Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2015-08-27 20:43:33 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2015-08-27 20:43:33 +0300
commit43a4aaf8e6f0ccbd9ef63c44861206024f71590b (patch)
tree96ace2a743acd29c72f3ee7f31e5799387a6ab72 /source/blender/compositor
parent3ec81b814c995b585f19c97cf87fee5b7195382b (diff)
Compositor: Reduce number of divisions in EWA filtering
Diffstat (limited to 'source/blender/compositor')
-rw-r--r--source/blender/compositor/intern/COM_MemoryBuffer.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.cpp b/source/blender/compositor/intern/COM_MemoryBuffer.cpp
index 162e08a95a6..7ee5e2f7c57 100644
--- a/source/blender/compositor/intern/COM_MemoryBuffer.cpp
+++ b/source/blender/compositor/intern/COM_MemoryBuffer.cpp
@@ -204,14 +204,15 @@ static void read_ewa_pixel_sampled(void *userdata, int x, int y, float result[4]
void MemoryBuffer::readEWA(float *result, const float uv[2], const float derivatives[2][2])
{
BLI_assert(this->m_datatype == COM_DT_COLOR);
- int width = this->getWidth(), height = this->getHeight();
+ float inv_width = 1.0f / (float)this->getWidth(),
+ inv_height = 1.0f / (float)this->getHeight();
/* TODO(sergey): Render pipeline uses normalized coordinates and derivatives,
* but compositor uses pixel space. For now let's just divide the values and
* switch compositor to normalized space for EWA later.
*/
- float uv_normal[2] = {uv[0] / width, uv[1] / height};
- float du_normal[2] = {derivatives[0][0] / width, derivatives[0][1] / height};
- float dv_normal[2] = {derivatives[1][0] / width, derivatives[1][1] / height};
+ float uv_normal[2] = {uv[0] * inv_width, uv[1] * inv_height};
+ float du_normal[2] = {derivatives[0][0] * inv_width, derivatives[0][1] * inv_height};
+ float dv_normal[2] = {derivatives[1][0] * inv_width, derivatives[1][1] * inv_height};
BLI_ewa_filter(this->getWidth(), this->getHeight(),
false,