aboutsummaryrefslogtreecommitdiffstats
path: root/src/transient_detector.h
diff options
context:
space:
mode:
authorDaniil Cherednik <dan.cherednik@gmail.com>2016-04-22 02:39:35 +0300
committerDaniil Cherednik <dan.cherednik@gmail.com>2016-04-22 02:49:07 +0300
commit8d65a0bd0774e03b3d10354e15f2f3361a2ce26a (patch)
tree779fee89fb4e068c9e4b346038c01081977bddb5 /src/transient_detector.h
parentd31ca6265e9c19b0f5dfd39a89b20e4ffb201234 (diff)
downloadatracdenc-8d65a0bd0774e03b3d10354e15f2f3361a2ce26a.tar.gz
Fix memory corruption: wrong size of HPFBuffer.
Diffstat (limited to 'src/transient_detector.h')
-rw-r--r--src/transient_detector.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/transient_detector.h b/src/transient_detector.h
index 9e066d4..b3db6ba 100644
--- a/src/transient_detector.h
+++ b/src/transient_detector.h
@@ -8,7 +8,8 @@ class TTransientDetector {
const uint32_t ShortSz;
const uint32_t BlockSz;
const uint32_t NShortBlocks;
- static const uint32_t prevBufSz = 20;
+ static const uint32_t PrevBufSz = 20;
+ static const uint32_t FIRLen = 21;
void HPFilter(const double* in, double* out);
std::vector<double> HPFBuffer;
double LastEnergy = 0.0;
@@ -18,7 +19,7 @@ public:
, BlockSz(blockSz)
, NShortBlocks(blockSz/shortSz)
{
- HPFBuffer.resize(BlockSz + prevBufSz);
+ HPFBuffer.resize(BlockSz + FIRLen);
}
bool Detect(const double* buf);
};