|
@@ -271,6 +271,17 @@ static int get_siz(Jpeg2000DecoderContext *s)
|
|
|
return AVERROR_INVALIDDATA;
|
|
return AVERROR_INVALIDDATA;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ for (i = 0; i < s->ncomponents; i++) {
|
|
|
|
|
+ if (s->cdef[i] < 0) {
|
|
|
|
|
+ for (i = 0; i < s->ncomponents; i++) {
|
|
|
|
|
+ s->cdef[i] = i + 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ if ((s->ncomponents & 1) == 0)
|
|
|
|
|
+ s->cdef[s->ncomponents-1] = 0;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ // after here we no longer have to consider negative cdef
|
|
|
|
|
+
|
|
|
for (i = 0; i < s->ncomponents; i++) { // Ssiz_i XRsiz_i, YRsiz_i
|
|
for (i = 0; i < s->ncomponents; i++) { // Ssiz_i XRsiz_i, YRsiz_i
|
|
|
uint8_t x = bytestream2_get_byteu(&s->g);
|
|
uint8_t x = bytestream2_get_byteu(&s->g);
|
|
|
s->cbps[i] = (x & 0x7f) + 1;
|
|
s->cbps[i] = (x & 0x7f) + 1;
|
|
@@ -2885,17 +2896,6 @@ static int jpeg2000_decode_frame(AVCodecContext *avctx, AVFrame *picture,
|
|
|
if (ret = jpeg2000_read_bitstream_packets(s))
|
|
if (ret = jpeg2000_read_bitstream_packets(s))
|
|
|
goto end;
|
|
goto end;
|
|
|
|
|
|
|
|
- for (int x = 0; x < s->ncomponents; x++) {
|
|
|
|
|
- if (s->cdef[x] < 0) {
|
|
|
|
|
- for (x = 0; x < s->ncomponents; x++) {
|
|
|
|
|
- s->cdef[x] = x + 1;
|
|
|
|
|
- }
|
|
|
|
|
- if ((s->ncomponents & 1) == 0)
|
|
|
|
|
- s->cdef[s->ncomponents-1] = 0;
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
for (int x = 0; x < s->ncomponents && s->codsty[x].transform == FF_DWT53;)
|
|
for (int x = 0; x < s->ncomponents && s->codsty[x].transform == FF_DWT53;)
|
|
|
if (++x == s->ncomponents)
|
|
if (++x == s->ncomponents)
|
|
|
picture->flags |= AV_FRAME_FLAG_LOSSLESS;
|
|
picture->flags |= AV_FRAME_FLAG_LOSSLESS;
|