Skip to content
Snippets Groups Projects
Commit 643d3676 authored by Julien Michel's avatar Julien Michel
Browse files

PERF: Compute abs(norm) outside pixel loop

parent fbf29901
No related branches found
No related tags found
No related merge requests found
......@@ -124,6 +124,8 @@ ConvolutionImageFilter<TInputImage, TOutputImage, TBoundaryCondition, TFilterPre
inputIt.GoToBegin();
unsigned int neighborhoodSize = inputIt.Size();
double norm_double = 1.;
// Compute the norm of the filter
if (m_NormalizeFilter)
{
......@@ -132,6 +134,7 @@ ConvolutionImageFilter<TInputImage, TOutputImage, TBoundaryCondition, TFilterPre
{
norm += static_cast<InputRealType>(vcl_abs(m_Filter(i)));
}
norm_double = static_cast<double>(vcl_abs(norm));
}
while (!inputIt.IsAtEnd())
......@@ -146,7 +149,7 @@ ConvolutionImageFilter<TInputImage, TOutputImage, TBoundaryCondition, TFilterPre
// get the mean value
if (m_NormalizeFilter)
{
outputIt.Set(static_cast<OutputPixelType>(sum / double(vcl_abs(norm))));
outputIt.Set(static_cast<OutputPixelType>(sum / norm_double));
}
else
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment