# HG changeset patch # User Chris Cannam # Date 1470060376 -3600 # Node ID c118d2022ffad04408e2b59891c209eacea983d9 # Parent 238780e92f86af98702ef9806ccb56f072b2a10a Scale range matching diff -r 238780e92f86 -r c118d2022ffa base/ColumnOp.h --- a/base/ColumnOp.h Wed Jul 20 13:40:23 2016 +0100 +++ b/base/ColumnOp.h Mon Aug 01 15:06:16 2016 +0100 @@ -52,18 +52,26 @@ typedef std::vector Column; /** + * Scale the given column using the given gain multiplier. + */ + static Column applyGain(const Column &in, float gain) { + + if (gain == 1.f) { + return in; + } + Column out; + out.reserve(in.size()); + for (auto v: in) { + out.push_back(v * gain); + } + return out; + } + + /** * Scale an FFT output by half the FFT size. */ static Column fftScale(const Column &in, int fftSize) { - - Column out; - out.reserve(in.size()); - float scale = 2.f / float(fftSize); - for (auto v: in) { - out.push_back(v * scale); - } - - return out; + return applyGain(in, 2.f / float(fftSize)); } /** @@ -144,22 +152,6 @@ } /** - * Scale the given column using the given gain multiplier. - */ - static Column applyGain(const Column &in, float gain) { - - if (gain == 1.f) { - return in; - } - Column out; - out.reserve(in.size()); - for (auto v: in) { - out.push_back(v * gain); - } - return out; - } - - /** * Distribute the given column into a target vector of a different * size, optionally using linear interpolation. The binfory vector * contains a mapping from y coordinate (i.e. index into the