Mercurial > libavcodec.hg
annotate i386/fft_3dn2.c @ 5179:04bbac6e28df libavcodec
modify msmpeg4 functions to generate VC1 compatible block layer bitstream
patch by Fortin Denis: \fortin nerim net/
original thread: [FFmpeg-devel] [PATCH] wmv3 encoder : msmpeg4.c changes
date: 06/19/2007 09:54 PM
author | benoit |
---|---|
date | Fri, 22 Jun 2007 08:35:21 +0000 |
parents | d5ba514e3f4a |
children | 33896780c612 |
rev | line source |
---|---|
3175 | 1 /* |
2 * FFT/MDCT transform with Extended 3DNow! optimizations | |
3555 | 3 * Copyright (c) 2006 Zuxy MENG Jie, Loren Merritt |
3175 | 4 * Based on fft_sse.c copyright (c) 2002 Fabrice Bellard. |
5 * | |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3748
diff
changeset
|
6 * This file is part of FFmpeg. |
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3748
diff
changeset
|
7 * |
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3748
diff
changeset
|
8 * FFmpeg is free software; you can redistribute it and/or |
3175 | 9 * modify it under the terms of the GNU Lesser General Public |
10 * License as published by the Free Software Foundation; either | |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3748
diff
changeset
|
11 * version 2.1 of the License, or (at your option) any later version. |
3175 | 12 * |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3748
diff
changeset
|
13 * FFmpeg is distributed in the hope that it will be useful, |
3175 | 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
16 * Lesser General Public License for more details. | |
17 * | |
18 * You should have received a copy of the GNU Lesser General Public | |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3748
diff
changeset
|
19 * License along with FFmpeg; if not, write to the Free Software |
3175 | 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
21 */ | |
5010
d5ba514e3f4a
Add libavcodec to compiler include flags in order to simplify header
diego
parents:
3947
diff
changeset
|
22 #include "dsputil.h" |
3175 | 23 |
24 static const int p1m1[2] __attribute__((aligned(8))) = | |
25 { 0, 1 << 31 }; | |
26 | |
27 static const int m1p1[2] __attribute__((aligned(8))) = | |
28 { 1 << 31, 0 }; | |
29 | |
30 void ff_fft_calc_3dn2(FFTContext *s, FFTComplex *z) | |
31 { | |
32 int ln = s->nbits; | |
3590
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
33 long i, j; |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
34 long nblocks, nloops; |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
35 FFTComplex *p, *cptr; |
3175 | 36 |
3590
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
37 asm volatile( |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
38 /* FEMMS is not a must here but recommended by AMD */ |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
39 "femms \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
40 "movq %0, %%mm7 \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
41 ::"m"(*(s->inverse ? m1p1 : p1m1)) |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
42 ); |
3175 | 43 |
3590
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
44 i = 8 << ln; |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
45 asm volatile( |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
46 "1: \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
47 "sub $32, %0 \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
48 "movq (%0,%1), %%mm0 \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
49 "movq 16(%0,%1), %%mm1 \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
50 "movq 8(%0,%1), %%mm2 \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
51 "movq 24(%0,%1), %%mm3 \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
52 "movq %%mm0, %%mm4 \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
53 "movq %%mm1, %%mm5 \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
54 "pfadd %%mm2, %%mm0 \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
55 "pfadd %%mm3, %%mm1 \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
56 "pfsub %%mm2, %%mm4 \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
57 "pfsub %%mm3, %%mm5 \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
58 "movq %%mm0, %%mm2 \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
59 "pswapd %%mm5, %%mm5 \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
60 "movq %%mm4, %%mm3 \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
61 "pxor %%mm7, %%mm5 \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
62 "pfadd %%mm1, %%mm0 \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
63 "pfadd %%mm5, %%mm4 \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
64 "pfsub %%mm1, %%mm2 \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
65 "pfsub %%mm5, %%mm3 \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
66 "movq %%mm0, (%0,%1) \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
67 "movq %%mm4, 8(%0,%1) \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
68 "movq %%mm2, 16(%0,%1) \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
69 "movq %%mm3, 24(%0,%1) \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
70 "jg 1b \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
71 :"+r"(i) |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
72 :"r"(z) |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
73 ); |
3175 | 74 /* pass 2 .. ln-1 */ |
75 | |
3590
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
76 nblocks = 1 << (ln-3); |
3175 | 77 nloops = 1 << 2; |
3590
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
78 cptr = s->exptab1; |
3175 | 79 do { |
80 p = z; | |
81 j = nblocks; | |
82 do { | |
3590
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
83 i = nloops*8; |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
84 asm volatile( |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
85 "1: \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
86 "sub $16, %0 \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
87 "movq (%1,%0), %%mm0 \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
88 "movq 8(%1,%0), %%mm1 \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
89 "movq (%2,%0), %%mm2 \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
90 "movq 8(%2,%0), %%mm3 \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
91 "movq (%3,%0,2), %%mm4 \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
92 "movq 8(%3,%0,2), %%mm5 \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
93 "pswapd %%mm4, %%mm6 \n\t" // no need for cptr[2] & cptr[3] |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
94 "pswapd %%mm5, %%mm7 \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
95 "pfmul %%mm2, %%mm4 \n\t" // cre*re cim*im |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
96 "pfmul %%mm3, %%mm5 \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
97 "pfmul %%mm2, %%mm6 \n\t" // cim*re cre*im |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
98 "pfmul %%mm3, %%mm7 \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
99 "pfpnacc %%mm6, %%mm4 \n\t" // cre*re-cim*im cim*re+cre*im |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
100 "pfpnacc %%mm7, %%mm5 \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
101 "movq %%mm0, %%mm2 \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
102 "movq %%mm1, %%mm3 \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
103 "pfadd %%mm4, %%mm0 \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
104 "pfadd %%mm5, %%mm1 \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
105 "pfsub %%mm4, %%mm2 \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
106 "pfsub %%mm5, %%mm3 \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
107 "movq %%mm0, (%1,%0) \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
108 "movq %%mm1, 8(%1,%0) \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
109 "movq %%mm2, (%2,%0) \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
110 "movq %%mm3, 8(%2,%0) \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
111 "jg 1b \n\t" |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
112 :"+r"(i) |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
113 :"r"(p), "r"(p + nloops), "r"(cptr) |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
114 ); |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
115 p += nloops*2; |
3175 | 116 } while (--j); |
3590
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
117 cptr += nloops*2; |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
118 nblocks >>= 1; |
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
119 nloops <<= 1; |
3175 | 120 } while (nblocks != 0); |
3590
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
121 asm volatile("femms"); |
3175 | 122 } |
123 | |
3555 | 124 void ff_imdct_calc_3dn2(MDCTContext *s, FFTSample *output, |
125 const FFTSample *input, FFTSample *tmp) | |
126 { | |
3559
c02459cd0d31
slightly faster ff_imdct_calc_3dn2() on amd64. (gcc added a bunch of useless movsxd)
lorenm
parents:
3555
diff
changeset
|
127 long k, n8, n4, n2, n; |
3555 | 128 const uint16_t *revtab = s->fft.revtab; |
129 const FFTSample *tcos = s->tcos; | |
130 const FFTSample *tsin = s->tsin; | |
131 const FFTSample *in1, *in2; | |
132 FFTComplex *z = (FFTComplex *)tmp; | |
133 | |
134 n = 1 << s->nbits; | |
135 n2 = n >> 1; | |
136 n4 = n >> 2; | |
137 n8 = n >> 3; | |
138 | |
139 /* pre rotation */ | |
140 in1 = input; | |
141 in2 = input + n2 - 1; | |
142 for(k = 0; k < n4; k++) { | |
3560
f1a16d793fc5
gcc 2.95 and 3.4.x on x86 32bit without fomit-frame-pointer can't even find 5 registers for asm input.
lorenm
parents:
3559
diff
changeset
|
143 // FIXME a single block is faster, but gcc 2.95 and 3.4.x on 32bit can't compile it |
3555 | 144 asm volatile( |
3560
f1a16d793fc5
gcc 2.95 and 3.4.x on x86 32bit without fomit-frame-pointer can't even find 5 registers for asm input.
lorenm
parents:
3559
diff
changeset
|
145 "movd %0, %%mm0 \n\t" |
f1a16d793fc5
gcc 2.95 and 3.4.x on x86 32bit without fomit-frame-pointer can't even find 5 registers for asm input.
lorenm
parents:
3559
diff
changeset
|
146 "movd %2, %%mm1 \n\t" |
f1a16d793fc5
gcc 2.95 and 3.4.x on x86 32bit without fomit-frame-pointer can't even find 5 registers for asm input.
lorenm
parents:
3559
diff
changeset
|
147 "punpckldq %1, %%mm0 \n\t" |
f1a16d793fc5
gcc 2.95 and 3.4.x on x86 32bit without fomit-frame-pointer can't even find 5 registers for asm input.
lorenm
parents:
3559
diff
changeset
|
148 "punpckldq %3, %%mm1 \n\t" |
3555 | 149 "movq %%mm0, %%mm2 \n\t" |
150 "pfmul %%mm1, %%mm0 \n\t" | |
151 "pswapd %%mm1, %%mm1 \n\t" | |
152 "pfmul %%mm1, %%mm2 \n\t" | |
153 "pfpnacc %%mm2, %%mm0 \n\t" | |
3560
f1a16d793fc5
gcc 2.95 and 3.4.x on x86 32bit without fomit-frame-pointer can't even find 5 registers for asm input.
lorenm
parents:
3559
diff
changeset
|
154 ::"m"(in2[-2*k]), "m"(in1[2*k]), |
f1a16d793fc5
gcc 2.95 and 3.4.x on x86 32bit without fomit-frame-pointer can't even find 5 registers for asm input.
lorenm
parents:
3559
diff
changeset
|
155 "m"(tcos[k]), "m"(tsin[k]) |
f1a16d793fc5
gcc 2.95 and 3.4.x on x86 32bit without fomit-frame-pointer can't even find 5 registers for asm input.
lorenm
parents:
3559
diff
changeset
|
156 ); |
f1a16d793fc5
gcc 2.95 and 3.4.x on x86 32bit without fomit-frame-pointer can't even find 5 registers for asm input.
lorenm
parents:
3559
diff
changeset
|
157 asm volatile( |
3555 | 158 "movq %%mm0, %0 \n\t" |
159 :"=m"(z[revtab[k]]) | |
160 ); | |
161 } | |
162 | |
163 ff_fft_calc(&s->fft, z); | |
164 | |
165 /* post rotation + reordering */ | |
166 for(k = 0; k < n4; k++) { | |
167 asm volatile( | |
168 "movq %0, %%mm0 \n\t" | |
169 "movd %1, %%mm1 \n\t" | |
170 "punpckldq %2, %%mm1 \n\t" | |
171 "movq %%mm0, %%mm2 \n\t" | |
172 "pfmul %%mm1, %%mm0 \n\t" | |
173 "pswapd %%mm1, %%mm1 \n\t" | |
174 "pfmul %%mm1, %%mm2 \n\t" | |
175 "pfpnacc %%mm2, %%mm0 \n\t" | |
176 "movq %%mm0, %0 \n\t" | |
177 :"+m"(z[k]) | |
178 :"m"(tcos[k]), "m"(tsin[k]) | |
179 ); | |
180 } | |
181 | |
3747 | 182 k = n-8; |
3555 | 183 asm volatile("movd %0, %%mm7" ::"r"(1<<31)); |
3747 | 184 asm volatile( |
3748 | 185 "1: \n\t" |
186 "movq (%4,%0), %%mm0 \n\t" // z[n8+k] | |
187 "neg %0 \n\t" | |
188 "pswapd -8(%4,%0), %%mm1 \n\t" // z[n8-1-k] | |
189 "movq %%mm0, %%mm2 \n\t" | |
190 "pxor %%mm7, %%mm2 \n\t" | |
191 "punpckldq %%mm1, %%mm2 \n\t" | |
192 "pswapd %%mm2, %%mm3 \n\t" | |
193 "punpckhdq %%mm1, %%mm0 \n\t" | |
194 "pswapd %%mm0, %%mm4 \n\t" | |
195 "pxor %%mm7, %%mm0 \n\t" | |
196 "pxor %%mm7, %%mm4 \n\t" | |
197 "movq %%mm3, -8(%3,%0) \n\t" // output[n-2-2*k] = { z[n8-1-k].im, -z[n8+k].re } | |
198 "movq %%mm4, -8(%2,%0) \n\t" // output[n2-2-2*k]= { -z[n8-1-k].re, z[n8+k].im } | |
199 "neg %0 \n\t" | |
200 "movq %%mm0, (%1,%0) \n\t" // output[2*k] = { -z[n8+k].im, z[n8-1-k].re } | |
201 "movq %%mm2, (%2,%0) \n\t" // output[n2+2*k] = { -z[n8+k].re, z[n8-1-k].im } | |
202 "sub $8, %0 \n\t" | |
203 "jge 1b \n\t" | |
3747 | 204 :"+r"(k) |
205 :"r"(output), "r"(output+n2), "r"(output+n), "r"(z+n8) | |
206 :"memory" | |
207 ); | |
3561 | 208 asm volatile("femms"); |
3555 | 209 } |
3590
a3d97c60ea07
ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents:
3561
diff
changeset
|
210 |