From: Steinar H. Gunderson Date: Sat, 29 Apr 2017 18:55:49 +0000 (+0200) Subject: In YCbCrInput, fix an issue where offsets would be treated as equal even if their... X-Git-Tag: 1.5.1~3 X-Git-Url: https://git.sesse.net/?p=movit;a=commitdiff_plain;h=f99a1a6295d7809703f6b0dfb7ab4360916b002e;ds=sidebyside In YCbCrInput, fix an issue where offsets would be treated as equal even if their y value differed. --- diff --git a/ycbcr_input.cpp b/ycbcr_input.cpp index e725750..925bf2a 100644 --- a/ycbcr_input.cpp +++ b/ycbcr_input.cpp @@ -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";