1

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.

Community
  • 1
  • 1
Robert
  • 37,670
  • 37
  • 171
  • 213
  • possible duplicate of [Fastest YUV420P to RGBA conversion on iOS using the CPU](http://stackoverflow.com/questions/11267693/fastest-yuv420p-to-rgba-conversion-on-ios-using-the-cpu) – David Berry May 27 '14 at 21:55
  • @David - Yes! I didn't see that one, thanks. unfortunately the answer from that question is to use `vImageMatrixMultiply` which was the part I was stuck on. Ill rephrase the question to specifically ask about using that function. – Robert May 28 '14 at 08:55

1 Answers1

3

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.

Ian Ollmann
  • 1,592
  • 9
  • 16