[FFmpeg-devel] [PATCH] avcodec/libx265: add support for ROI-based encoding

Guo, Yejun yejun.guo at intel.com
Mon Jan 21 08:45:43 EET 2019



> -----Original Message-----
> From: ffmpeg-devel [mailto:ffmpeg-devel-bounces at ffmpeg.org] On Behalf
> Of Derek Buitenhuis
> Sent: Friday, January 18, 2019 10:42 PM
> To: ffmpeg-devel at ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH] avcodec/libx265: add support for ROI-
> based encoding
> 
> On 18/01/2019 15:53, Guo, Yejun wrote:
> 
> [...]
> 
> > +static av_cold int libx265_encode_set_roi(libx265Context *ctx, const
> > +AVFrame *frame, x265_picture* pic) {
> > +    // From x265.h:
> > +    /* An array of quantizer offsets to be applied to this image during
> encoding.
> > +    * These are added on top of the decisions made by rateControl.
> > +    * Adaptive quantization must be enabled to use this feature. These
> quantizer
> > +    * offsets should be given for each 16x16 block (8x8 block, when qg-size
> is 8).
> > +    * Behavior if quant offsets differ between encoding passes is undefined.
> > +    */
> 
> I don't think you need to copy the API documentation from x265.

ok, I'll remove it.

> 
> > +                // 25 is a number that I think it is a possible proper scale value.
> > +                qoffset = qoffset * 25;
> 
> Is this based off anything?

the qp range of x265 is 0 to 51, I just choose around half of the range to be 25, so the final qoffset range will be [-25, 25].
I'll add into the note. Comments are welcome if it does not make sense.

(I'll also update notes for libx264, after this patch is done).

> 
> > +
> > +    if (x265pic.quantOffsets) {
> > +        av_free(x265pic.quantOffsets);
> > +        x265pic.quantOffsets = NULL;
> > +    }
> 
> av_freep(&x265pic.quantOffsets);

thanks, will change to it.

> 
> - Derek
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


More information about the ffmpeg-devel mailing list