The x86 runs short on registers because numerous elements are not static. In addition, splitting them allows more optimized code, at least for x86.
Unified · Split
| @@ -47,16 +47,43 @@ void ff_synth_filter_float_neon(FFTContext *imdct, · 46 unmodified lines | ||
| 47 | 47 | float out[32], const float in[32], |
| 48 | 48 | float scale); |
| 49 | 49 | |
| 50 | +static void lfe_fir0_vfp(float *out, const float *in, const float *coefs, | |
| 51 | + float scale) | |
| 52 | +{ | |
| 53 | + ff_dca_lfe_fir_vfp(out, in, coefs, 32, scale); | |
| 54 | +} | |
| 55 | + | |
| 56 | +static void lfe_fir1_vfp(float *out, const float *in, const float *coefs, | |
| 57 | + float scale) | |
| 58 | +{ | |
| 59 | + ff_dca_lfe_fir_vfp(out, in, coefs, 64, scale); | |
| 60 | +} | |
| 61 | + | |
| 62 | +static void lfe_fir0_neon(float *out, const float *in, const float *coefs, | |
| 63 | + float scale) | |
| 64 | +{ | |
| 65 | + ff_dca_lfe_fir_neon(out, in, coefs, 32, scale); | |
| 66 | +} | |
| 67 | + | |
| 68 | +static void lfe_fir1_neon(float *out, const float *in, const float *coefs, | |
| 69 | + float scale) | |
| 70 | +{ | |
| 71 | + ff_dca_lfe_fir_neon(out, in, coefs, 64, scale); | |
| 72 | +} | |
| 73 | + | |
| 50 | 74 | av_cold void ff_dcadsp_init_arm(DCADSPContext *s) |
| 51 | 75 | { |
| 52 | 76 | int cpu_flags = av_get_cpu_flags(); |
| 53 | 77 | |
| 54 | 78 | if (have_vfp(cpu_flags) && !have_vfpv3(cpu_flags)) { |
| 55 | − s->lfe_fir = ff_dca_lfe_fir_vfp; | |
| 79 | + s->lfe_fir[0] = lfe_fir0_vfp; | |
| 80 | + s->lfe_fir[1] = lfe_fir1_vfp; | |
| 56 | 81 | s->qmf_32_subbands = ff_dca_qmf_32_subbands_vfp; |
| 57 | 82 | } |
| 58 | − if (have_neon(cpu_flags)) | |
| 59 | − s->lfe_fir = ff_dca_lfe_fir_neon; | |
| 83 | + if (have_neon(cpu_flags)) { | |
| 84 | + s->lfe_fir[0] = lfe_fir0_neon; | |
| 85 | + s->lfe_fir[1] = lfe_fir1_neon; | |
| 86 | + } | |
| 60 | 87 | } |
| 61 | 88 | |
| 62 | 89 | av_cold void ff_synth_filter_init_arm(SynthFilterContext *s) |
| @@ -1118,23 +1118,23 @@ static void lfe_interpolation_fir(DCAContext *s, int decimation_select, · 1117 unmodified lines | ||
| 1118 | 1118 | * samples_out: An array holding interpolated samples |
| 1119 | 1119 | */ |
| 1120 | 1120 | |
| 1121 | − int decifactor; | |
| 1121 | + int idx; | |
| 1122 | 1122 | const float *prCoeff; |
| 1123 | 1123 | int deciindex; |
| 1124 | 1124 | |
| 1125 | 1125 | /* Select decimation filter */ |
| 1126 | 1126 | if (decimation_select == 1) { |
| 1127 | − decifactor = 64; | |
| 1127 | + idx = 1; | |
| 1128 | 1128 | prCoeff = lfe_fir_128; |
| 1129 | 1129 | } else { |
| 1130 | − decifactor = 32; | |
| 1130 | + idx = 0; | |
| 1131 | 1131 | prCoeff = lfe_fir_64; |
| 1132 | 1132 | } |
| 1133 | 1133 | /* Interpolation */ |
| 1134 | 1134 | for (deciindex = 0; deciindex < num_deci_sample; deciindex++) { |
| 1135 | − s->dcadsp.lfe_fir(samples_out, samples_in, prCoeff, decifactor, scale); | |
| 1135 | + s->dcadsp.lfe_fir[idx](samples_out, samples_in, prCoeff, scale); | |
| 1136 | 1136 | samples_in++; |
| 1137 | − samples_out += 2 * decifactor; | |
| 1137 | + samples_out += 2 * 32 * (1 + idx); | |
| 1138 | 1138 | } |
| 1139 | 1139 | } |
| 1140 | 1140 | |
| @@ -32,8 +32,9 @@ static void int8x8_fmul_int32_c(float *dst, const int8_t *src, int scale) · 31 unmodified lines | ||
| 32 | 32 | dst[i] = src[i] * fscale; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | −static void dca_lfe_fir_c(float *out, const float *in, const float *coefs, | |
| 36 | − int decifactor, float scale) | |
| 35 | +static inline void | |
| 36 | +dca_lfe_fir(float *out, const float *in, const float *coefs, | |
| 37 | + int decifactor, float scale) | |
| 37 | 38 | { |
| 38 | 39 | float *out2 = out + decifactor; |
| 39 | 40 | const float *cf0 = coefs; |
| @@ -82,9 +83,22 @@ static void dca_qmf_32_subbands(float samples_in[32][8], int sb_act, · 42 unmodified lines | ||
| 82 | 83 | } |
| 83 | 84 | } |
| 84 | 85 | |
| 86 | +static void dca_lfe_fir0_c(float *out, const float *in, const float *coefs, | |
| 87 | + float scale) | |
| 88 | +{ | |
| 89 | + dca_lfe_fir(out, in, coefs, 32, scale); | |
| 90 | +} | |
| 91 | + | |
| 92 | +static void dca_lfe_fir1_c(float *out, const float *in, const float *coefs, | |
| 93 | + float scale) | |
| 94 | +{ | |
| 95 | + dca_lfe_fir(out, in, coefs, 64, scale); | |
| 96 | +} | |
| 97 | + | |
| 85 | 98 | av_cold void ff_dcadsp_init(DCADSPContext *s) |
| 86 | 99 | { |
| 87 | − s->lfe_fir = dca_lfe_fir_c; | |
| 100 | + s->lfe_fir[0] = dca_lfe_fir0_c; | |
| 101 | + s->lfe_fir[1] = dca_lfe_fir1_c; | |
| 88 | 102 | s->qmf_32_subbands = dca_qmf_32_subbands; |
| 89 | 103 | s->int8x8_fmul_int32 = int8x8_fmul_int32_c; |
| 90 | 104 | if (ARCH_ARM) ff_dcadsp_init_arm(s); |
| @@ -23,8 +23,8 @@ · 22 unmodified lines | ||
| 23 | 23 | #include "synth_filter.h" |
| 24 | 24 | |
| 25 | 25 | typedef struct DCADSPContext { |
| 26 | − void (*lfe_fir)(float *out, const float *in, const float *coefs, | |
| 27 | − int decifactor, float scale); | |
| 26 | + void (*lfe_fir[2])(float *out, const float *in, const float *coefs, | |
| 27 | + float scale); | |
| 28 | 28 | void (*qmf_32_subbands)(float samples_in[32][8], int sb_act, |
| 29 | 29 | SynthFilterContext *synth, FFTContext *imdct, |
| 30 | 30 | float synth_buf_ptr[512], |