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

Thomas Guillem git at videolan.org
Thu Oct 1 07:19:16 CEST 2020


vlc/vlc-3.0 | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Sep 28 15:23:24 2020 +0200| [04be36e003428deea8f2228bbd9c400bb2d6651e] | committer: Felix Paul Kühne

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?).

Manual back-port of d4ccf13c

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

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

diff --git a/modules/codec/videotoolbox.m b/modules/codec/videotoolbox.m
index 846523ef7c..1078a55a0e 100644
--- a/modules/codec/videotoolbox.m
+++ b/modules/codec/videotoolbox.m
@@ -224,12 +224,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 = 'x420'; /* 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