From 7d44e77501f6bb7475ca27cf4bc821c0deadd1ea Mon Sep 17 00:00:00 2001
From: Julien Michel <julien.michel@cnes.fr>
Date: Fri, 30 Oct 2015 11:50:29 +0100
Subject: [PATCH] PERF: Try to remove replacement of * (1/bandwith) with /
 bandwith to see if it improves tests stability

---
 .../Smoothing/include/otbMeanShiftSmoothingImageFilter.txx  | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/Modules/Filtering/Smoothing/include/otbMeanShiftSmoothingImageFilter.txx b/Modules/Filtering/Smoothing/include/otbMeanShiftSmoothingImageFilter.txx
index f25daa21d9..55d75bbd64 100644
--- a/Modules/Filtering/Smoothing/include/otbMeanShiftSmoothingImageFilter.txx
+++ b/Modules/Filtering/Smoothing/include/otbMeanShiftSmoothingImageFilter.txx
@@ -375,9 +375,7 @@ void MeanShiftSmoothingImageFilter<TInputImage, TOutputImage, TKernel, TOutputIt
   neighborhoodRegion.SetSize(regionSize);
 
   RealType weightSum = 0;
-  RealVector oneOverBandwidth(jointDimension), shifts(jointDimension);
-  for (unsigned int comp = 0; comp < jointDimension; comp++)
-    oneOverBandwidth[comp] = 1.0/bandwidth[comp];
+  RealVector shifts(jointDimension);
 
   // An iterator on the neighborhood of the current pixel (in joint
   // spatial-range domain)
@@ -395,7 +393,7 @@ void MeanShiftSmoothingImageFilter<TInputImage, TOutputImage, TKernel, TOutputIt
     for (unsigned int comp = 0; comp < jointDimension; comp++)
       {
       shifts[comp] = jointNeighbor[comp] - jointPixel[comp];
-      double d = shifts[comp] * oneOverBandwidth[comp];
+      double d = shifts[comp] / bandwidth[comp];
       norm2 += d*d;
       }
 
-- 
GitLab