# HG changeset patch # User Chris Cannam # Date 1246626492 0 # Node ID 1a24b134cd7906960d204e06f1d1412f5be53cbb # Parent 9949881120a4c5ee3c404d758f21b04653acc32f * give a sensible preferred block size, & fail to initialise if block size is too small diff -r 9949881120a4 -r 1a24b134cd79 plugins/DWT.cpp --- a/plugins/DWT.cpp Tue Jun 30 14:50:08 2009 +0000 +++ b/plugins/DWT.cpp Fri Jul 03 13:08:12 2009 +0000 @@ -70,6 +70,14 @@ } size_t +DWT::getPreferredBlockSize() const +{ + size_t s = (1 << m_scales); + while (s < 1024) s *= 2; + return s; +} + +size_t DWT::getPreferredStepSize() const { return 0; @@ -81,6 +89,11 @@ if (channels < getMinChannelCount() || channels > getMaxChannelCount()) return false; + if ((1 << m_scales) > blockSize) { + std::cerr << "DWT::initialise: ERROR: Block size must be at least 2^scales (specified block size " << blockSize << " < " << (1 << m_scales) << ")" << std::endl; + return false; + } + m_stepSize = stepSize; m_blockSize = blockSize; diff -r 9949881120a4 -r 1a24b134cd79 plugins/DWT.h --- a/plugins/DWT.h Tue Jun 30 14:50:08 2009 +0000 +++ b/plugins/DWT.h Fri Jul 03 13:08:12 2009 +0000 @@ -34,6 +34,7 @@ std::string getMaker() const; int getPluginVersion() const; std::string getCopyright() const; + size_t getPreferredBlockSize() const; size_t getPreferredStepSize() const; OutputList getOutputDescriptors() const;