blob: 063765162166c28b2058ef1a6a8a3d9c16517a8b (
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
26
27
28
29
30
31
32
33
34
|
#pragma once
#include "vorbis_impl/mdct.h"
#include <vector>
namespace NMDCT {
class TMDCTBase {
protected:
MDCTContext Ctx;
TMDCTBase(int n, double scale) {
mdct_ctx_init(&Ctx, n, scale);
};
virtual ~TMDCTBase() {
mdct_ctx_close(&Ctx);
};
};
template<int N>
class TMDCT : public TMDCTBase {
std::vector<double> Buf;
public:
TMDCT(float scale = 1.0)
: Buf(N/2)
, TMDCTBase(N, scale)
{}
const std::vector<double>& operator()(double* in) {
mdct(&Ctx, &Buf[0], in);
return Buf;
}
};
} //namespace NMDCT
|