From ea4a0feb3a1a6f7513839ecfd0b492b48795515a Mon Sep 17 00:00:00 2001 From: Tadas Baltrusaitis Date: Sat, 30 Sep 2017 11:33:15 +0100 Subject: [PATCH] Changing division to multiplication, a decent speedup. --- lib/local/LandmarkDetector/src/CEN_patch_expert.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/local/LandmarkDetector/src/CEN_patch_expert.cpp b/lib/local/LandmarkDetector/src/CEN_patch_expert.cpp index 22c317b6..115dded9 100644 --- a/lib/local/LandmarkDetector/src/CEN_patch_expert.cpp +++ b/lib/local/LandmarkDetector/src/CEN_patch_expert.cpp @@ -367,9 +367,12 @@ void im2colBiasSparseContrastNorm(const cv::Mat_& input, int width, int h norm = 1; } + // Flip multiplication to division for speed + norm = 1.0 / norm; + for (size_t x = 1; x < width*height + 1; ++x) { - Mo[x] /= norm; + Mo[x] *= norm; } rowIdx++;