Skip to content
Snippets Groups Projects
  • Andreas Schenk's avatar
    5161efae
    refactored ValueHolder, ImageStateImpl and FFT · 5161efae
    Andreas Schenk authored
    Changed in detail:
    ------------------
    
    - removed DEPRECATED and unused code (slice and row pointers) in value holder
    - switched from new allocatd array to std::vector
    - removed explicit data initialization loop
    - using size_t instead of unsigned int for memory allocation
    - removed padding code
    - removed try catch(...) statements
    - added overflow check for big volumes
    - optimized 3D index to linear index calculation
    - removed physical extent for spatial domain (identical to logical extend not that padding is gone)
    - switched FFT to out of place transforms
    
    Benefits
    --------
    
    - memory for large images is correctly allocated
    - if the memory can't be allocated an exception is thrown instead of crashing the program
    - speed increase for FFT ca. 12% and for algorithms using direct value access (e.g. Stat) ca. 7%
    
    Issues
    -----
    
    - FFTs are not out of place, leading to increased memory usage for c2c DFT backtransform and
      hc2r FFT/DFT backtransform (3x image size instead of 2x image size). If necessary it would
      be possible to add a fallback for these cases (i.e. catch bad_alloc for the tmp state) and
      do them in place in low memory conditions. Padding for the in-place transform could be added
      to the std::vector either at construction time or otherwise using reserve().
    5161efae
    History
    refactored ValueHolder, ImageStateImpl and FFT
    Andreas Schenk authored
    Changed in detail:
    ------------------
    
    - removed DEPRECATED and unused code (slice and row pointers) in value holder
    - switched from new allocatd array to std::vector
    - removed explicit data initialization loop
    - using size_t instead of unsigned int for memory allocation
    - removed padding code
    - removed try catch(...) statements
    - added overflow check for big volumes
    - optimized 3D index to linear index calculation
    - removed physical extent for spatial domain (identical to logical extend not that padding is gone)
    - switched FFT to out of place transforms
    
    Benefits
    --------
    
    - memory for large images is correctly allocated
    - if the memory can't be allocated an exception is thrown instead of crashing the program
    - speed increase for FFT ca. 12% and for algorithms using direct value access (e.g. Stat) ca. 7%
    
    Issues
    -----
    
    - FFTs are not out of place, leading to increased memory usage for c2c DFT backtransform and
      hc2r FFT/DFT backtransform (3x image size instead of 2x image size). If necessary it would
      be possible to add a fallback for these cases (i.e. catch bad_alloc for the tmp state) and
      do them in place in low memory conditions. Padding for the in-place transform could be added
      to the std::vector either at construction time or otherwise using reserve().