Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGautam Ramakrishnan <gautamramk@gmail.com>2020-04-22 21:34:39 +0300
committerMichael Niedermayer <michael@niedermayer.cc>2020-04-22 23:57:38 +0300
commit6bd4a261689b2f464fba5d94f9c185c333ac947a (patch)
tree03de782d4a6ab8e250d84c54f0d514d1e50b5eda /libavcodec/jpeg2000dec.c
parentb4a33387cb1cd3f4c5036e65e0fdd953c6b5012f (diff)
libavcodec/jpeg2000dec.c: Support for CRG marker
This patch adds support to skip the CRG marker. The CRG marker, is an informational marker. Allows samples such as p0_03.j2k to be decoded. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/jpeg2000dec.c')
-rw-r--r--libavcodec/jpeg2000dec.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index af6dcee228..5a7d9e7882 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -798,6 +798,15 @@ static int get_sot(Jpeg2000DecoderContext *s, int n)
return 0;
}
+static int read_crg(Jpeg2000DecoderContext *s, int n)
+{
+ if (s->ncomponents*4 != n - 2) {
+ av_log(s->avctx, AV_LOG_ERROR, "Invalid CRG marker.\n");
+ return AVERROR_INVALIDDATA;
+ }
+ bytestream2_skip(&s->g, n - 2);
+ return 0;
+}
/* Tile-part lengths: see ISO 15444-1:2002, section A.7.1
* Used to know the number of tile parts and lengths.
* There may be multiple TLMs in the header.
@@ -2061,6 +2070,9 @@ static int jpeg2000_read_main_headers(Jpeg2000DecoderContext *s)
// the comment is ignored
bytestream2_skip(&s->g, len - 2);
break;
+ case JPEG2000_CRG:
+ ret = read_crg(s, len);
+ break;
case JPEG2000_TLM:
// Tile-part lengths
ret = get_tlm(s, len);