From e2a17282aa4e9d7fda39b64b8d03d2e2ac756d34 Mon Sep 17 00:00:00 2001 From: Fabien Freling Date: Wed, 6 Aug 2014 22:33:41 +0200 Subject: [PATCH] Remove boundary check in rotate_pixel(). This check makes the last line invalid. --- TODO.md | 2 +- rotation.cpp | 12 ++---------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/TODO.md b/TODO.md index 577a53b..30bf998 100644 --- a/TODO.md +++ b/TODO.md @@ -1,7 +1,7 @@ [-] Draw rotated pixels in src order -> cache write miss [X] Use atan2 at beginning and end of line. Interpolation in-between values -[ ] Test pixel perfect 0, 90 +[X] Test pixel perfect 0, 90 [X] Optimization for square images [X] Fixed point computation diff --git a/rotation.cpp b/rotation.cpp index 5e9874d..56fa935 100644 --- a/rotation.cpp +++ b/rotation.cpp @@ -438,7 +438,6 @@ uint16_t* generate_border_table(uint16_t const* padding_table, Image const& imag inline void rotate_pixel(Image const& src, Point const& src_rotated_point, - unsigned int const src_limit, pvalue_t* rotate_buffer, unsigned int rot_index, int q_pow) { @@ -456,12 +455,6 @@ void rotate_pixel(Image const& src, unsigned int const src_index_3 = src_index_1 + src.pixel_size * src.width; unsigned int const src_index_4 = src_index_3 + src.pixel_size; - // Out-of-bounds check - if (src_index_4 >= src_limit) - { - return; - } - pvalue_t const src_tl = src.buffer[src_index_1]; pvalue_t const src_tr = src.buffer[src_index_2]; pvalue_t const src_bl = src.buffer[src_index_3]; @@ -536,7 +529,6 @@ Image* rotate(Image const& src, double angle) unsigned int buffer_index = 0; pvalue_t* buffer = rotated->buffer; - unsigned int const src_limit = src.width * src.height * src.pixel_size; int const width = rotated->width; int const height = rotated->height; int const& src_qwidth = src.width * q_pos; @@ -588,7 +580,7 @@ Image* rotate(Image const& src, double angle) if (src_rotated_point.x < 0 || src_rotated_point.y < 0 || src_rotated_point.x >= src_qwidth || src_rotated_point.y >= src_qheight) { -// cout << "Point too low!" << endl; + LOG << "Out-of-bounds point!" << endl; // cout << " x: " << x << endl; // cout << " src_rotated_point: " << src_rotated_point << endl; // cout << " qdx: " << qdx << endl; @@ -606,7 +598,7 @@ Image* rotate(Image const& src, double angle) } else { - rotate_pixel(src, src_rotated_point, src_limit, buffer, buffer_index, q_pos_pow); + rotate_pixel(src, src_rotated_point, buffer, buffer_index, q_pos_pow); } src_rotated_point += qdx;