diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-08-18 17:37:13 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-08-18 17:38:15 +0400 |
commit | afa3469288337079cbff2bcecb7142448e961393 (patch) | |
tree | 572862e514fddd8decbb478ba46e4a3a8e9b4c56 /source/blender/blenlib/BLI_math_interp.h | |
parent | 354b17d2f3ff6e1b1c01fe147c2934103c8abef1 (diff) |
De-duplicate EWA filter code between renderer and compositor
The title says it all, move the EWA filter to BLI (currently it's
math_interp.c) and use the function from both BI renderer and the
compositor.
This makes more central place of the algorithm, allowing to have
fixes and optimizaitons synchronized across the two usages.
This also fixes T41440: Displacement in compositing creates holes
Reviewers: campbellbarton, lukastoenne
Reviewed By: lukastoenne
Maniphest Tasks: T41440
Differential Revision: https://developer.blender.org/D748
Diffstat (limited to 'source/blender/blenlib/BLI_math_interp.h')
-rw-r--r-- | source/blender/blenlib/BLI_math_interp.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_math_interp.h b/source/blender/blenlib/BLI_math_interp.h index 43ef64214ad..d2ec7b80d86 100644 --- a/source/blender/blenlib/BLI_math_interp.h +++ b/source/blender/blenlib/BLI_math_interp.h @@ -45,4 +45,24 @@ void BLI_bilinear_interpolation_fl(const float *buffer, float *output, int width void BLI_bilinear_interpolation_char(const unsigned char *buffer, unsigned char *output, int width, int height, int components, float u, float v); +#define EWA_MAXIDX 255 +extern const float EWA_WTS[EWA_MAXIDX + 1]; + +typedef void (*ewa_filter_read_pixel_cb) (void *userdata, int x, int y, float result[4]); + +void BLI_ewa_imp2radangle(float A, float B, float C, float F, float *a, float *b, float *th, float *ecc); + +/* TODO(sergey): Consider making this function inlined, so the pixel read callback + * could also be inlined in order to avoid per-pixel function calls. + */ +void BLI_ewa_filter(const int width, const int height, + const bool intpol, + const bool use_alpha, + const float uv[2], + const float du[2], + const float dv[2], + ewa_filter_read_pixel_cb read_pixel_cb, + void *customdata, + float result[4]); + #endif /* __BLI_MATH_INTERP_H__ */ |