aboutsummaryrefslogtreecommitdiffstats
path: root/src/mdct/mdct.cpp
diff options
context:
space:
mode:
authorDaniil Cherednik <dan.cherednik@gmail.com>2024-06-16 20:43:56 +0000
committerDaniil Cherednik <dan.cherednik@gmail.com>2024-06-16 20:54:48 +0000
commit482f247c6a3a0615491eab6b90c19b929a87ab56 (patch)
tree354d0378018485a407fc7369e2a91cc6705ec4f2 /src/mdct/mdct.cpp
parent80a30dc68671d7e88082bd28684320a2680824a1 (diff)
downloadatracdenc-482f247c6a3a0615491eab6b90c19b929a87ab56.tar.gz
[AT3P] Use fast DCT-IV calculation for PQF
Diffstat (limited to 'src/mdct/mdct.cpp')
-rw-r--r--src/mdct/mdct.cpp29
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;
+ }
+}
+