Add check_00().

master
Fabien Freling 2014-08-06 22:23:40 +02:00
parent e88962753c
commit 199ab32254
1 changed files with 37 additions and 1 deletions

View File

@ -869,6 +869,36 @@ bool check_trigo()
return true;
}
bool check_00(string const& path)
{
Image const src(path);
Image const* rotated = rotate(src, 0);
for (unsigned int y = 0; y < rotated->height; ++y)
{
for (unsigned int x = 0; x < rotated->width; ++x)
{
unsigned rot_index = (y * rotated->width + x) * rotated->pixel_size;
unsigned src_index = (y * src.width + x) * src.pixel_size;
if (memcmp(&rotated->buffer[rot_index], &src.buffer[src_index], src.pixel_size * sizeof (pvalue_t)) != 0)
{
Point r(x, y);
Point s(x, y);
LOG << "R" << r << " != S" << s << endl;
LOG << "R: " << rot_index << " != S: " << src_index << endl;
LOG << rotated->buffer[rot_index] << " != " << src.buffer[src_index] << endl;
LOG << "R dim: " << rotated->width << " x " << rotated->height << endl;
LOG << "S dim: " << src.width << " x " << src.height << endl;
return false;
}
}
}
delete rotated;
return true;
}
bool check_90(string const& path)
{
Image const src(path);
@ -926,7 +956,7 @@ int main(int argc, char* argv[])
return 1;
}
bool perform_check = false;
bool perform_check = true;
if (perform_check)
{
@ -936,6 +966,12 @@ int main(int argc, char* argv[])
if (!check_trigo())
return 1;
if (!check_00(argv[1]))
{
ERRLOG << "0 degree check failed" << endl << endl;
return 1;
}
if (!check_90(argv[1]))
{
ERRLOG << "90 degrees check failed" << endl << endl;