Go to the documentation of this file.
33 if (!num_reuse_blocks)
36 for (
i = 0;
i < nb_coefs;
i++) {
39 for (
blk = 0;
blk < num_reuse_blocks;
blk++) {
41 if (next_exp < min_exp)
51 const float scale = 1 << 24;
67 int snr_offset,
int floor,
70 int bin, band, band_end;
73 if (snr_offset == -960) {
83 band_end =
FFMIN(band_end, end);
85 for (; bin < band_end; bin++) {
89 }
while (end > band_end);
100 0, 0, 0, 3, 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 16
110 bits += (mant_cnt[
blk][1] / 3) * 5;
113 bits += ((mant_cnt[
blk][2] / 3) + (mant_cnt[
blk][4] >> 1)) * 7;
117 for (bap = 5; bap < 16; bap++)
127 for (
i = 0;
i < nb_coefs;
i++) {
128 int v =
abs(coef[
i]);
140 sum[0] = sum[1] = sum[2] = sum[3] = 0;
142 for (
i = 0;
i <
len;
i++) {
147 MAC64(sum[0], lt, lt);
148 MAC64(sum[1], rt, rt);
150 MAC64(sum[3], sd, sd);
161 sum[0] = sum[1] = sum[2] = sum[3] = 0;
163 for (
i = 0;
i <
len;
i++) {
180 float front_mix = matrix[0][0];
181 float center_mix = matrix[0][1];
182 float surround_mix = matrix[0][3];
184 for (
i = 0;
i <
len;
i++) {
202 float front_mix = matrix[0][0];
203 float center_mix = matrix[0][1];
204 float surround_mix = matrix[0][3];
206 for (
i = 0;
i <
len;
i++) {
216 int out_ch,
int in_ch,
int len)
222 for (
i = 0;
i <
len;
i++) {
224 for (j = 0; j < in_ch; j++) {
231 }
else if (out_ch == 1) {
232 for (
i = 0;
i <
len;
i++) {
234 for (j = 0; j < in_ch; j++)
246 int16_t front_mix = matrix[0][0];
247 int16_t center_mix = matrix[0][1];
248 int16_t surround_mix = matrix[0][3];
250 for (
i = 0;
i <
len;
i++) {
252 (int64_t)
samples[1][
i] * center_mix +
253 (int64_t)
samples[3][
i] * surround_mix;
255 v1 = (int64_t)
samples[1][
i] * center_mix +
256 (int64_t)
samples[2][
i] * front_mix +
257 (int64_t)
samples[4][
i] * surround_mix;
269 int16_t front_mix = matrix[0][0];
270 int16_t center_mix = matrix[0][1];
271 int16_t surround_mix = matrix[0][3];
273 for (
i = 0;
i <
len;
i++) {
275 (int64_t)
samples[1][
i] * center_mix +
276 (int64_t)
samples[2][
i] * front_mix +
277 (int64_t)
samples[3][
i] * surround_mix +
278 (int64_t)
samples[4][
i] * surround_mix;
285 int out_ch,
int in_ch,
int len)
290 for (
i = 0;
i <
len;
i++) {
292 for (j = 0; j < in_ch; j++) {
294 v1 += (int64_t)
samples[j][
i] * matrix[1][j];
299 }
else if (out_ch == 1) {
300 for (
i = 0;
i <
len;
i++) {
302 for (j = 0; j < in_ch; j++)
310 int out_ch,
int in_ch,
int len)
312 if (
c->in_channels != in_ch ||
c->out_channels != out_ch) {
313 c->in_channels = in_ch;
314 c->out_channels = out_ch;
315 c->downmix_fixed =
NULL;
317 if (in_ch == 5 && out_ch == 2 &&
318 !(matrix[1][0] | matrix[0][2] |
319 matrix[1][3] | matrix[0][4] |
320 (matrix[0][1] ^ matrix[1][1]) |
321 (matrix[0][0] ^ matrix[1][2]))) {
323 }
else if (in_ch == 5 && out_ch == 1 &&
324 matrix[0][0] == matrix[0][2] &&
325 matrix[0][3] == matrix[0][4]) {
330 if (
c->downmix_fixed)
337 int out_ch,
int in_ch,
int len)
339 if (
c->in_channels != in_ch ||
c->out_channels != out_ch) {
340 int **matrix_cmp = (
int **)matrix;
342 c->in_channels = in_ch;
343 c->out_channels = out_ch;
346 if (in_ch == 5 && out_ch == 2 &&
347 !(matrix_cmp[1][0] | matrix_cmp[0][2] |
348 matrix_cmp[1][3] | matrix_cmp[0][4] |
349 (matrix_cmp[0][1] ^ matrix_cmp[1][1]) |
350 (matrix_cmp[0][0] ^ matrix_cmp[1][2]))) {
352 }
else if (in_ch == 5 && out_ch == 1 &&
353 matrix_cmp[0][0] == matrix_cmp[0][2] &&
354 matrix_cmp[0][3] == matrix_cmp[0][4]) {
381 c->downmix_fixed =
NULL;
static int ac3_compute_mantissa_size_c(uint16_t mant_cnt[6][16])
const uint8_t ff_ac3_bin_to_band_tab[253]
Map each frequency coefficient bin to the critical band that contains it.
void ff_ac3dsp_init_arm(AC3DSPContext *c, int bit_exact)
static void ac3_sum_square_butterfly_float_c(float sum[4], const float *coef0, const float *coef1, int len)
static void ac3_downmix_c(float **samples, float **matrix, int out_ch, int in_ch, int len)
static void ac3_update_bap_counts_c(uint16_t mant_cnt[16], uint8_t *bap, int len)
void ff_ac3dsp_set_downmix_x86(AC3DSPContext *c)
static const uint16_t mask[17]
static __device__ float floor(float a)
const uint8_t ff_ac3_band_start_tab[AC3_CRITICAL_BANDS+1]
Starting frequency coefficient bin for each critical band.
static const uint8_t bap_tab[64]
void ff_ac3dsp_init_mips(AC3DSPContext *c, int bit_exact)
const uint16_t ff_ac3_bap_bits[16]
Number of mantissa bits written for each bap value.
static void ac3_extract_exponents_c(uint8_t *exp, int32_t *coef, int nb_coefs)
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
static void ac3_downmix_5_to_1_symmetric_c_fixed(int32_t **samples, int16_t **matrix, int len)
static void float_to_fixed24_c(int32_t *dst, const float *src, unsigned int len)
static void ac3_downmix_5_to_2_symmetric_c(float **samples, float **matrix, int len)
static void ac3_sum_square_butterfly_int32_c(int64_t sum[4], const int32_t *coef0, const int32_t *coef1, int len)
static void ac3_bit_alloc_calc_bap_c(int16_t *mask, int16_t *psd, int start, int end, int snr_offset, int floor, const uint8_t *bap_tab, uint8_t *bap)
#define DECLARE_ALIGNED(n, t, v)
static void ac3_downmix_5_to_2_symmetric_c_fixed(int32_t **samples, int16_t **matrix, int len)
void ff_ac3dsp_init_x86(AC3DSPContext *c, int bit_exact)
void ff_ac3dsp_downmix(AC3DSPContext *c, float **samples, float **matrix, int out_ch, int in_ch, int len)
void ff_ac3dsp_downmix_fixed(AC3DSPContext *c, int32_t **samples, int16_t **matrix, int out_ch, int in_ch, int len)
Filter the word “frame” indicates either a video frame or a group of audio samples
av_cold void ff_ac3dsp_init(AC3DSPContext *c, int bit_exact)
static void ac3_downmix_5_to_1_symmetric_c(float **samples, float **matrix, int len)
static void ac3_exponent_min_c(uint8_t *exp, int num_reuse_blocks, int nb_coefs)
static void ac3_downmix_c_fixed(int32_t **samples, int16_t **matrix, int out_ch, int in_ch, int len)