]> git.sesse.net Git - movit/blobdiff - resample_effect.h
Make BGRA deinterlacing benchmark premultiplied, so that we do not use forever just...
[movit] / resample_effect.h
index 7cd613fb34950d1620bceb257ce66cacd69536a8..af6a79f0227ced59522e57ced1a865d7b11a9df0 100644 (file)
@@ -18,6 +18,7 @@
 #include <epoxy/gl.h>
 #include <assert.h>
 #include <stddef.h>
+#include <memory>
 #include <string>
 
 #include "effect.h"
@@ -40,14 +41,15 @@ struct ScalingWeights {
        unsigned dst_samples, num_loops;
 
        // Exactly one of these is set.
-       Tap<fp16_int_t> *bilinear_weights_fp16;
-       Tap<float> *bilinear_weights_fp32;
+       std::unique_ptr<Tap<fp16_int_t>[]> bilinear_weights_fp16;
+       std::unique_ptr<Tap<float>[]> bilinear_weights_fp32;
 };
 ScalingWeights calculate_scaling_weights(unsigned src_size, unsigned dst_size, float zoom, float offset);
 
 class ResampleEffect : public Effect {
 public:
        ResampleEffect();
+       ~ResampleEffect();
 
        virtual std::string effect_type_id() const { return "ResampleEffect"; }
 
@@ -72,6 +74,9 @@ private:
        void update_size();
        void update_offset_and_zoom();
        
+       // Both of these are owned by us if owns_effects is true (before finalize()),
+       // and otherwise owned by the EffectChain.
+       bool owns_effects;
        SingleResamplePassEffect *hpass, *vpass;
        int input_width, input_height, output_width, output_height;
 
@@ -83,7 +88,7 @@ private:
 
 class SingleResamplePassEffect : public Effect {
 public:
-       // If parent is non-NULL, calls to inform_input_size will be forwarded,
+       // If parent is non-nullptr, calls to inform_input_size will be forwarded,
        // so that it can inform both passes about the right input and output
        // resolutions.
        SingleResamplePassEffect(ResampleEffect *parent);
@@ -98,7 +103,7 @@ public:
 
        virtual void inform_added(EffectChain *chain) { this->chain = chain; }
        virtual void inform_input_size(unsigned input_num, unsigned width, unsigned height) {
-               if (parent != NULL) {
+               if (parent != nullptr) {
                        parent->inform_input_size(input_num, width, height);
                }
        }