summaryrefslogtreecommitdiff
path: root/libavcodec/jpegls.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec/jpegls.c')
-rw-r--r--libavcodec/jpegls.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/libavcodec/jpegls.c b/libavcodec/jpegls.c
index bbe1a04e56..e3e81c4497 100644
--- a/libavcodec/jpegls.c
+++ b/libavcodec/jpegls.c
@@ -3,20 +3,20 @@
* Copyright (c) 2003 Michael Niedermayer
* Copyright (c) 2006 Konstantin Shishkov
*
- * This file is part of Libav.
+ * This file is part of FFmpeg.
*
- * Libav is free software; you can redistribute it and/or
+ * FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
- * Libav is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with Libav; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@@ -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);