title: Drawing CGImageRef in YUV
body: <p>I am using the code here to convert a <code>CGImageRef</code> into a <code>CVPixelBufferRef</code> on OS X . </p>
  
  <p><a href="https://stackoverflow.com/questions/8138018/convert-uiimage-to-cvimagebufferref">Convert UIImage to CVImageBufferRef</a></p>
  
  <p>However, I need the image to be drawn in YUV <code>(kCVPixelFormatType_420YpCbCr8Planar)</code> instead of RBG as it is now.</p>
  
  <p>Is there anyway to directly draw a <code>CGImage</code> in YUV colorspace? And if not, does anyone have an example for the best way to go about converting the <code>CVPixedBufferRef</code> from <strong>RBG</strong> into <strong>YUV</strong>? </p>
  
  <p>I understand the formulas for the conversion but doing it on the CPU is painfully slow.</p>