[vlc-commits] videotoolbox: fix HXXX 10bits on iOS 14

Thomas Guillem git at videolan.org
Mon Sep 28 17:23:30 CEST 2020


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Sep 28 15:23:24 2020 +0200| [d4ccf13c4be0fb43d959cec1839eb1e70b99decd] | committer: Thomas Guillem

videotoolbox: fix HXXX 10bits on iOS 14

iOS 14 adds support for 10bits YUV output. Unfortunately, it can only be
rendered with Metal (since the Apple OpenGLES implementation doesn't
expose 16bits textures), so force BGRA output for now (waiting for a
possible MetalAngle integration?).

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

 modules/codec/videotoolbox.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/modules/codec/videotoolbox.c b/modules/codec/videotoolbox.c
index 02e009a42d..707ac04f9c 100644
--- a/modules/codec/videotoolbox.c
+++ b/modules/codec/videotoolbox.c
@@ -180,12 +180,18 @@ static void HXXXGetBestChroma(decoder_t *p_dec)
     {
         if (i_depth_luma == 8 && i_depth_chroma == 8)
             p_sys->i_cvpx_format = kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange;
+        else if (i_depth_luma == 10 && i_depth_chroma == 10)
+        {
 #if !TARGET_OS_IPHONE
-        /* Not for iOS since there is no 10bits textures with the old iOS
-         * openGLES version, and therefore no P010 shaders */
-        else if (i_depth_luma == 10 && i_depth_chroma == 10 && deviceSupportsHEVC())
-            p_sys->i_cvpx_format = kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange;
+            if (deviceSupportsHEVC()) /* 42010bit went with HEVC on macOS */
+                p_sys->i_cvpx_format = kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange;
+#else
+            /* Force BGRA output (and let VT handle the tone mapping) on iOS
+             * since the apple openGLES implementation can't handle 16 bit
+             * textures. */
+            p_sys->i_cvpx_format = kCVPixelFormatType_32BGRA;
 #endif
+        }
     }
 }
 



More information about the vlc-commits mailing list