diff mbox series

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

Message ID 20200410173903.19636-1-gautamramk@gmail.com
State Accepted
Headers show
Series [FFmpeg-devel] libavcodec/jpeg2000dec.c: fix error in cod marker | expand

Checks

Context Check Description
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Gautam Ramakrishnan April 10, 2020, 5:39 p.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

Carl Eugen Hoyos April 10, 2020, 8:55 p.m. UTC | #1
Am Fr., 10. Apr. 2020 um 20:28 Uhr schrieb <gautamramk@gmail.com>:
>
> 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).

This patch makes p0_08.j2k decoding bit-exact,
the other sample is in
http://samples.ffmpeg.org/ffmpeg-bugs/trac/ticket4679/

Carl Eugen
Gautam Ramakrishnan April 11, 2020, 2:46 a.m. UTC | #2
On Sat, Apr 11, 2020 at 2:25 AM Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
>
> Am Fr., 10. Apr. 2020 um 20:28 Uhr schrieb <gautamramk@gmail.com>:
> >
> > 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).
>
> This patch makes p0_08.j2k decoding bit-exact,
> the other sample is in
> http://samples.ffmpeg.org/ffmpeg-bugs/trac/ticket4679/
>
> Carl Eugen
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

Hi Carl,

Have been debugging the other sample. Looks like
the numeric calculations with initialization of bands
precincts and codeblock is slightly wrong. I shall
try fixing it.
diff mbox series

Patch

diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 9684e57b34..290589934a 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;
 
     if ((ret = get_cox(s, c)) < 0)
         return ret;