diff mbox series

[FFmpeg-devel,2/3] libavcodec/jpeg2000dec.c: fix error in cod marker

Message ID 20200411064009.5321-2-gautamramk@gmail.com
State Accepted
Commit e8344f21e16b7043411830cea99304169127dacf
Headers show
Series [FFmpeg-devel,1/3] libavcodec/jpeg2000: fix cblk decode error check
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Gautam Ramakrishnan April 11, 2020, 6:40 a.m. UTC
From: Gautam Ramakrishnan <gautamramk@gmail.com>

This patch fixes an error where the COC marker
overrides all data of the SPcod field of the
COD marker. It must override only one bit of
SPcod field. This now allows p0_08.j2k to be
decoded correctly (mentioned in #4679).
---
 libavcodec/jpeg2000dec.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Michael Niedermayer April 11, 2020, 4:23 p.m. UTC | #1
On Sat, Apr 11, 2020 at 12:10:08PM +0530, gautamramk@gmail.com wrote:
> From: Gautam Ramakrishnan <gautamramk@gmail.com>
> 
> This patch fixes an error where the COC marker
> overrides all data of the SPcod field of the
> COD marker. It must override only one bit of
> SPcod field. This now allows p0_08.j2k to be
> decoded correctly (mentioned in #4679).
> ---
>  libavcodec/jpeg2000dec.c | 3 +++
>  1 file changed, 3 insertions(+)

will apply

thx

[...]
diff mbox series

Patch

diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 2f6bdeb6e0..e7841a65b1 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -566,6 +566,7 @@  static int get_coc(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c,
                    uint8_t *properties)
 {
     int compno, ret;
+    uint8_t has_eph;
 
     if (bytestream2_get_bytes_left(&s->g) < 2) {
         av_log(s->avctx, AV_LOG_ERROR, "Insufficient space for COC\n");
@@ -582,7 +583,9 @@  static int get_coc(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c,
     }
 
     c      += compno;
+    has_eph = c->csty & JPEG2000_CSTY_EPH;
     c->csty = bytestream2_get_byteu(&s->g);
+    c->csty |= has_eph; //do not override eph present bits from COD
 
     if ((ret = get_cox(s, c)) < 0)
         return ret;