[FFmpeg-cvslog] jpeg2000: Define the maximum decomposition levels

Luca Barbato git at videolan.org
Wed Jul 3 13:08:39 CEST 2013


ffmpeg | branch: master | Luca Barbato <lu_zero at gentoo.org> | Mon Jul  1 10:01:00 2013 +0200| [be3271009ef893fbed9640e8edbd771685fd957b] | committer: Luca Barbato

jpeg2000: Define the maximum decomposition levels

And define the resolution levels according.

Signed-off-by: Luca Barbato <lu_zero at gentoo.org>

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

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

diff --git a/libavcodec/jpeg2000.h b/libavcodec/jpeg2000.h
index 1e46f07..9282dd5 100644
--- a/libavcodec/jpeg2000.h
+++ b/libavcodec/jpeg2000.h
@@ -67,7 +67,9 @@ enum Jpeg2000Quantsty { // quantization style
 #define JPEG2000_MAX_CBLKW 64
 #define JPEG2000_MAX_CBLKH 64
 
-#define JPEG2000_MAX_RESLEVELS 33
+
+#define JPEG2000_MAX_DECLEVELS 32
+#define JPEG2000_MAX_RESLEVELS (JPEG2000_MAX_DECLEVELS + 1)
 
 // T1 flags
 // flags determining significance of neighbor coefficients
@@ -145,8 +147,8 @@ typedef struct Jpeg2000CodingStyle {
 } Jpeg2000CodingStyle;
 
 typedef struct Jpeg2000QuantStyle {
-    uint8_t expn[32 * 3];  // quantization exponent
-    uint32_t mant[32 * 3]; // quantization mantissa
+    uint8_t expn[JPEG2000_MAX_DECLEVELS * 3];  // quantization exponent
+    uint32_t mant[JPEG2000_MAX_DECLEVELS * 3]; // quantization mantissa
     uint8_t quantsty;      // quantization style
     uint8_t nguardbits;    // number of guard bits
 } Jpeg2000QuantStyle;
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 8fbe349..de13714 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -367,7 +367,7 @@ static int get_qcx(Jpeg2000DecoderContext *s, int n, Jpeg2000QuantStyle *q)
         x          = bytestream_get_be16(&s->buf);
         q->expn[0] = x >> 11;
         q->mant[0] = x & 0x7ff;
-        for (i = 1; i < 32 * 3; i++) {
+        for (i = 1; i < JPEG2000_MAX_DECLEVELS * 3; i++) {
             int curexpn = FFMAX(0, q->expn[0] - (i - 1) / 3);
             q->expn[i] = curexpn;
             q->mant[i] = q->mant[0];



More information about the ffmpeg-cvslog mailing list