On 13 February 2014 23:10, Stefan Dösinger <stefan(a)codeweavers.com> wrote:
- HRESULT color; - DWORD ref_color_left, ref_color_right; + DWORD ref_color_left, ref_color_right, color;
If you're cleaning it up anyway, you may as well make that a D3DCOLOR.
+ static const struct + { + DWORD in; /* The input color. */ + DWORD uyvy_left; /* "in" interpreted as uyvy and transformed to RGB, pixel 1/1. */ + DWORD uyvy_right; /* "in" interpreted as uyvy and transformed to RGB, pixel 2/1. */ + DWORD yuy2_left; /* "in" interpreted as yuy2 and transformed to RGB, pixel 1/1. */ + DWORD yuy2_right; /* "in" interpreted as yuy2 and transformed to RGB, pixel 2/1. */ + } + test_data[] = + { + {0x00000000, 0x00008700, 0x00008700, 0x00008700, 0x00008700}, + {0xff000000, 0x00008700, 0x004bff1c, 0x00b30000, 0x00b30000}, + {0x00ff0000, 0x00b30000, 0x00b30000, 0x00008700, 0x004bff1c}, + {0x0000ff00, 0x004bff1c, 0x00008700, 0x000030e1, 0x000030e1}, + {0x000000ff, 0x000030e1, 0x000030e1, 0x004bff1c, 0x00008700}, + {0xffff0000, 0x00b30000, 0x00ffd01c, 0x00b30000, 0x00ffd01c}, + {0xff00ff00, 0x004bff1c, 0x004bff1c, 0x00b300e1, 0x00b300e1}, + {0xff0000ff, 0x000030e1, 0x004bffff, 0x00ffd01c, 0x00b30000}, + {0x00ffff00, 0x00ffd01c, 0x00b30000, 0x000030e1, 0x004bffff}, + {0x00ff00ff, 0x00b300e1, 0x00b300e1, 0x004bff1c, 0x004bff1c}, + {0x0000ffff, 0x004bffff, 0x000030e1, 0x004bffff, 0x000030e1}, + {0xffffff00, 0x00ffd01c, 0x00ffd01c, 0x00b300e1, 0x00ff79ff}, + {0xffff00ff, 0x00b300e1, 0x00ff79ff, 0x00ffd01c, 0x00ffd01c}, + {0xffffffff, 0x00ff79ff, 0x00ff79ff, 0x00ff79ff, 0x00ff79ff}, + {0x4cff4c54, 0x00ff0000, 0x00ff0000, 0x000b8b00, 0x00b6ffa3}, + {0x00800080, 0x00000000, 0x00000000, 0x0000ff00, 0x0000ff00}, + {0xff80ff80, 0x00ffffff, 0x00ffffff, 0x00ff00ff, 0x00ff00ff}, + {0x1c6b1cff, 0x000000fd, 0x000000fd, 0x006dff45, 0x0000d500}, }; ... - for(fmt = 0; fmt < 2; fmt++) { - if(fmt == 0) { - format = D3DFMT_UYVY; - fmt_string = "D3DFMT_UYVY"; - } else { + for (fmt = 0; fmt < 2; fmt++) + { + if (fmt) + { format = D3DFMT_YUY2; fmt_string = "D3DFMT_YUY2"; } + else + { + format = D3DFMT_UYVY; + fmt_string = "D3DFMT_UYVY"; + } ... + if (fmt) + { ref_color_left = test_data[i].yuy2_left; ref_color_right = test_data[i].yuy2_right; } + else + { + ref_color_left = test_data[i].uyvy_left; + ref_color_right = test_data[i].uyvy_right; + }
There's probably a nicer way to do all that.