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

github.com/torch/image.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Deltheil <cedric@moodstocks.com>2015-09-13 22:01:44 +0300
committerCédric Deltheil <cedric@moodstocks.com>2015-09-13 22:01:44 +0300
commit2614f3d210f70b3768b6882a754a309c65d45a34 (patch)
tree902aebd6ebd9a5126cfb4b62ce4a37d4a27f8e66
parent1c013e5cc89e6831b65b2fef3c9c5a8a6a9e57d0 (diff)
warp: fix bounds checking for bicubic mode
This is related to commit b5fc8d0.
-rwxr-xr-xgeneric/image.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/generic/image.c b/generic/image.c
index 5ac3919..d977bcb 100755
--- a/generic/image.c
+++ b/generic/image.c
@@ -1670,7 +1670,7 @@ static inline image_(Main_bicubicInterpolate)(
#pragma unroll
for (j = 0; j < 4; j++) {
long u = x_pix + j - 1;
- if (bounds_check && (v < 0 || v >= size[2] || u < 0 || u >= size[3])) {
+ if (bounds_check && (v < 0 || v >= size[1] || u < 0 || u >= size[2])) {
p[j] = pad_value;
} else {
p[j] = data[u * is[2]];
@@ -1784,7 +1784,7 @@ int image_(Main_warp)(lua_State *L) {
case 2: // Bicubic
{
// We only need to do bounds checking if ix or iy are near the edge
- int edge = !(iy >= 1 && iy < height - 2 && ix >= 1 && ix < width - 2);
+ int edge = !(iy >= 1 && iy < src_height - 2 && ix >= 1 && ix < src_width - 2);
real* dst = dst_data + y*os[1] + x*os[2];
if (edge) {