diff mbox series

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

Message ID 20210823214730.25046-2-jeebjp@gmail.com
State New
Headers show
Series [FFmpeg-devel,1/2] avcodec/libx264: add support for setting chroma sample location | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Jan Ekström Aug. 23, 2021, 9:47 p.m. UTC
---
 libavcodec/libx265.c | 8 ++++++++
 1 file changed, 8 insertions(+)
diff mbox series

Patch

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;