]> git.sesse.net Git - movit/commitdiff
In YCbCrInput, fix an issue where offsets would be treated as equal even if their...
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 29 Apr 2017 18:55:49 +0000 (20:55 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 29 Apr 2017 18:55:49 +0000 (20:55 +0200)
ycbcr_input.cpp

index e725750291b4e2ce8f7f71533175e83f8dfac469..925bf2a11b2a89032b0d6f20f56110ceced0aa8f 100644 (file)
@@ -175,9 +175,12 @@ string YCbCrInput::output_fragment_shader()
        if (ycbcr_input_splitting == YCBCR_INPUT_INTERLEAVED) {
                frag_shader += "#define Y_CB_CR_SAME_TEXTURE 1\n";
        } else if (ycbcr_input_splitting == YCBCR_INPUT_SPLIT_Y_AND_CBCR) {
+               bool cb_cr_offsets_equal =
+                       (fabs(ycbcr_format.cb_x_position - ycbcr_format.cr_x_position) < 1e-6) &&
+                       (fabs(ycbcr_format.cb_y_position - ycbcr_format.cr_y_position) < 1e-6);
                char buf[256];
                snprintf(buf, sizeof(buf), "#define Y_CB_CR_SAME_TEXTURE 0\n#define CB_CR_SAME_TEXTURE 1\n#define CB_CR_OFFSETS_EQUAL %d\n",
-                       (fabs(ycbcr_format.cb_x_position - ycbcr_format.cr_x_position) < 1e-6));
+                       cb_cr_offsets_equal);
                frag_shader += buf;
        } else {
                frag_shader += "#define Y_CB_CR_SAME_TEXTURE 0\n#define CB_CR_SAME_TEXTURE 0\n";