[FFmpeg-devel] [PATCH]j2k: Increase cblk size to maximum value

Carl Eugen Hoyos cehoyos at ag.or.at
Thu Jun 25 23:04:12 CEST 2015


Hi!

Attached patch fixes ticket #4672 for me.
My old valgrind reports many (!) invalid memory accesses with the patch, 
but the line numbers make no sense so this may be a valgrind issue.
The memory footprint with the patch is still a magnitude lower than 
for the sample from ticket #4648 (without patch).

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavcodec/jpeg2000.h b/libavcodec/jpeg2000.h
index 24395a2..15fd6b5 100644
--- a/libavcodec/jpeg2000.h
+++ b/libavcodec/jpeg2000.h
@@ -67,8 +67,8 @@ enum Jpeg2000Quantsty { // quantization style
     JPEG2000_QSTY_SE    // scalar expounded
 };
 
-#define JPEG2000_MAX_CBLKW 128
-#define JPEG2000_MAX_CBLKH 128
+#define JPEG2000_MAX_CBLKW 1024
+#define JPEG2000_MAX_CBLKH 1024
 
 
 #define JPEG2000_MAX_DECLEVELS 32
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 3d518e3..39e94ba 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -439,11 +439,6 @@ static int get_cox(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c)
         return AVERROR_INVALIDDATA;
     }
 
-    if (c->log2_cblk_width > 7 || c->log2_cblk_height > 7) {
-        avpriv_request_sample(s->avctx, "cblk size > 128");
-        return AVERROR_PATCHWELCOME;
-    }
-
     c->cblk_style = bytestream2_get_byteu(&s->g);
     if (c->cblk_style != 0) { // cblk style
         av_log(s->avctx, AV_LOG_WARNING, "extra cblk styles %X\n", c->cblk_style);


More information about the ffmpeg-devel mailing list