I'am decoding a video using ffmpeg, convert it from yuv420 color space to the rgba color space with convert it to a CGImage and render it to the screen. The video plays correctly. With Instruments I see that a third of the CPU cycles are used for another conversion (function i开发者_开发技巧s called CGSConvertBGRX8888toRGBA8888) Why is this second color space conversion necessary and why is there no conversion if I load for example a PNG image and draw it the same way?
Code for the CGImage creation:
http://pastebin.com/CqePhPzG
Thanks!
Looks like the byte ordering of the source image doesn't match the destination. Also, I believe X is non-premultiplied alpha whereas A is premultiplied alpha. Try changing the byte ordering settings you pass when creating your image or bitmap image context. HTH.
精彩评论