aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil
diff options
context:
space:
mode:
authorRonald S. Bultje <rsbultje@gmail.com>2013-01-20 15:41:14 -0800
committerRonald S. Bultje <rsbultje@gmail.com>2013-01-22 11:55:42 -0800
commit5959bfaca396ecaf63a8123055f499688b79cae3 (patch)
treea32f22fb1a5ad7ddc731e9cee13ffface840cb4a /libavutil
parent42d324694883cdf1fff1612ac70fa403692a1ad4 (diff)
downloadffmpeg-5959bfaca396ecaf63a8123055f499688b79cae3.tar.gz
floatdsp: move butterflies_float from dsputil to avfloatdsp.
This makes wmadec/enc, twinvq and mpegaudiodec (i.e. mp2/mp3) independent of dsputil.
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/arm/float_dsp_init_neon.c3
-rw-r--r--libavutil/arm/float_dsp_neon.S12
-rw-r--r--libavutil/float_dsp.c13
-rw-r--r--libavutil/float_dsp.h9
4 files changed, 37 insertions, 0 deletions
diff --git a/libavutil/arm/float_dsp_init_neon.c b/libavutil/arm/float_dsp_init_neon.c
index c6f02bd2c5..b3644e82a2 100644
--- a/libavutil/arm/float_dsp_init_neon.c
+++ b/libavutil/arm/float_dsp_init_neon.c
@@ -41,6 +41,8 @@ void ff_vector_fmul_add_neon(float *dst, const float *src0, const float *src1,
void ff_vector_fmul_reverse_neon(float *dst, const float *src0,
const float *src1, int len);
+void ff_butterflies_float_neon(float *v1, float *v2, int len);
+
void ff_float_dsp_init_neon(AVFloatDSPContext *fdsp)
{
fdsp->vector_fmul = ff_vector_fmul_neon;
@@ -49,4 +51,5 @@ void ff_float_dsp_init_neon(AVFloatDSPContext *fdsp)
fdsp->vector_fmul_window = ff_vector_fmul_window_neon;
fdsp->vector_fmul_add = ff_vector_fmul_add_neon;
fdsp->vector_fmul_reverse = ff_vector_fmul_reverse_neon;
+ fdsp->butterflies_float = ff_butterflies_float_neon;
}
diff --git a/libavutil/arm/float_dsp_neon.S b/libavutil/arm/float_dsp_neon.S
index d00e59de8f..4acc406d33 100644
--- a/libavutil/arm/float_dsp_neon.S
+++ b/libavutil/arm/float_dsp_neon.S
@@ -244,3 +244,15 @@ function ff_vector_fmul_reverse_neon, export=1
2: vst1.32 {q8-q9}, [r0,:128]!
bx lr
endfunc
+
+function ff_butterflies_float_neon, export=1
+1: vld1.32 {q0},[r0,:128]
+ vld1.32 {q1},[r1,:128]
+ vsub.f32 q2, q0, q1
+ vadd.f32 q1, q0, q1
+ vst1.32 {q2},[r1,:128]!
+ vst1.32 {q1},[r0,:128]!
+ subs r2, r2, #4
+ bgt 1b
+ bx lr
+endfunc
diff --git a/libavutil/float_dsp.c b/libavutil/float_dsp.c
index aa5293710b..c6e2b41d66 100644
--- a/libavutil/float_dsp.c
+++ b/libavutil/float_dsp.c
@@ -89,6 +89,18 @@ static void vector_fmul_reverse_c(float *dst, const float *src0,
dst[i] = src0[i] * src1[-i];
}
+static void butterflies_float_c(float *restrict v1, float *restrict v2,
+ int len)
+{
+ int i;
+
+ for (i = 0; i < len; i++) {
+ float t = v1[i] - v2[i];
+ v1[i] += v2[i];
+ v2[i] = t;
+ }
+}
+
void avpriv_float_dsp_init(AVFloatDSPContext *fdsp, int bit_exact)
{
fdsp->vector_fmul = vector_fmul_c;
@@ -98,6 +110,7 @@ void avpriv_float_dsp_init(AVFloatDSPContext *fdsp, int bit_exact)
fdsp->vector_fmul_window = vector_fmul_window_c;
fdsp->vector_fmul_add = vector_fmul_add_c;
fdsp->vector_fmul_reverse = vector_fmul_reverse_c;
+ fdsp->butterflies_float = butterflies_float_c;
#if ARCH_ARM
ff_float_dsp_init_arm(fdsp);
diff --git a/libavutil/float_dsp.h b/libavutil/float_dsp.h
index 96fcdab1e6..ec57b36f79 100644
--- a/libavutil/float_dsp.h
+++ b/libavutil/float_dsp.h
@@ -137,6 +137,15 @@ typedef struct AVFloatDSPContext {
*/
void (*vector_fmul_reverse)(float *dst, const float *src0,
const float *src1, int len);
+
+ /**
+ * Calculate the sum and difference of two vectors of floats.
+ *
+ * @param v1 first input vector, sum output, 16-byte aligned
+ * @param v2 second input vector, difference output, 16-byte aligned
+ * @param len length of vectors, multiple of 4
+ */
+ void (*butterflies_float)(float *restrict v1, float *restrict v2, int len);
} AVFloatDSPContext;
/**