• Home
  • Raw
  • Download

Lines Matching refs:sce

77 static void encode_window_bands_info(AACEncContext *s, SingleChannelElement *sce,  in encode_window_bands_info()  argument
83 const int max_sfb = sce->ics.max_sfb; in encode_window_bands_info()
84 const int run_bits = sce->ics.num_windows == 1 ? 5 : 3; in encode_window_bands_info()
91 s->abs_pow34(s->scoefs, sce->coeffs, 1024); in encode_window_bands_info()
99 size = sce->ics.swb_sizes[swb]; in encode_window_bands_info()
100 if (sce->zeroes[win*16 + swb]) { in encode_window_bands_info()
114 if (cb >= 12 && sce->band_type[win*16+swb] < aac_cb_out_map[cb] || in encode_window_bands_info()
115 …cb < aac_cb_in_map[sce->band_type[win*16+swb]] && sce->band_type[win*16+swb] > aac_cb_out_map[cb]… in encode_window_bands_info()
123 rd += quantize_band_cost(s, &sce->coeffs[start + w*128], in encode_window_bands_info()
125 sce->sf_idx[(win+w)*16+swb], aac_cb_out_map[cb], in encode_window_bands_info()
130 if ( run_value_bits[sce->ics.num_windows == 8][path[swb][cb].run] in encode_window_bands_info()
131 != run_value_bits[sce->ics.num_windows == 8][path[swb][cb].run+1]) in encode_window_bands_info()
148 start += sce->ics.swb_sizes[swb]; in encode_window_bands_info()
173 memset(sce->zeroes + win*16 + start, !cb, count); in encode_window_bands_info()
176 sce->band_type[win*16 + start] = cb; in encode_window_bands_info()
196 static void set_special_band_scalefactors(AACEncContext *s, SingleChannelElement *sce) in set_special_band_scalefactors() argument
202 for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) { in set_special_band_scalefactors()
203 for (g = 0; g < sce->ics.num_swb; g++) { in set_special_band_scalefactors()
204 if (sce->zeroes[w*16+g]) in set_special_band_scalefactors()
206 if (sce->band_type[w*16+g] == INTENSITY_BT || sce->band_type[w*16+g] == INTENSITY_BT2) { in set_special_band_scalefactors()
207 sce->sf_idx[w*16+g] = av_clip(roundf(log2f(sce->is_ener[w*16+g])*2), -155, 100); in set_special_band_scalefactors()
209 } else if (sce->band_type[w*16+g] == NOISE_BT) { in set_special_band_scalefactors()
210 sce->sf_idx[w*16+g] = av_clip(3+ceilf(log2f(sce->pns_ener[w*16+g])*2), -100, 155); in set_special_band_scalefactors()
212 prevscaler_n = sce->sf_idx[w*16+g]; in set_special_band_scalefactors()
222 for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) { in set_special_band_scalefactors()
223 for (g = 0; g < sce->ics.num_swb; g++) { in set_special_band_scalefactors()
224 if (sce->zeroes[w*16+g]) in set_special_band_scalefactors()
226 if (sce->band_type[w*16+g] == INTENSITY_BT || sce->band_type[w*16+g] == INTENSITY_BT2) { in set_special_band_scalefactors()
227sce->sf_idx[w*16+g] = prevscaler_i = av_clip(sce->sf_idx[w*16+g], prevscaler_i - SCALE_MAX_DIFF, p… in set_special_band_scalefactors()
228 } else if (sce->band_type[w*16+g] == NOISE_BT) { in set_special_band_scalefactors()
229sce->sf_idx[w*16+g] = prevscaler_n = av_clip(sce->sf_idx[w*16+g], prevscaler_n - SCALE_MAX_DIFF, p… in set_special_band_scalefactors()
236 SingleChannelElement *sce, in search_for_quantizers_anmr() argument
250 float t = fabsf(sce->coeffs[i]); in search_for_quantizers_anmr()
260 memset(sce->sf_idx, 0, sizeof(sce->sf_idx)); in search_for_quantizers_anmr()
261 memset(sce->zeroes, 1, sizeof(sce->zeroes)); in search_for_quantizers_anmr()
302 s->abs_pow34(s->scoefs, sce->coeffs, 1024); in search_for_quantizers_anmr()
303 for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) { in search_for_quantizers_anmr()
305 for (g = 0; g < sce->ics.num_swb; g++) { in search_for_quantizers_anmr()
306 const float *coefs = &sce->coeffs[start]; in search_for_quantizers_anmr()
313 for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) { in search_for_quantizers_anmr()
316 sce->zeroes[(w+w2)*16+g] = 1; in search_for_quantizers_anmr()
319 sce->zeroes[(w+w2)*16+g] = 0; in search_for_quantizers_anmr()
321 for (i = 0; i < sce->ics.swb_sizes[g]; i++) { in search_for_quantizers_anmr()
342 … maxval = find_max_val(sce->ics.group_len[w], sce->ics.swb_sizes[g], s->scoefs+start); in search_for_quantizers_anmr()
345 int cb = find_min_book(maxval, sce->sf_idx[w*16+g]); in search_for_quantizers_anmr()
346 for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) { in search_for_quantizers_anmr()
348 … dist += quantize_band_cost(s, coefs + w2*128, s->scoefs + start + w2*128, sce->ics.swb_sizes[g], in search_for_quantizers_anmr()
369 sce->zeroes[w*16+g] = !nz; in search_for_quantizers_anmr()
370 start += sce->ics.swb_sizes[g]; in search_for_quantizers_anmr()
384 sce->sf_idx[bandaddr[idx]] = minq + q0; in search_for_quantizers_anmr()
389 for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) in search_for_quantizers_anmr()
390 for (g = 0; g < sce->ics.num_swb; g++) in search_for_quantizers_anmr()
391 for (w2 = 1; w2 < sce->ics.group_len[w]; w2++) in search_for_quantizers_anmr()
392 sce->sf_idx[(w+w2)*16+g] = sce->sf_idx[w*16+g]; in search_for_quantizers_anmr()
396 SingleChannelElement *sce, in search_for_quantizers_fast() argument
413 for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) { in search_for_quantizers_fast()
415 for (g = 0; g < sce->ics.num_swb; g++) { in search_for_quantizers_fast()
418 for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) { in search_for_quantizers_fast()
423 sce->zeroes[(w+w2)*16+g] = 1; in search_for_quantizers_fast()
429 sce->band_type[w*16+g] = 0; in search_for_quantizers_fast()
430 sce->zeroes[w*16+g] = !nz; in search_for_quantizers_fast()
434 start += sce->ics.swb_sizes[g]; in search_for_quantizers_fast()
437 for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) { in search_for_quantizers_fast()
438 for (g = 0; g < sce->ics.num_swb; g++) { in search_for_quantizers_fast()
439 if (sce->zeroes[w*16+g]) { in search_for_quantizers_fast()
440 sce->sf_idx[w*16+g] = SCALE_ONE_POS; in search_for_quantizers_fast()
443 sce->sf_idx[w*16+g] = SCALE_ONE_POS + FFMIN(log2f(uplims[w*16+g]/minthr)*4,59); in search_for_quantizers_fast()
449 s->abs_pow34(s->scoefs, sce->coeffs, 1024); in search_for_quantizers_fast()
452 for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) { in search_for_quantizers_fast()
454 for (g = 0; g < sce->ics.num_swb; g++) { in search_for_quantizers_fast()
456 maxvals[w*16+g] = find_max_val(sce->ics.group_len[w], sce->ics.swb_sizes[g], scaled); in search_for_quantizers_fast()
457 start += sce->ics.swb_sizes[g]; in search_for_quantizers_fast()
465 minscaler = sce->sf_idx[0]; in search_for_quantizers_fast()
471 for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) { in search_for_quantizers_fast()
473 for (g = 0; g < sce->ics.num_swb; g++) { in search_for_quantizers_fast()
474 const float *coefs = sce->coeffs + start; in search_for_quantizers_fast()
480 if (sce->zeroes[w*16+g] || sce->sf_idx[w*16+g] >= 218) { in search_for_quantizers_fast()
481 start += sce->ics.swb_sizes[g]; in search_for_quantizers_fast()
484 minscaler = FFMIN(minscaler, sce->sf_idx[w*16+g]); in search_for_quantizers_fast()
485 cb = find_min_book(maxvals[w*16+g], sce->sf_idx[w*16+g]); in search_for_quantizers_fast()
486 for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) { in search_for_quantizers_fast()
491 sce->ics.swb_sizes[g], in search_for_quantizers_fast()
492 sce->sf_idx[w*16+g], in search_for_quantizers_fast()
499 … bits += ff_aac_scalefactor_bits[sce->sf_idx[w*16+g] - prev + SCALE_DIFF_ZERO]; in search_for_quantizers_fast()
502 start += sce->ics.swb_sizes[g]; in search_for_quantizers_fast()
503 prev = sce->sf_idx[w*16+g]; in search_for_quantizers_fast()
508 if (sce->sf_idx[i] < 218 - qstep) in search_for_quantizers_fast()
509 sce->sf_idx[i] += qstep; in search_for_quantizers_fast()
512 if (sce->sf_idx[i] > 60 - qstep) in search_for_quantizers_fast()
513 sce->sf_idx[i] -= qstep; in search_for_quantizers_fast()
516 if (!qstep && tbits > destbits*1.02 && sce->sf_idx[0] < 217) in search_for_quantizers_fast()
523 for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) { in search_for_quantizers_fast()
524 for (g = 0; g < sce->ics.num_swb; g++) { in search_for_quantizers_fast()
525 int prevsc = sce->sf_idx[w*16+g]; in search_for_quantizers_fast()
526 if (dists[w*16+g] > uplims[w*16+g] && sce->sf_idx[w*16+g] > 60) { in search_for_quantizers_fast()
527 if (find_min_book(maxvals[w*16+g], sce->sf_idx[w*16+g]-1)) in search_for_quantizers_fast()
528 sce->sf_idx[w*16+g]--; in search_for_quantizers_fast()
530 sce->sf_idx[w*16+g]-=2; in search_for_quantizers_fast()
532sce->sf_idx[w*16+g] = av_clip(sce->sf_idx[w*16+g], minscaler, minscaler + SCALE_MAX_DIFF); in search_for_quantizers_fast()
533 sce->sf_idx[w*16+g] = FFMIN(sce->sf_idx[w*16+g], 219); in search_for_quantizers_fast()
534 if (sce->sf_idx[w*16+g] != prevsc) in search_for_quantizers_fast()
536 sce->band_type[w*16+g] = find_min_book(maxvals[w*16+g], sce->sf_idx[w*16+g]); in search_for_quantizers_fast()
543 static void search_for_pns(AACEncContext *s, AVCodecContext *avctx, SingleChannelElement *sce) in search_for_pns() argument
547 int wlen = 1024 / sce->ics.num_windows; in search_for_pns()
580 memcpy(sce->band_alt, sce->band_type, sizeof(sce->band_type)); in search_for_pns()
581 ff_init_nextband_map(sce, nextband); in search_for_pns()
582 for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) { in search_for_pns()
584 for (g = 0; g < sce->ics.num_swb; g++) { in search_for_pns()
590 const int start = wstart+sce->ics.swb_offset[g]; in search_for_pns()
594 if (!sce->zeroes[w*16+g]) in search_for_pns()
595 prev_sf = sce->sf_idx[w*16+g]; in search_for_pns()
598 for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) { in search_for_pns()
621 … if ((!sce->zeroes[w*16+g] && !ff_sfdelta_can_remove_band(sce, nextband, prev_sf, w*16+g)) || in search_for_pns()
622 …((sce->zeroes[w*16+g] || !sce->band_alt[w*16+g]) && sfb_energy < threshold*sqrtf(1.0f/freq_boost))… in search_for_pns()
623 … (!sce->zeroes[w*16+g] && sce->band_alt[w*16+g] && sfb_energy > threshold*thr_mult*freq_boost) || in search_for_pns()
625 sce->pns_ener[w*16+g] = sfb_energy; in search_for_pns()
626 if (!sce->zeroes[w*16+g]) in search_for_pns()
627 prev_sf = sce->sf_idx[w*16+g]; in search_for_pns()
637 if (!sce->zeroes[w*16+g]) in search_for_pns()
638 prev_sf = sce->sf_idx[w*16+g]; in search_for_pns()
642 for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) { in search_for_pns()
644 const int start_c = (w+w2)*128+sce->ics.swb_offset[g]; in search_for_pns()
646 for (i = 0; i < sce->ics.swb_sizes[g]; i++) { in search_for_pns()
650 band_energy = s->fdsp->scalarproduct_float(PNS, PNS, sce->ics.swb_sizes[g]); in search_for_pns()
652 s->fdsp->vector_fmul_scalar(PNS, PNS, scale, sce->ics.swb_sizes[g]); in search_for_pns()
653 pns_senergy = s->fdsp->scalarproduct_float(PNS, PNS, sce->ics.swb_sizes[g]); in search_for_pns()
655 s->abs_pow34(NOR34, &sce->coeffs[start_c], sce->ics.swb_sizes[g]); in search_for_pns()
656 s->abs_pow34(PNS34, PNS, sce->ics.swb_sizes[g]); in search_for_pns()
657 dist1 += quantize_band_cost(s, &sce->coeffs[start_c], in search_for_pns()
659 sce->ics.swb_sizes[g], in search_for_pns()
660 sce->sf_idx[(w+w2)*16+g], in search_for_pns()
661 sce->band_alt[(w+w2)*16+g], in search_for_pns()
666 if (g && sce->band_type[w*16+g-1] == NOISE_BT) { in search_for_pns()
672 sce->pns_ener[w*16+g] = energy_ratio*pns_tgt_energy; in search_for_pns()
673 …if (sce->zeroes[w*16+g] || !sce->band_alt[w*16+g] || (energy_ratio > 0.85f && energy_ratio < 1.25f… in search_for_pns()
674 sce->band_type[w*16+g] = NOISE_BT; in search_for_pns()
675 sce->zeroes[w*16+g] = 0; in search_for_pns()
678 if (!sce->zeroes[w*16+g]) in search_for_pns()
679 prev_sf = sce->sf_idx[w*16+g]; in search_for_pns()
685 static void mark_pns(AACEncContext *s, AVCodecContext *avctx, SingleChannelElement *sce) in mark_pns() argument
689 int wlen = 1024 / sce->ics.num_windows; in mark_pns()
716 memcpy(sce->band_alt, sce->band_type, sizeof(sce->band_type)); in mark_pns()
717 for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) { in mark_pns()
718 for (g = 0; g < sce->ics.num_swb; g++) { in mark_pns()
721 const int start = sce->ics.swb_offset[g]; in mark_pns()
725 sce->can_pns[w*16+g] = 0; in mark_pns()
728 for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) { in mark_pns()
746 sce->pns_ener[w*16+g] = sfb_energy; in mark_pns()
748 sce->can_pns[w*16+g] = 0; in mark_pns()
750 sce->can_pns[w*16+g] = 1; in mark_pns()