Coverting CVPixelBuffer 2VUY to a Metal Texture

I am working on a project for macOS where I am taking an AVCaptureSession's CVPixelBuffer and I need to convert it into a MTLTexture for rendering. On macOS the pixel format is 2vuy, there does not seem to be a clear format conversion while converting to a metal texture. I have been able to convert it to a texture but the color space seems to be off as it is rendering distorted colors with a double image.

I believe 2vuy is a single pane color space and I have tried to account for that, but I am unaware of what is off.

I have attached The CVPixelBuffer and The distorted MTLTexture along with a laundry list of errors.

On iOS my conversions are fine, it is only the macOS 2vuy pixel format that seems to have issues.

My code for the conversion is also attached.

If there are any suggestions or guidance on how to properly convert a 2vuy CVPixelBuffer to a MTLTexture I would greatly appreciate it.

Many Thanks

Hello @NeedleTails,

Could you provide a focused sample project that reproduces?

At a glance, I don't think you are handling the GBGR422 texture correctly in your kernel, but that's just a hunch. It would be best if I could examine a focused sample project.

-- Greg

Coverting CVPixelBuffer 2VUY to a Metal Texture
 
 
Q