title: How do I draw onto a CVPixelBufferRef that is planar/ycbcr/420f/yuv/NV12/not rgb?
body: <p>I have received a <code>CMSampleBufferRef</code> from a system API that contains <code>CVPixelBufferRef</code>s that are not <code>RGBA</code> (linear pixels). The buffer contains planar pixels (such as <code>420f</code> aka <code>kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange</code> aka <code>yCbCr</code> aka <code>YUV</code>).</p>
  
  <p>I would like to modify do some manipulation of this video data before sending it off to <code>VideoToolkit</code> to be encoded to <code>h264</code> (drawing some text, overlaying a logo, rotating the image, etc), but I'd like for it to be efficient and real-time. Buuuut planar image data looks suuuper messy to work with -- there's the chroma plane and the luma plane and they're different sizes and... Working with this on a byte level seems like a lot of work.</p>
  
  <p>I could probably use a <code>CGContextRef</code> and just paint right on top of the pixels, but from what I can gather it only supports RGBA pixels. Any advice on how I can do this with as little data copying as possible, yet as few lines of code as possible?</p>