diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-06-12 03:06:56 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-06-12 03:12:54 +0200 |
commit | dc73c7adc0284871af34100a6062378c07a63569 (patch) | |
tree | e4d58b5aaf6c2041408da7957672b128e5d7a5ec /libavcodec/jpeg2000.h | |
parent | eea92133a16e7e0a837ad680afd4a05d08683a61 (diff) | |
download | ffmpeg-dc73c7adc0284871af34100a6062378c07a63569.tar.gz |
avcodec/jpeg2000dec: Fix Selective arithmetic coding bypass and Multiple codeword segments
These 2 are highly related so they are in the same commit
Fixes part of Ticket4605
Fixes p0_04.j2k
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/jpeg2000.h')
-rw-r--r-- | libavcodec/jpeg2000.h | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/libavcodec/jpeg2000.h b/libavcodec/jpeg2000.h index 46067c871c..6ff0e90923 100644 --- a/libavcodec/jpeg2000.h +++ b/libavcodec/jpeg2000.h @@ -163,11 +163,15 @@ typedef struct Jpeg2000Cblk { uint8_t ninclpasses; // number coding of passes included in codestream uint8_t nonzerobits; uint16_t length; - uint16_t lengthinc; + uint16_t lengthinc[JPEG2000_MAX_PASSES]; + uint8_t nb_lengthinc; uint8_t lblock; uint8_t zero; uint8_t data[8192]; - Jpeg2000Pass passes[100]; + int nb_terminations; + int nb_terminationsinc; + int data_start[JPEG2000_MAX_PASSES]; + Jpeg2000Pass passes[JPEG2000_MAX_PASSES]; uint16_t coord[2][2]; // border coordinates {{x0, x1}, {y0, y1}} } Jpeg2000Cblk; // code block @@ -264,4 +268,21 @@ void ff_jpeg2000_reinit(Jpeg2000Component *comp, Jpeg2000CodingStyle *codsty); void ff_jpeg2000_cleanup(Jpeg2000Component *comp, Jpeg2000CodingStyle *codsty); +static inline int needs_termination(int style, int passno) { + if (style & JPEG2000_CBLK_BYPASS) { + int type = passno % 3; + passno /= 3; + if (type == 0 && passno > 2) + return 2; + if (type == 2 && passno > 2) + return 1; + if (style & JPEG2000_CBLK_TERMALL) { + return passno > 2 ? 2 : 1; + } + } + if (style & JPEG2000_CBLK_TERMALL) + return 1; + return 0; +} + #endif /* AVCODEC_JPEG2000_H */ |