diff options
author | Daniil Cherednik <dan.cherednik@gmail.com> | 2015-11-14 03:14:25 +0300 |
---|---|---|
committer | Daniil Cherednik <dan.cherednik@gmail.com> | 2015-11-14 03:14:25 +0300 |
commit | f06c500192ce216370bb92efd78b19765df4c39b (patch) | |
tree | b0d295c2c320deb232d9fe52437f58f04595b8d2 /src | |
parent | b45cd2e5bc5a26fa9b570be5246f6bf1b91d46b6 (diff) | |
download | atracdenc-f06c500192ce216370bb92efd78b19765df4c39b.tar.gz |
fix: compensate delay should be 39 sample not 23
Diffstat (limited to 'src')
-rw-r--r-- | src/atrac/atrac1_qmf.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/atrac/atrac1_qmf.h b/src/atrac/atrac1_qmf.h index fa2dcd9..8550932 100644 --- a/src/atrac/atrac1_qmf.h +++ b/src/atrac/atrac1_qmf.h @@ -5,6 +5,7 @@ template<class TIn> class Atrac1SplitFilterBank { const static int nInSamples = 512; + const static int delayComp = 39; TQmf<TIn, nInSamples> Qmf1; TQmf<TIn, nInSamples / 2> Qmf2; std::vector<double> MidLowTmp; @@ -12,11 +13,11 @@ class Atrac1SplitFilterBank { public: Atrac1SplitFilterBank() { MidLowTmp.resize(512); - DelayBuf.resize(23 + 512); + DelayBuf.resize(delayComp + 512); } void Split(TIn* pcm, double* low, double* mid, double* hi) { - memcpy(&DelayBuf[0], &DelayBuf[256], sizeof(double) * 23); - Qmf1.Split(pcm, &MidLowTmp[0], &DelayBuf[23]); + memcpy(&DelayBuf[0], &DelayBuf[256], sizeof(double) * delayComp); + Qmf1.Split(pcm, &MidLowTmp[0], &DelayBuf[delayComp]); Qmf2.Split(&MidLowTmp[0], low, mid); memcpy(hi, &DelayBuf[0], sizeof(double) * 256); @@ -25,6 +26,7 @@ public: template<class TOut> class Atrac1SynthesisFilterBank { const static int nInSamples = 512; + const static int delayComp = 39; TQmf<TOut, nInSamples> Qmf1; TQmf<TOut, nInSamples / 2> Qmf2; std::vector<double> MidLowTmp; @@ -32,11 +34,11 @@ class Atrac1SynthesisFilterBank { public: Atrac1SynthesisFilterBank() { MidLowTmp.resize(512); - DelayBuf.resize(23 + 512); + DelayBuf.resize(delayComp + 512); } void Synthesis(TOut* pcm, double* low, double* mid, double* hi) { - memcpy(&DelayBuf[0], &DelayBuf[256], sizeof(double) * 23); - memcpy(&DelayBuf[23], hi, sizeof(double) * 256); + memcpy(&DelayBuf[0], &DelayBuf[256], sizeof(double) * delayComp); + memcpy(&DelayBuf[delayComp], hi, sizeof(double) * 256); Qmf2.Merge(&MidLowTmp[0], &low[0], &mid[0]); Qmf1.Merge(&pcm[0], &MidLowTmp[0], &DelayBuf[0]); } |