Lines Matching refs:chn
406 convert_partition2scalefac_s(lame_internal_flags * gfc, FLOAT const *eb, FLOAT const *thr, int chn,
415 psv->en[chn].s[sb][sblock] = enn[sb];
416 psv->thm[chn].s[sb][sblock] = thm[sb];
422 convert_partition2scalefac_l(lame_internal_flags * gfc, FLOAT const *eb, FLOAT const *thr, int chn)
426 FLOAT *enn = &psv->en[chn].l[0];
427 FLOAT *thm = &psv->thm[chn].l[0];
433 int chn)
445 psv->en[chn].s[sb][sblock] = tmp_enn;
446 psv->thm[chn].s[sb][sblock] = tmp_thm;
666 vbrpsy_compute_fft_l(lame_internal_flags * gfc, const sample_t * const buffer[2], int chn,
674 if (chn < 2) {
675 fft_long(gfc, *wsamp_l, chn, buffer);
677 else if (chn == 2) {
705 psv->tot_ener[chn] = totalenergy;
710 plt->energy[gr_out][chn][j] = plt->energy_save[chn][j];
711 plt->energy_save[chn][j] = fftenergy[j];
718 vbrpsy_compute_fft_s(lame_internal_flags const *gfc, const sample_t * const buffer[2], int chn,
723 if (sblock == 0 && chn < 2) {
724 fft_short(gfc, *wsamp_s, chn, buffer);
726 if (chn == 2) {
754 vbrpsy_compute_loudness_approximation_l(lame_internal_flags * gfc, int gr_out, int chn,
758 if (chn < 2) { /*no loudness for mid/side ch */
759 gfc->ov_psy.loudness_sq[gr_out][chn] = psv->loudness_sq_save[chn];
760 psv->loudness_sq_save[chn] = psycho_loudness_approx(fftenergy, gfc->ATH->eql_w);
780 /* chn=2 and 3 = Mid and Side channels */
782 int chn, i, j;
787 for (chn = 0; chn < n_chn_out; chn++) {
794 const sample_t *const firbuf = &buffer[chn][576 - 350 - NSFIRLEN + 192];
804 ns_hpfsmpl[chn][i] = sum1 + sum2;
806 masking_ratio[gr_out][chn].en = psv->en[chn];
807 masking_ratio[gr_out][chn].thm = psv->thm[chn];
810 /*percep_MS_entropy [chn-2] = gfc -> pe [chn]; */
811 masking_MS_ratio[gr_out][chn].en = psv->en[chn + 2];
812 masking_MS_ratio[gr_out][chn].thm = psv->thm[chn + 2];
815 for (chn = 0; chn < n_chn_psy; chn++) {
819 FLOAT const *pf = ns_hpfsmpl[chn & 1];
822 if (chn == 2) {
835 en_subshort[i] = psv->last_en_subshort[chn][i + 6];
836 assert(psv->last_en_subshort[chn][i + 4] > 0);
837 attack_intensity[i] = en_subshort[i] / psv->last_en_subshort[chn][i + 4];
847 psv->last_en_subshort[chn][i] = en_subshort[i + 3] = p;
874 sub_short_factor[chn][i] = factor;
884 plt->ers[gr_out][chn] = plt->ers_save[chn];
885 plt->ers_save[chn] = x;
890 FLOAT x = gfc->cd_psy->attack_threshold[chn];
892 if (ns_attacks[chn][i / 3] == 0) {
894 ns_attacks[chn][i / 3] = (i % 3) + 1;
909 if (i == 1 && ns_attacks[chn][0] <= ns_attacks[chn][i]) {
910 ns_attacks[chn][0] = 0;
912 ns_attacks[chn][i] = 0;
917 if (ns_attacks[chn][0] <= psv->last_attacks[chn]) {
918 ns_attacks[chn][0] = 0;
921 if (psv->last_attacks[chn] == 3 ||
922 ns_attacks[chn][0] + ns_attacks[chn][1] + ns_attacks[chn][2] + ns_attacks[chn][3]) {
925 if (ns_attacks[chn][1] && ns_attacks[chn][0]) {
926 ns_attacks[chn][1] = 0;
928 if (ns_attacks[chn][2] && ns_attacks[chn][1]) {
929 ns_attacks[chn][2] = 0;
931 if (ns_attacks[chn][3] && ns_attacks[chn][2]) {
932 ns_attacks[chn][3] = 0;
936 if (chn < 2) {
937 uselongblock[chn] = ns_uselongblock;
948 energy[chn] = psv->tot_ener[chn];
954 vbrpsy_skip_masking_s(lame_internal_flags * gfc, int chn, int sblock)
957 FLOAT *nbs2 = &gfc->sv_psy.nb_s2[chn][0];
958 FLOAT *nbs1 = &gfc->sv_psy.nb_s1[chn][0];
1043 FLOAT * eb, FLOAT * thr, int chn, int sblock)
1096 if (psv->blocktype_old[chn & 0x01] == SHORT_TYPE) {
1098 FLOAT const t1 = rpelev_s * psv->nb_s1[chn][b];
1099 FLOAT const t2 = rpelev2_s * psv->nb_s2[chn][b];
1105 FLOAT const t1 = rpelev_s * psv->nb_s1[chn][b];
1111 psv->nb_s2[chn][b] = psv->nb_s1[chn][b];
1112 psv->nb_s1[chn][b] = ecb;
1146 FLOAT eb_l[CBANDS], FLOAT thr[CBANDS], int chn)
1205 /* chn=0,1 L and R channels
1206 chn=2,3 S and M channels.
1208 if (psv->blocktype_old[chn & 0x01] == SHORT_TYPE) {
1209 FLOAT const ecb_limit = rpelev * psv->nb_l1[chn][b];
1226 FLOAT ecb_limit_2 = rpelev2 * psv->nb_l2[chn][b];
1227 FLOAT ecb_limit_1 = rpelev * psv->nb_l1[chn][b];
1235 if (psv->blocktype_old[chn & 0x01] == NORM_TYPE) {
1243 psv->nb_l2[chn][b] = psv->nb_l1[chn][b];
1244 psv->nb_l1[chn][b] = ecb;
1278 int chn;
1287 for (chn = 0; chn < cfg->channels_out; chn++) {
1290 uselongblock[chn] = 1;
1293 uselongblock[chn] = 0;
1302 int chn;
1306 for (chn = 0; chn < nch; chn++) {
1310 if (uselongblock[chn]) {
1312 assert(psv->blocktype_old[chn] != START_TYPE);
1313 if (psv->blocktype_old[chn] == SHORT_TYPE)
1319 if (psv->blocktype_old[chn] == NORM_TYPE) {
1320 psv->blocktype_old[chn] = START_TYPE;
1322 if (psv->blocktype_old[chn] == STOP_TYPE)
1323 psv->blocktype_old[chn] = SHORT_TYPE;
1326 blocktype_d[chn] = psv->blocktype_old[chn]; /* value returned to calling program */
1327 psv->blocktype_old[chn] = blocktype; /* save for next call to l3psy_anal */
1446 int chn, sb, sblock;
1448 /* chn=2 and 3 = Mid and Side channels */
1460 for (chn = 0; chn < n_chn_psy; chn++) {
1461 int const ch01 = chn & 0x01;
1464 vbrpsy_compute_fft_l(gfc, buffer, chn, gr_out, fftenergy, wsamp_l);
1465 vbrpsy_compute_loudness_approximation_l(gfc, gr_out, chn, fftenergy);
1466 vbrpsy_compute_masking_l(gfc, fftenergy, eb[chn], thr[chn], chn);
1475 for (chn = 0; chn < n_chn_psy; chn++) {
1476 convert_partition2scalefac_l(gfc, eb[chn], thr[chn], chn);
1477 convert_partition2scalefac_l_to_s(gfc, eb[chn], thr[chn], chn);
1484 for (chn = 0; chn < n_chn_psy; ++chn) {
1485 int const ch01 = chn & 0x01;
1487 vbrpsy_skip_masking_s(gfc, chn, sblock);
1492 vbrpsy_compute_fft_s(gfc, buffer, chn, sblock, fftenergy_s, wsamp_s);
1493 vbrpsy_compute_masking_s(gfc, const_fftenergy_s, eb[chn], thr[chn], chn,
1504 for (chn = 0; chn < n_chn_psy; ++chn) {
1505 int const ch01 = chn & 0x01;
1507 convert_partition2scalefac_s(gfc, eb[chn], thr[chn], chn, sblock);
1513 for (chn = 0; chn < n_chn_psy; chn++) {
1517 thmm = psv->thm[chn].s[sb][sblock];
1526 prev_thm = last_thm[chn].s[sb][2];
1528 if (ns_attacks[chn][sblock] >= 2 || ns_attacks[chn][sblock + 1] == 1) {
1532 if (ns_attacks[chn][sblock] == 1) {
1535 else if ((sblock == 0 && psv->last_attacks[chn] == 3)
1536 || (sblock > 0 && ns_attacks[chn][sblock - 1] == 3)) { /* 2nd preceeding block */
1539 prev_thm = last_thm[chn].s[sb][1];
1542 prev_thm = last_thm[chn].s[sb][2];
1555 thmm *= sub_short_factor[chn][sblock];
1560 psv->thm[chn].s[sb][sblock] = new_thmm[sblock];
1565 for (chn = 0; chn < n_chn_psy; chn++) {
1566 psv->last_attacks[chn] = ns_attacks[chn][2];
1578 for (chn = 0; chn < n_chn_psy; chn++) {
1583 if (chn > 1) {
1588 mr = &masking_MS_ratio[gr_out][chn - 2];
1592 type = blocktype_d[chn];
1593 mr = &masking_ratio[gr_out][chn];
1596 ppe[chn] = pecalc_s(mr, gfc->sv_qnt.masking_lower);
1599 ppe[chn] = pecalc_l(mr, gfc->sv_qnt.masking_lower);
1603 plt->pe[gr_out][chn] = ppe[chn];