Commit a05db52c authored by Michael Niedermayer's avatar Michael Niedermayer

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: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 81ccc31f
...@@ -306,11 +306,6 @@ int ff_j2k_init_component(Jpeg2000Component *comp, ...@@ -306,11 +306,6 @@ int ff_j2k_init_component(Jpeg2000Component *comp,
band->cblknx = ff_jpeg2000_ceildiv(band->cblknx, dx); band->cblknx = ff_jpeg2000_ceildiv(band->cblknx, dx);
band->cblkny = ff_jpeg2000_ceildiv(band->cblkny, dy); 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 * band->prec = av_malloc_array(reslevel->num_precincts_x *
reslevel->num_precincts_y, reslevel->num_precincts_y,
sizeof(*band->prec)); sizeof(*band->prec));
...@@ -399,11 +394,9 @@ int ff_j2k_init_component(Jpeg2000Component *comp, ...@@ -399,11 +394,9 @@ int ff_j2k_init_component(Jpeg2000Component *comp,
if (!prec->zerobits) if (!prec->zerobits)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
// prec->cblk = av_malloc_array(prec->nb_codeblocks_width * prec->cblk = av_malloc_array(prec->nb_codeblocks_width *
// prec->nb_codeblocks_height, prec->nb_codeblocks_height,
// sizeof(*prec->cblk)); sizeof(*prec->cblk));
prec->cblk = band->cblk;
av_assert0(nb_precincts == 1);
if (!prec->cblk) if (!prec->cblk)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
for (cblkno = 0; cblkno < prec->nb_codeblocks_width * prec->nb_codeblocks_height; cblkno++) { for (cblkno = 0; cblkno < prec->nb_codeblocks_width * prec->nb_codeblocks_height; cblkno++) {
...@@ -461,14 +454,14 @@ void ff_j2k_reinit(Jpeg2000Component *comp, Jpeg2000CodingStyle *codsty) ...@@ -461,14 +454,14 @@ void ff_j2k_reinit(Jpeg2000Component *comp, Jpeg2000CodingStyle *codsty)
Jpeg2000Prec *prec = band->prec + precno; Jpeg2000Prec *prec = band->prec + precno;
tag_tree_zero(prec->zerobits, prec->xi1 - prec->xi0, prec->yi1 - prec->yi0); 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); tag_tree_zero(prec->cblkincl, prec->xi1 - prec->xi0, prec->yi1 - prec->yi0);
} for (cblkno = 0; cblkno < prec->nb_codeblocks_width * prec->nb_codeblocks_height; cblkno++) {
for (cblkno = 0; cblkno < band->cblknx * band->cblkny; cblkno++) { Jpeg2000Cblk *cblk = prec->cblk + cblkno;
Jpeg2000Cblk *cblk = band->cblk + cblkno;
cblk->length = 0; cblk->length = 0;
cblk->lblock = 3; cblk->lblock = 3;
} }
} }
} }
}
} }
void ff_j2k_cleanup(Jpeg2000Component *comp, Jpeg2000CodingStyle *codsty) void ff_j2k_cleanup(Jpeg2000Component *comp, Jpeg2000CodingStyle *codsty)
...@@ -483,8 +476,8 @@ void ff_j2k_cleanup(Jpeg2000Component *comp, Jpeg2000CodingStyle *codsty) ...@@ -483,8 +476,8 @@ void ff_j2k_cleanup(Jpeg2000Component *comp, Jpeg2000CodingStyle *codsty)
Jpeg2000Prec *prec = band->prec + precno; Jpeg2000Prec *prec = band->prec + precno;
av_freep(&prec->zerobits); av_freep(&prec->zerobits);
av_freep(&prec->cblkincl); av_freep(&prec->cblkincl);
av_freep(&prec->cblk);
} }
av_freep(&band->cblk);
av_freep(&band->prec); av_freep(&band->prec);
} }
av_freep(&reslevel->band); av_freep(&reslevel->band);
......
...@@ -182,7 +182,6 @@ typedef struct Jpeg2000Band { ...@@ -182,7 +182,6 @@ typedef struct Jpeg2000Band {
uint16_t cblknx, cblkny; uint16_t cblknx, cblkny;
uint32_t stepsize; // quantization stepsize (* 2^13) uint32_t stepsize; // quantization stepsize (* 2^13)
Jpeg2000Prec *prec; Jpeg2000Prec *prec;
Jpeg2000Cblk *cblk;
} Jpeg2000Band; // subband } Jpeg2000Band; // subband
typedef struct Jpeg2000ResLevel { typedef struct Jpeg2000ResLevel {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment