aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-06-13 12:19:22 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-06-13 13:09:13 +0200
commit86efe83177cd1aa8bede79f3f87721585129872a (patch)
treec49bee7989c726b40766d9bd2e452883526a6cca
parent3323c5f353af9d9de29528a086cbe9b103e268ea (diff)
downloadffmpeg-86efe83177cd1aa8bede79f3f87721585129872a.tar.gz
avcodec/jpeg2000dec: Fix x/y step TODO for CPRL
No testcase known Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/jpeg2000dec.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index c83494ce8a..f502151095 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -963,15 +963,20 @@ static int jpeg2000_decode_packets(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile
for (compno = 0; compno < s->ncomponents; compno++) {
Jpeg2000CodingStyle *codsty = tile->codsty + compno;
Jpeg2000QuantStyle *qntsty = tile->qntsty + compno;
+ int step_x = 32;
+ int step_y = 32;
+
+ for (reslevelno = 0; reslevelno < codsty->nreslevels; reslevelno++) {
+ uint8_t reducedresno = codsty->nreslevels - 1 -reslevelno; // ==> N_L - r
+ Jpeg2000ResLevel *rlevel = tile->comp[compno].reslevel + reslevelno;
+ step_x = FFMIN(step_x, rlevel->log2_prec_width + reducedresno);
+ step_y = FFMIN(step_y, rlevel->log2_prec_height + reducedresno);
+ }
+ step_x = 1<<step_x;
+ step_y = 1<<step_y;
- /* Position loop (y axis)
- * TODO: Automate computing of step 256.
- * Fixed here, but to be computed before entering here. */
- for (y = 0; y < s->height; y += 256) {
- /* Position loop (y axis)
- * TODO: automate computing of step 256.
- * Fixed here, but to be computed before entering here. */
- for (x = 0; x < s->width; x += 256) {
+ for (y = 0; y < s->height; y += step_y) {
+ for (x = 0; x < s->width; x += step_x) {
for (reslevelno = 0; reslevelno < codsty->nreslevels; reslevelno++) {
uint16_t prcx, prcy;
uint8_t reducedresno = codsty->nreslevels - 1 -reslevelno; // ==> N_L - r