class AlphaDivisionEffect : public Effect {
public:
AlphaDivisionEffect() {}
- virtual std::string effect_type_id() const { return "AlphaDivisionEffect"; }
- std::string output_fragment_shader();
- virtual bool one_to_one_sampling() const { return true; }
+ std::string effect_type_id() const override { return "AlphaDivisionEffect"; }
+ std::string output_fragment_shader() override;
+ bool one_to_one_sampling() const override { return true; }
};
} // namespace movit
class AlphaMultiplicationEffect : public Effect {
public:
AlphaMultiplicationEffect() {}
- virtual std::string effect_type_id() const { return "AlphaMultiplicationEffect"; }
- std::string output_fragment_shader();
- virtual bool one_to_one_sampling() const { return true; }
+ std::string effect_type_id() const override { return "AlphaMultiplicationEffect"; }
+ std::string output_fragment_shader() override;
+ bool one_to_one_sampling() const override { return true; }
};
} // namespace movit
public:
BlurEffect();
- virtual std::string effect_type_id() const { return "BlurEffect"; }
+ std::string effect_type_id() const override { return "BlurEffect"; }
// We want this for the same reason as ResizeEffect; we could end up scaling
// down quite a lot.
- virtual bool needs_texture_bounce() const { return true; }
- virtual bool needs_mipmaps() const { return true; }
- virtual bool needs_srgb_primaries() const { return false; }
+ bool needs_texture_bounce() const override { return true; }
+ bool needs_mipmaps() const override { return true; }
+ bool needs_srgb_primaries() const override { return false; }
- virtual void inform_input_size(unsigned input_num, unsigned width, unsigned height);
+ void inform_input_size(unsigned input_num, unsigned width, unsigned height) override;
- virtual std::string output_fragment_shader() {
+ std::string output_fragment_shader() override {
assert(false);
}
- virtual 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 {
assert(false);
}
- virtual void rewrite_graph(EffectChain *graph, Node *self);
- virtual bool set_float(const std::string &key, float value);
- virtual bool set_int(const std::string &key, int value);
+ void rewrite_graph(EffectChain *graph, Node *self) override;
+ bool set_float(const std::string &key, float value) override;
+ bool set_int(const std::string &key, int value) override;
private:
void update_radius();
// so that it can make reasonable decisions for both blur passes.
SingleBlurPassEffect(BlurEffect *parent);
virtual ~SingleBlurPassEffect();
- virtual std::string effect_type_id() const { return "SingleBlurPassEffect"; }
+ std::string effect_type_id() const override { return "SingleBlurPassEffect"; }
- std::string output_fragment_shader();
+ std::string output_fragment_shader() override;
- virtual bool needs_texture_bounce() const { return true; }
- virtual bool needs_mipmaps() const { return true; }
- virtual bool needs_srgb_primaries() const { return false; }
- virtual AlphaHandling alpha_handling() const { return INPUT_PREMULTIPLIED_ALPHA_KEEP_BLANK; }
+ bool needs_texture_bounce() const override { return true; }
+ bool needs_mipmaps() const override { return true; }
+ bool needs_srgb_primaries() const override { return false; }
+ AlphaHandling alpha_handling() const override { return INPUT_PREMULTIPLIED_ALPHA_KEEP_BLANK; }
- virtual void inform_input_size(unsigned input_num, unsigned width, unsigned height) {
+ void inform_input_size(unsigned input_num, unsigned width, unsigned height) override {
if (parent != nullptr) {
parent->inform_input_size(input_num, width, height);
}
}
- virtual bool changes_output_size() const { return true; }
- virtual bool sets_virtual_output_size() const { return true; }
- virtual bool one_to_one_sampling() const { return false; } // Can sample outside the border.
+ bool changes_output_size() const override { return true; }
+ bool sets_virtual_output_size() const override { return true; }
+ bool one_to_one_sampling() const override { return false; } // Can sample outside the border.
- virtual void get_output_size(unsigned *width, unsigned *height, unsigned *virtual_width, unsigned *virtual_height) const {
+ void get_output_size(unsigned *width, unsigned *height, unsigned *virtual_width, unsigned *virtual_height) const override {
*width = this->width;
*height = this->height;
*virtual_width = this->virtual_width;
*virtual_height = this->virtual_height;
}
- void set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num);
- void clear_gl_state();
+ void set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num) override;
+ void clear_gl_state() override;
enum Direction { HORIZONTAL = 0, VERTICAL = 1 };
friend class EffectChain;
public:
- virtual std::string effect_type_id() const { return "ColorspaceConversionEffect"; }
- std::string output_fragment_shader();
+ std::string effect_type_id() const override { return "ColorspaceConversionEffect"; }
+ std::string output_fragment_shader() override;
- virtual bool needs_srgb_primaries() const { return false; }
- virtual AlphaHandling alpha_handling() const { return DONT_CARE_ALPHA_TYPE; }
- virtual bool one_to_one_sampling() const { return true; }
+ bool needs_srgb_primaries() const override { return false; }
+ AlphaHandling alpha_handling() const override { return DONT_CARE_ALPHA_TYPE; }
+ bool one_to_one_sampling() const override { return true; }
// Get a conversion matrix from the given color space to XYZ.
static Eigen::Matrix3d get_xyz_matrix(Colorspace space);
class ComplexModulateEffect : public Effect {
public:
ComplexModulateEffect();
- virtual std::string effect_type_id() const { return "ComplexModulateEffect"; }
- std::string output_fragment_shader();
+ std::string effect_type_id() const override { return "ComplexModulateEffect"; }
+ std::string output_fragment_shader() override;
// Technically we only need texture bounce for the second input
// (to be allowed to mess with its sampler state), but there's
// no way of expressing that currently.
- virtual bool needs_texture_bounce() const { return true; }
- virtual bool changes_output_size() const { return true; }
- virtual bool sets_virtual_output_size() const { return false; }
+ bool needs_texture_bounce() const override { return true; }
+ bool changes_output_size() const override { return true; }
+ bool sets_virtual_output_size() const override { return false; }
- virtual void inform_input_size(unsigned input_num, unsigned width, unsigned height);
- virtual void get_output_size(unsigned *width, unsigned *height,
- unsigned *virtual_width, unsigned *virtual_height) const;
- virtual unsigned num_inputs() const { return 2; }
- virtual void inform_added(EffectChain *chain) { this->chain = chain; }
+ void inform_input_size(unsigned input_num, unsigned width, unsigned height) override;
+ void get_output_size(unsigned *width, unsigned *height,
+ unsigned *virtual_width, unsigned *virtual_height) const override;
+ unsigned num_inputs() const override { return 2; }
+ void inform_added(EffectChain *chain) override { this->chain = chain; }
- 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;
private:
EffectChain *chain;
public:
DeconvolutionSharpenEffect();
virtual ~DeconvolutionSharpenEffect();
- virtual std::string effect_type_id() const { return "DeconvolutionSharpenEffect"; }
- std::string output_fragment_shader();
+ std::string effect_type_id() const override { return "DeconvolutionSharpenEffect"; }
+ std::string output_fragment_shader() override;
// Samples a lot of times from its input.
- virtual bool needs_texture_bounce() const { return true; }
+ bool needs_texture_bounce() const override { return true; }
- virtual void inform_input_size(unsigned input_num, unsigned width, unsigned height)
+ void inform_input_size(unsigned input_num, unsigned width, unsigned height) override
{
this->width = width;
this->height = height;
}
- void set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num);
- virtual AlphaHandling alpha_handling() const { return INPUT_PREMULTIPLIED_ALPHA_KEEP_BLANK; }
+ void set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num) override;
+ AlphaHandling alpha_handling() const override { return INPUT_PREMULTIPLIED_ALPHA_KEEP_BLANK; }
private:
// Input size.
class DeinterlaceEffect : public Effect {
public:
DeinterlaceEffect();
- virtual std::string effect_type_id() const { return "DeinterlaceEffect"; }
- std::string output_fragment_shader();
+ std::string effect_type_id() const override { return "DeinterlaceEffect"; }
+ std::string output_fragment_shader() override;
// Replaces itself with DeinterlaceComputeEffect if compute shaders are supported.
// Otherwise, does nothing.
- void rewrite_graph(EffectChain *graph, Node *self);
- bool set_int(const std::string &key, int value);
+ void rewrite_graph(EffectChain *graph, Node *self) override;
+ bool set_int(const std::string &key, int value) override;
- 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;
// First = before previous, second = previous, third = current,
// fourth = next, fifth = after next. These are treated symmetrically,
//
// Note that if you have interlaced _frames_ and not _fields_, you will
// need to pull them apart first, for instance with SliceEffect.
- virtual unsigned num_inputs() const { return 5; }
- virtual bool needs_texture_bounce() const { return true; }
- virtual bool changes_output_size() const { return true; }
+ unsigned num_inputs() const override { return 5; }
+ bool needs_texture_bounce() const override { return true; }
+ bool changes_output_size() const override { return true; }
- virtual AlphaHandling alpha_handling() const { return INPUT_PREMULTIPLIED_ALPHA_KEEP_BLANK; }
+ AlphaHandling alpha_handling() const override { return INPUT_PREMULTIPLIED_ALPHA_KEEP_BLANK; }
- virtual void inform_input_size(unsigned input_num, unsigned width, unsigned height);
- virtual void get_output_size(unsigned *width, unsigned *height,
- unsigned *virtual_width, unsigned *virtual_height) const;
+ void inform_input_size(unsigned input_num, unsigned width, unsigned height) override;
+ void get_output_size(unsigned *width, unsigned *height,
+ unsigned *virtual_width, unsigned *virtual_height) const override;
enum FieldPosition { TOP = 0, BOTTOM = 1 };
class DeinterlaceComputeEffect : public Effect {
public:
DeinterlaceComputeEffect();
- virtual std::string effect_type_id() const { return "DeinterlaceComputeEffect"; }
- std::string output_fragment_shader();
+ std::string effect_type_id() const override { return "DeinterlaceComputeEffect"; }
+ std::string output_fragment_shader() override;
- 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;
- virtual unsigned num_inputs() const { return 5; }
- virtual bool changes_output_size() const { return true; }
- virtual bool is_compute_shader() const { return true; }
- virtual void get_compute_dimensions(unsigned output_width, unsigned output_height,
- unsigned *x, unsigned *y, unsigned *z) const;
+ unsigned num_inputs() const override { return 5; }
+ bool changes_output_size() const override { return true; }
+ bool is_compute_shader() const override { return true; }
+ void get_compute_dimensions(unsigned output_width, unsigned output_height,
+ unsigned *x, unsigned *y, unsigned *z) const override;
- virtual AlphaHandling alpha_handling() const { return INPUT_PREMULTIPLIED_ALPHA_KEEP_BLANK; }
+ AlphaHandling alpha_handling() const override { return INPUT_PREMULTIPLIED_ALPHA_KEEP_BLANK; }
- virtual void inform_input_size(unsigned input_num, unsigned width, unsigned height);
- virtual void get_output_size(unsigned *width, unsigned *height,
- unsigned *virtual_width, unsigned *virtual_height) const;
+ void inform_input_size(unsigned input_num, unsigned width, unsigned height) override;
+ void get_output_size(unsigned *width, unsigned *height,
+ unsigned *virtual_width, unsigned *virtual_height) const override;
enum FieldPosition { TOP = 0, BOTTOM = 1 };
public:
DiffusionEffect();
~DiffusionEffect();
- virtual std::string effect_type_id() const { return "DiffusionEffect"; }
+ std::string effect_type_id() const override { return "DiffusionEffect"; }
- virtual void rewrite_graph(EffectChain *graph, Node *self);
- virtual bool set_float(const std::string &key, float value);
+ void rewrite_graph(EffectChain *graph, Node *self) override;
+ bool set_float(const std::string &key, float value) override;
- virtual std::string output_fragment_shader() {
+ std::string output_fragment_shader() override {
assert(false);
}
- virtual 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 {
assert(false);
}
class OverlayMatteEffect : public Effect {
public:
OverlayMatteEffect();
- virtual std::string effect_type_id() const { return "OverlayMatteEffect"; }
- std::string output_fragment_shader();
- virtual AlphaHandling alpha_handling() const { return INPUT_PREMULTIPLIED_ALPHA_KEEP_BLANK; }
+ std::string effect_type_id() const override { return "OverlayMatteEffect"; }
+ std::string output_fragment_shader() override;
+ AlphaHandling alpha_handling() const override { return INPUT_PREMULTIPLIED_ALPHA_KEEP_BLANK; }
- unsigned num_inputs() const { return 2; }
- virtual bool one_to_one_sampling() const { return true; }
+ unsigned num_inputs() const override { return 2; }
+ bool one_to_one_sampling() const override { return true; }
private:
float blurred_mix_amount;
public:
~DitherEffect();
- virtual std::string effect_type_id() const { return "DitherEffect"; }
- std::string output_fragment_shader();
+ std::string effect_type_id() const override { return "DitherEffect"; }
+ std::string output_fragment_shader() override;
// Note that if we did error diffusion, we'd actually want to diffuse the
// premultiplied error. However, we need to do dithering in the same
// space as quantization, whether that be pre- or postmultiply.
- virtual AlphaHandling alpha_handling() const { return DONT_CARE_ALPHA_TYPE; }
- virtual bool one_to_one_sampling() const { return true; }
+ AlphaHandling alpha_handling() const override { return DONT_CARE_ALPHA_TYPE; }
+ bool one_to_one_sampling() const override { return true; }
- 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;
private:
void update_texture(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num);
class IdentityEffect : public Effect {
public:
IdentityEffect() {}
- virtual string effect_type_id() const { return "IdentityEffect"; }
- string output_fragment_shader() { return read_file("identity.frag"); }
+ string effect_type_id() const override { return "IdentityEffect"; }
+ string output_fragment_shader() override { return read_file("identity.frag"); }
};
} // namespace
class IdentityEffect : public Effect {
public:
IdentityEffect() {}
- virtual string effect_type_id() const { return "IdentityEffect"; }
- string output_fragment_shader() { return read_file("identity.frag"); }
+ string effect_type_id() const override { return "IdentityEffect"; }
+ string output_fragment_shader() override { return read_file("identity.frag"); }
};
TEST(EffectChainTest, Identity) {
class BouncingIdentityEffect : public Effect {
public:
BouncingIdentityEffect() {}
- virtual string effect_type_id() const { return "IdentityEffect"; }
- string output_fragment_shader() { return read_file("identity.frag"); }
- bool needs_texture_bounce() const { return true; }
- AlphaHandling alpha_handling() const { return DONT_CARE_ALPHA_TYPE; }
+ string effect_type_id() const override { return "IdentityEffect"; }
+ string output_fragment_shader() override { return read_file("identity.frag"); }
+ bool needs_texture_bounce() const override { return true; }
+ AlphaHandling alpha_handling() const override { return DONT_CARE_ALPHA_TYPE; }
};
TEST(EffectChainTest, TextureBouncePreservesIdentity) {
class InvertEffect : public Effect {
public:
InvertEffect() {}
- virtual string effect_type_id() const { return "InvertEffect"; }
- string output_fragment_shader() { return read_file("invert_effect.frag"); }
+ string effect_type_id() const override { return "InvertEffect"; }
+ string output_fragment_shader() override { return read_file("invert_effect.frag"); }
// A real invert would actually care about its alpha,
// but in this unit test, it only complicates things.
- virtual AlphaHandling alpha_handling() const { return DONT_CARE_ALPHA_TYPE; }
+ AlphaHandling alpha_handling() const override { return DONT_CARE_ALPHA_TYPE; }
};
// Like IdentityEffect, but rewrites itself out of the loop,
class RewritingEffect : public Effect {
public:
RewritingEffect() : effect(new T()), replaced_node(nullptr) {}
- virtual string effect_type_id() const { return "RewritingEffect[" + effect->effect_type_id() + "]"; }
- string output_fragment_shader() { EXPECT_TRUE(false); return read_file("identity.frag"); }
- virtual void rewrite_graph(EffectChain *graph, Node *self) {
+ string effect_type_id() const override { return "RewritingEffect[" + effect->effect_type_id() + "]"; }
+ string output_fragment_shader() override { EXPECT_TRUE(false); return read_file("identity.frag"); }
+ void rewrite_graph(EffectChain *graph, Node *self) override {
replaced_node = graph->add_node(effect);
graph->replace_receiver(self, replaced_node);
graph->replace_sender(self, replaced_node);
: FlatInput(format, pixel_format, type, width, height),
overridden_color_space(format.color_space),
overridden_gamma_curve(format.gamma_curve) {}
- virtual string effect_type_id() const { return "UnknownColorspaceInput"; }
+ string effect_type_id() const override { return "UnknownColorspaceInput"; }
void set_color_space(Colorspace colorspace) {
overridden_color_space = colorspace;
void set_gamma_curve(GammaCurve gamma_curve) {
overridden_gamma_curve = gamma_curve;
}
- Colorspace get_color_space() const { return overridden_color_space; }
- GammaCurve get_gamma_curve() const { return overridden_gamma_curve; }
+ Colorspace get_color_space() const override { return overridden_color_space; }
+ GammaCurve get_gamma_curve() const override { return overridden_gamma_curve; }
private:
Colorspace overridden_color_space;
class BlueInput : public Input {
public:
BlueInput() { register_int("needs_mipmaps", &needs_mipmaps); }
- virtual string effect_type_id() const { return "IdentityEffect"; }
- string output_fragment_shader() { return read_file("blue.frag"); }
- virtual AlphaHandling alpha_handling() const { return OUTPUT_BLANK_ALPHA; }
- virtual void finalize() {}
- virtual bool can_output_linear_gamma() const { return true; }
- virtual unsigned get_width() const { return 1; }
- virtual unsigned get_height() const { return 1; }
- virtual Colorspace get_color_space() const { return COLORSPACE_sRGB; }
- virtual GammaCurve get_gamma_curve() const { return GAMMA_LINEAR; }
+ string effect_type_id() const override { return "IdentityEffect"; }
+ string output_fragment_shader() override { return read_file("blue.frag"); }
+ AlphaHandling alpha_handling() const override { return OUTPUT_BLANK_ALPHA; }
+ bool can_output_linear_gamma() const override { return true; }
+ unsigned get_width() const override { return 1; }
+ unsigned get_height() const override { return 1; }
+ Colorspace get_color_space() const override { return COLORSPACE_sRGB; }
+ GammaCurve get_gamma_curve() const override { return GAMMA_LINEAR; }
private:
int needs_mipmaps;
class RewritingToBlueInput : public Input {
public:
RewritingToBlueInput() : blue_node(nullptr) { register_int("needs_mipmaps", &needs_mipmaps); }
- virtual string effect_type_id() const { return "RewritingToBlueInput"; }
- string output_fragment_shader() { EXPECT_TRUE(false); return read_file("identity.frag"); }
- virtual void rewrite_graph(EffectChain *graph, Node *self) {
+ string effect_type_id() const override { return "RewritingToBlueInput"; }
+ string output_fragment_shader() override { EXPECT_TRUE(false); return read_file("identity.frag"); }
+ void rewrite_graph(EffectChain *graph, Node *self) override {
Node *blue_node = graph->add_node(new BlueInput());
graph->replace_receiver(self, blue_node);
graph->replace_sender(self, blue_node);
// Dummy values that we need to implement because we inherit from Input.
// Same as BlueInput.
- virtual AlphaHandling alpha_handling() const { return OUTPUT_BLANK_ALPHA; }
- virtual void finalize() {}
- virtual bool can_output_linear_gamma() const { return true; }
- virtual unsigned get_width() const { return 1; }
- virtual unsigned get_height() const { return 1; }
- virtual Colorspace get_color_space() const { return COLORSPACE_sRGB; }
- virtual GammaCurve get_gamma_curve() const { return GAMMA_LINEAR; }
+ AlphaHandling alpha_handling() const override { return OUTPUT_BLANK_ALPHA; }
+ bool can_output_linear_gamma() const override { return true; }
+ unsigned get_width() const override { return 1; }
+ unsigned get_height() const override { return 1; }
+ Colorspace get_color_space() const override { return COLORSPACE_sRGB; }
+ GammaCurve get_gamma_curve() const override { return GAMMA_LINEAR; }
Node *blue_node;
class BlankAlphaPreservingEffect : public Effect {
public:
BlankAlphaPreservingEffect() {}
- virtual string effect_type_id() const { return "BlankAlphaPreservingEffect"; }
- string output_fragment_shader() { return read_file("identity.frag"); }
- virtual AlphaHandling alpha_handling() const { return INPUT_PREMULTIPLIED_ALPHA_KEEP_BLANK; }
+ string effect_type_id() const override { return "BlankAlphaPreservingEffect"; }
+ string output_fragment_shader() override { return read_file("identity.frag"); }
+ AlphaHandling alpha_handling() const override { return INPUT_PREMULTIPLIED_ALPHA_KEEP_BLANK; }
};
TEST(EffectChainTest, NoAlphaConversionsWithBlankAlphaPreservingEffect) {
class MipmapNeedingEffect : public Effect {
public:
MipmapNeedingEffect() {}
- virtual bool needs_mipmaps() const { return true; }
+ bool needs_mipmaps() const override { return true; }
// To be allowed to mess with the sampler state.
- virtual bool needs_texture_bounce() const { return true; }
+ bool needs_texture_bounce() const override { return true; }
- virtual string effect_type_id() const { return "MipmapNeedingEffect"; }
- string output_fragment_shader() { return read_file("mipmap_needing_effect.frag"); }
- virtual void inform_added(EffectChain *chain) { this->chain = chain; }
+ string effect_type_id() const override { return "MipmapNeedingEffect"; }
+ string output_fragment_shader() override { return read_file("mipmap_needing_effect.frag"); }
+ void inform_added(EffectChain *chain) override { this->chain = chain; }
- void set_gl_state(GLuint glsl_program_num, const string& prefix, unsigned *sampler_num)
+ void set_gl_state(GLuint glsl_program_num, const string& prefix, unsigned *sampler_num) override
{
Node *self = chain->find_node_for_effect(this);
glActiveTexture(chain->get_input_sampler(self, 0));
NonMipmapCapableInput(ImageFormat format, MovitPixelFormat pixel_format, GLenum type, unsigned width, unsigned height)
: FlatInput(format, pixel_format, type, width, height) {}
- virtual bool can_supply_mipmaps() const { return false; }
- bool set_int(const std::string& key, int value) {
+ bool can_supply_mipmaps() const override { return false; }
+ bool set_int(const std::string& key, int value) override {
if (key == "needs_mipmaps") {
assert(value == 0);
}
class AddEffect : public Effect {
public:
AddEffect() {}
- virtual string effect_type_id() const { return "AddEffect"; }
- string output_fragment_shader() { return read_file("add.frag"); }
- virtual unsigned num_inputs() const { return 2; }
- virtual AlphaHandling alpha_handling() const { return DONT_CARE_ALPHA_TYPE; }
+ string effect_type_id() const override { return "AddEffect"; }
+ string output_fragment_shader() override { return read_file("add.frag"); }
+ unsigned num_inputs() const override { return 2; }
+ AlphaHandling alpha_handling() const override { return DONT_CARE_ALPHA_TYPE; }
};
// Constructs the graph
class SizeStoringEffect : public BouncingIdentityEffect {
public:
SizeStoringEffect() : input_width(-1), input_height(-1) {}
- virtual void inform_input_size(unsigned input_num, unsigned width, unsigned height) {
+ void inform_input_size(unsigned input_num, unsigned width, unsigned height) override {
assert(input_num == 0);
input_width = width;
input_height = height;
}
- virtual string effect_type_id() const { return "SizeStoringEffect"; }
+ string effect_type_id() const override { return "SizeStoringEffect"; }
int input_width, input_height;
};
height(height),
virtual_width(virtual_width),
virtual_height(virtual_height) {}
- virtual string effect_type_id() const { return "VirtualResizeEffect"; }
- string output_fragment_shader() { return read_file("identity.frag"); }
+ string effect_type_id() const override { return "VirtualResizeEffect"; }
+ string output_fragment_shader() override { return read_file("identity.frag"); }
- virtual bool changes_output_size() const { return true; }
+ bool changes_output_size() const override { return true; }
- virtual void get_output_size(unsigned *width, unsigned *height,
- unsigned *virtual_width, unsigned *virtual_height) const {
+ void get_output_size(unsigned *width, unsigned *height,
+ unsigned *virtual_width, unsigned *virtual_height) const override {
*width = this->width;
*height = this->height;
*virtual_width = this->virtual_width;
public:
NonVirtualResizeEffect(int width, int height)
: VirtualResizeEffect(width, height, width, height) {}
- virtual string effect_type_id() const { return "NonVirtualResizeEffect"; }
- virtual bool sets_virtual_output_size() const { return false; }
+ string effect_type_id() const override { return "NonVirtualResizeEffect"; }
+ bool sets_virtual_output_size() const override { return false; }
};
// An effect that promises one-to-one sampling (unlike IdentityEffect).
class OneToOneEffect : public Effect {
public:
OneToOneEffect() {}
- virtual string effect_type_id() const { return "OneToOneEffect"; }
- string output_fragment_shader() { return read_file("identity.frag"); }
- virtual bool one_to_one_sampling() const { return true; }
+ string effect_type_id() const override { return "OneToOneEffect"; }
+ string output_fragment_shader() override { return read_file("identity.frag"); }
+ bool one_to_one_sampling() const override { return true; }
};
TEST(EffectChainTest, NoBounceWithOneToOneSampling) {
class PrintfingBlueEffect : public Effect {
public:
PrintfingBlueEffect() {}
- virtual string effect_type_id() const { return "PrintfingBlueEffect"; }
- string output_fragment_shader() {
+ string effect_type_id() const override { return "PrintfingBlueEffect"; }
+ string output_fragment_shader() override {
stringstream ss;
ss.imbue(locale("C"));
ss.precision(8);
class IdentityComputeEffect : public Effect {
public:
IdentityComputeEffect() {}
- virtual string effect_type_id() const { return "IdentityComputeEffect"; }
- virtual bool is_compute_shader() const { return true; }
- string output_fragment_shader() { return read_file("identity.comp"); }
+ string effect_type_id() const override { return "IdentityComputeEffect"; }
+ bool is_compute_shader() const override { return true; }
+ string output_fragment_shader() override { return read_file("identity.comp"); }
};
class WithAndWithoutComputeShaderTest : public testing::TestWithParam<string> {
class PassThroughEffect : public IdentityEffect {
public:
PassThroughEffect() {}
- virtual string effect_type_id() const { return "PassThroughEffect"; }
- virtual bool needs_linear_light() const { return false; }
- AlphaHandling alpha_handling() const { return DONT_CARE_ALPHA_TYPE; }
+ string effect_type_id() const override { return "PassThroughEffect"; }
+ bool needs_linear_light() const override { return false; }
+ AlphaHandling alpha_handling() const override { return DONT_CARE_ALPHA_TYPE; }
};
// Same, just also bouncing.
class BouncingPassThroughEffect : public BouncingIdentityEffect {
public:
BouncingPassThroughEffect() {}
- virtual string effect_type_id() const { return "BouncingPassThroughEffect"; }
- virtual bool needs_linear_light() const { return false; }
- bool needs_texture_bounce() const { return true; }
- AlphaHandling alpha_handling() const { return DONT_CARE_ALPHA_TYPE; }
+ string effect_type_id() const override { return "BouncingPassThroughEffect"; }
+ bool needs_linear_light() const override { return false; }
+ bool needs_texture_bounce() const override { return true; }
+ AlphaHandling alpha_handling() const override { return DONT_CARE_ALPHA_TYPE; }
};
TEST(EffectChainTest, Linear10bitIntermediateAccuracy) {
class RecordingIdentityEffect : public Effect {
public:
RecordingIdentityEffect() {}
- virtual string effect_type_id() const { return "RecordingIdentityEffect"; }
- string output_fragment_shader() { return read_file("identity.frag"); }
+ string effect_type_id() const override { return "RecordingIdentityEffect"; }
+ string output_fragment_shader() override { return read_file("identity.frag"); }
GLuint last_glsl_program_num;
- 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
{
last_glsl_program_num = glsl_program_num;
}
public:
FFTConvolutionEffect(int input_width, int input_height, int convolve_width, int convolve_height);
~FFTConvolutionEffect();
- virtual std::string effect_type_id() const { return "FFTConvolutionEffect"; }
- std::string output_fragment_shader() { assert(false); }
- virtual void rewrite_graph(EffectChain *graph, Node *self);
+ std::string effect_type_id() const override { return "FFTConvolutionEffect"; }
+ std::string output_fragment_shader() override { assert(false); }
+ void rewrite_graph(EffectChain *graph, Node *self) override;
// See FFTInput::set_pixel_data().
void set_convolution_kernel(const float *pixel_data)
FFTInput(unsigned width, unsigned height);
~FFTInput();
- virtual std::string effect_type_id() const { return "FFTInput"; }
- std::string output_fragment_shader();
+ std::string effect_type_id() const override { return "FFTInput"; }
+ std::string output_fragment_shader() override;
// FFTs the data and 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 fft_width; }
- unsigned get_height() const { return fft_height; }
+ unsigned get_width() const override { return fft_width; }
+ unsigned get_height() const override { return fft_height; }
// Strictly speaking, FFT data doesn't have any colorspace or gamma;
// these values are the Movit standards for “do nothing”.
- Colorspace get_color_space() const { return COLORSPACE_sRGB; }
- GammaCurve get_gamma_curve() const { return GAMMA_LINEAR; }
- virtual AlphaHandling alpha_handling() const { return INPUT_AND_OUTPUT_PREMULTIPLIED_ALPHA; }
- virtual bool is_single_texture() const { return true; }
- virtual bool can_output_linear_gamma() const { return true; }
- virtual bool can_supply_mipmaps() const { return false; }
+ Colorspace get_color_space() const override { return COLORSPACE_sRGB; }
+ GammaCurve get_gamma_curve() const override { return GAMMA_LINEAR; }
+ AlphaHandling alpha_handling() const override { return INPUT_AND_OUTPUT_PREMULTIPLIED_ALPHA; }
+ bool is_single_texture() const override { return true; }
+ bool can_output_linear_gamma() const override { return true; }
+ 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
void invalidate_pixel_data();
- virtual void inform_added(EffectChain *chain)
+ void inform_added(EffectChain *chain) override
{
resource_pool = chain->get_resource_pool();
}
- virtual bool set_int(const std::string& key, int value);
+ bool set_int(const std::string& key, int value) override;
private:
GLuint texture_num;
public:
FFTPassEffect();
~FFTPassEffect();
- virtual std::string effect_type_id() const {
+ std::string effect_type_id() const override {
char buf[256];
if (inverse) {
snprintf(buf, sizeof(buf), "IFFTPassEffect[%d]", (1 << pass_number));
}
return buf;
}
- std::string output_fragment_shader();
+ std::string output_fragment_shader() override;
- 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;
// We don't actually change the output size, but this flag makes sure
// that no other effect is chained after us. This is important since
// mode to GL_NEAREST, which other effects are not ready for; so, the
// combination of these two flags guarantee that we're run entirely alone
// in our own phase, which is exactly what we want.
- virtual bool needs_texture_bounce() const { return true; }
- virtual bool changes_output_size() const { return true; }
- virtual bool sets_virtual_output_size() const { return false; }
+ bool needs_texture_bounce() const override { return true; }
+ bool changes_output_size() const override { return true; }
+ bool sets_virtual_output_size() const override { return false; }
- virtual void inform_input_size(unsigned input_num, unsigned width, unsigned height)
+ void inform_input_size(unsigned input_num, unsigned width, unsigned height) override
{
assert(input_num == 0);
input_width = width;
input_height = height;
}
- virtual void get_output_size(unsigned *width, unsigned *height,
- unsigned *virtual_width, unsigned *virtual_height) const {
+ void get_output_size(unsigned *width, unsigned *height,
+ unsigned *virtual_width, unsigned *virtual_height) const override {
*width = *virtual_width = input_width;
*height = *virtual_height = input_height;
}
- virtual void inform_added(EffectChain *chain) { this->chain = chain; }
+ void inform_added(EffectChain *chain) override { this->chain = chain; }
enum Direction { INVALID = -1, HORIZONTAL = 0, VERTICAL = 1 };
FlatInput(ImageFormat format, MovitPixelFormat pixel_format, GLenum type, unsigned width, unsigned height);
~FlatInput();
- virtual std::string effect_type_id() const { return "FlatInput"; }
+ std::string effect_type_id() const override { return "FlatInput"; }
- virtual bool can_output_linear_gamma() const {
+ bool can_output_linear_gamma() const override {
// On desktop OpenGL, there's also GL_SLUMINANCE8 which could give us
// support for single-channel sRGB decoding, but it's not supported
// on GLES, and we're already actively rewriting single-channel inputs
(image_format.gamma_curve == GAMMA_LINEAR ||
image_format.gamma_curve == GAMMA_sRGB));
}
- virtual AlphaHandling alpha_handling() const {
+ AlphaHandling alpha_handling() const override {
switch (pixel_format) {
case FORMAT_RGBA_PREMULTIPLIED_ALPHA:
return INPUT_AND_OUTPUT_PREMULTIPLIED_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 is_single_texture() const { return true; }
+ 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 is_single_texture() const override { return true; }
// 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
this->owns_texture = false;
}
- virtual void inform_added(EffectChain *chain)
+ void inform_added(EffectChain *chain) override
{
resource_pool = chain->get_resource_pool();
}
friend class EffectChain;
public:
- virtual std::string effect_type_id() const { return "GammaCompressionEffect"; }
- std::string output_fragment_shader();
- virtual void set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num);
+ std::string effect_type_id() const override { return "GammaCompressionEffect"; }
+ std::string output_fragment_shader() override;
+ void set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num) override;
- virtual bool needs_srgb_primaries() const { return false; }
- virtual bool one_to_one_sampling() const { return true; }
+ bool needs_srgb_primaries() const override { return false; }
+ bool one_to_one_sampling() const override { return true; }
// Actually needs postmultiplied input as well as outputting it.
// EffectChain will take care of that.
- virtual AlphaHandling alpha_handling() const { return OUTPUT_POSTMULTIPLIED_ALPHA; }
+ AlphaHandling alpha_handling() const override { return OUTPUT_POSTMULTIPLIED_ALPHA; }
private:
GammaCurve destination_curve;
friend class EffectChain;
public:
- virtual std::string effect_type_id() const { return "GammaExpansionEffect"; }
- std::string output_fragment_shader();
- virtual void set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num);
+ std::string effect_type_id() const override { return "GammaExpansionEffect"; }
+ std::string output_fragment_shader() override;
+ void set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num) override;
- virtual bool needs_linear_light() const { return false; }
- virtual bool needs_srgb_primaries() const { return false; }
- virtual bool one_to_one_sampling() const { return true; }
+ bool needs_linear_light() const override { return false; }
+ bool needs_srgb_primaries() const override { return false; }
+ bool one_to_one_sampling() const override { return true; }
// Actually processes its input in a nonlinear fashion,
// but does not touch alpha, and we are a special case anyway.
- virtual AlphaHandling alpha_handling() const { return DONT_CARE_ALPHA_TYPE; }
+ AlphaHandling alpha_handling() const override { return DONT_CARE_ALPHA_TYPE; }
private:
GammaCurve source_curve;
class GlowEffect : public Effect {
public:
GlowEffect();
- virtual std::string effect_type_id() const { return "GlowEffect"; }
+ std::string effect_type_id() const override { return "GlowEffect"; }
- virtual bool needs_srgb_primaries() const { return false; }
+ bool needs_srgb_primaries() const override { return false; }
- virtual void rewrite_graph(EffectChain *graph, Node *self);
- virtual bool set_float(const std::string &key, float value);
+ void rewrite_graph(EffectChain *graph, Node *self) override;
+ bool set_float(const std::string &key, float value) override;
- virtual std::string output_fragment_shader() {
+ std::string output_fragment_shader() override {
assert(false);
}
- virtual 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 {
assert(false);
}
class HighlightCutoffEffect : public Effect {
public:
HighlightCutoffEffect();
- virtual std::string effect_type_id() const { return "HighlightCutoffEffect"; }
- std::string output_fragment_shader();
+ std::string effect_type_id() const override { return "HighlightCutoffEffect"; }
+ std::string output_fragment_shader() override;
- virtual AlphaHandling alpha_handling() const { return INPUT_PREMULTIPLIED_ALPHA_KEEP_BLANK; }
- virtual bool one_to_one_sampling() const { return true; }
+ AlphaHandling alpha_handling() const override { return INPUT_PREMULTIPLIED_ALPHA_KEEP_BLANK; }
+ bool one_to_one_sampling() const override { return true; }
private:
float cutoff;
// including possibly uploading the texture if so required.
class Input : public Effect {
public:
- virtual unsigned num_inputs() const { return 0; }
+ unsigned num_inputs() const override { return 0; }
// Whether this input can deliver linear gamma directly if it's
// asked to. (If so, set the parameter “output_linear_gamma”
class LiftGammaGainEffect : public Effect {
public:
LiftGammaGainEffect();
- virtual std::string effect_type_id() const { return "LiftGammaGainEffect"; }
- virtual AlphaHandling alpha_handling() const { return INPUT_PREMULTIPLIED_ALPHA_KEEP_BLANK; }
- virtual bool one_to_one_sampling() const { return true; }
- std::string output_fragment_shader();
+ std::string effect_type_id() const override { return "LiftGammaGainEffect"; }
+ AlphaHandling alpha_handling() const override { return INPUT_PREMULTIPLIED_ALPHA_KEEP_BLANK; }
+ bool one_to_one_sampling() const override { return true; }
+ std::string output_fragment_shader() override;
- 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;
private:
RGBTriplet lift, gamma, gain;
class LumaMixEffect : public Effect {
public:
LumaMixEffect();
- virtual std::string effect_type_id() const { return "LumaMixEffect"; }
- std::string output_fragment_shader();
- virtual void set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num);
-
- virtual bool needs_srgb_primaries() const { return false; }
- virtual unsigned num_inputs() const { return 3; }
- virtual bool one_to_one_sampling() const { return true; }
- virtual AlphaHandling alpha_handling() const { return INPUT_PREMULTIPLIED_ALPHA_KEEP_BLANK; }
+ std::string effect_type_id() const override { return "LumaMixEffect"; }
+ std::string output_fragment_shader() override;
+ void set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num) override;
+
+ bool needs_srgb_primaries() const override { return false; }
+ unsigned num_inputs() const override { return 3; }
+ bool one_to_one_sampling() const override { return true; }
+ AlphaHandling alpha_handling() const override { return INPUT_PREMULTIPLIED_ALPHA_KEEP_BLANK; }
private:
float transition_width, progress;
class MirrorEffect : public Effect {
public:
MirrorEffect();
- virtual std::string effect_type_id() const { return "MirrorEffect"; }
- std::string output_fragment_shader();
+ std::string effect_type_id() const override { return "MirrorEffect"; }
+ std::string output_fragment_shader() override;
- virtual bool needs_linear_light() const { return false; }
- virtual bool needs_srgb_primaries() const { return false; }
- virtual AlphaHandling alpha_handling() const { return DONT_CARE_ALPHA_TYPE; }
- virtual bool one_to_one_sampling() const { return true; }
+ bool needs_linear_light() const override { return false; }
+ bool needs_srgb_primaries() const override { return false; }
+ AlphaHandling alpha_handling() const override { return DONT_CARE_ALPHA_TYPE; }
+ bool one_to_one_sampling() const override { return true; }
};
} // namespace movit
class MixEffect : public Effect {
public:
MixEffect();
- virtual std::string effect_type_id() const { return "MixEffect"; }
- std::string output_fragment_shader();
+ std::string effect_type_id() const override { return "MixEffect"; }
+ std::string output_fragment_shader() override;
- virtual bool needs_srgb_primaries() const { return false; }
- virtual unsigned num_inputs() const { return 2; }
- virtual bool one_to_one_sampling() const { return true; }
+ bool needs_srgb_primaries() const override { return false; }
+ unsigned num_inputs() const override { return 2; }
+ bool one_to_one_sampling() const override { return true; }
// TODO: In the common case where a+b=1, it would be useful to be able to set
// alpha_handling() to INPUT_PREMULTIPLIED_ALPHA_KEEP_BLANK. However, right now
class MultiplyEffect : public Effect {
public:
MultiplyEffect();
- virtual std::string effect_type_id() const { return "MultiplyEffect"; }
- std::string output_fragment_shader();
- virtual bool one_to_one_sampling() const { return true; }
+ std::string effect_type_id() const override { return "MultiplyEffect"; }
+ std::string output_fragment_shader() override;
+ bool one_to_one_sampling() const override { return true; }
private:
RGBATuple factor;
class OverlayEffect : public Effect {
public:
OverlayEffect();
- virtual std::string effect_type_id() const { return "OverlayEffect"; }
- std::string output_fragment_shader();
+ std::string effect_type_id() const override { return "OverlayEffect"; }
+ std::string output_fragment_shader() override;
- virtual bool needs_srgb_primaries() const { return false; }
- virtual unsigned num_inputs() const { return 2; }
- virtual bool one_to_one_sampling() const { return true; }
+ bool needs_srgb_primaries() const override { return false; }
+ unsigned num_inputs() const override { return 2; }
+ bool one_to_one_sampling() const override { return true; }
// Actually, if _either_ image has blank alpha, our output will have
// blank alpha, too (this only tells the framework that having _both_
// images with blank alpha would result in blank alpha).
// However, understanding that would require changes
// to EffectChain, so postpone that optimization for later.
- virtual AlphaHandling alpha_handling() const { return INPUT_PREMULTIPLIED_ALPHA_KEEP_BLANK; }
+ AlphaHandling alpha_handling() const override { return INPUT_PREMULTIPLIED_ALPHA_KEEP_BLANK; }
private:
// If true, overlays input1 on top of input2 instead of vice versa.
class PaddingEffect : public Effect {
public:
PaddingEffect();
- virtual std::string effect_type_id() const { return "PaddingEffect"; }
- std::string output_fragment_shader();
- void set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num);
+ std::string effect_type_id() const override { return "PaddingEffect"; }
+ std::string output_fragment_shader() override;
+ void set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num) override;
- virtual bool needs_linear_light() const;
- virtual bool needs_srgb_primaries() const;
- virtual AlphaHandling alpha_handling() const;
+ bool needs_linear_light() const override;
+ bool needs_srgb_primaries() const override;
+ AlphaHandling alpha_handling() const override;
- virtual bool changes_output_size() const { return true; }
- virtual bool sets_virtual_output_size() const { return false; }
- virtual void get_output_size(unsigned *width, unsigned *height, unsigned *virtual_width, unsigned *virtual_height) const;
- virtual void inform_input_size(unsigned input_num, unsigned width, unsigned height);
+ bool changes_output_size() const override { return true; }
+ bool sets_virtual_output_size() const override { return false; }
+ void get_output_size(unsigned *width, unsigned *height, unsigned *virtual_width, unsigned *virtual_height) const override;
+ void inform_input_size(unsigned input_num, unsigned width, unsigned height) override;
private:
RGBATuple border_color;
class IntegralPaddingEffect : public PaddingEffect {
public:
IntegralPaddingEffect();
- virtual std::string effect_type_id() const { return "IntegralPaddingEffect"; }
- virtual bool one_to_one_sampling() const { return true; }
- virtual bool set_int(const std::string&, int value);
- virtual bool set_float(const std::string &key, float value);
+ std::string effect_type_id() const override { return "IntegralPaddingEffect"; }
+ bool one_to_one_sampling() const override { return true; }
+ bool set_int(const std::string&, int value) override;
+ bool set_float(const std::string &key, float value) override;
};
} // namespace movit
ResampleEffect();
~ResampleEffect();
- virtual std::string effect_type_id() const { return "ResampleEffect"; }
+ std::string effect_type_id() const override { return "ResampleEffect"; }
// We want this for the same reason as ResizeEffect; we could end up scaling
// down quite a lot.
- virtual bool needs_texture_bounce() const { return true; }
- virtual bool needs_srgb_primaries() const { return false; }
+ bool needs_texture_bounce() const override { return true; }
+ bool needs_srgb_primaries() const override { return false; }
- virtual void inform_input_size(unsigned input_num, unsigned width, unsigned height);
+ void inform_input_size(unsigned input_num, unsigned width, unsigned height) override;
- virtual std::string output_fragment_shader() {
+ std::string output_fragment_shader() override {
assert(false);
}
- virtual 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 {
assert(false);
}
- virtual void rewrite_graph(EffectChain *graph, Node *self);
- virtual bool set_float(const std::string &key, float value);
+ void rewrite_graph(EffectChain *graph, Node *self) override;
+ bool set_float(const std::string &key, float value) override;
private:
void update_size();
// resolutions.
SingleResamplePassEffect(ResampleEffect *parent);
~SingleResamplePassEffect();
- virtual std::string effect_type_id() const { return "SingleResamplePassEffect"; }
+ std::string effect_type_id() const override { return "SingleResamplePassEffect"; }
- std::string output_fragment_shader();
+ std::string output_fragment_shader() override;
- virtual bool needs_texture_bounce() const { return true; }
- virtual bool needs_srgb_primaries() const { return false; }
- virtual AlphaHandling alpha_handling() const { return INPUT_PREMULTIPLIED_ALPHA_KEEP_BLANK; }
+ bool needs_texture_bounce() const override { return true; }
+ bool needs_srgb_primaries() const override { return false; }
+ AlphaHandling alpha_handling() const override { return INPUT_PREMULTIPLIED_ALPHA_KEEP_BLANK; }
- virtual void inform_added(EffectChain *chain) { this->chain = chain; }
- virtual void inform_input_size(unsigned input_num, unsigned width, unsigned height) {
+ void inform_added(EffectChain *chain) override { this->chain = chain; }
+ void inform_input_size(unsigned input_num, unsigned width, unsigned height) override {
if (parent != nullptr) {
parent->inform_input_size(input_num, width, height);
}
}
- virtual bool changes_output_size() const { return true; }
- virtual bool sets_virtual_output_size() const { return false; }
+ bool changes_output_size() const override { return true; }
+ bool sets_virtual_output_size() const override { return false; }
- virtual void get_output_size(unsigned *width, unsigned *height, unsigned *virtual_width, unsigned *virtual_height) const {
+ void get_output_size(unsigned *width, unsigned *height, unsigned *virtual_width, unsigned *virtual_height) const override {
*virtual_width = *width = this->output_width;
*virtual_height = *height = this->output_height;
}
- 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;
enum Direction { HORIZONTAL = 0, VERTICAL = 1 };
class ResizeEffect : public Effect {
public:
ResizeEffect();
- virtual std::string effect_type_id() const { return "ResizeEffect"; }
- std::string output_fragment_shader();
+ std::string effect_type_id() const override { return "ResizeEffect"; }
+ std::string output_fragment_shader() override;
// We want processing done pre-filtering and mipmapped,
// in case we need to scale down a lot.
- virtual bool needs_texture_bounce() const { return true; }
- virtual bool needs_mipmaps() const { return true; }
- virtual AlphaHandling alpha_handling() const { return INPUT_PREMULTIPLIED_ALPHA_KEEP_BLANK; }
+ bool needs_texture_bounce() const override { return true; }
+ bool needs_mipmaps() const override { return true; }
+ AlphaHandling alpha_handling() const override { return INPUT_PREMULTIPLIED_ALPHA_KEEP_BLANK; }
- virtual bool changes_output_size() const { return true; }
- virtual bool sets_virtual_output_size() const { return false; }
- virtual void get_output_size(unsigned *width, unsigned *height, unsigned *virtual_width, unsigned *virtual_height) const;
+ bool changes_output_size() const override { return true; }
+ bool sets_virtual_output_size() const override { return false; }
+ void get_output_size(unsigned *width, unsigned *height, unsigned *virtual_width, unsigned *virtual_height) const override;
private:
int width, height;
class SandboxEffect : public Effect {
public:
SandboxEffect();
- virtual std::string effect_type_id() const { return "SandboxEffect"; }
- std::string output_fragment_shader();
+ std::string effect_type_id() const override { return "SandboxEffect"; }
+ std::string output_fragment_shader() override;
- 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;
private:
float parm;
class SaturationEffect : public Effect {
public:
SaturationEffect();
- virtual std::string effect_type_id() const { return "SaturationEffect"; }
- virtual AlphaHandling alpha_handling() const { return DONT_CARE_ALPHA_TYPE; }
- virtual bool one_to_one_sampling() const { return true; }
- std::string output_fragment_shader();
+ std::string effect_type_id() const override { return "SaturationEffect"; }
+ AlphaHandling alpha_handling() const override { return DONT_CARE_ALPHA_TYPE; }
+ bool one_to_one_sampling() const override { return true; }
+ std::string output_fragment_shader() override;
private:
float saturation;
class SliceEffect : public Effect {
public:
SliceEffect();
- virtual std::string effect_type_id() const { return "SliceEffect"; }
- std::string output_fragment_shader();
- virtual bool needs_texture_bounce() const { return true; }
- virtual bool changes_output_size() const { return true; }
- virtual bool sets_virtual_output_size() const { return false; }
- virtual void inform_input_size(unsigned input_num, unsigned width, unsigned height);
- virtual void get_output_size(unsigned *width, unsigned *height,
- unsigned *virtual_width, unsigned *virtual_height) const;
-
- void set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num);
- virtual void inform_added(EffectChain *chain) { this->chain = chain; }
+ std::string effect_type_id() const override { return "SliceEffect"; }
+ std::string output_fragment_shader() override;
+ bool needs_texture_bounce() const override { return true; }
+ bool changes_output_size() const override { return true; }
+ bool sets_virtual_output_size() const override { return false; }
+ void inform_input_size(unsigned input_num, unsigned width, unsigned height) override;
+ void get_output_size(unsigned *width, unsigned *height,
+ unsigned *virtual_width, unsigned *virtual_height) const override;
+
+ void set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num) override;
+ void inform_added(EffectChain *chain) override { this->chain = chain; }
enum Direction { HORIZONTAL = 0, VERTICAL = 1 };
class UnsharpMaskEffect : public Effect {
public:
UnsharpMaskEffect();
- virtual std::string effect_type_id() const { return "UnsharpMaskEffect"; }
+ std::string effect_type_id() const override { return "UnsharpMaskEffect"; }
- virtual bool needs_srgb_primaries() const { return false; }
+ bool needs_srgb_primaries() const override { return false; }
- virtual void rewrite_graph(EffectChain *graph, Node *self);
- virtual bool set_float(const std::string &key, float value);
+ void rewrite_graph(EffectChain *graph, Node *self) override;
+ bool set_float(const std::string &key, float value) override;
- virtual std::string output_fragment_shader() {
+ std::string output_fragment_shader() override {
assert(false);
}
- virtual 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 {
assert(false);
}
class VignetteEffect : public Effect {
public:
VignetteEffect();
- virtual std::string effect_type_id() const { return "VignetteEffect"; }
- std::string output_fragment_shader();
+ std::string effect_type_id() const override { return "VignetteEffect"; }
+ std::string output_fragment_shader() override;
- virtual bool needs_srgb_primaries() const { return false; }
- virtual AlphaHandling alpha_handling() const { return DONT_CARE_ALPHA_TYPE; }
- virtual bool one_to_one_sampling() const { return true; }
+ bool needs_srgb_primaries() const override { return false; }
+ AlphaHandling alpha_handling() const override { return DONT_CARE_ALPHA_TYPE; }
+ bool one_to_one_sampling() const override { return true; }
- virtual void inform_input_size(unsigned input_num, unsigned width, unsigned height);
- void set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num);
+ void inform_input_size(unsigned input_num, unsigned width, unsigned height) override;
+ void set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num) override;
private:
Point2D center;
class WhiteBalanceEffect : public Effect {
public:
WhiteBalanceEffect();
- virtual std::string effect_type_id() const { return "WhiteBalanceEffect"; }
- virtual AlphaHandling alpha_handling() const { return DONT_CARE_ALPHA_TYPE; }
- virtual bool one_to_one_sampling() const { return true; }
- std::string output_fragment_shader();
+ std::string effect_type_id() const override { return "WhiteBalanceEffect"; }
+ AlphaHandling alpha_handling() const override { return DONT_CARE_ALPHA_TYPE; }
+ bool one_to_one_sampling() const override { return true; }
+ std::string output_fragment_shader() override;
- 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;
private:
// The neutral color, in linear sRGB.
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
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;
height(height),
virtual_width(virtual_width),
virtual_height(virtual_height) {}
- virtual string effect_type_id() const { return "VirtualResizeEffect"; }
- string output_fragment_shader() { return read_file("identity.frag"); }
+ string effect_type_id() const override { return "VirtualResizeEffect"; }
+ string output_fragment_shader() override { return read_file("identity.frag"); }
- virtual bool changes_output_size() const { return true; }
+ bool changes_output_size() const override { return true; }
- virtual void get_output_size(unsigned *width, unsigned *height,
- unsigned *virtual_width, unsigned *virtual_height) const {
+ void get_output_size(unsigned *width, unsigned *height,
+ unsigned *virtual_width, unsigned *virtual_height) const override {
*width = this->width;
*height = this->height;
*virtual_width = this->virtual_width;
friend class EffectChain;
public:
- virtual std::string effect_type_id() const { return "YCbCrConversionEffect"; }
- std::string output_fragment_shader();
- void set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num);
- virtual AlphaHandling alpha_handling() const { return DONT_CARE_ALPHA_TYPE; }
- virtual bool one_to_one_sampling() const { return true; }
+ std::string effect_type_id() const override { return "YCbCrConversionEffect"; }
+ std::string output_fragment_shader() override;
+ void set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num) override;
+ AlphaHandling alpha_handling() const override { return DONT_CARE_ALPHA_TYPE; }
+ bool one_to_one_sampling() const override { return true; }
// Should not be called by end users; call
// EffectChain::change_ycbcr_output_format() instead.
GLenum type = GL_UNSIGNED_BYTE);
~YCbCrInput();
- virtual std::string effect_type_id() const { return "YCbCrInput"; }
+ std::string effect_type_id() const override { return "YCbCrInput"; }
- 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 ycbcr_input_splitting == YCBCR_INPUT_INTERLEAVED; }
- virtual bool is_single_texture() const { return ycbcr_input_splitting == YCBCR_INPUT_INTERLEAVED; }
+ 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 ycbcr_input_splitting == YCBCR_INPUT_INTERLEAVED; }
+ bool is_single_texture() const override { return ycbcr_input_splitting == YCBCR_INPUT_INTERLEAVED; }
// 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
// set_width() / set_height() again after this.
void change_ycbcr_format(const YCbCrFormat &ycbcr_format);
- 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:
// Release the texture in the given channel if we have any, and it is owned by us.
class MipmapNeedingEffect : public Effect {
public:
MipmapNeedingEffect() {}
- virtual bool needs_mipmaps() const { return true; }
+ bool needs_mipmaps() const override { return true; }
// To be allowed to mess with the sampler state.
- virtual bool needs_texture_bounce() const { return true; }
+ bool needs_texture_bounce() const override { return true; }
- virtual string effect_type_id() const { return "MipmapNeedingEffect"; }
- string output_fragment_shader() { return read_file("mipmap_needing_effect.frag"); }
- virtual void inform_added(EffectChain *chain) { this->chain = chain; }
+ string effect_type_id() const override { return "MipmapNeedingEffect"; }
+ string output_fragment_shader() override { return read_file("mipmap_needing_effect.frag"); }
+ void inform_added(EffectChain *chain) override { this->chain = chain; }
- void set_gl_state(GLuint glsl_program_num, const string& prefix, unsigned *sampler_num)
+ void set_gl_state(GLuint glsl_program_num, const string& prefix, unsigned *sampler_num) override
{
Node *self = chain->find_node_for_effect(this);
glActiveTexture(chain->get_input_sampler(self, 0));