[vlc-devel] [PATCH] videotoolbox: fix HEVC 10bits on iOS 14

Thomas Guillem thomas at gllm.fr
Mon Sep 28 17:14:13 CEST 2020



On Mon, Sep 28, 2020, at 17:10, Alexandre Janniaux wrote:
> Hi,
> 
> On Mon, Sep 28, 2020 at 03:27:35PM +0200, Thomas Guillem wrote:
> > iOS 14 adds support for 10bits YUV output. Unfortunately, it can only be
> > rendered with Metal, so force BGRA output for now (waiting for a
> > possible MetalAngle integration?).
> 
> I've started MetalANGLE integration, just for notification. :)
> 
> > ---
> >  modules/codec/videotoolbox.c | 10 +++++++---
> >  1 file changed, 7 insertions(+), 3 deletions(-)
> >
> > diff --git a/modules/codec/videotoolbox.c b/modules/codec/videotoolbox.c
> > index 02e009a42dd..673fc21dd2d 100644
> > --- a/modules/codec/videotoolbox.c
> > +++ b/modules/codec/videotoolbox.c
> > @@ -180,12 +180,16 @@ static void HXXXGetBestChroma(decoder_t *p_dec)
> >      {
> >          if (i_depth_luma == 8 && i_depth_chroma == 8)
> >              p_sys->i_cvpx_format = kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange;
> > -#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())
> > +        {
> > +#if !TARGET_OS_IPHONE
> >              p_sys->i_cvpx_format = kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange;
> > +#else
> > +            /* Force BGRA output (and let VT handle the tone mapping) on iOS
> > +             * since the old openGLES version can't handle 16 bit textures. */
> > +            p_sys->i_cvpx_format = kCVPixelFormatType_32BGRA;
> >  #endif
> > +        }
> 
> LGTM for now, but I don't think that's completely correct. Since we're
> testing the availability of 16bit textures, you could instead use the
> updateFormat callback to check whether we can have a vout with the 10bit
> format, and if it fails, falls back to kCVPixelFormatType_32BGRA.
> 
> It would means that adding MetalANGLE won't need a modification to
> videotoolbox and unavailability of MetalANGLE won't re-trigger the bug.
> 
> It's ok for 3.0 and 4.0 but I'd like this to change on 4.0.

I'm OK with this change but I propose to do it after this patch is merged.

> 
> >      }
> >  }
> >
> > --
> > 2.28.0
> >
> > _______________________________________________
> > vlc-devel mailing list
> > To unsubscribe or modify your subscription options:
> > https://mailman.videolan.org/listinfo/vlc-devel
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list