uint8_t properties[4];
Jpeg2000CodingStyle codsty[4];
Jpeg2000QuantStyle qntsty[4];
- Jpeg2000TilePart tile_part[32];
+ Jpeg2000TilePart tile_part[256];
uint16_t tp_idx; // Tile-part index
} Jpeg2000Tile;
return AVERROR_INVALIDDATA;
}
- if (c->log2_cblk_width > 6 || c->log2_cblk_height > 6) {
- avpriv_request_sample(s->avctx, "cblk size > 64");
+ if (c->log2_cblk_width > 7 || c->log2_cblk_height > 7) {
+ avpriv_request_sample(s->avctx, "cblk size > 128");
return AVERROR_PATCHWELCOME;
}
Jpeg2000TilePart *tp;
uint16_t Isot;
uint32_t Psot;
- uint8_t TPsot;
+ unsigned TPsot;
if (bytestream2_get_bytes_left(&s->g) < 8)
return AVERROR_INVALIDDATA;
return AVERROR_INVALIDDATA;
}
- if (TPsot >= FF_ARRAY_ELEMS(s->tile[Isot].tile_part)) {
- avpriv_request_sample(s->avctx, "Support for %"PRIu8" components", TPsot);
- return AVERROR_PATCHWELCOME;
- }
+ av_assert0(TPsot < FF_ARRAY_ELEMS(s->tile[Isot].tile_part));
s->tile[Isot].tp_idx = TPsot;
tp = s->tile[Isot].tile_part + TPsot;
precno = prcx + rlevel->num_precincts_x * prcy;
+ ok_reslevel = 1;
if (prcx >= rlevel->num_precincts_x || prcy >= rlevel->num_precincts_y) {
av_log(s->avctx, AV_LOG_WARNING, "prc %d %d outside limits %d %d\n",
prcx, prcy, rlevel->num_precincts_x, rlevel->num_precincts_y);
continue;
}
- ok_reslevel = 1;
for (layno = 0; layno < tile->codsty[0].nlayers; layno++) {
if ((ret = jpeg2000_decode_packet(s, tile, &tp_index,
codsty, rlevel,
for (j = 0; j < (cblk->coord[1][1] - cblk->coord[1][0]); ++j) {
int32_t *datap = &comp->i_data[(comp->coord[0][1] - comp->coord[0][0]) * (y + j) + x];
int *src = t1->data[j];
- for (i = 0; i < w; ++i)
- datap[i] = (src[i] * band->i_stepsize) / 32768;
+ if (band->i_stepsize == 16384) {
+ for (i = 0; i < w; ++i)
+ datap[i] = src[i] / 2;
+ } else {
+ // This should be VERY uncommon
+ for (i = 0; i < w; ++i)
+ datap[i] = (src[i] * (int64_t)band->i_stepsize) / 32768;
+ }
}
}
int32_t *datap = &comp->i_data[(comp->coord[0][1] - comp->coord[0][0]) * (y + j) + x];
int *src = t1->data[j];
for (i = 0; i < w; ++i)
- datap[i] = (src[i] * band->i_stepsize + (1<<14)) >> 15;
+ datap[i] = (src[i] * (int64_t)band->i_stepsize + (1<<14)) >> 15;
}
}