Convert a loop to range-based for.
[movit] / ycbcr_input.frag
index c57c6d1..170e412 100644 (file)
@@ -3,6 +3,10 @@
 // uniform sampler2D PREFIX(tex_cbcr);  // If CB_CR_SAME_TEXTURE.
 // uniform sampler2D PREFIX(tex_cb);    // If not CB_CR_SAME_TEXTURE.
 // uniform sampler2D PREFIX(tex_cr);    // If not CB_CR_SAME_TEXTURE.
+// uniform mat3 PREFIX(ycbcr_matrix);
+// uniform vec3 PREFIX(offset);
+// uniform vec2 PREFIX(cb_offset);
+// uniform vec2 PREFIX(cr_offset);
 
 vec4 FUNCNAME(vec2 tc) {
        // OpenGL's origin is bottom-left, but most graphics software assumes
@@ -11,17 +15,21 @@ vec4 FUNCNAME(vec2 tc) {
        tc.y = 1.0 - tc.y;
 
        vec3 ycbcr;
+#if Y_CB_CR_SAME_TEXTURE
+       ycbcr = tex2D(PREFIX(tex_y), tc).xyz;
+#else
        ycbcr.x = tex2D(PREFIX(tex_y), tc).x;
-#if CB_CR_SAME_TEXTURE
-#if CB_CR_OFFSETS_EQUAL
+  #if CB_CR_SAME_TEXTURE
+    #if CB_CR_OFFSETS_EQUAL
        ycbcr.yz = tex2D(PREFIX(tex_cbcr), tc + PREFIX(cb_offset)).xy;
-#else
+    #else
        ycbcr.y = tex2D(PREFIX(tex_cbcr), tc + PREFIX(cb_offset)).x;
        ycbcr.z = tex2D(PREFIX(tex_cbcr), tc + PREFIX(cr_offset)).x;
-#endif
-#else
+    #endif
+  #else
        ycbcr.y = tex2D(PREFIX(tex_cb), tc + PREFIX(cb_offset)).x;
        ycbcr.z = tex2D(PREFIX(tex_cr), tc + PREFIX(cr_offset)).x;
+  #endif
 #endif
 
        ycbcr -= PREFIX(offset);