summaryrefslogtreecommitdiff
path: root/libavcodec/jpegls.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-02-13 23:51:37 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-02-14 01:22:38 +0100
commit387783749faca39c98571d139c32866923ab5653 (patch)
tree2b62e17dc7b32af43a699bfdbaffe871c9bc4cc5 /libavcodec/jpegls.c
parent00ab9cdae1a96dfea33cd505076a83823f390aa4 (diff)
downloadffmpeg-387783749faca39c98571d139c32866923ab5653.tar.gz
jpeglsdec: fix bpp & limit.
Fixes: Tikcet969 Thanks-to: ITU for the freely available spec. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/jpegls.c')
-rw-r--r--libavcodec/jpegls.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/libavcodec/jpegls.c b/libavcodec/jpegls.c
index c40b929e95..f1ce16e0d8 100644
--- a/libavcodec/jpegls.c
+++ b/libavcodec/jpegls.c
@@ -36,10 +36,8 @@ void ff_jpegls_init_state(JLSState *state){
// QBPP = ceil(log2(RANGE))
for(state->qbpp = 0; (1 << state->qbpp) < state->range; state->qbpp++);
- if(state->bpp < 8)
- state->limit = 16 + 2 * state->bpp - state->qbpp;
- else
- state->limit = (4 * state->bpp) - state->qbpp;
+ state->bpp = FFMAX(av_log2(state->maxval)+1, 2);
+ state->limit = 2*(state->bpp + FFMAX(state->bpp, 8)) - state->qbpp;
for(i = 0; i < 367; i++) {
state->A[i] = FFMAX((state->range + 32) >> 6, 2);