Commit 6bd4a261 authored by Gautam Ramakrishnan's avatar Gautam Ramakrishnan Committed by Michael Niedermayer

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: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent b4a33387
...@@ -798,6 +798,15 @@ static int get_sot(Jpeg2000DecoderContext *s, int n) ...@@ -798,6 +798,15 @@ static int get_sot(Jpeg2000DecoderContext *s, int n)
return 0; 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 /* Tile-part lengths: see ISO 15444-1:2002, section A.7.1
* Used to know the number of tile parts and lengths. * Used to know the number of tile parts and lengths.
* There may be multiple TLMs in the header. * There may be multiple TLMs in the header.
...@@ -2061,6 +2070,9 @@ static int jpeg2000_read_main_headers(Jpeg2000DecoderContext *s) ...@@ -2061,6 +2070,9 @@ static int jpeg2000_read_main_headers(Jpeg2000DecoderContext *s)
// the comment is ignored // the comment is ignored
bytestream2_skip(&s->g, len - 2); bytestream2_skip(&s->g, len - 2);
break; break;
case JPEG2000_CRG:
ret = read_crg(s, len);
break;
case JPEG2000_TLM: case JPEG2000_TLM:
// Tile-part lengths // Tile-part lengths
ret = get_tlm(s, len); ret = get_tlm(s, len);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment