diff --git a/plugins/GSdx/GSCapture.cpp b/plugins/GSdx/GSCapture.cpp index b2207e09fb..de8ee02dea 100644 --- a/plugins/GSdx/GSCapture.cpp +++ b/plugins/GSdx/GSCapture.cpp @@ -245,53 +245,31 @@ public: { int dstpitch = ((VIDEOINFOHEADER*)mt.Format())->bmiHeader.biWidth * 2; - const GSVector4 ys(0.098f, 0.504f, 0.257f, 0.0f); - const GSVector4 us(0.439f / 2, -0.291f / 2, -0.148f / 2, 0.0f); - const GSVector4 vs(-0.071f / 2, -0.368f / 2, 0.439f / 2, 0.0f); + GSVector4 ys(0.257f, 0.504f, 0.098f, 0.0f); + GSVector4 us(-0.148f / 2, -0.291f / 2, 0.439f / 2, 0.0f); + GSVector4 vs(0.439f / 2, -0.368f / 2, -0.071f / 2, 0.0f); const GSVector4 offset(16, 128, 16, 128); - if(rgba) + if (!rgba) + ys = ys.zyxw(), us = us.zyxw(), vs = vs.zyxw(); + + for(int j = 0; j < h; j++, dst += dstpitch, src += srcpitch) { - for(int j = 0; j < h; j++, dst += dstpitch, src += srcpitch) + uint32* s = (uint32*)src; + uint16* d = (uint16*)dst; + + for(int i = 0; i < w; i += 2) { - uint32* s = (uint32*)src; - uint16* d = (uint16*)dst; + GSVector4 c0 = GSVector4(s[i + 0]); + GSVector4 c1 = GSVector4(s[i + 1]); + GSVector4 c2 = c0 + c1; - for(int i = 0; i < w; i += 2) - { - GSVector4 c0 = GSVector4(s[i + 0]); - GSVector4 c1 = GSVector4(s[i + 1]); - GSVector4 c2 = c0 + c1; + GSVector4 lo = (c0 * ys).hadd(c2 * us); + GSVector4 hi = (c1 * ys).hadd(c2 * vs); - GSVector4 lo = (c0 * ys).hadd(c2 * vs); - GSVector4 hi = (c1 * ys).hadd(c2 * us); + GSVector4 c = lo.hadd(hi) + offset; - GSVector4 c = lo.hadd(hi) + offset; - - *((uint32*)&d[i]) = GSVector4i(c).rgba32(); - } - } - } - else - { - for(int j = 0; j < h; j++, dst += dstpitch, src += srcpitch) - { - uint32* s = (uint32*)src; - uint16* d = (uint16*)dst; - - for(int i = 0; i < w; i += 2) - { - GSVector4 c0 = GSVector4(s[i + 0]).zyxw(); - GSVector4 c1 = GSVector4(s[i + 1]).zyxw(); - GSVector4 c2 = c0 + c1; - - GSVector4 lo = (c0 * ys).hadd(c2 * vs); - GSVector4 hi = (c1 * ys).hadd(c2 * us); - - GSVector4 c = lo.hadd(hi) + offset; - - *((uint32*)&d[i]) = GSVector4i(c).rgba32(); - } + *((uint32*)&d[i]) = GSVector4i(c).rgba32(); } } }