On Tue, Aug 25, 2020 at 09:50:06AM +0530, gautamr...@gmail.com wrote: > From: Gautam Ramakrishnan <gautamr...@gmail.com> > > This patch allows setting a compression ratio and to > set multiple layers. The user has to input a compression > ratio for each layer. > The per layer compression ration can be set as follows: > -layer_rates "r1,r2,...rn" > for to create 'n' layers.
[...] > diff --git a/libavcodec/jpeg2000.c b/libavcodec/jpeg2000.c > index 70c25a0ca2..1c294ad9e6 100644 > --- a/libavcodec/jpeg2000.c > +++ b/libavcodec/jpeg2000.c > @@ -261,9 +261,11 @@ static void init_band_stepsize(AVCodecContext *avctx, > band->f_stepsize *= 0.5; > } > > -static int init_prec(Jpeg2000Band *band, > +static int init_prec(AVCodecContext *avctx, > + Jpeg2000Band *band, > Jpeg2000ResLevel *reslevel, > Jpeg2000Component *comp, > + Jpeg2000CodingStyle *codsty, > int precno, int bandno, int reslevelno, > int log2_band_prec_width, > int log2_band_prec_height) > @@ -366,6 +368,11 @@ static int init_prec(Jpeg2000Band *band, > cblk->lblock = 3; > cblk->length = 0; > cblk->npasses = 0; > + if (av_codec_is_encoder(avctx->codec)) { > + cblk->layers = av_mallocz_array(codsty->nlayers, > sizeof(*cblk->layers)); > + if (!cblk->layers) > + return AVERROR(ENOMEM); > + } > } > > return 0; > @@ -439,7 +446,7 @@ static int init_band(AVCodecContext *avctx, > return AVERROR(ENOMEM); > > for (precno = 0; precno < nb_precincts; precno++) { > - ret = init_prec(band, reslevel, comp, > + ret = init_prec(avctx, band, reslevel, comp, codsty, > precno, bandno, reslevelno, > log2_band_prec_width, log2_band_prec_height); > if (ret < 0) > @@ -614,6 +621,8 @@ void ff_jpeg2000_cleanup(Jpeg2000Component *comp, > Jpeg2000CodingStyle *codsty, i > av_freep(&cblk->passes); > av_freep(&cblk->lengthinc); > av_freep(&cblk->data_start); > + if (isencoder) > + av_freep(&cblk->layers); why does this need a isencoder check ? isnt it NULL otherwise ? iam asking as this might avoid the need for the isencoder argument thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Opposition brings concord. Out of discord comes the fairest harmony. -- Heraclitus
signature.asc
Description: PGP signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".