summaryrefslogtreecommitdiff
path: root/libavcodec/jpeg2000.c
diff options
context:
space:
mode:
authorGautam Ramakrishnan <gautamramk@gmail.com>2020-08-28 00:15:36 +0530
committerMichael Niedermayer <michael@niedermayer.cc>2020-08-30 16:18:37 +0200
commit341064d68a134e2fb3dd35f8f5b50c6df8506c10 (patch)
tree767b9687e77cf50e243c16ce6be016b9a88e5b95 /libavcodec/jpeg2000.c
parentf0e33119e4fa1cf1705c16affa5daa6f0b487b48 (diff)
libavcodec/jpeg2000: fix tag tree reset
The implementation of the tag tree did not set the correct reset value for the encoder. This lead to inefficent tag tree being encoded. This patch fixes the implementation of the ff_tag_tree_zero() function. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/jpeg2000.c')
-rw-r--r--libavcodec/jpeg2000.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavcodec/jpeg2000.c b/libavcodec/jpeg2000.c
index 6501de0d04..56d98c8a89 100644
--- a/libavcodec/jpeg2000.c
+++ b/libavcodec/jpeg2000.c
@@ -82,12 +82,12 @@ static Jpeg2000TgtNode *ff_jpeg2000_tag_tree_init(int w, int h)
return res;
}
-void ff_tag_tree_zero(Jpeg2000TgtNode *t, int w, int h)
+void ff_tag_tree_zero(Jpeg2000TgtNode *t, int w, int h, int val)
{
int i, siz = ff_tag_tree_size(w, h);
for (i = 0; i < siz; i++) {
- t[i].val = 0;
+ t[i].val = val;
t[i].temp_val = 0;
t[i].vis = 0;
}
@@ -575,8 +575,8 @@ void ff_jpeg2000_reinit(Jpeg2000Component *comp, Jpeg2000CodingStyle *codsty)
Jpeg2000Band *band = rlevel->band + bandno;
for(precno = 0; precno < rlevel->num_precincts_x * rlevel->num_precincts_y; precno++) {
Jpeg2000Prec *prec = band->prec + precno;
- ff_tag_tree_zero(prec->zerobits, prec->nb_codeblocks_width, prec->nb_codeblocks_height);
- ff_tag_tree_zero(prec->cblkincl, prec->nb_codeblocks_width, prec->nb_codeblocks_height);
+ ff_tag_tree_zero(prec->zerobits, prec->nb_codeblocks_width, prec->nb_codeblocks_height, 0);
+ ff_tag_tree_zero(prec->cblkincl, prec->nb_codeblocks_width, prec->nb_codeblocks_height, 0);
for (cblkno = 0; cblkno < prec->nb_codeblocks_width * prec->nb_codeblocks_height; cblkno++) {
Jpeg2000Cblk *cblk = prec->cblk + cblkno;
cblk->length = 0;