[FFmpeg-cvslog] avcodec/libsvtav1: add support for setting chroma sample location

Jan Ekström git at videolan.org
Tue Apr 26 09:18:31 EEST 2022


ffmpeg | branch: master | Jan Ekström <jeebjp at gmail.com> | Mon Apr 25 23:35:17 2022 +0300| [ded0334d214f9617122ccf5466f99df5c908277b] | committer: Jan Ekström

avcodec/libsvtav1: add support for setting chroma sample location

Support for configuring this was added with version 1.0.0.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ded0334d214f9617122ccf5466f99df5c908277b
---

 libavcodec/libsvtav1.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c
index 088b9bab02..b4112004ad 100644
--- a/libavcodec/libsvtav1.c
+++ b/libavcodec/libsvtav1.c
@@ -205,6 +205,33 @@ 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) {
+        const char *name =
+            av_chroma_location_name(avctx->chroma_sample_location);
+
+        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:
+            if (!name)
+                break;
+
+            av_log(avctx, AV_LOG_WARNING,
+                   "Specified chroma sample location %s is unsupported "
+                   "on the AV1 bit stream level. Usage of a container that "
+                   "allows passing this information - such as Matroska - "
+                   "is recommended.\n",
+                   name);
+            break;
+        }
+    }
+#endif
+
     if (avctx->profile != FF_PROFILE_UNKNOWN)
         param->profile = avctx->profile;
 



More information about the ffmpeg-cvslog mailing list