Fix T43908: Mask render bug, one pixel black line

This was a regression caused by attempts to fix T42844 and there were
some red-herrings which lead me to the wrong way to fix it. It's some
deeper issue than just interpolation offset, it's mainly how the node
resolution is being mapped to each other.

It could be actually a part of canvas awareness project..
This commit is contained in:
Sergey Sharybin 2015-03-09 12:45:01 +05:00
parent 36df8cc1e5
commit 2ae0f1e70b
8 changed files with 17 additions and 17 deletions

@ -259,7 +259,7 @@ public:
float u = x;
float v = y;
this->wrap_pixel(u, v, extend_x, extend_y);
BLI_bilinear_interpolation_fl(this->m_buffer, result, this->m_width, this->m_height, this->m_num_channels, u - 0.5f, v - 0.5f);
BLI_bilinear_interpolation_fl(this->m_buffer, result, this->m_width, this->m_height, this->m_num_channels, u, v);
}
void readEWA(float *result, const float uv[2], const float derivatives[2][2], PixelSampler sampler);

@ -185,7 +185,7 @@ void CompositorOperation::executeRegion(rcti *rect, unsigned int tileNumber)
for (y = y1; y < y2 && (!breaked); y++) {
for (x = x1; x < x2 && (!breaked); x++) {
float input_x = (float)x + dx + 0.5f, input_y = (float)y + dy + 0.5f;
int input_x = x + dx, input_y = y + dy;
this->m_imageInput->readSampled(color, input_x, input_y, COM_PS_NEAREST);
if (this->m_useAlphaInput) {

@ -119,10 +119,10 @@ static void sampleImageAtLocation(ImBuf *ibuf, float x, float y, PixelSampler sa
nearest_interpolation_color(ibuf, NULL, color, x, y);
break;
case COM_PS_BILINEAR:
bilinear_interpolation_color(ibuf, NULL, color, x - 0.5f, y - 0.5f);
bilinear_interpolation_color(ibuf, NULL, color, x, y);
break;
case COM_PS_BICUBIC:
bicubic_interpolation_color(ibuf, NULL, color, x - 0.5f, y - 0.5f);
bicubic_interpolation_color(ibuf, NULL, color, x, y);
break;
}
}
@ -133,10 +133,10 @@ static void sampleImageAtLocation(ImBuf *ibuf, float x, float y, PixelSampler sa
nearest_interpolation_color(ibuf, byte_color, NULL, x, y);
break;
case COM_PS_BILINEAR:
bilinear_interpolation_color(ibuf, byte_color, NULL, x - 0.5f, y - 0.5f);
bilinear_interpolation_color(ibuf, byte_color, NULL, x, y);
break;
case COM_PS_BICUBIC:
bicubic_interpolation_color(ibuf, byte_color, NULL, x - 0.5f, y - 0.5f);
bicubic_interpolation_color(ibuf, byte_color, NULL, x, y);
break;
}
rgba_uchar_to_float(color, byte_color);

@ -103,10 +103,10 @@ void MovieClipBaseOperation::executePixelSampled(float output[4], float x, float
nearest_interpolation_color(ibuf, NULL, output, x, y);
break;
case COM_PS_BILINEAR:
bilinear_interpolation_color(ibuf, NULL, output, x - 0.5f, y - 0.5f);
bilinear_interpolation_color(ibuf, NULL, output, x, y);
break;
case COM_PS_BICUBIC:
bicubic_interpolation_color(ibuf, NULL, output, x - 0.5f, y - 0.5f);
bicubic_interpolation_color(ibuf, NULL, output, x, y);
break;
}
}

@ -54,10 +54,10 @@ void MultilayerColorOperation::executePixelSampled(float output[4], float x, flo
nearest_interpolation_color(this->m_buffer, NULL, output, x, y);
break;
case COM_PS_BILINEAR:
bilinear_interpolation_color(this->m_buffer, NULL, output, x - 0.5f, y - 0.5f);
bilinear_interpolation_color(this->m_buffer, NULL, output, x, y);
break;
case COM_PS_BICUBIC:
bicubic_interpolation_color(this->m_buffer, NULL, output, x - 0.5f, y - 0.5f);
bicubic_interpolation_color(this->m_buffer, NULL, output, x, y);
break;
}
}

@ -104,11 +104,11 @@ void RenderLayersBaseProg::doInterpolation(float output[4], float x, float y, Pi
}
case COM_PS_BILINEAR:
BLI_bilinear_interpolation_fl(this->m_inputBuffer, output, width, height, this->m_elementsize, x - 0.5f, y - 0.5f);
BLI_bilinear_interpolation_fl(this->m_inputBuffer, output, width, height, this->m_elementsize, x, y);
break;
case COM_PS_BICUBIC:
BLI_bicubic_interpolation_fl(this->m_inputBuffer, output, width, height, this->m_elementsize, x - 0.5f, y - 0.5f);
BLI_bicubic_interpolation_fl(this->m_inputBuffer, output, width, height, this->m_elementsize, x, y);
break;
}
}

@ -100,12 +100,12 @@ void ViewerOperation::executeRegion(rcti *rect, unsigned int tileNumber)
for (y = y1; y < y2 && (!breaked); y++) {
for (x = x1; x < x2; x++) {
this->m_imageInput->readSampled(&(buffer[offset4]), (float)x + 0.5f, (float)y + 0.5f, COM_PS_NEAREST);
this->m_imageInput->readSampled(&(buffer[offset4]), x, y, COM_PS_NEAREST);
if (this->m_useAlphaInput) {
this->m_alphaInput->readSampled(alpha, (float)x + 0.5f, (float)y + 0.5f, COM_PS_NEAREST);
this->m_alphaInput->readSampled(alpha, x, y, COM_PS_NEAREST);
buffer[offset4 + 3] = alpha[0];
}
this->m_depthInput->readSampled(depth, (float)x + 0.5f, (float)y + 0.5f, COM_PS_NEAREST);
this->m_depthInput->readSampled(depth, x, y, COM_PS_NEAREST);
depthbuffer[offset] = depth[0];
offset ++;

@ -74,7 +74,7 @@ void WriteBufferOperation::executeRegion(rcti *rect, unsigned int tileNumber)
for (y = y1; y < y2 && (!breaked); y++) {
int offset4 = (y * memoryBuffer->getWidth() + x1) * num_channels;
for (x = x1; x < x2; x++) {
this->m_input->read(&(buffer[offset4]), (float)x + 0.5f, (float)y + 0.5f, data);
this->m_input->read(&(buffer[offset4]), x, y, data);
offset4 += num_channels;
}
if (isBreaked()) {
@ -99,7 +99,7 @@ void WriteBufferOperation::executeRegion(rcti *rect, unsigned int tileNumber)
for (y = y1; y < y2 && (!breaked); y++) {
int offset4 = (y * memoryBuffer->getWidth() + x1) * num_channels;
for (x = x1; x < x2; x++) {
this->m_input->readSampled(&(buffer[offset4]), (float)x + 0.5f, (float)y + 0.5f, COM_PS_NEAREST);
this->m_input->readSampled(&(buffer[offset4]), x, y, COM_PS_NEAREST);
offset4 += num_channels;
}
if (isBreaked()) {