将 YUV 文件转换为 RGB 文件时出现问题。完成后,我无法使用 GIMP 或其他查看器打开 .rgb 文件,但我成功打开了下载的 .rgb 文件。请告诉我RGB文件的结构是什么?(它是否包含标题?)是:1)所有 R 值,然后所有 G 值,然后所有 B 值?2)循环(一R一G一B)*像素数?
void convert_YUV_to_RGB (unsigned char Y1, unsigned char Y2, unsigned char Y3, unsigned char Y4, unsigned char U, unsigned char V) {
/*
//V1 for conversion YUV 420 -> RGB
//1.164*(Y - 16) + 1.596*(V - 128);
//1.164*(Y - 16) - 0.813*(V - 128) - 0.391*(U - 128);
//1.164*(Y - 16) + 2.018*(U - 128);
*/
rgb[rgb_counter++] = Y1 + 1.403*V;
rgb[rgb_counter++] = Y1 + -0.344 * U + -0.714 * V;
rgb[rgb_counter++] = Y1 + 1.770 * U ;
rgb[rgb_counter++] = Y2 + 1.403*V;
rgb[rgb_counter++] = Y2 + -0.344 * U + -0.714 * V;
rgb[rgb_counter++] = Y2 + 1.770 * U ;
rgb[rgb_counter++] = Y3 + 1.403*V;
rgb[rgb_counter++] = Y3 + -0.344 * U + -0.714 * V;
rgb[rgb_counter++] = Y3 + 1.770 * U ;
rgb[rgb_counter++] = Y4 + 1.403*V;
rgb[rgb_counter++] = Y4 + -0.344 * U + -0.714 * V;
rgb[rgb_counter++] = Y4 + 1.770 * U ; }
for each (int i in rgb)
{
fputc(i, pRGBFile);
}