fixed initialization of the border interpolation table in the filter engine (ticket #161)

This commit is contained in:
Vadim Pisarevsky 2010-11-13 20:23:20 +00:00
parent 70a524bc50
commit bffb5f8b58

View File

@ -270,19 +270,21 @@ int FilterEngine::start(Size _wholeSize, Rect _roi, int _maxBufRows)
} }
else else
{ {
int xofs1 = std::min(roi.x, anchor.x) - roi.x;
int btab_esz = borderElemSize, wholeWidth = wholeSize.width; int btab_esz = borderElemSize, wholeWidth = wholeSize.width;
int* btab = (int*)&borderTab[0]; int* btab = (int*)&borderTab[0];
for( i = 0; i < dx1; i++ ) for( i = 0; i < dx1; i++ )
{ {
int p0 = borderInterpolate(i-dx1, wholeWidth, rowBorderType)*btab_esz; int p0 = (borderInterpolate(i-dx1, wholeWidth, rowBorderType) + xofs1)*btab_esz;
for( j = 0; j < btab_esz; j++ ) for( j = 0; j < btab_esz; j++ )
btab[i*btab_esz + j] = p0 + j; btab[i*btab_esz + j] = p0 + j;
} }
for( i = 0; i < dx2; i++ ) for( i = 0; i < dx2; i++ )
{ {
int p0 = borderInterpolate(wholeWidth + i, wholeWidth, rowBorderType)*btab_esz; int p0 = (borderInterpolate(wholeWidth + i, wholeWidth, rowBorderType) + xofs1)*btab_esz;
for( j = 0; j < btab_esz; j++ ) for( j = 0; j < btab_esz; j++ )
btab[(i + dx1)*btab_esz + j] = p0 + j; btab[(i + dx1)*btab_esz + j] = p0 + j;
} }