[FFmpeg-devel] [PATCH v2 2/3] avcodec/jpeg2000dec: add support for HTJ2K block decoding
Tomas Härdin
git at haerdin.se
Fri Apr 14 16:04:07 EEST 2023
> #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
> - 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
/Tomas
More information about the ffmpeg-devel
mailing list