From d2ae5f77c61a29c3c63cc4c41c74ccfca4167649 Mon Sep 17 00:00:00 2001 From: Rostislav Pehlivanov Date: Sat, 8 Oct 2016 15:59:14 +0100 Subject: 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 Signed-off-by: Rostislav Pehlivanov Tested-by: Michael Niedermayer Reviewed-by: James Almer --- libavcodec/aacenc_pred.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'libavcodec/aacenc_pred.c') diff --git a/libavcodec/aacenc_pred.c b/libavcodec/aacenc_pred.c index e77a3de987..d111192f06 100644 --- a/libavcodec/aacenc_pred.c +++ b/libavcodec/aacenc_pred.c @@ -270,7 +270,7 @@ void ff_aac_search_for_pred(AACEncContext *s, SingleChannelElement *sce) continue; /* Normal coefficients */ - abs_pow34_v(O34, &sce->coeffs[start_coef], num_coeffs); + s->abs_pow34(O34, &sce->coeffs[start_coef], num_coeffs); dist1 = quantize_and_encode_band_cost(s, NULL, &sce->coeffs[start_coef], NULL, O34, num_coeffs, sce->sf_idx[sfb], cb_n, s->lambda / band->threshold, INFINITY, &cost1, NULL, 0); @@ -279,7 +279,7 @@ void ff_aac_search_for_pred(AACEncContext *s, SingleChannelElement *sce) /* Encoded coefficients - needed for #bits, band type and quant. error */ for (i = 0; i < num_coeffs; i++) SENT[i] = sce->coeffs[start_coef + i] - sce->prcoeffs[start_coef + i]; - abs_pow34_v(S34, SENT, num_coeffs); + s->abs_pow34(S34, SENT, num_coeffs); if (cb_n < RESERVED_BT) cb_p = av_clip(find_min_book(find_max_val(1, num_coeffs, S34), sce->sf_idx[sfb]), cb_min, cb_max); else @@ -291,7 +291,7 @@ void ff_aac_search_for_pred(AACEncContext *s, SingleChannelElement *sce) /* Reconstructed coefficients - needed for distortion measurements */ for (i = 0; i < num_coeffs; i++) sce->prcoeffs[start_coef + i] += QERR[i] != 0.0f ? (sce->prcoeffs[start_coef + i] - QERR[i]) : 0.0f; - abs_pow34_v(P34, &sce->prcoeffs[start_coef], num_coeffs); + s->abs_pow34(P34, &sce->prcoeffs[start_coef], num_coeffs); if (cb_n < RESERVED_BT) cb_p = av_clip(find_min_book(find_max_val(1, num_coeffs, P34), sce->sf_idx[sfb]), cb_min, cb_max); else -- cgit v1.2.1