annotate i386/dsputilenc_mmx.c @ 6795:6c7e7fdedfd3 libavcodec

Add VP56_FRAME_NONE and use VP56_FRAME_CURRENT. Fixes icc warning #188: enumerated type mixed with another type
author cehoyos
date Tue, 13 May 2008 15:56:45 +0000
parents f7cbb7733146
children 5dc77fe205ac
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6403
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1 /*
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
2 * MMX optimized DSP utils
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
3 * Copyright (c) 2000, 2001 Fabrice Bellard.
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
4 * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
5 *
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
6 * This file is part of FFmpeg.
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
7 *
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
8 * FFmpeg is free software; you can redistribute it and/or
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
9 * modify it under the terms of the GNU Lesser General Public
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
10 * License as published by the Free Software Foundation; either
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
11 * version 2.1 of the License, or (at your option) any later version.
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
12 *
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
13 * FFmpeg is distributed in the hope that it will be useful,
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
16 * Lesser General Public License for more details.
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
17 *
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
18 * You should have received a copy of the GNU Lesser General Public
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
19 * License along with FFmpeg; if not, write to the Free Software
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
21 *
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
22 * MMX optimization by Nick Kurshev <nickols_k@mail.ru>
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
23 */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
24
6763
f7cbb7733146 Use full path for #includes from another directory.
diego
parents: 6755
diff changeset
25 #include "libavutil/x86_cpu.h"
f7cbb7733146 Use full path for #includes from another directory.
diego
parents: 6755
diff changeset
26 #include "libavcodec/dsputil.h"
f7cbb7733146 Use full path for #includes from another directory.
diego
parents: 6755
diff changeset
27 #include "libavcodec/mpegvideo.h"
6403
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
28 #include "dsputil_mmx.h"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
29
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
30
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
31 static void get_pixels_mmx(DCTELEM *block, const uint8_t *pixels, int line_size)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
32 {
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
33 asm volatile(
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
34 "mov $-128, %%"REG_a" \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
35 "pxor %%mm7, %%mm7 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
36 ASMALIGN(4)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
37 "1: \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
38 "movq (%0), %%mm0 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
39 "movq (%0, %2), %%mm2 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
40 "movq %%mm0, %%mm1 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
41 "movq %%mm2, %%mm3 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
42 "punpcklbw %%mm7, %%mm0 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
43 "punpckhbw %%mm7, %%mm1 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
44 "punpcklbw %%mm7, %%mm2 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
45 "punpckhbw %%mm7, %%mm3 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
46 "movq %%mm0, (%1, %%"REG_a") \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
47 "movq %%mm1, 8(%1, %%"REG_a") \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
48 "movq %%mm2, 16(%1, %%"REG_a") \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
49 "movq %%mm3, 24(%1, %%"REG_a") \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
50 "add %3, %0 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
51 "add $32, %%"REG_a" \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
52 "js 1b \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
53 : "+r" (pixels)
6755
33896780c612 Do not misuse long as the size of a register in x86.
ramiro
parents: 6403
diff changeset
54 : "r" (block+64), "r" ((x86_reg)line_size), "r" ((x86_reg)line_size*2)
6403
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
55 : "%"REG_a
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
56 );
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
57 }
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
58
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
59 static inline void diff_pixels_mmx(DCTELEM *block, const uint8_t *s1, const uint8_t *s2, int stride)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
60 {
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
61 asm volatile(
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
62 "pxor %%mm7, %%mm7 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
63 "mov $-128, %%"REG_a" \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
64 ASMALIGN(4)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
65 "1: \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
66 "movq (%0), %%mm0 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
67 "movq (%1), %%mm2 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
68 "movq %%mm0, %%mm1 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
69 "movq %%mm2, %%mm3 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
70 "punpcklbw %%mm7, %%mm0 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
71 "punpckhbw %%mm7, %%mm1 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
72 "punpcklbw %%mm7, %%mm2 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
73 "punpckhbw %%mm7, %%mm3 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
74 "psubw %%mm2, %%mm0 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
75 "psubw %%mm3, %%mm1 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
76 "movq %%mm0, (%2, %%"REG_a") \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
77 "movq %%mm1, 8(%2, %%"REG_a") \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
78 "add %3, %0 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
79 "add %3, %1 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
80 "add $16, %%"REG_a" \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
81 "jnz 1b \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
82 : "+r" (s1), "+r" (s2)
6755
33896780c612 Do not misuse long as the size of a register in x86.
ramiro
parents: 6403
diff changeset
83 : "r" (block+64), "r" ((x86_reg)stride)
6403
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
84 : "%"REG_a
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
85 );
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
86 }
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
87
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
88 static int pix_sum16_mmx(uint8_t * pix, int line_size){
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
89 const int h=16;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
90 int sum;
6755
33896780c612 Do not misuse long as the size of a register in x86.
ramiro
parents: 6403
diff changeset
91 x86_reg index= -line_size*h;
6403
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
92
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
93 asm volatile(
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
94 "pxor %%mm7, %%mm7 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
95 "pxor %%mm6, %%mm6 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
96 "1: \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
97 "movq (%2, %1), %%mm0 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
98 "movq (%2, %1), %%mm1 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
99 "movq 8(%2, %1), %%mm2 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
100 "movq 8(%2, %1), %%mm3 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
101 "punpcklbw %%mm7, %%mm0 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
102 "punpckhbw %%mm7, %%mm1 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
103 "punpcklbw %%mm7, %%mm2 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
104 "punpckhbw %%mm7, %%mm3 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
105 "paddw %%mm0, %%mm1 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
106 "paddw %%mm2, %%mm3 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
107 "paddw %%mm1, %%mm3 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
108 "paddw %%mm3, %%mm6 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
109 "add %3, %1 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
110 " js 1b \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
111 "movq %%mm6, %%mm5 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
112 "psrlq $32, %%mm6 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
113 "paddw %%mm5, %%mm6 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
114 "movq %%mm6, %%mm5 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
115 "psrlq $16, %%mm6 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
116 "paddw %%mm5, %%mm6 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
117 "movd %%mm6, %0 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
118 "andl $0xFFFF, %0 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
119 : "=&r" (sum), "+r" (index)
6755
33896780c612 Do not misuse long as the size of a register in x86.
ramiro
parents: 6403
diff changeset
120 : "r" (pix - index), "r" ((x86_reg)line_size)
6403
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
121 );
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
122
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
123 return sum;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
124 }
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
125
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
126 static int pix_norm1_mmx(uint8_t *pix, int line_size) {
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
127 int tmp;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
128 asm volatile (
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
129 "movl $16,%%ecx\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
130 "pxor %%mm0,%%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
131 "pxor %%mm7,%%mm7\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
132 "1:\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
133 "movq (%0),%%mm2\n" /* mm2 = pix[0-7] */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
134 "movq 8(%0),%%mm3\n" /* mm3 = pix[8-15] */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
135
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
136 "movq %%mm2,%%mm1\n" /* mm1 = mm2 = pix[0-7] */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
137
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
138 "punpckhbw %%mm0,%%mm1\n" /* mm1 = [pix4-7] */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
139 "punpcklbw %%mm0,%%mm2\n" /* mm2 = [pix0-3] */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
140
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
141 "movq %%mm3,%%mm4\n" /* mm4 = mm3 = pix[8-15] */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
142 "punpckhbw %%mm0,%%mm3\n" /* mm3 = [pix12-15] */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
143 "punpcklbw %%mm0,%%mm4\n" /* mm4 = [pix8-11] */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
144
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
145 "pmaddwd %%mm1,%%mm1\n" /* mm1 = (pix0^2+pix1^2,pix2^2+pix3^2) */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
146 "pmaddwd %%mm2,%%mm2\n" /* mm2 = (pix4^2+pix5^2,pix6^2+pix7^2) */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
147
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
148 "pmaddwd %%mm3,%%mm3\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
149 "pmaddwd %%mm4,%%mm4\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
150
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
151 "paddd %%mm1,%%mm2\n" /* mm2 = (pix0^2+pix1^2+pix4^2+pix5^2,
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
152 pix2^2+pix3^2+pix6^2+pix7^2) */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
153 "paddd %%mm3,%%mm4\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
154 "paddd %%mm2,%%mm7\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
155
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
156 "add %2, %0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
157 "paddd %%mm4,%%mm7\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
158 "dec %%ecx\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
159 "jnz 1b\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
160
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
161 "movq %%mm7,%%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
162 "psrlq $32, %%mm7\n" /* shift hi dword to lo */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
163 "paddd %%mm7,%%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
164 "movd %%mm1,%1\n"
6755
33896780c612 Do not misuse long as the size of a register in x86.
ramiro
parents: 6403
diff changeset
165 : "+r" (pix), "=r"(tmp) : "r" ((x86_reg)line_size) : "%ecx" );
6403
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
166 return tmp;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
167 }
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
168
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
169 static int sse8_mmx(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h) {
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
170 int tmp;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
171 asm volatile (
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
172 "movl %4,%%ecx\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
173 "shr $1,%%ecx\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
174 "pxor %%mm0,%%mm0\n" /* mm0 = 0 */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
175 "pxor %%mm7,%%mm7\n" /* mm7 holds the sum */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
176 "1:\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
177 "movq (%0),%%mm1\n" /* mm1 = pix1[0][0-7] */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
178 "movq (%1),%%mm2\n" /* mm2 = pix2[0][0-7] */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
179 "movq (%0,%3),%%mm3\n" /* mm3 = pix1[1][0-7] */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
180 "movq (%1,%3),%%mm4\n" /* mm4 = pix2[1][0-7] */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
181
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
182 /* todo: mm1-mm2, mm3-mm4 */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
183 /* algo: subtract mm1 from mm2 with saturation and vice versa */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
184 /* OR the results to get absolute difference */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
185 "movq %%mm1,%%mm5\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
186 "movq %%mm3,%%mm6\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
187 "psubusb %%mm2,%%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
188 "psubusb %%mm4,%%mm3\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
189 "psubusb %%mm5,%%mm2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
190 "psubusb %%mm6,%%mm4\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
191
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
192 "por %%mm1,%%mm2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
193 "por %%mm3,%%mm4\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
194
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
195 /* now convert to 16-bit vectors so we can square them */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
196 "movq %%mm2,%%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
197 "movq %%mm4,%%mm3\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
198
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
199 "punpckhbw %%mm0,%%mm2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
200 "punpckhbw %%mm0,%%mm4\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
201 "punpcklbw %%mm0,%%mm1\n" /* mm1 now spread over (mm1,mm2) */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
202 "punpcklbw %%mm0,%%mm3\n" /* mm4 now spread over (mm3,mm4) */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
203
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
204 "pmaddwd %%mm2,%%mm2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
205 "pmaddwd %%mm4,%%mm4\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
206 "pmaddwd %%mm1,%%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
207 "pmaddwd %%mm3,%%mm3\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
208
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
209 "lea (%0,%3,2), %0\n" /* pix1 += 2*line_size */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
210 "lea (%1,%3,2), %1\n" /* pix2 += 2*line_size */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
211
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
212 "paddd %%mm2,%%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
213 "paddd %%mm4,%%mm3\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
214 "paddd %%mm1,%%mm7\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
215 "paddd %%mm3,%%mm7\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
216
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
217 "decl %%ecx\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
218 "jnz 1b\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
219
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
220 "movq %%mm7,%%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
221 "psrlq $32, %%mm7\n" /* shift hi dword to lo */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
222 "paddd %%mm7,%%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
223 "movd %%mm1,%2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
224 : "+r" (pix1), "+r" (pix2), "=r"(tmp)
6755
33896780c612 Do not misuse long as the size of a register in x86.
ramiro
parents: 6403
diff changeset
225 : "r" ((x86_reg)line_size) , "m" (h)
6403
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
226 : "%ecx");
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
227 return tmp;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
228 }
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
229
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
230 static int sse16_mmx(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h) {
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
231 int tmp;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
232 asm volatile (
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
233 "movl %4,%%ecx\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
234 "pxor %%mm0,%%mm0\n" /* mm0 = 0 */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
235 "pxor %%mm7,%%mm7\n" /* mm7 holds the sum */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
236 "1:\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
237 "movq (%0),%%mm1\n" /* mm1 = pix1[0-7] */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
238 "movq (%1),%%mm2\n" /* mm2 = pix2[0-7] */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
239 "movq 8(%0),%%mm3\n" /* mm3 = pix1[8-15] */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
240 "movq 8(%1),%%mm4\n" /* mm4 = pix2[8-15] */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
241
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
242 /* todo: mm1-mm2, mm3-mm4 */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
243 /* algo: subtract mm1 from mm2 with saturation and vice versa */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
244 /* OR the results to get absolute difference */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
245 "movq %%mm1,%%mm5\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
246 "movq %%mm3,%%mm6\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
247 "psubusb %%mm2,%%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
248 "psubusb %%mm4,%%mm3\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
249 "psubusb %%mm5,%%mm2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
250 "psubusb %%mm6,%%mm4\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
251
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
252 "por %%mm1,%%mm2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
253 "por %%mm3,%%mm4\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
254
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
255 /* now convert to 16-bit vectors so we can square them */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
256 "movq %%mm2,%%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
257 "movq %%mm4,%%mm3\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
258
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
259 "punpckhbw %%mm0,%%mm2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
260 "punpckhbw %%mm0,%%mm4\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
261 "punpcklbw %%mm0,%%mm1\n" /* mm1 now spread over (mm1,mm2) */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
262 "punpcklbw %%mm0,%%mm3\n" /* mm4 now spread over (mm3,mm4) */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
263
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
264 "pmaddwd %%mm2,%%mm2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
265 "pmaddwd %%mm4,%%mm4\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
266 "pmaddwd %%mm1,%%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
267 "pmaddwd %%mm3,%%mm3\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
268
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
269 "add %3,%0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
270 "add %3,%1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
271
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
272 "paddd %%mm2,%%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
273 "paddd %%mm4,%%mm3\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
274 "paddd %%mm1,%%mm7\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
275 "paddd %%mm3,%%mm7\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
276
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
277 "decl %%ecx\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
278 "jnz 1b\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
279
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
280 "movq %%mm7,%%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
281 "psrlq $32, %%mm7\n" /* shift hi dword to lo */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
282 "paddd %%mm7,%%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
283 "movd %%mm1,%2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
284 : "+r" (pix1), "+r" (pix2), "=r"(tmp)
6755
33896780c612 Do not misuse long as the size of a register in x86.
ramiro
parents: 6403
diff changeset
285 : "r" ((x86_reg)line_size) , "m" (h)
6403
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
286 : "%ecx");
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
287 return tmp;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
288 }
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
289
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
290 static int sse16_sse2(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h) {
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
291 int tmp;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
292 asm volatile (
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
293 "shr $1,%2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
294 "pxor %%xmm0,%%xmm0\n" /* mm0 = 0 */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
295 "pxor %%xmm7,%%xmm7\n" /* mm7 holds the sum */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
296 "1:\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
297 "movdqu (%0),%%xmm1\n" /* mm1 = pix1[0][0-15] */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
298 "movdqu (%1),%%xmm2\n" /* mm2 = pix2[0][0-15] */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
299 "movdqu (%0,%4),%%xmm3\n" /* mm3 = pix1[1][0-15] */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
300 "movdqu (%1,%4),%%xmm4\n" /* mm4 = pix2[1][0-15] */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
301
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
302 /* todo: mm1-mm2, mm3-mm4 */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
303 /* algo: subtract mm1 from mm2 with saturation and vice versa */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
304 /* OR the results to get absolute difference */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
305 "movdqa %%xmm1,%%xmm5\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
306 "movdqa %%xmm3,%%xmm6\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
307 "psubusb %%xmm2,%%xmm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
308 "psubusb %%xmm4,%%xmm3\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
309 "psubusb %%xmm5,%%xmm2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
310 "psubusb %%xmm6,%%xmm4\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
311
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
312 "por %%xmm1,%%xmm2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
313 "por %%xmm3,%%xmm4\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
314
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
315 /* now convert to 16-bit vectors so we can square them */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
316 "movdqa %%xmm2,%%xmm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
317 "movdqa %%xmm4,%%xmm3\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
318
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
319 "punpckhbw %%xmm0,%%xmm2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
320 "punpckhbw %%xmm0,%%xmm4\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
321 "punpcklbw %%xmm0,%%xmm1\n" /* mm1 now spread over (mm1,mm2) */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
322 "punpcklbw %%xmm0,%%xmm3\n" /* mm4 now spread over (mm3,mm4) */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
323
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
324 "pmaddwd %%xmm2,%%xmm2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
325 "pmaddwd %%xmm4,%%xmm4\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
326 "pmaddwd %%xmm1,%%xmm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
327 "pmaddwd %%xmm3,%%xmm3\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
328
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
329 "lea (%0,%4,2), %0\n" /* pix1 += 2*line_size */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
330 "lea (%1,%4,2), %1\n" /* pix2 += 2*line_size */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
331
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
332 "paddd %%xmm2,%%xmm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
333 "paddd %%xmm4,%%xmm3\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
334 "paddd %%xmm1,%%xmm7\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
335 "paddd %%xmm3,%%xmm7\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
336
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
337 "decl %2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
338 "jnz 1b\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
339
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
340 "movdqa %%xmm7,%%xmm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
341 "psrldq $8, %%xmm7\n" /* shift hi qword to lo */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
342 "paddd %%xmm1,%%xmm7\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
343 "movdqa %%xmm7,%%xmm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
344 "psrldq $4, %%xmm7\n" /* shift hi dword to lo */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
345 "paddd %%xmm1,%%xmm7\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
346 "movd %%xmm7,%3\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
347 : "+r" (pix1), "+r" (pix2), "+r"(h), "=r"(tmp)
6755
33896780c612 Do not misuse long as the size of a register in x86.
ramiro
parents: 6403
diff changeset
348 : "r" ((x86_reg)line_size));
6403
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
349 return tmp;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
350 }
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
351
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
352 static int hf_noise8_mmx(uint8_t * pix1, int line_size, int h) {
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
353 int tmp;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
354 asm volatile (
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
355 "movl %3,%%ecx\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
356 "pxor %%mm7,%%mm7\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
357 "pxor %%mm6,%%mm6\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
358
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
359 "movq (%0),%%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
360 "movq %%mm0, %%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
361 "psllq $8, %%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
362 "psrlq $8, %%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
363 "psrlq $8, %%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
364 "movq %%mm0, %%mm2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
365 "movq %%mm1, %%mm3\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
366 "punpcklbw %%mm7,%%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
367 "punpcklbw %%mm7,%%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
368 "punpckhbw %%mm7,%%mm2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
369 "punpckhbw %%mm7,%%mm3\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
370 "psubw %%mm1, %%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
371 "psubw %%mm3, %%mm2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
372
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
373 "add %2,%0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
374
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
375 "movq (%0),%%mm4\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
376 "movq %%mm4, %%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
377 "psllq $8, %%mm4\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
378 "psrlq $8, %%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
379 "psrlq $8, %%mm4\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
380 "movq %%mm4, %%mm5\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
381 "movq %%mm1, %%mm3\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
382 "punpcklbw %%mm7,%%mm4\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
383 "punpcklbw %%mm7,%%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
384 "punpckhbw %%mm7,%%mm5\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
385 "punpckhbw %%mm7,%%mm3\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
386 "psubw %%mm1, %%mm4\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
387 "psubw %%mm3, %%mm5\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
388 "psubw %%mm4, %%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
389 "psubw %%mm5, %%mm2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
390 "pxor %%mm3, %%mm3\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
391 "pxor %%mm1, %%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
392 "pcmpgtw %%mm0, %%mm3\n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
393 "pcmpgtw %%mm2, %%mm1\n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
394 "pxor %%mm3, %%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
395 "pxor %%mm1, %%mm2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
396 "psubw %%mm3, %%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
397 "psubw %%mm1, %%mm2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
398 "paddw %%mm0, %%mm2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
399 "paddw %%mm2, %%mm6\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
400
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
401 "add %2,%0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
402 "1:\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
403
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
404 "movq (%0),%%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
405 "movq %%mm0, %%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
406 "psllq $8, %%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
407 "psrlq $8, %%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
408 "psrlq $8, %%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
409 "movq %%mm0, %%mm2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
410 "movq %%mm1, %%mm3\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
411 "punpcklbw %%mm7,%%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
412 "punpcklbw %%mm7,%%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
413 "punpckhbw %%mm7,%%mm2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
414 "punpckhbw %%mm7,%%mm3\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
415 "psubw %%mm1, %%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
416 "psubw %%mm3, %%mm2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
417 "psubw %%mm0, %%mm4\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
418 "psubw %%mm2, %%mm5\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
419 "pxor %%mm3, %%mm3\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
420 "pxor %%mm1, %%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
421 "pcmpgtw %%mm4, %%mm3\n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
422 "pcmpgtw %%mm5, %%mm1\n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
423 "pxor %%mm3, %%mm4\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
424 "pxor %%mm1, %%mm5\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
425 "psubw %%mm3, %%mm4\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
426 "psubw %%mm1, %%mm5\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
427 "paddw %%mm4, %%mm5\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
428 "paddw %%mm5, %%mm6\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
429
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
430 "add %2,%0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
431
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
432 "movq (%0),%%mm4\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
433 "movq %%mm4, %%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
434 "psllq $8, %%mm4\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
435 "psrlq $8, %%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
436 "psrlq $8, %%mm4\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
437 "movq %%mm4, %%mm5\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
438 "movq %%mm1, %%mm3\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
439 "punpcklbw %%mm7,%%mm4\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
440 "punpcklbw %%mm7,%%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
441 "punpckhbw %%mm7,%%mm5\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
442 "punpckhbw %%mm7,%%mm3\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
443 "psubw %%mm1, %%mm4\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
444 "psubw %%mm3, %%mm5\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
445 "psubw %%mm4, %%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
446 "psubw %%mm5, %%mm2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
447 "pxor %%mm3, %%mm3\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
448 "pxor %%mm1, %%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
449 "pcmpgtw %%mm0, %%mm3\n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
450 "pcmpgtw %%mm2, %%mm1\n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
451 "pxor %%mm3, %%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
452 "pxor %%mm1, %%mm2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
453 "psubw %%mm3, %%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
454 "psubw %%mm1, %%mm2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
455 "paddw %%mm0, %%mm2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
456 "paddw %%mm2, %%mm6\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
457
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
458 "add %2,%0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
459 "subl $2, %%ecx\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
460 " jnz 1b\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
461
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
462 "movq %%mm6, %%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
463 "punpcklwd %%mm7,%%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
464 "punpckhwd %%mm7,%%mm6\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
465 "paddd %%mm0, %%mm6\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
466
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
467 "movq %%mm6,%%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
468 "psrlq $32, %%mm6\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
469 "paddd %%mm6,%%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
470 "movd %%mm0,%1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
471 : "+r" (pix1), "=r"(tmp)
6755
33896780c612 Do not misuse long as the size of a register in x86.
ramiro
parents: 6403
diff changeset
472 : "r" ((x86_reg)line_size) , "g" (h-2)
6403
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
473 : "%ecx");
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
474 return tmp;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
475 }
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
476
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
477 static int hf_noise16_mmx(uint8_t * pix1, int line_size, int h) {
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
478 int tmp;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
479 uint8_t * pix= pix1;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
480 asm volatile (
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
481 "movl %3,%%ecx\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
482 "pxor %%mm7,%%mm7\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
483 "pxor %%mm6,%%mm6\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
484
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
485 "movq (%0),%%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
486 "movq 1(%0),%%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
487 "movq %%mm0, %%mm2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
488 "movq %%mm1, %%mm3\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
489 "punpcklbw %%mm7,%%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
490 "punpcklbw %%mm7,%%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
491 "punpckhbw %%mm7,%%mm2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
492 "punpckhbw %%mm7,%%mm3\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
493 "psubw %%mm1, %%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
494 "psubw %%mm3, %%mm2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
495
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
496 "add %2,%0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
497
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
498 "movq (%0),%%mm4\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
499 "movq 1(%0),%%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
500 "movq %%mm4, %%mm5\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
501 "movq %%mm1, %%mm3\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
502 "punpcklbw %%mm7,%%mm4\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
503 "punpcklbw %%mm7,%%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
504 "punpckhbw %%mm7,%%mm5\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
505 "punpckhbw %%mm7,%%mm3\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
506 "psubw %%mm1, %%mm4\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
507 "psubw %%mm3, %%mm5\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
508 "psubw %%mm4, %%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
509 "psubw %%mm5, %%mm2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
510 "pxor %%mm3, %%mm3\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
511 "pxor %%mm1, %%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
512 "pcmpgtw %%mm0, %%mm3\n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
513 "pcmpgtw %%mm2, %%mm1\n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
514 "pxor %%mm3, %%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
515 "pxor %%mm1, %%mm2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
516 "psubw %%mm3, %%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
517 "psubw %%mm1, %%mm2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
518 "paddw %%mm0, %%mm2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
519 "paddw %%mm2, %%mm6\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
520
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
521 "add %2,%0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
522 "1:\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
523
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
524 "movq (%0),%%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
525 "movq 1(%0),%%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
526 "movq %%mm0, %%mm2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
527 "movq %%mm1, %%mm3\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
528 "punpcklbw %%mm7,%%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
529 "punpcklbw %%mm7,%%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
530 "punpckhbw %%mm7,%%mm2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
531 "punpckhbw %%mm7,%%mm3\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
532 "psubw %%mm1, %%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
533 "psubw %%mm3, %%mm2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
534 "psubw %%mm0, %%mm4\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
535 "psubw %%mm2, %%mm5\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
536 "pxor %%mm3, %%mm3\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
537 "pxor %%mm1, %%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
538 "pcmpgtw %%mm4, %%mm3\n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
539 "pcmpgtw %%mm5, %%mm1\n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
540 "pxor %%mm3, %%mm4\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
541 "pxor %%mm1, %%mm5\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
542 "psubw %%mm3, %%mm4\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
543 "psubw %%mm1, %%mm5\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
544 "paddw %%mm4, %%mm5\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
545 "paddw %%mm5, %%mm6\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
546
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
547 "add %2,%0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
548
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
549 "movq (%0),%%mm4\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
550 "movq 1(%0),%%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
551 "movq %%mm4, %%mm5\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
552 "movq %%mm1, %%mm3\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
553 "punpcklbw %%mm7,%%mm4\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
554 "punpcklbw %%mm7,%%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
555 "punpckhbw %%mm7,%%mm5\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
556 "punpckhbw %%mm7,%%mm3\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
557 "psubw %%mm1, %%mm4\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
558 "psubw %%mm3, %%mm5\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
559 "psubw %%mm4, %%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
560 "psubw %%mm5, %%mm2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
561 "pxor %%mm3, %%mm3\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
562 "pxor %%mm1, %%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
563 "pcmpgtw %%mm0, %%mm3\n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
564 "pcmpgtw %%mm2, %%mm1\n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
565 "pxor %%mm3, %%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
566 "pxor %%mm1, %%mm2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
567 "psubw %%mm3, %%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
568 "psubw %%mm1, %%mm2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
569 "paddw %%mm0, %%mm2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
570 "paddw %%mm2, %%mm6\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
571
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
572 "add %2,%0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
573 "subl $2, %%ecx\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
574 " jnz 1b\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
575
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
576 "movq %%mm6, %%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
577 "punpcklwd %%mm7,%%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
578 "punpckhwd %%mm7,%%mm6\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
579 "paddd %%mm0, %%mm6\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
580
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
581 "movq %%mm6,%%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
582 "psrlq $32, %%mm6\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
583 "paddd %%mm6,%%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
584 "movd %%mm0,%1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
585 : "+r" (pix1), "=r"(tmp)
6755
33896780c612 Do not misuse long as the size of a register in x86.
ramiro
parents: 6403
diff changeset
586 : "r" ((x86_reg)line_size) , "g" (h-2)
6403
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
587 : "%ecx");
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
588 return tmp + hf_noise8_mmx(pix+8, line_size, h);
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
589 }
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
590
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
591 static int nsse16_mmx(void *p, uint8_t * pix1, uint8_t * pix2, int line_size, int h) {
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
592 MpegEncContext *c = p;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
593 int score1, score2;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
594
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
595 if(c) score1 = c->dsp.sse[0](c, pix1, pix2, line_size, h);
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
596 else score1 = sse16_mmx(c, pix1, pix2, line_size, h);
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
597 score2= hf_noise16_mmx(pix1, line_size, h) - hf_noise16_mmx(pix2, line_size, h);
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
598
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
599 if(c) return score1 + FFABS(score2)*c->avctx->nsse_weight;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
600 else return score1 + FFABS(score2)*8;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
601 }
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
602
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
603 static int nsse8_mmx(void *p, uint8_t * pix1, uint8_t * pix2, int line_size, int h) {
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
604 MpegEncContext *c = p;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
605 int score1= sse8_mmx(c, pix1, pix2, line_size, h);
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
606 int score2= hf_noise8_mmx(pix1, line_size, h) - hf_noise8_mmx(pix2, line_size, h);
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
607
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
608 if(c) return score1 + FFABS(score2)*c->avctx->nsse_weight;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
609 else return score1 + FFABS(score2)*8;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
610 }
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
611
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
612 static int vsad_intra16_mmx(void *v, uint8_t * pix, uint8_t * dummy, int line_size, int h) {
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
613 int tmp;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
614
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
615 assert( (((int)pix) & 7) == 0);
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
616 assert((line_size &7) ==0);
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
617
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
618 #define SUM(in0, in1, out0, out1) \
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
619 "movq (%0), %%mm2\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
620 "movq 8(%0), %%mm3\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
621 "add %2,%0\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
622 "movq %%mm2, " #out0 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
623 "movq %%mm3, " #out1 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
624 "psubusb " #in0 ", %%mm2\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
625 "psubusb " #in1 ", %%mm3\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
626 "psubusb " #out0 ", " #in0 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
627 "psubusb " #out1 ", " #in1 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
628 "por %%mm2, " #in0 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
629 "por %%mm3, " #in1 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
630 "movq " #in0 ", %%mm2\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
631 "movq " #in1 ", %%mm3\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
632 "punpcklbw %%mm7, " #in0 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
633 "punpcklbw %%mm7, " #in1 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
634 "punpckhbw %%mm7, %%mm2\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
635 "punpckhbw %%mm7, %%mm3\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
636 "paddw " #in1 ", " #in0 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
637 "paddw %%mm3, %%mm2\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
638 "paddw %%mm2, " #in0 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
639 "paddw " #in0 ", %%mm6\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
640
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
641
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
642 asm volatile (
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
643 "movl %3,%%ecx\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
644 "pxor %%mm6,%%mm6\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
645 "pxor %%mm7,%%mm7\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
646 "movq (%0),%%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
647 "movq 8(%0),%%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
648 "add %2,%0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
649 "subl $2, %%ecx\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
650 SUM(%%mm0, %%mm1, %%mm4, %%mm5)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
651 "1:\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
652
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
653 SUM(%%mm4, %%mm5, %%mm0, %%mm1)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
654
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
655 SUM(%%mm0, %%mm1, %%mm4, %%mm5)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
656
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
657 "subl $2, %%ecx\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
658 "jnz 1b\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
659
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
660 "movq %%mm6,%%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
661 "psrlq $32, %%mm6\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
662 "paddw %%mm6,%%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
663 "movq %%mm0,%%mm6\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
664 "psrlq $16, %%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
665 "paddw %%mm6,%%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
666 "movd %%mm0,%1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
667 : "+r" (pix), "=r"(tmp)
6755
33896780c612 Do not misuse long as the size of a register in x86.
ramiro
parents: 6403
diff changeset
668 : "r" ((x86_reg)line_size) , "m" (h)
6403
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
669 : "%ecx");
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
670 return tmp & 0xFFFF;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
671 }
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
672 #undef SUM
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
673
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
674 static int vsad_intra16_mmx2(void *v, uint8_t * pix, uint8_t * dummy, int line_size, int h) {
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
675 int tmp;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
676
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
677 assert( (((int)pix) & 7) == 0);
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
678 assert((line_size &7) ==0);
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
679
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
680 #define SUM(in0, in1, out0, out1) \
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
681 "movq (%0), " #out0 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
682 "movq 8(%0), " #out1 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
683 "add %2,%0\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
684 "psadbw " #out0 ", " #in0 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
685 "psadbw " #out1 ", " #in1 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
686 "paddw " #in1 ", " #in0 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
687 "paddw " #in0 ", %%mm6\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
688
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
689 asm volatile (
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
690 "movl %3,%%ecx\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
691 "pxor %%mm6,%%mm6\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
692 "pxor %%mm7,%%mm7\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
693 "movq (%0),%%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
694 "movq 8(%0),%%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
695 "add %2,%0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
696 "subl $2, %%ecx\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
697 SUM(%%mm0, %%mm1, %%mm4, %%mm5)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
698 "1:\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
699
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
700 SUM(%%mm4, %%mm5, %%mm0, %%mm1)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
701
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
702 SUM(%%mm0, %%mm1, %%mm4, %%mm5)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
703
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
704 "subl $2, %%ecx\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
705 "jnz 1b\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
706
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
707 "movd %%mm6,%1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
708 : "+r" (pix), "=r"(tmp)
6755
33896780c612 Do not misuse long as the size of a register in x86.
ramiro
parents: 6403
diff changeset
709 : "r" ((x86_reg)line_size) , "m" (h)
6403
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
710 : "%ecx");
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
711 return tmp;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
712 }
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
713 #undef SUM
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
714
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
715 static int vsad16_mmx(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h) {
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
716 int tmp;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
717
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
718 assert( (((int)pix1) & 7) == 0);
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
719 assert( (((int)pix2) & 7) == 0);
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
720 assert((line_size &7) ==0);
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
721
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
722 #define SUM(in0, in1, out0, out1) \
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
723 "movq (%0),%%mm2\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
724 "movq (%1)," #out0 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
725 "movq 8(%0),%%mm3\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
726 "movq 8(%1)," #out1 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
727 "add %3,%0\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
728 "add %3,%1\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
729 "psubb " #out0 ", %%mm2\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
730 "psubb " #out1 ", %%mm3\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
731 "pxor %%mm7, %%mm2\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
732 "pxor %%mm7, %%mm3\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
733 "movq %%mm2, " #out0 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
734 "movq %%mm3, " #out1 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
735 "psubusb " #in0 ", %%mm2\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
736 "psubusb " #in1 ", %%mm3\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
737 "psubusb " #out0 ", " #in0 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
738 "psubusb " #out1 ", " #in1 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
739 "por %%mm2, " #in0 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
740 "por %%mm3, " #in1 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
741 "movq " #in0 ", %%mm2\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
742 "movq " #in1 ", %%mm3\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
743 "punpcklbw %%mm7, " #in0 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
744 "punpcklbw %%mm7, " #in1 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
745 "punpckhbw %%mm7, %%mm2\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
746 "punpckhbw %%mm7, %%mm3\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
747 "paddw " #in1 ", " #in0 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
748 "paddw %%mm3, %%mm2\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
749 "paddw %%mm2, " #in0 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
750 "paddw " #in0 ", %%mm6\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
751
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
752
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
753 asm volatile (
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
754 "movl %4,%%ecx\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
755 "pxor %%mm6,%%mm6\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
756 "pcmpeqw %%mm7,%%mm7\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
757 "psllw $15, %%mm7\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
758 "packsswb %%mm7, %%mm7\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
759 "movq (%0),%%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
760 "movq (%1),%%mm2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
761 "movq 8(%0),%%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
762 "movq 8(%1),%%mm3\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
763 "add %3,%0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
764 "add %3,%1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
765 "subl $2, %%ecx\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
766 "psubb %%mm2, %%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
767 "psubb %%mm3, %%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
768 "pxor %%mm7, %%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
769 "pxor %%mm7, %%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
770 SUM(%%mm0, %%mm1, %%mm4, %%mm5)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
771 "1:\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
772
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
773 SUM(%%mm4, %%mm5, %%mm0, %%mm1)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
774
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
775 SUM(%%mm0, %%mm1, %%mm4, %%mm5)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
776
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
777 "subl $2, %%ecx\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
778 "jnz 1b\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
779
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
780 "movq %%mm6,%%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
781 "psrlq $32, %%mm6\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
782 "paddw %%mm6,%%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
783 "movq %%mm0,%%mm6\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
784 "psrlq $16, %%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
785 "paddw %%mm6,%%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
786 "movd %%mm0,%2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
787 : "+r" (pix1), "+r" (pix2), "=r"(tmp)
6755
33896780c612 Do not misuse long as the size of a register in x86.
ramiro
parents: 6403
diff changeset
788 : "r" ((x86_reg)line_size) , "m" (h)
6403
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
789 : "%ecx");
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
790 return tmp & 0x7FFF;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
791 }
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
792 #undef SUM
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
793
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
794 static int vsad16_mmx2(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h) {
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
795 int tmp;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
796
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
797 assert( (((int)pix1) & 7) == 0);
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
798 assert( (((int)pix2) & 7) == 0);
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
799 assert((line_size &7) ==0);
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
800
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
801 #define SUM(in0, in1, out0, out1) \
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
802 "movq (%0)," #out0 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
803 "movq (%1),%%mm2\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
804 "movq 8(%0)," #out1 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
805 "movq 8(%1),%%mm3\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
806 "add %3,%0\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
807 "add %3,%1\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
808 "psubb %%mm2, " #out0 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
809 "psubb %%mm3, " #out1 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
810 "pxor %%mm7, " #out0 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
811 "pxor %%mm7, " #out1 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
812 "psadbw " #out0 ", " #in0 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
813 "psadbw " #out1 ", " #in1 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
814 "paddw " #in1 ", " #in0 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
815 "paddw " #in0 ", %%mm6\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
816
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
817 asm volatile (
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
818 "movl %4,%%ecx\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
819 "pxor %%mm6,%%mm6\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
820 "pcmpeqw %%mm7,%%mm7\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
821 "psllw $15, %%mm7\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
822 "packsswb %%mm7, %%mm7\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
823 "movq (%0),%%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
824 "movq (%1),%%mm2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
825 "movq 8(%0),%%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
826 "movq 8(%1),%%mm3\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
827 "add %3,%0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
828 "add %3,%1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
829 "subl $2, %%ecx\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
830 "psubb %%mm2, %%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
831 "psubb %%mm3, %%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
832 "pxor %%mm7, %%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
833 "pxor %%mm7, %%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
834 SUM(%%mm0, %%mm1, %%mm4, %%mm5)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
835 "1:\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
836
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
837 SUM(%%mm4, %%mm5, %%mm0, %%mm1)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
838
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
839 SUM(%%mm0, %%mm1, %%mm4, %%mm5)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
840
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
841 "subl $2, %%ecx\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
842 "jnz 1b\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
843
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
844 "movd %%mm6,%2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
845 : "+r" (pix1), "+r" (pix2), "=r"(tmp)
6755
33896780c612 Do not misuse long as the size of a register in x86.
ramiro
parents: 6403
diff changeset
846 : "r" ((x86_reg)line_size) , "m" (h)
6403
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
847 : "%ecx");
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
848 return tmp;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
849 }
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
850 #undef SUM
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
851
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
852 static void diff_bytes_mmx(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w){
6755
33896780c612 Do not misuse long as the size of a register in x86.
ramiro
parents: 6403
diff changeset
853 x86_reg i=0;
6403
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
854 asm volatile(
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
855 "1: \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
856 "movq (%2, %0), %%mm0 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
857 "movq (%1, %0), %%mm1 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
858 "psubb %%mm0, %%mm1 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
859 "movq %%mm1, (%3, %0) \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
860 "movq 8(%2, %0), %%mm0 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
861 "movq 8(%1, %0), %%mm1 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
862 "psubb %%mm0, %%mm1 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
863 "movq %%mm1, 8(%3, %0) \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
864 "add $16, %0 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
865 "cmp %4, %0 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
866 " jb 1b \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
867 : "+r" (i)
6755
33896780c612 Do not misuse long as the size of a register in x86.
ramiro
parents: 6403
diff changeset
868 : "r"(src1), "r"(src2), "r"(dst), "r"((x86_reg)w-15)
6403
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
869 );
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
870 for(; i<w; i++)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
871 dst[i+0] = src1[i+0]-src2[i+0];
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
872 }
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
873
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
874 static void sub_hfyu_median_prediction_mmx2(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w, int *left, int *left_top){
6755
33896780c612 Do not misuse long as the size of a register in x86.
ramiro
parents: 6403
diff changeset
875 x86_reg i=0;
6403
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
876 uint8_t l, lt;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
877
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
878 asm volatile(
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
879 "1: \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
880 "movq -1(%1, %0), %%mm0 \n\t" // LT
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
881 "movq (%1, %0), %%mm1 \n\t" // T
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
882 "movq -1(%2, %0), %%mm2 \n\t" // L
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
883 "movq (%2, %0), %%mm3 \n\t" // X
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
884 "movq %%mm2, %%mm4 \n\t" // L
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
885 "psubb %%mm0, %%mm2 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
886 "paddb %%mm1, %%mm2 \n\t" // L + T - LT
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
887 "movq %%mm4, %%mm5 \n\t" // L
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
888 "pmaxub %%mm1, %%mm4 \n\t" // max(T, L)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
889 "pminub %%mm5, %%mm1 \n\t" // min(T, L)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
890 "pminub %%mm2, %%mm4 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
891 "pmaxub %%mm1, %%mm4 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
892 "psubb %%mm4, %%mm3 \n\t" // dst - pred
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
893 "movq %%mm3, (%3, %0) \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
894 "add $8, %0 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
895 "cmp %4, %0 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
896 " jb 1b \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
897 : "+r" (i)
6755
33896780c612 Do not misuse long as the size of a register in x86.
ramiro
parents: 6403
diff changeset
898 : "r"(src1), "r"(src2), "r"(dst), "r"((x86_reg)w)
6403
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
899 );
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
900
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
901 l= *left;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
902 lt= *left_top;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
903
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
904 dst[0]= src2[0] - mid_pred(l, src1[0], (l + src1[0] - lt)&0xFF);
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
905
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
906 *left_top= src1[w-1];
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
907 *left = src2[w-1];
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
908 }
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
909
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
910 #define DIFF_PIXELS_1(m,a,t,p1,p2)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
911 "mov"#m" "#p1", "#a" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
912 "mov"#m" "#p2", "#t" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
913 "punpcklbw "#a", "#t" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
914 "punpcklbw "#a", "#a" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
915 "psubw "#t", "#a" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
916
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
917 #define DIFF_PIXELS_8(m0,m1,mm,p1,p2,stride,temp) {\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
918 uint8_t *p1b=p1, *p2b=p2;\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
919 asm volatile(\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
920 DIFF_PIXELS_1(m0, mm##0, mm##7, (%1), (%2))\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
921 DIFF_PIXELS_1(m0, mm##1, mm##7, (%1,%3), (%2,%3))\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
922 DIFF_PIXELS_1(m0, mm##2, mm##7, (%1,%3,2), (%2,%3,2))\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
923 "add %4, %1 \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
924 "add %4, %2 \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
925 DIFF_PIXELS_1(m0, mm##3, mm##7, (%1), (%2))\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
926 DIFF_PIXELS_1(m0, mm##4, mm##7, (%1,%3), (%2,%3))\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
927 DIFF_PIXELS_1(m0, mm##5, mm##7, (%1,%3,2), (%2,%3,2))\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
928 DIFF_PIXELS_1(m0, mm##6, mm##7, (%1,%4), (%2,%4))\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
929 "mov"#m1" "#mm"0, %0 \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
930 DIFF_PIXELS_1(m0, mm##7, mm##0, (%1,%3,4), (%2,%3,4))\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
931 "mov"#m1" %0, "#mm"0 \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
932 : "+m"(temp), "+r"(p1b), "+r"(p2b)\
6755
33896780c612 Do not misuse long as the size of a register in x86.
ramiro
parents: 6403
diff changeset
933 : "r"((x86_reg)stride), "r"((x86_reg)stride*3)\
6403
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
934 );\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
935 }
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
936 //the "+m"(temp) is needed as gcc 2.95 sometimes fails to compile "=m"(temp)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
937
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
938 #define DIFF_PIXELS_4x8(p1,p2,stride,temp) DIFF_PIXELS_8(d, q, %%mm, p1, p2, stride, temp)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
939 #define DIFF_PIXELS_8x8(p1,p2,stride,temp) DIFF_PIXELS_8(q, dqa, %%xmm, p1, p2, stride, temp)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
940
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
941 #define LBUTTERFLY2(a1,b1,a2,b2)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
942 "paddw " #b1 ", " #a1 " \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
943 "paddw " #b2 ", " #a2 " \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
944 "paddw " #b1 ", " #b1 " \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
945 "paddw " #b2 ", " #b2 " \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
946 "psubw " #a1 ", " #b1 " \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
947 "psubw " #a2 ", " #b2 " \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
948
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
949 #define HADAMARD8(m0, m1, m2, m3, m4, m5, m6, m7)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
950 LBUTTERFLY2(m0, m1, m2, m3)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
951 LBUTTERFLY2(m4, m5, m6, m7)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
952 LBUTTERFLY2(m0, m2, m1, m3)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
953 LBUTTERFLY2(m4, m6, m5, m7)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
954 LBUTTERFLY2(m0, m4, m1, m5)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
955 LBUTTERFLY2(m2, m6, m3, m7)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
956
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
957 #define HADAMARD48 HADAMARD8(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm6, %%mm7)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
958
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
959 #define MMABS_MMX(a,z)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
960 "pxor " #z ", " #z " \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
961 "pcmpgtw " #a ", " #z " \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
962 "pxor " #z ", " #a " \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
963 "psubw " #z ", " #a " \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
964
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
965 #define MMABS_MMX2(a,z)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
966 "pxor " #z ", " #z " \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
967 "psubw " #a ", " #z " \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
968 "pmaxsw " #z ", " #a " \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
969
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
970 #define MMABS_SSSE3(a,z)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
971 "pabsw " #a ", " #a " \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
972
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
973 #define MMABS_SUM(a,z, sum)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
974 MMABS(a,z)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
975 "paddusw " #a ", " #sum " \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
976
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
977 #define MMABS_SUM_8x8_NOSPILL\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
978 MMABS(%%xmm0, %%xmm8)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
979 MMABS(%%xmm1, %%xmm9)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
980 MMABS_SUM(%%xmm2, %%xmm8, %%xmm0)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
981 MMABS_SUM(%%xmm3, %%xmm9, %%xmm1)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
982 MMABS_SUM(%%xmm4, %%xmm8, %%xmm0)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
983 MMABS_SUM(%%xmm5, %%xmm9, %%xmm1)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
984 MMABS_SUM(%%xmm6, %%xmm8, %%xmm0)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
985 MMABS_SUM(%%xmm7, %%xmm9, %%xmm1)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
986 "paddusw %%xmm1, %%xmm0 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
987
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
988 #ifdef ARCH_X86_64
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
989 #define MMABS_SUM_8x8_SSE2 MMABS_SUM_8x8_NOSPILL
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
990 #else
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
991 #define MMABS_SUM_8x8_SSE2\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
992 "movdqa %%xmm7, (%1) \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
993 MMABS(%%xmm0, %%xmm7)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
994 MMABS(%%xmm1, %%xmm7)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
995 MMABS_SUM(%%xmm2, %%xmm7, %%xmm0)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
996 MMABS_SUM(%%xmm3, %%xmm7, %%xmm1)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
997 MMABS_SUM(%%xmm4, %%xmm7, %%xmm0)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
998 MMABS_SUM(%%xmm5, %%xmm7, %%xmm1)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
999 MMABS_SUM(%%xmm6, %%xmm7, %%xmm0)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1000 "movdqa (%1), %%xmm2 \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1001 MMABS_SUM(%%xmm2, %%xmm7, %%xmm1)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1002 "paddusw %%xmm1, %%xmm0 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1003 #endif
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1004
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1005 #define LOAD4(o, a, b, c, d)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1006 "movq "#o"(%1), "#a" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1007 "movq "#o"+8(%1), "#b" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1008 "movq "#o"+16(%1), "#c" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1009 "movq "#o"+24(%1), "#d" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1010
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1011 #define STORE4(o, a, b, c, d)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1012 "movq "#a", "#o"(%1) \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1013 "movq "#b", "#o"+8(%1) \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1014 "movq "#c", "#o"+16(%1) \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1015 "movq "#d", "#o"+24(%1) \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1016
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1017 /* FIXME: HSUM_* saturates at 64k, while an 8x8 hadamard or dct block can get up to
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1018 * about 100k on extreme inputs. But that's very unlikely to occur in natural video,
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1019 * and it's even more unlikely to not have any alternative mvs/modes with lower cost. */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1020 #define HSUM_MMX(a, t, dst)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1021 "movq "#a", "#t" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1022 "psrlq $32, "#a" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1023 "paddusw "#t", "#a" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1024 "movq "#a", "#t" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1025 "psrlq $16, "#a" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1026 "paddusw "#t", "#a" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1027 "movd "#a", "#dst" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1028
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1029 #define HSUM_MMX2(a, t, dst)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1030 "pshufw $0x0E, "#a", "#t" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1031 "paddusw "#t", "#a" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1032 "pshufw $0x01, "#a", "#t" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1033 "paddusw "#t", "#a" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1034 "movd "#a", "#dst" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1035
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1036 #define HSUM_SSE2(a, t, dst)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1037 "movhlps "#a", "#t" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1038 "paddusw "#t", "#a" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1039 "pshuflw $0x0E, "#a", "#t" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1040 "paddusw "#t", "#a" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1041 "pshuflw $0x01, "#a", "#t" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1042 "paddusw "#t", "#a" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1043 "movd "#a", "#dst" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1044
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1045 #define HADAMARD8_DIFF_MMX(cpu) \
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1046 static int hadamard8_diff_##cpu(void *s, uint8_t *src1, uint8_t *src2, int stride, int h){\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1047 DECLARE_ALIGNED_8(uint64_t, temp[13]);\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1048 int sum;\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1049 \
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1050 assert(h==8);\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1051 \
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1052 DIFF_PIXELS_4x8(src1, src2, stride, temp[0]);\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1053 \
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1054 asm volatile(\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1055 HADAMARD48\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1056 \
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1057 "movq %%mm7, 96(%1) \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1058 \
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1059 TRANSPOSE4(%%mm0, %%mm1, %%mm2, %%mm3, %%mm7)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1060 STORE4(0 , %%mm0, %%mm3, %%mm7, %%mm2)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1061 \
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1062 "movq 96(%1), %%mm7 \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1063 TRANSPOSE4(%%mm4, %%mm5, %%mm6, %%mm7, %%mm0)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1064 STORE4(64, %%mm4, %%mm7, %%mm0, %%mm6)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1065 \
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1066 : "=r" (sum)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1067 : "r"(temp)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1068 );\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1069 \
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1070 DIFF_PIXELS_4x8(src1+4, src2+4, stride, temp[4]);\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1071 \
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1072 asm volatile(\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1073 HADAMARD48\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1074 \
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1075 "movq %%mm7, 96(%1) \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1076 \
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1077 TRANSPOSE4(%%mm0, %%mm1, %%mm2, %%mm3, %%mm7)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1078 STORE4(32, %%mm0, %%mm3, %%mm7, %%mm2)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1079 \
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1080 "movq 96(%1), %%mm7 \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1081 TRANSPOSE4(%%mm4, %%mm5, %%mm6, %%mm7, %%mm0)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1082 "movq %%mm7, %%mm5 \n\t"/*FIXME remove*/\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1083 "movq %%mm6, %%mm7 \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1084 "movq %%mm0, %%mm6 \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1085 \
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1086 LOAD4(64, %%mm0, %%mm1, %%mm2, %%mm3)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1087 \
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1088 HADAMARD48\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1089 "movq %%mm7, 64(%1) \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1090 MMABS(%%mm0, %%mm7)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1091 MMABS(%%mm1, %%mm7)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1092 MMABS_SUM(%%mm2, %%mm7, %%mm0)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1093 MMABS_SUM(%%mm3, %%mm7, %%mm1)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1094 MMABS_SUM(%%mm4, %%mm7, %%mm0)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1095 MMABS_SUM(%%mm5, %%mm7, %%mm1)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1096 MMABS_SUM(%%mm6, %%mm7, %%mm0)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1097 "movq 64(%1), %%mm2 \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1098 MMABS_SUM(%%mm2, %%mm7, %%mm1)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1099 "paddusw %%mm1, %%mm0 \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1100 "movq %%mm0, 64(%1) \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1101 \
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1102 LOAD4(0 , %%mm0, %%mm1, %%mm2, %%mm3)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1103 LOAD4(32, %%mm4, %%mm5, %%mm6, %%mm7)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1104 \
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1105 HADAMARD48\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1106 "movq %%mm7, (%1) \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1107 MMABS(%%mm0, %%mm7)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1108 MMABS(%%mm1, %%mm7)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1109 MMABS_SUM(%%mm2, %%mm7, %%mm0)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1110 MMABS_SUM(%%mm3, %%mm7, %%mm1)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1111 MMABS_SUM(%%mm4, %%mm7, %%mm0)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1112 MMABS_SUM(%%mm5, %%mm7, %%mm1)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1113 MMABS_SUM(%%mm6, %%mm7, %%mm0)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1114 "movq (%1), %%mm2 \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1115 MMABS_SUM(%%mm2, %%mm7, %%mm1)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1116 "paddusw 64(%1), %%mm0 \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1117 "paddusw %%mm1, %%mm0 \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1118 \
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1119 HSUM(%%mm0, %%mm1, %0)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1120 \
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1121 : "=r" (sum)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1122 : "r"(temp)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1123 );\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1124 return sum&0xFFFF;\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1125 }\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1126 WRAPPER8_16_SQ(hadamard8_diff_##cpu, hadamard8_diff16_##cpu)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1127
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1128 #define HADAMARD8_DIFF_SSE2(cpu) \
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1129 static int hadamard8_diff_##cpu(void *s, uint8_t *src1, uint8_t *src2, int stride, int h){\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1130 DECLARE_ALIGNED_16(uint64_t, temp[4]);\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1131 int sum;\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1132 \
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1133 assert(h==8);\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1134 \
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1135 DIFF_PIXELS_8x8(src1, src2, stride, temp[0]);\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1136 \
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1137 asm volatile(\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1138 HADAMARD8(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm6, %%xmm7)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1139 TRANSPOSE8(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm6, %%xmm7, (%1))\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1140 HADAMARD8(%%xmm0, %%xmm5, %%xmm7, %%xmm3, %%xmm6, %%xmm4, %%xmm2, %%xmm1)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1141 MMABS_SUM_8x8\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1142 HSUM_SSE2(%%xmm0, %%xmm1, %0)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1143 : "=r" (sum)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1144 : "r"(temp)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1145 );\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1146 return sum&0xFFFF;\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1147 }\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1148 WRAPPER8_16_SQ(hadamard8_diff_##cpu, hadamard8_diff16_##cpu)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1149
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1150 #define MMABS(a,z) MMABS_MMX(a,z)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1151 #define HSUM(a,t,dst) HSUM_MMX(a,t,dst)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1152 HADAMARD8_DIFF_MMX(mmx)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1153 #undef MMABS
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1154 #undef HSUM
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1155
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1156 #define MMABS(a,z) MMABS_MMX2(a,z)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1157 #define MMABS_SUM_8x8 MMABS_SUM_8x8_SSE2
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1158 #define HSUM(a,t,dst) HSUM_MMX2(a,t,dst)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1159 HADAMARD8_DIFF_MMX(mmx2)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1160 HADAMARD8_DIFF_SSE2(sse2)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1161 #undef MMABS
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1162 #undef MMABS_SUM_8x8
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1163 #undef HSUM
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1164
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1165 #ifdef HAVE_SSSE3
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1166 #define MMABS(a,z) MMABS_SSSE3(a,z)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1167 #define MMABS_SUM_8x8 MMABS_SUM_8x8_NOSPILL
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1168 HADAMARD8_DIFF_SSE2(ssse3)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1169 #undef MMABS
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1170 #undef MMABS_SUM_8x8
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1171 #endif
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1172
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1173 #define DCT_SAD4(m,mm,o)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1174 "mov"#m" "#o"+ 0(%1), "#mm"2 \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1175 "mov"#m" "#o"+16(%1), "#mm"3 \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1176 "mov"#m" "#o"+32(%1), "#mm"4 \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1177 "mov"#m" "#o"+48(%1), "#mm"5 \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1178 MMABS_SUM(mm##2, mm##6, mm##0)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1179 MMABS_SUM(mm##3, mm##7, mm##1)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1180 MMABS_SUM(mm##4, mm##6, mm##0)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1181 MMABS_SUM(mm##5, mm##7, mm##1)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1182
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1183 #define DCT_SAD_MMX\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1184 "pxor %%mm0, %%mm0 \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1185 "pxor %%mm1, %%mm1 \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1186 DCT_SAD4(q, %%mm, 0)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1187 DCT_SAD4(q, %%mm, 8)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1188 DCT_SAD4(q, %%mm, 64)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1189 DCT_SAD4(q, %%mm, 72)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1190 "paddusw %%mm1, %%mm0 \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1191 HSUM(%%mm0, %%mm1, %0)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1192
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1193 #define DCT_SAD_SSE2\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1194 "pxor %%xmm0, %%xmm0 \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1195 "pxor %%xmm1, %%xmm1 \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1196 DCT_SAD4(dqa, %%xmm, 0)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1197 DCT_SAD4(dqa, %%xmm, 64)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1198 "paddusw %%xmm1, %%xmm0 \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1199 HSUM(%%xmm0, %%xmm1, %0)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1200
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1201 #define DCT_SAD_FUNC(cpu) \
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1202 static int sum_abs_dctelem_##cpu(DCTELEM *block){\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1203 int sum;\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1204 asm volatile(\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1205 DCT_SAD\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1206 :"=r"(sum)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1207 :"r"(block)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1208 );\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1209 return sum&0xFFFF;\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1210 }
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1211
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1212 #define DCT_SAD DCT_SAD_MMX
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1213 #define HSUM(a,t,dst) HSUM_MMX(a,t,dst)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1214 #define MMABS(a,z) MMABS_MMX(a,z)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1215 DCT_SAD_FUNC(mmx)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1216 #undef MMABS
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1217 #undef HSUM
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1218
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1219 #define HSUM(a,t,dst) HSUM_MMX2(a,t,dst)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1220 #define MMABS(a,z) MMABS_MMX2(a,z)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1221 DCT_SAD_FUNC(mmx2)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1222 #undef HSUM
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1223 #undef DCT_SAD
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1224
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1225 #define DCT_SAD DCT_SAD_SSE2
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1226 #define HSUM(a,t,dst) HSUM_SSE2(a,t,dst)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1227 DCT_SAD_FUNC(sse2)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1228 #undef MMABS
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1229
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1230 #ifdef HAVE_SSSE3
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1231 #define MMABS(a,z) MMABS_SSSE3(a,z)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1232 DCT_SAD_FUNC(ssse3)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1233 #undef MMABS
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1234 #endif
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1235 #undef HSUM
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1236 #undef DCT_SAD
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1237
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1238 static int ssd_int8_vs_int16_mmx(const int8_t *pix1, const int16_t *pix2, int size){
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1239 int sum;
6755
33896780c612 Do not misuse long as the size of a register in x86.
ramiro
parents: 6403
diff changeset
1240 x86_reg i=size;
6403
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1241 asm volatile(
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1242 "pxor %%mm4, %%mm4 \n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1243 "1: \n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1244 "sub $8, %0 \n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1245 "movq (%2,%0), %%mm2 \n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1246 "movq (%3,%0,2), %%mm0 \n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1247 "movq 8(%3,%0,2), %%mm1 \n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1248 "punpckhbw %%mm2, %%mm3 \n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1249 "punpcklbw %%mm2, %%mm2 \n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1250 "psraw $8, %%mm3 \n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1251 "psraw $8, %%mm2 \n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1252 "psubw %%mm3, %%mm1 \n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1253 "psubw %%mm2, %%mm0 \n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1254 "pmaddwd %%mm1, %%mm1 \n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1255 "pmaddwd %%mm0, %%mm0 \n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1256 "paddd %%mm1, %%mm4 \n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1257 "paddd %%mm0, %%mm4 \n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1258 "jg 1b \n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1259 "movq %%mm4, %%mm3 \n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1260 "psrlq $32, %%mm3 \n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1261 "paddd %%mm3, %%mm4 \n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1262 "movd %%mm4, %1 \n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1263 :"+r"(i), "=r"(sum)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1264 :"r"(pix1), "r"(pix2)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1265 );
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1266 return sum;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1267 }
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1268
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1269 #define PHADDD(a, t)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1270 "movq "#a", "#t" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1271 "psrlq $32, "#a" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1272 "paddd "#t", "#a" \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1273 /*
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1274 pmulhw: dst[0-15]=(src[0-15]*dst[0-15])[16-31]
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1275 pmulhrw: dst[0-15]=(src[0-15]*dst[0-15] + 0x8000)[16-31]
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1276 pmulhrsw: dst[0-15]=(src[0-15]*dst[0-15] + 0x4000)[15-30]
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1277 */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1278 #define PMULHRW(x, y, s, o)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1279 "pmulhw " #s ", "#x " \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1280 "pmulhw " #s ", "#y " \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1281 "paddw " #o ", "#x " \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1282 "paddw " #o ", "#y " \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1283 "psraw $1, "#x " \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1284 "psraw $1, "#y " \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1285 #define DEF(x) x ## _mmx
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1286 #define SET_RND MOVQ_WONE
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1287 #define SCALE_OFFSET 1
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1288
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1289 #include "dsputil_mmx_qns.h"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1290
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1291 #undef DEF
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1292 #undef SET_RND
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1293 #undef SCALE_OFFSET
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1294 #undef PMULHRW
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1295
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1296 #define DEF(x) x ## _3dnow
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1297 #define SET_RND(x)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1298 #define SCALE_OFFSET 0
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1299 #define PMULHRW(x, y, s, o)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1300 "pmulhrw " #s ", "#x " \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1301 "pmulhrw " #s ", "#y " \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1302
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1303 #include "dsputil_mmx_qns.h"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1304
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1305 #undef DEF
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1306 #undef SET_RND
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1307 #undef SCALE_OFFSET
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1308 #undef PMULHRW
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1309
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1310 #ifdef HAVE_SSSE3
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1311 #undef PHADDD
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1312 #define DEF(x) x ## _ssse3
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1313 #define SET_RND(x)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1314 #define SCALE_OFFSET -1
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1315 #define PHADDD(a, t)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1316 "pshufw $0x0E, "#a", "#t" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1317 "paddd "#t", "#a" \n\t" /* faster than phaddd on core2 */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1318 #define PMULHRW(x, y, s, o)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1319 "pmulhrsw " #s ", "#x " \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1320 "pmulhrsw " #s ", "#y " \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1321
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1322 #include "dsputil_mmx_qns.h"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1323
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1324 #undef DEF
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1325 #undef SET_RND
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1326 #undef SCALE_OFFSET
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1327 #undef PMULHRW
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1328 #undef PHADDD
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1329 #endif //HAVE_SSSE3
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1330
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1331
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1332 /* FLAC specific */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1333 void ff_flac_compute_autocorr_sse2(const int32_t *data, int len, int lag,
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1334 double *autoc);
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1335
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1336
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1337 void dsputilenc_init_mmx(DSPContext* c, AVCodecContext *avctx)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1338 {
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1339 if (mm_flags & MM_MMX) {
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1340 const int dct_algo = avctx->dct_algo;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1341 if(dct_algo==FF_DCT_AUTO || dct_algo==FF_DCT_MMX){
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1342 if(mm_flags & MM_SSE2){
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1343 c->fdct = ff_fdct_sse2;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1344 }else if(mm_flags & MM_MMXEXT){
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1345 c->fdct = ff_fdct_mmx2;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1346 }else{
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1347 c->fdct = ff_fdct_mmx;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1348 }
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1349 }
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1350
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1351 c->get_pixels = get_pixels_mmx;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1352 c->diff_pixels = diff_pixels_mmx;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1353 c->pix_sum = pix_sum16_mmx;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1354
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1355 c->diff_bytes= diff_bytes_mmx;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1356 c->sum_abs_dctelem= sum_abs_dctelem_mmx;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1357
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1358 c->hadamard8_diff[0]= hadamard8_diff16_mmx;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1359 c->hadamard8_diff[1]= hadamard8_diff_mmx;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1360
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1361 c->pix_norm1 = pix_norm1_mmx;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1362 c->sse[0] = (mm_flags & MM_SSE2) ? sse16_sse2 : sse16_mmx;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1363 c->sse[1] = sse8_mmx;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1364 c->vsad[4]= vsad_intra16_mmx;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1365
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1366 c->nsse[0] = nsse16_mmx;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1367 c->nsse[1] = nsse8_mmx;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1368 if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1369 c->vsad[0] = vsad16_mmx;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1370 }
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1371
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1372 if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1373 c->try_8x8basis= try_8x8basis_mmx;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1374 }
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1375 c->add_8x8basis= add_8x8basis_mmx;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1376
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1377 c->ssd_int8_vs_int16 = ssd_int8_vs_int16_mmx;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1378
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1379
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1380 if (mm_flags & MM_MMXEXT) {
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1381 c->sum_abs_dctelem= sum_abs_dctelem_mmx2;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1382 c->hadamard8_diff[0]= hadamard8_diff16_mmx2;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1383 c->hadamard8_diff[1]= hadamard8_diff_mmx2;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1384 c->vsad[4]= vsad_intra16_mmx2;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1385
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1386 if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1387 c->vsad[0] = vsad16_mmx2;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1388 }
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1389
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1390 c->sub_hfyu_median_prediction= sub_hfyu_median_prediction_mmx2;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1391 }
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1392
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1393 if(mm_flags & MM_SSE2){
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1394 c->sum_abs_dctelem= sum_abs_dctelem_sse2;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1395 c->hadamard8_diff[0]= hadamard8_diff16_sse2;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1396 c->hadamard8_diff[1]= hadamard8_diff_sse2;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1397 if (ENABLE_FLAC_ENCODER)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1398 c->flac_compute_autocorr = ff_flac_compute_autocorr_sse2;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1399 }
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1400
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1401 #ifdef HAVE_SSSE3
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1402 if(mm_flags & MM_SSSE3){
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1403 if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1404 c->try_8x8basis= try_8x8basis_ssse3;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1405 }
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1406 c->add_8x8basis= add_8x8basis_ssse3;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1407 c->sum_abs_dctelem= sum_abs_dctelem_ssse3;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1408 c->hadamard8_diff[0]= hadamard8_diff16_ssse3;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1409 c->hadamard8_diff[1]= hadamard8_diff_ssse3;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1410 }
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1411 #endif
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1412
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1413 if(mm_flags & MM_3DNOW){
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1414 if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1415 c->try_8x8basis= try_8x8basis_3dnow;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1416 }
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1417 c->add_8x8basis= add_8x8basis_3dnow;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1418 }
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1419 }
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1420
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1421 dsputil_init_pix_mmx(c, avctx);
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1422 }