summaryrefslogtreecommitdiff
path: root/libavcodec/j2k.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-05-27 14:55:46 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-05-27 15:13:51 +0200
commita05db52c12f08463005cce4c13c86edd51f21fa3 (patch)
tree4244b2bbdf2334431b2b9d3693ee3a36d90738bc /libavcodec/j2k.c
parent81ccc31f75e0e4c35f345784e58244d846a5d862 (diff)
j2k: remove cblk from band
cblk is now in the same place as in jpeg2000, which will simplify merging the 2 decoders Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/j2k.c')
-rw-r--r--libavcodec/j2k.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/libavcodec/j2k.c b/libavcodec/j2k.c
index ba7a8e542b..f93a99d2e0 100644
--- a/libavcodec/j2k.c
+++ b/libavcodec/j2k.c
@@ -306,11 +306,6 @@ int ff_j2k_init_component(Jpeg2000Component *comp,
band->cblknx = ff_jpeg2000_ceildiv(band->cblknx, dx);
band->cblkny = ff_jpeg2000_ceildiv(band->cblkny, dy);
- band->cblk = av_malloc_array(band->cblknx *
- band->cblkny,
- sizeof(*band->cblk));
- if (!band->cblk)
- return AVERROR(ENOMEM);
band->prec = av_malloc_array(reslevel->num_precincts_x *
reslevel->num_precincts_y,
sizeof(*band->prec));
@@ -399,11 +394,9 @@ int ff_j2k_init_component(Jpeg2000Component *comp,
if (!prec->zerobits)
return AVERROR(ENOMEM);
-// prec->cblk = av_malloc_array(prec->nb_codeblocks_width *
-// prec->nb_codeblocks_height,
-// sizeof(*prec->cblk));
- prec->cblk = band->cblk;
- av_assert0(nb_precincts == 1);
+ prec->cblk = av_malloc_array(prec->nb_codeblocks_width *
+ prec->nb_codeblocks_height,
+ sizeof(*prec->cblk));
if (!prec->cblk)
return AVERROR(ENOMEM);
for (cblkno = 0; cblkno < prec->nb_codeblocks_width * prec->nb_codeblocks_height; cblkno++) {
@@ -461,11 +454,11 @@ void ff_j2k_reinit(Jpeg2000Component *comp, Jpeg2000CodingStyle *codsty)
Jpeg2000Prec *prec = band->prec + precno;
tag_tree_zero(prec->zerobits, prec->xi1 - prec->xi0, prec->yi1 - prec->yi0);
tag_tree_zero(prec->cblkincl, prec->xi1 - prec->xi0, prec->yi1 - prec->yi0);
- }
- for (cblkno = 0; cblkno < band->cblknx * band->cblkny; cblkno++) {
- Jpeg2000Cblk *cblk = band->cblk + cblkno;
- cblk->length = 0;
- cblk->lblock = 3;
+ for (cblkno = 0; cblkno < prec->nb_codeblocks_width * prec->nb_codeblocks_height; cblkno++) {
+ Jpeg2000Cblk *cblk = prec->cblk + cblkno;
+ cblk->length = 0;
+ cblk->lblock = 3;
+ }
}
}
}
@@ -483,8 +476,8 @@ void ff_j2k_cleanup(Jpeg2000Component *comp, Jpeg2000CodingStyle *codsty)
Jpeg2000Prec *prec = band->prec + precno;
av_freep(&prec->zerobits);
av_freep(&prec->cblkincl);
+ av_freep(&prec->cblk);
}
- av_freep(&band->cblk);
av_freep(&band->prec);
}
av_freep(&reslevel->band);