Commit 673ccbbf authored by Davis King's avatar Davis King

Made interpolate_bilinear a little bit faster.

parent e3a43652
...@@ -60,18 +60,18 @@ namespace dlib ...@@ -60,18 +60,18 @@ namespace dlib
{ {
COMPILE_TIME_ASSERT(pixel_traits<typename image_type::type>::has_alpha == false); COMPILE_TIME_ASSERT(pixel_traits<typename image_type::type>::has_alpha == false);
const long top = static_cast<long>(std::floor(p.y()));
const long bottom = static_cast<long>(std::ceil (p.y()));
const long left = static_cast<long>(std::floor(p.x())); const long left = static_cast<long>(std::floor(p.x()));
const long right = static_cast<long>(std::ceil (p.x())); const long top = static_cast<long>(std::floor(p.y()));
const long right = left+1;
const long bottom = top+1;
// if the interpolation goes outside img // if the interpolation goes outside img
if (!get_rect(img).contains(rectangle(left,top,right,bottom))) if (!get_rect(img).contains(rectangle(left,top,right,bottom)))
return false; return false;
const double lr_frac = p.x() - std::floor(p.x()); const double lr_frac = p.x() - left;
const double tb_frac = p.y() - std::floor(p.y()); const double tb_frac = p.y() - top;
double tl = 0, tr = 0, bl = 0, br = 0; double tl = 0, tr = 0, bl = 0, br = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment