Commit 87ec849f authored by Christophe Gisquet's avatar Christophe Gisquet Committed by Janne Grunau
Browse files

dcadec: remove scaling in lfe_interpolation_fir



The scaling factor is constant so it is faster to scale the
FIR coefficients in the tables during compilation.
Signed-off-by: default avatarJanne Grunau <janne-libav@jannau.net>
parent a55546f4
......@@ -24,15 +24,11 @@
#include "libavutil/attributes.h"
#include "libavcodec/dcadsp.h"
void ff_dca_lfe_fir0_neon(float *out, const float *in, const float *coefs,
float scale);
void ff_dca_lfe_fir1_neon(float *out, const float *in, const float *coefs,
float scale);
void ff_dca_lfe_fir0_neon(float *out, const float *in, const float *coefs);
void ff_dca_lfe_fir1_neon(float *out, const float *in, const float *coefs);
void ff_dca_lfe_fir32_vfp(float *out, const float *in, const float *coefs,
float scale);
void ff_dca_lfe_fir64_vfp(float *out, const float *in, const float *coefs,
float scale);
void ff_dca_lfe_fir32_vfp(float *out, const float *in, const float *coefs);
void ff_dca_lfe_fir64_vfp(float *out, const float *in, const float *coefs);
void ff_dca_qmf_32_subbands_vfp(float samples_in[32][8], int sb_act,
SynthFilterContext *synth, FFTContext *imdct,
......
......@@ -22,7 +22,6 @@
function ff_dca_lfe_fir0_neon, export=1
push {r4-r6,lr}
NOVFP vmov s0, r3 @ scale
mov r3, #32 @ decifactor
mov r6, #256/32
b dca_lfe_fir
......@@ -30,7 +29,6 @@ endfunc
function ff_dca_lfe_fir1_neon, export=1
push {r4-r6,lr}
NOVFP vmov s0, r3 @ scale
mov r3, #64 @ decifactor
mov r6, #256/64
dca_lfe_fir:
......@@ -57,8 +55,7 @@ dca_lfe_fir:
subs r3, r3, #1
vadd.f32 d4, d4, d5
vadd.f32 d6, d6, d7
vpadd.f32 d4, d4, d6
vmul.f32 d5, d4, d0[0]
vpadd.f32 d5, d4, d6
vst1.32 {d5[0]}, [r0,:32]!
vst1.32 {d5[1]}, [r4,:32]!
bne 1b
......
......@@ -27,8 +27,6 @@ PCOEF .req a3
OLDFPSCR .req a4
COUNTER .req ip
SCALE32 .req s28 @ use vector of 4 in place of 9th scalar when decifactor=32 / JMAX=8
SCALE64 .req s0 @ spare register in scalar bank when decifactor=64 / JMAX=4
IN0 .req s4
IN1 .req s5
IN2 .req s6
......@@ -76,9 +74,6 @@ POST3 .req s27
vldr COEF5, [PCOEF, #X + (1*JMAX + 1) * Y]
vldr COEF6, [PCOEF, #X + (2*JMAX + 1) * Y]
.endif
.ifnc "\tail",""
vmul.f POST0, POST0, SCALE\decifactor @ vector operation (SCALE may be scalar)
.endif
.ifnc "\head",""
vldr COEF7, [PCOEF, #X + (3*JMAX + 1) * Y]
.ifc "\tail",""
......@@ -129,7 +124,6 @@ POST3 .req s27
.macro dca_lfe_fir decifactor
function ff_dca_lfe_fir\decifactor\()_vfp, export=1
NOVFP vmov s0, r3
fmrx OLDFPSCR, FPSCR
ldr ip, =0x03030000 @ RunFast mode, short vectors of length 4, stride 1
fmxr FPSCR, ip
......@@ -140,7 +134,6 @@ NOVFP vmov s0, r3
.if \decifactor == 32
.set JMAX, 8
vpush {s16-s31}
vmov SCALE32, s0 @ duplicate scalar across vector
vldr IN4, [PIN, #-4*4]
vldr IN5, [PIN, #-5*4]
vldr IN6, [PIN, #-6*4]
......@@ -186,8 +179,6 @@ endfunc
.unreq OLDFPSCR
.unreq COUNTER
.unreq SCALE32
.unreq SCALE64
.unreq IN0
.unreq IN1
.unreq IN2
......
This diff is collapsed.
......@@ -947,7 +947,7 @@ static void qmf_32_subbands(DCAContext *s, int chans,
static void lfe_interpolation_fir(DCAContext *s, int decimation_select,
int num_deci_sample, float *samples_in,
float *samples_out, float scale)
float *samples_out)
{
/* samples_in: An array holding decimated samples.
* Samples in current subframe starts from samples_in[0],
......@@ -971,7 +971,7 @@ static void lfe_interpolation_fir(DCAContext *s, int decimation_select,
}
/* Interpolation */
for (deciindex = 0; deciindex < num_deci_sample; deciindex++) {
s->dcadsp.lfe_fir[idx](samples_out, samples_in, prCoeff, scale);
s->dcadsp.lfe_fir[idx](samples_out, samples_in, prCoeff);
samples_in++;
samples_out += 2 * 32 * (1 + idx);
}
......@@ -1265,8 +1265,7 @@ static int dca_filter_channels(DCAContext *s, int block_index)
if (s->lfe) {
lfe_interpolation_fir(s, s->lfe, 2 * s->lfe,
s->lfe_data + 2 * s->lfe * (block_index + 4),
s->samples_chanptr[dca_lfe_index[s->amode]],
1.0 / (256.0 * 32768.0));
s->samples_chanptr[dca_lfe_index[s->amode]]);
/* Outputs 20bits pcm samples */
}
......
......@@ -34,7 +34,7 @@ static void int8x8_fmul_int32_c(float *dst, const int8_t *src, int scale)
static inline void
dca_lfe_fir(float *out, const float *in, const float *coefs,
int decifactor, float scale)
int decifactor)
{
float *out2 = out + decifactor;
const float *cf0 = coefs;
......@@ -50,8 +50,8 @@ dca_lfe_fir(float *out, const float *in, const float *coefs,
v0 += s * *cf0++;
v1 += s * *--cf1;
}
*out++ = v0 * scale;
*out2++ = v1 * scale;
*out++ = v0;
*out2++ = v1;
}
}
......@@ -83,16 +83,14 @@ static void dca_qmf_32_subbands(float samples_in[32][8], int sb_act,
}
}
static void dca_lfe_fir0_c(float *out, const float *in, const float *coefs,
float scale)
static void dca_lfe_fir0_c(float *out, const float *in, const float *coefs)
{
dca_lfe_fir(out, in, coefs, 32, scale);
dca_lfe_fir(out, in, coefs, 32);
}
static void dca_lfe_fir1_c(float *out, const float *in, const float *coefs,
float scale)
static void dca_lfe_fir1_c(float *out, const float *in, const float *coefs)
{
dca_lfe_fir(out, in, coefs, 64, scale);
dca_lfe_fir(out, in, coefs, 64);
}
av_cold void ff_dcadsp_init(DCADSPContext *s)
......
......@@ -23,8 +23,7 @@
#include "synth_filter.h"
typedef struct DCADSPContext {
void (*lfe_fir[2])(float *out, const float *in, const float *coefs,
float scale);
void (*lfe_fir[2])(float *out, const float *in, const float *coefs);
void (*qmf_32_subbands)(float samples_in[32][8], int sb_act,
SynthFilterContext *synth, FFTContext *imdct,
float synth_buf_ptr[512],
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment