BGR packed转换位BGR planar方法及其优化

基本的方法如下:

// the array with the BGRBGRBGR pixel data
byte[] source;
// the array with the BBBGGGRRR pixel data
byte[] result;
// the amount of pixels in one channel, width*height
int imageSize;

for (int i = 0; i < source.Length; i += 3)
{
    result[i/3] = source[i + 0]; // B
    result[i/3 + imageSize] = source[i + 1]; // G
    result[i/3 + imageSize * 2] = source[i+2]; // R
}

具体的优化策略可以参考如下网址:

http://www.howtobuildsoftware.com/index.php/how-do/b649/c-arrays-image-processing-intrinsics-pixelformat-speed-up-pixel-format-conversion-bgr-packed-to-rgb-planar

你可能感兴趣的:(C++)