diff options
author | Daniil Cherednik <dan.cherednik@gmail.com> | 2016-06-19 02:58:23 +0300 |
---|---|---|
committer | Daniil Cherednik <dan.cherednik@gmail.com> | 2016-06-19 03:31:55 +0300 |
commit | 1151d5831f19a9f24dd0c545a4968606712a62d2 (patch) | |
tree | c978c1b9a3fc86fef531dd412fe6b7668b7c0567 /src/transient_detector.h | |
parent | 8d65a0bd0774e03b3d10354e15f2f3361a2ce26a (diff) | |
download | atracdenc-1151d5831f19a9f24dd0c545a4968606712a62d2.tar.gz |
some improvements of ATRAC3 implementation:atrac3
- simple (ATRAC1 like) psychoacoustic added
- possibility to encode tonal components
- simple tonal component extractor
- refactoring
Diffstat (limited to 'src/transient_detector.h')
-rw-r--r-- | src/transient_detector.h | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/transient_detector.h b/src/transient_detector.h index b3db6ba..004eff6 100644 --- a/src/transient_detector.h +++ b/src/transient_detector.h @@ -3,6 +3,8 @@ #include <cstdint> #include <vector> +#include "config.h" + namespace NAtracDEnc { class TTransientDetector { const uint32_t ShortSz; @@ -10,9 +12,10 @@ class TTransientDetector { const uint32_t NShortBlocks; 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; + void HPFilter(const TFloat* in, TFloat* out); + std::vector<TFloat> HPFBuffer; + TFloat LastEnergy = 0.0; + uint32_t LastTransientPos = 0; public: TTransientDetector(uint32_t shortSz, uint32_t blockSz) : ShortSz(shortSz) @@ -21,6 +24,9 @@ public: { HPFBuffer.resize(BlockSz + FIRLen); } - bool Detect(const double* buf); + bool Detect(const TFloat* buf); + uint32_t GetLastTransientPos() const { return LastTransientPos; } }; + +std::vector<TFloat> AnalyzeGain(const TFloat* in, const uint32_t len, const uint32_t maxPoints); } |