X-Git-Url: https://git.sesse.net/?p=movit;a=blobdiff_plain;f=ycbcr_input.cpp;h=4bc519ce7f20068e3b8da5faecd988e5708e693c;hp=374237e1d748aaf8e61fd4c0c8e24891d6d00dce;hb=07f8e190c12f4b7883f7891b0c5b03d361cd97fb;hpb=dbdbdd8f13c846ce751dc455ce4d19cbe5dbb232 diff --git a/ycbcr_input.cpp b/ycbcr_input.cpp index 374237e..4bc519c 100644 --- a/ycbcr_input.cpp +++ b/ycbcr_input.cpp @@ -1,11 +1,13 @@ -#include -#include - +#include #include +#include +#include +#include +#include -#include "ycbcr_input.h" +#include "effect_util.h" #include "util.h" -#include "opengl.h" +#include "ycbcr_input.h" using namespace Eigen; @@ -79,6 +81,8 @@ YCbCrInput::YCbCrInput(const ImageFormat &image_format, heights[1] = height / ycbcr_format.chroma_subsampling_y; heights[2] = height / ycbcr_format.chroma_subsampling_y; + pixel_data[0] = pixel_data[1] = pixel_data[2] = NULL; + register_int("needs_mipmaps", &needs_mipmaps); } @@ -253,12 +257,20 @@ std::string YCbCrInput::output_fragment_shader() scale[0], scale[1], scale[2]); frag_shader += buf; - float chroma_offset_x = compute_chroma_offset( - ycbcr_format.chroma_x_position, ycbcr_format.chroma_subsampling_x, widths[1]); - float chroma_offset_y = compute_chroma_offset( - ycbcr_format.chroma_y_position, ycbcr_format.chroma_subsampling_y, heights[1]); - sprintf(buf, "const vec2 PREFIX(chroma_offset) = vec2(%.8f, %.8f);\n", - chroma_offset_x, chroma_offset_y); + float cb_offset_x = compute_chroma_offset( + ycbcr_format.cb_x_position, ycbcr_format.chroma_subsampling_x, widths[1]); + float cb_offset_y = compute_chroma_offset( + ycbcr_format.cb_y_position, ycbcr_format.chroma_subsampling_y, heights[1]); + sprintf(buf, "const vec2 PREFIX(cb_offset) = vec2(%.8f, %.8f);\n", + cb_offset_x, cb_offset_y); + frag_shader += buf; + + float cr_offset_x = compute_chroma_offset( + ycbcr_format.cr_x_position, ycbcr_format.chroma_subsampling_x, widths[2]); + float cr_offset_y = compute_chroma_offset( + ycbcr_format.cr_y_position, ycbcr_format.chroma_subsampling_y, heights[2]); + sprintf(buf, "const vec2 PREFIX(cr_offset) = vec2(%.8f, %.8f);\n", + cr_offset_x, cr_offset_y); frag_shader += buf; frag_shader += read_file("ycbcr_input.frag");