mirror of
				https://git.ffmpeg.org/ffmpeg.git
				synced 2025-10-30 23:30:55 +00:00 
			
		
		
		
	 8c6ebab747
			
		
	
	
		8c6ebab747
		
	
	
	
	
		
			
			* qatar/master: (26 commits) eac3dec: replace undefined 1<<31 with INT32_MIN in noise generation yadif: specify array size outside DECLARE_ALIGNED prores: specify array size outside DECLARE_ALIGNED brackets. WavPack demuxer: set packet duration tta: use skip_bits_long() mxfdec: Ignore the last entry in Avid's index table segments mxfdec: Sanity-check SampleRate mxfdec: Handle small EditUnitByteCount mxfdec: Consider OPAtom files that do not have exactly one EC to be OP1a mxfdec: Don't crash in mxf_packet_timestamps() if current_edit_unit overflows mxfdec: Zero nb_ptses in mxf_compute_ptses_fake_index() mxfdec: Sanity check PreviousPartition mxfdec: Never seek back in local sets and KLVs mxfdec: Move the current_partition check inside mxf_read_header() mxfdec: Fix infinite loop in mxf_packet_timestamps() mxfdec: Check eof_reached in mxf_read_local_tags() mxfdec: Check for NULL component mxfdec: Make sure mxf->nb_index_tables > 0 in mxf_packet_timestamps() mxfdec: Make sure x < index_table->nb_ptses build: Add missing directories to DIRS declarations. ... Conflicts: doc/build_system.txt doc/fate.texi libavfilter/x86/yadif_template.c libavformat/mxfdec.c libavutil/Makefile tests/fate/audio.mak tests/fate/prores.mak tests/fate/screen.mak tests/fate/video.mak tests/ref/fate/bethsoft-vid tests/ref/fate/cscd tests/ref/fate/dfa4 tests/ref/fate/nuv tests/ref/fate/vp8-sign-bias tests/ref/fate/wmv8-drm tests/ref/lavf/gxf Merged-by: Michael Niedermayer <michaelni@gmx.at>
		
			
				
	
	
		
			110 lines
		
	
	
	
		
			3.1 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			110 lines
		
	
	
	
		
			3.1 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| /*
 | |
|  * FFT/MDCT transform with SSE optimizations
 | |
|  * Copyright (c) 2008 Loren Merritt
 | |
|  *
 | |
|  * 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/x86_cpu.h"
 | |
| #include "libavcodec/dsputil.h"
 | |
| #include "fft.h"
 | |
| #include "config.h"
 | |
| 
 | |
| DECLARE_ASM_CONST(16, unsigned int, ff_m1m1m1m1)[4] =
 | |
|     { 1U << 31, 1U << 31, 1U << 31, 1U << 31 };
 | |
| 
 | |
| void ff_fft_dispatch_sse(FFTComplex *z, int nbits);
 | |
| void ff_fft_dispatch_interleave_sse(FFTComplex *z, int nbits);
 | |
| void ff_fft_dispatch_interleave_avx(FFTComplex *z, int nbits);
 | |
| 
 | |
| #if HAVE_AVX
 | |
| void ff_fft_calc_avx(FFTContext *s, FFTComplex *z)
 | |
| {
 | |
|     ff_fft_dispatch_interleave_avx(z, s->nbits);
 | |
| }
 | |
| #endif
 | |
| 
 | |
| void ff_fft_calc_sse(FFTContext *s, FFTComplex *z)
 | |
| {
 | |
|     int n = 1 << s->nbits;
 | |
| 
 | |
|     ff_fft_dispatch_interleave_sse(z, s->nbits);
 | |
| 
 | |
|     if(n <= 16) {
 | |
|         x86_reg i = -8*n;
 | |
|         __asm__ volatile(
 | |
|             "1: \n"
 | |
|             "movaps     (%0,%1), %%xmm0 \n"
 | |
|             "movaps      %%xmm0, %%xmm1 \n"
 | |
|             "unpcklps 16(%0,%1), %%xmm0 \n"
 | |
|             "unpckhps 16(%0,%1), %%xmm1 \n"
 | |
|             "movaps      %%xmm0,   (%0,%1) \n"
 | |
|             "movaps      %%xmm1, 16(%0,%1) \n"
 | |
|             "add $32, %0 \n"
 | |
|             "jl 1b \n"
 | |
|             :"+r"(i)
 | |
|             :"r"(z+n)
 | |
|             :"memory"
 | |
|         );
 | |
|     }
 | |
| }
 | |
| 
 | |
| void ff_fft_permute_sse(FFTContext *s, FFTComplex *z)
 | |
| {
 | |
|     int n = 1 << s->nbits;
 | |
|     int i;
 | |
|     for(i=0; i<n; i+=2) {
 | |
|         __asm__ volatile(
 | |
|             "movaps %2, %%xmm0 \n"
 | |
|             "movlps %%xmm0, %0 \n"
 | |
|             "movhps %%xmm0, %1 \n"
 | |
|             :"=m"(s->tmp_buf[s->revtab[i]]),
 | |
|              "=m"(s->tmp_buf[s->revtab[i+1]])
 | |
|             :"m"(z[i])
 | |
|         );
 | |
|     }
 | |
|     memcpy(z, s->tmp_buf, n*sizeof(FFTComplex));
 | |
| }
 | |
| 
 | |
| void ff_imdct_calc_sse(FFTContext *s, FFTSample *output, const FFTSample *input)
 | |
| {
 | |
|     x86_reg j, k;
 | |
|     long n = s->mdct_size;
 | |
|     long n4 = n >> 2;
 | |
| 
 | |
|     s->imdct_half(s, output + n4, input);
 | |
| 
 | |
|     j = -n;
 | |
|     k = n-16;
 | |
|     __asm__ volatile(
 | |
|         "movaps "MANGLE(ff_m1m1m1m1)", %%xmm7 \n"
 | |
|         "1: \n"
 | |
|         "movaps       (%2,%1), %%xmm0 \n"
 | |
|         "movaps       (%3,%0), %%xmm1 \n"
 | |
|         "shufps $0x1b, %%xmm0, %%xmm0 \n"
 | |
|         "shufps $0x1b, %%xmm1, %%xmm1 \n"
 | |
|         "xorps         %%xmm7, %%xmm0 \n"
 | |
|         "movaps        %%xmm1, (%3,%1) \n"
 | |
|         "movaps        %%xmm0, (%2,%0) \n"
 | |
|         "sub $16, %1 \n"
 | |
|         "add $16, %0 \n"
 | |
|         "jl 1b \n"
 | |
|         :"+r"(j), "+r"(k)
 | |
|         :"r"(output+n4), "r"(output+n4*3)
 | |
|         XMM_CLOBBERS_ONLY("%xmm0", "%xmm1", "%xmm7")
 | |
|     );
 | |
| }
 |