X-Git-Url: https://git.sesse.net/?p=movit;a=blobdiff_plain;f=ycbcr_422interleaved_input.h;h=88d12491a23d065d04ef6984ec3e810fc66859f3;hp=b3469864d5024373b9c301d73243e4cd3fac0c81;hb=eff011224abc5dc81f801f3ea44572287a55bcac;hpb=ba60914d4e5eda7b28af700bf43e9699b7aa720d diff --git a/ycbcr_422interleaved_input.h b/ycbcr_422interleaved_input.h index b346986..88d1249 100644 --- a/ycbcr_422interleaved_input.h +++ b/ycbcr_422interleaved_input.h @@ -28,6 +28,11 @@ // RGBA texture (from which we sample chroma). We throw away half of the color // channels each time, so bandwidth is wasted, but it makes for a very // uncomplicated shader. +// +// Note that if you can shuffle your data around very cheaply on the CPU +// (say, while you're decoding it out of some other buffer anyway), +// regular YCbCrInput with YCBCR_INPUT_SPLIT_Y_AND_CBCR will probably be +// more efficient, as it doesn't need this bandwidth waste. #include #include @@ -56,21 +61,21 @@ public: unsigned width, unsigned height); ~YCbCr422InterleavedInput(); - virtual std::string effect_type_id() const { return "YCbCr422InterleavedInput"; } + std::string effect_type_id() const override { return "YCbCr422InterleavedInput"; } - virtual bool can_output_linear_gamma() const { return false; } - virtual AlphaHandling alpha_handling() const { return OUTPUT_BLANK_ALPHA; } + bool can_output_linear_gamma() const override { return false; } + AlphaHandling alpha_handling() const override { return OUTPUT_BLANK_ALPHA; } - std::string output_fragment_shader(); + std::string output_fragment_shader() override; // Uploads the texture if it has changed since last time. - void set_gl_state(GLuint glsl_program_num, const std::string& prefix, unsigned *sampler_num); + void set_gl_state(GLuint glsl_program_num, const std::string& prefix, unsigned *sampler_num) override; - unsigned get_width() const { return width; } - unsigned get_height() const { return height; } - Colorspace get_color_space() const { return image_format.color_space; } - GammaCurve get_gamma_curve() const { return image_format.gamma_curve; } - virtual bool can_supply_mipmaps() const { return false; } + unsigned get_width() const override { return width; } + unsigned get_height() const override { return height; } + Colorspace get_color_space() const override { return image_format.color_space; } + GammaCurve get_gamma_curve() const override { return image_format.gamma_curve; } + bool can_supply_mipmaps() const override { return false; } // Tells the input where to fetch the actual pixel data. Note that if you change // this data, you must either call set_pixel_data() again (using the same pointer @@ -92,19 +97,20 @@ public: void invalidate_pixel_data(); - void set_pitch(unsigned pitch) { + void set_pitch(unsigned pitch) + { assert(pitch % ycbcr_format.chroma_subsampling_x == 0); pitches[CHANNEL_LUMA] = pitch; pitches[CHANNEL_CHROMA] = pitch / ycbcr_format.chroma_subsampling_x; invalidate_pixel_data(); } - virtual void inform_added(EffectChain *chain) + void inform_added(EffectChain *chain) override { resource_pool = chain->get_resource_pool(); } - bool set_int(const std::string& key, int value); + bool set_int(const std::string& key, int value) override; private: ImageFormat image_format; @@ -123,6 +129,8 @@ private: unsigned width, height; const unsigned char *pixel_data; ResourcePool *resource_pool; + + GLint uniform_tex_y, uniform_tex_cbcr; }; } // namespace movit