Is there a good way to convert pixel data between formats?
I have an byte array of pixel data in RGB format - if I want to add an alpha channel, or convert it into BGR format etc, is there a better way of doing it than manually processing the array pixel by pixel, pixel component by pixel component?
Its depends. If you want to change the pixelformat before you upload it as a texture to the GPU, I would let the GPU/driver do the work since todays GPU’s are good in data swizzling.
If you mean pixel format conversions for normal CPU use, you need an appropriate algorithm (or library) that does the conversion. Some conversions can be speeded up by using extended instructions like “MMX-SSE3” or “3dNow!” others cant.