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.5f;
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.5f;
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.5f;
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];
200 for (i = 0; i < n / 2; i++)
201 s->
csc2[i] = 0.5 / sin((
M_PI / (2 * n) * (2 * i + 1)));