[FFmpeg-devel] [PATCH] avcodec/libsvtav1: add support for setting chroma sample location
James Almer
jamrial at gmail.com
Tue Apr 26 00:15:51 EEST 2022
On 4/25/2022 6:02 PM, Jan Ekström wrote:
> Support for configuring this was added with version 1.0.0.
> ---
> libavcodec/libsvtav1.c | 22 ++++++++++++++++++++++
> 1 file changed, 22 insertions(+)
>
> diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c
> index 2e3d96ce37..a670dab822 100644
> --- a/libavcodec/libsvtav1.c
> +++ b/libavcodec/libsvtav1.c
> @@ -205,6 +205,28 @@ static int config_enc_params(EbSvtAv1EncConfiguration *param,
> else
> param->color_range = !!(desc->flags & AV_PIX_FMT_FLAG_RGB);
>
> +#if SVT_AV1_CHECK_VERSION(1, 0, 0)
> + if (avctx->chroma_sample_location != AVCHROMA_LOC_UNSPECIFIED) {
> + switch (avctx->chroma_sample_location) {
> + case AVCHROMA_LOC_LEFT:
> + param->chroma_sample_position = EB_CSP_VERTICAL;
> + break;
> + case AVCHROMA_LOC_TOPLEFT:
> + param->chroma_sample_position = EB_CSP_COLOCATED;
> + break;
> + default:
> + av_log(avctx, AV_LOG_INFO,
> + "Specified chroma sample location %s (%d) is unsupported "
> + "on the AV1 bit stream level. Usage of a container that "
> + "allows passing this information - such as Matroska - "
> + "is recommended.\n",
> + av_chroma_location_name(avctx->chroma_sample_location),
This can return NULL on invalid AVChromaLocation values, so better check
for that and print a different log message.
> + avctx->chroma_sample_location);
> + break;
> + }
> + }
> +#endif
> +
> if (avctx->profile != FF_PROFILE_UNKNOWN)
> param->profile = avctx->profile;
>
More information about the ffmpeg-devel
mailing list