annotate i386/dsputilenc_mmx.c @ 7974:2b20ad98e424 libavcodec

Rename copy_picture to ff_copy_picture.
author cehoyos
date Thu, 02 Oct 2008 00:27:09 +0000
parents a94b2cf78a2e
children cecd3150f82b
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"
6822
5dc77fe205ac Simplify vsad_intra16_mmx()
michael
parents: 6763
diff changeset
649 "jmp 2f\n"
6403
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
650 "1:\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
651
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
652 SUM(%%mm4, %%mm5, %%mm0, %%mm1)
6822
5dc77fe205ac Simplify vsad_intra16_mmx()
michael
parents: 6763
diff changeset
653 "2:\n"
6403
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
654 SUM(%%mm0, %%mm1, %%mm4, %%mm5)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
655
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
656 "subl $2, %%ecx\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
657 "jnz 1b\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
658
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
659 "movq %%mm6,%%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
660 "psrlq $32, %%mm6\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
661 "paddw %%mm6,%%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
662 "movq %%mm0,%%mm6\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
663 "psrlq $16, %%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
664 "paddw %%mm6,%%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
665 "movd %%mm0,%1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
666 : "+r" (pix), "=r"(tmp)
6755
33896780c612 Do not misuse long as the size of a register in x86.
ramiro
parents: 6403
diff changeset
667 : "r" ((x86_reg)line_size) , "m" (h)
6403
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
668 : "%ecx");
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
669 return tmp & 0xFFFF;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
670 }
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
671 #undef SUM
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
672
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
673 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
674 int tmp;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
675
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
676 assert( (((int)pix) & 7) == 0);
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
677 assert((line_size &7) ==0);
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
678
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
679 #define SUM(in0, in1, out0, out1) \
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
680 "movq (%0), " #out0 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
681 "movq 8(%0), " #out1 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
682 "add %2,%0\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
683 "psadbw " #out0 ", " #in0 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
684 "psadbw " #out1 ", " #in1 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
685 "paddw " #in1 ", " #in0 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
686 "paddw " #in0 ", %%mm6\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
687
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
688 asm volatile (
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
689 "movl %3,%%ecx\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
690 "pxor %%mm6,%%mm6\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
691 "pxor %%mm7,%%mm7\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
692 "movq (%0),%%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
693 "movq 8(%0),%%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
694 "add %2,%0\n"
6823
4a05527f5856 Simplify vsad_intra16_mmx2()
michael
parents: 6822
diff changeset
695 "jmp 2f\n"
6403
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
696 "1:\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
697
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
698 SUM(%%mm4, %%mm5, %%mm0, %%mm1)
6823
4a05527f5856 Simplify vsad_intra16_mmx2()
michael
parents: 6822
diff changeset
699 "2:\n"
6403
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
700 SUM(%%mm0, %%mm1, %%mm4, %%mm5)
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 "subl $2, %%ecx\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
703 "jnz 1b\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
704
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
705 "movd %%mm6,%1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
706 : "+r" (pix), "=r"(tmp)
6755
33896780c612 Do not misuse long as the size of a register in x86.
ramiro
parents: 6403
diff changeset
707 : "r" ((x86_reg)line_size) , "m" (h)
6403
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
708 : "%ecx");
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
709 return tmp;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
710 }
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
711 #undef SUM
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 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
714 int tmp;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
715
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
716 assert( (((int)pix1) & 7) == 0);
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
717 assert( (((int)pix2) & 7) == 0);
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
718 assert((line_size &7) ==0);
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
719
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
720 #define SUM(in0, in1, out0, out1) \
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
721 "movq (%0),%%mm2\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
722 "movq (%1)," #out0 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
723 "movq 8(%0),%%mm3\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
724 "movq 8(%1)," #out1 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
725 "add %3,%0\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
726 "add %3,%1\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
727 "psubb " #out0 ", %%mm2\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
728 "psubb " #out1 ", %%mm3\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
729 "pxor %%mm7, %%mm2\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
730 "pxor %%mm7, %%mm3\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
731 "movq %%mm2, " #out0 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
732 "movq %%mm3, " #out1 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
733 "psubusb " #in0 ", %%mm2\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
734 "psubusb " #in1 ", %%mm3\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
735 "psubusb " #out0 ", " #in0 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
736 "psubusb " #out1 ", " #in1 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
737 "por %%mm2, " #in0 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
738 "por %%mm3, " #in1 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
739 "movq " #in0 ", %%mm2\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
740 "movq " #in1 ", %%mm3\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
741 "punpcklbw %%mm7, " #in0 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
742 "punpcklbw %%mm7, " #in1 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
743 "punpckhbw %%mm7, %%mm2\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
744 "punpckhbw %%mm7, %%mm3\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
745 "paddw " #in1 ", " #in0 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
746 "paddw %%mm3, %%mm2\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
747 "paddw %%mm2, " #in0 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
748 "paddw " #in0 ", %%mm6\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
749
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
750
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
751 asm volatile (
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
752 "movl %4,%%ecx\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
753 "pxor %%mm6,%%mm6\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
754 "pcmpeqw %%mm7,%%mm7\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
755 "psllw $15, %%mm7\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
756 "packsswb %%mm7, %%mm7\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
757 "movq (%0),%%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
758 "movq (%1),%%mm2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
759 "movq 8(%0),%%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
760 "movq 8(%1),%%mm3\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
761 "add %3,%0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
762 "add %3,%1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
763 "psubb %%mm2, %%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
764 "psubb %%mm3, %%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
765 "pxor %%mm7, %%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
766 "pxor %%mm7, %%mm1\n"
6825
000f873d0220 Simplify vsad16_mmx().
michael
parents: 6823
diff changeset
767 "jmp 2f\n"
6403
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
768 "1:\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
769
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
770 SUM(%%mm4, %%mm5, %%mm0, %%mm1)
6825
000f873d0220 Simplify vsad16_mmx().
michael
parents: 6823
diff changeset
771 "2:\n"
6403
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
772 SUM(%%mm0, %%mm1, %%mm4, %%mm5)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
773
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
774 "subl $2, %%ecx\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
775 "jnz 1b\n"
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 "movq %%mm6,%%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
778 "psrlq $32, %%mm6\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
779 "paddw %%mm6,%%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
780 "movq %%mm0,%%mm6\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
781 "psrlq $16, %%mm0\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 "movd %%mm0,%2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
784 : "+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
785 : "r" ((x86_reg)line_size) , "m" (h)
6403
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
786 : "%ecx");
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
787 return tmp & 0x7FFF;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
788 }
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
789 #undef SUM
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
790
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
791 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
792 int tmp;
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 assert( (((int)pix1) & 7) == 0);
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
795 assert( (((int)pix2) & 7) == 0);
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
796 assert((line_size &7) ==0);
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
797
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
798 #define SUM(in0, in1, out0, out1) \
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
799 "movq (%0)," #out0 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
800 "movq (%1),%%mm2\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
801 "movq 8(%0)," #out1 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
802 "movq 8(%1),%%mm3\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
803 "add %3,%0\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
804 "add %3,%1\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
805 "psubb %%mm2, " #out0 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
806 "psubb %%mm3, " #out1 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
807 "pxor %%mm7, " #out0 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
808 "pxor %%mm7, " #out1 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
809 "psadbw " #out0 ", " #in0 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
810 "psadbw " #out1 ", " #in1 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
811 "paddw " #in1 ", " #in0 "\n"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
812 "paddw " #in0 ", %%mm6\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
813
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
814 asm volatile (
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
815 "movl %4,%%ecx\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
816 "pxor %%mm6,%%mm6\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
817 "pcmpeqw %%mm7,%%mm7\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
818 "psllw $15, %%mm7\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
819 "packsswb %%mm7, %%mm7\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
820 "movq (%0),%%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
821 "movq (%1),%%mm2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
822 "movq 8(%0),%%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
823 "movq 8(%1),%%mm3\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
824 "add %3,%0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
825 "add %3,%1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
826 "psubb %%mm2, %%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
827 "psubb %%mm3, %%mm1\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
828 "pxor %%mm7, %%mm0\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
829 "pxor %%mm7, %%mm1\n"
6827
51c80db5905c Simplify vsad16_mmx2().
michael
parents: 6825
diff changeset
830 "jmp 2f\n"
6403
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
831 "1:\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
832
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
833 SUM(%%mm4, %%mm5, %%mm0, %%mm1)
6827
51c80db5905c Simplify vsad16_mmx2().
michael
parents: 6825
diff changeset
834 "2:\n"
6403
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
835 SUM(%%mm0, %%mm1, %%mm4, %%mm5)
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 "subl $2, %%ecx\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
838 "jnz 1b\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
839
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
840 "movd %%mm6,%2\n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
841 : "+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
842 : "r" ((x86_reg)line_size) , "m" (h)
6403
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
843 : "%ecx");
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
844 return tmp;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
845 }
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
846 #undef SUM
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
847
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
848 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
849 x86_reg i=0;
6403
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
850 asm volatile(
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
851 "1: \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
852 "movq (%2, %0), %%mm0 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
853 "movq (%1, %0), %%mm1 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
854 "psubb %%mm0, %%mm1 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
855 "movq %%mm1, (%3, %0) \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
856 "movq 8(%2, %0), %%mm0 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
857 "movq 8(%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, 8(%3, %0) \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
860 "add $16, %0 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
861 "cmp %4, %0 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
862 " jb 1b \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
863 : "+r" (i)
6755
33896780c612 Do not misuse long as the size of a register in x86.
ramiro
parents: 6403
diff changeset
864 : "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
865 );
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
866 for(; i<w; i++)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
867 dst[i+0] = src1[i+0]-src2[i+0];
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
868 }
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 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
871 x86_reg i=0;
6403
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
872 uint8_t l, lt;
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 asm volatile(
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
875 "1: \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
876 "movq -1(%1, %0), %%mm0 \n\t" // LT
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
877 "movq (%1, %0), %%mm1 \n\t" // T
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
878 "movq -1(%2, %0), %%mm2 \n\t" // L
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
879 "movq (%2, %0), %%mm3 \n\t" // X
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
880 "movq %%mm2, %%mm4 \n\t" // L
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
881 "psubb %%mm0, %%mm2 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
882 "paddb %%mm1, %%mm2 \n\t" // L + T - LT
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
883 "movq %%mm4, %%mm5 \n\t" // L
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
884 "pmaxub %%mm1, %%mm4 \n\t" // max(T, L)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
885 "pminub %%mm5, %%mm1 \n\t" // min(T, L)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
886 "pminub %%mm2, %%mm4 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
887 "pmaxub %%mm1, %%mm4 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
888 "psubb %%mm4, %%mm3 \n\t" // dst - pred
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
889 "movq %%mm3, (%3, %0) \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
890 "add $8, %0 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
891 "cmp %4, %0 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
892 " jb 1b \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
893 : "+r" (i)
6755
33896780c612 Do not misuse long as the size of a register in x86.
ramiro
parents: 6403
diff changeset
894 : "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
895 );
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
896
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
897 l= *left;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
898 lt= *left_top;
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 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
901
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
902 *left_top= src1[w-1];
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
903 *left = src2[w-1];
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
904 }
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 #define DIFF_PIXELS_1(m,a,t,p1,p2)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
907 "mov"#m" "#p1", "#a" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
908 "mov"#m" "#p2", "#t" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
909 "punpcklbw "#a", "#t" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
910 "punpcklbw "#a", "#a" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
911 "psubw "#t", "#a" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
912
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
913 #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
914 uint8_t *p1b=p1, *p2b=p2;\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
915 asm volatile(\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
916 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
917 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
918 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
919 "add %4, %1 \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
920 "add %4, %2 \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
921 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
922 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
923 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
924 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
925 "mov"#m1" "#mm"0, %0 \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
926 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
927 "mov"#m1" %0, "#mm"0 \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
928 : "+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
929 : "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
930 );\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
931 }
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
932 //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
933
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
934 #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
935 #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
936
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
937 #define LBUTTERFLY2(a1,b1,a2,b2)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
938 "paddw " #b1 ", " #a1 " \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
939 "paddw " #b2 ", " #a2 " \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
940 "paddw " #b1 ", " #b1 " \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
941 "paddw " #b2 ", " #b2 " \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
942 "psubw " #a1 ", " #b1 " \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
943 "psubw " #a2 ", " #b2 " \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
944
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
945 #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
946 LBUTTERFLY2(m0, m1, m2, m3)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
947 LBUTTERFLY2(m4, m5, m6, m7)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
948 LBUTTERFLY2(m0, m2, m1, m3)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
949 LBUTTERFLY2(m4, m6, m5, m7)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
950 LBUTTERFLY2(m0, m4, m1, m5)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
951 LBUTTERFLY2(m2, m6, m3, m7)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
952
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
953 #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
954
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
955 #define MMABS_MMX(a,z)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
956 "pxor " #z ", " #z " \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
957 "pcmpgtw " #a ", " #z " \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
958 "pxor " #z ", " #a " \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
959 "psubw " #z ", " #a " \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
960
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
961 #define MMABS_MMX2(a,z)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
962 "pxor " #z ", " #z " \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
963 "psubw " #a ", " #z " \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
964 "pmaxsw " #z ", " #a " \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
965
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
966 #define MMABS_SSSE3(a,z)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
967 "pabsw " #a ", " #a " \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
968
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
969 #define MMABS_SUM(a,z, sum)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
970 MMABS(a,z)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
971 "paddusw " #a ", " #sum " \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_8x8_NOSPILL\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
974 MMABS(%%xmm0, %%xmm8)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
975 MMABS(%%xmm1, %%xmm9)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
976 MMABS_SUM(%%xmm2, %%xmm8, %%xmm0)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
977 MMABS_SUM(%%xmm3, %%xmm9, %%xmm1)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
978 MMABS_SUM(%%xmm4, %%xmm8, %%xmm0)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
979 MMABS_SUM(%%xmm5, %%xmm9, %%xmm1)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
980 MMABS_SUM(%%xmm6, %%xmm8, %%xmm0)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
981 MMABS_SUM(%%xmm7, %%xmm9, %%xmm1)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
982 "paddusw %%xmm1, %%xmm0 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
983
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
984 #ifdef ARCH_X86_64
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
985 #define MMABS_SUM_8x8_SSE2 MMABS_SUM_8x8_NOSPILL
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
986 #else
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
987 #define MMABS_SUM_8x8_SSE2\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
988 "movdqa %%xmm7, (%1) \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
989 MMABS(%%xmm0, %%xmm7)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
990 MMABS(%%xmm1, %%xmm7)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
991 MMABS_SUM(%%xmm2, %%xmm7, %%xmm0)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
992 MMABS_SUM(%%xmm3, %%xmm7, %%xmm1)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
993 MMABS_SUM(%%xmm4, %%xmm7, %%xmm0)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
994 MMABS_SUM(%%xmm5, %%xmm7, %%xmm1)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
995 MMABS_SUM(%%xmm6, %%xmm7, %%xmm0)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
996 "movdqa (%1), %%xmm2 \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
997 MMABS_SUM(%%xmm2, %%xmm7, %%xmm1)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
998 "paddusw %%xmm1, %%xmm0 \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
999 #endif
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1000
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1001 /* 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
1002 * 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
1003 * 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
1004 #define HSUM_MMX(a, t, dst)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1005 "movq "#a", "#t" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1006 "psrlq $32, "#a" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1007 "paddusw "#t", "#a" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1008 "movq "#a", "#t" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1009 "psrlq $16, "#a" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1010 "paddusw "#t", "#a" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1011 "movd "#a", "#dst" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1012
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1013 #define HSUM_MMX2(a, t, dst)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1014 "pshufw $0x0E, "#a", "#t" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1015 "paddusw "#t", "#a" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1016 "pshufw $0x01, "#a", "#t" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1017 "paddusw "#t", "#a" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1018 "movd "#a", "#dst" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1019
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1020 #define HSUM_SSE2(a, t, dst)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1021 "movhlps "#a", "#t" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1022 "paddusw "#t", "#a" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1023 "pshuflw $0x0E, "#a", "#t" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1024 "paddusw "#t", "#a" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1025 "pshuflw $0x01, "#a", "#t" \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 HADAMARD8_DIFF_MMX(cpu) \
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1030 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
1031 DECLARE_ALIGNED_8(uint64_t, temp[13]);\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1032 int sum;\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1033 \
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1034 assert(h==8);\
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 DIFF_PIXELS_4x8(src1, src2, stride, temp[0]);\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1037 \
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1038 asm volatile(\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1039 HADAMARD48\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1040 \
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1041 "movq %%mm7, 96(%1) \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1042 \
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1043 TRANSPOSE4(%%mm0, %%mm1, %%mm2, %%mm3, %%mm7)\
7220
a94b2cf78a2e Make LOAD4/STORE4 macros more generic.
benoit
parents: 6827
diff changeset
1044 STORE4(8, 0(%1), %%mm0, %%mm3, %%mm7, %%mm2)\
6403
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1045 \
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1046 "movq 96(%1), %%mm7 \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1047 TRANSPOSE4(%%mm4, %%mm5, %%mm6, %%mm7, %%mm0)\
7220
a94b2cf78a2e Make LOAD4/STORE4 macros more generic.
benoit
parents: 6827
diff changeset
1048 STORE4(8, 64(%1), %%mm4, %%mm7, %%mm0, %%mm6)\
6403
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 : "=r" (sum)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1051 : "r"(temp)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1052 );\
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 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
1055 \
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1056 asm volatile(\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1057 HADAMARD48\
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 "movq %%mm7, 96(%1) \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1060 \
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1061 TRANSPOSE4(%%mm0, %%mm1, %%mm2, %%mm3, %%mm7)\
7220
a94b2cf78a2e Make LOAD4/STORE4 macros more generic.
benoit
parents: 6827
diff changeset
1062 STORE4(8, 32(%1), %%mm0, %%mm3, %%mm7, %%mm2)\
6403
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1063 \
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1064 "movq 96(%1), %%mm7 \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1065 TRANSPOSE4(%%mm4, %%mm5, %%mm6, %%mm7, %%mm0)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1066 "movq %%mm7, %%mm5 \n\t"/*FIXME remove*/\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1067 "movq %%mm6, %%mm7 \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1068 "movq %%mm0, %%mm6 \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1069 \
7220
a94b2cf78a2e Make LOAD4/STORE4 macros more generic.
benoit
parents: 6827
diff changeset
1070 LOAD4(8, 64(%1), %%mm0, %%mm1, %%mm2, %%mm3)\
6403
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 HADAMARD48\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1073 "movq %%mm7, 64(%1) \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1074 MMABS(%%mm0, %%mm7)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1075 MMABS(%%mm1, %%mm7)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1076 MMABS_SUM(%%mm2, %%mm7, %%mm0)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1077 MMABS_SUM(%%mm3, %%mm7, %%mm1)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1078 MMABS_SUM(%%mm4, %%mm7, %%mm0)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1079 MMABS_SUM(%%mm5, %%mm7, %%mm1)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1080 MMABS_SUM(%%mm6, %%mm7, %%mm0)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1081 "movq 64(%1), %%mm2 \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1082 MMABS_SUM(%%mm2, %%mm7, %%mm1)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1083 "paddusw %%mm1, %%mm0 \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1084 "movq %%mm0, 64(%1) \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1085 \
7220
a94b2cf78a2e Make LOAD4/STORE4 macros more generic.
benoit
parents: 6827
diff changeset
1086 LOAD4(8, 0(%1), %%mm0, %%mm1, %%mm2, %%mm3)\
a94b2cf78a2e Make LOAD4/STORE4 macros more generic.
benoit
parents: 6827
diff changeset
1087 LOAD4(8, 32(%1), %%mm4, %%mm5, %%mm6, %%mm7)\
6403
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1088 \
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1089 HADAMARD48\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1090 "movq %%mm7, (%1) \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1091 MMABS(%%mm0, %%mm7)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1092 MMABS(%%mm1, %%mm7)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1093 MMABS_SUM(%%mm2, %%mm7, %%mm0)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1094 MMABS_SUM(%%mm3, %%mm7, %%mm1)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1095 MMABS_SUM(%%mm4, %%mm7, %%mm0)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1096 MMABS_SUM(%%mm5, %%mm7, %%mm1)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1097 MMABS_SUM(%%mm6, %%mm7, %%mm0)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1098 "movq (%1), %%mm2 \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1099 MMABS_SUM(%%mm2, %%mm7, %%mm1)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1100 "paddusw 64(%1), %%mm0 \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1101 "paddusw %%mm1, %%mm0 \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1102 \
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1103 HSUM(%%mm0, %%mm1, %0)\
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 : "=r" (sum)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1106 : "r"(temp)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1107 );\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1108 return sum&0xFFFF;\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1109 }\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1110 WRAPPER8_16_SQ(hadamard8_diff_##cpu, hadamard8_diff16_##cpu)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1111
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1112 #define HADAMARD8_DIFF_SSE2(cpu) \
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1113 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
1114 DECLARE_ALIGNED_16(uint64_t, temp[4]);\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1115 int sum;\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1116 \
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1117 assert(h==8);\
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 DIFF_PIXELS_8x8(src1, src2, stride, temp[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 asm volatile(\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1122 HADAMARD8(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm6, %%xmm7)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1123 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
1124 HADAMARD8(%%xmm0, %%xmm5, %%xmm7, %%xmm3, %%xmm6, %%xmm4, %%xmm2, %%xmm1)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1125 MMABS_SUM_8x8\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1126 HSUM_SSE2(%%xmm0, %%xmm1, %0)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1127 : "=r" (sum)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1128 : "r"(temp)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1129 );\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1130 return sum&0xFFFF;\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1131 }\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1132 WRAPPER8_16_SQ(hadamard8_diff_##cpu, hadamard8_diff16_##cpu)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1133
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1134 #define MMABS(a,z) MMABS_MMX(a,z)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1135 #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
1136 HADAMARD8_DIFF_MMX(mmx)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1137 #undef MMABS
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1138 #undef HSUM
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1139
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1140 #define MMABS(a,z) MMABS_MMX2(a,z)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1141 #define MMABS_SUM_8x8 MMABS_SUM_8x8_SSE2
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1142 #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
1143 HADAMARD8_DIFF_MMX(mmx2)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1144 HADAMARD8_DIFF_SSE2(sse2)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1145 #undef MMABS
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1146 #undef MMABS_SUM_8x8
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1147 #undef HSUM
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1148
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1149 #ifdef HAVE_SSSE3
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1150 #define MMABS(a,z) MMABS_SSSE3(a,z)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1151 #define MMABS_SUM_8x8 MMABS_SUM_8x8_NOSPILL
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1152 HADAMARD8_DIFF_SSE2(ssse3)
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 MMABS_SUM_8x8
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1155 #endif
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1156
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1157 #define DCT_SAD4(m,mm,o)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1158 "mov"#m" "#o"+ 0(%1), "#mm"2 \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1159 "mov"#m" "#o"+16(%1), "#mm"3 \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1160 "mov"#m" "#o"+32(%1), "#mm"4 \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1161 "mov"#m" "#o"+48(%1), "#mm"5 \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1162 MMABS_SUM(mm##2, mm##6, mm##0)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1163 MMABS_SUM(mm##3, mm##7, mm##1)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1164 MMABS_SUM(mm##4, mm##6, mm##0)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1165 MMABS_SUM(mm##5, mm##7, mm##1)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1166
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1167 #define DCT_SAD_MMX\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1168 "pxor %%mm0, %%mm0 \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1169 "pxor %%mm1, %%mm1 \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1170 DCT_SAD4(q, %%mm, 0)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1171 DCT_SAD4(q, %%mm, 8)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1172 DCT_SAD4(q, %%mm, 64)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1173 DCT_SAD4(q, %%mm, 72)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1174 "paddusw %%mm1, %%mm0 \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1175 HSUM(%%mm0, %%mm1, %0)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1176
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1177 #define DCT_SAD_SSE2\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1178 "pxor %%xmm0, %%xmm0 \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1179 "pxor %%xmm1, %%xmm1 \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1180 DCT_SAD4(dqa, %%xmm, 0)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1181 DCT_SAD4(dqa, %%xmm, 64)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1182 "paddusw %%xmm1, %%xmm0 \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1183 HSUM(%%xmm0, %%xmm1, %0)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1184
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1185 #define DCT_SAD_FUNC(cpu) \
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1186 static int sum_abs_dctelem_##cpu(DCTELEM *block){\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1187 int sum;\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1188 asm volatile(\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1189 DCT_SAD\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1190 :"=r"(sum)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1191 :"r"(block)\
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 return sum&0xFFFF;\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1194 }
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1195
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1196 #define DCT_SAD DCT_SAD_MMX
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1197 #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
1198 #define MMABS(a,z) MMABS_MMX(a,z)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1199 DCT_SAD_FUNC(mmx)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1200 #undef MMABS
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1201 #undef HSUM
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1202
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1203 #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
1204 #define MMABS(a,z) MMABS_MMX2(a,z)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1205 DCT_SAD_FUNC(mmx2)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1206 #undef HSUM
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1207 #undef DCT_SAD
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 #define DCT_SAD DCT_SAD_SSE2
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1210 #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
1211 DCT_SAD_FUNC(sse2)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1212 #undef MMABS
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1213
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1214 #ifdef HAVE_SSSE3
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1215 #define MMABS(a,z) MMABS_SSSE3(a,z)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1216 DCT_SAD_FUNC(ssse3)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1217 #undef MMABS
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1218 #endif
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1219 #undef HSUM
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1220 #undef DCT_SAD
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1221
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1222 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
1223 int sum;
6755
33896780c612 Do not misuse long as the size of a register in x86.
ramiro
parents: 6403
diff changeset
1224 x86_reg i=size;
6403
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1225 asm volatile(
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1226 "pxor %%mm4, %%mm4 \n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1227 "1: \n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1228 "sub $8, %0 \n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1229 "movq (%2,%0), %%mm2 \n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1230 "movq (%3,%0,2), %%mm0 \n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1231 "movq 8(%3,%0,2), %%mm1 \n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1232 "punpckhbw %%mm2, %%mm3 \n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1233 "punpcklbw %%mm2, %%mm2 \n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1234 "psraw $8, %%mm3 \n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1235 "psraw $8, %%mm2 \n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1236 "psubw %%mm3, %%mm1 \n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1237 "psubw %%mm2, %%mm0 \n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1238 "pmaddwd %%mm1, %%mm1 \n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1239 "pmaddwd %%mm0, %%mm0 \n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1240 "paddd %%mm1, %%mm4 \n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1241 "paddd %%mm0, %%mm4 \n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1242 "jg 1b \n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1243 "movq %%mm4, %%mm3 \n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1244 "psrlq $32, %%mm3 \n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1245 "paddd %%mm3, %%mm4 \n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1246 "movd %%mm4, %1 \n"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1247 :"+r"(i), "=r"(sum)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1248 :"r"(pix1), "r"(pix2)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1249 );
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1250 return sum;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1251 }
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1252
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1253 #define PHADDD(a, t)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1254 "movq "#a", "#t" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1255 "psrlq $32, "#a" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1256 "paddd "#t", "#a" \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1257 /*
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1258 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
1259 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
1260 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
1261 */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1262 #define PMULHRW(x, y, s, o)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1263 "pmulhw " #s ", "#x " \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1264 "pmulhw " #s ", "#y " \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1265 "paddw " #o ", "#x " \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1266 "paddw " #o ", "#y " \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1267 "psraw $1, "#x " \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1268 "psraw $1, "#y " \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1269 #define DEF(x) x ## _mmx
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1270 #define SET_RND MOVQ_WONE
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1271 #define SCALE_OFFSET 1
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1272
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1273 #include "dsputil_mmx_qns.h"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1274
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1275 #undef DEF
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1276 #undef SET_RND
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1277 #undef SCALE_OFFSET
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1278 #undef PMULHRW
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1279
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1280 #define DEF(x) x ## _3dnow
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1281 #define SET_RND(x)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1282 #define SCALE_OFFSET 0
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1283 #define PMULHRW(x, y, s, o)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1284 "pmulhrw " #s ", "#x " \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1285 "pmulhrw " #s ", "#y " \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1286
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1287 #include "dsputil_mmx_qns.h"
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 #undef DEF
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1290 #undef SET_RND
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1291 #undef SCALE_OFFSET
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1292 #undef PMULHRW
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1293
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1294 #ifdef HAVE_SSSE3
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1295 #undef PHADDD
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1296 #define DEF(x) x ## _ssse3
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 -1
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1299 #define PHADDD(a, t)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1300 "pshufw $0x0E, "#a", "#t" \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1301 "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
1302 #define PMULHRW(x, y, s, o)\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1303 "pmulhrsw " #s ", "#x " \n\t"\
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1304 "pmulhrsw " #s ", "#y " \n\t"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1305
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1306 #include "dsputil_mmx_qns.h"
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1307
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1308 #undef DEF
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1309 #undef SET_RND
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1310 #undef SCALE_OFFSET
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1311 #undef PMULHRW
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1312 #undef PHADDD
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1313 #endif //HAVE_SSSE3
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1314
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1315
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1316 /* FLAC specific */
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1317 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
1318 double *autoc);
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1319
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1320
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1321 void dsputilenc_init_mmx(DSPContext* c, AVCodecContext *avctx)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1322 {
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1323 if (mm_flags & MM_MMX) {
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1324 const int dct_algo = avctx->dct_algo;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1325 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
1326 if(mm_flags & MM_SSE2){
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1327 c->fdct = ff_fdct_sse2;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1328 }else if(mm_flags & MM_MMXEXT){
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1329 c->fdct = ff_fdct_mmx2;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1330 }else{
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1331 c->fdct = ff_fdct_mmx;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1332 }
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1333 }
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1334
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1335 c->get_pixels = get_pixels_mmx;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1336 c->diff_pixels = diff_pixels_mmx;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1337 c->pix_sum = pix_sum16_mmx;
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 c->diff_bytes= diff_bytes_mmx;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1340 c->sum_abs_dctelem= sum_abs_dctelem_mmx;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1341
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1342 c->hadamard8_diff[0]= hadamard8_diff16_mmx;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1343 c->hadamard8_diff[1]= hadamard8_diff_mmx;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1344
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1345 c->pix_norm1 = pix_norm1_mmx;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1346 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
1347 c->sse[1] = sse8_mmx;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1348 c->vsad[4]= vsad_intra16_mmx;
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 c->nsse[0] = nsse16_mmx;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1351 c->nsse[1] = nsse8_mmx;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1352 if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1353 c->vsad[0] = vsad16_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
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1356 if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1357 c->try_8x8basis= try_8x8basis_mmx;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1358 }
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1359 c->add_8x8basis= add_8x8basis_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->ssd_int8_vs_int16 = ssd_int8_vs_int16_mmx;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1362
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1363
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1364 if (mm_flags & MM_MMXEXT) {
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1365 c->sum_abs_dctelem= sum_abs_dctelem_mmx2;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1366 c->hadamard8_diff[0]= hadamard8_diff16_mmx2;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1367 c->hadamard8_diff[1]= hadamard8_diff_mmx2;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1368 c->vsad[4]= vsad_intra16_mmx2;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1369
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1370 if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1371 c->vsad[0] = vsad16_mmx2;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1372 }
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1373
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1374 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
1375 }
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 if(mm_flags & MM_SSE2){
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1378 c->sum_abs_dctelem= sum_abs_dctelem_sse2;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1379 c->hadamard8_diff[0]= hadamard8_diff16_sse2;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1380 c->hadamard8_diff[1]= hadamard8_diff_sse2;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1381 if (ENABLE_FLAC_ENCODER)
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1382 c->flac_compute_autocorr = ff_flac_compute_autocorr_sse2;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1383 }
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1384
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1385 #ifdef HAVE_SSSE3
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1386 if(mm_flags & MM_SSSE3){
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1387 if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1388 c->try_8x8basis= try_8x8basis_ssse3;
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->add_8x8basis= add_8x8basis_ssse3;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1391 c->sum_abs_dctelem= sum_abs_dctelem_ssse3;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1392 c->hadamard8_diff[0]= hadamard8_diff16_ssse3;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1393 c->hadamard8_diff[1]= hadamard8_diff_ssse3;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1394 }
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1395 #endif
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1396
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1397 if(mm_flags & MM_3DNOW){
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1398 if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1399 c->try_8x8basis= try_8x8basis_3dnow;
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 c->add_8x8basis= add_8x8basis_3dnow;
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1402 }
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1403 }
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1404
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1405 dsputil_init_pix_mmx(c, avctx);
9a736918fd90 split encoding part of dsputil_mmx into its own file
aurel
parents:
diff changeset
1406 }