]> git.sesse.net Git - movit/blobdiff - resample_effect.h
In ResampleEffect, split the weight calculation out into its own function that does...
[movit] / resample_effect.h
index b06b09b57ae9af67f18e938396adc8ab8ddbdd0d..1aa459cbaaa3926c1aeabe2cd8f4647d77fd5f29 100644 (file)
 #include <epoxy/gl.h>
 #include <assert.h>
 #include <stddef.h>
+#include <memory>
 #include <string>
 
 #include "effect.h"
+#include "fp16.h"
 
 namespace movit {
 
@@ -28,6 +30,22 @@ class EffectChain;
 class Node;
 class SingleResamplePassEffect;
 
+// Public so that it can be benchmarked externally.
+template<class T>
+struct Tap {
+       T weight;
+       T pos;
+};
+struct ScalingWeights {
+       unsigned src_bilinear_samples;
+       unsigned dst_samples, num_loops;
+
+       // Exactly one of these is set.
+       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();