[FFmpeg-devel] [PATCH 2/2] avcodec/libx265: add support for setting chroma sample location

Jan Ekström jeebjp at gmail.com
Tue Aug 24 00:47:30 EEST 2021


---
 libavcodec/libx265.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
index b5c94b64a3..c58882170b 100644
--- a/libavcodec/libx265.c
+++ b/libavcodec/libx265.c
@@ -210,6 +210,14 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx)
         ctx->params->vui.matrixCoeffs            = avctx->colorspace;
     }
 
+    if (avctx->chroma_sample_location != AVCHROMA_LOC_UNSPECIFIED) {
+        ctx->params->vui.bEnableChromaLocInfoPresentFlag = 1;
+
+        ctx->params->vui.chromaSampleLocTypeTopField =
+        ctx->params->vui.chromaSampleLocTypeBottomField =
+            avctx->chroma_sample_location - 1;
+    }
+
     if (avctx->sample_aspect_ratio.num > 0 && avctx->sample_aspect_ratio.den > 0) {
         char sar[12];
         int sar_num, sar_den;
-- 
2.31.1



More information about the ffmpeg-devel mailing list