summaryrefslogtreecommitdiff
path: root/libavcodec/jpeg2000dec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-06-26 04:26:05 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-06-26 05:25:42 +0200
commit50b77e364f0a8c94de523e1d5afcd2be0a9a0384 (patch)
treef6cf531d698e47de3c4e1095c3dc7b17fc7e9f5d /libavcodec/jpeg2000dec.c
parent6c4a2f11ddde59719e672a09d519f031a2d3a20c (diff)
avcodec/jpeg2000dec: iterate over positions with the special cases from jpeg2000
The order in j2k is not the simple and logic one Fixes Ticket4670 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/jpeg2000dec.c')
-rw-r--r--libavcodec/jpeg2000dec.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 7e1fc5e775..4ba8bcf9d6 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -1163,9 +1163,8 @@ static int jpeg2000_decode_packets(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile
step_x = 1<<step_x;
step_y = 1<<step_y;
- //FIXME we could iterate over less than the whole image
- for (y = 0; y < s->height; y += step_y) {
- for (x = 0; x < s->width; x += step_x) {
+ for (y = tile->coord[1][0]; y < tile->coord[1][1]; y = (y/step_y + 1)*step_y) {
+ for (x = tile->coord[0][0]; x < tile->coord[0][1]; x = (x/step_x + 1)*step_x) {
for (compno = 0; compno < s->ncomponents; compno++) {
Jpeg2000Component *comp = tile->comp + compno;
Jpeg2000CodingStyle *codsty = tile->codsty + compno;
@@ -1178,10 +1177,10 @@ static int jpeg2000_decode_packets(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile
uint8_t reducedresno = codsty->nreslevels - 1 -reslevelno; // ==> N_L - r
Jpeg2000ResLevel *rlevel = comp->reslevel + reslevelno;
- if (yc % (1 << (rlevel->log2_prec_height + reducedresno)))
+ if (yc % (1 << (rlevel->log2_prec_height + reducedresno)) && y != tile->coord[1][0]) //FIXME this is a subset of the check
continue;
- if (xc % (1 << (rlevel->log2_prec_width + reducedresno)))
+ if (xc % (1 << (rlevel->log2_prec_width + reducedresno)) && x != tile->coord[0][0]) //FIXME this is a subset of the check
continue;
// check if a precinct exists