summaryrefslogtreecommitdiff
path: root/libavcodec/jpeg2000.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-06-22 01:30:33 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-06-22 01:36:05 +0200
commit1c495b0bf690995c45f79f4f19500921e14ec78a (patch)
treed5ef046b1289363a74f1d54e8ee609ec8a6649a4 /libavcodec/jpeg2000.c
parent6504047f82866fdc0e2a5422ad7fecb44740e9d6 (diff)
avcodec/jpeg2000: Move gainb handling into the quantization code
thats how the specification defines it, this also improves numerical accuracy of the integer wavelet implementation. It otherwise should be equivalent, in case of overflows this can be reverted. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/jpeg2000.c')
-rw-r--r--libavcodec/jpeg2000.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/libavcodec/jpeg2000.c b/libavcodec/jpeg2000.c
index 427f6f7423..3bb55786b7 100644
--- a/libavcodec/jpeg2000.c
+++ b/libavcodec/jpeg2000.c
@@ -305,9 +305,6 @@ int ff_jpeg2000_init_component(Jpeg2000Component *comp,
* delta_b = 2 ^ (R_b - expn_b) * (1 + (mant_b / 2 ^ 11))
* R_b = R_I + log2 (gain_b )
* see ISO/IEC 15444-1:2002 E.1.1 eqn. E-3 and E-4 */
- /* TODO/WARN: value of log2 (gain_b ) not taken into account
- * but it works (compared to OpenJPEG). Why?
- * Further investigation needed. */
gain = cbps;
band->f_stepsize = pow(2.0, gain - qntsty->expn[gbandno]);
band->f_stepsize *= qntsty->mant[gbandno] / 2048.0 + 1.0;
@@ -317,6 +314,8 @@ int ff_jpeg2000_init_component(Jpeg2000Component *comp,
av_log(avctx, AV_LOG_ERROR, "Unknown quantization format\n");
break;
}
+ band->f_stepsize *= 1<<lut_gain[codsty->transform != FF_DWT53][bandno + (reslevelno > 0)];
+
/* FIXME: In openjepg code stespize = stepsize * 0.5. Why?
* If not set output of entropic decoder is not correct. */
if (!av_codec_is_encoder(avctx->codec))