mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-13 21:28:01 +02:00
jpeg2000: Compute quantization for 'scalar derived' in the correct case.
Scalar derived case is represented by the JPEG2K_QSTY_SI define. Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
This commit is contained in:
parent
4e11b15534
commit
952f7ed3c0
@ -284,14 +284,14 @@ int ff_jpeg2000_init_component(Jpeg2000Component *comp,
|
|||||||
int numbps;
|
int numbps;
|
||||||
case JPEG2000_QSTY_NONE:
|
case JPEG2000_QSTY_NONE:
|
||||||
/* TODO: to verify. No quantization in this case */
|
/* TODO: to verify. No quantization in this case */
|
||||||
numbps = cbps +
|
band->f_stepsize = 1;
|
||||||
lut_gain[codsty->transform][bandno + (reslevelno > 0)];
|
|
||||||
band->stepsize = (float)SHL(2048 + qntsty->mant[gbandno],
|
|
||||||
2 + numbps - qntsty->expn[gbandno]);
|
|
||||||
break;
|
break;
|
||||||
case JPEG2000_QSTY_SI:
|
case JPEG2000_QSTY_SI:
|
||||||
/*TODO: Compute formula to implement. */
|
/*TODO: Compute formula to implement. */
|
||||||
band->stepsize = (float) (1 << 13);
|
numbps = cbps +
|
||||||
|
lut_gain[codsty->transform == FF_DWT53][bandno + (reslevelno > 0)];
|
||||||
|
band->stepsize = (float)SHL(2048 + qntsty->mant[gbandno],
|
||||||
|
2 + numbps - qntsty->expn[gbandno]);
|
||||||
break;
|
break;
|
||||||
case JPEG2000_QSTY_SE:
|
case JPEG2000_QSTY_SE:
|
||||||
/* Exponent quantization step.
|
/* Exponent quantization step.
|
||||||
@ -305,15 +305,15 @@ int ff_jpeg2000_init_component(Jpeg2000Component *comp,
|
|||||||
gain = cbps;
|
gain = cbps;
|
||||||
band->stepsize = pow(2.0, gain - qntsty->expn[gbandno]);
|
band->stepsize = pow(2.0, gain - qntsty->expn[gbandno]);
|
||||||
band->stepsize *= (float)qntsty->mant[gbandno] / 2048.0 + 1.0;
|
band->stepsize *= (float)qntsty->mant[gbandno] / 2048.0 + 1.0;
|
||||||
/* FIXME: In openjepg code stespize = stepsize * 0.5. Why?
|
|
||||||
* If not set output of entropic decoder is not correct. */
|
|
||||||
band->stepsize *= 0.5;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
band->stepsize = 0;
|
band->stepsize = 0;
|
||||||
av_log(avctx, AV_LOG_ERROR, "Unknown quantization format\n");
|
av_log(avctx, AV_LOG_ERROR, "Unknown quantization format\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
/* FIXME: In openjepg code stespize = stepsize * 0.5. Why?
|
||||||
|
* If not set output of entropic decoder is not correct. */
|
||||||
|
band->stepsize *= 0.5;
|
||||||
/* BITEXACT computing case --> convert to int */
|
/* BITEXACT computing case --> convert to int */
|
||||||
if (avctx->flags & CODEC_FLAG_BITEXACT)
|
if (avctx->flags & CODEC_FLAG_BITEXACT)
|
||||||
band->stepsize = (int32_t)(band->stepsize * (1 << 16));
|
band->stepsize = (int32_t)(band->stepsize * (1 << 16));
|
||||||
|
Loading…
Reference in New Issue
Block a user