[FFmpeg-cvslog] avcodec/jpeg2000dec: Fix high bit depth branch sample shift

Michael Niedermayer git at videolan.org
Tue Jun 9 01:02:41 CEST 2015


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon Jun  8 23:36:59 2015 +0200| [028c59c17b14751e049a05abbdac52f885ad96a2] | committer: Michael Niedermayer

avcodec/jpeg2000dec: Fix high bit depth branch sample shift

Fix part of Ticket3619

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=028c59c17b14751e049a05abbdac52f885ad96a2
---

 libavcodec/jpeg2000dec.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 1b441a5..6587e7d 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -1284,6 +1284,8 @@ static int jpeg2000_decode_tile(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile,
             }
         }
     } else {
+        int precision = picture->format == AV_PIX_FMT_XYZ12 ? 16 : s->precision;
+
         for (compno = 0; compno < s->ncomponents; compno++) {
             Jpeg2000Component *comp = tile->comp + compno;
             Jpeg2000CodingStyle *codsty = tile->codsty + compno;
@@ -1310,7 +1312,7 @@ static int jpeg2000_decode_tile(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile,
                         /* DC level shift and clip see ISO 15444-1:2002 G.1.2 */
                         val = av_clip(val, 0, (1 << cbps) - 1);
                         /* align 12 bit values in little-endian mode */
-                        *dst = val << (16 - cbps);
+                        *dst = val << (precision - cbps);
                         datap++;
                         dst += pixelsize;
                     }
@@ -1320,7 +1322,7 @@ static int jpeg2000_decode_tile(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile,
                         /* DC level shift and clip see ISO 15444-1:2002 G.1.2 */
                         val = av_clip(val, 0, (1 << cbps) - 1);
                         /* align 12 bit values in little-endian mode */
-                        *dst = val << (16 - cbps);
+                        *dst = val << (precision - cbps);
                         i_datap++;
                         dst += pixelsize;
                     }



More information about the ffmpeg-cvslog mailing list