Remove boundary check in rotate_pixel().

This check makes the last line invalid.
master
Fabien Freling 2014-08-06 22:33:41 +02:00
parent 210dff5c62
commit e2a17282aa
2 changed files with 3 additions and 11 deletions

View File

@ -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

View File

@ -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;