aboutsummaryrefslogtreecommitdiff
path: root/system/shaders/yuv2rgb_basic_rect_YUY2.arb
diff options
context:
space:
mode:
Diffstat (limited to 'system/shaders/yuv2rgb_basic_rect_YUY2.arb')
-rw-r--r--system/shaders/yuv2rgb_basic_rect_YUY2.arb45
1 files changed, 45 insertions, 0 deletions
diff --git a/system/shaders/yuv2rgb_basic_rect_YUY2.arb b/system/shaders/yuv2rgb_basic_rect_YUY2.arb
new file mode 100644
index 0000000000..42dd4e89fe
--- /dev/null
+++ b/system/shaders/yuv2rgb_basic_rect_YUY2.arb
@@ -0,0 +1,45 @@
+!!ARBfp1.0
+PARAM yuvmat[4] = { program.local[0..3] };
+#stepx, stepy, width, height
+PARAM dims[1] = { program.local[4] };
+TEMP f;
+TEMP pos;
+MAD pos.x , fragment.texcoord[0].x, 0.5, -0.25;
+MOV pos.y , fragment.texcoord[0].y;
+FRC f , pos;
+
+TEMP c1pos;
+TEMP c2pos;
+SUB c1pos.x, -0.5, f.x;
+SUB c2pos.x, 0.5, f.x;
+ADD c1pos.x, c1pos.x, pos.x;
+ADD c2pos.x, c2pos.x, pos.x;
+MOV c1pos.y, pos.y;
+MOV c2pos.y, pos.y;
+
+TEMP c1;
+TEMP c2;
+TEX c1, c1pos, texture[0], RECT;
+TEX c2, c2pos, texture[0], RECT;
+
+TEMP cint;
+MUL cint.x, f.x, 2.0;
+MAD cint.y, f.x, 2.0, -1.0;
+SGE cint.z, f.x, 0.5;
+
+TEMP yuv;
+LRP yuv.g, cint.x, c1.r , c1.b;
+LRP yuv.b, cint.y, c2.b , c1.r;
+LRP yuv.r, cint.z, yuv.b, yuv.g;
+
+LRP yuv.g, f.x , c2.g , c1.g;
+LRP yuv.b, f.x , c2.a , c1.a;
+
+TEMP rgb;
+DPH rgb.r, yuv, yuvmat[0];
+DPH rgb.g, yuv, yuvmat[1];
+DPH rgb.b, yuv, yuvmat[2];
+MOV rgb.a, fragment.color.a;
+MOV result.color, rgb;
+
+END