X-Git-Url: https://git.sesse.net/?p=movit;a=blobdiff_plain;f=resample_effect.h;h=ceae920aa71c98a0799a8423f173bc9e13c25876;hp=73dfc210e9732388e193ed2dcd0eb6cdb31d50a8;hb=706365ccee2ad69c5bc3608e12ca8e9ada7ce954;hpb=c2ca57b71bf77244acc85aaccb2d6c360517c5a3 diff --git a/resample_effect.h b/resample_effect.h index 73dfc21..ceae920 100644 --- a/resample_effect.h +++ b/resample_effect.h @@ -21,6 +21,7 @@ #include #include "effect.h" +#include "fp16.h" namespace movit { @@ -28,9 +29,26 @@ class EffectChain; class Node; class SingleResamplePassEffect; +// Public so that it can be benchmarked externally. +template +struct Tap { + T weight; + T pos; +}; +struct ScalingWeights { + unsigned src_bilinear_samples; + unsigned dst_samples, num_loops; + + // Exactly one of these is set. + Tap *bilinear_weights_fp16; + Tap *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"; } @@ -55,12 +73,16 @@ 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; float offset_x, offset_y; float zoom_x, zoom_y; float zoom_center_x, zoom_center_y; + float unused; }; class SingleResamplePassEffect : public Effect { @@ -103,8 +125,14 @@ private: EffectChain *chain; Direction direction; GLuint texnum; + GLint uniform_sample_tex; + float uniform_num_loops, uniform_slice_height, uniform_sample_x_scale, uniform_sample_x_offset; + float uniform_whole_pixel_offset; + int uniform_num_samples; + int input_width, input_height, output_width, output_height; float offset, zoom; + float unused; int last_input_width, last_input_height, last_output_width, last_output_height; float last_offset, last_zoom; int src_bilinear_samples, num_loops;