History

dcadsp: split lfe_dir cases

The x86 runs short on registers because numerous elements are not static. In addition, splitting them allows more optimized code, at least for x86.

Christophe Gisquet committed 12 years ago

Commit 45854df1 parent 82ae8a44 files · +54 −13Browse files

Unified · Split

4 files
  1. libavcodec/arm/dcadsp_init_arm.c +30 −3
  2. libavcodec/dcadec.c +5 −5
  3. libavcodec/dcadsp.c +17 −3
  4. libavcodec/dcadsp.h +2 −2
libavcodec/arm/dcadsp_init_arm.c+30−3
@@ -47,16 +47,43 @@ void ff_synth_filter_float_neon(FFTContext *imdct, · 46 unmodified lines
4747 float out[32], const float in[32],
4848 float scale);
4949
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+
5074 av_cold void ff_dcadsp_init_arm(DCADSPContext *s)
5175 {
5276 int cpu_flags = av_get_cpu_flags();
5377
5478 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;
5681 s->qmf_32_subbands = ff_dca_qmf_32_subbands_vfp;
5782 }
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+ }
6087 }
6188
6289 av_cold void ff_synth_filter_init_arm(SynthFilterContext *s)
libavcodec/dcadec.c+5−5
@@ -1118,23 +1118,23 @@ static void lfe_interpolation_fir(DCAContext *s, int decimation_select, · 1117 unmodified lines
11181118 * samples_out: An array holding interpolated samples
11191119 */
11201120
1121− int decifactor;
1121+ int idx;
11221122 const float *prCoeff;
11231123 int deciindex;
11241124
11251125 /* Select decimation filter */
11261126 if (decimation_select == 1) {
1127− decifactor = 64;
1127+ idx = 1;
11281128 prCoeff = lfe_fir_128;
11291129 } else {
1130− decifactor = 32;
1130+ idx = 0;
11311131 prCoeff = lfe_fir_64;
11321132 }
11331133 /* Interpolation */
11341134 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);
11361136 samples_in++;
1137− samples_out += 2 * decifactor;
1137+ samples_out += 2 * 32 * (1 + idx);
11381138 }
11391139 }
11401140
libavcodec/dcadsp.c+17−3
@@ -32,8 +32,9 @@ static void int8x8_fmul_int32_c(float *dst, const int8_t *src, int scale) · 31 unmodified lines
3232 dst[i] = src[i] * fscale;
3333 }
3434
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)
3738 {
3839 float *out2 = out + decifactor;
3940 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
8283 }
8384 }
8485
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+
8598 av_cold void ff_dcadsp_init(DCADSPContext *s)
8699 {
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;
88102 s->qmf_32_subbands = dca_qmf_32_subbands;
89103 s->int8x8_fmul_int32 = int8x8_fmul_int32_c;
90104 if (ARCH_ARM) ff_dcadsp_init_arm(s);
libavcodec/dcadsp.h+2−2
@@ -23,8 +23,8 @@ · 22 unmodified lines
2323 #include "synth_filter.h"
2424
2525 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);
2828 void (*qmf_32_subbands)(float samples_in[32][8], int sb_act,
2929 SynthFilterContext *synth, FFTContext *imdct,
3030 float synth_buf_ptr[512],

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