annotate i386/motion_est_mmx.c @ 2979:bfabfdf9ce55 libavcodec

COSMETICS: tabs --> spaces, some prettyprinting
author diego
date Thu, 22 Dec 2005 01:10:11 +0000
parents ef2149182f1c
children 0b546eab515d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
1 /*
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
2 * MMX optimized motion estimation
429
718a22dc121f license/copyright change
glantau
parents: 330
diff changeset
3 * Copyright (c) 2001 Fabrice Bellard.
1739
07a484280a82 copyright year update of the files i touched and remembered, things look annoyingly unmaintained otherwise
michael
parents: 1708
diff changeset
4 * Copyright (c) 2002-2004 Michael Niedermayer
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
5 *
429
718a22dc121f license/copyright change
glantau
parents: 330
diff changeset
6 * This library is free software; you can redistribute it and/or
718a22dc121f license/copyright change
glantau
parents: 330
diff changeset
7 * modify it under the terms of the GNU Lesser General Public
718a22dc121f license/copyright change
glantau
parents: 330
diff changeset
8 * License as published by the Free Software Foundation; either
718a22dc121f license/copyright change
glantau
parents: 330
diff changeset
9 * version 2 of the License, or (at your option) any later version.
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
10 *
429
718a22dc121f license/copyright change
glantau
parents: 330
diff changeset
11 * This library is distributed in the hope that it will be useful,
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
429
718a22dc121f license/copyright change
glantau
parents: 330
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
718a22dc121f license/copyright change
glantau
parents: 330
diff changeset
14 * Lesser General Public License for more details.
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
15 *
429
718a22dc121f license/copyright change
glantau
parents: 330
diff changeset
16 * You should have received a copy of the GNU Lesser General Public
718a22dc121f license/copyright change
glantau
parents: 330
diff changeset
17 * License along with this library; if not, write to the Free Software
718a22dc121f license/copyright change
glantau
parents: 330
diff changeset
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
19 *
294
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
20 * mostly by Michael Niedermayer <michaelni@gmx.at>
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
21 */
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
22 #include "../dsputil.h"
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 1845
diff changeset
23 #include "mmx.h"
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
24
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
25 static const __attribute__ ((aligned(8))) uint64_t round_tab[3]={
1569
1f8d1e1173d8 Fixes GCC 3.3.2 warnings patch by (Panagiotis Issaris <takis at lumumba dot luc dot ac dot be>)
michael
parents: 1455
diff changeset
26 0x0000000000000000ULL,
1f8d1e1173d8 Fixes GCC 3.3.2 warnings patch by (Panagiotis Issaris <takis at lumumba dot luc dot ac dot be>)
michael
parents: 1455
diff changeset
27 0x0001000100010001ULL,
1f8d1e1173d8 Fixes GCC 3.3.2 warnings patch by (Panagiotis Issaris <takis at lumumba dot luc dot ac dot be>)
michael
parents: 1455
diff changeset
28 0x0002000200020002ULL,
294
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
29 };
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
30
1845
3054613980a8 attribute used patch by (mitya at school dot ioffe dot ru (Dmitry Baryshkov))
michael
parents: 1739
diff changeset
31 static attribute_used __attribute__ ((aligned(8))) uint64_t bone= 0x0101010101010101LL;
330
54d86f074a4b rounding bugfix
michaelni
parents: 294
diff changeset
32
1708
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
33 static inline void sad8_1_mmx(uint8_t *blk1, uint8_t *blk2, int stride, int h)
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
34 {
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 1845
diff changeset
35 long len= -(stride*h);
294
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
36 asm volatile(
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
37 ".balign 16 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
38 "1: \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
39 "movq (%1, %%"REG_a"), %%mm0 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
40 "movq (%2, %%"REG_a"), %%mm2 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
41 "movq (%2, %%"REG_a"), %%mm4 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
42 "add %3, %%"REG_a" \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
43 "psubusb %%mm0, %%mm2 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
44 "psubusb %%mm4, %%mm0 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
45 "movq (%1, %%"REG_a"), %%mm1 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
46 "movq (%2, %%"REG_a"), %%mm3 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
47 "movq (%2, %%"REG_a"), %%mm5 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
48 "psubusb %%mm1, %%mm3 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
49 "psubusb %%mm5, %%mm1 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
50 "por %%mm2, %%mm0 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
51 "por %%mm1, %%mm3 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
52 "movq %%mm0, %%mm1 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
53 "movq %%mm3, %%mm2 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
54 "punpcklbw %%mm7, %%mm0 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
55 "punpckhbw %%mm7, %%mm1 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
56 "punpcklbw %%mm7, %%mm3 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
57 "punpckhbw %%mm7, %%mm2 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
58 "paddw %%mm1, %%mm0 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
59 "paddw %%mm3, %%mm2 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
60 "paddw %%mm2, %%mm0 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
61 "paddw %%mm0, %%mm6 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
62 "add %3, %%"REG_a" \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
63 " js 1b \n\t"
294
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
64 : "+a" (len)
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 1845
diff changeset
65 : "r" (blk1 - len), "r" (blk2 - len), "r" ((long)stride)
294
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
66 );
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
67 }
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
68
1708
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
69 static inline void sad8_1_mmx2(uint8_t *blk1, uint8_t *blk2, int stride, int h)
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
70 {
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 1845
diff changeset
71 long len= -(stride*h);
294
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
72 asm volatile(
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
73 ".balign 16 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
74 "1: \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
75 "movq (%1, %%"REG_a"), %%mm0 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
76 "movq (%2, %%"REG_a"), %%mm2 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
77 "psadbw %%mm2, %%mm0 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
78 "add %3, %%"REG_a" \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
79 "movq (%1, %%"REG_a"), %%mm1 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
80 "movq (%2, %%"REG_a"), %%mm3 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
81 "psadbw %%mm1, %%mm3 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
82 "paddw %%mm3, %%mm0 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
83 "paddw %%mm0, %%mm6 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
84 "add %3, %%"REG_a" \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
85 " js 1b \n\t"
294
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
86 : "+a" (len)
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 1845
diff changeset
87 : "r" (blk1 - len), "r" (blk2 - len), "r" ((long)stride)
294
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
88 );
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
89 }
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
90
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
91 static inline void sad8_2_mmx2(uint8_t *blk1a, uint8_t *blk1b, uint8_t *blk2, int stride, int h)
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
92 {
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 1845
diff changeset
93 long len= -(stride*h);
294
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
94 asm volatile(
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
95 ".balign 16 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
96 "1: \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
97 "movq (%1, %%"REG_a"), %%mm0 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
98 "movq (%2, %%"REG_a"), %%mm2 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
99 "pavgb %%mm2, %%mm0 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
100 "movq (%3, %%"REG_a"), %%mm2 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
101 "psadbw %%mm2, %%mm0 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
102 "add %4, %%"REG_a" \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
103 "movq (%1, %%"REG_a"), %%mm1 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
104 "movq (%2, %%"REG_a"), %%mm3 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
105 "pavgb %%mm1, %%mm3 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
106 "movq (%3, %%"REG_a"), %%mm1 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
107 "psadbw %%mm1, %%mm3 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
108 "paddw %%mm3, %%mm0 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
109 "paddw %%mm0, %%mm6 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
110 "add %4, %%"REG_a" \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
111 " js 1b \n\t"
294
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
112 : "+a" (len)
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 1845
diff changeset
113 : "r" (blk1a - len), "r" (blk1b -len), "r" (blk2 - len), "r" ((long)stride)
294
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
114 );
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
115 }
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
116
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
117 static inline void sad8_4_mmx2(uint8_t *blk1, uint8_t *blk2, int stride, int h)
294
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
118 { //FIXME reuse src
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 1845
diff changeset
119 long len= -(stride*h);
294
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
120 asm volatile(
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
121 ".balign 16 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
122 "movq "MANGLE(bone)", %%mm5 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
123 "1: \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
124 "movq (%1, %%"REG_a"), %%mm0 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
125 "movq (%2, %%"REG_a"), %%mm2 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
126 "movq 1(%1, %%"REG_a"), %%mm1 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
127 "movq 1(%2, %%"REG_a"), %%mm3 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
128 "pavgb %%mm2, %%mm0 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
129 "pavgb %%mm1, %%mm3 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
130 "psubusb %%mm5, %%mm3 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
131 "pavgb %%mm3, %%mm0 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
132 "movq (%3, %%"REG_a"), %%mm2 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
133 "psadbw %%mm2, %%mm0 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
134 "add %4, %%"REG_a" \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
135 "movq (%1, %%"REG_a"), %%mm1 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
136 "movq (%2, %%"REG_a"), %%mm3 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
137 "movq 1(%1, %%"REG_a"), %%mm2 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
138 "movq 1(%2, %%"REG_a"), %%mm4 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
139 "pavgb %%mm3, %%mm1 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
140 "pavgb %%mm4, %%mm2 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
141 "psubusb %%mm5, %%mm2 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
142 "pavgb %%mm1, %%mm2 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
143 "movq (%3, %%"REG_a"), %%mm1 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
144 "psadbw %%mm1, %%mm2 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
145 "paddw %%mm2, %%mm0 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
146 "paddw %%mm0, %%mm6 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
147 "add %4, %%"REG_a" \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
148 " js 1b \n\t"
294
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
149 : "+a" (len)
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 1845
diff changeset
150 : "r" (blk1 - len), "r" (blk1 - len + stride), "r" (blk2 - len), "r" ((long)stride)
294
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
151 );
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
152 }
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
153
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
154 static inline void sad8_2_mmx(uint8_t *blk1a, uint8_t *blk1b, uint8_t *blk2, int stride, int h)
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
155 {
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 1845
diff changeset
156 long len= -(stride*h);
294
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
157 asm volatile(
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
158 ".balign 16 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
159 "1: \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
160 "movq (%1, %%"REG_a"), %%mm0 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
161 "movq (%2, %%"REG_a"), %%mm1 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
162 "movq (%1, %%"REG_a"), %%mm2 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
163 "movq (%2, %%"REG_a"), %%mm3 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
164 "punpcklbw %%mm7, %%mm0 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
165 "punpcklbw %%mm7, %%mm1 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
166 "punpckhbw %%mm7, %%mm2 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
167 "punpckhbw %%mm7, %%mm3 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
168 "paddw %%mm0, %%mm1 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
169 "paddw %%mm2, %%mm3 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
170 "movq (%3, %%"REG_a"), %%mm4 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
171 "movq (%3, %%"REG_a"), %%mm2 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
172 "paddw %%mm5, %%mm1 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
173 "paddw %%mm5, %%mm3 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
174 "psrlw $1, %%mm1 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
175 "psrlw $1, %%mm3 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
176 "packuswb %%mm3, %%mm1 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
177 "psubusb %%mm1, %%mm4 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
178 "psubusb %%mm2, %%mm1 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
179 "por %%mm4, %%mm1 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
180 "movq %%mm1, %%mm0 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
181 "punpcklbw %%mm7, %%mm0 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
182 "punpckhbw %%mm7, %%mm1 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
183 "paddw %%mm1, %%mm0 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
184 "paddw %%mm0, %%mm6 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
185 "add %4, %%"REG_a" \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
186 " js 1b \n\t"
294
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
187 : "+a" (len)
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 1845
diff changeset
188 : "r" (blk1a - len), "r" (blk1b -len), "r" (blk2 - len), "r" ((long)stride)
294
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
189 );
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
190 }
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
191
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
192 static inline void sad8_4_mmx(uint8_t *blk1, uint8_t *blk2, int stride, int h)
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
193 {
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 1845
diff changeset
194 long len= -(stride*h);
294
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
195 asm volatile(
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
196 ".balign 16 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
197 "1: \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
198 "movq (%1, %%"REG_a"), %%mm0 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
199 "movq (%2, %%"REG_a"), %%mm1 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
200 "movq %%mm0, %%mm4 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
201 "movq %%mm1, %%mm2 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
202 "punpcklbw %%mm7, %%mm0 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
203 "punpcklbw %%mm7, %%mm1 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
204 "punpckhbw %%mm7, %%mm4 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
205 "punpckhbw %%mm7, %%mm2 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
206 "paddw %%mm1, %%mm0 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
207 "paddw %%mm2, %%mm4 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
208 "movq 1(%1, %%"REG_a"), %%mm2 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
209 "movq 1(%2, %%"REG_a"), %%mm3 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
210 "movq %%mm2, %%mm1 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
211 "punpcklbw %%mm7, %%mm2 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
212 "punpckhbw %%mm7, %%mm1 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
213 "paddw %%mm0, %%mm2 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
214 "paddw %%mm4, %%mm1 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
215 "movq %%mm3, %%mm4 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
216 "punpcklbw %%mm7, %%mm3 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
217 "punpckhbw %%mm7, %%mm4 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
218 "paddw %%mm3, %%mm2 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
219 "paddw %%mm4, %%mm1 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
220 "movq (%3, %%"REG_a"), %%mm3 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
221 "movq (%3, %%"REG_a"), %%mm4 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
222 "paddw %%mm5, %%mm2 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
223 "paddw %%mm5, %%mm1 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
224 "psrlw $2, %%mm2 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
225 "psrlw $2, %%mm1 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
226 "packuswb %%mm1, %%mm2 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
227 "psubusb %%mm2, %%mm3 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
228 "psubusb %%mm4, %%mm2 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
229 "por %%mm3, %%mm2 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
230 "movq %%mm2, %%mm0 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
231 "punpcklbw %%mm7, %%mm0 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
232 "punpckhbw %%mm7, %%mm2 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
233 "paddw %%mm2, %%mm0 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
234 "paddw %%mm0, %%mm6 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
235 "add %4, %%"REG_a" \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
236 " js 1b \n\t"
294
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
237 : "+a" (len)
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 1845
diff changeset
238 : "r" (blk1 - len), "r" (blk1 -len + stride), "r" (blk2 - len), "r" ((long)stride)
294
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
239 );
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
240 }
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
241
1057
bb5de8a59da8 * static,const,compiler warning cleanup
kabi
parents: 936
diff changeset
242 static inline int sum_mmx(void)
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
243 {
294
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
244 int ret;
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
245 asm volatile(
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
246 "movq %%mm6, %%mm0 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
247 "psrlq $32, %%mm6 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
248 "paddw %%mm0, %%mm6 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
249 "movq %%mm6, %%mm0 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
250 "psrlq $16, %%mm6 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
251 "paddw %%mm0, %%mm6 \n\t"
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
252 "movd %%mm6, %0 \n\t"
294
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
253 : "=r" (ret)
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
254 );
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
255 return ret&0xFFFF;
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
256 }
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
257
1057
bb5de8a59da8 * static,const,compiler warning cleanup
kabi
parents: 936
diff changeset
258 static inline int sum_mmx2(void)
294
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
259 {
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
260 int ret;
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
261 asm volatile(
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
262 "movd %%mm6, %0 \n\t"
294
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
263 : "=r" (ret)
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
264 );
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
265 return ret;
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
266 }
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
267
900
52c26a143399 100l (sad8x8_x2 had params in wrong order)
michaelni
parents: 429
diff changeset
268
294
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
269 #define PIX_SAD(suf)\
1708
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
270 static int sad8_ ## suf(void *v, uint8_t *blk2, uint8_t *blk1, int stride, int h)\
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
271 {\
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
272 assert(h==8);\
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
273 asm volatile("pxor %%mm7, %%mm7 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
274 "pxor %%mm6, %%mm6 \n\t":);\
1708
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
275 \
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
276 sad8_1_ ## suf(blk1, blk2, stride, 8);\
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
277 \
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
278 return sum_ ## suf();\
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
279 }\
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
280 static int sad8_x2_ ## suf(void *v, uint8_t *blk2, uint8_t *blk1, int stride, int h)\
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
281 {\
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
282 assert(h==8);\
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
283 asm volatile("pxor %%mm7, %%mm7 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
284 "pxor %%mm6, %%mm6 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
285 "movq %0, %%mm5 \n\t"\
1708
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
286 :: "m"(round_tab[1]) \
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
287 );\
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
288 \
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
289 sad8_2_ ## suf(blk1, blk1+1, blk2, stride, 8);\
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
290 \
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
291 return sum_ ## suf();\
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
292 }\
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
293 \
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
294 static int sad8_y2_ ## suf(void *v, uint8_t *blk2, uint8_t *blk1, int stride, int h)\
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
295 {\
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
296 assert(h==8);\
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
297 asm volatile("pxor %%mm7, %%mm7 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
298 "pxor %%mm6, %%mm6 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
299 "movq %0, %%mm5 \n\t"\
1708
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
300 :: "m"(round_tab[1]) \
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
301 );\
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
302 \
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
303 sad8_2_ ## suf(blk1, blk1+stride, blk2, stride, 8);\
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
304 \
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
305 return sum_ ## suf();\
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
306 }\
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
307 \
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
308 static int sad8_xy2_ ## suf(void *v, uint8_t *blk2, uint8_t *blk1, int stride, int h)\
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
309 {\
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
310 assert(h==8);\
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
311 asm volatile("pxor %%mm7, %%mm7 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
312 "pxor %%mm6, %%mm6 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
313 "movq %0, %%mm5 \n\t"\
1708
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
314 :: "m"(round_tab[2]) \
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
315 );\
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
316 \
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
317 sad8_4_ ## suf(blk1, blk2, stride, 8);\
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
318 \
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
319 return sum_ ## suf();\
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
320 }\
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
321 \
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
322 static int sad16_ ## suf(void *v, uint8_t *blk2, uint8_t *blk1, int stride, int h)\
294
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
323 {\
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
324 asm volatile("pxor %%mm7, %%mm7 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
325 "pxor %%mm6, %%mm6 \n\t":);\
294
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
326 \
1708
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
327 sad8_1_ ## suf(blk1 , blk2 , stride, h);\
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
328 sad8_1_ ## suf(blk1+8, blk2+8, stride, h);\
294
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
329 \
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
330 return sum_ ## suf();\
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
331 }\
1708
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
332 static int sad16_x2_ ## suf(void *v, uint8_t *blk2, uint8_t *blk1, int stride, int h)\
294
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
333 {\
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
334 asm volatile("pxor %%mm7, %%mm7 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
335 "pxor %%mm6, %%mm6 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
336 "movq %0, %%mm5 \n\t"\
294
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
337 :: "m"(round_tab[1]) \
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
338 );\
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
339 \
1708
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
340 sad8_2_ ## suf(blk1 , blk1+1, blk2 , stride, h);\
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
341 sad8_2_ ## suf(blk1+8, blk1+9, blk2+8, stride, h);\
294
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
342 \
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
343 return sum_ ## suf();\
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
344 }\
1708
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
345 static int sad16_y2_ ## suf(void *v, uint8_t *blk2, uint8_t *blk1, int stride, int h)\
294
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
346 {\
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
347 asm volatile("pxor %%mm7, %%mm7 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
348 "pxor %%mm6, %%mm6 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
349 "movq %0, %%mm5 \n\t"\
294
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
350 :: "m"(round_tab[1]) \
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
351 );\
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
352 \
1708
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
353 sad8_2_ ## suf(blk1 , blk1+stride, blk2 , stride, h);\
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
354 sad8_2_ ## suf(blk1+8, blk1+stride+8,blk2+8, stride, h);\
294
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
355 \
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
356 return sum_ ## suf();\
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
357 }\
1708
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
358 static int sad16_xy2_ ## suf(void *v, uint8_t *blk2, uint8_t *blk1, int stride, int h)\
294
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
359 {\
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
360 asm volatile("pxor %%mm7, %%mm7 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
361 "pxor %%mm6, %%mm6 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
362 "movq %0, %%mm5 \n\t"\
294
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
363 :: "m"(round_tab[2]) \
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
364 );\
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
365 \
1708
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
366 sad8_4_ ## suf(blk1 , blk2 , stride, h);\
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
367 sad8_4_ ## suf(blk1+8, blk2+8, stride, h);\
294
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
368 \
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
369 return sum_ ## suf();\
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
370 }\
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
371
294
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
372 PIX_SAD(mmx)
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 72
diff changeset
373 PIX_SAD(mmx2)
1057
bb5de8a59da8 * static,const,compiler warning cleanup
kabi
parents: 936
diff changeset
374
1092
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
375 void dsputil_init_pix_mmx(DSPContext* c, AVCodecContext *avctx)
1057
bb5de8a59da8 * static,const,compiler warning cleanup
kabi
parents: 936
diff changeset
376 {
bb5de8a59da8 * static,const,compiler warning cleanup
kabi
parents: 936
diff changeset
377 if (mm_flags & MM_MMX) {
1708
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
378 c->pix_abs[0][0] = sad16_mmx;
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
379 c->pix_abs[0][1] = sad16_x2_mmx;
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
380 c->pix_abs[0][2] = sad16_y2_mmx;
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
381 c->pix_abs[0][3] = sad16_xy2_mmx;
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
382 c->pix_abs[1][0] = sad8_mmx;
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
383 c->pix_abs[1][1] = sad8_x2_mmx;
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
384 c->pix_abs[1][2] = sad8_y2_mmx;
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
385 c->pix_abs[1][3] = sad8_xy2_mmx;
1057
bb5de8a59da8 * static,const,compiler warning cleanup
kabi
parents: 936
diff changeset
386
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
387 c->sad[0]= sad16_mmx;
1708
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
388 c->sad[1]= sad8_mmx;
1057
bb5de8a59da8 * static,const,compiler warning cleanup
kabi
parents: 936
diff changeset
389 }
bb5de8a59da8 * static,const,compiler warning cleanup
kabi
parents: 936
diff changeset
390 if (mm_flags & MM_MMXEXT) {
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
391 c->pix_abs[0][0] = sad16_mmx2;
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
392 c->pix_abs[1][0] = sad8_mmx2;
1057
bb5de8a59da8 * static,const,compiler warning cleanup
kabi
parents: 936
diff changeset
393
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
394 c->sad[0]= sad16_mmx2;
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
395 c->sad[1]= sad8_mmx2;
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2293
diff changeset
396
1092
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
397 if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
1708
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
398 c->pix_abs[0][1] = sad16_x2_mmx2;
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
399 c->pix_abs[0][2] = sad16_y2_mmx2;
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
400 c->pix_abs[0][3] = sad16_xy2_mmx2;
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
401 c->pix_abs[1][1] = sad8_x2_mmx2;
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
402 c->pix_abs[1][2] = sad8_y2_mmx2;
dea5b2946999 interlaced motion estimation
michael
parents: 1569
diff changeset
403 c->pix_abs[1][3] = sad8_xy2_mmx2;
1092
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
404 }
1057
bb5de8a59da8 * static,const,compiler warning cleanup
kabi
parents: 936
diff changeset
405 }
bb5de8a59da8 * static,const,compiler warning cleanup
kabi
parents: 936
diff changeset
406 }