[FFmpeg-cvslog] avcodec/jpeg2000dec: Improve readability of SOP check

Michael Niedermayer git at videolan.org
Mon Jun 15 13:42:53 CEST 2015


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon Jun 15 04:21:40 2015 +0200| [4ec14ce121df4c33880251a96c2f3e7409eb14fe] | committer: Michael Niedermayer

avcodec/jpeg2000dec: Improve readability of SOP check

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

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

 libavcodec/jpeg2000.h    |    3 +++
 libavcodec/jpeg2000dec.c |    4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavcodec/jpeg2000.h b/libavcodec/jpeg2000.h
index 6ff0e909..1054fe6 100644
--- a/libavcodec/jpeg2000.h
+++ b/libavcodec/jpeg2000.h
@@ -58,6 +58,9 @@ enum Jpeg2000Markers {
     JPEG2000_EOC = 0xffd9, // end of codestream
 };
 
+#define JPEG2000_SOP_FIXED_BYTES 0xFF910004
+#define JPEG2000_SOP_BYTE_LENGTH 6
+
 enum Jpeg2000Quantsty { // quantization style
     JPEG2000_QSTY_NONE, // no quantization
     JPEG2000_QSTY_SI,   // scalar derived
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 5ec929d..8df6168 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -812,8 +812,8 @@ static int jpeg2000_decode_packet(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile,
         }
     }
 
-    if (bytestream2_peek_be32(&s->g) == 0xFF910004)
-        bytestream2_skip(&s->g, 6);
+    if (bytestream2_peek_be32(&s->g) == JPEG2000_SOP_FIXED_BYTES)
+        bytestream2_skip(&s->g, JPEG2000_SOP_BYTE_LENGTH);
 
     if (!(ret = get_bits(s, 1))) {
         jpeg2000_flush(s);



More information about the ffmpeg-cvslog mailing list