43 #define numQMFSlots 32 //numTimeSlots * RATE
51 10, 20, 34, 10, 20, 34,
80 #define READ_PAR_DATA(PAR, OFFSET, MASK, ERR_CONDITION) \
93 static int read_ ## PAR ## _data(AVCodecContext *avctx, GetBitContext *gb, PSContext *ps, \
94 int8_t (*PAR)[PS_MAX_NR_IIDICC], int table_idx, int e, int dt) \
96 int b, num = ps->nr_ ## PAR ## _par; \
97 VLC_TYPE (*vlc_table)[2] = vlc_ps[table_idx].table; \
99 int e_prev = e ? e - 1 : ps->num_env_old - 1; \
100 e_prev = FFMAX(e_prev, 0); \
101 for (b = 0; b < num; b++) { \
102 int val = PAR[e_prev][b] + get_vlc2(gb, vlc_table, 9, 3) - OFFSET; \
103 if (MASK) val &= MASK; \
110 for (b = 0; b < num; b++) { \
111 val += get_vlc2(gb, vlc_table, 9, 3) - OFFSET; \
112 if (MASK) val &= MASK; \
120 av_log(avctx, AV_LOG_ERROR, "illegal "#PAR"\n"); \
137 if (ps->enable_ipdopd) {
138 for (e = 0; e < ps->num_env; e++) {
169 if (ps->enable_iid) {
177 ps->iid_quant = iid_mode > 2;
181 if (ps->enable_icc) {
183 if (ps->icc_mode > 5) {
194 ps->num_env_old = ps->num_env;
197 ps->border_position[0] = -1;
198 if (ps->frame_class) {
199 for (e = 1; e <= ps->num_env; e++)
200 ps->border_position[e] =
get_bits(gb, 5);
202 for (e = 1; e <= ps->num_env; e++)
205 if (ps->enable_iid) {
206 for (e = 0; e < ps->num_env; e++) {
212 memset(ps->iid_par, 0,
sizeof(ps->iid_par));
215 for (e = 0; e < ps->num_env; e++) {
221 memset(ps->icc_par, 0,
sizeof(ps->icc_par));
223 if (ps->enable_ext) {
230 int ps_extension_id =
get_bits(gb, 2);
243 if (!ps->num_env || ps->border_position[ps->num_env] <
numQMFSlots - 1) {
245 int source = ps->num_env ? ps->num_env - 1 : ps->num_env_old - 1;
247 if (source >= 0 && source != ps->num_env) {
248 if (ps->enable_iid) {
249 memcpy(ps->iid_par+ps->num_env, ps->iid_par+source,
sizeof(ps->iid_par[0]));
251 if (ps->enable_icc) {
252 memcpy(ps->icc_par+ps->num_env, ps->icc_par+source,
sizeof(ps->icc_par[0]));
254 if (ps->enable_ipdopd) {
255 memcpy(ps->ipd_par+ps->num_env, ps->ipd_par+source,
sizeof(ps->ipd_par[0]));
256 memcpy(ps->opd_par+ps->num_env, ps->opd_par+source,
sizeof(ps->opd_par[0]));
260 for (b = 0; b < ps->nr_iid_par; b++) {
261 if (
FFABS(ps->iid_par[ps->num_env][b]) > 7 + 8 * ps->iid_quant) {
268 for (b = 0; b < ps->nr_iid_par; b++) {
269 if (ps->icc_par[ps->num_env][b] > 7
U) {
276 ps->border_position[ps->num_env] =
numQMFSlots - 1;
280 ps->is34bands_old = ps->is34bands;
281 if (!
PS_BASELINE && (ps->enable_iid || ps->enable_icc))
282 ps->is34bands = (ps->enable_iid && ps->nr_iid_par == 34) ||
283 (ps->enable_icc && ps->nr_icc_par == 34);
286 if (!ps->enable_ipdopd) {
287 memset(ps->ipd_par, 0,
sizeof(ps->ipd_par));
288 memset(ps->opd_par, 0,
sizeof(ps->opd_par));
295 if (bits_consumed <= bits_left) {
297 return bits_consumed;
299 av_log(avctx,
AV_LOG_ERROR,
"Expected to read %d PS bits actually read %d.\n", bits_left, bits_consumed);
303 memset(ps->iid_par, 0,
sizeof(ps->iid_par));
304 memset(ps->icc_par, 0,
sizeof(ps->icc_par));
305 memset(ps->ipd_par, 0,
sizeof(ps->ipd_par));
306 memset(ps->opd_par, 0,
sizeof(ps->opd_par));
315 for (i = 0; i <
len; i++,
in++) {
320 for (j = 0; j < 6; j += 2) {
326 re_op = (re_op + 0x40000000) >> 31;
327 im_op = (im_op + 0x40000000) >> 31;
345 for (i = 0; i <
len; i++,
in++) {
356 out[4][i][1] = temp[2][1] + temp[5][1];
357 out[5][i][0] = temp[3][0] + temp[4][0];
358 out[5][i][1] = temp[3][1] + temp[4][1];
368 for (i = 0; i <
len; i++,
in++) {
378 for (i = 0; i < 5; i++) {
379 for (j = 0; j < 38; j++) {
380 in[i][j+6][0] = L[0][j][i];
381 in[i][j+6][1] = L[1][j][i];
398 for (i = 0; i < 5; i++) {
399 memcpy(in[i], in[i]+32, 6 *
sizeof(in[i][0]));
408 for (n = 0; n <
len; n++) {
409 memset(out[0][n], 0, 5*
sizeof(out[0][n][0]));
410 memset(out[1][n], 0, 5*
sizeof(out[1][n][0]));
411 for (i = 0; i < 12; i++) {
412 out[0][
n][0] += in[ i][
n][0];
413 out[1][
n][0] += in[ i][
n][1];
415 for (i = 0; i < 8; i++) {
416 out[0][
n][1] += in[12+i][
n][0];
417 out[1][
n][1] += in[12+i][
n][1];
419 for (i = 0; i < 4; i++) {
420 out[0][
n][2] += in[20+i][
n][0];
421 out[1][
n][2] += in[20+i][
n][1];
422 out[0][
n][3] += in[24+i][
n][0];
423 out[1][
n][3] += in[24+i][
n][1];
424 out[0][
n][4] += in[28+i][
n][0];
425 out[1][
n][4] += in[28+i][
n][1];
430 for (n = 0; n <
len; n++) {
431 out[0][
n][0] = in[0][
n][0] + in[1][
n][0] + in[2][
n][0] +
432 in[3][
n][0] + in[4][
n][0] + in[5][
n][0];
433 out[1][
n][0] = in[0][
n][1] + in[1][
n][1] + in[2][
n][1] +
434 in[3][
n][1] + in[4][
n][1] + in[5][
n][1];
435 out[0][
n][1] = in[6][
n][0] + in[7][
n][0];
436 out[1][
n][1] = in[6][
n][1] + in[7][
n][1];
437 out[0][
n][2] = in[8][
n][0] + in[9][
n][0];
438 out[1][
n][2] = in[8][
n][1] + in[9][
n][1];
445 #define DECAY_SLOPE Q30(0.05f)
468 for (; b >= 0; b--) {
469 par_mapped[2*b+1] = par_mapped[2*
b] = par[
b];
475 par_mapped[ 0] = (2*par[ 0] + par[ 1]) / 3;
476 par_mapped[ 1] = ( par[ 1] + 2*par[ 2]) / 3;
477 par_mapped[ 2] = (2*par[ 3] + par[ 4]) / 3;
478 par_mapped[ 3] = ( par[ 4] + 2*par[ 5]) / 3;
479 par_mapped[ 4] = ( par[ 6] + par[ 7]) / 2;
480 par_mapped[ 5] = ( par[ 8] + par[ 9]) / 2;
481 par_mapped[ 6] = par[10];
482 par_mapped[ 7] = par[11];
483 par_mapped[ 8] = ( par[12] + par[13]) / 2;
484 par_mapped[ 9] = ( par[14] + par[15]) / 2;
485 par_mapped[10] = par[16];
487 par_mapped[11] = par[17];
488 par_mapped[12] = par[18];
489 par_mapped[13] = par[19];
490 par_mapped[14] = ( par[20] + par[21]) / 2;
491 par_mapped[15] = ( par[22] + par[23]) / 2;
492 par_mapped[16] = ( par[24] + par[25]) / 2;
493 par_mapped[17] = ( par[26] + par[27]) / 2;
494 par_mapped[18] = ( par[28] + par[29] + par[30] + par[31]) / 4;
495 par_mapped[19] = ( par[32] + par[33]) / 2;
502 par[ 0] = (
int)(((int64_t)(par[ 0] + (
unsigned)(par[ 1]>>1)) * 1431655765 + \
504 par[ 1] = (
int)(((int64_t)((par[ 1]>>1) + (
unsigned)par[ 2]) * 1431655765 + \
506 par[ 2] = (
int)(((int64_t)(par[ 3] + (unsigned)(par[ 4]>>1)) * 1431655765 + \
508 par[ 3] = (
int)(((int64_t)((par[ 4]>>1) + (
unsigned)par[ 5]) * 1431655765 + \
511 par[ 0] = (2*par[ 0] + par[ 1]) * 0.33333333f;
512 par[ 1] = ( par[ 1] + 2*par[ 2]) * 0.33333333f;
513 par[ 2] = (2*par[ 3] + par[ 4]) * 0.33333333f;
514 par[ 3] = ( par[ 4] + 2*par[ 5]) * 0.33333333f;
531 par[18] = (((par[28]+2)>>2) + ((par[29]+2)>>2) + ((par[30]+2)>>2) + ((par[31]+2)>>2));
533 par[18] = ( par[28] + par[29] + par[30] + par[31]) * 0.25f;
541 par_mapped[33] = par[9];
542 par_mapped[32] = par[9];
543 par_mapped[31] = par[9];
544 par_mapped[30] = par[9];
545 par_mapped[29] = par[9];
546 par_mapped[28] = par[9];
547 par_mapped[27] = par[8];
548 par_mapped[26] = par[8];
549 par_mapped[25] = par[8];
550 par_mapped[24] = par[8];
551 par_mapped[23] = par[7];
552 par_mapped[22] = par[7];
553 par_mapped[21] = par[7];
554 par_mapped[20] = par[7];
555 par_mapped[19] = par[6];
556 par_mapped[18] = par[6];
557 par_mapped[17] = par[5];
558 par_mapped[16] = par[5];
562 par_mapped[15] = par[4];
563 par_mapped[14] = par[4];
564 par_mapped[13] = par[4];
565 par_mapped[12] = par[4];
566 par_mapped[11] = par[3];
567 par_mapped[10] = par[3];
568 par_mapped[ 9] = par[2];
569 par_mapped[ 8] = par[2];
570 par_mapped[ 7] = par[2];
571 par_mapped[ 6] = par[2];
572 par_mapped[ 5] = par[1];
573 par_mapped[ 4] = par[1];
574 par_mapped[ 3] = par[1];
575 par_mapped[ 2] = par[0];
576 par_mapped[ 1] = par[0];
577 par_mapped[ 0] = par[0];
583 par_mapped[33] = par[19];
584 par_mapped[32] = par[19];
585 par_mapped[31] = par[18];
586 par_mapped[30] = par[18];
587 par_mapped[29] = par[18];
588 par_mapped[28] = par[18];
589 par_mapped[27] = par[17];
590 par_mapped[26] = par[17];
591 par_mapped[25] = par[16];
592 par_mapped[24] = par[16];
593 par_mapped[23] = par[15];
594 par_mapped[22] = par[15];
595 par_mapped[21] = par[14];
596 par_mapped[20] = par[14];
597 par_mapped[19] = par[13];
598 par_mapped[18] = par[12];
599 par_mapped[17] = par[11];
601 par_mapped[16] = par[10];
602 par_mapped[15] = par[ 9];
603 par_mapped[14] = par[ 9];
604 par_mapped[13] = par[ 8];
605 par_mapped[12] = par[ 8];
606 par_mapped[11] = par[ 7];
607 par_mapped[10] = par[ 6];
608 par_mapped[ 9] = par[ 5];
609 par_mapped[ 8] = par[ 5];
610 par_mapped[ 7] = par[ 4];
611 par_mapped[ 6] = par[ 4];
612 par_mapped[ 5] = par[ 3];
613 par_mapped[ 4] = (par[ 2] + par[ 3]) / 2;
614 par_mapped[ 3] = par[ 2];
615 par_mapped[ 2] = par[ 1];
616 par_mapped[ 1] = (par[ 0] + par[ 1]) / 2;
617 par_mapped[ 0] = par[ 0];
667 const float transient_impact = 1.5f;
668 const float a_smooth = 0.25f;
673 const INTFLOAT peak_decay_factor =
Q31(0.76592833836465f);
675 memset(power, 0, 34 *
sizeof(*power));
685 for (k = 0; k < NR_BANDS[is34]; k++) {
692 for (i = 0; i < NR_PAR_BANDS[is34]; i++) {
693 for (n = n0; n < nL; n++) {
695 decayed_peak = (
int)(((int64_t)peak_decay_factor * \
696 peak_decay_nrg[i] + 0x40000000) >> 31);
697 peak_decay_nrg[i] =
FFMAX(decayed_peak, power[i][n]);
698 power_smooth[i] += (power[i][
n] + 2LL - power_smooth[i]) >> 2;
699 peak_decay_diff_smooth[i] += (peak_decay_nrg[i] + 2LL - power[i][
n] - \
700 peak_decay_diff_smooth[i]) >> 2;
702 if (peak_decay_diff_smooth[i]) {
703 transient_gain[i][
n] =
FFMIN(power_smooth[i]*43691LL / peak_decay_diff_smooth[i], 1<<16);
705 transient_gain[i][
n] = 1 << 16;
709 for (i = 0; i < NR_PAR_BANDS[is34]; i++) {
710 for (n = n0; n < nL; n++) {
711 float decayed_peak = peak_decay_factor * peak_decay_nrg[i];
713 peak_decay_nrg[i] =
FFMAX(decayed_peak, power[i][n]);
714 power_smooth[i] += a_smooth * (power[i][
n] - power_smooth[i]);
715 peak_decay_diff_smooth[i] += a_smooth * (peak_decay_nrg[i] - power[i][
n] - peak_decay_diff_smooth[i]);
716 denom = transient_impact * peak_decay_diff_smooth[i];
717 transient_gain[i][
n] = (denom > power_smooth[i]) ?
718 power_smooth[i] / denom : 1.0f;
731 for (k = 0; k < NR_ALLPASS_BANDS[is34]; k++) {
736 if (k - DECAY_CUTOFF[is34] <= 0) {
737 g_decay_slope = 1 << 30;
739 else if (k - DECAY_CUTOFF[is34] >= 20) {
743 g_decay_slope = (1 << 30) -
DECAY_SLOPE * (k - DECAY_CUTOFF[is34]);
746 float g_decay_slope = 1.f -
DECAY_SLOPE * (k - DECAY_CUTOFF[is34]);
747 g_decay_slope = av_clipf(g_decay_slope, 0.f, 1.f);
749 memcpy(delay[k], delay[k]+nL,
PS_MAX_DELAY*
sizeof(delay[k][0]));
752 memcpy(ap_delay[k][m], ap_delay[k][m]+
numQMFSlots, 5*
sizeof(ap_delay[k][m][0]));
757 transient_gain[b], g_decay_slope, nL - n0);
759 for (; k < SHORT_DELAY_BAND[is34]; k++) {
761 memcpy(delay[k], delay[k]+nL,
PS_MAX_DELAY*
sizeof(delay[k][0]));
765 transient_gain[i], nL - n0);
767 for (; k < NR_BANDS[is34]; k++) {
769 memcpy(delay[k], delay[k]+nL,
PS_MAX_DELAY*
sizeof(delay[k][0]));
773 transient_gain[i], nL - n0);
778 int8_t (*par)[PS_MAX_NR_IIDICC],
779 int num_par,
int num_env,
int full)
783 if (num_par == 20 || num_par == 11) {
784 for (e = 0; e < num_env; e++) {
787 }
else if (num_par == 10 || num_par == 5) {
788 for (e = 0; e < num_env; e++) {
796 static void remap20(int8_t (**p_par_mapped)[PS_MAX_NR_IIDICC],
797 int8_t (*par)[PS_MAX_NR_IIDICC],
798 int num_par,
int num_env,
int full)
802 if (num_par == 34 || num_par == 17) {
803 for (e = 0; e < num_env; e++) {
806 }
else if (num_par == 10 || num_par == 5) {
807 for (e = 0; e < num_env; e++) {
838 memcpy(H11[0][0], H11[0][ps->
num_env_old], PS_MAX_NR_IIDICC*
sizeof(H11[0][0][0]));
839 memcpy(H11[1][0], H11[1][ps->
num_env_old], PS_MAX_NR_IIDICC*
sizeof(H11[1][0][0]));
840 memcpy(H12[0][0], H12[0][ps->
num_env_old], PS_MAX_NR_IIDICC*
sizeof(H12[0][0][0]));
841 memcpy(H12[1][0], H12[1][ps->
num_env_old], PS_MAX_NR_IIDICC*
sizeof(H12[1][0][0]));
842 memcpy(H21[0][0], H21[0][ps->
num_env_old], PS_MAX_NR_IIDICC*
sizeof(H21[0][0][0]));
843 memcpy(H21[1][0], H21[1][ps->
num_env_old], PS_MAX_NR_IIDICC*
sizeof(H21[1][0][0]));
844 memcpy(H22[0][0], H22[0][ps->
num_env_old], PS_MAX_NR_IIDICC*
sizeof(H22[0][0][0]));
845 memcpy(H22[1][0], H22[1][ps->
num_env_old], PS_MAX_NR_IIDICC*
sizeof(H22[1][0][0]));
887 for (e = 0; e < ps->
num_env; e++) {
888 for (b = 0; b < NR_PAR_BANDS[is34]; b++) {
890 h11 = H_LUT[iid_mapped[e][
b] + 7 + 23 * ps->
iid_quant][icc_mapped[e][
b]][0];
891 h12 = H_LUT[iid_mapped[e][
b] + 7 + 23 * ps->
iid_quant][icc_mapped[e][
b]][1];
892 h21 = H_LUT[iid_mapped[e][
b] + 7 + 23 * ps->
iid_quant][icc_mapped[e][
b]][2];
893 h22 = H_LUT[iid_mapped[e][
b] + 7 + 23 * ps->
iid_quant][icc_mapped[e][
b]][3];
900 int opd_idx = opd_hist[
b] * 8 + opd_mapped[e][
b];
901 int ipd_idx = ipd_hist[
b] * 8 + ipd_mapped[e][
b];
906 opd_hist[
b] = opd_idx & 0x3F;
907 ipd_hist[
b] = ipd_idx & 0x3F;
909 ipd_adj_re =
AAC_MADD30(opd_re, ipd_re, opd_im, ipd_im);
910 ipd_adj_im =
AAC_MSUB30(opd_im, ipd_re, opd_re, ipd_im);
919 H11[1][e+1][
b] = h11i;
920 H12[1][e+1][
b] = h12i;
921 H21[1][e+1][
b] = h21i;
922 H22[1][e+1][
b] = h22i;
924 H11[0][e+1][
b] = h11;
925 H12[0][e+1][
b] = h12;
926 H21[0][e+1][
b] = h21;
927 H22[0][e+1][
b] = h22;
929 for (k = 0; k < NR_BANDS[is34]; k++) {
936 width =
FFMIN(2
U*width, INT_MAX);
939 h[0][0] = H11[0][e][
b];
940 h[0][1] = H12[0][e][
b];
941 h[0][2] = H21[0][e][
b];
942 h[0][3] = H22[0][e][
b];
945 if ((is34 && k <= 13 && k >= 9) || (!is34 && k <= 1)) {
946 h[1][0] = -H11[1][e][
b];
947 h[1][1] = -H12[1][e][
b];
948 h[1][2] = -H21[1][e][
b];
949 h[1][3] = -H22[1][e][
b];
951 h[1][0] = H11[1][e][
b];
952 h[1][1] = H12[1][e][
b];
953 h[1][2] = H21[1][e][
b];
954 h[1][3] = H22[1][e][
b];
980 int is34 = ps->is34bands;
982 top += NR_BANDS[is34] - 64;
983 memset(ps->delay+top, 0, (NR_BANDS[is34] - top)*
sizeof(ps->delay[0]));
984 if (top < NR_ALLPASS_BANDS[is34])
985 memset(ps->ap_delay + top, 0, (NR_ALLPASS_BANDS[is34] - top)*
sizeof(ps->ap_delay[0]));
996 #define PS_INIT_VLC_STATIC(num, size) \
997 INIT_VLC_STATIC(&vlc_ps[num], 9, ps_tmp[num].table_size / ps_tmp[num].elem_size, \
998 ps_tmp[num].ps_bits, 1, 1, \
999 ps_tmp[num].ps_codes, ps_tmp[num].elem_size, ps_tmp[num].elem_size, \
1002 #define PS_VLC_ROW(name) \
1003 { name ## _codes, name ## _bits, sizeof(name ## _codes), sizeof(name ## _codes[0]) }
1007 static const struct {
1008 const void *ps_codes, *ps_bits;
1009 const unsigned int table_size, elem_size;
void(* mul_pair_single)(INTFLOAT(*dst)[2], INTFLOAT(*src0)[2], INTFLOAT *src1, int n)
void AAC_RENAME() ff_psdsp_init(PSDSPContext *s)
static const INTFLOAT g1_Q2[]
static void map_idx_20_to_34(int8_t *par_mapped, const int8_t *par, int full)
INTFLOAT peak_decay_diff_smooth[34]
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static TABLE_CONST int Q_fract_allpass[2][50][3][2]
static void skip_bits_long(GetBitContext *s, int n)
static void ipdopd_reset(int8_t *ipd_hist, int8_t *opd_hist)
INTFLOAT peak_decay_nrg[34]
static const int NR_BANDS[]
Number of frequency bands that can be addressed by the sub subband index, k.
int AAC_RENAME() ff_ps_read_data(AVCodecContext *avctx, GetBitContext *gb_host, PSContext *ps, int bits_left)
void(* decorrelate)(INTFLOAT(*out)[2], INTFLOAT(*delay)[2], INTFLOAT(*ap_delay)[PS_QMF_TIME_SLOTS+PS_MAX_AP_DELAY][2], const INTFLOAT phi_fract[2], const INTFLOAT(*Q_fract)[2], const INTFLOAT *transient_gain, INTFLOAT g_decay_slope, int len)
static const int8_t nr_iidopd_par_tab[]
static const int NR_IPDOPD_BANDS[]
static const int8_t huff_offset[]
void(* add_squares)(INTFLOAT *dst, const INTFLOAT(*src)[2], int n)
static void map_idx_10_to_20(int8_t *par_mapped, const int8_t *par, int full)
Table 8.46.
static void map_idx_34_to_20(int8_t *par_mapped, const int8_t *par, int full)
INTFLOAT ap_delay[PS_MAX_AP_BANDS][PS_AP_LINKS][PS_QMF_TIME_SLOTS+PS_MAX_AP_DELAY][2]
static const int8_t k_to_i_34[]
Table 8.49.
#define PS_INIT_VLC_STATIC(num, size)
int AAC_RENAME() ff_ps_apply(AVCodecContext *avctx, PSContext *ps, INTFLOAT L[2][38][64], INTFLOAT R[2][38][64], int top)
#define READ_PAR_DATA(PAR, OFFSET, MASK, ERR_CONDITION)
static int pd_im_smooth[8 *8 *8]
INTFLOAT H21[2][PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC]
INTFLOAT delay[PS_MAX_SSB][PS_QMF_TIME_SLOTS+PS_MAX_DELAY][2]
static uint32_t reverse(uint32_t num, int bits)
static void filter(int16_t *output, ptrdiff_t out_stride, int16_t *low, ptrdiff_t low_stride, int16_t *high, ptrdiff_t high_stride, int len, uint8_t clip)
static void hybrid_analysis(PSDSPContext *dsp, INTFLOAT out[91][32][2], INTFLOAT in[5][44][2], INTFLOAT L[2][38][64], int is34, int len)
static void remap34(int8_t(**p_par_mapped)[PS_MAX_NR_IIDICC], int8_t(*par)[PS_MAX_NR_IIDICC], int num_par, int num_env, int full)
static int get_bits_count(const GetBitContext *s)
bitstream reader API header.
static int f34_0_12[12][8][2]
static const uint8_t header[24]
static void map_idx_10_to_34(int8_t *par_mapped, const int8_t *par, int full)
#define DECAY_SLOPE
All-pass filter decay slope.
static void hybrid6_cx(PSDSPContext *dsp, INTFLOAT(*in)[2], INTFLOAT(*out)[32][2], TABLE_CONST INTFLOAT(*filter)[8][2], int len)
Split one subband into 6 subsubbands with a complex filter.
#define AAC_MSUB30(x, y, a, b)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static void hybrid2_re(INTFLOAT(*in)[2], INTFLOAT(*out)[32][2], const INTFLOAT filter[8], int len, int reverse)
Split one subband into 2 subsubbands with a symmetric real filter.
int8_t icc_par[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC]
Inter-Channel Coherence Parameters.
#define AAC_HALF_SUM(x, y)
static int read_iid_data(AVCodecContext *avctx, GetBitContext *gb, PSContext *ps, int8_t(*iid)[34], int table_idx, int e, int dt)
\ * Read Inter-channel Intensity Difference/Inter-Channel Coherence/ \ * Inter-channel Phase Differen...
static const int SHORT_DELAY_BAND[]
First stereo band using the short one sample delay.
#define PS_BASELINE
Operate in Baseline PS mode.
INTFLOAT H22[2][PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC]
static int phi_fract[2][50][2]
static int read_icc_data(AVCodecContext *avctx, GetBitContext *gb, PSContext *ps, int8_t(*icc)[34], int table_idx, int e, int dt)
\ * Read Inter-channel Intensity Difference/Inter-Channel Coherence/ \ * Inter-channel Phase Differen...
common internal API header
static int f34_1_8[8][8][2]
void(* stereo_interpolate[2])(INTFLOAT(*l)[2], INTFLOAT(*r)[2], INTFLOAT h[2][4], INTFLOAT h_step[2][4], int len)
static void stereo_processing(PSContext *ps, INTFLOAT(*l)[32][2], INTFLOAT(*r)[32][2], int is34)
static void map_val_20_to_34(INTFLOAT par[PS_MAX_NR_IIDICC])
typedef void(APIENTRY *FF_PFNGLACTIVETEXTUREPROC)(GLenum texture)
static void hybrid_synthesis(PSDSPContext *dsp, INTFLOAT out[2][38][64], INTFLOAT in[91][32][2], int is34, int len)
static int read_ipdopd_data(AVCodecContext *avctx, GetBitContext *gb, PSContext *ps, int8_t(*ipdopd)[34], int table_idx, int e, int dt)
\ * Read Inter-channel Intensity Difference/Inter-Channel Coherence/ \ * Inter-channel Phase Differen...
int8_t ipd_hist[PS_MAX_NR_IIDICC]
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
static const int huff_iid[]
int8_t ipd_par[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC]
Inter-channel Phase Difference Parameters.
av_cold void AAC_RENAME() ff_ps_init(void)
static const int8_t nr_iidicc_par_tab[]
const uint8_t ff_log2_tab[256]
static const int NR_ALLPASS_BANDS[]
Number of all-pass filer bands.
Libavcodec external API header.
static const int8_t num_env_tab[2][4]
static void hybrid4_8_12_cx(PSDSPContext *dsp, INTFLOAT(*in)[2], INTFLOAT(*out)[32][2], TABLE_CONST INTFLOAT(*filter)[8][2], int N, int len)
main external API structure.
static void decorrelation(PSContext *ps, INTFLOAT(*out)[32][2], const INTFLOAT(*s)[32][2], int is34)
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31))))#defineSET_CONV_FUNC_GROUP(ofmt, ifmt) staticvoidset_generic_function(AudioConvert *ac){}voidff_audio_convert_free(AudioConvert **ac){if(!*ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, intsample_rate, intapply_map){AudioConvert *ac;intin_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) returnNULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method!=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt)>2){ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc){av_free(ac);returnNULL;}returnac;}in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar){ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar?ac->channels:1;}elseif(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;elseac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);returnac;}intff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){intuse_generic=1;intlen=in->nb_samples;intp;if(ac->dc){av_log(ac->avr, AV_LOG_TRACE,"%dsamples-audio_convert:%sto%s(dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));returnff_convert_dither(ac-> in
static void ps_tableinit(void)
static unsigned int get_bits1(GetBitContext *s)
int8_t iid_par[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC]
Inter-channel Intensity Difference Parameters.
static void skip_bits1(GetBitContext *s)
static const int NR_PAR_BANDS[]
Number of frequency bands that can be addressed by the parameter index, b(k)
static void skip_bits(GetBitContext *s, int n)
void(* hybrid_analysis)(INTFLOAT(*out)[2], INTFLOAT(*in)[2], const INTFLOAT(*filter)[8][2], int stride, int n)
INTFLOAT power_smooth[34]
av_cold void AAC_RENAME() ff_ps_ctx_init(PSContext *ps)
int8_t opd_hist[PS_MAX_NR_IIDICC]
int border_position[PS_MAX_NUM_ENV+1]
#define AAC_MADD30(x, y, a, b)
#define AAC_MSUB31_V3(x, y, z)
void(* hybrid_synthesis_deint)(INTFLOAT out[2][38][64], INTFLOAT(*in)[32][2], int i, int len)
common internal and external API header
static const int8_t k_to_i_20[]
Table 8.48.
#define PS_QMF_TIME_SLOTS
static void remap20(int8_t(**p_par_mapped)[PS_MAX_NR_IIDICC], int8_t(*par)[PS_MAX_NR_IIDICC], int num_par, int num_env, int full)
static int pd_re_smooth[8 *8 *8]
INTFLOAT H12[2][PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC]
static int f34_2_4[4][8][2]
static void map_val_34_to_20(INTFLOAT par[PS_MAX_NR_IIDICC])
INTFLOAT H11[2][PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC]
static const int DECAY_CUTOFF[]
Start frequency band for the all-pass filter decay slope.
static int ps_read_extension_data(GetBitContext *gb, PSContext *ps, int ps_extension_id)
#define LOCAL_ALIGNED_16(t, v,...)
static int f20_0_8[8][8][2]
int8_t opd_par[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC]
Overall Phase Difference Parameters.
void(* hybrid_analysis_ileave)(INTFLOAT(*out)[32][2], INTFLOAT L[2][38][64], int i, int len)