annotate liba52/resample_mmx.c @ 4504:6287a2ff4d08 libavcodec

merge asm fragments in H264_CHROMA_MC2_TMPL() 10% faster avg_h264_chroma_mc2_mmx2() 5% faster put_h264_chroma_mc2_mmx2()
author michael
date Fri, 09 Feb 2007 12:24:22 +0000
parents 1d69d79f7cc3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3673
1d69d79f7cc3 Exchange informal GPL notice by official license header.
diego
parents: 2967
diff changeset
1 /*
1d69d79f7cc3 Exchange informal GPL notice by official license header.
diego
parents: 2967
diff changeset
2 * resample_mmx.c
1d69d79f7cc3 Exchange informal GPL notice by official license header.
diego
parents: 2967
diff changeset
3 * Copyright (C) 2003 Michael Niedermayer <michaelni@gmx.at>
1d69d79f7cc3 Exchange informal GPL notice by official license header.
diego
parents: 2967
diff changeset
4 *
1d69d79f7cc3 Exchange informal GPL notice by official license header.
diego
parents: 2967
diff changeset
5 * This file is part of a52dec, a free ATSC A-52 stream decoder.
1d69d79f7cc3 Exchange informal GPL notice by official license header.
diego
parents: 2967
diff changeset
6 * See http://liba52.sourceforge.net/ for updates.
1d69d79f7cc3 Exchange informal GPL notice by official license header.
diego
parents: 2967
diff changeset
7 *
1d69d79f7cc3 Exchange informal GPL notice by official license header.
diego
parents: 2967
diff changeset
8 * a52dec is free software; you can redistribute it and/or modify
1d69d79f7cc3 Exchange informal GPL notice by official license header.
diego
parents: 2967
diff changeset
9 * it under the terms of the GNU General Public License as published by
1d69d79f7cc3 Exchange informal GPL notice by official license header.
diego
parents: 2967
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
1d69d79f7cc3 Exchange informal GPL notice by official license header.
diego
parents: 2967
diff changeset
11 * (at your option) any later version.
1d69d79f7cc3 Exchange informal GPL notice by official license header.
diego
parents: 2967
diff changeset
12 *
1d69d79f7cc3 Exchange informal GPL notice by official license header.
diego
parents: 2967
diff changeset
13 * a52dec is distributed in the hope that it will be useful,
1d69d79f7cc3 Exchange informal GPL notice by official license header.
diego
parents: 2967
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
1d69d79f7cc3 Exchange informal GPL notice by official license header.
diego
parents: 2967
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1d69d79f7cc3 Exchange informal GPL notice by official license header.
diego
parents: 2967
diff changeset
16 * GNU General Public License for more details.
1d69d79f7cc3 Exchange informal GPL notice by official license header.
diego
parents: 2967
diff changeset
17 *
1d69d79f7cc3 Exchange informal GPL notice by official license header.
diego
parents: 2967
diff changeset
18 * You should have received a copy of the GNU General Public License
1d69d79f7cc3 Exchange informal GPL notice by official license header.
diego
parents: 2967
diff changeset
19 * along with this program; if not, write to the Free Software
1d69d79f7cc3 Exchange informal GPL notice by official license header.
diego
parents: 2967
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1d69d79f7cc3 Exchange informal GPL notice by official license header.
diego
parents: 2967
diff changeset
21 */
1193
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
22
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2352
diff changeset
23 /* optimization TODO / NOTES
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2352
diff changeset
24 movntq is slightly faster (0.5% with the current test.c benchmark)
1193
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
25 (but thats just test.c so that needs to be testd in reallity)
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2352
diff changeset
26 and it would mean (C / MMX2 / MMX / 3DNOW) versions
1193
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
27 */
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
28
2352
06e1d7d44d19 attribute_used
michael
parents: 1193
diff changeset
29 static uint64_t __attribute__((aligned(8))) attribute_used magicF2W= 0x43c0000043c00000LL;
06e1d7d44d19 attribute_used
michael
parents: 1193
diff changeset
30 static uint64_t __attribute__((aligned(8))) attribute_used wm1010= 0xFFFF0000FFFF0000LL;
06e1d7d44d19 attribute_used
michael
parents: 1193
diff changeset
31 static uint64_t __attribute__((aligned(8))) attribute_used wm0101= 0x0000FFFF0000FFFFLL;
06e1d7d44d19 attribute_used
michael
parents: 1193
diff changeset
32 static uint64_t __attribute__((aligned(8))) attribute_used wm1100= 0xFFFFFFFF00000000LL;
1193
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
33
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
34 static int a52_resample_MONO_to_5_MMX(float * _f, int16_t * s16){
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
35 int32_t * f = (int32_t *) _f;
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
36 asm volatile(
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
37 "movl $-512, %%esi \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
38 "movq "MANGLE(magicF2W)", %%mm7 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
39 "movq "MANGLE(wm1100)", %%mm3 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
40 "movq "MANGLE(wm0101)", %%mm4 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
41 "movq "MANGLE(wm1010)", %%mm5 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
42 "pxor %%mm6, %%mm6 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
43 "1: \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
44 "movq (%1, %%esi, 2), %%mm0 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
45 "movq 8(%1, %%esi, 2), %%mm1 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
46 "leal (%%esi, %%esi, 4), %%edi \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
47 "psubd %%mm7, %%mm0 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
48 "psubd %%mm7, %%mm1 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
49 "packssdw %%mm1, %%mm0 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
50 "movq %%mm0, %%mm1 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
51 "pand %%mm4, %%mm0 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
52 "pand %%mm5, %%mm1 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
53 "movq %%mm6, (%0, %%edi) \n\t" // 0 0 0 0
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
54 "movd %%mm0, 8(%0, %%edi) \n\t" // A 0
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
55 "pand %%mm3, %%mm0 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
56 "movd %%mm6, 12(%0, %%edi) \n\t" // 0 0
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
57 "movd %%mm1, 16(%0, %%edi) \n\t" // 0 B
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
58 "pand %%mm3, %%mm1 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
59 "movd %%mm6, 20(%0, %%edi) \n\t" // 0 0
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
60 "movq %%mm0, 24(%0, %%edi) \n\t" // 0 0 C 0
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
61 "movq %%mm1, 32(%0, %%edi) \n\t" // 0 0 0 B
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
62 "addl $8, %%esi \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
63 " jnz 1b \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
64 "emms \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
65 :: "r" (s16+1280), "r" (f+256)
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
66 :"%esi", "%edi", "memory"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
67 );
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
68 return 5*256;
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
69 }
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
70
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
71 static int a52_resample_STEREO_to_2_MMX(float * _f, int16_t * s16){
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
72 int32_t * f = (int32_t *) _f;
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
73 /* benchmark scores are 0.3% better with SSE but we would need to set bias=0 and premultiply it
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
74 #ifdef HAVE_SSE
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
75 asm volatile(
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
76 "movl $-1024, %%esi \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
77 "1: \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
78 "cvtps2pi (%1, %%esi), %%mm0 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
79 "cvtps2pi 1024(%1, %%esi), %%mm2\n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
80 "movq %%mm0, %%mm1 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
81 "punpcklwd %%mm2, %%mm0 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
82 "punpckhwd %%mm2, %%mm1 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
83 "movq %%mm0, (%0, %%esi) \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
84 "movq %%mm1, 8(%0, %%esi) \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
85 "addl $16, %%esi \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
86 " jnz 1b \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
87 "emms \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
88 :: "r" (s16+512), "r" (f+256)
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
89 :"%esi", "memory"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
90 );*/
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
91 asm volatile(
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
92 "movl $-1024, %%esi \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
93 "movq "MANGLE(magicF2W)", %%mm7 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
94 "1: \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
95 "movq (%1, %%esi), %%mm0 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
96 "movq 8(%1, %%esi), %%mm1 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
97 "movq 1024(%1, %%esi), %%mm2 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
98 "movq 1032(%1, %%esi), %%mm3 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
99 "psubd %%mm7, %%mm0 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
100 "psubd %%mm7, %%mm1 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
101 "psubd %%mm7, %%mm2 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
102 "psubd %%mm7, %%mm3 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
103 "packssdw %%mm1, %%mm0 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
104 "packssdw %%mm3, %%mm2 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
105 "movq %%mm0, %%mm1 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
106 "punpcklwd %%mm2, %%mm0 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
107 "punpckhwd %%mm2, %%mm1 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
108 "movq %%mm0, (%0, %%esi) \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
109 "movq %%mm1, 8(%0, %%esi) \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
110 "addl $16, %%esi \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
111 " jnz 1b \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
112 "emms \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
113 :: "r" (s16+512), "r" (f+256)
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
114 :"%esi", "memory"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
115 );
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
116 return 2*256;
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
117 }
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
118
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
119 static int a52_resample_3F_to_5_MMX(float * _f, int16_t * s16){
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
120 int32_t * f = (int32_t *) _f;
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
121 asm volatile(
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
122 "movl $-1024, %%esi \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
123 "movq "MANGLE(magicF2W)", %%mm7 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
124 "pxor %%mm6, %%mm6 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
125 "movq %%mm7, %%mm5 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
126 "punpckldq %%mm6, %%mm5 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
127 "1: \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
128 "movd (%1, %%esi), %%mm0 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
129 "punpckldq 2048(%1, %%esi), %%mm0\n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
130 "movd 1024(%1, %%esi), %%mm1 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
131 "punpckldq 4(%1, %%esi), %%mm1 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
132 "movd 2052(%1, %%esi), %%mm2 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
133 "movq %%mm7, %%mm3 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
134 "punpckldq 1028(%1, %%esi), %%mm3\n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
135 "movd 8(%1, %%esi), %%mm4 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
136 "punpckldq 2056(%1, %%esi), %%mm4\n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
137 "leal (%%esi, %%esi, 4), %%edi \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
138 "sarl $1, %%edi \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
139 "psubd %%mm7, %%mm0 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
140 "psubd %%mm7, %%mm1 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
141 "psubd %%mm5, %%mm2 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
142 "psubd %%mm7, %%mm3 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
143 "psubd %%mm7, %%mm4 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
144 "packssdw %%mm6, %%mm0 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
145 "packssdw %%mm2, %%mm1 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
146 "packssdw %%mm4, %%mm3 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
147 "movq %%mm0, (%0, %%edi) \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
148 "movq %%mm1, 8(%0, %%edi) \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
149 "movq %%mm3, 16(%0, %%edi) \n\t"
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2352
diff changeset
150
1193
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
151 "movd 1032(%1, %%esi), %%mm1 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
152 "punpckldq 12(%1, %%esi), %%mm1\n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
153 "movd 2060(%1, %%esi), %%mm2 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
154 "movq %%mm7, %%mm3 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
155 "punpckldq 1036(%1, %%esi), %%mm3\n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
156 "pxor %%mm0, %%mm0 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
157 "psubd %%mm7, %%mm1 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
158 "psubd %%mm5, %%mm2 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
159 "psubd %%mm7, %%mm3 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
160 "packssdw %%mm1, %%mm0 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
161 "packssdw %%mm3, %%mm2 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
162 "movq %%mm0, 24(%0, %%edi) \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
163 "movq %%mm2, 32(%0, %%edi) \n\t"
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2352
diff changeset
164
1193
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
165 "addl $16, %%esi \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
166 " jnz 1b \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
167 "emms \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
168 :: "r" (s16+1280), "r" (f+256)
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
169 :"%esi", "%edi", "memory"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
170 );
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
171 return 5*256;
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
172 }
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
173
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
174 static int a52_resample_2F_2R_to_4_MMX(float * _f, int16_t * s16){
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
175 int32_t * f = (int32_t *) _f;
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
176 asm volatile(
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
177 "movl $-1024, %%esi \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
178 "movq "MANGLE(magicF2W)", %%mm7 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
179 "1: \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
180 "movq (%1, %%esi), %%mm0 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
181 "movq 8(%1, %%esi), %%mm1 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
182 "movq 1024(%1, %%esi), %%mm2 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
183 "movq 1032(%1, %%esi), %%mm3 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
184 "psubd %%mm7, %%mm0 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
185 "psubd %%mm7, %%mm1 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
186 "psubd %%mm7, %%mm2 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
187 "psubd %%mm7, %%mm3 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
188 "packssdw %%mm1, %%mm0 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
189 "packssdw %%mm3, %%mm2 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
190 "movq 2048(%1, %%esi), %%mm3 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
191 "movq 2056(%1, %%esi), %%mm4 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
192 "movq 3072(%1, %%esi), %%mm5 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
193 "movq 3080(%1, %%esi), %%mm6 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
194 "psubd %%mm7, %%mm3 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
195 "psubd %%mm7, %%mm4 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
196 "psubd %%mm7, %%mm5 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
197 "psubd %%mm7, %%mm6 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
198 "packssdw %%mm4, %%mm3 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
199 "packssdw %%mm6, %%mm5 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
200 "movq %%mm0, %%mm1 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
201 "movq %%mm3, %%mm4 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
202 "punpcklwd %%mm2, %%mm0 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
203 "punpckhwd %%mm2, %%mm1 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
204 "punpcklwd %%mm5, %%mm3 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
205 "punpckhwd %%mm5, %%mm4 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
206 "movq %%mm0, %%mm2 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
207 "movq %%mm1, %%mm5 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
208 "punpckldq %%mm3, %%mm0 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
209 "punpckhdq %%mm3, %%mm2 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
210 "punpckldq %%mm4, %%mm1 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
211 "punpckhdq %%mm4, %%mm5 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
212 "movq %%mm0, (%0, %%esi,2) \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
213 "movq %%mm2, 8(%0, %%esi,2) \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
214 "movq %%mm1, 16(%0, %%esi,2) \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
215 "movq %%mm5, 24(%0, %%esi,2) \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
216 "addl $16, %%esi \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
217 " jnz 1b \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
218 "emms \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
219 :: "r" (s16+1024), "r" (f+256)
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
220 :"%esi", "memory"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
221 );
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
222 return 4*256;
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
223 }
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
224
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
225 static int a52_resample_3F_2R_to_5_MMX(float * _f, int16_t * s16){
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
226 int32_t * f = (int32_t *) _f;
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
227 asm volatile(
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
228 "movl $-1024, %%esi \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
229 "movq "MANGLE(magicF2W)", %%mm7 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
230 "1: \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
231 "movd (%1, %%esi), %%mm0 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
232 "punpckldq 2048(%1, %%esi), %%mm0\n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
233 "movd 3072(%1, %%esi), %%mm1 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
234 "punpckldq 4096(%1, %%esi), %%mm1\n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
235 "movd 1024(%1, %%esi), %%mm2 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
236 "punpckldq 4(%1, %%esi), %%mm2 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
237 "movd 2052(%1, %%esi), %%mm3 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
238 "punpckldq 3076(%1, %%esi), %%mm3\n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
239 "movd 4100(%1, %%esi), %%mm4 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
240 "punpckldq 1028(%1, %%esi), %%mm4\n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
241 "movd 8(%1, %%esi), %%mm5 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
242 "punpckldq 2056(%1, %%esi), %%mm5\n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
243 "leal (%%esi, %%esi, 4), %%edi \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
244 "sarl $1, %%edi \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
245 "psubd %%mm7, %%mm0 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
246 "psubd %%mm7, %%mm1 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
247 "psubd %%mm7, %%mm2 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
248 "psubd %%mm7, %%mm3 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
249 "psubd %%mm7, %%mm4 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
250 "psubd %%mm7, %%mm5 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
251 "packssdw %%mm1, %%mm0 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
252 "packssdw %%mm3, %%mm2 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
253 "packssdw %%mm5, %%mm4 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
254 "movq %%mm0, (%0, %%edi) \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
255 "movq %%mm2, 8(%0, %%edi) \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
256 "movq %%mm4, 16(%0, %%edi) \n\t"
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2352
diff changeset
257
1193
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
258 "movd 3080(%1, %%esi), %%mm0 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
259 "punpckldq 4104(%1, %%esi), %%mm0\n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
260 "movd 1032(%1, %%esi), %%mm1 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
261 "punpckldq 12(%1, %%esi), %%mm1\n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
262 "movd 2060(%1, %%esi), %%mm2 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
263 "punpckldq 3084(%1, %%esi), %%mm2\n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
264 "movd 4108(%1, %%esi), %%mm3 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
265 "punpckldq 1036(%1, %%esi), %%mm3\n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
266 "psubd %%mm7, %%mm0 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
267 "psubd %%mm7, %%mm1 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
268 "psubd %%mm7, %%mm2 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
269 "psubd %%mm7, %%mm3 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
270 "packssdw %%mm1, %%mm0 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
271 "packssdw %%mm3, %%mm2 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
272 "movq %%mm0, 24(%0, %%edi) \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
273 "movq %%mm2, 32(%0, %%edi) \n\t"
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2352
diff changeset
274
1193
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
275 "addl $16, %%esi \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
276 " jnz 1b \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
277 "emms \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
278 :: "r" (s16+1280), "r" (f+256)
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
279 :"%esi", "%edi", "memory"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
280 );
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
281 return 5*256;
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
282 }
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
283
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
284 static int a52_resample_MONO_LFE_to_6_MMX(float * _f, int16_t * s16){
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
285 int32_t * f = (int32_t *) _f;
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
286 asm volatile(
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
287 "movl $-1024, %%esi \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
288 "movq "MANGLE(magicF2W)", %%mm7 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
289 "pxor %%mm6, %%mm6 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
290 "1: \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
291 "movq 1024(%1, %%esi), %%mm0 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
292 "movq 1032(%1, %%esi), %%mm1 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
293 "movq (%1, %%esi), %%mm2 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
294 "movq 8(%1, %%esi), %%mm3 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
295 "psubd %%mm7, %%mm0 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
296 "psubd %%mm7, %%mm1 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
297 "psubd %%mm7, %%mm2 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
298 "psubd %%mm7, %%mm3 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
299 "packssdw %%mm1, %%mm0 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
300 "packssdw %%mm3, %%mm2 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
301 "movq %%mm0, %%mm1 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
302 "punpcklwd %%mm2, %%mm0 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
303 "punpckhwd %%mm2, %%mm1 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
304 "leal (%%esi, %%esi, 2), %%edi \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
305 "movq %%mm6, (%0, %%edi) \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
306 "movd %%mm0, 8(%0, %%edi) \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
307 "punpckhdq %%mm0, %%mm0 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
308 "movq %%mm6, 12(%0, %%edi) \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
309 "movd %%mm0, 20(%0, %%edi) \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
310 "movq %%mm6, 24(%0, %%edi) \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
311 "movd %%mm1, 32(%0, %%edi) \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
312 "punpckhdq %%mm1, %%mm1 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
313 "movq %%mm6, 36(%0, %%edi) \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
314 "movd %%mm1, 44(%0, %%edi) \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
315 "addl $16, %%esi \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
316 " jnz 1b \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
317 "emms \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
318 :: "r" (s16+1536), "r" (f+256)
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
319 :"%esi", "%edi", "memory"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
320 );
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
321 return 6*256;
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
322 }
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
323
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
324 static int a52_resample_STEREO_LFE_to_6_MMX(float * _f, int16_t * s16){
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
325 int32_t * f = (int32_t *) _f;
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
326 asm volatile(
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
327 "movl $-1024, %%esi \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
328 "movq "MANGLE(magicF2W)", %%mm7 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
329 "pxor %%mm6, %%mm6 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
330 "1: \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
331 "movq 1024(%1, %%esi), %%mm0 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
332 "movq 2048(%1, %%esi), %%mm1 \n\t"
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2352
diff changeset
333 "movq (%1, %%esi), %%mm5 \n\t"
1193
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
334 "psubd %%mm7, %%mm0 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
335 "psubd %%mm7, %%mm1 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
336 "psubd %%mm7, %%mm5 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
337 "leal (%%esi, %%esi, 2), %%edi \n\t"
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2352
diff changeset
338
1193
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
339 "pxor %%mm4, %%mm4 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
340 "packssdw %%mm5, %%mm0 \n\t" // FfAa
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
341 "packssdw %%mm4, %%mm1 \n\t" // 00Bb
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
342 "punpckhwd %%mm0, %%mm4 \n\t" // F0f0
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
343 "punpcklwd %%mm1, %%mm0 \n\t" // BAba
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
344 "movq %%mm0, %%mm1 \n\t" // BAba
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
345 "punpckldq %%mm4, %%mm3 \n\t" // f0XX
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
346 "punpckldq %%mm6, %%mm0 \n\t" // 00ba
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
347 "punpckhdq %%mm1, %%mm3 \n\t" // BAf0
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2352
diff changeset
348
1193
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
349 "movq %%mm0, (%0, %%edi) \n\t" // 00ba
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
350 "punpckhdq %%mm4, %%mm0 \n\t" // F000
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
351 "movq %%mm3, 8(%0, %%edi) \n\t" // BAf0
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
352 "movq %%mm0, 16(%0, %%edi) \n\t" // F000
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
353 "addl $8, %%esi \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
354 " jnz 1b \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
355 "emms \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
356 :: "r" (s16+1536), "r" (f+256)
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
357 :"%esi", "%edi", "memory"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
358 );
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
359 return 6*256;
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
360 }
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
361
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
362 static int a52_resample_3F_LFE_to_6_MMX(float * _f, int16_t * s16){
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
363 int32_t * f = (int32_t *) _f;
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
364 asm volatile(
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
365 "movl $-1024, %%esi \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
366 "movq "MANGLE(magicF2W)", %%mm7 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
367 "pxor %%mm6, %%mm6 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
368 "1: \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
369 "movq 1024(%1, %%esi), %%mm0 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
370 "movq 3072(%1, %%esi), %%mm1 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
371 "movq 2048(%1, %%esi), %%mm4 \n\t"
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2352
diff changeset
372 "movq (%1, %%esi), %%mm5 \n\t"
1193
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
373 "psubd %%mm7, %%mm0 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
374 "psubd %%mm7, %%mm1 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
375 "psubd %%mm7, %%mm4 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
376 "psubd %%mm7, %%mm5 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
377 "leal (%%esi, %%esi, 2), %%edi \n\t"
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2352
diff changeset
378
1193
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
379 "packssdw %%mm4, %%mm0 \n\t" // EeAa
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
380 "packssdw %%mm5, %%mm1 \n\t" // FfBb
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
381 "movq %%mm0, %%mm2 \n\t" // EeAa
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
382 "punpcklwd %%mm1, %%mm0 \n\t" // BAba
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
383 "punpckhwd %%mm1, %%mm2 \n\t" // FEfe
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
384 "movq %%mm0, %%mm1 \n\t" // BAba
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
385 "punpckldq %%mm6, %%mm0 \n\t" // 00ba
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
386 "punpckhdq %%mm1, %%mm1 \n\t" // BABA
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2352
diff changeset
387
1193
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
388 "movq %%mm0, (%0, %%edi) \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
389 "punpckhdq %%mm2, %%mm0 \n\t" // FE00
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
390 "punpckldq %%mm1, %%mm2 \n\t" // BAfe
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
391 "movq %%mm2, 8(%0, %%edi) \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
392 "movq %%mm0, 16(%0, %%edi) \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
393 "addl $8, %%esi \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
394 " jnz 1b \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
395 "emms \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
396 :: "r" (s16+1536), "r" (f+256)
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
397 :"%esi", "%edi", "memory"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
398 );
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
399 return 6*256;
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
400 }
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
401
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
402 static int a52_resample_2F_2R_LFE_to_6_MMX(float * _f, int16_t * s16){
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
403 int32_t * f = (int32_t *) _f;
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
404 asm volatile(
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
405 "movl $-1024, %%esi \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
406 "movq "MANGLE(magicF2W)", %%mm7 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
407 // "pxor %%mm6, %%mm6 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
408 "1: \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
409 "movq 1024(%1, %%esi), %%mm0 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
410 "movq 2048(%1, %%esi), %%mm1 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
411 "movq 3072(%1, %%esi), %%mm2 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
412 "movq 4096(%1, %%esi), %%mm3 \n\t"
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2352
diff changeset
413 "movq (%1, %%esi), %%mm5 \n\t"
1193
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
414 "psubd %%mm7, %%mm0 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
415 "psubd %%mm7, %%mm1 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
416 "psubd %%mm7, %%mm2 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
417 "psubd %%mm7, %%mm3 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
418 "psubd %%mm7, %%mm5 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
419 "leal (%%esi, %%esi, 2), %%edi \n\t"
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2352
diff changeset
420
1193
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
421 "packssdw %%mm2, %%mm0 \n\t" // CcAa
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
422 "packssdw %%mm3, %%mm1 \n\t" // DdBb
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
423 "packssdw %%mm5, %%mm5 \n\t" // FfFf
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
424 "movq %%mm0, %%mm2 \n\t" // CcAa
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
425 "punpcklwd %%mm1, %%mm0 \n\t" // BAba
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
426 "punpckhwd %%mm1, %%mm2 \n\t" // DCdc
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
427 "pxor %%mm4, %%mm4 \n\t" // 0000
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
428 "punpcklwd %%mm5, %%mm4 \n\t" // F0f0
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
429 "movq %%mm0, %%mm1 \n\t" // BAba
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
430 "movq %%mm4, %%mm3 \n\t" // F0f0
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
431 "punpckldq %%mm2, %%mm0 \n\t" // dcba
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
432 "punpckhdq %%mm1, %%mm1 \n\t" // BABA
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
433 "punpckldq %%mm1, %%mm4 \n\t" // BAf0
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
434 "punpckhdq %%mm3, %%mm2 \n\t" // F0DC
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2352
diff changeset
435
1193
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
436 "movq %%mm0, (%0, %%edi) \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
437 "movq %%mm4, 8(%0, %%edi) \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
438 "movq %%mm2, 16(%0, %%edi) \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
439 "addl $8, %%esi \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
440 " jnz 1b \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
441 "emms \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
442 :: "r" (s16+1536), "r" (f+256)
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
443 :"%esi", "%edi", "memory"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
444 );
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
445 return 6*256;
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
446 }
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
447
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
448 static int a52_resample_3F_2R_LFE_to_6_MMX(float * _f, int16_t * s16){
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
449 int32_t * f = (int32_t *) _f;
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
450 asm volatile(
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
451 "movl $-1024, %%esi \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
452 "movq "MANGLE(magicF2W)", %%mm7 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
453 // "pxor %%mm6, %%mm6 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
454 "1: \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
455 "movq 1024(%1, %%esi), %%mm0 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
456 "movq 3072(%1, %%esi), %%mm1 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
457 "movq 4096(%1, %%esi), %%mm2 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
458 "movq 5120(%1, %%esi), %%mm3 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
459 "movq 2048(%1, %%esi), %%mm4 \n\t"
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2352
diff changeset
460 "movq (%1, %%esi), %%mm5 \n\t"
1193
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
461 "psubd %%mm7, %%mm0 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
462 "psubd %%mm7, %%mm1 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
463 "psubd %%mm7, %%mm2 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
464 "psubd %%mm7, %%mm3 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
465 "psubd %%mm7, %%mm4 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
466 "psubd %%mm7, %%mm5 \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
467 "leal (%%esi, %%esi, 2), %%edi \n\t"
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2352
diff changeset
468
1193
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
469 "packssdw %%mm2, %%mm0 \n\t" // CcAa
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
470 "packssdw %%mm3, %%mm1 \n\t" // DdBb
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
471 "packssdw %%mm4, %%mm4 \n\t" // EeEe
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
472 "packssdw %%mm5, %%mm5 \n\t" // FfFf
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
473 "movq %%mm0, %%mm2 \n\t" // CcAa
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
474 "punpcklwd %%mm1, %%mm0 \n\t" // BAba
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
475 "punpckhwd %%mm1, %%mm2 \n\t" // DCdc
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
476 "punpcklwd %%mm5, %%mm4 \n\t" // FEfe
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
477 "movq %%mm0, %%mm1 \n\t" // BAba
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
478 "movq %%mm4, %%mm3 \n\t" // FEfe
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
479 "punpckldq %%mm2, %%mm0 \n\t" // dcba
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
480 "punpckhdq %%mm1, %%mm1 \n\t" // BABA
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
481 "punpckldq %%mm1, %%mm4 \n\t" // BAfe
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
482 "punpckhdq %%mm3, %%mm2 \n\t" // FEDC
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2352
diff changeset
483
1193
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
484 "movq %%mm0, (%0, %%edi) \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
485 "movq %%mm4, 8(%0, %%edi) \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
486 "movq %%mm2, 16(%0, %%edi) \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
487 "addl $8, %%esi \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
488 " jnz 1b \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
489 "emms \n\t"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
490 :: "r" (s16+1536), "r" (f+256)
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
491 :"%esi", "%edi", "memory"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
492 );
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
493 return 6*256;
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
494 }
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
495
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
496
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
497 static void* a52_resample_MMX(int flags, int ch){
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
498 switch (flags) {
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
499 case A52_MONO:
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
500 if(ch==5) return a52_resample_MONO_to_5_MMX;
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
501 break;
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
502 case A52_CHANNEL:
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
503 case A52_STEREO:
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
504 case A52_DOLBY:
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
505 if(ch==2) return a52_resample_STEREO_to_2_MMX;
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
506 break;
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
507 case A52_3F:
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
508 if(ch==5) return a52_resample_3F_to_5_MMX;
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
509 break;
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
510 case A52_2F2R:
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
511 if(ch==4) return a52_resample_2F_2R_to_4_MMX;
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
512 break;
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
513 case A52_3F2R:
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
514 if(ch==5) return a52_resample_3F_2R_to_5_MMX;
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
515 break;
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
516 case A52_MONO | A52_LFE:
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
517 if(ch==6) return a52_resample_MONO_LFE_to_6_MMX;
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
518 break;
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
519 case A52_CHANNEL | A52_LFE:
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
520 case A52_STEREO | A52_LFE:
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
521 case A52_DOLBY | A52_LFE:
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
522 if(ch==6) return a52_resample_STEREO_LFE_to_6_MMX;
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
523 break;
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
524 case A52_3F | A52_LFE:
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
525 if(ch==6) return a52_resample_3F_LFE_to_6_MMX;
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
526 break;
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
527 case A52_2F2R | A52_LFE:
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
528 if(ch==6) return a52_resample_2F_2R_LFE_to_6_MMX;
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
529 break;
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
530 case A52_3F2R | A52_LFE:
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
531 if(ch==6) return a52_resample_3F_2R_LFE_to_6_MMX;
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
532 break;
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
533 }
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
534 return NULL;
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
535 }
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
536
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
537