diff options
author | Daniil Cherednik <dan.cherednik@gmail.com> | 2024-06-16 20:43:56 +0000 |
---|---|---|
committer | Daniil Cherednik <dan.cherednik@gmail.com> | 2024-06-16 20:54:48 +0000 |
commit | 482f247c6a3a0615491eab6b90c19b929a87ab56 (patch) | |
tree | 354d0378018485a407fc7369e2a91cc6705ec4f2 /src/mdct/mdct.cpp | |
parent | 80a30dc68671d7e88082bd28684320a2680824a1 (diff) | |
download | atracdenc-482f247c6a3a0615491eab6b90c19b929a87ab56.tar.gz |
[AT3P] Use fast DCT-IV calculation for PQF
Diffstat (limited to 'src/mdct/mdct.cpp')
-rw-r--r-- | src/mdct/mdct.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/mdct/mdct.cpp b/src/mdct/mdct.cpp index 6acd8d3..74b6d91 100644 --- a/src/mdct/mdct.cpp +++ b/src/mdct/mdct.cpp @@ -17,6 +17,7 @@ */ #include "mdct.h" +#include "dct.h" #include <iostream> namespace NMDCT { @@ -51,3 +52,31 @@ TMDCTBase::~TMDCTBase() } } // namespace NMDCT + +struct atde_dct_ctx { + atde_dct_ctx(float scale) + : mdct(scale) + {} + NMDCT::TMIDCT<32, float> mdct; +}; + +atde_dct_ctx_t atde_create_dct4_16(float scale) +{ + return new atde_dct_ctx(32.0 * scale); +} + +void atde_free_dct_ctx(atde_dct_ctx_t ctx) +{ + delete ctx; +} + +void atde_do_dct4_16(atde_dct_ctx_t ctx, const float* in, float* out) +{ + //TODO: rewrire more optimal + const auto& x = ctx->mdct(in); + + for (int i = 0; i < 16; i++) { + out[i] = x[i + 8] * -1.0; + } +} + |