diff --git a/include/algorithms/public/DCT.hpp b/include/algorithms/public/DCT.hpp index 1cde59292..f53ae8264 100644 --- a/include/algorithms/public/DCT.hpp +++ b/include/algorithms/public/DCT.hpp @@ -41,6 +41,11 @@ class DCT assert(inputSize <= mTable.cols()); assert(outputSize <= mTable.rows()); + // Do not reinitialise if there is no need + + if (mInitialized && mInputSize == inputSize && mOutputSize == outputSize) + return; + mInputSize = inputSize; mOutputSize = outputSize; mTable.setZero();