History

aacenc: add SIMD optimizations for abs_pow34 and quantization

Performance improvements: quant_bands: with: 681 decicycles in quant_bands, 8388453 runs, 155 skips without: 1190 decicycles in quant_bands, 8388386 runs, 222 skips Around 42% for the function Twoloop coder: abs_pow34: with/without: 7.82s/8.17s Around 4% for the entire encoder Both: with/without: 7.15s/8.17s Around 12% for the entire encoder Fast coder: abs_pow34: with/without: 3.40s/3.77s Around 10% for the entire encoder Both: with/without: 3.02s/3.77s Around 20% faster for the entire encoder

Rostislav Pehlivanov committed 10 years ago

Commit d2ae5f71 parent 3b02f6d13 files · +170 −26Browse files

Showing the changes to libavcodec/aaccoder.c (1 of 13 files). Show all

Unified · Split

libavcodec/aaccoder.c+14−13
@@ -88,7 +88,7 @@ static void encode_window_bands_info(AACEncContext *s, SingleChannelElement *sce · 87 unmodified lines
8888 float next_minrd = INFINITY;
8989 int next_mincb = 0;
9090
91− abs_pow34_v(s->scoefs, sce->coeffs, 1024);
91+ s->abs_pow34(s->scoefs, sce->coeffs, 1024);
9292 start = win*128;
9393 for (cb = 0; cb < CB_TOT_ALL; cb++) {
9494 path[0][cb].cost = 0.0f;
@@ -299,7 +299,7 @@ static void search_for_quantizers_anmr(AVCodecContext *avctx, AACEncContext *s, · 204 unmodified lines
299299 }
300300 }
301301 idx = 1;
302− abs_pow34_v(s->scoefs, sce->coeffs, 1024);
302+ s->abs_pow34(s->scoefs, sce->coeffs, 1024);
303303 for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
304304 start = w*128;
305305 for (g = 0; g < sce->ics.num_swb; g++) {
@@ -446,7 +446,7 @@ static void search_for_quantizers_fast(AVCodecContext *avctx, AACEncContext *s, · 140 unmodified lines
446446
447447 if (!allz)
448448 return;
449− abs_pow34_v(s->scoefs, sce->coeffs, 1024);
449+ s->abs_pow34(s->scoefs, sce->coeffs, 1024);
450450 ff_quantize_band_cost_cache_init(s);
451451
452452 for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
@@ -652,8 +652,8 @@ static void search_for_pns(AACEncContext *s, AVCodecContext *avctx, SingleChanne · 199 unmodified lines
652652 s->fdsp->vector_fmul_scalar(PNS, PNS, scale, sce->ics.swb_sizes[g]);
653653 pns_senergy = s->fdsp->scalarproduct_float(PNS, PNS, sce->ics.swb_sizes[g]);
654654 pns_energy += pns_senergy;
655− abs_pow34_v(NOR34, &sce->coeffs[start_c], sce->ics.swb_sizes[g]);
656− abs_pow34_v(PNS34, PNS, sce->ics.swb_sizes[g]);
655+ s->abs_pow34(NOR34, &sce->coeffs[start_c], sce->ics.swb_sizes[g]);
656+ s->abs_pow34(PNS34, PNS, sce->ics.swb_sizes[g]);
657657 dist1 += quantize_band_cost(s, &sce->coeffs[start_c],
658658 NOR34,
659659 sce->ics.swb_sizes[g],
@@ -757,8 +757,9 @@ static void search_for_ms(AACEncContext *s, ChannelElement *cpe) · 97 unmodified lines
757757 {
758758 int start = 0, i, w, w2, g, sid_sf_boost, prev_mid, prev_side;
759759 uint8_t nextband0[128], nextband1[128];
760− float M[128], S[128];
761− float *L34 = s->scoefs, *R34 = s->scoefs + 128, *M34 = s->scoefs + 128*2, *S34 = s->scoefs + 128*3;
760+ float *M = s->scoefs + 128*0, *S = s->scoefs + 128*1;
761+ float *L34 = s->scoefs + 128*2, *R34 = s->scoefs + 128*3;
762+ float *M34 = s->scoefs + 128*4, *S34 = s->scoefs + 128*5;
762763 const float lambda = s->lambda;
763764 const float mslambda = FFMIN(1.0f, lambda / 120.f);
764765 SingleChannelElement *sce0 = &cpe->ch[0];
@@ -789,8 +790,8 @@ static void search_for_ms(AACEncContext *s, ChannelElement *cpe) · 24 unmodified lines
789790 S[i] = M[i]
790791 - sce1->coeffs[start+(w+w2)*128+i];
791792 }
792− abs_pow34_v(M34, M, sce0->ics.swb_sizes[g]);
793− abs_pow34_v(S34, S, sce0->ics.swb_sizes[g]);
793+ s->abs_pow34(M34, M, sce0->ics.swb_sizes[g]);
794+ s->abs_pow34(S34, S, sce0->ics.swb_sizes[g]);
794795 for (i = 0; i < sce0->ics.swb_sizes[g]; i++ ) {
795796 Mmax = FFMAX(Mmax, M34[i]);
796797 Smax = FFMAX(Smax, S34[i]);
@@ -833,10 +834,10 @@ static void search_for_ms(AACEncContext *s, ChannelElement *cpe) · 36 unmodified lines
833834 - sce1->coeffs[start+(w+w2)*128+i];
834835 }
835836
836− abs_pow34_v(L34, sce0->coeffs+start+(w+w2)*128, sce0->ics.swb_sizes[g]);
837− abs_pow34_v(R34, sce1->coeffs+start+(w+w2)*128, sce0->ics.swb_sizes[g]);
838− abs_pow34_v(M34, M, sce0->ics.swb_sizes[g]);
839− abs_pow34_v(S34, S, sce0->ics.swb_sizes[g]);
837+ s->abs_pow34(L34, sce0->coeffs+start+(w+w2)*128, sce0->ics.swb_sizes[g]);
838+ s->abs_pow34(R34, sce1->coeffs+start+(w+w2)*128, sce0->ics.swb_sizes[g]);
839+ s->abs_pow34(M34, M, sce0->ics.swb_sizes[g]);
840+ s->abs_pow34(S34, S, sce0->ics.swb_sizes[g]);
840841 dist1 += quantize_band_cost(s, &sce0->coeffs[start + (w+w2)*128],
841842 L34,
842843 sce0->ics.swb_sizes[g],

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