---
libavcodec/arm/Makefile | 2 +
libavcodec/arm/fft_fixed_init_arm.c | 10 --
...{fft_fixed_init_arm.c => mdct_fixed_init_arm.c} | 12 +-
.../arm/{fft_fixed_init_arm.c => mdct_init_arm.c} | 31 ++---
libavcodec/fft.h | 5 +
libavcodec/fft_template.c | 7 --
libavcodec/mdct_template.c | 15 +++
libavcodec/x86/Makefile | 1 +
libavcodec/x86/fft.asm | 128 +++++++++++----------
libavcodec/x86/fft.h | 8 --
libavcodec/x86/fft_init.c | 7 --
libavcodec/x86/{fft.h => mdct.h} | 12 +-
libavcodec/x86/{fft_init.c => mdct_init.c} | 13 +--
13 files changed, 115 insertions(+), 136 deletions(-)
copy libavcodec/arm/{fft_fixed_init_arm.c => mdct_fixed_init_arm.c} (81%)
copy libavcodec/arm/{fft_fixed_init_arm.c => mdct_init_arm.c} (57%)
copy libavcodec/x86/{fft.h => mdct.h} (79%)
copy libavcodec/x86/{fft_init.c => mdct_init.c} (79%)
diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile
index cd4907c..b2eb879 100644
--- a/libavcodec/arm/Makefile
+++ b/libavcodec/arm/Makefile
@@ -21,6 +21,8 @@ OBJS-$(CONFIG_IDCTDSP) +=
arm/idctdsp_init_arm.o \
OBJS-$(CONFIG_FLACDSP) += arm/flacdsp_init_arm.o \
arm/flacdsp_arm.o
OBJS-$(CONFIG_G722DSP) += arm/g722dsp_init_arm.o
+OBJS-$(CONFIG_MDCT) += arm/mdct_init_arm.o \
+ arm/mdct_fixed_init_arm.o
OBJS-$(CONFIG_ME_CMP) += arm/me_cmp_init_arm.o
OBJS-$(CONFIG_MPEGAUDIODSP) += arm/mpegaudiodsp_init_arm.o
OBJS-$(CONFIG_MPEGVIDEO) += arm/mpegvideo_arm.o
diff --git a/libavcodec/arm/fft_fixed_init_arm.c
b/libavcodec/arm/fft_fixed_init_arm.c
index 2f749e4..a0723be 100644
--- a/libavcodec/arm/fft_fixed_init_arm.c
+++ b/libavcodec/arm/fft_fixed_init_arm.c
@@ -24,8 +24,6 @@
#include "libavcodec/fft.h"
void ff_fft_fixed_calc_neon(FFTContext *s, FFTComplex *z);
-void ff_mdct_fixed_calc_neon(FFTContext *s, FFTSample *o, const FFTSample *i);
-void ff_mdct_fixed_calcw_neon(FFTContext *s, FFTDouble *o, const FFTSample *i);
av_cold void ff_fft_fixed_init_arm(FFTContext *s)
{
@@ -34,13 +32,5 @@ av_cold void ff_fft_fixed_init_arm(FFTContext *s)
if (have_neon(cpu_flags)) {
s->fft_permutation = FF_FFT_PERM_SWAP_LSBS;
s->fft_calc = ff_fft_fixed_calc_neon;
-
-#if CONFIG_MDCT
- if (!s->inverse && s->nbits >= 3) {
- s->mdct_permutation = FF_MDCT_PERM_INTERLEAVE;
- s->mdct_calc = ff_mdct_fixed_calc_neon;
- s->mdct_calcw = ff_mdct_fixed_calcw_neon;
- }
-#endif
}
}
diff --git a/libavcodec/arm/fft_fixed_init_arm.c
b/libavcodec/arm/mdct_fixed_init_arm.c
similarity index 81%
copy from libavcodec/arm/fft_fixed_init_arm.c
copy to libavcodec/arm/mdct_fixed_init_arm.c
index 2f749e4..606c80c 100644
--- a/libavcodec/arm/fft_fixed_init_arm.c
+++ b/libavcodec/arm/mdct_fixed_init_arm.c
@@ -1,6 +1,4 @@
/*
- * Copyright (c) 2009 Mans Rullgard <[email protected]>
- *
* This file is part of Libav.
*
* Libav is free software; you can redistribute it and/or
@@ -18,29 +16,25 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/attributes.h"
+#include "libavutil/cpu.h"
#include "libavutil/arm/cpu.h"
#define FFT_FLOAT 0
#include "libavcodec/fft.h"
-void ff_fft_fixed_calc_neon(FFTContext *s, FFTComplex *z);
void ff_mdct_fixed_calc_neon(FFTContext *s, FFTSample *o, const FFTSample *i);
void ff_mdct_fixed_calcw_neon(FFTContext *s, FFTDouble *o, const FFTSample *i);
-av_cold void ff_fft_fixed_init_arm(FFTContext *s)
+av_cold void ff_mdct_fixed_init_arm(FFTContext *s)
{
int cpu_flags = av_get_cpu_flags();
if (have_neon(cpu_flags)) {
- s->fft_permutation = FF_FFT_PERM_SWAP_LSBS;
- s->fft_calc = ff_fft_fixed_calc_neon;
-
-#if CONFIG_MDCT
if (!s->inverse && s->nbits >= 3) {
s->mdct_permutation = FF_MDCT_PERM_INTERLEAVE;
s->mdct_calc = ff_mdct_fixed_calc_neon;
s->mdct_calcw = ff_mdct_fixed_calcw_neon;
}
-#endif
}
}
diff --git a/libavcodec/arm/fft_fixed_init_arm.c
b/libavcodec/arm/mdct_init_arm.c
similarity index 57%
copy from libavcodec/arm/fft_fixed_init_arm.c
copy to libavcodec/arm/mdct_init_arm.c
index 2f749e4..5825034 100644
--- a/libavcodec/arm/fft_fixed_init_arm.c
+++ b/libavcodec/arm/mdct_init_arm.c
@@ -18,29 +18,30 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/attributes.h"
+#include "libavutil/cpu.h"
#include "libavutil/arm/cpu.h"
-#define FFT_FLOAT 0
#include "libavcodec/fft.h"
-void ff_fft_fixed_calc_neon(FFTContext *s, FFTComplex *z);
-void ff_mdct_fixed_calc_neon(FFTContext *s, FFTSample *o, const FFTSample *i);
-void ff_mdct_fixed_calcw_neon(FFTContext *s, FFTDouble *o, const FFTSample *i);
+void ff_imdct_half_vfp(FFTContext *s, FFTSample *output, const FFTSample
*input);
-av_cold void ff_fft_fixed_init_arm(FFTContext *s)
+void ff_imdct_calc_neon(FFTContext *s, FFTSample *output, const FFTSample
*input);
+void ff_imdct_half_neon(FFTContext *s, FFTSample *output, const FFTSample
*input);
+void ff_mdct_calc_neon(FFTContext *s, FFTSample *output, const FFTSample
*input);
+
+av_cold void ff_fft_init_arm(FFTContext *s)
{
int cpu_flags = av_get_cpu_flags();
- if (have_neon(cpu_flags)) {
- s->fft_permutation = FF_FFT_PERM_SWAP_LSBS;
- s->fft_calc = ff_fft_fixed_calc_neon;
+ if (have_vfp_vm(cpu_flags)) {
+ s->imdct_half = ff_imdct_half_vfp;
+ }
-#if CONFIG_MDCT
- if (!s->inverse && s->nbits >= 3) {
- s->mdct_permutation = FF_MDCT_PERM_INTERLEAVE;
- s->mdct_calc = ff_mdct_fixed_calc_neon;
- s->mdct_calcw = ff_mdct_fixed_calcw_neon;
- }
-#endif
+ if (have_neon(cpu_flags)) {
+ s->imdct_calc = ff_imdct_calc_neon;
+ s->imdct_half = ff_imdct_half_neon;
+ s->mdct_calc = ff_mdct_calc_neon;
+ s->mdct_permutation = FF_MDCT_PERM_INTERLEAVE;
}
}
diff --git a/libavcodec/fft.h b/libavcodec/fft.h
index 7daae24..bb87903 100644
--- a/libavcodec/fft.h
+++ b/libavcodec/fft.h
@@ -154,4 +154,9 @@ void ff_fft_end(FFTContext *s);
int ff_mdct_init(FFTContext *s, int nbits, int inverse, double scale);
void ff_mdct_end(FFTContext *s);
+void ff_mdct_init_arm(FFTContext *s);
+void ff_mdct_init_x86(FFTContext *s);
+
+void ff_mdct_fixed_init_arm(FFTContext *s);
+
#endif /* AVCODEC_FFT_H */
diff --git a/libavcodec/fft_template.c b/libavcodec/fft_template.c
index 808f317..3642b43 100644
--- a/libavcodec/fft_template.c
+++ b/libavcodec/fft_template.c
@@ -151,20 +151,13 @@ av_cold int ff_fft_init(FFTContext *s, int nbits, int
inverse)
s->fft_permute = fft_permute_c;
s->fft_calc = fft_calc_c;
-#if CONFIG_MDCT
- s->imdct_calc = ff_imdct_calc_c;
- s->imdct_half = ff_imdct_half_c;
- s->mdct_calc = ff_mdct_calc_c;
-#endif
#if FFT_FLOAT
if (ARCH_AARCH64) ff_fft_init_aarch64(s);
if (ARCH_ARM) ff_fft_init_arm(s);
if (ARCH_PPC) ff_fft_init_ppc(s);
if (ARCH_X86) ff_fft_init_x86(s);
- if (CONFIG_MDCT) s->mdct_calcw = s->mdct_calc;
#else
- if (CONFIG_MDCT) s->mdct_calcw = ff_mdct_calcw_c;
if (ARCH_ARM) ff_fft_fixed_init_arm(s);
#endif
diff --git a/libavcodec/mdct_template.c b/libavcodec/mdct_template.c
index bad890e..c3511c9 100644
--- a/libavcodec/mdct_template.c
+++ b/libavcodec/mdct_template.c
@@ -53,6 +53,21 @@ av_cold int ff_mdct_init(FFTContext *s, int nbits, int
inverse, double scale)
n4 = n >> 2;
s->mdct_permutation = FF_MDCT_PERM_NONE;
+ s->imdct_calc = ff_imdct_calc_c;
+ s->imdct_half = ff_imdct_half_c;
+ s->mdct_calc = ff_mdct_calc_c;
+#if FFT_FLOAT
+ s->mdct_calcw = s->mdct_calc;
+ if (ARCH_ARM)
+ ff_mdct_init_arm(s);
+ if (ARCH_X86)
+ ff_mdct_init_x86(s);
+#else
+ s->mdct_calcw = ff_mdct_calcw_c;
+ if (ARCH_ARM)
+ ff_mdct_fixed_init_arm(s);
+#endif
+
if (ff_fft_init(s, s->mdct_bits - 2, inverse) < 0)
goto fail;
diff --git a/libavcodec/x86/Makefile b/libavcodec/x86/Makefile
index 4afd0a7..653beee 100644
--- a/libavcodec/x86/Makefile
+++ b/libavcodec/x86/Makefile
@@ -19,6 +19,7 @@ OBJS-$(CONFIG_HUFFYUVDSP) +=
x86/huffyuvdsp_init.o
OBJS-$(CONFIG_HUFFYUVENCDSP) += x86/huffyuvencdsp_mmx.o
OBJS-$(CONFIG_IDCTDSP) += x86/idctdsp_init.o
OBJS-$(CONFIG_LPC) += x86/lpc.o
+OBJS-$(CONFIG_MDCT) += x86/mdct_init.o
OBJS-$(CONFIG_ME_CMP) += x86/me_cmp_init.o
OBJS-$(CONFIG_MPEGAUDIODSP) += x86/mpegaudiodsp.o
OBJS-$(CONFIG_MPEGVIDEO) += x86/mpegvideo.o \
diff --git a/libavcodec/x86/fft.asm b/libavcodec/x86/fft.asm
index d3be72e..ef007f4 100644
--- a/libavcodec/x86/fft.asm
+++ b/libavcodec/x86/fft.asm
@@ -655,68 +655,6 @@ cglobal fft_permute, 2,7,1
jl .loopcopy
REP_RET
-%macro IMDCT_CALC_FUNC 0
-cglobal imdct_calc, 3,5,3
- mov r3d, [r0 + FFTContext.mdctsize]
- mov r4, [r0 + FFTContext.imdcthalf]
- add r1, r3
- PUSH r3
- PUSH r1
-%if ARCH_X86_32
- push r2
- push r1
- push r0
-%else
- sub rsp, 8+32*WIN64 ; allocate win64 shadow space
-%endif
- call r4
-%if ARCH_X86_32
- add esp, 12
-%else
- add rsp, 8+32*WIN64
-%endif
- POP r1
- POP r3
- lea r0, [r1 + 2*r3]
- mov r2, r3
- sub r3, mmsize
- neg r2
- mova m2, [ps_m1m1m1m1]
-.loop:
-%if mmsize == 8
- PSWAPD m0, [r1 + r3]
- PSWAPD m1, [r0 + r2]
- pxor m0, m2
-%else
- mova m0, [r1 + r3]
- mova m1, [r0 + r2]
- shufps m0, m0, 0x1b
- shufps m1, m1, 0x1b
- xorps m0, m2
-%endif
- mova [r0 + r3], m1
- mova [r1 + r2], m0
- sub r3, mmsize
- add r2, mmsize
- jl .loop
-%if cpuflag(3dnow)
- femms
- RET
-%else
- REP_RET
-%endif
-%endmacro
-
-%if ARCH_X86_32
-INIT_MMX 3dnow
-IMDCT_CALC_FUNC
-INIT_MMX 3dnowext
-IMDCT_CALC_FUNC
-%endif
-
-INIT_XMM sse
-IMDCT_CALC_FUNC
-
%if ARCH_X86_32
INIT_MMX 3dnow
%define mulps pfmul
@@ -791,6 +729,70 @@ DECL_FFT 4
DECL_FFT 4, _interleave
%endif
+%if CONFIG_MDCT
+
+%macro IMDCT_CALC_FUNC 0
+cglobal imdct_calc, 3,5,3
+ mov r3d, [r0 + FFTContext.mdctsize]
+ mov r4, [r0 + FFTContext.imdcthalf]
+ add r1, r3
+ PUSH r3
+ PUSH r1
+%if ARCH_X86_32
+ push r2
+ push r1
+ push r0
+%else
+ sub rsp, 8+32*WIN64 ; allocate win64 shadow space
+%endif
+ call r4
+%if ARCH_X86_32
+ add esp, 12
+%else
+ add rsp, 8+32*WIN64
+%endif
+ POP r1
+ POP r3
+ lea r0, [r1 + 2*r3]
+ mov r2, r3
+ sub r3, mmsize
+ neg r2
+ mova m2, [ps_m1m1m1m1]
+.loop:
+%if mmsize == 8
+ PSWAPD m0, [r1 + r3]
+ PSWAPD m1, [r0 + r2]
+ pxor m0, m2
+%else
+ mova m0, [r1 + r3]
+ mova m1, [r0 + r2]
+ shufps m0, m0, 0x1b
+ shufps m1, m1, 0x1b
+ xorps m0, m2
+%endif
+ mova [r0 + r3], m1
+ mova [r1 + r2], m0
+ sub r3, mmsize
+ add r2, mmsize
+ jl .loop
+%if cpuflag(3dnow)
+ femms
+ RET
+%else
+ REP_RET
+%endif
+%endmacro
+
+%if ARCH_X86_32
+INIT_MMX 3dnow
+IMDCT_CALC_FUNC
+INIT_MMX 3dnowext
+IMDCT_CALC_FUNC
+%endif
+
+INIT_XMM sse
+IMDCT_CALC_FUNC
+
INIT_XMM sse
%undef mulps
%undef addps
@@ -1081,3 +1083,5 @@ DECL_IMDCT POSROTATESHUF_3DNOW
INIT_YMM avx
DECL_IMDCT POSROTATESHUF_AVX
+
+%endif ; CONFIG_MDCT
diff --git a/libavcodec/x86/fft.h b/libavcodec/x86/fft.h
index a604956..94405d0 100644
--- a/libavcodec/x86/fft.h
+++ b/libavcodec/x86/fft.h
@@ -27,12 +27,4 @@ void ff_fft_calc_sse(FFTContext *s, FFTComplex *z);
void ff_fft_calc_3dnow(FFTContext *s, FFTComplex *z);
void ff_fft_calc_3dnowext(FFTContext *s, FFTComplex *z);
-void ff_imdct_calc_3dnow(FFTContext *s, FFTSample *output, const FFTSample
*input);
-void ff_imdct_half_3dnow(FFTContext *s, FFTSample *output, const FFTSample
*input);
-void ff_imdct_calc_3dnowext(FFTContext *s, FFTSample *output, const FFTSample
*input);
-void ff_imdct_half_3dnowext(FFTContext *s, FFTSample *output, const FFTSample
*input);
-void ff_imdct_calc_sse(FFTContext *s, FFTSample *output, const FFTSample
*input);
-void ff_imdct_half_sse(FFTContext *s, FFTSample *output, const FFTSample
*input);
-void ff_imdct_half_avx(FFTContext *s, FFTSample *output, const FFTSample
*input);
-
#endif /* AVCODEC_X86_FFT_H */
diff --git a/libavcodec/x86/fft_init.c b/libavcodec/x86/fft_init.c
index b052859..b9a6c90 100644
--- a/libavcodec/x86/fft_init.c
+++ b/libavcodec/x86/fft_init.c
@@ -28,28 +28,21 @@ av_cold void ff_fft_init_x86(FFTContext *s)
#if ARCH_X86_32
if (EXTERNAL_AMD3DNOW(cpu_flags)) {
- s->imdct_calc = ff_imdct_calc_3dnow;
- s->imdct_half = ff_imdct_half_3dnow;
s->fft_calc = ff_fft_calc_3dnow;
}
if (EXTERNAL_AMD3DNOWEXT(cpu_flags)) {
- s->imdct_calc = ff_imdct_calc_3dnowext;
- s->imdct_half = ff_imdct_half_3dnowext;
s->fft_calc = ff_fft_calc_3dnowext;
}
#endif /* ARCH_X86_32 */
if (EXTERNAL_SSE(cpu_flags)) {
- s->imdct_calc = ff_imdct_calc_sse;
- s->imdct_half = ff_imdct_half_sse;
s->fft_permute = ff_fft_permute_sse;
s->fft_calc = ff_fft_calc_sse;
s->fft_permutation = FF_FFT_PERM_SWAP_LSBS;
}
if (EXTERNAL_AVX_FAST(cpu_flags) && s->nbits >= 5) {
- s->imdct_half = ff_imdct_half_avx;
s->fft_calc = ff_fft_calc_avx;
s->fft_permutation = FF_FFT_PERM_AVX;
}
diff --git a/libavcodec/x86/fft.h b/libavcodec/x86/mdct.h
similarity index 79%
copy from libavcodec/x86/fft.h
copy to libavcodec/x86/mdct.h
index a604956..cc107cb 100644
--- a/libavcodec/x86/fft.h
+++ b/libavcodec/x86/mdct.h
@@ -16,17 +16,11 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef AVCODEC_X86_FFT_H
-#define AVCODEC_X86_FFT_H
+#ifndef AVCODEC_X86_MDCT_H
+#define AVCODEC_X86_MDCT_H
#include "libavcodec/fft.h"
-void ff_fft_permute_sse(FFTContext *s, FFTComplex *z);
-void ff_fft_calc_avx(FFTContext *s, FFTComplex *z);
-void ff_fft_calc_sse(FFTContext *s, FFTComplex *z);
-void ff_fft_calc_3dnow(FFTContext *s, FFTComplex *z);
-void ff_fft_calc_3dnowext(FFTContext *s, FFTComplex *z);
-
void ff_imdct_calc_3dnow(FFTContext *s, FFTSample *output, const FFTSample
*input);
void ff_imdct_half_3dnow(FFTContext *s, FFTSample *output, const FFTSample
*input);
void ff_imdct_calc_3dnowext(FFTContext *s, FFTSample *output, const FFTSample
*input);
@@ -35,4 +29,4 @@ void ff_imdct_calc_sse(FFTContext *s, FFTSample *output,
const FFTSample *input)
void ff_imdct_half_sse(FFTContext *s, FFTSample *output, const FFTSample
*input);
void ff_imdct_half_avx(FFTContext *s, FFTSample *output, const FFTSample
*input);
-#endif /* AVCODEC_X86_FFT_H */
+#endif /* AVCODEC_X86_MDCT_H */
diff --git a/libavcodec/x86/fft_init.c b/libavcodec/x86/mdct_init.c
similarity index 79%
copy from libavcodec/x86/fft_init.c
copy to libavcodec/x86/mdct_init.c
index b052859..db642d8 100644
--- a/libavcodec/x86/fft_init.c
+++ b/libavcodec/x86/mdct_init.c
@@ -17,12 +17,14 @@
*/
#include "config.h"
+
#include "libavutil/attributes.h"
#include "libavutil/cpu.h"
#include "libavutil/x86/cpu.h"
-#include "fft.h"
-av_cold void ff_fft_init_x86(FFTContext *s)
+#include "mdct.h"
+
+av_cold void ff_mdct_init_x86(FFTContext *s)
{
int cpu_flags = av_get_cpu_flags();
@@ -30,27 +32,20 @@ av_cold void ff_fft_init_x86(FFTContext *s)
if (EXTERNAL_AMD3DNOW(cpu_flags)) {
s->imdct_calc = ff_imdct_calc_3dnow;
s->imdct_half = ff_imdct_half_3dnow;
- s->fft_calc = ff_fft_calc_3dnow;
}
if (EXTERNAL_AMD3DNOWEXT(cpu_flags)) {
s->imdct_calc = ff_imdct_calc_3dnowext;
s->imdct_half = ff_imdct_half_3dnowext;
- s->fft_calc = ff_fft_calc_3dnowext;
}
#endif /* ARCH_X86_32 */
if (EXTERNAL_SSE(cpu_flags)) {
s->imdct_calc = ff_imdct_calc_sse;
s->imdct_half = ff_imdct_half_sse;
- s->fft_permute = ff_fft_permute_sse;
- s->fft_calc = ff_fft_calc_sse;
- s->fft_permutation = FF_FFT_PERM_SWAP_LSBS;
}
if (EXTERNAL_AVX_FAST(cpu_flags) && s->nbits >= 5) {
s->imdct_half = ff_imdct_half_avx;
- s->fft_calc = ff_fft_calc_avx;
- s->fft_permutation = FF_FFT_PERM_AVX;
}
}
--
2.5.0
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel