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

Derek Buitenhuis derek.buitenhuis at gmail.com
Fri Jan 18 16:42:27 EET 2019


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.

> +                // 25 is a number that I think it is a possible proper scale value.
> +                qoffset = qoffset * 25;

Is this based off anything?

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

av_freep(&x265pic.quantOffsets);

- Derek


More information about the ffmpeg-devel mailing list