blob: 9e066d4330cf8d0441aeeb60addd016b2ddca6c5 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#pragma once
#include <math.h>
#include <cstdint>
#include <vector>
namespace NAtracDEnc {
class TTransientDetector {
const uint32_t ShortSz;
const uint32_t BlockSz;
const uint32_t NShortBlocks;
static const uint32_t prevBufSz = 20;
void HPFilter(const double* in, double* out);
std::vector<double> HPFBuffer;
double LastEnergy = 0.0;
public:
TTransientDetector(uint32_t shortSz, uint32_t blockSz)
: ShortSz(shortSz)
, BlockSz(blockSz)
, NShortBlocks(blockSz/shortSz)
{
HPFBuffer.resize(BlockSz + prevBufSz);
}
bool Detect(const double* buf);
};
}
|