Le 24/06/2013 17:14, Luca Barbato a écrit :
And define the resolution levels according.
---
  libavcodec/jpeg2k.h    | 8 +++++---
  libavcodec/jpeg2kdec.c | 2 +-
  2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/libavcodec/jpeg2k.h b/libavcodec/jpeg2k.h
index e7a8c3b..f3e11cb 100644
--- a/libavcodec/jpeg2k.h
+++ b/libavcodec/jpeg2k.h
@@ -67,7 +67,9 @@ enum Jpeg2KQuantsty { // quantization style
  #define JPEG2K_MAX_CBLKW 64
  #define JPEG2K_MAX_CBLKH 64

-#define JPEG2K_MAX_RESLEVELS 33
+
+#define JPEG2K_MAX_DECLEVELS 32
+#define JPEG2K_MAX_RESLEVELS JPEG2K_MAX_DECLEVELS + 1

  // T1 flags
  // flags determining significance of neighbor coefficients
@@ -145,8 +147,8 @@ typedef struct Jpeg2KCodingStyle {
  } Jpeg2KCodingStyle;

  typedef struct Jpeg2KQuantStyle {
-    uint8_t expn[32 * 3];  // quantization exponent
-    uint32_t mant[32 * 3]; // quantization mantissa
+    uint8_t expn[JPEG2K_MAX_DECLEVELS * 3];  // quantization exponent
+    uint32_t mant[JPEG2K_MAX_DECLEVELS * 3]; // quantization mantissa
      uint8_t quantsty;      // quantization style
      uint8_t nguardbits;    // number of guard bits
  } Jpeg2KQuantStyle;
diff --git a/libavcodec/jpeg2kdec.c b/libavcodec/jpeg2kdec.c
index 91793ce..d932710 100644
--- a/libavcodec/jpeg2kdec.c
+++ b/libavcodec/jpeg2kdec.c
@@ -366,7 +366,7 @@ static int get_qcx(Jpeg2KDecoderContext *s, int n, 
Jpeg2KQuantStyle *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 < JPEG2K_MAX_DECLEVELS * 3; i++) {
maybe try a avpriv_resuest_sample?
              int curexpn = FFMAX(0, q->expn[0] - (i - 1) / 3);
              q->expn[i] = curexpn;
              q->mant[i] = q->mant[0];


_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to