Commit 4e926fb9 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/jpeg2000: Move L band scaling from the 9/7f wavelet to quantization stage

This reduces the number of operations
Its not done for 9/7i as that would overflow thanks to JPEG2000 allowing
32 decomposition levels
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent b1fdf81c
......@@ -315,15 +315,20 @@ int ff_jpeg2000_init_component(Jpeg2000Component *comp,
break;
}
if (codsty->transform != FF_DWT53) {
int lband = 0;
switch (bandno + (reslevelno > 0)) {
case 1:
case 2:
band->f_stepsize *= F_LFTG_X * 2;
lband = 1;
break;
case 3:
band->f_stepsize *= F_LFTG_X * F_LFTG_X * 4;
break;
}
if (codsty->transform == FF_DWT97) {
band->f_stepsize *= pow(F_LFTG_K, 2*(codsty->nreslevels2decode - reslevelno) + lband - 2);
}
}
/* FIXME: In openjepg code stespize = stepsize * 0.5. Why?
* If not set output of entropic decoder is not correct. */
......
......@@ -196,7 +196,7 @@ static void dwt_encode97_float(DWTContext *s, float *t)
// copy back and deinterleave
for (i = mh; i < lh; i+=2, j++)
t[w*lp + j] = F_LFTG_X * l[i];
t[w*lp + j] = l[i];
for (i = 1-mh; i < lh; i+=2, j++)
t[w*lp + j] = l[i];
}
......@@ -213,7 +213,7 @@ static void dwt_encode97_float(DWTContext *s, float *t)
// copy back and deinterleave
for (i = mv; i < lv; i+=2, j++)
t[w*j + lp] = F_LFTG_X * l[i];
t[w*j + lp] = l[i];
for (i = 1-mv; i < lv; i+=2, j++)
t[w*j + lp] = l[i];
}
......@@ -421,7 +421,7 @@ static void dwt_decode97_float(DWTContext *s, float *t)
int i, j = 0;
// copy with interleaving
for (i = mh; i < lh; i += 2, j++)
l[i] = data[w * lp + j] * F_LFTG_K;
l[i] = data[w * lp + j];
for (i = 1 - mh; i < lh; i += 2, j++)
l[i] = data[w * lp + j];
......@@ -437,7 +437,7 @@ static void dwt_decode97_float(DWTContext *s, float *t)
int i, j = 0;
// copy with interleaving
for (i = mv; i < lv; i += 2, j++)
l[i] = data[w * j + lp] * F_LFTG_K;
l[i] = data[w * j + lp];
for (i = 1 - mv; i < lv; i += 2, j++)
l[i] = data[w * j + lp];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment