[vlc-devel] [PATCH 1/2] videotoolbox: force decoder output to nv12

Thomas Guillem thomas at gllm.fr
Fri Jul 7 22:02:45 CEST 2017


I think you should handle the YUYV -> NV12 in the filter if it can only
handle NV12.

On Fri, Jul 7, 2017, at 21:52, Thomas Guillem wrote:
> 
> Unfortunately we can't force output to nv12 in case the output will be
> filtered since it decreases performance a lot (when not filtered).
> 
> Ps: iOS is nv12 native while macOS seems to be YUYV native.
> 
> On Fri, Jul 7, 2017, at 19:34, Victorien Le Couviour--Tuffet wrote:
> > The CoreImage filters do not accept UYVY color space while NV12 works
> > just
> > fine.
> > ---
> >  modules/codec/videotoolbox.m | 4 ++++
> >  modules/codec/vt_utils.c     | 6 +-----
> >  2 files changed, 5 insertions(+), 5 deletions(-)
> > 
> > diff --git a/modules/codec/videotoolbox.m b/modules/codec/videotoolbox.m
> > index 7806bd7843..36e0b35776 100644
> > --- a/modules/codec/videotoolbox.m
> > +++ b/modules/codec/videotoolbox.m
> > @@ -695,6 +695,10 @@ static int StartVideoToolbox(decoder_t *p_dec)
> >                       kCVPixelBufferBytesPerRowAlignmentKey,
> >                       i_video_width * 2);
> >  
> > +    /* force NV12 */
> > +    cfdict_set_int32(p_sys->destinationPixelBufferAttributes,
> > kCVPixelBufferPixelFormatTypeKey,
> > +                     kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange);
> > +
> >      /* setup decoder callback record */
> >      VTDecompressionOutputCallbackRecord decoderCallbackRecord;
> >      decoderCallbackRecord.decompressionOutputCallback = DecoderCallback;
> > diff --git a/modules/codec/vt_utils.c b/modules/codec/vt_utils.c
> > index 3faf8598dd..9bab10fec3 100644
> > --- a/modules/codec/vt_utils.c
> > +++ b/modules/codec/vt_utils.c
> > @@ -198,13 +198,9 @@ cvpxpool_create(const video_format_t *fmt, unsigned
> > count)
> >      switch (fmt->i_chroma)
> >      {
> >          case VLC_CODEC_CVPX_UYVY:
> > -            cvpx_format = kCVPixelFormatType_422YpCbCr8;
> > -            break;
> >          case VLC_CODEC_CVPX_NV12:
> > -            cvpx_format =
> > kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange;
> > -            break;
> >          case VLC_CODEC_CVPX_I420:
> > -            cvpx_format = kCVPixelFormatType_420YpCbCr8Planar;
> > +            cvpx_format =
> > kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange;
> >              break;
> >          case VLC_CODEC_CVPX_BGRA:
> >              cvpx_format = kCVPixelFormatType_32BGRA;
> > -- 
> > 2.13.1
> > 
> > _______________________________________________
> > 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