36 #define numQMFSlots 32 //numTimeSlots * RATE 44 10, 20, 34, 10, 20, 34,
73 #define READ_PAR_DATA(PAR, OFFSET, MASK, ERR_CONDITION) \ 86 static int read_ ## PAR ## _data(AVCodecContext *avctx, GetBitContext *gb, PSContext *ps, \ 87 int8_t (*PAR)[PS_MAX_NR_IIDICC], int table_idx, int e, int dt) \ 89 int b, num = ps->nr_ ## PAR ## _par; \ 90 VLC_TYPE (*vlc_table)[2] = vlc_ps[table_idx].table; \ 92 int e_prev = e ? e - 1 : ps->num_env_old - 1; \ 93 e_prev = FFMAX(e_prev, 0); \ 94 for (b = 0; b < num; b++) { \ 95 int val = PAR[e_prev][b] + get_vlc2(gb, vlc_table, 9, 3) - OFFSET; \ 96 if (MASK) val &= MASK; \ 103 for (b = 0; b < num; b++) { \ 104 val += get_vlc2(gb, vlc_table, 9, 3) - OFFSET; \ 105 if (MASK) val &= MASK; \ 113 av_log(avctx, AV_LOG_ERROR, "illegal "#PAR"\n"); \ 130 if (ps->enable_ipdopd) {
131 for (e = 0; e < ps->num_env; e++) {
192 for (e = 1; e <= ps->
num_env; e++)
195 for (e = 1; e <= ps->
num_env; e++)
199 for (e = 0; e < ps->
num_env; e++) {
208 for (e = 0; e < ps->
num_env; e++) {
223 int ps_extension_id =
get_bits(gb, 2);
240 if (source >= 0 && source != ps->
num_env) {
288 if (bits_consumed <= bits_left) {
290 return bits_consumed;
292 av_log(avctx,
AV_LOG_ERROR,
"Expected to read %d PS bits actually read %d.\n", bits_left, bits_consumed);
308 for (i = 0; i <
len; i++,
in++) {
309 float re_in = filter[6] *
in[6][0];
311 float im_in = filter[6] * in[6][1];
313 for (j = 0; j < 6; j += 2) {
314 re_op += filter[j+1] * (in[j+1][0] + in[12-j-1][0]);
315 im_op += filter[j+1] * (in[j+1][1] + in[12-j-1][1]);
317 out[ reverse][
i][0] = re_in + re_op;
318 out[ reverse][
i][1] = im_in + im_op;
319 out[!reverse][
i][0] = re_in - re_op;
320 out[!reverse][
i][1] = im_in - im_op;
331 for (i = 0; i <
len; i++,
in++) {
342 out[4][
i][1] = temp[2][1] + temp[5][1];
343 out[5][
i][0] = temp[3][0] + temp[4][0];
344 out[5][
i][1] = temp[3][1] + temp[4][1];
352 for (i = 0; i <
len; i++,
in++) {
358 float in[5][44][2],
float L[2][38][64],
362 for (i = 0; i < 5; i++) {
363 for (j = 0; j < 38; j++) {
364 in[
i][j+6][0] = L[0][j][
i];
365 in[
i][j+6][1] = L[1][j][
i];
382 for (i = 0; i < 5; i++) {
383 memcpy(in[i], in[i]+32, 6 *
sizeof(in[i][0]));
388 float in[91][32][2],
int is34,
int len)
392 for (n = 0; n <
len; n++) {
393 memset(out[0][n], 0, 5*
sizeof(out[0][n][0]));
394 memset(out[1][n], 0, 5*
sizeof(out[1][n][0]));
395 for (i = 0; i < 12; i++) {
396 out[0][
n][0] += in[
i][
n][0];
397 out[1][
n][0] += in[
i][
n][1];
399 for (i = 0; i < 8; i++) {
400 out[0][
n][1] += in[12+
i][
n][0];
401 out[1][
n][1] += in[12+
i][
n][1];
403 for (i = 0; i < 4; i++) {
404 out[0][
n][2] += in[20+
i][
n][0];
405 out[1][
n][2] += in[20+
i][
n][1];
406 out[0][
n][3] += in[24+
i][
n][0];
407 out[1][
n][3] += in[24+
i][
n][1];
408 out[0][
n][4] += in[28+
i][
n][0];
409 out[1][
n][4] += in[28+
i][
n][1];
414 for (n = 0; n <
len; n++) {
415 out[0][
n][0] = in[0][
n][0] + in[1][
n][0] + in[2][
n][0] +
416 in[3][
n][0] + in[4][
n][0] + in[5][
n][0];
417 out[1][
n][0] = in[0][
n][1] + in[1][
n][1] + in[2][
n][1] +
418 in[3][
n][1] + in[4][
n][1] + in[5][
n][1];
419 out[0][
n][1] = in[6][
n][0] + in[7][
n][0];
420 out[1][
n][1] = in[6][
n][1] + in[7][
n][1];
421 out[0][
n][2] = in[8][
n][0] + in[9][
n][0];
422 out[1][
n][2] = in[8][
n][1] + in[9][
n][1];
429 #define DECAY_SLOPE 0.05f 451 for (; b >= 0; b--) {
452 par_mapped[2*b+1] = par_mapped[2*
b] = par[
b];
458 par_mapped[ 0] = (2*par[ 0] + par[ 1]) / 3;
459 par_mapped[ 1] = ( par[ 1] + 2*par[ 2]) / 3;
460 par_mapped[ 2] = (2*par[ 3] + par[ 4]) / 3;
461 par_mapped[ 3] = ( par[ 4] + 2*par[ 5]) / 3;
462 par_mapped[ 4] = ( par[ 6] + par[ 7]) / 2;
463 par_mapped[ 5] = ( par[ 8] + par[ 9]) / 2;
464 par_mapped[ 6] = par[10];
465 par_mapped[ 7] = par[11];
466 par_mapped[ 8] = ( par[12] + par[13]) / 2;
467 par_mapped[ 9] = ( par[14] + par[15]) / 2;
468 par_mapped[10] = par[16];
470 par_mapped[11] = par[17];
471 par_mapped[12] = par[18];
472 par_mapped[13] = par[19];
473 par_mapped[14] = ( par[20] + par[21]) / 2;
474 par_mapped[15] = ( par[22] + par[23]) / 2;
475 par_mapped[16] = ( par[24] + par[25]) / 2;
476 par_mapped[17] = ( par[26] + par[27]) / 2;
477 par_mapped[18] = ( par[28] + par[29] + par[30] + par[31]) / 4;
478 par_mapped[19] = ( par[32] + par[33]) / 2;
484 par[ 0] = (2*par[ 0] + par[ 1]) * 0.33333333
f;
485 par[ 1] = ( par[ 1] + 2*par[ 2]) * 0.33333333
f;
486 par[ 2] = (2*par[ 3] + par[ 4]) * 0.33333333
f;
487 par[ 3] = ( par[ 4] + 2*par[ 5]) * 0.33333333
f;
488 par[ 4] = ( par[ 6] + par[ 7]) * 0.5
f;
489 par[ 5] = ( par[ 8] + par[ 9]) * 0.5
f;
492 par[ 8] = ( par[12] + par[13]) * 0.5
f;
493 par[ 9] = ( par[14] + par[15]) * 0.5
f;
498 par[14] = ( par[20] + par[21]) * 0.5
f;
499 par[15] = ( par[22] + par[23]) * 0.5
f;
500 par[16] = ( par[24] + par[25]) * 0.5
f;
501 par[17] = ( par[26] + par[27]) * 0.5
f;
502 par[18] = ( par[28] + par[29] + par[30] + par[31]) * 0.25
f;
503 par[19] = ( par[32] + par[33]) * 0.5
f;
509 par_mapped[33] = par[9];
510 par_mapped[32] = par[9];
511 par_mapped[31] = par[9];
512 par_mapped[30] = par[9];
513 par_mapped[29] = par[9];
514 par_mapped[28] = par[9];
515 par_mapped[27] = par[8];
516 par_mapped[26] = par[8];
517 par_mapped[25] = par[8];
518 par_mapped[24] = par[8];
519 par_mapped[23] = par[7];
520 par_mapped[22] = par[7];
521 par_mapped[21] = par[7];
522 par_mapped[20] = par[7];
523 par_mapped[19] = par[6];
524 par_mapped[18] = par[6];
525 par_mapped[17] = par[5];
526 par_mapped[16] = par[5];
530 par_mapped[15] = par[4];
531 par_mapped[14] = par[4];
532 par_mapped[13] = par[4];
533 par_mapped[12] = par[4];
534 par_mapped[11] = par[3];
535 par_mapped[10] = par[3];
536 par_mapped[ 9] = par[2];
537 par_mapped[ 8] = par[2];
538 par_mapped[ 7] = par[2];
539 par_mapped[ 6] = par[2];
540 par_mapped[ 5] = par[1];
541 par_mapped[ 4] = par[1];
542 par_mapped[ 3] = par[1];
543 par_mapped[ 2] = par[0];
544 par_mapped[ 1] = par[0];
545 par_mapped[ 0] = par[0];
551 par_mapped[33] = par[19];
552 par_mapped[32] = par[19];
553 par_mapped[31] = par[18];
554 par_mapped[30] = par[18];
555 par_mapped[29] = par[18];
556 par_mapped[28] = par[18];
557 par_mapped[27] = par[17];
558 par_mapped[26] = par[17];
559 par_mapped[25] = par[16];
560 par_mapped[24] = par[16];
561 par_mapped[23] = par[15];
562 par_mapped[22] = par[15];
563 par_mapped[21] = par[14];
564 par_mapped[20] = par[14];
565 par_mapped[19] = par[13];
566 par_mapped[18] = par[12];
567 par_mapped[17] = par[11];
569 par_mapped[16] = par[10];
570 par_mapped[15] = par[ 9];
571 par_mapped[14] = par[ 9];
572 par_mapped[13] = par[ 8];
573 par_mapped[12] = par[ 8];
574 par_mapped[11] = par[ 7];
575 par_mapped[10] = par[ 6];
576 par_mapped[ 9] = par[ 5];
577 par_mapped[ 8] = par[ 5];
578 par_mapped[ 7] = par[ 4];
579 par_mapped[ 6] = par[ 4];
580 par_mapped[ 5] = par[ 3];
581 par_mapped[ 4] = (par[ 2] + par[ 3]) / 2;
582 par_mapped[ 3] = par[ 2];
583 par_mapped[ 2] = par[ 1];
584 par_mapped[ 1] = (par[ 0] + par[ 1]) / 2;
585 par_mapped[ 0] = par[ 0];
619 par[ 4] = (par[ 2] + par[ 3]) * 0.5
f;
622 par[ 1] = (par[ 0] + par[ 1]) * 0.5
f;
629 float *peak_decay_nrg = ps->peak_decay_nrg;
630 float *power_smooth = ps->power_smooth;
631 float *peak_decay_diff_smooth = ps->peak_decay_diff_smooth;
635 const float peak_decay_factor = 0.76592833836465f;
636 const float transient_impact = 1.5f;
637 const float a_smooth = 0.25f;
641 memset(power, 0, 34 *
sizeof(*power));
644 memset(ps->peak_decay_nrg, 0,
sizeof(ps->peak_decay_nrg));
645 memset(ps->power_smooth, 0,
sizeof(ps->power_smooth));
646 memset(ps->peak_decay_diff_smooth, 0,
sizeof(ps->peak_decay_diff_smooth));
647 memset(ps->delay, 0,
sizeof(ps->delay));
648 memset(ps->ap_delay, 0,
sizeof(ps->ap_delay));
651 for (k = 0; k < NR_BANDS[is34]; k++) {
657 for (i = 0; i < NR_PAR_BANDS[is34]; i++) {
658 for (n = n0; n < nL; n++) {
659 float decayed_peak = peak_decay_factor * peak_decay_nrg[
i];
661 peak_decay_nrg[
i] =
FFMAX(decayed_peak, power[i][n]);
662 power_smooth[
i] += a_smooth * (power[
i][
n] - power_smooth[
i]);
663 peak_decay_diff_smooth[
i] += a_smooth * (peak_decay_nrg[
i] - power[
i][
n] - peak_decay_diff_smooth[
i]);
664 denom = transient_impact * peak_decay_diff_smooth[
i];
665 transient_gain[
i][
n] = (denom > power_smooth[
i]) ?
666 power_smooth[i] / denom : 1.0
f;
678 for (k = 0; k < NR_ALLPASS_BANDS[is34]; k++) {
680 float g_decay_slope = 1.f -
DECAY_SLOPE * (k - DECAY_CUTOFF[is34]);
681 g_decay_slope = av_clipf(g_decay_slope, 0.
f, 1.
f);
682 memcpy(delay[k], delay[k]+nL,
PS_MAX_DELAY*
sizeof(delay[k][0]));
685 memcpy(ap_delay[k][m], ap_delay[k][m]+
numQMFSlots, 5*
sizeof(ap_delay[k][m][0]));
688 phi_fract[is34][k], Q_fract_allpass[is34][k],
689 transient_gain[b], g_decay_slope, nL - n0);
691 for (; k < SHORT_DELAY_BAND[is34]; k++) {
693 memcpy(delay[k], delay[k]+nL,
PS_MAX_DELAY*
sizeof(delay[k][0]));
697 transient_gain[i], nL - n0);
699 for (; k < NR_BANDS[is34]; k++) {
701 memcpy(delay[k], delay[k]+nL,
PS_MAX_DELAY*
sizeof(delay[k][0]));
705 transient_gain[i], nL - n0);
710 int8_t (*par)[PS_MAX_NR_IIDICC],
711 int num_par,
int num_env,
int full)
715 if (num_par == 20 || num_par == 11) {
716 for (e = 0; e < num_env; e++) {
719 }
else if (num_par == 10 || num_par == 5) {
720 for (e = 0; e < num_env; e++) {
728 static void remap20(int8_t (**p_par_mapped)[PS_MAX_NR_IIDICC],
729 int8_t (*par)[PS_MAX_NR_IIDICC],
730 int num_par,
int num_env,
int full)
734 if (num_par == 34 || num_par == 17) {
735 for (e = 0; e < num_env; e++) {
738 }
else if (num_par == 10 || num_par == 5) {
739 for (e = 0; e < num_env; e++) {
770 memcpy(H11[0][0], H11[0][ps->
num_env_old], PS_MAX_NR_IIDICC*
sizeof(H11[0][0][0]));
771 memcpy(H11[1][0], H11[1][ps->
num_env_old], PS_MAX_NR_IIDICC*
sizeof(H11[1][0][0]));
772 memcpy(H12[0][0], H12[0][ps->
num_env_old], PS_MAX_NR_IIDICC*
sizeof(H12[0][0][0]));
773 memcpy(H12[1][0], H12[1][ps->
num_env_old], PS_MAX_NR_IIDICC*
sizeof(H12[1][0][0]));
774 memcpy(H21[0][0], H21[0][ps->
num_env_old], PS_MAX_NR_IIDICC*
sizeof(H21[0][0][0]));
775 memcpy(H21[1][0], H21[1][ps->
num_env_old], PS_MAX_NR_IIDICC*
sizeof(H21[1][0][0]));
776 memcpy(H22[0][0], H22[0][ps->
num_env_old], PS_MAX_NR_IIDICC*
sizeof(H22[0][0][0]));
777 memcpy(H22[1][0], H22[1][ps->
num_env_old], PS_MAX_NR_IIDICC*
sizeof(H22[1][0][0]));
819 for (e = 0; e < ps->
num_env; e++) {
820 for (b = 0; b < NR_PAR_BANDS[is34]; b++) {
821 float h11, h12, h21, h22;
822 h11 = H_LUT[iid_mapped[e][
b] + 7 + 23 * ps->
iid_quant][icc_mapped[e][
b]][0];
823 h12 = H_LUT[iid_mapped[e][
b] + 7 + 23 * ps->
iid_quant][icc_mapped[e][
b]][1];
824 h21 = H_LUT[iid_mapped[e][
b] + 7 + 23 * ps->
iid_quant][icc_mapped[e][
b]][2];
825 h22 = H_LUT[iid_mapped[e][
b] + 7 + 23 * ps->
iid_quant][icc_mapped[e][
b]][3];
830 float h11i, h12i, h21i, h22i;
831 float ipd_adj_re, ipd_adj_im;
832 int opd_idx = opd_hist[
b] * 8 + opd_mapped[e][
b];
833 int ipd_idx = ipd_hist[
b] * 8 + ipd_mapped[e][
b];
838 opd_hist[
b] = opd_idx & 0x3F;
839 ipd_hist[
b] = ipd_idx & 0x3F;
841 ipd_adj_re = opd_re*ipd_re + opd_im*ipd_im;
842 ipd_adj_im = opd_im*ipd_re - opd_re*ipd_im;
845 h12i = h12 * ipd_adj_im;
846 h12 = h12 * ipd_adj_re;
849 h22i = h22 * ipd_adj_im;
850 h22 = h22 * ipd_adj_re;
851 H11[1][e+1][
b] = h11i;
852 H12[1][e+1][
b] = h12i;
853 H21[1][e+1][
b] = h21i;
854 H22[1][e+1][
b] = h22i;
856 H11[0][e+1][
b] = h11;
857 H12[0][e+1][
b] = h12;
858 H21[0][e+1][
b] = h21;
859 H22[0][e+1][
b] = h22;
861 for (k = 0; k < NR_BANDS[is34]; k++) {
868 h[0][0] = H11[0][e][
b];
869 h[0][1] = H12[0][e][
b];
870 h[0][2] = H21[0][e][
b];
871 h[0][3] = H22[0][e][
b];
874 if ((is34 && k <= 13 && k >= 9) || (!is34 && k <= 1)) {
875 h[1][0] = -H11[1][e][
b];
876 h[1][1] = -H12[1][e][
b];
877 h[1][2] = -H21[1][e][
b];
878 h[1][3] = -H22[1][e][
b];
880 h[1][0] = H11[1][e][
b];
881 h[1][1] = H12[1][e][
b];
882 h[1][2] = H21[1][e][
b];
883 h[1][3] = H22[1][e][
b];
887 h_step[0][0] = (H11[0][e+1][
b] - h[0][0]) * width;
888 h_step[0][1] = (H12[0][e+1][
b] - h[0][1]) * width;
889 h_step[0][2] = (H21[0][e+1][
b] - h[0][2]) * width;
890 h_step[0][3] = (H22[0][e+1][
b] - h[0][3]) * width;
892 h_step[1][0] = (H11[1][e+1][
b] - h[1][0]) * width;
893 h_step[1][1] = (H12[1][e+1][
b] - h[1][1]) * width;
894 h_step[1][2] = (H21[1][e+1][
b] - h[1][2]) * width;
895 h_step[1][3] = (H22[1][e+1][
b] - h[1][3]) * width;
898 l[
k] + start + 1,
r[
k] + start + 1,
899 h, h_step, stop -
start);
911 top += NR_BANDS[is34] - 64;
912 memset(ps->delay+top, 0, (NR_BANDS[is34] - top)*
sizeof(ps->delay[0]));
913 if (top < NR_ALLPASS_BANDS[is34])
914 memset(ps->ap_delay + top, 0, (NR_ALLPASS_BANDS[is34] - top)*
sizeof(ps->ap_delay[0]));
925 #define PS_INIT_VLC_STATIC(num, size) \ 926 INIT_VLC_STATIC(&vlc_ps[num], 9, ps_tmp[num].table_size / ps_tmp[num].elem_size, \ 927 ps_tmp[num].ps_bits, 1, 1, \ 928 ps_tmp[num].ps_codes, ps_tmp[num].elem_size, ps_tmp[num].elem_size, \ 931 #define PS_VLC_ROW(name) \ 932 { name ## _codes, name ## _bits, sizeof(name ## _codes), sizeof(name ## _codes[0]) } 936 static const struct {
937 const void *ps_codes, *ps_bits;
938 const unsigned int table_size, elem_size;
static void map_idx_20_to_34(int8_t *par_mapped, const int8_t *par, int full)
int ff_ps_apply(AVCodecContext *avctx, PSContext *ps, float L[2][38][64], float R[2][38][64], int top)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
av_cold void ff_psdsp_init(PSDSPContext *s)
static void skip_bits_long(GetBitContext *s, int n)
static void ipdopd_reset(int8_t *ipd_hist, int8_t *opd_hist)
static void hybrid_analysis(PSDSPContext *dsp, float out[91][32][2], float in[5][44][2], float L[2][38][64], int is34, int len)
static const int NR_BANDS[]
Number of frequency bands that can be addressed by the sub subband index, k.
static const int8_t nr_iidopd_par_tab[]
About Git write you should know how to use GIT properly Luckily Git comes with excellent documentation git help man git shows you the available git< command > help man git< command > shows information about the subcommand< command > The most comprehensive manual is the website Git Reference visit they are quite exhaustive You do not need a special username or password All you need is to provide a ssh public key to the Git server admin What follows now is a basic introduction to Git and some FFmpeg specific guidelines Read it at least if you are granted commit privileges to the FFmpeg project you are expected to be familiar with these rules I if not You can get git from etc no matter how small Every one of them has been saved from looking like a fool by this many times It s very easy for stray debug output or cosmetic modifications to slip in
static const int8_t huff_offset[]
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)
static float pd_im_smooth[8 *8 *8]
static const int8_t k_to_i_34[]
Table 8.49.
#define PS_INIT_VLC_STATIC(num, size)
#define READ_PAR_DATA(PAR, OFFSET, MASK, ERR_CONDITION)
void(* stereo_interpolate[2])(float(*l)[2], float(*r)[2], float h[2][4], float h_step[2][4], int len)
void(* mul_pair_single)(float(*dst)[2], float(*src0)[2], float *src1, int n)
static void hybrid6_cx(PSDSPContext *dsp, float(*in)[2], float(*out)[32][2], const float(*filter)[8][2], int len)
Split one subband into 6 subsubbands with a complex filter.
static void decorrelation(PSContext *ps, float(*out)[32][2], const float(*s)[32][2], int is34)
the mask is usually to keep the same permissions Filters should remove permissions on reference they give to output whenever necessary It can be automatically done by setting the rej_perms field on the output pad Here are a few guidelines corresponding to common then the filter should push the output frames on the output link immediately As an exception to the previous rule if the input frame is enough to produce several output frames then the filter needs output only at least one per link The additional frames can be left buffered in the filter
static void hybrid4_8_12_cx(PSDSPContext *dsp, float(*in)[2], float(*out)[32][2], const float(*filter)[8][2], int N, 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)
void(* hybrid_synthesis_deint)(float out[2][38][64], float(*in)[32][2], int i, int len)
static int get_bits_count(const GetBitContext *s)
bitstream reader API header.
const uint8_t ff_log2_tab[256]
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.
int8_t icc_par[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC]
Inter-Channel Coherence Parameters.
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.
av_cold void ff_ps_ctx_init(PSContext *ps)
void av_log(void *avcl, int level, const char *fmt,...)
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 const float g1_Q2[]
static float HA[46][8][4]
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]
static float pd_re_smooth[8 *8 *8]
static const int huff_iid[]
int8_t ipd_par[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC]
Inter-channel Phase Difference Parameters.
static const int8_t nr_iidicc_par_tab[]
av_cold void ff_ps_init(void)
void(* hybrid_analysis)(float(*out)[2], float(*in)[2], const float(*filter)[8][2], int stride, int n)
void(* hybrid_analysis_ileave)(float(*out)[32][2], float L[2][38][64], int i, int len)
static const int NR_ALLPASS_BANDS[]
Number of all-pass filer bands.
static const int8_t num_env_tab[2][4]
main external API structure.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
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 map_val_34_to_20(float par[PS_MAX_NR_IIDICC])
static void skip_bits(GetBitContext *s, int n)
static void hybrid_synthesis(PSDSPContext *dsp, float out[2][38][64], float in[91][32][2], int is34, int len)
synthesis window for stochastic i
static void ps_tableinit(void)
static float HB[46][8][4]
int8_t opd_hist[PS_MAX_NR_IIDICC]
int border_position[PS_MAX_NUM_ENV+1]
static void hybrid2_re(float(*in)[2], float(*out)[32][2], const float filter[8], int len, int reverse)
Split one subband into 2 subsubbands with a symmetric real filter.
void(* decorrelate)(float(*out)[2], float(*delay)[2], float(*ap_delay)[PS_QMF_TIME_SLOTS+PS_MAX_AP_DELAY][2], const float phi_fract[2], float(*Q_fract)[2], const float *transient_gain, float g_decay_slope, int len)
common internal and external API header
static const int8_t k_to_i_20[]
Table 8.48.
void(* add_squares)(float *dst, const float(*src)[2], int n)
#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 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,...)
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(const int16_t *) pi >> 8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(const int32_t *) pi >> 24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31))))#define SET_CONV_FUNC_GROUP(ofmt, ifmt) static void set_generic_function(AudioConvert *ac){}void ff_audio_convert_free(AudioConvert **ac){if(!*ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, int sample_rate, int apply_map){AudioConvert *ac;int in_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) return NULL;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);return NULL;}return ac;}in_planar=av_sample_fmt_is_planar(in_fmt);out_planar=av_sample_fmt_is_planar(out_fmt);if(in_planar==out_planar){ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar?ac->channels:1;}else if(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;else ac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);return ac;}int ff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){int use_generic=1;int len=in->nb_samples;int p;if(ac->dc){av_dlog(ac->avr,"%d samples - audio_convert: %s to %s (dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));return ff_convert_dither(ac-> out
static void stereo_processing(PSContext *ps, float(*l)[32][2], float(*r)[32][2], int is34)
int ff_ps_read_data(AVCodecContext *avctx, GetBitContext *gb_host, PSContext *ps, int bits_left)
int8_t opd_par[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC]
Overall Phase Difference Parameters.
static void map_val_20_to_34(float par[PS_MAX_NR_IIDICC])