From aac46e088d67a390489af686b846dea4987d8ffb Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Thu, 12 Jan 2012 00:17:45 +0000 Subject: aacsbr: move some simdable loops to function pointers This prepares for assembly optimisations by moving the most time-consuming loops to functions called through pointers in a new context. Signed-off-by: Mans Rullgard --- libavcodec/sbr.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'libavcodec/sbr.h') diff --git a/libavcodec/sbr.h b/libavcodec/sbr.h index 5b0f334219..58f4b61341 100644 --- a/libavcodec/sbr.h +++ b/libavcodec/sbr.h @@ -32,6 +32,7 @@ #include #include "fft.h" #include "aacps.h" +#include "sbrdsp.h" /** * Spectral Band Replication header - spectrum parameters that invoke a reset if they differ from the previous header. @@ -180,6 +181,7 @@ typedef struct { DECLARE_ALIGNED(16, float, qmf_filter_scratch)[5][64]; FFTContext mdct_ana; FFTContext mdct; + SBRDSPContext dsp; } SpectralBandReplication; #endif /* AVCODEC_SBR_H */ -- cgit v1.2.3 From 8996ed2b7324f35798c4198b495f8a6955d2047d Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Fri, 13 Jan 2012 14:31:18 +0000 Subject: aacsbr: align some arrays Signed-off-by: Mans Rullgard --- libavcodec/aacsbr.c | 8 +++++--- libavcodec/aacsbrdata.h | 4 +++- libavcodec/sbr.h | 12 ++++++------ 3 files changed, 14 insertions(+), 10 deletions(-) (limited to 'libavcodec/sbr.h') diff --git a/libavcodec/aacsbr.c b/libavcodec/aacsbr.c index 01601b035c..3a30fcad7f 100644 --- a/libavcodec/aacsbr.c +++ b/libavcodec/aacsbr.c @@ -1220,7 +1220,8 @@ static void sbr_hf_inverse_filter(SBRDSPContext *dsp, { int k; for (k = 0; k < k0; k++) { - float phi[3][2][2], dk; + LOCAL_ALIGNED_16(float, phi, [3], [2][2]); + float dk; dsp->autocorrelate(X_low[k], phi); @@ -1580,8 +1581,9 @@ static void sbr_hf_assemble(float Y[2][38][64][2], const float X_high[64][40][2] for (e = 0; e < ch_data->bs_num_env; e++) { for (i = 2 * ch_data->t_env[e]; i < 2 * ch_data->t_env[e + 1]; i++) { int phi_sign = (1 - 2*(kx & 1)); - float g_filt_tab[48], *g_filt; - float q_filt_tab[48], *q_filt; + LOCAL_ALIGNED_16(float, g_filt_tab, [48]); + LOCAL_ALIGNED_16(float, q_filt_tab, [48]); + float *g_filt, *q_filt; if (h_SL && e != e_a[0] && e != e_a[1]) { g_filt = g_filt_tab; diff --git a/libavcodec/aacsbrdata.h b/libavcodec/aacsbrdata.h index 02491c3356..fb02a77f7d 100644 --- a/libavcodec/aacsbrdata.h +++ b/libavcodec/aacsbrdata.h @@ -352,7 +352,8 @@ static DECLARE_ALIGNED(16, float, sbr_qmf_window_us)[640] = { 0.8537385600, }; -const float ff_sbr_noise_table[512][2] = { +/* First two entries repeated at end to simplify SIMD implementations. */ +const DECLARE_ALIGNED(16, float, ff_sbr_noise_table)[][2] = { {-0.99948153278296, -0.59483417516607}, { 0.97113454393991, -0.67528515225647}, { 0.14130051758487, -0.95090983575689}, {-0.47005496701697, -0.37340549728647}, { 0.80705063769351, 0.29653668284408}, {-0.38981478896926, 0.89572605717087}, @@ -609,6 +610,7 @@ const float ff_sbr_noise_table[512][2] = { {-0.93412041758744, 0.41374052024363}, { 0.96063943315511, 0.93116709541280}, { 0.97534253457837, 0.86150930812689}, { 0.99642466504163, 0.70190043427512}, {-0.94705089665984, -0.29580042814306}, { 0.91599807087376, -0.98147830385781}, +{-0.99948153278296, -0.59483417516607}, { 0.97113454393991, -0.67528515225647}, }; #endif /* AVCODEC_AACSBRDATA_H */ diff --git a/libavcodec/sbr.h b/libavcodec/sbr.h index 58f4b61341..7d06faddde 100644 --- a/libavcodec/sbr.h +++ b/libavcodec/sbr.h @@ -88,8 +88,8 @@ typedef struct { ///QMF values of the original signal float W[2][32][32][2]; ///QMF output of the HF adjustor - float Y[2][38][64][2]; - float g_temp[42][48]; + DECLARE_ALIGNED(16, float, Y)[2][38][64][2]; + DECLARE_ALIGNED(16, float, g_temp)[42][48]; float q_temp[42][48]; uint8_t s_indexmapped[8][48]; ///Envelope scalefactors @@ -156,15 +156,15 @@ typedef struct { uint8_t patch_num_subbands[6]; uint8_t patch_start_subband[6]; ///QMF low frequency input to the HF generator - float X_low[32][40][2]; + DECLARE_ALIGNED(16, float, X_low)[32][40][2]; ///QMF output of the HF generator - float X_high[64][40][2]; + DECLARE_ALIGNED(16, float, X_high)[64][40][2]; ///QMF values of the reconstructed signal DECLARE_ALIGNED(16, float, X)[2][2][38][64]; ///Zeroth coefficient used to filter the subband signals - float alpha0[64][2]; + DECLARE_ALIGNED(16, float, alpha0)[64][2]; ///First coefficient used to filter the subband signals - float alpha1[64][2]; + DECLARE_ALIGNED(16, float, alpha1)[64][2]; ///Dequantized envelope scalefactors, remapped float e_origmapped[7][48]; ///Dequantized noise scalefactors, remapped -- cgit v1.2.3