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:
authorLukas Tönne <lukas.toenne@gmail.com>2013-12-04 19:05:56 +0400
committerLukas Tönne <lukas.toenne@gmail.com>2013-12-04 19:05:56 +0400
commit67134a7bf689279785e2e40b29cd24243813998b (patch)
tree6c3a117459901d455d52726bd7bddd3e931e9650 /source/blender/compositor/operations
parent04e434cd81edf942289f7094bc5fdc3ab8846259 (diff)
Fix for EWA (elliptical weighted average) sampling in the compositor.
EWA sampling is designed for downsampling images, i.e. scaling down the size of input image pixels, which happens regularly in compositing. While the standard sampling methods (linear, cubic) work reasonably well for linear transformations, they don't yield good results in non-linear cases like perspective projection or arbitrary displacement. EWA sampling is comparable to mipmapping, but avoids problems with discontinuities. To work correctly the EWA algorithm needs partial derivatives of the mapping functions which convert output pixel coordinates back into the input image space (2x2 Jacobian matrix). With these derivatives the EWA algorithm projects ellipses into the input space and accumulates colors over their area. This calculation was not done correctly in the compositor, only the derivatives du/dx and dv/dy were calculation, basically this means it only worked for non-rotated input images. The patch introduces full derivative calculations du/dx, du/dy, dv/dx, dv/dy for the 3 nodes which use EWA sampling currently: PlaneTrackWarp, MapUV and Displace. In addition the calculation of ellipsis area and axis-aligned bounding boxes has been fixed. For the MapUV and Displace nodes the derivatives have to be estimated by evaluating the UV/displacement inputs with 1-pixel offsets, which can still have problems on discontinuities and sub-pixel variations. These potential problems can only be alleviated by more radical design changes in the compositor functions, which are out of scope for now. Basically the values passed to the UV/Displacement inputs would need to be associated with their 1st order derivatives, which requires a general approach to derivatives in all nodes.
Diffstat (limited to 'source/blender/compositor/operations')
-rw-r--r--source/blender/compositor/operations/COM_DisplaceOperation.cpp124
-rw-r--r--source/blender/compositor/operations/COM_DisplaceOperation.h7
-rw-r--r--source/blender/compositor/operations/COM_MapUVOperation.cpp116
-rw-r--r--source/blender/compositor/operations/COM_MapUVOperation.h8
-rw-r--r--source/blender/compositor/operations/COM_PlaneTrackWarpImageOperation.cpp101
-rw-r--r--source/blender/compositor/operations/COM_PlaneTrackWarpImageOperation.h3
-rw-r--r--source/blender/compositor/operations/COM_ReadBufferOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_ReadBufferOperation.h2
8 files changed, 205 insertions, 162 deletions
diff --git a/source/blender/compositor/operations/COM_DisplaceOperation.cpp b/source/blender/compositor/operations/COM_DisplaceOperation.cpp
index 17692bd18ef..96031e7acc4 100644
--- a/source/blender/compositor/operations/COM_DisplaceOperation.cpp
+++ b/source/blender/compositor/operations/COM_DisplaceOperation.cpp
@@ -49,54 +49,92 @@ void DisplaceOperation::initExecution()
this->m_height_x4 = this->getHeight() * 4;
}
-
-/* minimum distance (in pixels) a pixel has to be displaced
- * in order to take effect */
-#define DISPLACE_EPSILON 0.01f
-
-void DisplaceOperation::executePixel(float output[4], int x, int y, void *data)
+void DisplaceOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler)
{
- float inVector[4];
- float inScale[4];
+ float xy[2] = { x, y };
+ float uv[2], deriv[2][2];
- float p_dx, p_dy; /* main displacement in pixel space */
- float d_dx, d_dy;
- float dxt, dyt;
- float u, v;
+ pixelTransform(xy, uv, deriv);
- this->m_inputScaleXProgram->readSampled(inScale, x, y, COM_PS_NEAREST);
- float xs = inScale[0];
- this->m_inputScaleYProgram->readSampled(inScale, x, y, COM_PS_NEAREST);
- float ys = inScale[0];
+ /* EWA filtering (without nearest it gets blurry with NO distortion) */
+ this->m_inputColorProgram->readFiltered(output, uv[0], uv[1], deriv[0], deriv[1], COM_PS_BILINEAR);
+}
+bool DisplaceOperation::read_displacement(float x, float y, float xscale, float yscale, const float origin[2], float &r_u, float &r_v)
+{
+ float width = m_inputVectorProgram->getWidth();
+ float height = m_inputVectorProgram->getHeight();
+ if (x < 0.0f || x >= width || y < 0.0f || y >= height) {
+ r_u = 0.0f;
+ r_v = 0.0f;
+ return false;
+ }
+ else {
+ float col[4];
+ m_inputVectorProgram->readSampled(col, x, y, COM_PS_BILINEAR);
+ r_u = origin[0] - col[0]*xscale + 0.5f;
+ r_v = origin[1] - col[1]*yscale + 0.5f;
+ return true;
+ }
+}
+
+void DisplaceOperation::pixelTransform(const float xy[2], float r_uv[2], float r_deriv[2][2])
+{
+ float col[4];
+ float uv[2]; /* temporary variables for derivative estimation */
+ int num;
+
+ m_inputScaleXProgram->readSampled(col, xy[0], xy[1], COM_PS_NEAREST);
+ float xs = col[0];
+ m_inputScaleYProgram->readSampled(col, xy[0], xy[1], COM_PS_NEAREST);
+ float ys = col[0];
/* clamp x and y displacement to triple image resolution -
* to prevent hangs from huge values mistakenly plugged in eg. z buffers */
- CLAMP(xs, -this->m_width_x4, this->m_width_x4);
- CLAMP(ys, -this->m_height_x4, this->m_height_x4);
-
- this->m_inputVectorProgram->readSampled(inVector, x, y, COM_PS_NEAREST);
- p_dx = inVector[0] * xs;
- p_dy = inVector[1] * ys;
+ CLAMP(xs, -m_width_x4, m_width_x4);
+ CLAMP(ys, -m_height_x4, m_height_x4);
/* displaced pixel in uv coords, for image sampling */
- u = x - p_dx + 0.5f;
- v = y - p_dy + 0.5f;
-
- /* calc derivatives */
- this->m_inputVectorProgram->readSampled(inVector, x + 1, y, COM_PS_NEAREST);
- d_dx = inVector[0] * xs;
- this->m_inputVectorProgram->readSampled(inVector, x, y + 1, COM_PS_NEAREST);
- d_dy = inVector[1] * ys;
-
- /* clamp derivatives to minimum displacement distance in UV space */
- dxt = p_dx - d_dx;
- dyt = p_dy - d_dy;
-
- dxt = signf(dxt) * max_ff(fabsf(dxt), DISPLACE_EPSILON) / this->getWidth();
- dyt = signf(dyt) * max_ff(fabsf(dyt), DISPLACE_EPSILON) / this->getHeight();
+ read_displacement(xy[0], xy[1], xs, ys, xy, r_uv[0], r_uv[1]);
+
+ /* Estimate partial derivatives using 1-pixel offsets */
+ const float epsilon[2] = { 1.0f, 1.0f };
+
+ zero_v2(r_deriv[0]);
+ zero_v2(r_deriv[1]);
+
+ num = 0;
+ if (read_displacement(xy[0] + epsilon[0], xy[1], xs, ys, xy, uv[0], uv[1])) {
+ r_deriv[0][0] += uv[0] - r_uv[0];
+ r_deriv[1][0] += uv[1] - r_uv[1];
+ ++num;
+ }
+ if (read_displacement(xy[0] - epsilon[0], xy[1], xs, ys, xy, uv[0], uv[1])) {
+ r_deriv[0][0] += r_uv[0] - uv[0];
+ r_deriv[1][0] += r_uv[1] - uv[1];
+ ++num;
+ }
+ if (num > 0) {
+ float numinv = 1.0f / (float)num;
+ r_deriv[0][0] *= numinv;
+ r_deriv[1][0] *= numinv;
+ }
- /* EWA filtering (without nearest it gets blurry with NO distortion) */
- this->m_inputColorProgram->readFiltered(output, u, v, dxt, dyt, COM_PS_NEAREST);
+ num = 0;
+ if (read_displacement(xy[0], xy[1] + epsilon[1], xs, ys, xy, uv[0], uv[1])) {
+ r_deriv[0][1] += uv[0] - r_uv[0];
+ r_deriv[1][1] += uv[1] - r_uv[1];
+ ++num;
+ }
+ if (read_displacement(xy[0], xy[1] - epsilon[1], xs, ys, xy, uv[0], uv[1])) {
+ r_deriv[0][1] += r_uv[0] - uv[0];
+ r_deriv[1][1] += r_uv[1] - uv[1];
+ ++num;
+ }
+ if (num > 0) {
+ float numinv = 1.0f / (float)num;
+ r_deriv[0][1] *= numinv;
+ r_deriv[1][1] *= numinv;
+ }
}
void DisplaceOperation::deinitExecution()
@@ -126,10 +164,10 @@ bool DisplaceOperation::determineDependingAreaOfInterest(rcti *input, ReadBuffer
/* vector */
operation = getInputOperation(1);
- vectorInput.xmax = input->xmax + 2;
- vectorInput.xmin = input->xmin;
- vectorInput.ymax = input->ymax + 2;
- vectorInput.ymin = input->ymin;
+ vectorInput.xmax = input->xmax + 1;
+ vectorInput.xmin = input->xmin - 1;
+ vectorInput.ymax = input->ymax + 1;
+ vectorInput.ymin = input->ymin - 1;
if (operation->determineDependingAreaOfInterest(&vectorInput, readOperation, output)) {
return true;
}
diff --git a/source/blender/compositor/operations/COM_DisplaceOperation.h b/source/blender/compositor/operations/COM_DisplaceOperation.h
index daf54294aa1..cec7937d9d6 100644
--- a/source/blender/compositor/operations/COM_DisplaceOperation.h
+++ b/source/blender/compositor/operations/COM_DisplaceOperation.h
@@ -48,7 +48,9 @@ public:
/**
* the inner loop of this program
*/
- void executePixel(float output[4], int x, int y, void *data);
+ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler);
+
+ void pixelTransform(const float xy[2], float r_uv[2], float r_deriv[2][2]);
/**
* Initialize the execution
@@ -59,5 +61,8 @@ public:
* Deinitialize the execution
*/
void deinitExecution();
+
+private:
+ bool read_displacement(float x, float y, float xscale, float yscale, const float origin[2], float &r_u, float &r_v);
};
#endif
diff --git a/source/blender/compositor/operations/COM_MapUVOperation.cpp b/source/blender/compositor/operations/COM_MapUVOperation.cpp
index 289b447dec7..292f073548a 100644
--- a/source/blender/compositor/operations/COM_MapUVOperation.cpp
+++ b/source/blender/compositor/operations/COM_MapUVOperation.cpp
@@ -42,46 +42,28 @@ void MapUVOperation::initExecution()
void MapUVOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler)
{
- float inputUV[4];
- float uv_a[4], uv_b[4];
- float u, v;
+ float xy[2] = { x, y };
+ float uv[2], deriv[2][2], alpha;
- float dx, dy;
- float uv_l, uv_r;
- float uv_u, uv_d;
-
- this->m_inputUVProgram->readSampled(inputUV, x, y, sampler);
- if (inputUV[2] == 0.f) {
+ pixelTransform(xy, uv, deriv, alpha);
+ if (alpha == 0.0f) {
zero_v4(output);
return;
}
- /* adaptive sampling, red (U) channel */
- this->m_inputUVProgram->readSampled(uv_a, x - 1, y, COM_PS_NEAREST);
- this->m_inputUVProgram->readSampled(uv_b, x + 1, y, COM_PS_NEAREST);
- uv_l = uv_a[2] != 0.f ? fabsf(inputUV[0] - uv_a[0]) : 0.f;
- uv_r = uv_b[2] != 0.f ? fabsf(inputUV[0] - uv_b[0]) : 0.f;
-
- dx = 0.5f * (uv_l + uv_r);
-
- /* adaptive sampling, green (V) channel */
- this->m_inputUVProgram->readSampled(uv_a, x, y - 1, COM_PS_NEAREST);
- this->m_inputUVProgram->readSampled(uv_b, x, y + 1, COM_PS_NEAREST);
- uv_u = uv_a[2] != 0.f ? fabsf(inputUV[1] - uv_a[1]) : 0.f;
- uv_d = uv_b[2] != 0.f ? fabsf(inputUV[1] - uv_b[1]) : 0.f;
-
- dy = 0.5f * (uv_u + uv_d);
+ /* EWA filtering */
+ this->m_inputColorProgram->readFiltered(output, uv[0], uv[1], deriv[0], deriv[1], COM_PS_BILINEAR);
+
/* UV to alpha threshold */
const float threshold = this->m_alpha * 0.05f;
- float alpha = 1.0f - threshold * (dx + dy);
- if (alpha < 0.f) alpha = 0.f;
- else alpha *= inputUV[2];
-
- /* EWA filtering */
- u = inputUV[0] * this->m_inputColorProgram->getWidth();
- v = inputUV[1] * this->m_inputColorProgram->getHeight();
-
- this->m_inputColorProgram->readFiltered(output, u, v, dx, dy, COM_PS_NEAREST);
+ /* XXX alpha threshold is used to fade out pixels on boundaries with invalid derivatives.
+ * this calculation is not very well defined, should be looked into if it becomes a problem ...
+ */
+ float du = len_v2(deriv[0]);
+ float dv = len_v2(deriv[1]);
+ float factor = 1.0f - threshold * (du + dv);
+ if (factor < 0.f) alpha = 0.f;
+ else alpha *= factor;
/* "premul" */
if (alpha < 1.0f) {
@@ -89,6 +71,74 @@ void MapUVOperation::executePixelSampled(float output[4], float x, float y, Pixe
}
}
+bool MapUVOperation::read_uv(float x, float y, float &r_u, float &r_v, float &r_alpha)
+{
+ float width = m_inputUVProgram->getWidth();
+ float height = m_inputUVProgram->getHeight();
+ if (x < 0.0f || x >= width || y < 0.0f || y >= height) {
+ r_u = 0.0f;
+ r_v = 0.0f;
+ r_alpha = 0.0f;
+ return false;
+ }
+ else {
+ float col[4];
+ m_inputUVProgram->readSampled(col, x, y, COM_PS_BILINEAR);
+ r_u = col[0] * width;
+ r_v = col[1] * height;
+ r_alpha = col[2];
+ return true;
+ }
+}
+
+void MapUVOperation::pixelTransform(const float xy[2], float r_uv[2], float r_deriv[2][2], float &r_alpha)
+{
+ float uv[2], alpha; /* temporary variables for derivative estimation */
+ int num;
+
+ read_uv(xy[0], xy[1], r_uv[0], r_uv[1], r_alpha);
+
+ /* Estimate partial derivatives using 1-pixel offsets */
+ const float epsilon[2] = { 1.0f, 1.0f };
+
+ zero_v2(r_deriv[0]);
+ zero_v2(r_deriv[1]);
+
+ num = 0;
+ if (read_uv(xy[0] + epsilon[0], xy[1], uv[0], uv[1], alpha)) {
+ r_deriv[0][0] += uv[0] - r_uv[0];
+ r_deriv[1][0] += uv[1] - r_uv[1];
+ ++num;
+ }
+ if (read_uv(xy[0] - epsilon[0], xy[1], uv[0], uv[1], alpha)) {
+ r_deriv[0][0] += r_uv[0] - uv[0];
+ r_deriv[1][0] += r_uv[1] - uv[1];
+ ++num;
+ }
+ if (num > 0) {
+ float numinv = 1.0f / (float)num;
+ r_deriv[0][0] *= numinv;
+ r_deriv[1][0] *= numinv;
+ }
+
+ num = 0;
+ if (read_uv(xy[0], xy[1] + epsilon[1], uv[0], uv[1], alpha)) {
+ r_deriv[0][1] += uv[0] - r_uv[0];
+ r_deriv[1][1] += uv[1] - r_uv[1];
+ ++num;
+ }
+ if (read_uv(xy[0], xy[1] - epsilon[1], uv[0], uv[1], alpha)) {
+ r_deriv[0][1] += r_uv[0] - uv[0];
+ r_deriv[1][1] += r_uv[1] - uv[1];
+ ++num;
+ }
+ if (num > 0) {
+ float numinv = 1.0f / (float)num;
+ r_deriv[0][1] *= numinv;
+ r_deriv[1][1] *= numinv;
+ }
+}
+
void MapUVOperation::deinitExecution()
{
this->m_inputUVProgram = NULL;
diff --git a/source/blender/compositor/operations/COM_MapUVOperation.h b/source/blender/compositor/operations/COM_MapUVOperation.h
index fe8bfd2a9ac..796ee952607 100644
--- a/source/blender/compositor/operations/COM_MapUVOperation.h
+++ b/source/blender/compositor/operations/COM_MapUVOperation.h
@@ -46,7 +46,9 @@ public:
* the inner loop of this program
*/
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler);
-
+
+ void pixelTransform(const float xy[2], float r_uv[2], float r_deriv[2][2], float &r_alpha);
+
/**
* Initialize the execution
*/
@@ -58,5 +60,9 @@ public:
void deinitExecution();
void setAlpha(float alpha) { this->m_alpha = alpha; }
+
+private:
+ bool read_uv(float x, float y, float &r_u, float &r_v, float &r_alpha);
};
+
#endif
diff --git a/source/blender/compositor/operations/COM_PlaneTrackWarpImageOperation.cpp b/source/blender/compositor/operations/COM_PlaneTrackWarpImageOperation.cpp
index dba3a6f3505..7780023c465 100644
--- a/source/blender/compositor/operations/COM_PlaneTrackWarpImageOperation.cpp
+++ b/source/blender/compositor/operations/COM_PlaneTrackWarpImageOperation.cpp
@@ -36,60 +36,17 @@ extern "C" {
#include "BKE_tracking.h"
}
-BLI_INLINE bool isPointInsideQuad(const float x, const float y, const float corners[4][2])
-{
- float point[2];
-
- point[0] = x;
- point[1] = y;
-
- return isect_point_tri_v2(point, corners[0], corners[1], corners[2]) ||
- isect_point_tri_v2(point, corners[0], corners[2], corners[3]);
-}
-
-BLI_INLINE void warpCoord(float x, float y, float matrix[3][3], float uv[2])
+BLI_INLINE void warpCoord(float x, float y, float matrix[3][3], float uv[2], float deriv[2][2])
{
float vec[3] = {x, y, 1.0f};
mul_m3_v3(matrix, vec);
- vec[0] /= vec[2];
- vec[1] /= vec[2];
+ uv[0] = vec[0] / vec[2];
+ uv[1] = vec[1] / vec[2];
- copy_v2_v2(uv, vec);
-}
-
-BLI_INLINE void resolveUVAndDxDy(const float x, const float y, float matrix[3][3],
- float *u_r, float *v_r, float *dx_r, float *dy_r)
-{
- float inputUV[2];
- float uv_a[2], uv_b[2];
-
- float dx, dy;
- float uv_l, uv_r;
- float uv_u, uv_d;
-
- warpCoord(x, y, matrix, inputUV);
-
- /* adaptive sampling, red (U) channel */
- warpCoord(x - 1, y, matrix, uv_a);
- warpCoord(x + 1, y, matrix, uv_b);
- uv_l = fabsf(inputUV[0] - uv_a[0]);
- uv_r = fabsf(inputUV[0] - uv_b[0]);
-
- dx = 0.5f * (uv_l + uv_r);
-
- /* adaptive sampling, green (V) channel */
- warpCoord(x, y - 1, matrix, uv_a);
- warpCoord(x, y + 1, matrix, uv_b);
- uv_u = fabsf(inputUV[1] - uv_a[1]);
- uv_d = fabsf(inputUV[1] - uv_b[1]);
-
- dy = 0.5f * (uv_u + uv_d);
-
- *dx_r = dx;
- *dy_r = dy;
-
- *u_r = inputUV[0];
- *v_r = inputUV[1];
+ deriv[0][0] = (matrix[0][0] - matrix[0][2] * uv[0]) / vec[2];
+ deriv[1][0] = (matrix[0][1] - matrix[0][2] * uv[1]) / vec[2];
+ deriv[0][1] = (matrix[1][0] - matrix[1][2] * uv[0]) / vec[2];
+ deriv[1][1] = (matrix[1][1] - matrix[1][2] * uv[1]) / vec[2];
}
PlaneTrackWarpImageOperation::PlaneTrackWarpImageOperation() : PlaneTrackCommonOperation()
@@ -98,9 +55,6 @@ PlaneTrackWarpImageOperation::PlaneTrackWarpImageOperation() : PlaneTrackCommonO
this->addOutputSocket(COM_DT_COLOR);
this->m_pixelReader = NULL;
this->setComplex(true);
-
- /* Currently hardcoded to 8 samples. */
- this->m_osa = 8;
}
void PlaneTrackWarpImageOperation::initExecution()
@@ -109,8 +63,6 @@ void PlaneTrackWarpImageOperation::initExecution()
this->m_pixelReader = this->getInputSocketReader(0);
- BLI_jitter_init(this->m_jitter[0], this->m_osa);
-
const int width = this->m_pixelReader->getWidth();
const int height = this->m_pixelReader->getHeight();
float frame_corners[4][2] = {{0.0f, 0.0f},
@@ -127,41 +79,32 @@ void PlaneTrackWarpImageOperation::deinitExecution()
this->m_pixelReader = NULL;
}
-void PlaneTrackWarpImageOperation::executePixelSampled(float output[4], float x_, float y_, PixelSampler sampler)
+void PlaneTrackWarpImageOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler)
{
- float color_accum[4];
+ float xy[2] = {x, y};
+ float uv[2];
+ float deriv[2][2];
- zero_v4(color_accum);
- for (int sample = 0; sample < this->m_osa; sample++) {
- float current_x = x_ + this->m_jitter[sample][0],
- current_y = y_ + this->m_jitter[sample][1];
- if (isPointInsideQuad(current_x, current_y, this->m_frameSpaceCorners)) {
- float current_color[4];
- float u, v, dx, dy;
+ pixelTransform(xy, uv, deriv);
- resolveUVAndDxDy(current_x, current_y, m_perspectiveMatrix, &u, &v, &dx, &dy);
-
- /* derivatives are to be in normalized space.. */
- dx /= this->m_pixelReader->getWidth();
- dy /= this->m_pixelReader->getHeight();
-
- this->m_pixelReader->readFiltered(current_color, u, v, dx, dy, COM_PS_NEAREST);
- add_v4_v4(color_accum, current_color);
- }
- }
+ m_pixelReader->readFiltered(output, uv[0], uv[1], deriv[0], deriv[1], COM_PS_BILINEAR);
+}
- mul_v4_v4fl(output, color_accum, 1.0f / this->m_osa);
+void PlaneTrackWarpImageOperation::pixelTransform(const float xy[2], float r_uv[2], float r_deriv[2][2])
+{
+ warpCoord(xy[0], xy[1], m_perspectiveMatrix, r_uv, r_deriv);
}
bool PlaneTrackWarpImageOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
{
float UVs[4][2];
+ float deriv[2][2];
/* TODO(sergey): figure out proper way to do this. */
- warpCoord(input->xmin - 2, input->ymin - 2, this->m_perspectiveMatrix, UVs[0]);
- warpCoord(input->xmax + 2, input->ymin - 2, this->m_perspectiveMatrix, UVs[1]);
- warpCoord(input->xmax + 2, input->ymax + 2, this->m_perspectiveMatrix, UVs[2]);
- warpCoord(input->xmin - 2, input->ymax + 2, this->m_perspectiveMatrix, UVs[3]);
+ warpCoord(input->xmin - 2, input->ymin - 2, this->m_perspectiveMatrix, UVs[0], deriv);
+ warpCoord(input->xmax + 2, input->ymin - 2, this->m_perspectiveMatrix, UVs[1], deriv);
+ warpCoord(input->xmax + 2, input->ymax + 2, this->m_perspectiveMatrix, UVs[2], deriv);
+ warpCoord(input->xmin - 2, input->ymax + 2, this->m_perspectiveMatrix, UVs[3], deriv);
float min[2], max[2];
INIT_MINMAX2(min, max);
diff --git a/source/blender/compositor/operations/COM_PlaneTrackWarpImageOperation.h b/source/blender/compositor/operations/COM_PlaneTrackWarpImageOperation.h
index ed9cc2fe5aa..ceb002c8039 100644
--- a/source/blender/compositor/operations/COM_PlaneTrackWarpImageOperation.h
+++ b/source/blender/compositor/operations/COM_PlaneTrackWarpImageOperation.h
@@ -36,8 +36,6 @@
class PlaneTrackWarpImageOperation : public PlaneTrackCommonOperation {
protected:
SocketReader *m_pixelReader;
- int m_osa;
- float m_jitter[32][2];
float m_perspectiveMatrix[3][3];
public:
@@ -47,6 +45,7 @@ public:
void deinitExecution();
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler);
+ void pixelTransform(const float xy[2], float r_uv[2], float r_deriv[2][2]);
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
};
diff --git a/source/blender/compositor/operations/COM_ReadBufferOperation.cpp b/source/blender/compositor/operations/COM_ReadBufferOperation.cpp
index b93e338ad6c..47d5fc6bcca 100644
--- a/source/blender/compositor/operations/COM_ReadBufferOperation.cpp
+++ b/source/blender/compositor/operations/COM_ReadBufferOperation.cpp
@@ -81,14 +81,16 @@ void ReadBufferOperation::executePixelExtend(float output[4], float x, float y,
}
}
-void ReadBufferOperation::executePixelFiltered(float output[4], float x, float y, float dx, float dy, PixelSampler sampler)
+void ReadBufferOperation::executePixelFiltered(float output[4], float x, float y, float dx[2], float dy[2], PixelSampler sampler)
{
if (m_single_value) {
/* write buffer has a single value stored at (0,0) */
m_buffer->read(output, 0, 0);
}
else {
- m_buffer->readEWA(output, x, y, dx, dy, sampler);
+ const float uv[2] = { x, y };
+ const float deriv[2][2] = { {dx[0], dx[1]}, {dy[0], dy[1]} };
+ m_buffer->readEWA(output, uv, deriv, sampler);
}
}
diff --git a/source/blender/compositor/operations/COM_ReadBufferOperation.h b/source/blender/compositor/operations/COM_ReadBufferOperation.h
index cdc6e50f6d4..cce519c6eb3 100644
--- a/source/blender/compositor/operations/COM_ReadBufferOperation.h
+++ b/source/blender/compositor/operations/COM_ReadBufferOperation.h
@@ -43,7 +43,7 @@ public:
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler);
void executePixelExtend(float output[4], float x, float y, PixelSampler sampler,
MemoryBufferExtend extend_x, MemoryBufferExtend extend_y);
- void executePixelFiltered(float output[4], float x, float y, float dx, float dy, PixelSampler sampler);
+ void executePixelFiltered(float output[4], float x, float y, float dx[2], float dy[2], PixelSampler sampler);
const bool isReadBufferOperation() const { return true; }
void setOffset(unsigned int offset) { this->m_offset = offset; }
unsigned int getOffset() const { return this->m_offset; }