40 for (i = 0; i <
n; i += 2) {
43 accu += (int64_t)x[i + 0][0] * x[i + 0][0];
45 accu += (int64_t)x[i + 0][1] * x[i + 0][1];
47 accu += (int64_t)x[i + 1][0] * x[i + 1][0];
49 accu += (int64_t)x[i + 1][1] * x[i + 1][1];
52 i = (int)(accu >> 32);
57 while (
FFABS(i) < 0x40000000) {
65 i = (int)((accu + round) >> nz);
75 for (i = 1; i < 64; i += 2)
84 for (k = 1; k < 32; k++) {
85 z[64+2*k ] = -z[64 - k];
86 z[64+2*k+1] = z[ k + 1];
93 for (k = 0; k < 32; k++) {
102 for (i = 0; i < 32; i++) {
103 v[ i] = ( src[63 - 2*i ] + 0x10) >> 5;
104 v[63 - i] = (-src[63 - 2*i - 1] + 0x10) >> 5;
110 int nz, mant, expo,
round;
111 int i = (int)(accu >> 32);
116 while (
FFABS(i) < 0x40000000) {
124 mant = (int)((accu + round) >> nz);
125 mant = (mant + 0x40)>>7;
134 int64_t real_sum, imag_sum;
135 int64_t accu_re = 0, accu_im = 0;
138 for (i = 1; i < 38; i++) {
139 accu_re += (int64_t)x[i][0] * x[i+lag][0];
140 accu_re += (int64_t)x[i][1] * x[i+lag][1];
141 accu_im += (int64_t)x[i][0] * x[i+lag][1];
142 accu_im -= (int64_t)x[i][1] * x[i+lag][0];
148 accu_re += (int64_t)x[ 0][0] * x[lag][0];
149 accu_re += (int64_t)x[ 0][1] * x[lag][1];
150 accu_im += (int64_t)x[ 0][0] * x[lag][1];
151 accu_im -= (int64_t)x[ 0][1] * x[lag][0];
159 accu_re += (int64_t)x[38][0] * x[39][0];
160 accu_re += (int64_t)x[38][1] * x[39][1];
161 accu_im += (int64_t)x[38][0] * x[39][1];
162 accu_im -= (int64_t)x[38][1] * x[39][0];
168 for (i = 1; i < 38; i++) {
169 accu_re += (int64_t)x[i][0] * x[i][0];
170 accu_re += (int64_t)x[i][1] * x[i][1];
173 accu_re += (int64_t)x[ 0][0] * x[ 0][0];
174 accu_re += (int64_t)x[ 0][1] * x[ 0][1];
179 accu_re += (int64_t)x[38][0] * x[38][0];
180 accu_re += (int64_t)x[38][1] * x[38][1];
194 const int alpha0[2],
const int alpha1[2],
201 accu = (int64_t)alpha0[0] * bw;
202 alpha[2] = (int)((accu + 0x40000000) >> 31);
203 accu = (int64_t)alpha0[1] * bw;
204 alpha[3] = (int)((accu + 0x40000000) >> 31);
205 accu = (int64_t)bw * bw;
206 bw = (int)((accu + 0x40000000) >> 31);
207 accu = (int64_t)alpha1[0] * bw;
208 alpha[0] = (int)((accu + 0x40000000) >> 31);
209 accu = (int64_t)alpha1[1] * bw;
210 alpha[1] = (int)((accu + 0x40000000) >> 31);
212 for (i = start; i <
end; i++) {
213 accu = (int64_t)X_low[i][0] * 0x20000000;
214 accu += (int64_t)X_low[i - 2][0] * alpha[0];
215 accu -= (int64_t)X_low[i - 2][1] * alpha[1];
216 accu += (int64_t)X_low[i - 1][0] * alpha[2];
217 accu -= (int64_t)X_low[i - 1][1] * alpha[3];
218 X_high[i][0] = (int)((accu + 0x10000000) >> 29);
220 accu = (int64_t)X_low[i][1] * 0x20000000;
221 accu += (int64_t)X_low[i - 2][1] * alpha[0];
222 accu += (int64_t)X_low[i - 2][0] * alpha[1];
223 accu += (int64_t)X_low[i - 1][1] * alpha[2];
224 accu += (int64_t)X_low[i - 1][0] * alpha[3];
225 X_high[i][1] = (int)((accu + 0x10000000) >> 29);
230 const SoftFloat *g_filt,
int m_max, intptr_t ixh)
235 for (m = 0; m < m_max; m++) {
236 r = 1 << (22-g_filt[
m].
exp);
237 accu = (int64_t)X_high[m][ixh][0] * ((g_filt[m].mant + 0x40)>>7);
238 Y[
m][0] = (int)((accu + r) >> (23-g_filt[
m].
exp));
240 accu = (int64_t)X_high[m][ixh][1] * ((g_filt[m].mant + 0x40)>>7);
241 Y[
m][1] = (int)((accu + r) >> (23-g_filt[
m].
exp));
255 for (m = 0; m < m_max; m++) {
258 noise = (noise + 1) & 0x1ff;
262 shift = 22 - s_m[
m].
exp;
264 round = 1 << (shift-1);
265 y0 += (s_m[
m].
mant * phi_sign0 +
round) >> shift;
266 y1 += (s_m[
m].
mant * phi_sign1 +
round) >> shift;
272 shift = 22 - q_filt[
m].
exp;
274 round = 1 << (shift-1);
276 accu = (int64_t)q_filt[m].mant * ff_sbr_noise_table_fixed[noise][0];
277 tmp = (int)((accu + 0x40000000) >> 31);
278 y0 += (tmp +
round) >> shift;
280 accu = (int64_t)q_filt[m].mant * ff_sbr_noise_table_fixed[noise][1];
281 tmp = (int)((accu + 0x40000000) >> 31);
282 y1 += (tmp +
round) >> shift;
287 phi_sign1 = -phi_sign1;
static int shift(int a, int b)
static av_always_inline SoftFloat autocorr_calc(int64_t accu)
static void sbr_autocorrelate_c(const int x[40][2], SoftFloat phi[3][2][2])
Macro definitions for various function/variable attributes.
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
static void sbr_hf_g_filt_c(int(*Y)[2], const int(*X_high)[40][2], const SoftFloat *g_filt, int m_max, intptr_t ixh)
static av_cold int end(AVCodecContext *avctx)
static SoftFloat sbr_sum_square_c(int(*x)[2], int n)
static double alpha(void *priv, double x, double y)
static av_always_inline void autocorrelate(const int x[40][2], SoftFloat phi[3][2][2], int lag)
static av_always_inline av_const double round(double x)
static void sbr_qmf_post_shuffle_c(int W[32][2], const int *z)
static av_always_inline void sbr_hf_apply_noise(int(*Y)[2], const SoftFloat *s_m, const SoftFloat *q_filt, int noise, int phi_sign0, int phi_sign1, int m_max)
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
AAC definitions and structures.
static int noise(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args, uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size, int keyframe)
static void sbr_neg_odd_64_c(int *x)
static void sbr_qmf_pre_shuffle_c(int *z)
static void sbr_qmf_deint_neg_c(int *v, const int *src)
static av_const SoftFloat av_int2sf(int v, int frac_bits)
Converts a mantisse and exponent to a SoftFloat.
static void sbr_hf_gen_c(int(*X_high)[2], const int(*X_low)[2], const int alpha0[2], const int alpha1[2], int bw, int start, int end)