[FFmpeg-devel] [RFC PATCH v5 2/3] libavcodec/j2kenc: Fix tag tree coding

Michael Niedermayer michael at niedermayer.cc
Wed Aug 26 01:34:22 EEST 2020


On Tue, Aug 25, 2020 at 07:25:44PM +0530, gautamramk at gmail.com wrote:
> From: Gautam Ramakrishnan <gautamramk at gmail.com>
> 
> The implementation of tag tree encoding was incorrect.
> However, this error was not visible as the current j2k
> encoder encodes only 1 layer.
> This patch fixes tag tree coding for JPEG2000 such tag
> tree coding would work for multi layer encoding.

[...]

> diff --git a/libavcodec/jpeg2000.c b/libavcodec/jpeg2000.c
> index 26e09fbe38..2e26bc5b00 100644
> --- a/libavcodec/jpeg2000.c
> +++ b/libavcodec/jpeg2000.c
> @@ -82,12 +82,13 @@ 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;
>      }
>  }
> @@ -567,8 +568,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);

this looks a bit like a somewhat unlrelated bugfix thats spread over this and
the next patch 
if so, that should be moved into a seperate patch
the patches are already complex without an additional bugfix in them

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Whats the most studid thing your enemy could do ? Blow himself up
Whats the most studid thing you could do ? Give up your rights and
freedom because your enemy blew himself up.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20200826/58926cdc/attachment.sig>


More information about the ffmpeg-devel mailing list