38 #define SIN(s, n, x) (s->costab[(n) - (x)])
41 #define COS(s, n, x) (s->costab[x])
49 for (i = 1; i < n / 2; i++) {
50 float tmp1 = data[i ];
51 float tmp2 = data[n - i];
52 float s =
SIN(ctx, n, 2 * i);
55 tmp1 = (tmp1 - tmp2) * 0.5
f;
57 data[n - i] = s - tmp1;
65 for (i = 1; i < n - 2; i += 2) {
66 data[i + 1] += data[i - 1];
67 data[i] = -data[i + 2];
77 float next = -0.5f * (data[0] - data[
n]);
79 for (i = 0; i < n / 2; i++) {
81 float tmp2 = data[n - i];
82 float s =
SIN(ctx, n, 2 * i);
83 float c =
COS(ctx, n, 2 * i);
90 tmp1 = (tmp1 + tmp2) * 0.5
f;
92 data[n - i] = tmp1 +
s;
99 for (i = 3; i <=
n; i += 2)
100 data[i] = data[i - 2] - data[i];
108 float next = data[n - 1];
109 float inv_n = 1.0f /
n;
111 for (i = n - 2; i >= 2; i -= 2) {
112 float val1 = data[i];
113 float val2 = data[i - 1] - data[i + 1];
114 float c =
COS(ctx, n, i);
115 float s =
SIN(ctx, n, i);
117 data[i] = c * val1 + s * val2;
118 data[i + 1] = s * val1 - c * val2;
125 for (i = 0; i < n / 2; i++) {
126 float tmp1 = data[i] * inv_n;
127 float tmp2 = data[n - i - 1] * inv_n;
128 float csc = ctx->
csc2[i] * (tmp1 - tmp2);
131 data[i] = tmp1 + csc;
132 data[n - i - 1] = tmp1 - csc;
142 for (i = 0; i < n / 2; i++) {
143 float tmp1 = data[i];
144 float tmp2 = data[n - i - 1];
145 float s =
SIN(ctx, n, 2 * i + 1);
148 tmp1 = (tmp1 + tmp2) * 0.5
f;
151 data[n-i-1] = tmp1 -
s;
156 next = data[1] * 0.5;
159 for (i = n - 2; i >= 0; i -= 2) {
160 float inr = data[i ];
161 float ini = data[i + 1];
162 float c =
COS(ctx, n, i);
163 float s =
SIN(ctx, n, i);
165 data[i] = c * inr + s * ini;
168 next += s * inr - c * ini;
174 ctx->
dct32(data, data);
182 memset(s, 0,
sizeof(*s));
187 if (inverse ==
DCT_II && nbits == 5) {
192 s->
costab = ff_cos_tabs[nbits + 2];
202 for (i = 0; i < n / 2; i++)
203 s->
csc2[i] = 0.5 / sin((
M_PI / (2 * n) * (2 * i + 1)));
av_cold void ff_rdft_end(RDFTContext *s)
static void dct32_func(DCTContext *ctx, FFTSample *data)
void(* dct_calc)(struct DCTContext *s, FFTSample *data)
ptrdiff_t const GLvoid * data
static void dct_calc_I_c(DCTContext *ctx, FFTSample *data)
void ff_dct_init_x86(DCTContext *s)
void(* rdft_calc)(struct RDFTContext *s, FFTSample *z)
static void dct_calc_II_c(DCTContext *ctx, FFTSample *data)
void ff_dct32_float(float *dst, const float *src)
static void dct_calc_III_c(DCTContext *ctx, FFTSample *data)
void(* dct32)(FFTSample *out, const FFTSample *in)
av_cold int ff_dct_init(DCTContext *s, int nbits, enum DCTTransformType inverse)
Set up DCT.
#define ff_init_ff_cos_tabs
static void dst_calc_I_c(DCTContext *ctx, FFTSample *data)
av_cold void ff_dct_end(DCTContext *s)
static uint32_t inverse(uint32_t v)
find multiplicative inverse modulo 2 ^ 32
#define av_malloc_array(a, b)
av_cold int ff_rdft_init(RDFTContext *s, int nbits, enum RDFTransformType trans)
Set up a real FFT.