History

AAC encoder: improve SF range utilization

This patch does 4 things, all of which interact and thus it woudln't be possible to commit them separately without causing either quality regressions or assertion failures. Fate comparison targets don't all reflect improvements in quality, yet listening tests show substantially improved quality and stability. 1. Increase SF range utilization. The spec requires SF delta values to be constrained within the range -60..60. The previous code was applying that range to the whole SF array and not only the deltas of consecutive values, because doing so requires smarter code: zeroing or otherwise skipping a band may invalidate lots of SF choices. This patch implements that logic to allow the coders to utilize the full dynamic range of scalefactors, increasing quality quite considerably, and fixing delta-SF-related assertion failures, since now the limitation is enforced rather than asserted. 2. PNS tweaks The previous modification makes big improvements in twoloop's efficiency, and every time that happens PNS logic needs to be tweaked accordingly to avoid it from stepping all over twoloop's decisions. This patch includes modifications of the sort. 3. Account for lowpass cutoff during PSY analysis The closer PSY's allocation is to final allocation the better the quality is, and given these modifications, twoloop is now very efficient at avoiding holes. Thus, to compute accurate thresholds, PSY needs to account for the lowpass applied implicitly during twoloop (by zeroing high bands). This patch makes twoloop set the cutoff in psymodel's context the first time it runs, and makes PSY account for it during threshold computation, making PE and threshold computations closer to the final allocation and thus achieving better subjective quality. 4. Tweaks to RC lambda tracking loop in relation to PNS Without this tweak some corner cases cause quality regressions. Basically, lambda needs to react faster to overall bitrate efficiency changes since now PNS can be quite successful in enforcing maximum bitrates, when PSY allocates too many bits to the lower bands, suppressing the signals RC logic uses to lower lambda in those cases and causing aggressive PNS. This tweak makes PNS much less aggressive, though it can still use some further tweaks. Also update MIPS specializations and adjust fuzz Also in lavc/mips/aacpsy_mips.h: remove trailing whitespace

Claudio Freire committed 10 years ago

Commit ca203e91 parent ec83efd11 files · +393 −177Browse files

Unified · Split

11 files
  1. libavcodec/aaccoder.c +41 −19
  2. libavcodec/aaccoder_twoloop.h +93 −43
  3. libavcodec/aacenc.c +1 −1
  4. libavcodec/aacenc_is.c +9 −2
  5. libavcodec/aacenc_utils.h +63 −0
  6. libavcodec/aacpsy.c +13 −7
  7. libavcodec/mips/aaccoder_mips.c +117 −55
  8. libavcodec/mips/aacpsy_mips.h +41 −37
  9. libavcodec/psymodel.c +1 −0
  10. libavcodec/psymodel.h +1 −0
  11. tests/fate/aac.mak +13 −13
libavcodec/aaccoder.c+41−19
@@ -54,7 +54,7 @@ · 53 unmodified lines
54 54
55/* Parameter of f(x) = a*(lambda/100), defines the maximum fourier spread55/* Parameter of f(x) = a*(lambda/100), defines the maximum fourier spread
56 * beyond which no PNS is used (since the SFBs contain tone rather than noise) */56 * beyond which no PNS is used (since the SFBs contain tone rather than noise) */
57#define NOISE_SPREAD_THRESHOLD 0.5073f57#define NOISE_SPREAD_THRESHOLD 0.9f
58 58
59/* Parameter of f(x) = a*(100/lambda), defines how much PNS is allowed to59/* Parameter of f(x) = a*(100/lambda), defines how much PNS is allowed to
60 * replace low energy non zero bands */60 * replace low energy non zero bands */
@@ -591,6 +591,7 @@ static void search_for_pns(AACEncContext *s, AVCodecContext *avctx, SingleChanne · 530 unmodified lines
591 int bandwidth, cutoff;591 int bandwidth, cutoff;
592 float *PNS = &s->scoefs[0*128], *PNS34 = &s->scoefs[1*128];592 float *PNS = &s->scoefs[0*128], *PNS34 = &s->scoefs[1*128];
593 float *NOR34 = &s->scoefs[3*128];593 float *NOR34 = &s->scoefs[3*128];
594 uint8_t nextband[128];
594 const float lambda = s->lambda;595 const float lambda = s->lambda;
595 const float freq_mult = avctx->sample_rate*0.5f/wlen;596 const float freq_mult = avctx->sample_rate*0.5f/wlen;
596 const float thr_mult = NOISE_LAMBDA_REPLACE*(100.0f/lambda);597 const float thr_mult = NOISE_LAMBDA_REPLACE*(100.0f/lambda);
@@ -604,6 +605,7 @@ static void search_for_pns(AACEncContext *s, AVCodecContext *avctx, SingleChanne · 7 unmodified lines
604 605
605 /** Keep this in sync with twoloop's cutoff selection */606 /** Keep this in sync with twoloop's cutoff selection */
606 float rate_bandwidth_multiplier = 1.5f;607 float rate_bandwidth_multiplier = 1.5f;
608 int prev = -1000, prev_sf = -1;
607 int frame_bit_rate = (avctx->flags & CODEC_FLAG_QSCALE)609 int frame_bit_rate = (avctx->flags & CODEC_FLAG_QSCALE)
608 ? (refbits * rate_bandwidth_multiplier * avctx->sample_rate / 1024)610 ? (refbits * rate_bandwidth_multiplier * avctx->sample_rate / 1024)
609 : (avctx->bit_rate / avctx->channels);611 : (avctx->bit_rate / avctx->channels);
@@ -619,6 +621,7 @@ static void search_for_pns(AACEncContext *s, AVCodecContext *avctx, SingleChanne · 9 unmodified lines
619 cutoff = bandwidth * 2 * wlen / avctx->sample_rate;621 cutoff = bandwidth * 2 * wlen / avctx->sample_rate;
620 622
621 memcpy(sce->band_alt, sce->band_type, sizeof(sce->band_type));623 memcpy(sce->band_alt, sce->band_type, sizeof(sce->band_type));
624 ff_init_nextband_map(sce, nextband);
622 for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {625 for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
623 int wstart = w*128;626 int wstart = w*128;
624 for (g = 0; g < sce->ics.num_swb; g++) {627 for (g = 0; g < sce->ics.num_swb; g++) {
@@ -655,16 +658,27 @@ static void search_for_pns(AACEncContext *s, AVCodecContext *avctx, SingleChanne · 30 unmodified lines
655 *658 *
656 * At this stage, point 2 is relaxed for zeroed bands near the noise threshold (hole avoidance is more important)659 * At this stage, point 2 is relaxed for zeroed bands near the noise threshold (hole avoidance is more important)
657 */660 */
658 if (((sce->zeroes[w*16+g] || !sce->band_alt[w*16+g]) && sfb_energy < threshold*sqrtf(1.5f/freq_boost)) || spread < spread_threshold ||661 if ((!sce->zeroes[w*16+g] && !ff_sfdelta_can_remove_band(sce, nextband, prev_sf, w*16+g)) ||
662 ((sce->zeroes[w*16+g] || !sce->band_alt[w*16+g]) && sfb_energy < threshold*sqrtf(1.0f/freq_boost)) || spread < spread_threshold ||
659 (!sce->zeroes[w*16+g] && sce->band_alt[w*16+g] && sfb_energy > threshold*thr_mult*freq_boost) ||663 (!sce->zeroes[w*16+g] && sce->band_alt[w*16+g] && sfb_energy > threshold*thr_mult*freq_boost) ||
660 min_energy < pns_transient_energy_r * max_energy ) {664 min_energy < pns_transient_energy_r * max_energy ) {
661 sce->pns_ener[w*16+g] = sfb_energy;665 sce->pns_ener[w*16+g] = sfb_energy;
666 if (!sce->zeroes[w*16+g])
667 prev_sf = sce->sf_idx[w*16+g];
662 continue;668 continue;
663 }669 }
664 670
665 pns_tgt_energy = sfb_energy*FFMIN(1.0f, spread*spread);671 pns_tgt_energy = sfb_energy*FFMIN(1.0f, spread*spread);
666 noise_sfi = av_clip(roundf(log2f(pns_tgt_energy)*2), -100, 155); /* Quantize */672 noise_sfi = av_clip(roundf(log2f(pns_tgt_energy)*2), -100, 155); /* Quantize */
667 noise_amp = -ff_aac_pow2sf_tab[noise_sfi + POW_SF2_ZERO]; /* Dequantize */673 noise_amp = -ff_aac_pow2sf_tab[noise_sfi + POW_SF2_ZERO]; /* Dequantize */
674 if (prev != -1000) {
675 int noise_sfdiff = noise_sfi - prev + SCALE_DIFF_ZERO;
676 if (noise_sfdiff < 0 || noise_sfdiff > 2*SCALE_MAX_DIFF) {
677 if (!sce->zeroes[w*16+g])
678 prev_sf = sce->sf_idx[w*16+g];
679 continue;
680 }
681 }
668 for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) {682 for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) {
669 float band_energy, scale, pns_senergy;683 float band_energy, scale, pns_senergy;
670 const int start_c = (w+w2)*128+sce->ics.swb_offset[g];684 const int start_c = (w+w2)*128+sce->ics.swb_offset[g];
@@ -697,7 +711,10 @@ static void search_for_pns(AACEncContext *s, AVCodecContext *avctx, SingleChanne · 26 unmodified lines
697 if (sce->zeroes[w*16+g] || !sce->band_alt[w*16+g] || (energy_ratio > 0.85f && energy_ratio < 1.25f && dist2 < dist1)) {711 if (sce->zeroes[w*16+g] || !sce->band_alt[w*16+g] || (energy_ratio > 0.85f && energy_ratio < 1.25f && dist2 < dist1)) {
698 sce->band_type[w*16+g] = NOISE_BT;712 sce->band_type[w*16+g] = NOISE_BT;
699 sce->zeroes[w*16+g] = 0;713 sce->zeroes[w*16+g] = 0;
714 prev = noise_sfi;
700 }715 }
716 if (!sce->zeroes[w*16+g])
717 prev_sf = sce->sf_idx[w*16+g];
701 }718 }
702 }719 }
703}720}
@@ -775,7 +792,8 @@ static void mark_pns(AACEncContext *s, AVCodecContext *avctx, SingleChannelEleme · 71 unmodified lines
775 792
776static void search_for_ms(AACEncContext *s, ChannelElement *cpe)793static void search_for_ms(AACEncContext *s, ChannelElement *cpe)
777{794{
778 int start = 0, i, w, w2, g, sid_sf_boost;795 int start = 0, i, w, w2, g, sid_sf_boost, prev_mid, prev_side;
796 uint8_t nextband0[128], nextband1[128];
779 float M[128], S[128];797 float M[128], S[128];
780 float *L34 = s->scoefs, *R34 = s->scoefs + 128, *M34 = s->scoefs + 128*2, *S34 = s->scoefs + 128*3;798 float *L34 = s->scoefs, *R34 = s->scoefs + 128, *M34 = s->scoefs + 128*2, *S34 = s->scoefs + 128*3;
781 const float lambda = s->lambda;799 const float lambda = s->lambda;
@@ -784,21 +802,19 @@ static void search_for_ms(AACEncContext *s, ChannelElement *cpe) · 2 unmodified lines
784 SingleChannelElement *sce1 = &cpe->ch[1];802 SingleChannelElement *sce1 = &cpe->ch[1];
785 if (!cpe->common_window)803 if (!cpe->common_window)
786 return;804 return;
787 for (w = 0; w < sce0->ics.num_windows; w += sce0->ics.group_len[w]) {
788 int min_sf_idx_mid = SCALE_MAX_POS;
789 int min_sf_idx_side = SCALE_MAX_POS;
790 for (g = 0; g < sce0->ics.num_swb; g++) {
791 if (!sce0->zeroes[w*16+g] && sce0->band_type[w*16+g] < RESERVED_BT)
792 min_sf_idx_mid = FFMIN(min_sf_idx_mid, sce0->sf_idx[w*16+g]);
793 if (!sce1->zeroes[w*16+g] && sce1->band_type[w*16+g] < RESERVED_BT)
794 min_sf_idx_side = FFMIN(min_sf_idx_side, sce1->sf_idx[w*16+g]);
795 }
796 805
806 /** Scout out next nonzero bands */
807 ff_init_nextband_map(sce0, nextband0);
808 ff_init_nextband_map(sce1, nextband1);
809
810 prev_mid = sce0->sf_idx[0];
811 prev_side = sce1->sf_idx[0];
812 for (w = 0; w < sce0->ics.num_windows; w += sce0->ics.group_len[w]) {
797 start = 0;813 start = 0;
798 for (g = 0; g < sce0->ics.num_swb; g++) {814 for (g = 0; g < sce0->ics.num_swb; g++) {
799 float bmax = bval2bmax(g * 17.0f / sce0->ics.num_swb) / 0.0045f;815 float bmax = bval2bmax(g * 17.0f / sce0->ics.num_swb) / 0.0045f;
800 cpe->ms_mask[w*16+g] = 0;816 cpe->ms_mask[w*16+g] = 0;
801 if (!cpe->ch[0].zeroes[w*16+g] && !cpe->ch[1].zeroes[w*16+g]) {817 if (!sce0->zeroes[w*16+g] && !sce1->zeroes[w*16+g]) {
802 float Mmax = 0.0f, Smax = 0.0f;818 float Mmax = 0.0f, Smax = 0.0f;
803 819
804 /* Must compute mid/side SF and book for the whole window group */820 /* Must compute mid/side SF and book for the whole window group */
@@ -825,16 +841,18 @@ static void search_for_ms(AACEncContext *s, ChannelElement *cpe) · 20 unmodified lines
825 int midcb, sidcb;841 int midcb, sidcb;
826 842
827 minidx = FFMIN(sce0->sf_idx[w*16+g], sce1->sf_idx[w*16+g]);843 minidx = FFMIN(sce0->sf_idx[w*16+g], sce1->sf_idx[w*16+g]);
828 mididx = av_clip(minidx, min_sf_idx_mid, min_sf_idx_mid + SCALE_MAX_DIFF);844 mididx = av_clip(minidx, 0, SCALE_MAX_POS - SCALE_DIV_512);
829 sididx = av_clip(minidx - sid_sf_boost * 3, min_sf_idx_side, min_sf_idx_side + SCALE_MAX_DIFF);845 sididx = av_clip(minidx - sid_sf_boost * 3, 0, SCALE_MAX_POS - SCALE_DIV_512);
830 midcb = find_min_book(Mmax, mididx);846 if (!cpe->is_mask[w*16+g] && sce0->band_type[w*16+g] != NOISE_BT && sce1->band_type[w*16+g] != NOISE_BT
831 sidcb = find_min_book(Smax, sididx);847 && ( !ff_sfdelta_can_replace(sce0, nextband0, prev_mid, mididx, w*16+g)
832 848 || !ff_sfdelta_can_replace(sce1, nextband1, prev_side, sididx, w*16+g))) {
833 if ((mididx > minidx) || (sididx > minidx)) {
834 /* scalefactor range violation, bad stuff, will decrease quality unacceptably */849 /* scalefactor range violation, bad stuff, will decrease quality unacceptably */
835 continue;850 continue;
836 }851 }
837 852
853 midcb = find_min_book(Mmax, mididx);
854 sidcb = find_min_book(Smax, sididx);
855
838 /* No CB can be zero */856 /* No CB can be zero */
839 midcb = FFMAX(1,midcb);857 midcb = FFMAX(1,midcb);
840 sidcb = FFMAX(1,sidcb);858 sidcb = FFMAX(1,sidcb);
@@ -900,6 +918,10 @@ static void search_for_ms(AACEncContext *s, ChannelElement *cpe) · 59 unmodified lines
900 }918 }
901 }919 }
902 }920 }
921 if (!sce0->zeroes[w*16+g] && sce0->band_type[w*16+g] < RESERVED_BT)
922 prev_mid = sce0->sf_idx[w*16+g];
923 if (!sce1->zeroes[w*16+g] && !cpe->is_mask[w*16+g] && sce1->band_type[w*16+g] < RESERVED_BT)
924 prev_side = sce1->sf_idx[w*16+g];
903 start += sce0->ics.swb_sizes[g];925 start += sce0->ics.swb_sizes[g];
904 }926 }
905 }927 }
libavcodec/aaccoder_twoloop.h+93−43
@@ -76,6 +76,7 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx, · 75 unmodified lines
76 int refbits = destbits;76 int refbits = destbits;
77 int toomanybits, toofewbits;77 int toomanybits, toofewbits;
78 char nzs[128];78 char nzs[128];
79 uint8_t nextband[128];
79 int maxsf[128];80 int maxsf[128];
80 float dists[128] = { 0 }, qenergies[128] = { 0 }, uplims[128], euplims[128], energies[128];81 float dists[128] = { 0 }, qenergies[128] = { 0 }, uplims[128], euplims[128], energies[128];
81 float maxvals[128], spread_thr_r[128];82 float maxvals[128], spread_thr_r[128];
@@ -102,7 +103,7 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx, · 20 unmodified lines
102 */103 */
103 float sfoffs = av_clipf(log2f(120.0f / lambda) * 4.0f, -5, 10);104 float sfoffs = av_clipf(log2f(120.0f / lambda) * 4.0f, -5, 10);
104 105
105 int fflag, minscaler, maxscaler, nminscaler, minrdsf;106 int fflag, minscaler, maxscaler, nminscaler;
106 int its = 0;107 int its = 0;
107 int maxits = 30;108 int maxits = 30;
108 int allz = 0;109 int allz = 0;
@@ -158,9 +159,13 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx, · 49 unmodified lines
158 /** search further */159 /** search further */
159 maxits *= 2;160 maxits *= 2;
160 } else {161 } else {
161 /** When using ABR, be strict */162 /* When using ABR, be strict, but a reasonable leeway is
162 toomanybits = destbits + destbits/16;163 * critical to allow RC to smoothly track desired bitrate
163 toofewbits = destbits - destbits/4;164 * without sudden quality drops that cause audible artifacts.
165 * Symmetry is also desirable, to avoid systematic bias.
166 */
167 toomanybits = destbits + destbits/8;
168 toofewbits = destbits - destbits/8;
164 169
165 sfoffs = 0;170 sfoffs = 0;
166 rdlambda = sqrtf(rdlambda);171 rdlambda = sqrtf(rdlambda);
@@ -191,6 +196,7 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx, · 24 unmodified lines
191 bandwidth = avctx->cutoff;196 bandwidth = avctx->cutoff;
192 } else {197 } else {
193 bandwidth = FFMAX(3000, AAC_CUTOFF_FROM_BITRATE(frame_bit_rate, 1, avctx->sample_rate));198 bandwidth = FFMAX(3000, AAC_CUTOFF_FROM_BITRATE(frame_bit_rate, 1, avctx->sample_rate));
199 s->psy.cutoff = bandwidth;
194 }200 }
195 201
196 cutoff = bandwidth * 2 * wlen / avctx->sample_rate;202 cutoff = bandwidth * 2 * wlen / avctx->sample_rate;
@@ -241,7 +247,7 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx, · 44 unmodified lines
241 nzs[w*16+g] = nz;247 nzs[w*16+g] = nz;
242 sce->zeroes[w*16+g] = !nz;248 sce->zeroes[w*16+g] = !nz;
243 allz |= nz;249 allz |= nz;
244 if (nz) {250 if (nz && sce->can_pns[w*16+g]) {
245 spread_thr_r[w*16+g] = energy * nz / (uplim * spread);251 spread_thr_r[w*16+g] = energy * nz / (uplim * spread);
246 if (min_spread_thr_r < 0) {252 if (min_spread_thr_r < 0) {
247 min_spread_thr_r = max_spread_thr_r = spread_thr_r[w*16+g];253 min_spread_thr_r = max_spread_thr_r = spread_thr_r[w*16+g];
@@ -433,6 +439,7 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx, · 185 unmodified lines
433 } while (qstep);439 } while (qstep);
434 440
435 overdist = 1;441 overdist = 1;
442 fflag = tbits < toofewbits;
436 for (i = 0; i < 2 && (overdist || recomprd); ++i) {443 for (i = 0; i < 2 && (overdist || recomprd); ++i) {
437 if (recomprd) {444 if (recomprd) {
438 /** Must recompute distortion */445 /** Must recompute distortion */
@@ -484,13 +491,13 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx, · 45 unmodified lines
484 }491 }
485 }492 }
486 }493 }
487 if (!i && s->options.pns && its > maxits/2) {494 if (!i && s->options.pns && its > maxits/2 && tbits > toofewbits) {
488 float maxoverdist = 0.0f;495 float maxoverdist = 0.0f;
496 float ovrfactor = 1.f+(maxits-its)*16.f/maxits;
489 overdist = recomprd = 0;497 overdist = recomprd = 0;
490 for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {498 for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
491 float ovrfactor = 2.f+(maxits-its)*16.f/maxits;
492 for (g = start = 0; g < sce->ics.num_swb; start += sce->ics.swb_sizes[g++]) {499 for (g = start = 0; g < sce->ics.num_swb; start += sce->ics.swb_sizes[g++]) {
493 if (!sce->zeroes[w*16+g] && dists[w*16+g] > uplims[w*16+g]*ovrfactor) {500 if (!sce->zeroes[w*16+g] && sce->sf_idx[w*16+g] > SCALE_ONE_POS && dists[w*16+g] > uplims[w*16+g]*ovrfactor) {
494 float ovrdist = dists[w*16+g] / FFMAX(uplims[w*16+g],euplims[w*16+g]);501 float ovrdist = dists[w*16+g] / FFMAX(uplims[w*16+g],euplims[w*16+g]);
495 maxoverdist = FFMAX(maxoverdist, ovrdist);502 maxoverdist = FFMAX(maxoverdist, ovrdist);
496 overdist++;503 overdist++;
@@ -506,7 +513,7 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx, · 9 unmodified lines
506 float zspread;513 float zspread;
507 int zeroable = 0;514 int zeroable = 0;
508 int zeroed = 0;515 int zeroed = 0;
509 int maxzeroed;516 int maxzeroed, zloop;
510 for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {517 for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
511 for (g = start = 0; g < sce->ics.num_swb; start += sce->ics.swb_sizes[g++]) {518 for (g = start = 0; g < sce->ics.num_swb; start += sce->ics.swb_sizes[g++]) {
512 if (start >= pns_start_pos && !sce->zeroes[w*16+g] && sce->can_pns[w*16+g]) {519 if (start >= pns_start_pos && !sce->zeroes[w*16+g] && sce->can_pns[w*16+g]) {
@@ -517,21 +524,41 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx, · 4 unmodified lines
517 }524 }
518 }525 }
519 zspread = (maxspread-minspread) * 0.0125f + minspread;526 zspread = (maxspread-minspread) * 0.0125f + minspread;
520 zspread = FFMIN(maxoverdist, zspread);527 /* Don't PNS everything even if allowed. It suppresses bit starvation signals from RC,
521 maxzeroed = zeroable * its / (2 * maxits);528 * and forced the hand of the later search_for_pns step.
522 for (g = sce->ics.num_swb-1; g > 0 && zeroed < maxzeroed; g--) {529 * Instead, PNS a fraction of the spread_thr_r range depending on how starved for bits we are,
523 if (sce->ics.swb_offset[g] < pns_start_pos)530 * and leave further PNSing to search_for_pns if worthwhile.
524 continue;531 */
525 for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {532 zspread = FFMIN3(min_spread_thr_r * 8.f, zspread,
526 if (!sce->zeroes[w*16+g] && sce->can_pns[w*16+g] && spread_thr_r[w*16+g] <= zspread) {533 ((toomanybits - tbits) * min_spread_thr_r + (tbits - toofewbits) * max_spread_thr_r) / (toomanybits - toofewbits + 1));
527 sce->zeroes[w*16+g] = 1;534 maxzeroed = FFMIN(zeroable, FFMAX(1, (zeroable * its + maxits - 1) / (2 * maxits)));
528 sce->band_type[w*16+g] = 0;535 for (zloop = 0; zloop < 2; zloop++) {
529 zeroed++;536 /* Two passes: first distorted stuff - two birds in one shot and all that,
537 * then anything viable. Viable means not zero, but either CB=zero-able
538 * (too high SF), not SF <= 1 (that means we'd be operating at very high
539 * quality, we don't want PNS when doing VHQ), PNS allowed, and within
540 * the lowest ranking percentile.
541 */
542 float loopovrfactor = (zloop) ? 1.0f : ovrfactor;
543 int loopminsf = (zloop) ? (SCALE_ONE_POS - SCALE_DIV_512) : SCALE_ONE_POS;
544 int mcb;
545 for (g = sce->ics.num_swb-1; g > 0 && zeroed < maxzeroed; g--) {
546 if (sce->ics.swb_offset[g] < pns_start_pos)
547 continue;
548 for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
549 if (!sce->zeroes[w*16+g] && sce->can_pns[w*16+g] && spread_thr_r[w*16+g] <= zspread
550 && sce->sf_idx[w*16+g] > loopminsf
551 && (dists[w*16+g] > loopovrfactor*uplims[w*16+g] || !(mcb = find_min_book(maxvals[w*16+g], sce->sf_idx[w*16+g]))
552 || (mcb <= 1 && dists[w*16+g] > FFMIN(uplims[w*16+g], euplims[w*16+g]))) ) {
553 sce->zeroes[w*16+g] = 1;
554 sce->band_type[w*16+g] = 0;
555 zeroed++;
556 }
530 }557 }
531 }558 }
532 }559 }
533 if (zeroed)560 if (zeroed)
534 recomprd = 1;561 recomprd = fflag = 1;
535 } else {562 } else {
536 overdist = 0;563 overdist = 0;
537 }564 }
@@ -549,9 +576,8 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx, · 11 unmodified lines
549 }576 }
550 }577 }
551 578
552 fflag = 0;
553 minscaler = nminscaler = av_clip(minscaler, SCALE_ONE_POS - SCALE_DIV_512, SCALE_MAX_POS - SCALE_DIV_512);579 minscaler = nminscaler = av_clip(minscaler, SCALE_ONE_POS - SCALE_DIV_512, SCALE_MAX_POS - SCALE_DIV_512);
554 minrdsf = FFMAX3(60, minscaler - 1, maxscaler - SCALE_MAX_DIFF - 1);580 prev = -1;
555 for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {581 for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
556 /** Start with big steps, end up fine-tunning */582 /** Start with big steps, end up fine-tunning */
557 int depth = (its > maxits/2) ? ((its > maxits*2/3) ? 1 : 3) : 10;583 int depth = (its > maxits/2) ? ((its > maxits*2/3) ? 1 : 3) : 10;
@@ -561,19 +587,22 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx, · 3 unmodified lines
561 start = w * 128;587 start = w * 128;
562 for (g = 0; g < sce->ics.num_swb; g++) {588 for (g = 0; g < sce->ics.num_swb; g++) {
563 int prevsc = sce->sf_idx[w*16+g];589 int prevsc = sce->sf_idx[w*16+g];
564 int minrdsfboost = (sce->ics.num_windows > 1) ? av_clip(g-4, -2, 0) : av_clip(g-16, -4, 0);590 if (prev < 0 && !sce->zeroes[w*16+g])
591 prev = sce->sf_idx[0];
565 if (!sce->zeroes[w*16+g]) {592 if (!sce->zeroes[w*16+g]) {
566 const float *coefs = sce->coeffs + start;593 const float *coefs = sce->coeffs + start;
567 const float *scaled = s->scoefs + start;594 const float *scaled = s->scoefs + start;
568 int cmb = find_min_book(maxvals[w*16+g], sce->sf_idx[w*16+g]);595 int cmb = find_min_book(maxvals[w*16+g], sce->sf_idx[w*16+g]);
569 if ((!cmb || dists[w*16+g] > uplims[w*16+g]) && sce->sf_idx[w*16+g] > minrdsf) {596 int mindeltasf = FFMAX(0, prev - SCALE_MAX_DIFF);
597 int maxdeltasf = FFMIN(SCALE_MAX_POS - SCALE_DIV_512, prev + SCALE_MAX_DIFF);
598 if ((!cmb || dists[w*16+g] > uplims[w*16+g]) && sce->sf_idx[w*16+g] > mindeltasf) {
570 /* Try to make sure there is some energy in every nonzero band599 /* Try to make sure there is some energy in every nonzero band
571 * NOTE: This algorithm must be forcibly imbalanced, pushing harder600 * NOTE: This algorithm must be forcibly imbalanced, pushing harder
572 * on holes or more distorted bands at first, otherwise there's601 * on holes or more distorted bands at first, otherwise there's
573 * no net gain (since the next iteration will offset all bands602 * no net gain (since the next iteration will offset all bands
574 * on the opposite direction to compensate for extra bits)603 * on the opposite direction to compensate for extra bits)
575 */604 */
576 for (i = 0; i < edepth; ++i) {605 for (i = 0; i < edepth && sce->sf_idx[w*16+g] > mindeltasf; ++i) {
577 int cb, bits;606 int cb, bits;
578 float dist, qenergy;607 float dist, qenergy;
579 int mb = find_min_book(maxvals[w*16+g], sce->sf_idx[w*16+g]-1);608 int mb = find_min_book(maxvals[w*16+g], sce->sf_idx[w*16+g]-1);
@@ -585,6 +614,12 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx, · 5 unmodified lines
585 } else if (i >= depth && dists[w*16+g] < euplims[w*16+g]) {614 } else if (i >= depth && dists[w*16+g] < euplims[w*16+g]) {
586 break;615 break;
587 }616 }
617 /* !g is the DC band, it's important, since quantization error here
618 * applies to less than a cycle, it creates horrible intermodulation
619 * distortion if it doesn't stick to what psy requests
620 */
621 if (!g && sce->ics.num_windows > 1 && dists[w*16+g] >= euplims[w*16+g])
622 maxsf[w*16+g] = FFMIN(sce->sf_idx[w*16+g], maxsf[w*16+g]);
588 for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) {623 for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) {
589 int b;624 int b;
590 float sqenergy;625 float sqenergy;
@@ -603,19 +638,19 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx, · 12 unmodified lines
603 sce->sf_idx[w*16+g]--;638 sce->sf_idx[w*16+g]--;
604 dists[w*16+g] = dist - bits;639 dists[w*16+g] = dist - bits;
605 qenergies[w*16+g] = qenergy;640 qenergies[w*16+g] = qenergy;
606 if (mb && (sce->sf_idx[w*16+g] < (minrdsf+minrdsfboost) || (641 if (mb && (sce->sf_idx[w*16+g] < mindeltasf || (
607 (dists[w*16+g] < FFMIN(uplmax*uplims[w*16+g], euplims[w*16+g]))642 (dists[w*16+g] < FFMIN(uplmax*uplims[w*16+g], euplims[w*16+g]))
608 && (fabsf(qenergies[w*16+g]-energies[w*16+g]) < euplims[w*16+g])643 && (fabsf(qenergies[w*16+g]-energies[w*16+g]) < euplims[w*16+g])
609 ) )) {644 ) )) {
610 break;645 break;
611 }646 }
612 }647 }
613 } else if (tbits > toofewbits && sce->sf_idx[w*16+g] < maxscaler648 } else if (tbits > toofewbits && sce->sf_idx[w*16+g] < FFMIN(maxdeltasf, maxsf[w*16+g])
614 && (dists[w*16+g] < FFMIN(euplims[w*16+g], uplims[w*16+g]))649 && (dists[w*16+g] < FFMIN(euplims[w*16+g], uplims[w*16+g]))
615 && (fabsf(qenergies[w*16+g]-energies[w*16+g]) < euplims[w*16+g])650 && (fabsf(qenergies[w*16+g]-energies[w*16+g]) < euplims[w*16+g])
616 ) {651 ) {
617 /** Um... over target. Save bits for more important stuff. */652 /** Um... over target. Save bits for more important stuff. */
618 for (i = 0; i < depth; ++i) {653 for (i = 0; i < depth && sce->sf_idx[w*16+g] < maxdeltasf; ++i) {
619 int cb, bits;654 int cb, bits;
620 float dist, qenergy;655 float dist, qenergy;
621 cb = find_min_book(maxvals[w*16+g], sce->sf_idx[w*16+g]+1);656 cb = find_min_book(maxvals[w*16+g], sce->sf_idx[w*16+g]+1);
@@ -651,38 +686,53 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx, · 29 unmodified lines
651 }686 }
652 }687 }
653 }688 }
689 prev = sce->sf_idx[w*16+g] = av_clip(sce->sf_idx[w*16+g], mindeltasf, maxdeltasf);
690 if (sce->sf_idx[w*16+g] != prevsc)
691 fflag = 1;
692 nminscaler = FFMIN(nminscaler, sce->sf_idx[w*16+g]);
693 sce->band_type[w*16+g] = find_min_book(maxvals[w*16+g], sce->sf_idx[w*16+g]);
654 }694 }
655 sce->sf_idx[w*16+g] = av_clip(sce->sf_idx[w*16+g], minrdsf, minscaler + SCALE_MAX_DIFF);
656 sce->sf_idx[w*16+g] = FFMIN(sce->sf_idx[w*16+g], SCALE_MAX_POS - SCALE_DIV_512);
657 if (sce->sf_idx[w*16+g] != prevsc)
658 fflag = 1;
659 nminscaler = FFMIN(nminscaler, sce->sf_idx[w*16+g]);
660 sce->band_type[w*16+g] = find_min_book(maxvals[w*16+g], sce->sf_idx[w*16+g]);
661 start += sce->ics.swb_sizes[g];695 start += sce->ics.swb_sizes[g];
662 }696 }
663 }697 }
664 if (nminscaler < minscaler || sce->ics.num_windows > 1) {698
665 /** SF difference limit violation risk. Must re-clamp. */699 /** SF difference limit violation risk. Must re-clamp. */
666 minscaler = nminscaler;700 prev = -1;
667 for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {701 for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
668 for (g = 0; g < sce->ics.num_swb; g++) {702 for (g = 0; g < sce->ics.num_swb; g++) {
669 sce->sf_idx[w*16+g] = av_clip(sce->sf_idx[w*16+g], minscaler, minscaler + SCALE_MAX_DIFF);703 if (!sce->zeroes[w*16+g]) {
704 int prevsf = sce->sf_idx[w*16+g];
705 if (prev < 0)
706 prev = prevsf;
707 sce->sf_idx[w*16+g] = av_clip(sce->sf_idx[w*16+g], prev - SCALE_MAX_DIFF, prev + SCALE_MAX_DIFF);
670 sce->band_type[w*16+g] = find_min_book(maxvals[w*16+g], sce->sf_idx[w*16+g]);708 sce->band_type[w*16+g] = find_min_book(maxvals[w*16+g], sce->sf_idx[w*16+g]);
709 prev = sce->sf_idx[w*16+g];
710 if (!fflag && prevsf != sce->sf_idx[w*16+g])
711 fflag = 1;
671 }712 }
672 }713 }
673 }714 }
715
674 its++;716 its++;
675 } while (fflag && its < maxits);717 } while (fflag && its < maxits);
676 718
719 /** Scout out next nonzero bands */
720 ff_init_nextband_map(sce, nextband);
721
677 prev = -1;722 prev = -1;
678 for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {723 for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
679 /** Make sure proper codebooks are set */724 /** Make sure proper codebooks are set */
680 for (g = start = 0; g < sce->ics.num_swb; start += sce->ics.swb_sizes[g++]) {725 for (g = 0; g < sce->ics.num_swb; g++) {
681 if (!sce->zeroes[w*16+g]) {726 if (!sce->zeroes[w*16+g]) {
682 sce->band_type[w*16+g] = find_min_book(maxvals[w*16+g], sce->sf_idx[w*16+g]);727 sce->band_type[w*16+g] = find_min_book(maxvals[w*16+g], sce->sf_idx[w*16+g]);
683 if (sce->band_type[w*16+g] <= 0) {728 if (sce->band_type[w*16+g] <= 0) {
684 sce->zeroes[w*16+g] = 1;729 if (!ff_sfdelta_can_remove_band(sce, nextband, prev, w*16+g)) {
685 sce->band_type[w*16+g] = 0;730 /** Cannot zero out, make sure it's not attempted */
731 sce->band_type[w*16+g] = 1;
732 } else {
733 sce->zeroes[w*16+g] = 1;
734 sce->band_type[w*16+g] = 0;
735 }
686 }736 }
687 } else {737 } else {
688 sce->band_type[w*16+g] = 0;738 sce->band_type[w*16+g] = 0;
libavcodec/aacenc.c+1−1
@@ -793,7 +793,7 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, · 792 unmodified lines
793 s->lambda = FFMIN(s->lambda * ratio, 65536.f);793 s->lambda = FFMIN(s->lambda * ratio, 65536.f);
794 794
795 /* Keep iterating if we must reduce and lambda is in the sky */795 /* Keep iterating if we must reduce and lambda is in the sky */
796 if ((s->lambda < 300.f || ratio > 0.9f) && (s->lambda > 10.f || ratio < 1.1f)) {796 if (ratio > 0.9f && ratio < 1.1f) {
797 break;797 break;
798 } else {798 } else {
799 if (is_mode || ms_mode || tns_mode || pred_mode) {799 if (is_mode || ms_mode || tns_mode || pred_mode) {
libavcodec/aacenc_is.c+9−2
@@ -99,18 +99,23 @@ void ff_aac_search_for_is(AACEncContext *s, AVCodecContext *avctx, ChannelElemen · 98 unmodified lines
99{99{
100 SingleChannelElement *sce0 = &cpe->ch[0];100 SingleChannelElement *sce0 = &cpe->ch[0];
101 SingleChannelElement *sce1 = &cpe->ch[1];101 SingleChannelElement *sce1 = &cpe->ch[1];
102 int start = 0, count = 0, w, w2, g, i;102 int start = 0, count = 0, w, w2, g, i, prev_sf1 = -1;
103 const float freq_mult = avctx->sample_rate/(1024.0f/sce0->ics.num_windows)/2.0f;103 const float freq_mult = avctx->sample_rate/(1024.0f/sce0->ics.num_windows)/2.0f;
104 uint8_t nextband1[128];
104 105
105 if (!cpe->common_window)106 if (!cpe->common_window)
106 return;107 return;
107 108
109 /** Scout out next nonzero bands */
110 ff_init_nextband_map(sce1, nextband1);
111
108 for (w = 0; w < sce0->ics.num_windows; w += sce0->ics.group_len[w]) {112 for (w = 0; w < sce0->ics.num_windows; w += sce0->ics.group_len[w]) {
109 start = 0;113 start = 0;
110 for (g = 0; g < sce0->ics.num_swb; g++) {114 for (g = 0; g < sce0->ics.num_swb; g++) {
111 if (start*freq_mult > INT_STEREO_LOW_LIMIT*(s->lambda/170.0f) &&115 if (start*freq_mult > INT_STEREO_LOW_LIMIT*(s->lambda/170.0f) &&
112 cpe->ch[0].band_type[w*16+g] != NOISE_BT && !cpe->ch[0].zeroes[w*16+g] &&116 cpe->ch[0].band_type[w*16+g] != NOISE_BT && !cpe->ch[0].zeroes[w*16+g] &&
113 cpe->ch[1].band_type[w*16+g] != NOISE_BT && !cpe->ch[1].zeroes[w*16+g]) {117 cpe->ch[1].band_type[w*16+g] != NOISE_BT && !cpe->ch[1].zeroes[w*16+g] &&
118 ff_sfdelta_can_remove_band(sce1, nextband1, prev_sf1, w*16+g)) {
114 float ener0 = 0.0f, ener1 = 0.0f, ener01 = 0.0f, ener01p = 0.0f;119 float ener0 = 0.0f, ener1 = 0.0f, ener01 = 0.0f, ener01p = 0.0f;
115 struct AACISError ph_err1, ph_err2, *erf;120 struct AACISError ph_err1, ph_err2, *erf;
116 if (sce0->band_type[w*16+g] == NOISE_BT ||121 if (sce0->band_type[w*16+g] == NOISE_BT ||
@@ -142,6 +147,8 @@ void ff_aac_search_for_is(AACEncContext *s, AVCodecContext *avctx, ChannelElemen · 25 unmodified lines
142 count++;147 count++;
143 }148 }
144 }149 }
150 if (!sce1->zeroes[w*16+g] && sce1->band_type[w*16+g] < RESERVED_BT)
151 prev_sf1 = sce1->sf_idx[w*16+g];
145 start += sce0->ics.swb_sizes[g];152 start += sce0->ics.swb_sizes[g];
146 }153 }
147 }154 }
libavcodec/aacenc_utils.h+63−0
@@ -191,6 +191,69 @@ static inline int lcg_random(unsigned previous_val) · 190 unmodified lines
191 return v.s;191 return v.s;
192}192}
193 193
194
195/*
196 * Compute a nextband map to be used with SF delta constraint utilities.
197 * The nextband array should contain 128 elements, and positions that don't
198 * map to valid, nonzero bands of the form w*16+g (with w being the initial
199 * window of the window group, only) are left indetermined.
200 */
201static inline void ff_init_nextband_map(const SingleChannelElement *sce, uint8_t *nextband)
202{
203 unsigned char prevband = 0;
204 int w, g;
205 /** Just a safe default */
206 for (g = 0; g < 128; g++)
207 nextband[g] = g;
208
209 /** Now really navigate the nonzero band chain */
210 for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
211 for (g = 0; g < sce->ics.num_swb; g++) {
212 if (!sce->zeroes[w*16+g] && sce->band_type[w*16+g] < RESERVED_BT)
213 prevband = nextband[prevband] = w*16+g;
214 }
215 }
216 nextband[prevband] = prevband; /* terminate */
217}
218
219/*
220 * Updates nextband to reflect a removed band (equivalent to
221 * calling ff_init_nextband_map after marking a band as zero)
222 */
223static inline void ff_nextband_remove(uint8_t *nextband, int prevband, int band)
224{
225 nextband[prevband] = nextband[band];
226}
227
228/*
229 * Checks whether the specified band could be removed without inducing
230 * scalefactor delta that violates SF delta encoding constraints.
231 * prev_sf has to be the scalefactor of the previous nonzero, nonspecial
232 * band, in encoding order, or negative if there was no such band.
233 */
234static inline int ff_sfdelta_can_remove_band(const SingleChannelElement *sce,
235 const uint8_t *nextband, int prev_sf, int band)
236{
237 return prev_sf >= 0
238 && sce->sf_idx[nextband[band]] >= (prev_sf - SCALE_MAX_DIFF)
239 && sce->sf_idx[nextband[band]] <= (prev_sf + SCALE_MAX_DIFF);
240}
241
242/*
243 * Checks whether the specified band's scalefactor could be replaced
244 * with another one without violating SF delta encoding constraints.
245 * prev_sf has to be the scalefactor of the previous nonzero, nonsepcial
246 * band, in encoding order, or negative if there was no such band.
247 */
248static inline int ff_sfdelta_can_replace(const SingleChannelElement *sce,
249 const uint8_t *nextband, int prev_sf, int new_sf, int band)
250{
251 return new_sf >= (prev_sf - SCALE_MAX_DIFF)
252 && new_sf <= (prev_sf + SCALE_MAX_DIFF)
253 && sce->sf_idx[nextband[band]] >= (new_sf - SCALE_MAX_DIFF)
254 && sce->sf_idx[nextband[band]] <= (new_sf + SCALE_MAX_DIFF);
255}
256
194#define ERROR_IF(cond, ...) \257#define ERROR_IF(cond, ...) \
195 if (cond) { \258 if (cond) { \
196 av_log(avctx, AV_LOG_ERROR, __VA_ARGS__); \259 av_log(avctx, AV_LOG_ERROR, __VA_ARGS__); \
libavcodec/aacpsy.c+13−7
@@ -305,7 +305,7 @@ static av_cold int psy_3gpp_init(FFPsyContext *ctx) { · 304 unmodified lines
305 float prev, minscale, minath, minsnr, pe_min;305 float prev, minscale, minath, minsnr, pe_min;
306 int chan_bitrate = ctx->avctx->bit_rate / ((ctx->avctx->flags & CODEC_FLAG_QSCALE) ? 2.0f : ctx->avctx->channels);306 int chan_bitrate = ctx->avctx->bit_rate / ((ctx->avctx->flags & CODEC_FLAG_QSCALE) ? 2.0f : ctx->avctx->channels);
307 307
308 const int bandwidth = ctx->avctx->cutoff ? ctx->avctx->cutoff : AAC_CUTOFF(ctx->avctx);308 const int bandwidth = ctx->cutoff ? ctx->cutoff : AAC_CUTOFF(ctx->avctx);
309 const float num_bark = calc_bark((float)bandwidth);309 const float num_bark = calc_bark((float)bandwidth);
310 310
311 ctx->model_priv_data = av_mallocz(sizeof(AacPsyContext));311 ctx->model_priv_data = av_mallocz(sizeof(AacPsyContext));
@@ -595,26 +595,30 @@ static float calc_reduced_thr_3gpp(AacPsyBand *band, float min_snr, · 283 unmodified lines
595 595
596#ifndef calc_thr_3gpp596#ifndef calc_thr_3gpp
597static void calc_thr_3gpp(const FFPsyWindowInfo *wi, const int num_bands, AacPsyChannel *pch,597static void calc_thr_3gpp(const FFPsyWindowInfo *wi, const int num_bands, AacPsyChannel *pch,
598 const uint8_t *band_sizes, const float *coefs)598 const uint8_t *band_sizes, const float *coefs, const int cutoff)
599{599{
600 int i, w, g;600 int i, w, g;
601 int start = 0;601 int start = 0, wstart = 0;
602 for (w = 0; w < wi->num_windows*16; w += 16) {602 for (w = 0; w < wi->num_windows*16; w += 16) {
603 wstart = 0;
603 for (g = 0; g < num_bands; g++) {604 for (g = 0; g < num_bands; g++) {
604 AacPsyBand *band = &pch->band[w+g];605 AacPsyBand *band = &pch->band[w+g];
605 606
606 float form_factor = 0.0f;607 float form_factor = 0.0f;
607 float Temp;608 float Temp;
608 band->energy = 0.0f;609 band->energy = 0.0f;
609 for (i = 0; i < band_sizes[g]; i++) {610 if (wstart < cutoff) {
610 band->energy += coefs[start+i] * coefs[start+i];611 for (i = 0; i < band_sizes[g]; i++) {
611 form_factor += sqrtf(fabs(coefs[start+i]));612 band->energy += coefs[start+i] * coefs[start+i];
613 form_factor += sqrtf(fabs(coefs[start+i]));
614 }
612 }615 }
613 Temp = band->energy > 0 ? sqrtf((float)band_sizes[g] / band->energy) : 0;616 Temp = band->energy > 0 ? sqrtf((float)band_sizes[g] / band->energy) : 0;
614 band->thr = band->energy * 0.001258925f;617 band->thr = band->energy * 0.001258925f;
615 band->nz_lines = form_factor * sqrtf(Temp);618 band->nz_lines = form_factor * sqrtf(Temp);
616 619
617 start += band_sizes[g];620 start += band_sizes[g];
621 wstart += band_sizes[g];
618 }622 }
619 }623 }
620}624}
@@ -655,9 +659,11 @@ static void psy_3gpp_analyze_channel(FFPsyContext *ctx, int channel, · 34 unmodified lines
655 const uint8_t *band_sizes = ctx->bands[wi->num_windows == 8];659 const uint8_t *band_sizes = ctx->bands[wi->num_windows == 8];
656 AacPsyCoeffs *coeffs = pctx->psy_coef[wi->num_windows == 8];660 AacPsyCoeffs *coeffs = pctx->psy_coef[wi->num_windows == 8];
657 const float avoid_hole_thr = wi->num_windows == 8 ? PSY_3GPP_AH_THR_SHORT : PSY_3GPP_AH_THR_LONG;661 const float avoid_hole_thr = wi->num_windows == 8 ? PSY_3GPP_AH_THR_SHORT : PSY_3GPP_AH_THR_LONG;
662 const int bandwidth = ctx->cutoff ? ctx->cutoff : AAC_CUTOFF(ctx->avctx);
663 const int cutoff = bandwidth * 2048 / wi->num_windows / ctx->avctx->sample_rate;
658 664
659 //calculate energies, initial thresholds and related values - 5.4.2 "Threshold Calculation"665 //calculate energies, initial thresholds and related values - 5.4.2 "Threshold Calculation"
660 calc_thr_3gpp(wi, num_bands, pch, band_sizes, coefs);666 calc_thr_3gpp(wi, num_bands, pch, band_sizes, coefs, cutoff);
661 667
662 //modify thresholds and energies - spread, threshold in quiet, pre-echo control668 //modify thresholds and energies - spread, threshold in quiet, pre-echo control
663 for (w = 0; w < wi->num_windows*16; w += 16) {669 for (w = 0; w < wi->num_windows*16; w += 16) {
libavcodec/mips/aaccoder_mips.c+117−55
@@ -2336,74 +2336,136 @@ static float quantize_band_cost(struct AACEncContext *s, const float *in, · 2335 unmodified lines
2336 2336
2337static void search_for_ms_mips(AACEncContext *s, ChannelElement *cpe)2337static void search_for_ms_mips(AACEncContext *s, ChannelElement *cpe)
2338{2338{
2339 int start = 0, i, w, w2, g;2339 int start = 0, i, w, w2, g, sid_sf_boost, prev_mid, prev_side;
2340 uint8_t nextband0[128], nextband1[128];
2340 float M[128], S[128];2341 float M[128], S[128];
2341 float *L34 = s->scoefs, *R34 = s->scoefs + 128, *M34 = s->scoefs + 128*2, *S34 = s->scoefs + 128*3;2342 float *L34 = s->scoefs, *R34 = s->scoefs + 128, *M34 = s->scoefs + 128*2, *S34 = s->scoefs + 128*3;
2342 const float lambda = s->lambda;2343 const float lambda = s->lambda;
2344 const float mslambda = FFMIN(1.0f, lambda / 120.f);
2343 SingleChannelElement *sce0 = &cpe->ch[0];2345 SingleChannelElement *sce0 = &cpe->ch[0];
2344 SingleChannelElement *sce1 = &cpe->ch[1];2346 SingleChannelElement *sce1 = &cpe->ch[1];
2345 if (!cpe->common_window)2347 if (!cpe->common_window)
2346 return;2348 return;
2349
2350 /** Scout out next nonzero bands */
2351 ff_init_nextband_map(sce0, nextband0);
2352 ff_init_nextband_map(sce1, nextband1);
2353
2354 prev_mid = sce0->sf_idx[0];
2355 prev_side = sce1->sf_idx[0];
2347 for (w = 0; w < sce0->ics.num_windows; w += sce0->ics.group_len[w]) {2356 for (w = 0; w < sce0->ics.num_windows; w += sce0->ics.group_len[w]) {
2348 start = 0;2357 start = 0;
2349 for (g = 0; g < sce0->ics.num_swb; g++) {2358 for (g = 0; g < sce0->ics.num_swb; g++) {
2350 if (!cpe->ch[0].zeroes[w*16+g] && !cpe->ch[1].zeroes[w*16+g]) {2359 float bmax = bval2bmax(g * 17.0f / sce0->ics.num_swb) / 0.0045f;
2351 float dist1 = 0.0f, dist2 = 0.0f;2360 cpe->ms_mask[w*16+g] = 0;
2361 if (!sce0->zeroes[w*16+g] && !sce1->zeroes[w*16+g]) {
2362 float Mmax = 0.0f, Smax = 0.0f;
2363
2364 /* Must compute mid/side SF and book for the whole window group */
2352 for (w2 = 0; w2 < sce0->ics.group_len[w]; w2++) {2365 for (w2 = 0; w2 < sce0->ics.group_len[w]; w2++) {
2353 FFPsyBand *band0 = &s->psy.ch[s->cur_channel+0].psy_bands[(w+w2)*16+g];2366 for (i = 0; i < sce0->ics.swb_sizes[g]; i++) {
2354 FFPsyBand *band1 = &s->psy.ch[s->cur_channel+1].psy_bands[(w+w2)*16+g];2367 M[i] = (sce0->coeffs[start+(w+w2)*128+i]
2355 float minthr = FFMIN(band0->threshold, band1->threshold);2368 + sce1->coeffs[start+(w+w2)*128+i]) * 0.5;
2356 float maxthr = FFMAX(band0->threshold, band1->threshold);2369 S[i] = M[i]
2357 for (i = 0; i < sce0->ics.swb_sizes[g]; i+=4) {2370 - sce1->coeffs[start+(w+w2)*128+i];
2358 M[i ] = (sce0->coeffs[start+w2*128+i ]2371 }
2359 + sce1->coeffs[start+w2*128+i ]) * 0.5;2372 abs_pow34_v(M34, M, sce0->ics.swb_sizes[g]);
2360 M[i+1] = (sce0->coeffs[start+w2*128+i+1]2373 abs_pow34_v(S34, S, sce0->ics.swb_sizes[g]);
2361 + sce1->coeffs[start+w2*128+i+1]) * 0.5;2374 for (i = 0; i < sce0->ics.swb_sizes[g]; i++ ) {
2362 M[i+2] = (sce0->coeffs[start+w2*128+i+2]2375 Mmax = FFMAX(Mmax, M34[i]);
2363 + sce1->coeffs[start+w2*128+i+2]) * 0.5;2376 Smax = FFMAX(Smax, S34[i]);
2364 M[i+3] = (sce0->coeffs[start+w2*128+i+3]2377 }
2365 + sce1->coeffs[start+w2*128+i+3]) * 0.5;2378 }
2366 2379
2367 S[i ] = M[i ]2380 for (sid_sf_boost = 0; sid_sf_boost < 4; sid_sf_boost++) {
2368 - sce1->coeffs[start+w2*128+i ];2381 float dist1 = 0.0f, dist2 = 0.0f;
2369 S[i+1] = M[i+1]2382 int B0 = 0, B1 = 0;
2370 - sce1->coeffs[start+w2*128+i+1];2383 int minidx;
2371 S[i+2] = M[i+2]2384 int mididx, sididx;
2372 - sce1->coeffs[start+w2*128+i+2];2385 int midcb, sidcb;
2373 S[i+3] = M[i+3]2386
2374 - sce1->coeffs[start+w2*128+i+3];2387 minidx = FFMIN(sce0->sf_idx[w*16+g], sce1->sf_idx[w*16+g]);
2375 }2388 mididx = av_clip(minidx, 0, SCALE_MAX_POS - SCALE_DIV_512);
2376 abs_pow34_v(L34, sce0->coeffs+start+(w+w2)*128, sce0->ics.swb_sizes[g]);2389 sididx = av_clip(minidx - sid_sf_boost * 3, 0, SCALE_MAX_POS - SCALE_DIV_512);
2377 abs_pow34_v(R34, sce1->coeffs+start+(w+w2)*128, sce0->ics.swb_sizes[g]);2390 if (!cpe->is_mask[w*16+g] && sce0->band_type[w*16+g] != NOISE_BT && sce1->band_type[w*16+g] != NOISE_BT
2378 abs_pow34_v(M34, M, sce0->ics.swb_sizes[g]);2391 && ( !ff_sfdelta_can_replace(sce0, nextband0, prev_mid, mididx, w*16+g)
2379 abs_pow34_v(S34, S, sce0->ics.swb_sizes[g]);2392 || !ff_sfdelta_can_replace(sce1, nextband1, prev_side, sididx, w*16+g))) {
2380 dist1 += quantize_band_cost(s, &sce0->coeffs[start + (w+w2)*128],2393 /* scalefactor range violation, bad stuff, will decrease quality unacceptably */
2381 L34,2394 continue;
2382 sce0->ics.swb_sizes[g],2395 }
2383 sce0->sf_idx[(w+w2)*16+g],2396
2384 sce0->band_type[(w+w2)*16+g],2397 midcb = find_min_book(Mmax, mididx);
2385 lambda / band0->threshold, INFINITY, NULL, NULL, 0);2398 sidcb = find_min_book(Smax, sididx);
2386 dist1 += quantize_band_cost(s, &sce1->coeffs[start + (w+w2)*128],2399
2387 R34,2400 /* No CB can be zero */
2388 sce1->ics.swb_sizes[g],2401 midcb = FFMAX(1,midcb);
2389 sce1->sf_idx[(w+w2)*16+g],2402 sidcb = FFMAX(1,sidcb);
2390 sce1->band_type[(w+w2)*16+g],2403
2391 lambda / band1->threshold, INFINITY, NULL, NULL, 0);2404 for (w2 = 0; w2 < sce0->ics.group_len[w]; w2++) {
2392 dist2 += quantize_band_cost(s, M,2405 FFPsyBand *band0 = &s->psy.ch[s->cur_channel+0].psy_bands[(w+w2)*16+g];
2393 M34,2406 FFPsyBand *band1 = &s->psy.ch[s->cur_channel+1].psy_bands[(w+w2)*16+g];
2394 sce0->ics.swb_sizes[g],2407 float minthr = FFMIN(band0->threshold, band1->threshold);
2395 sce0->sf_idx[(w+w2)*16+g],2408 int b1,b2,b3,b4;
2396 sce0->band_type[(w+w2)*16+g],2409 for (i = 0; i < sce0->ics.swb_sizes[g]; i++) {
2397 lambda / maxthr, INFINITY, NULL, NULL, 0);2410 M[i] = (sce0->coeffs[start+(w+w2)*128+i]
2398 dist2 += quantize_band_cost(s, S,2411 + sce1->coeffs[start+(w+w2)*128+i]) * 0.5;
2399 S34,2412 S[i] = M[i]
2400 sce1->ics.swb_sizes[g],2413 - sce1->coeffs[start+(w+w2)*128+i];
2401 sce1->sf_idx[(w+w2)*16+g],2414 }
2402 sce1->band_type[(w+w2)*16+g],2415
2403 lambda / minthr, INFINITY, NULL, NULL, 0);2416 abs_pow34_v(L34, sce0->coeffs+start+(w+w2)*128, sce0->ics.swb_sizes[g]);
2417 abs_pow34_v(R34, sce1->coeffs+start+(w+w2)*128, sce0->ics.swb_sizes[g]);
2418 abs_pow34_v(M34, M, sce0->ics.swb_sizes[g]);
2419 abs_pow34_v(S34, S, sce0->ics.swb_sizes[g]);
2420 dist1 += quantize_band_cost(s, &sce0->coeffs[start + (w+w2)*128],
2421 L34,
2422 sce0->ics.swb_sizes[g],
2423 sce0->sf_idx[(w+w2)*16+g],
2424 sce0->band_type[(w+w2)*16+g],
2425 lambda / band0->threshold, INFINITY, &b1, NULL, 0);
2426 dist1 += quantize_band_cost(s, &sce1->coeffs[start + (w+w2)*128],
2427 R34,
2428 sce1->ics.swb_sizes[g],
2429 sce1->sf_idx[(w+w2)*16+g],
2430 sce1->band_type[(w+w2)*16+g],
2431 lambda / band1->threshold, INFINITY, &b2, NULL, 0);
2432 dist2 += quantize_band_cost(s, M,
2433 M34,
2434 sce0->ics.swb_sizes[g],
2435 sce0->sf_idx[(w+w2)*16+g],
2436 sce0->band_type[(w+w2)*16+g],
2437 lambda / minthr, INFINITY, &b3, NULL, 0);
2438 dist2 += quantize_band_cost(s, S,
2439 S34,
2440 sce1->ics.swb_sizes[g],
2441 sce1->sf_idx[(w+w2)*16+g],
2442 sce1->band_type[(w+w2)*16+g],
2443 mslambda / (minthr * bmax), INFINITY, &b4, NULL, 0);
2444 B0 += b1+b2;
2445 B1 += b3+b4;
2446 dist1 -= B0;
2447 dist2 -= B1;
2448 }
2449 cpe->ms_mask[w*16+g] = dist2 <= dist1 && B1 < B0;
2450 if (cpe->ms_mask[w*16+g]) {
2451 /* Setting the M/S mask is useful with I/S or PNS, but only the flag */
2452 if (!cpe->is_mask[w*16+g] && sce0->band_type[w*16+g] != NOISE_BT && sce1->band_type[w*16+g] != NOISE_BT) {
2453 sce0->sf_idx[w*16+g] = mididx;
2454 sce1->sf_idx[w*16+g] = sididx;
2455 sce0->band_type[w*16+g] = midcb;
2456 sce1->band_type[w*16+g] = sidcb;
2457 }
2458 break;
2459 } else if (B1 > B0) {
2460 /* More boost won't fix this */
2461 break;
2462 }
2404 }2463 }
2405 cpe->ms_mask[w*16+g] = dist2 < dist1;
2406 }2464 }
2465 if (!sce0->zeroes[w*16+g] && sce0->band_type[w*16+g] < RESERVED_BT)
2466 prev_mid = sce0->sf_idx[w*16+g];
2467 if (!sce1->zeroes[w*16+g] && !cpe->is_mask[w*16+g] && sce1->band_type[w*16+g] < RESERVED_BT)
2468 prev_side = sce1->sf_idx[w*16+g];
2407 start += sce0->ics.swb_sizes[g];2469 start += sce0->ics.swb_sizes[g];
2408 }2470 }
2409 }2471 }
libavcodec/mips/aacpsy_mips.h+41−37
@@ -61,58 +61,62 @@ · 60 unmodified lines
61#if HAVE_INLINE_ASM && HAVE_MIPSFPU && ( PSY_LAME_FIR_LEN == 21 )61#if HAVE_INLINE_ASM && HAVE_MIPSFPU && ( PSY_LAME_FIR_LEN == 21 )
62static void calc_thr_3gpp_mips(const FFPsyWindowInfo *wi, const int num_bands,62static void calc_thr_3gpp_mips(const FFPsyWindowInfo *wi, const int num_bands,
63 AacPsyChannel *pch, const uint8_t *band_sizes,63 AacPsyChannel *pch, const uint8_t *band_sizes,
64 const float *coefs)64 const float *coefs, const int cutoff)
65{65{
66 int i, w, g;66 int i, w, g;
67 int start = 0;67 int start = 0, wstart = 0;
68 for (w = 0; w < wi->num_windows*16; w += 16) {68 for (w = 0; w < wi->num_windows*16; w += 16) {
69 wstart = 0;
69 for (g = 0; g < num_bands; g++) {70 for (g = 0; g < num_bands; g++) {
70 AacPsyBand *band = &pch->band[w+g];71 AacPsyBand *band = &pch->band[w+g];
71 72
72 float form_factor = 0.0f;73 float form_factor = 0.0f;
73 float Temp;74 float Temp;
74 band->energy = 0.0f;75 band->energy = 0.0f;
75 for (i = 0; i < band_sizes[g]; i+=4) {76 if (wstart < cutoff) {
76 float a, b, c, d;77 for (i = 0; i < band_sizes[g]; i+=4) {
77 float ax, bx, cx, dx;78 float a, b, c, d;
78 float *cf = (float *)&coefs[start+i];79 float ax, bx, cx, dx;
79 80 float *cf = (float *)&coefs[start+i];
80 __asm__ volatile (81
81 "lwc1 %[a], 0(%[cf]) \n\t"82 __asm__ volatile (
82 "lwc1 %[b], 4(%[cf]) \n\t"83 "lwc1 %[a], 0(%[cf]) \n\t"
83 "lwc1 %[c], 8(%[cf]) \n\t"84 "lwc1 %[b], 4(%[cf]) \n\t"
84 "lwc1 %[d], 12(%[cf]) \n\t"85 "lwc1 %[c], 8(%[cf]) \n\t"
85 "abs.s %[a], %[a] \n\t"86 "lwc1 %[d], 12(%[cf]) \n\t"
86 "abs.s %[b], %[b] \n\t"87 "abs.s %[a], %[a] \n\t"
87 "abs.s %[c], %[c] \n\t"88 "abs.s %[b], %[b] \n\t"
88 "abs.s %[d], %[d] \n\t"89 "abs.s %[c], %[c] \n\t"
89 "sqrt.s %[ax], %[a] \n\t"90 "abs.s %[d], %[d] \n\t"
90 "sqrt.s %[bx], %[b] \n\t"91 "sqrt.s %[ax], %[a] \n\t"
91 "sqrt.s %[cx], %[c] \n\t"92 "sqrt.s %[bx], %[b] \n\t"
92 "sqrt.s %[dx], %[d] \n\t"93 "sqrt.s %[cx], %[c] \n\t"
93 "madd.s %[e], %[e], %[a], %[a] \n\t"94 "sqrt.s %[dx], %[d] \n\t"
94 "madd.s %[e], %[e], %[b], %[b] \n\t"95 "madd.s %[e], %[e], %[a], %[a] \n\t"
95 "madd.s %[e], %[e], %[c], %[c] \n\t"96 "madd.s %[e], %[e], %[b], %[b] \n\t"
96 "madd.s %[e], %[e], %[d], %[d] \n\t"97 "madd.s %[e], %[e], %[c], %[c] \n\t"
97 "add.s %[f], %[f], %[ax] \n\t"98 "madd.s %[e], %[e], %[d], %[d] \n\t"
98 "add.s %[f], %[f], %[bx] \n\t"99 "add.s %[f], %[f], %[ax] \n\t"
99 "add.s %[f], %[f], %[cx] \n\t"100 "add.s %[f], %[f], %[bx] \n\t"
100 "add.s %[f], %[f], %[dx] \n\t"101 "add.s %[f], %[f], %[cx] \n\t"
101 102 "add.s %[f], %[f], %[dx] \n\t"
102 : [a]"=&f"(a), [b]"=&f"(b),103
103 [c]"=&f"(c), [d]"=&f"(d),104 : [a]"=&f"(a), [b]"=&f"(b),
104 [e]"+f"(band->energy), [f]"+f"(form_factor),105 [c]"=&f"(c), [d]"=&f"(d),
105 [ax]"=&f"(ax), [bx]"=&f"(bx),106 [e]"+f"(band->energy), [f]"+f"(form_factor),
106 [cx]"=&f"(cx), [dx]"=&f"(dx)107 [ax]"=&f"(ax), [bx]"=&f"(bx),
107 : [cf]"r"(cf)108 [cx]"=&f"(cx), [dx]"=&f"(dx)
108 : "memory"109 : [cf]"r"(cf)
109 );110 : "memory"
111 );
112 }
110 }113 }
111 114
112 Temp = sqrtf((float)band_sizes[g] / band->energy);115 Temp = sqrtf((float)band_sizes[g] / band->energy);
113 band->thr = band->energy * 0.001258925f;116 band->thr = band->energy * 0.001258925f;
114 band->nz_lines = form_factor * sqrtf(Temp);117 band->nz_lines = form_factor * sqrtf(Temp);
115 start += band_sizes[g];118 start += band_sizes[g];
119 wstart += band_sizes[g];
116 }120 }
117 }121 }
118}122}
libavcodec/psymodel.c+1−0
@@ -39,6 +39,7 @@ av_cold int ff_psy_init(FFPsyContext *ctx, AVCodecContext *avctx, int num_lens, · 38 unmodified lines
39 ctx->group = av_mallocz_array(sizeof(ctx->group[0]), num_groups);39 ctx->group = av_mallocz_array(sizeof(ctx->group[0]), num_groups);
40 ctx->bands = av_malloc_array (sizeof(ctx->bands[0]), num_lens);40 ctx->bands = av_malloc_array (sizeof(ctx->bands[0]), num_lens);
41 ctx->num_bands = av_malloc_array (sizeof(ctx->num_bands[0]), num_lens);41 ctx->num_bands = av_malloc_array (sizeof(ctx->num_bands[0]), num_lens);
42 ctx->cutoff = avctx->cutoff;
42 43
43 if (!ctx->ch || !ctx->group || !ctx->bands || !ctx->num_bands) {44 if (!ctx->ch || !ctx->group || !ctx->bands || !ctx->num_bands) {
44 ff_psy_end(ctx);45 ff_psy_end(ctx);
libavcodec/psymodel.h+1−0
@@ -93,6 +93,7 @@ typedef struct FFPsyContext { · 92 unmodified lines
93 FFPsyChannel *ch; ///< single channel information93 FFPsyChannel *ch; ///< single channel information
94 FFPsyChannelGroup *group; ///< channel group information94 FFPsyChannelGroup *group; ///< channel group information
95 int num_groups; ///< number of channel groups95 int num_groups; ///< number of channel groups
96 int cutoff; ///< lowpass frequency cutoff for analysis
96 97
97 uint8_t **bands; ///< scalefactor band sizes for possible frame sizes98 uint8_t **bands; ///< scalefactor band sizes for possible frame sizes
98 int *num_bands; ///< number of scalefactor bands for possible frame sizes99 int *num_bands; ///< number of scalefactor bands for possible frame sizes
tests/fate/aac.mak+13−13
@@ -146,16 +146,16 @@ fate-aac-aref-encode: CMD = enc_dec_pcm adts wav s16le $(REF) -strict -2 -c:a aa · 145 unmodified lines
146fate-aac-aref-encode: CMP = stddev146fate-aac-aref-encode: CMP = stddev
147fate-aac-aref-encode: REF = ./tests/data/asynth-44100-2.wav147fate-aac-aref-encode: REF = ./tests/data/asynth-44100-2.wav
148fate-aac-aref-encode: CMP_SHIFT = -4096148fate-aac-aref-encode: CMP_SHIFT = -4096
149fate-aac-aref-encode: CMP_TARGET = 1139149fate-aac-aref-encode: CMP_TARGET = 670
150fate-aac-aref-encode: SIZE_TOLERANCE = 2464150fate-aac-aref-encode: SIZE_TOLERANCE = 2464
151fate-aac-aref-encode: FUZZ = 6151fate-aac-aref-encode: FUZZ = 89
152 152
153FATE_AAC_ENCODE += fate-aac-ln-encode153FATE_AAC_ENCODE += fate-aac-ln-encode
154fate-aac-ln-encode: CMD = enc_dec_pcm adts wav s16le $(TARGET_SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav -strict -2 -c:a aac -aac_is 0 -aac_pns 0 -aac_ms 0 -aac_tns 0 -b:a 512k154fate-aac-ln-encode: CMD = enc_dec_pcm adts wav s16le $(TARGET_SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav -strict -2 -c:a aac -aac_is 0 -aac_pns 0 -aac_ms 0 -aac_tns 0 -b:a 512k
155fate-aac-ln-encode: CMP = stddev155fate-aac-ln-encode: CMP = stddev
156fate-aac-ln-encode: REF = $(SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav156fate-aac-ln-encode: REF = $(SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav
157fate-aac-ln-encode: CMP_SHIFT = -4096157fate-aac-ln-encode: CMP_SHIFT = -4096
158fate-aac-ln-encode: CMP_TARGET = 80158fate-aac-ln-encode: CMP_TARGET = 50
159fate-aac-ln-encode: SIZE_TOLERANCE = 3560159fate-aac-ln-encode: SIZE_TOLERANCE = 3560
160fate-aac-ln-encode: FUZZ = 30160fate-aac-ln-encode: FUZZ = 30
161 161
@@ -164,7 +164,7 @@ fate-aac-ln-encode-128k: CMD = enc_dec_pcm adts wav s16le $(TARGET_SAMPLES)/audi · 2 unmodified lines
164fate-aac-ln-encode-128k: CMP = stddev164fate-aac-ln-encode-128k: CMP = stddev
165fate-aac-ln-encode-128k: REF = $(SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav165fate-aac-ln-encode-128k: REF = $(SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav
166fate-aac-ln-encode-128k: CMP_SHIFT = -4096166fate-aac-ln-encode-128k: CMP_SHIFT = -4096
167fate-aac-ln-encode-128k: CMP_TARGET = 745167fate-aac-ln-encode-128k: CMP_TARGET = 798
168fate-aac-ln-encode-128k: SIZE_TOLERANCE = 3560168fate-aac-ln-encode-128k: SIZE_TOLERANCE = 3560
169fate-aac-ln-encode-128k: FUZZ = 5169fate-aac-ln-encode-128k: FUZZ = 5
170 170
@@ -173,16 +173,16 @@ fate-aac-pns-encode: CMD = enc_dec_pcm adts wav s16le $(TARGET_SAMPLES)/audio-re · 2 unmodified lines
173fate-aac-pns-encode: CMP = stddev173fate-aac-pns-encode: CMP = stddev
174fate-aac-pns-encode: REF = $(SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav174fate-aac-pns-encode: REF = $(SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav
175fate-aac-pns-encode: CMP_SHIFT = -4096175fate-aac-pns-encode: CMP_SHIFT = -4096
176fate-aac-pns-encode: CMP_TARGET = 695176fate-aac-pns-encode: CMP_TARGET = 663
177fate-aac-pns-encode: SIZE_TOLERANCE = 3560177fate-aac-pns-encode: SIZE_TOLERANCE = 3560
178fate-aac-pns-encode: FUZZ = 25178fate-aac-pns-encode: FUZZ = 72
179 179
180FATE_AAC_ENCODE += fate-aac-tns-encode180FATE_AAC_ENCODE += fate-aac-tns-encode
181fate-aac-tns-encode: CMD = enc_dec_pcm adts wav s16le $(TARGET_SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav -strict -2 -c:a aac -aac_tns 1 -aac_is 0 -aac_pns 0 -aac_ms 0 -b:a 128k -cutoff 22050181fate-aac-tns-encode: CMD = enc_dec_pcm adts wav s16le $(TARGET_SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav -strict -2 -c:a aac -aac_tns 1 -aac_is 0 -aac_pns 0 -aac_ms 0 -b:a 128k -cutoff 22050
182fate-aac-tns-encode: CMP = stddev182fate-aac-tns-encode: CMP = stddev
183fate-aac-tns-encode: REF = $(SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav183fate-aac-tns-encode: REF = $(SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav
184fate-aac-tns-encode: CMP_SHIFT = -4096184fate-aac-tns-encode: CMP_SHIFT = -4096
185fate-aac-tns-encode: CMP_TARGET = 766185fate-aac-tns-encode: CMP_TARGET = 857
186fate-aac-tns-encode: FUZZ = 6186fate-aac-tns-encode: FUZZ = 6
187fate-aac-tns-encode: SIZE_TOLERANCE = 3560187fate-aac-tns-encode: SIZE_TOLERANCE = 3560
188 188
@@ -191,25 +191,25 @@ fate-aac-is-encode: CMD = enc_dec_pcm adts wav s16le $(TARGET_SAMPLES)/audio-ref · 2 unmodified lines
191fate-aac-is-encode: CMP = stddev191fate-aac-is-encode: CMP = stddev
192fate-aac-is-encode: REF = $(SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav192fate-aac-is-encode: REF = $(SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav
193fate-aac-is-encode: CMP_SHIFT = -4096193fate-aac-is-encode: CMP_SHIFT = -4096
194fate-aac-is-encode: CMP_TARGET = 584194fate-aac-is-encode: CMP_TARGET = 725
195fate-aac-is-encode: SIZE_TOLERANCE = 3560195fate-aac-is-encode: SIZE_TOLERANCE = 3560
196fate-aac-is-encode: FUZZ = 1196fate-aac-is-encode: FUZZ = 5
197 197
198FATE_AAC_ENCODE += fate-aac-ms-encode198FATE_AAC_ENCODE += fate-aac-ms-encode
199fate-aac-ms-encode: CMD = enc_dec_pcm adts wav s16le $(TARGET_SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav -strict -2 -c:a aac -aac_pns 0 -aac_is 0 -aac_ms 1 -aac_tns 0 -b:a 128k -cutoff 22050199fate-aac-ms-encode: CMD = enc_dec_pcm adts wav s16le $(TARGET_SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav -strict -2 -c:a aac -aac_pns 0 -aac_is 0 -aac_ms 1 -aac_tns 0 -b:a 128k -cutoff 22050
200fate-aac-ms-encode: CMP = stddev200fate-aac-ms-encode: CMP = stddev
201fate-aac-ms-encode: REF = $(SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav201fate-aac-ms-encode: REF = $(SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav
202fate-aac-ms-encode: CMP_SHIFT = -4096202fate-aac-ms-encode: CMP_SHIFT = -4096
203fate-aac-ms-encode: CMP_TARGET = 615203fate-aac-ms-encode: CMP_TARGET = 682
204fate-aac-ms-encode: SIZE_TOLERANCE = 3560204fate-aac-ms-encode: SIZE_TOLERANCE = 3560
205fate-aac-ms-encode: FUZZ = 10205fate-aac-ms-encode: FUZZ = 15
206 206
207FATE_AAC_ENCODE += fate-aac-ltp-encode207FATE_AAC_ENCODE += fate-aac-ltp-encode
208fate-aac-ltp-encode: CMD = enc_dec_pcm adts wav s16le $(TARGET_SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav -strict -2 -c:a aac -profile:a aac_ltp -aac_pns 0 -aac_is 0 -aac_ms 0 -aac_tns 0 -b:a 36k -fflags +bitexact -flags +bitexact208fate-aac-ltp-encode: CMD = enc_dec_pcm adts wav s16le $(TARGET_SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav -strict -2 -c:a aac -profile:a aac_ltp -aac_pns 0 -aac_is 0 -aac_ms 0 -aac_tns 0 -b:a 36k -fflags +bitexact -flags +bitexact
209fate-aac-ltp-encode: CMP = stddev209fate-aac-ltp-encode: CMP = stddev
210fate-aac-ltp-encode: REF = $(SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav210fate-aac-ltp-encode: REF = $(SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav
211fate-aac-ltp-encode: CMP_SHIFT = -4096211fate-aac-ltp-encode: CMP_SHIFT = -4096
212fate-aac-ltp-encode: CMP_TARGET = 1120212fate-aac-ltp-encode: CMP_TARGET = 1284
213fate-aac-ltp-encode: SIZE_TOLERANCE = 3560213fate-aac-ltp-encode: SIZE_TOLERANCE = 3560
214fate-aac-ltp-encode: FUZZ = 17214fate-aac-ltp-encode: FUZZ = 17
215 215
@@ -218,7 +218,7 @@ fate-aac-pred-encode: CMD = enc_dec_pcm adts wav s16le $(TARGET_SAMPLES)/audio-r · 2 unmodified lines
218fate-aac-pred-encode: CMP = stddev218fate-aac-pred-encode: CMP = stddev
219fate-aac-pred-encode: REF = $(SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav219fate-aac-pred-encode: REF = $(SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav
220fate-aac-pred-encode: CMP_SHIFT = -4096220fate-aac-pred-encode: CMP_SHIFT = -4096
221fate-aac-pred-encode: CMP_TARGET = 790221fate-aac-pred-encode: CMP_TARGET = 835
222fate-aac-pred-encode: FUZZ = 12222fate-aac-pred-encode: FUZZ = 12
223fate-aac-pred-encode: SIZE_TOLERANCE = 3560223fate-aac-pred-encode: SIZE_TOLERANCE = 3560
224 224

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t