aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/x86/fft_init.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-08-15 15:41:01 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-08-15 15:55:24 +0200
commit9e89bc37edfcd1b4b0a22c096c6546df4a9d1c0b (patch)
treede31fc8aa5b32d28a0143aff2477b4c3ada40318 /libavcodec/x86/fft_init.c
parentaee7b88cc0675fb668e39e8f4a50f2b1bd9305d4 (diff)
parent635ac8e1be91e941908f85642e4bbb609e48193f (diff)
downloadffmpeg-9e89bc37edfcd1b4b0a22c096c6546df4a9d1c0b.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: rtmp: Add support for SWFVerification api-example: use new video encoding API. x86: avcodec: Appropriately name files containing only init functions mpegvideo_mmx_template: drop some commented-out cruft libavresample: add mix level normalization option w32pthreads: Add missing #includes to make header compile standalone rtmp: Gracefully ignore _checkbw errors by tracking them rtmp: Do not send _checkbw calls as notifications prores: interlaced ProRes encoding Conflicts: doc/examples/decoding_encoding.c libavcodec/proresenc_kostya.c libavcodec/w32pthreads.h libavcodec/x86/Makefile libavformat/version.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/x86/fft_init.c')
-rw-r--r--libavcodec/x86/fft_init.c72
1 files changed, 72 insertions, 0 deletions
diff --git a/libavcodec/x86/fft_init.c b/libavcodec/x86/fft_init.c
new file mode 100644
index 0000000000..852c6b8d1e
--- /dev/null
+++ b/libavcodec/x86/fft_init.c
@@ -0,0 +1,72 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/cpu.h"
+#include "libavcodec/dsputil.h"
+#include "libavcodec/dct.h"
+#include "fft.h"
+
+av_cold void ff_fft_init_mmx(FFTContext *s)
+{
+#if HAVE_YASM
+ int has_vectors = av_get_cpu_flags();
+#if ARCH_X86_32
+ if (has_vectors & AV_CPU_FLAG_3DNOW && HAVE_AMD3DNOW) {
+ /* 3DNow! for K6-2/3 */
+ s->imdct_calc = ff_imdct_calc_3dnow;
+ s->imdct_half = ff_imdct_half_3dnow;
+ s->fft_calc = ff_fft_calc_3dnow;
+ }
+ if (has_vectors & AV_CPU_FLAG_3DNOWEXT && HAVE_AMD3DNOWEXT) {
+ /* 3DNowEx for K7 */
+ s->imdct_calc = ff_imdct_calc_3dnowext;
+ s->imdct_half = ff_imdct_half_3dnowext;
+ s->fft_calc = ff_fft_calc_3dnowext;
+ }
+#endif
+ if (has_vectors & AV_CPU_FLAG_SSE && HAVE_SSE) {
+ /* SSE for P3/P4/K8 */
+ 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 (has_vectors & AV_CPU_FLAG_AVX && HAVE_AVX && s->nbits >= 5) {
+ /* AVX for SB */
+ s->imdct_half = ff_imdct_half_avx;
+ s->fft_calc = ff_fft_calc_avx;
+ s->fft_permutation = FF_FFT_PERM_AVX;
+ }
+#endif
+}
+
+#if CONFIG_DCT
+av_cold void ff_dct_init_mmx(DCTContext *s)
+{
+#if HAVE_YASM
+ int has_vectors = av_get_cpu_flags();
+ if (has_vectors & AV_CPU_FLAG_SSE && HAVE_SSE)
+ s->dct32 = ff_dct32_float_sse;
+ if (has_vectors & AV_CPU_FLAG_SSE2 && HAVE_SSE)
+ s->dct32 = ff_dct32_float_sse2;
+ if (has_vectors & AV_CPU_FLAG_AVX && HAVE_AVX)
+ s->dct32 = ff_dct32_float_avx;
+#endif
+}
+#endif