Optimization of Image to VectorImage Cast Filter (from 47M cycles to 7M cycles)
Mantis Issue 1042, reported by lhermitte, assigned to rkanavath, created: 2015-05-04
Useless reallocation were done in OTB 3.16.
Here is a patch that makes the use of Image to VectorImage Cast Filter goes down from 47M cycles 7M cycles (measured by callgrind on a program compiled with -O2 -g -DNDEBUG)
The idea behind the patch is to avoid to allocate and free memory to store a VectorPixel of size 1 at each iteration.
Instead the output pixel is cached and its value is updated at each iteration. Moreover the pixel is now returned through a const reference.
NB: The end user code shall not remember references on the returned pixels.
1431527037 - rashadkmThis patch is breaking some tests. Hence cannot be applied now. Need to investiage the issue more.
The following tests are failing:
1160 - coTvImageToVectorImageCastFilter (Failed)
ctest -VV -R coTvImageToVectorImageCastFilter
1160: Test command: /home/mkanavat/build/otb/bin/otbImageManipulationTestDriver "--compare-image" "0.0" "/home/mkanavat/sources/orfeo/OTB-Data/Baseline/OTB/Images/coImageToVectorImageCastFilterOutput.tif" "/home/mkanavat/build/otb/Testing/Temporary/coImageToVectorImageCastFilterOutput.tif" "otbImageToVectorImageCastFilter" "/home/mkanavat/sources/orfeo/OTB-Data/Input/poupees.hdr" "/home/mkanavat/build/otb/Testing/Temporary/coImageToVectorImageCastFilterOutput.tif" 1160: Test timeout computed to be: 1500 1160: -> Test EXIT SUCCESS. 1160: ------------- Start control baseline tests ------------- 1160: Number of baseline images: 1 1160: Testing non-regression on image: /home/mkanavat/sources/orfeo/OTB-Data/Baseline/OTB/Images/coImageToVectorIma