diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-06-24 17:05:42 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-06-24 17:05:42 +0200 |
commit | 05ef6324d11017420a087150f2addbb18cdb9ad3 (patch) | |
tree | 08bba1737ee1795a07722782294479e153b14f8d /libavcodec/jpeg2000dec.c | |
parent | 8ff09e90986941942f4dc9eb3dc11073215589a3 (diff) | |
download | ffmpeg-streaming-05ef6324d11017420a087150f2addbb18cdb9ad3.zip ffmpeg-streaming-05ef6324d11017420a087150f2addbb18cdb9ad3.tar.gz |
avcodec/jpeg2000dec: Add 5/3 de-quantization special case for the lossless case
This avoids a multiplication and 64bits
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/jpeg2000dec.c')
-rw-r--r-- | libavcodec/jpeg2000dec.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c index be78660..11f4cd6 100644 --- a/libavcodec/jpeg2000dec.c +++ b/libavcodec/jpeg2000dec.c @@ -1436,8 +1436,14 @@ static void dequantization_int(int x, int y, Jpeg2000Cblk *cblk, for (j = 0; j < (cblk->coord[1][1] - cblk->coord[1][0]); ++j) { int32_t *datap = &comp->i_data[(comp->coord[0][1] - comp->coord[0][0]) * (y + j) + x]; int *src = t1->data[j]; - for (i = 0; i < w; ++i) - datap[i] = (src[i] * (int64_t)band->i_stepsize) / 32768; + if (band->i_stepsize == 16384) { + for (i = 0; i < w; ++i) + datap[i] = src[i] / 2; + } else { + // This should be VERY uncommon + for (i = 0; i < w; ++i) + datap[i] = (src[i] * (int64_t)band->i_stepsize) / 32768; + } } } |