Robert
Robert

Reputation: 38223

How to use vImageMatrixMultiply to convert from YUV planer data to 32 bpp, 8bpc RGBX?

I have YUV planar data (420YpCbCr8BiPlanarFullRange) and I would like to convert it to RBGX (RBGA but with 255 in the alpha channel).

void * const luminescencePlaneBytes = ...;
void * const cbChrominancePlaneBytes = ...;
void * const crChrominancePlaneBytes = ...;

// ... Convert YUV planar -> RBGX 32bpp, 8bpc.
void *convertedBytes = ... 

The vImage docs and this answer state this is possible using a Matrix multiplication function:

vImageMatrixMultiply_Planar8

However, I have been unable to find any sample code to that does this.

Upvotes: 1

Views: 977

Answers (1)

Ian Ollmann
Ian Ollmann

Reputation: 1592

420->RGBA888 involves some upsampling, which means that vImageMatrixMultiply_Planar8 won't do it alone. You will need to double the size of the chroma channels. After that, you should be able to do it with appropriate matrix.

If you have access to the iOS 8 developer seed, then I recommend that you take a look at vImageConvert_420Yp8_CbCr8ToARGB8888.

Upvotes: 3

Related Questions