[FFmpeg-devel] [PATCH v2 2/3] avcodec/jpeg2000dec: add support for HTJ2K block decoding
Caleb Etemesi
etemesicaleb at gmail.com
Fri Apr 14 17:13:35 EEST 2023
On Fri, 14 Apr 2023, 16:04 Tomas Härdin, <git at haerdin.se> wrote:
> > #define JP2_SIG_TYPE 0x6A502020
> > #define JP2_SIG_VALUE 0x0D0A870A
> > @@ -436,12 +437,13 @@ static int get_cox(Jpeg2000DecoderContext *s,
> > Jpeg2000CodingStyle *c)
> > c->cblk_style = bytestream2_get_byteu(&s->g);
> > if (c->cblk_style != 0) { // cblk style
> > if (c->cblk_style & JPEG2000_CTSY_HTJ2K_M || c->cblk_style &
> > JPEG2000_CTSY_HTJ2K_F) {
> > - av_log(s->avctx, AV_LOG_ERROR, "Support for High
> > throughput JPEG 2000 is not yet available\n");
> > - return AVERROR_PATCHWELCOME;
> > + av_log(s->avctx,AV_LOG_TRACE,"High Throughput jpeg 2000
> > codestream.\n");
> > + s->is_htj2k = 1;
>
> Still no support for per-CB style? Or, this still looks a bit strange,
> see below
>
There is a bit further down, i.e the `& JPEG2000_CTSY_HTJ2K_F` does the CB
check
+
+ if (codsty->cblk_style & JPEG2000_CTSY_HTJ2K_F)
+ ret = ff_jpeg2000_decode_htj2k(s, codsty, &t1,
cblk,
+
cblk->coord[0][1] - cblk->coord[0][0],
+
cblk->coord[1][1] - cblk->coord[1][0],
+ magp,
comp->roi_shift);
+ else
+ ret = decode_cblk(s, codsty, &t1, cblk,
+ cblk->coord[0][1] -
cblk->coord[0][0],
+ cblk->coord[1][1] -
cblk->coord[1][0],
+ bandpos, comp->roi_shift);
+
> - if ((ret = get_bits(s, av_log2(newpasses1) + cblk-
> > >lblock)) < 0)
> > - return ret;
> > + if (newpasses > 1 && s->is_htj2k) {
>
> Is this not per-tile? See codsty further down
>
> > @@ -1863,9 +1882,12 @@ static inline void tile_codeblocks(const
> > Jpeg2000DecoderContext *s, Jpeg2000Tile
> >
> > /* Loop on tile components */
> > for (compno = 0; compno < s->ncomponents; compno++) {
> > - Jpeg2000Component *comp = tile->comp + compno;
> > - Jpeg2000CodingStyle *codsty = tile->codsty + compno;
> > + Jpeg2000Component *comp = tile->comp + compno;
> > + Jpeg2000CodingStyle *codsty = tile->codsty + compno;
>
> Here
>
> > for (cblkno = 0;
> > cblkno < prec->nb_codeblocks_width * prec-
> > >nb_codeblocks_height;
> > cblkno++) {
> > - int x, y;
> > + int x, y, ret;
> > + /* See Rec. ITU-T T.800, Equation E-2 */
> > + int magp = quantsty->expn[subbandno] +
> > quantsty->nguardbits - 1;
> > +
> > Jpeg2000Cblk *cblk = prec->cblk + cblkno;
> > - int ret = decode_cblk(s, codsty, &t1, cblk,
> > - cblk->coord[0][1] - cblk-
> > >coord[0][0],
> > - cblk->coord[1][1] - cblk-
> > >coord[1][0],
> > - bandpos, comp->roi_shift);
> > +
> > + if (codsty->cblk_style &
> > JPEG2000_CTSY_HTJ2K_F)
>
> And here
>
Fixing, sending updated patch in a few
> /Tomas
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
>
More information about the ffmpeg-devel
mailing list