Christophe Gisquet <[email protected]> writes: > 2012/6/26 Måns Rullgård <[email protected]>: >> Send a patch. > > From 8bb72535b4029263df73fa694892dcdbd667b15f Mon Sep 17 00:00:00 2001 > From: Christophe Gisquet <[email protected]> > Date: Tue, 26 Jun 2012 16:10:33 +0200 > Subject: [PATCH] FFT x86: replace call to memcpy by a loop > > The function call was a mess to handle, and memcpy cannot make the assumptions > we do in the new code. > > Tested on an IMC sample: 430c -> 370c. > --- > libavcodec/x86/fft_mmx.asm | 34 ++++++++++++---------------------- > 1 files changed, 12 insertions(+), 22 deletions(-) > > diff --git a/libavcodec/x86/fft_mmx.asm b/libavcodec/x86/fft_mmx.asm > index 007f5ca..f79699a 100644 > --- a/libavcodec/x86/fft_mmx.asm > +++ b/libavcodec/x86/fft_mmx.asm > @@ -636,30 +636,20 @@ cglobal fft_permute, 2,7,1 > add r0, 2 > cmp r0, r2 > jl .loop > + > shl r2, 3 > -%if ARCH_X86_64 > - mov r0, r1 > - mov r1, r5 > -%endif > -%if WIN64 > - sub rsp, 8 > - call memcpy > - add rsp, 8 > - RET > -%elif ARCH_X86_64 > -%ifdef PIC > - jmp memcpy wrt ..plt > -%else > - jmp memcpy > -%endif > -%else > - push r2 > - push r5 > - push r1 > - call memcpy > - add esp, 12 > + add r1, r2 > + add r5, r2 > + neg r2 > +; nbits >= 2 (FFT4) and sizeof(FFTComplex)=8 => at least 32b per iteration
s/per iteration// > +.loopcopy: > + movaps xmm0, [r5 + r2] > + movaps xmm1, [r5 + r2 + 16] > + movaps [r1 + r2], xmm0 > + movaps [r1 + r2 + 16], xmm1 > + add r2, 32 > + jl .loopcopy > RET > -%endif > > cglobal imdct_calc, 3,5,3 > mov r3d, [r0 + FFTContext.mdctsize] > -- Seems reasonable from what I can tell. -- Måns Rullgård [email protected] _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
