diff options
author | Daniil Cherednik <dan.cherednik@gmail.com> | 2022-02-22 00:47:51 +0300 |
---|---|---|
committer | Daniil Cherednik <dan.cherednik@gmail.com> | 2022-02-22 01:28:18 +0300 |
commit | 718aea2242da052183f08e9ad58c2a9a1843d8a6 (patch) | |
tree | 595c18cd5de19ceaa30655c8c3dd55a908af3696 /src/transient_detector.cpp | |
parent | b232396d25bd2eaef3fcaa536dd506a3b5da2c99 (diff) | |
download | atracdenc-718aea2242da052183f08e9ad58c2a9a1843d8a6.tar.gz |
Fix CodeQL (Multiplication result converted to larger type) warning
Diffstat (limited to 'src/transient_detector.cpp')
-rw-r--r-- | src/transient_detector.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/transient_detector.cpp b/src/transient_detector.cpp index 692c3a7..8e4c072 100644 --- a/src/transient_detector.cpp +++ b/src/transient_detector.cpp @@ -67,14 +67,14 @@ void TTransientDetector::HPFilter(const TFloat* in, TFloat* out) { bool TTransientDetector::Detect(const TFloat* buf) { - const uint32_t nBlocksToAnalize = NShortBlocks + 1; + const uint16_t nBlocksToAnalize = NShortBlocks + 1; TFloat* rmsPerShortBlock = reinterpret_cast<TFloat*>(alloca(sizeof(TFloat) * nBlocksToAnalize)); std::vector<TFloat> filtered(BlockSz); HPFilter(buf, filtered.data()); bool trans = false; rmsPerShortBlock[0] = LastEnergy; - for (uint32_t i = 1; i < nBlocksToAnalize; ++i) { - rmsPerShortBlock[i] = 19.0 * log10(calculateRMS(&filtered[(i - 1) * ShortSz], ShortSz)); + for (uint16_t i = 1; i < nBlocksToAnalize; ++i) { + rmsPerShortBlock[i] = 19.0 * log10(calculateRMS(&filtered[(size_t)(i - 1) * ShortSz], ShortSz)); if (rmsPerShortBlock[i] - rmsPerShortBlock[i - 1] > 16) { trans = true; LastTransientPos = i; |