[FFmpeg-cvslog] lavc/videotoolbox: select 4:2:2 and 4:4:4 formats when applicable

rcombs git at videolan.org
Mon Nov 29 00:41:59 EET 2021


ffmpeg | branch: master | rcombs <rcombs at rcombs.me> | Sat Nov 13 01:02:26 2021 -0600| [f0952f87bcfd905f21ce6cefa8e14a127fb00c8a] | committer: rcombs

lavc/videotoolbox: select 4:2:2 and 4:4:4 formats when applicable

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

 libavcodec/videotoolbox.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index 010f553e57..57b37bf3bf 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -1064,9 +1064,35 @@ static enum AVPixelFormat videotoolbox_best_pixel_format(AVCodecContext *avctx)
         return AV_PIX_FMT_NV12; // same as av_videotoolbox_alloc_context()
 
     int depth = descriptor->comp[0].depth;
+
+#if HAVE_KCVPIXELFORMATTYPE_444YPCBCR16BIPLANARVIDEORANGE
+    if (depth > 10)
+        return descriptor->log2_chroma_w == 0 ? AV_PIX_FMT_P416 : AV_PIX_FMT_P216;
+#endif
+
+#if HAVE_KCVPIXELFORMATTYPE_444YPCBCR10BIPLANARVIDEORANGE
+    if (descriptor->log2_chroma_w == 0) {
+#if HAVE_KCVPIXELFORMATTYPE_444YPCBCR8BIPLANARVIDEORANGE
+        if (depth <= 8)
+            return AV_PIX_FMT_NV24;
+#endif
+        return AV_PIX_FMT_P410;
+    }
+#endif
+#if HAVE_KCVPIXELFORMATTYPE_422YPCBCR10BIPLANARVIDEORANGE
+    if (descriptor->log2_chroma_h == 0) {
+#if HAVE_KCVPIXELFORMATTYPE_422YPCBCR8BIPLANARVIDEORANGE
+        if (depth <= 8)
+            return AV_PIX_FMT_NV16;
+#endif
+        return AV_PIX_FMT_P210;
+    }
+#endif
+#if HAVE_KCVPIXELFORMATTYPE_420YPCBCR10BIPLANARVIDEORANGE
     if (depth > 8) {
         return AV_PIX_FMT_P010;
     }
+#endif
 
     return AV_PIX_FMT_NV12;
 }



More information about the ffmpeg-cvslog mailing list