1

The documentation states that the first element in the AVCaptureVideoDataOutput.availableVideoCVPixelFormatTypes array is the most efficient pixel format to use (i. e. it means no further conversion work).

I'm planning to use Metal in order to manipulate CMSampleBuffer video output.

Bottom line,

Would it make more sense to setup the capture session to deliver sample buffers as BGRA(kCVPixelFormatType_32BGRA) or does the YCbCr(kCVPixelFormatType_420YpCbCr8BiPlanarFullRange) to RGB conversion deliver better performance when using metal?

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
Roi Mulia
  • 5,626
  • 11
  • 54
  • 105
  • I haven't benchmarked this myself, but if you ultimately need a texture in BGRA or a format you can swizzle it from, it's likely more efficient to ask for the sample buffers in that format in the first place. Otherwise you'll be creating two textures (one for each plane) and either converting the texture with a shader at-once or doing the conversion on a per-texel basis each time you need to sample it. How are you actually using the Metal texture? – warrenm Jun 04 '16 at 01:20
  • @warrenm Hey warrenm! Thank you for replying! Eventually I'm planning to manipulate specific portion of the texture, i.e only for the (5,5,40,70) rect texture. Being more specific- i have a source UIimage, and i need to "add" it as overlay in this specific rect(after manipulating the UIImage as well) Am i at the right direction? – Roi Mulia Jun 04 '16 at 06:23
  • @warrenm , Would love a reply if possible! – Roi Mulia Jun 04 '16 at 21:19
  • I'd recommend implementing it the easiest way first and then optimizing if necessary. – warrenm Jun 05 '16 at 22:18

0 Answers0