annotate postprocess_template.c @ 90:8e738e0a16f5 libpostproc

typo fixes
author diego
date Sat, 15 Mar 2008 16:15:47 +0000
parents 47ff4bd209cd
children 8879eafb9431
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1 /*
22
da3bfee1fa67 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 0
diff changeset
2 * Copyright (C) 2001-2002 Michael Niedermayer (michaelni@gmx.at)
da3bfee1fa67 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 0
diff changeset
3 *
da3bfee1fa67 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 0
diff changeset
4 * This file is part of FFmpeg.
da3bfee1fa67 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 0
diff changeset
5 *
da3bfee1fa67 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 0
diff changeset
6 * FFmpeg is free software; you can redistribute it and/or modify
da3bfee1fa67 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 0
diff changeset
7 * it under the terms of the GNU General Public License as published by
da3bfee1fa67 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 0
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
da3bfee1fa67 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 0
diff changeset
9 * (at your option) any later version.
da3bfee1fa67 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 0
diff changeset
10 *
da3bfee1fa67 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 0
diff changeset
11 * FFmpeg is distributed in the hope that it will be useful,
da3bfee1fa67 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 0
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
da3bfee1fa67 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 0
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
da3bfee1fa67 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 0
diff changeset
14 * GNU General Public License for more details.
da3bfee1fa67 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 0
diff changeset
15 *
da3bfee1fa67 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 0
diff changeset
16 * You should have received a copy of the GNU General Public License
da3bfee1fa67 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 0
diff changeset
17 * along with FFmpeg; if not, write to the Free Software
da3bfee1fa67 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 0
diff changeset
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
55
95d9409452f2 license header consistency cosmetics
diego
parents: 49
diff changeset
19 */
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
20
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
21 /**
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
22 * @file postprocess_template.c
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
23 * mmx/mmx2/3dnow postprocess code.
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
24 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
25
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
26
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
27 #ifdef ARCH_X86_64
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
28 # define REGa rax
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
29 # define REGc rcx
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
30 # define REGd rdx
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
31 # define REG_a "rax"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
32 # define REG_c "rcx"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
33 # define REG_d "rdx"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
34 # define REG_SP "rsp"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
35 # define ALIGN_MASK "$0xFFFFFFFFFFFFFFF8"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
36 #else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
37 # define REGa eax
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
38 # define REGc ecx
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
39 # define REGd edx
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
40 # define REG_a "eax"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
41 # define REG_c "ecx"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
42 # define REG_d "edx"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
43 # define REG_SP "esp"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
44 # define ALIGN_MASK "$0xFFFFFFF8"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
45 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
46
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
47
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
48 #undef PAVGB
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
49 #undef PMINUB
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
50 #undef PMAXUB
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
51
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
52 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
53 #define REAL_PAVGB(a,b) "pavgb " #a ", " #b " \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
54 #elif defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
55 #define REAL_PAVGB(a,b) "pavgusb " #a ", " #b " \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
56 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
57 #define PAVGB(a,b) REAL_PAVGB(a,b)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
58
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
59 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
60 #define PMINUB(a,b,t) "pminub " #a ", " #b " \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
61 #elif defined (HAVE_MMX)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
62 #define PMINUB(b,a,t) \
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
63 "movq " #a ", " #t " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
64 "psubusb " #b ", " #t " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
65 "psubb " #t ", " #a " \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
66 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
67
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
68 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
69 #define PMAXUB(a,b) "pmaxub " #a ", " #b " \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
70 #elif defined (HAVE_MMX)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
71 #define PMAXUB(a,b) \
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
72 "psubusb " #a ", " #b " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
73 "paddb " #a ", " #b " \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
74 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
75
48
72675332ed82 misc spelling fixes
diego
parents: 45
diff changeset
76 //FIXME? |255-0| = 1 (should not be a problem ...)
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
77 #ifdef HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
78 /**
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
79 * Check if the middle 8x8 Block in the given 8x16 block is flat
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
80 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
81 static inline int RENAME(vertClassify)(uint8_t src[], int stride, PPContext *c){
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
82 int numEq= 0, dcOk;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
83 src+= stride*4; // src points to begin of the 8x8 Block
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
84 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
85 "movq %0, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
86 "movq %1, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
87 : : "m" (c->mmxDcOffset[c->nonBQP]), "m" (c->mmxDcThreshold[c->nonBQP])
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
88 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
89
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
90 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
91 "lea (%2, %3), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
92 // 0 1 2 3 4 5 6 7 8 9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
93 // %1 eax eax+%2 eax+2%2 %1+4%2 ecx ecx+%2 ecx+2%2 %1+8%2 ecx+4%2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
94
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
95 "movq (%2), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
96 "movq (%%"REG_a"), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
97 "movq %%mm0, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
98 "movq %%mm0, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
99 PMAXUB(%%mm1, %%mm4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
100 PMINUB(%%mm1, %%mm3, %%mm5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
101 "psubb %%mm1, %%mm0 \n\t" // mm0 = differnece
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
102 "paddb %%mm7, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
103 "pcmpgtb %%mm6, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
104
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
105 "movq (%%"REG_a",%3), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
106 PMAXUB(%%mm2, %%mm4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
107 PMINUB(%%mm2, %%mm3, %%mm5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
108 "psubb %%mm2, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
109 "paddb %%mm7, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
110 "pcmpgtb %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
111 "paddb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
112
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
113 "movq (%%"REG_a", %3, 2), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
114 PMAXUB(%%mm1, %%mm4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
115 PMINUB(%%mm1, %%mm3, %%mm5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
116 "psubb %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
117 "paddb %%mm7, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
118 "pcmpgtb %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
119 "paddb %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
120
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
121 "lea (%%"REG_a", %3, 4), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
122
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
123 "movq (%2, %3, 4), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
124 PMAXUB(%%mm2, %%mm4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
125 PMINUB(%%mm2, %%mm3, %%mm5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
126 "psubb %%mm2, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
127 "paddb %%mm7, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
128 "pcmpgtb %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
129 "paddb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
130
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
131 "movq (%%"REG_a"), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
132 PMAXUB(%%mm1, %%mm4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
133 PMINUB(%%mm1, %%mm3, %%mm5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
134 "psubb %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
135 "paddb %%mm7, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
136 "pcmpgtb %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
137 "paddb %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
138
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
139 "movq (%%"REG_a", %3), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
140 PMAXUB(%%mm2, %%mm4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
141 PMINUB(%%mm2, %%mm3, %%mm5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
142 "psubb %%mm2, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
143 "paddb %%mm7, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
144 "pcmpgtb %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
145 "paddb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
146
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
147 "movq (%%"REG_a", %3, 2), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
148 PMAXUB(%%mm1, %%mm4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
149 PMINUB(%%mm1, %%mm3, %%mm5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
150 "psubb %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
151 "paddb %%mm7, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
152 "pcmpgtb %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
153 "paddb %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
154 "psubusb %%mm3, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
155
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
156 " \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
157 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
158 "pxor %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
159 "psadbw %%mm7, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
160 #else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
161 "movq %%mm0, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
162 "psrlw $8, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
163 "paddb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
164 "movq %%mm0, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
165 "psrlq $16, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
166 "paddb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
167 "movq %%mm0, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
168 "psrlq $32, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
169 "paddb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
170 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
171 "movq %4, %%mm7 \n\t" // QP,..., QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
172 "paddusb %%mm7, %%mm7 \n\t" // 2QP ... 2QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
173 "psubusb %%mm7, %%mm4 \n\t" // Diff <= 2QP -> 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
174 "packssdw %%mm4, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
175 "movd %%mm0, %0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
176 "movd %%mm4, %1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
177
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
178 : "=r" (numEq), "=r" (dcOk)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
179 : "r" (src), "r" ((long)stride), "m" (c->pQPb)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
180 : "%"REG_a
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
181 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
182
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
183 numEq= (-numEq) &0xFF;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
184 if(numEq > c->ppMode.flatnessThreshold){
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
185 if(dcOk) return 0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
186 else return 1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
187 }else{
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
188 return 2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
189 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
190 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
191 #endif //HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
192
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
193 /**
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
194 * Do a vertical low pass filter on the 8x16 block (only write to the 8x8 block in the middle)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
195 * using the 9-Tap Filter (1,1,2,2,4,2,2,1,1)/16
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
196 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
197 #ifndef HAVE_ALTIVEC
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
198 static inline void RENAME(doVertLowPass)(uint8_t *src, int stride, PPContext *c)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
199 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
200 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
201 src+= stride*3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
202 asm volatile( //"movv %0 %1 %2\n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
203 "movq %2, %%mm0 \n\t" // QP,..., QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
204 "pxor %%mm4, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
205
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
206 "movq (%0), %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
207 "movq (%0, %1), %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
208 "movq %%mm5, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
209 "movq %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
210 "psubusb %%mm6, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
211 "psubusb %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
212 "por %%mm5, %%mm2 \n\t" // ABS Diff of lines
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
213 "psubusb %%mm0, %%mm2 \n\t" // diff <= QP -> 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
214 "pcmpeqb %%mm4, %%mm2 \n\t" // diff <= QP -> FF
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
215
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
216 "pand %%mm2, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
217 "pandn %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
218 "por %%mm2, %%mm6 \n\t"// First Line to Filter
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
219
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
220 "movq (%0, %1, 8), %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
221 "lea (%0, %1, 4), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
222 "lea (%0, %1, 8), %%"REG_c" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
223 "sub %1, %%"REG_c" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
224 "add %1, %0 \n\t" // %0 points to line 1 not 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
225 "movq (%0, %1, 8), %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
226 "movq %%mm5, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
227 "movq %%mm7, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
228 "psubusb %%mm7, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
229 "psubusb %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
230 "por %%mm5, %%mm2 \n\t" // ABS Diff of lines
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
231 "psubusb %%mm0, %%mm2 \n\t" // diff <= QP -> 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
232 "pcmpeqb %%mm4, %%mm2 \n\t" // diff <= QP -> FF
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
233
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
234 "pand %%mm2, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
235 "pandn %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
236 "por %%mm2, %%mm7 \n\t" // First Line to Filter
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
237
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
238
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
239 // 1 2 3 4 5 6 7 8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
240 // %0 %0+%1 %0+2%1 eax %0+4%1 eax+2%1 ecx eax+4%1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
241 // 6 4 2 2 1 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
242 // 6 4 4 2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
243 // 6 8 2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
244
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
245 "movq (%0, %1), %%mm0 \n\t" // 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
246 "movq %%mm0, %%mm1 \n\t" // 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
247 PAVGB(%%mm6, %%mm0) //1 1 /2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
248 PAVGB(%%mm6, %%mm0) //3 1 /4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
249
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
250 "movq (%0, %1, 4), %%mm2 \n\t" // 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
251 "movq %%mm2, %%mm5 \n\t" // 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
252 PAVGB((%%REGa), %%mm2) // 11 /2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
253 PAVGB((%0, %1, 2), %%mm2) // 211 /4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
254 "movq %%mm2, %%mm3 \n\t" // 211 /4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
255 "movq (%0), %%mm4 \n\t" // 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
256 PAVGB(%%mm4, %%mm3) // 4 211 /8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
257 PAVGB(%%mm0, %%mm3) //642211 /16
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
258 "movq %%mm3, (%0) \n\t" // X
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
259 // mm1=2 mm2=3(211) mm4=1 mm5=5 mm6=0 mm7=9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
260 "movq %%mm1, %%mm0 \n\t" // 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
261 PAVGB(%%mm6, %%mm0) //1 1 /2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
262 "movq %%mm4, %%mm3 \n\t" // 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
263 PAVGB((%0,%1,2), %%mm3) // 1 1 /2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
264 PAVGB((%%REGa,%1,2), %%mm5) // 11 /2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
265 PAVGB((%%REGa), %%mm5) // 211 /4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
266 PAVGB(%%mm5, %%mm3) // 2 2211 /8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
267 PAVGB(%%mm0, %%mm3) //4242211 /16
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
268 "movq %%mm3, (%0,%1) \n\t" // X
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
269 // mm1=2 mm2=3(211) mm4=1 mm5=4(211) mm6=0 mm7=9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
270 PAVGB(%%mm4, %%mm6) //11 /2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
271 "movq (%%"REG_c"), %%mm0 \n\t" // 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
272 PAVGB((%%REGa, %1, 2), %%mm0) // 11/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
273 "movq %%mm0, %%mm3 \n\t" // 11/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
274 PAVGB(%%mm1, %%mm0) // 2 11/4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
275 PAVGB(%%mm6, %%mm0) //222 11/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
276 PAVGB(%%mm2, %%mm0) //22242211/16
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
277 "movq (%0, %1, 2), %%mm2 \n\t" // 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
278 "movq %%mm0, (%0, %1, 2) \n\t" // X
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
279 // mm1=2 mm2=3 mm3=6(11) mm4=1 mm5=4(211) mm6=0(11) mm7=9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
280 "movq (%%"REG_a", %1, 4), %%mm0 \n\t" // 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
281 PAVGB((%%REGc), %%mm0) // 11 /2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
282 PAVGB(%%mm0, %%mm6) //11 11 /4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
283 PAVGB(%%mm1, %%mm4) // 11 /2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
284 PAVGB(%%mm2, %%mm1) // 11 /2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
285 PAVGB(%%mm1, %%mm6) //1122 11 /8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
286 PAVGB(%%mm5, %%mm6) //112242211 /16
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
287 "movq (%%"REG_a"), %%mm5 \n\t" // 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
288 "movq %%mm6, (%%"REG_a") \n\t" // X
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
289 // mm0=7(11) mm1=2(11) mm2=3 mm3=6(11) mm4=1(11) mm5=4 mm7=9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
290 "movq (%%"REG_a", %1, 4), %%mm6 \n\t" // 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
291 PAVGB(%%mm7, %%mm6) // 11 /2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
292 PAVGB(%%mm4, %%mm6) // 11 11 /4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
293 PAVGB(%%mm3, %%mm6) // 11 2211 /8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
294 PAVGB(%%mm5, %%mm2) // 11 /2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
295 "movq (%0, %1, 4), %%mm4 \n\t" // 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
296 PAVGB(%%mm4, %%mm2) // 112 /4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
297 PAVGB(%%mm2, %%mm6) // 112242211 /16
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
298 "movq %%mm6, (%0, %1, 4) \n\t" // X
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
299 // mm0=7(11) mm1=2(11) mm2=3(112) mm3=6(11) mm4=5 mm5=4 mm7=9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
300 PAVGB(%%mm7, %%mm1) // 11 2 /4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
301 PAVGB(%%mm4, %%mm5) // 11 /2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
302 PAVGB(%%mm5, %%mm0) // 11 11 /4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
303 "movq (%%"REG_a", %1, 2), %%mm6 \n\t" // 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
304 PAVGB(%%mm6, %%mm1) // 11 4 2 /8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
305 PAVGB(%%mm0, %%mm1) // 11224222 /16
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
306 "movq %%mm1, (%%"REG_a", %1, 2) \n\t" // X
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
307 // mm2=3(112) mm3=6(11) mm4=5 mm5=4(11) mm6=6 mm7=9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
308 PAVGB((%%REGc), %%mm2) // 112 4 /8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
309 "movq (%%"REG_a", %1, 4), %%mm0 \n\t" // 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
310 PAVGB(%%mm0, %%mm6) // 1 1 /2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
311 PAVGB(%%mm7, %%mm6) // 1 12 /4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
312 PAVGB(%%mm2, %%mm6) // 1122424 /4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
313 "movq %%mm6, (%%"REG_c") \n\t" // X
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
314 // mm0=8 mm3=6(11) mm4=5 mm5=4(11) mm7=9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
315 PAVGB(%%mm7, %%mm5) // 11 2 /4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
316 PAVGB(%%mm7, %%mm5) // 11 6 /8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
317
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
318 PAVGB(%%mm3, %%mm0) // 112 /4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
319 PAVGB(%%mm0, %%mm5) // 112246 /16
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
320 "movq %%mm5, (%%"REG_a", %1, 4) \n\t" // X
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
321 "sub %1, %0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
322
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
323 :
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
324 : "r" (src), "r" ((long)stride), "m" (c->pQPb)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
325 : "%"REG_a, "%"REG_c
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
326 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
327 #else //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
328 const int l1= stride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
329 const int l2= stride + l1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
330 const int l3= stride + l2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
331 const int l4= stride + l3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
332 const int l5= stride + l4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
333 const int l6= stride + l5;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
334 const int l7= stride + l6;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
335 const int l8= stride + l7;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
336 const int l9= stride + l8;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
337 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
338 src+= stride*3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
339 for(x=0; x<BLOCK_SIZE; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
340 {
32
cb746db3fd32 Rename ABS macro to FFABS.
diego
parents: 31
diff changeset
341 const int first= FFABS(src[0] - src[l1]) < c->QP ? src[0] : src[l1];
cb746db3fd32 Rename ABS macro to FFABS.
diego
parents: 31
diff changeset
342 const int last= FFABS(src[l8] - src[l9]) < c->QP ? src[l9] : src[l8];
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
343
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
344 int sums[10];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
345 sums[0] = 4*first + src[l1] + src[l2] + src[l3] + 4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
346 sums[1] = sums[0] - first + src[l4];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
347 sums[2] = sums[1] - first + src[l5];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
348 sums[3] = sums[2] - first + src[l6];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
349 sums[4] = sums[3] - first + src[l7];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
350 sums[5] = sums[4] - src[l1] + src[l8];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
351 sums[6] = sums[5] - src[l2] + last;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
352 sums[7] = sums[6] - src[l3] + last;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
353 sums[8] = sums[7] - src[l4] + last;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
354 sums[9] = sums[8] - src[l5] + last;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
355
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
356 src[l1]= (sums[0] + sums[2] + 2*src[l1])>>4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
357 src[l2]= (sums[1] + sums[3] + 2*src[l2])>>4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
358 src[l3]= (sums[2] + sums[4] + 2*src[l3])>>4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
359 src[l4]= (sums[3] + sums[5] + 2*src[l4])>>4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
360 src[l5]= (sums[4] + sums[6] + 2*src[l5])>>4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
361 src[l6]= (sums[5] + sums[7] + 2*src[l6])>>4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
362 src[l7]= (sums[6] + sums[8] + 2*src[l7])>>4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
363 src[l8]= (sums[7] + sums[9] + 2*src[l8])>>4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
364
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
365 src++;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
366 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
367 #endif //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
368 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
369 #endif //HAVE_ALTIVEC
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
370
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
371 #if 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
372 /**
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
373 * Experimental implementation of the filter (Algorithm 1) described in a paper from Ramkishor & Karandikar
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
374 * values are correctly clipped (MMX2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
375 * values are wraparound (C)
49
cdfe8fc50090 misc typo fixes
diego
parents: 48
diff changeset
376 * Conclusion: It is fast, but introduces ugly horizontal patterns
cdfe8fc50090 misc typo fixes
diego
parents: 48
diff changeset
377 * if there is a continuous gradient.
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
378 0 8 16 24
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
379 x = 8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
380 x/2 = 4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
381 x/8 = 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
382 1 12 12 23
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
383 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
384 static inline void RENAME(vertRK1Filter)(uint8_t *src, int stride, int QP)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
385 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
386 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
387 src+= stride*3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
388 // FIXME rounding
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
389 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
390 "pxor %%mm7, %%mm7 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
391 "movq "MANGLE(b80)", %%mm6 \n\t" // MIN_SIGNED_BYTE
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
392 "leal (%0, %1), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
393 "leal (%%"REG_a", %1, 4), %%"REG_c" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
394 // 0 1 2 3 4 5 6 7 8 9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
395 // %0 eax eax+%1 eax+2%1 %0+4%1 ecx ecx+%1 ecx+2%1 %0+8%1 ecx+4%1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
396 "movq "MANGLE(pQPb)", %%mm0 \n\t" // QP,..., QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
397 "movq %%mm0, %%mm1 \n\t" // QP,..., QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
398 "paddusb "MANGLE(b02)", %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
399 "psrlw $2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
400 "pand "MANGLE(b3F)", %%mm0 \n\t" // QP/4,..., QP/4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
401 "paddusb %%mm1, %%mm0 \n\t" // QP*1.25 ...
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
402 "movq (%0, %1, 4), %%mm2 \n\t" // line 4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
403 "movq (%%"REG_c"), %%mm3 \n\t" // line 5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
404 "movq %%mm2, %%mm4 \n\t" // line 4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
405 "pcmpeqb %%mm5, %%mm5 \n\t" // -1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
406 "pxor %%mm2, %%mm5 \n\t" // -line 4 - 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
407 PAVGB(%%mm3, %%mm5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
408 "paddb %%mm6, %%mm5 \n\t" // (l5-l4)/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
409 "psubusb %%mm3, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
410 "psubusb %%mm2, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
411 "por %%mm3, %%mm4 \n\t" // |l4 - l5|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
412 "psubusb %%mm0, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
413 "pcmpeqb %%mm7, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
414 "pand %%mm4, %%mm5 \n\t" // d/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
415
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
416 // "paddb %%mm6, %%mm2 \n\t" // line 4 + 0x80
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
417 "paddb %%mm5, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
418 // "psubb %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
419 "movq %%mm2, (%0,%1, 4) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
420
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
421 "movq (%%"REG_c"), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
422 // "paddb %%mm6, %%mm2 \n\t" // line 5 + 0x80
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
423 "psubb %%mm5, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
424 // "psubb %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
425 "movq %%mm2, (%%"REG_c") \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
426
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
427 "paddb %%mm6, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
428 "psrlw $2, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
429 "pand "MANGLE(b3F)", %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
430 "psubb "MANGLE(b20)", %%mm5 \n\t" // (l5-l4)/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
431
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
432 "movq (%%"REG_a", %1, 2), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
433 "paddb %%mm6, %%mm2 \n\t" // line 3 + 0x80
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
434 "paddsb %%mm5, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
435 "psubb %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
436 "movq %%mm2, (%%"REG_a", %1, 2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
437
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
438 "movq (%%"REG_c", %1), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
439 "paddb %%mm6, %%mm2 \n\t" // line 6 + 0x80
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
440 "psubsb %%mm5, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
441 "psubb %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
442 "movq %%mm2, (%%"REG_c", %1) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
443
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
444 :
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
445 : "r" (src), "r" ((long)stride)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
446 : "%"REG_a, "%"REG_c
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
447 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
448 #else //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
449 const int l1= stride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
450 const int l2= stride + l1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
451 const int l3= stride + l2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
452 const int l4= stride + l3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
453 const int l5= stride + l4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
454 const int l6= stride + l5;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
455 // const int l7= stride + l6;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
456 // const int l8= stride + l7;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
457 // const int l9= stride + l8;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
458 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
459 const int QP15= QP + (QP>>2);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
460 src+= stride*3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
461 for(x=0; x<BLOCK_SIZE; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
462 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
463 const int v = (src[x+l5] - src[x+l4]);
32
cb746db3fd32 Rename ABS macro to FFABS.
diego
parents: 31
diff changeset
464 if(FFABS(v) < QP15)
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
465 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
466 src[x+l3] +=v>>3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
467 src[x+l4] +=v>>1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
468 src[x+l5] -=v>>1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
469 src[x+l6] -=v>>3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
470
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
471 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
472 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
473
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
474 #endif //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
475 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
476 #endif //0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
477
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
478 /**
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
479 * Experimental Filter 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
480 * will not damage linear gradients
90
8e738e0a16f5 typo fixes
diego
parents: 78
diff changeset
481 * Flat blocks should look like they were passed through the (1,1,2,2,4,2,2,1,1) 9-Tap filter
48
72675332ed82 misc spelling fixes
diego
parents: 45
diff changeset
482 * can only smooth blocks at the expected locations (it cannot smooth them if they did move)
72675332ed82 misc spelling fixes
diego
parents: 45
diff changeset
483 * MMX2 version does correct clipping C version does not
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
484 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
485 static inline void RENAME(vertX1Filter)(uint8_t *src, int stride, PPContext *co)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
486 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
487 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
488 src+= stride*3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
489
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
490 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
491 "pxor %%mm7, %%mm7 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
492 "lea (%0, %1), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
493 "lea (%%"REG_a", %1, 4), %%"REG_c" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
494 // 0 1 2 3 4 5 6 7 8 9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
495 // %0 eax eax+%1 eax+2%1 %0+4%1 ecx ecx+%1 ecx+2%1 %0+8%1 ecx+4%1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
496 "movq (%%"REG_a", %1, 2), %%mm0 \n\t" // line 3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
497 "movq (%0, %1, 4), %%mm1 \n\t" // line 4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
498 "movq %%mm1, %%mm2 \n\t" // line 4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
499 "psubusb %%mm0, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
500 "psubusb %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
501 "por %%mm1, %%mm0 \n\t" // |l2 - l3|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
502 "movq (%%"REG_c"), %%mm3 \n\t" // line 5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
503 "movq (%%"REG_c", %1), %%mm4 \n\t" // line 6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
504 "movq %%mm3, %%mm5 \n\t" // line 5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
505 "psubusb %%mm4, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
506 "psubusb %%mm5, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
507 "por %%mm4, %%mm3 \n\t" // |l5 - l6|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
508 PAVGB(%%mm3, %%mm0) // (|l2 - l3| + |l5 - l6|)/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
509 "movq %%mm2, %%mm1 \n\t" // line 4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
510 "psubusb %%mm5, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
511 "movq %%mm2, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
512 "pcmpeqb %%mm7, %%mm2 \n\t" // (l4 - l5) <= 0 ? -1 : 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
513 "psubusb %%mm1, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
514 "por %%mm5, %%mm4 \n\t" // |l4 - l5|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
515 "psubusb %%mm0, %%mm4 \n\t" //d = MAX(0, |l4-l5| - (|l2-l3| + |l5-l6|)/2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
516 "movq %%mm4, %%mm3 \n\t" // d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
517 "movq %2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
518 "paddusb %%mm0, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
519 "psubusb %%mm0, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
520 "pcmpeqb %%mm7, %%mm4 \n\t" // d <= QP ? -1 : 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
521 "psubusb "MANGLE(b01)", %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
522 "pand %%mm4, %%mm3 \n\t" // d <= QP ? d : 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
523
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
524 PAVGB(%%mm7, %%mm3) // d/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
525 "movq %%mm3, %%mm1 \n\t" // d/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
526 PAVGB(%%mm7, %%mm3) // d/4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
527 PAVGB(%%mm1, %%mm3) // 3*d/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
528
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
529 "movq (%0, %1, 4), %%mm0 \n\t" // line 4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
530 "pxor %%mm2, %%mm0 \n\t" //(l4 - l5) <= 0 ? -l4-1 : l4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
531 "psubusb %%mm3, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
532 "pxor %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
533 "movq %%mm0, (%0, %1, 4) \n\t" // line 4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
534
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
535 "movq (%%"REG_c"), %%mm0 \n\t" // line 5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
536 "pxor %%mm2, %%mm0 \n\t" //(l4 - l5) <= 0 ? -l5-1 : l5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
537 "paddusb %%mm3, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
538 "pxor %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
539 "movq %%mm0, (%%"REG_c") \n\t" // line 5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
540
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
541 PAVGB(%%mm7, %%mm1) // d/4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
542
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
543 "movq (%%"REG_a", %1, 2), %%mm0 \n\t" // line 3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
544 "pxor %%mm2, %%mm0 \n\t" //(l4 - l5) <= 0 ? -l4-1 : l4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
545 "psubusb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
546 "pxor %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
547 "movq %%mm0, (%%"REG_a", %1, 2) \n\t" // line 3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
548
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
549 "movq (%%"REG_c", %1), %%mm0 \n\t" // line 6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
550 "pxor %%mm2, %%mm0 \n\t" //(l4 - l5) <= 0 ? -l5-1 : l5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
551 "paddusb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
552 "pxor %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
553 "movq %%mm0, (%%"REG_c", %1) \n\t" // line 6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
554
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
555 PAVGB(%%mm7, %%mm1) // d/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
556
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
557 "movq (%%"REG_a", %1), %%mm0 \n\t" // line 2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
558 "pxor %%mm2, %%mm0 \n\t" //(l4 - l5) <= 0 ? -l2-1 : l2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
559 "psubusb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
560 "pxor %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
561 "movq %%mm0, (%%"REG_a", %1) \n\t" // line 2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
562
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
563 "movq (%%"REG_c", %1, 2), %%mm0 \n\t" // line 7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
564 "pxor %%mm2, %%mm0 \n\t" //(l4 - l5) <= 0 ? -l7-1 : l7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
565 "paddusb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
566 "pxor %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
567 "movq %%mm0, (%%"REG_c", %1, 2) \n\t" // line 7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
568
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
569 :
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
570 : "r" (src), "r" ((long)stride), "m" (co->pQPb)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
571 : "%"REG_a, "%"REG_c
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
572 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
573 #else //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
574
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
575 const int l1= stride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
576 const int l2= stride + l1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
577 const int l3= stride + l2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
578 const int l4= stride + l3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
579 const int l5= stride + l4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
580 const int l6= stride + l5;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
581 const int l7= stride + l6;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
582 // const int l8= stride + l7;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
583 // const int l9= stride + l8;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
584 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
585
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
586 src+= stride*3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
587 for(x=0; x<BLOCK_SIZE; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
588 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
589 int a= src[l3] - src[l4];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
590 int b= src[l4] - src[l5];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
591 int c= src[l5] - src[l6];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
592
32
cb746db3fd32 Rename ABS macro to FFABS.
diego
parents: 31
diff changeset
593 int d= FFABS(b) - ((FFABS(a) + FFABS(c))>>1);
27
c83a71c1729d Change libpostproc to use the FFMIN/FFMAX macros from libavutil.
diego
parents: 22
diff changeset
594 d= FFMAX(d, 0);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
595
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
596 if(d < co->QP*2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
597 {
31
81ad3274583c Rename SIGN macro to FFSIGN to avoid clashes with system headers.
diego
parents: 29
diff changeset
598 int v = d * FFSIGN(-b);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
599
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
600 src[l2] +=v>>3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
601 src[l3] +=v>>2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
602 src[l4] +=(3*v)>>3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
603 src[l5] -=(3*v)>>3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
604 src[l6] -=v>>2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
605 src[l7] -=v>>3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
606
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
607 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
608 src++;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
609 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
610 #endif //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
611 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
612
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
613 #ifndef HAVE_ALTIVEC
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
614 static inline void RENAME(doVertDefFilter)(uint8_t src[], int stride, PPContext *c)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
615 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
616 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
617 /*
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
618 uint8_t tmp[16];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
619 const int l1= stride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
620 const int l2= stride + l1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
621 const int l3= stride + l2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
622 const int l4= (int)tmp - (int)src - stride*3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
623 const int l5= (int)tmp - (int)src - stride*3 + 8;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
624 const int l6= stride*3 + l3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
625 const int l7= stride + l6;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
626 const int l8= stride + l7;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
627
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
628 memcpy(tmp, src+stride*7, 8);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
629 memcpy(tmp+8, src+stride*8, 8);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
630 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
631 src+= stride*4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
632 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
633
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
634 #if 0 //sligtly more accurate and slightly slower
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
635 "pxor %%mm7, %%mm7 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
636 "lea (%0, %1), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
637 "lea (%%"REG_a", %1, 4), %%"REG_c" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
638 // 0 1 2 3 4 5 6 7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
639 // %0 %0+%1 %0+2%1 eax+2%1 %0+4%1 eax+4%1 ecx+%1 ecx+2%1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
640 // %0 eax eax+%1 eax+2%1 %0+4%1 ecx ecx+%1 ecx+2%1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
641
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
642
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
643 "movq (%0, %1, 2), %%mm0 \n\t" // l2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
644 "movq (%0), %%mm1 \n\t" // l0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
645 "movq %%mm0, %%mm2 \n\t" // l2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
646 PAVGB(%%mm7, %%mm0) // ~l2/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
647 PAVGB(%%mm1, %%mm0) // ~(l2 + 2l0)/4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
648 PAVGB(%%mm2, %%mm0) // ~(5l2 + 2l0)/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
649
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
650 "movq (%%"REG_a"), %%mm1 \n\t" // l1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
651 "movq (%%"REG_a", %1, 2), %%mm3 \n\t" // l3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
652 "movq %%mm1, %%mm4 \n\t" // l1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
653 PAVGB(%%mm7, %%mm1) // ~l1/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
654 PAVGB(%%mm3, %%mm1) // ~(l1 + 2l3)/4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
655 PAVGB(%%mm4, %%mm1) // ~(5l1 + 2l3)/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
656
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
657 "movq %%mm0, %%mm4 \n\t" // ~(5l2 + 2l0)/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
658 "psubusb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
659 "psubusb %%mm4, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
660 "por %%mm0, %%mm1 \n\t" // ~|2l0 - 5l1 + 5l2 - 2l3|/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
661 // mm1= |lenergy|, mm2= l2, mm3= l3, mm7=0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
662
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
663 "movq (%0, %1, 4), %%mm0 \n\t" // l4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
664 "movq %%mm0, %%mm4 \n\t" // l4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
665 PAVGB(%%mm7, %%mm0) // ~l4/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
666 PAVGB(%%mm2, %%mm0) // ~(l4 + 2l2)/4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
667 PAVGB(%%mm4, %%mm0) // ~(5l4 + 2l2)/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
668
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
669 "movq (%%"REG_c"), %%mm2 \n\t" // l5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
670 "movq %%mm3, %%mm5 \n\t" // l3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
671 PAVGB(%%mm7, %%mm3) // ~l3/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
672 PAVGB(%%mm2, %%mm3) // ~(l3 + 2l5)/4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
673 PAVGB(%%mm5, %%mm3) // ~(5l3 + 2l5)/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
674
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
675 "movq %%mm0, %%mm6 \n\t" // ~(5l4 + 2l2)/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
676 "psubusb %%mm3, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
677 "psubusb %%mm6, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
678 "por %%mm0, %%mm3 \n\t" // ~|2l2 - 5l3 + 5l4 - 2l5|/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
679 "pcmpeqb %%mm7, %%mm0 \n\t" // SIGN(2l2 - 5l3 + 5l4 - 2l5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
680 // mm0= SIGN(menergy), mm1= |lenergy|, mm2= l5, mm3= |menergy|, mm4=l4, mm5= l3, mm7=0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
681
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
682 "movq (%%"REG_c", %1), %%mm6 \n\t" // l6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
683 "movq %%mm6, %%mm5 \n\t" // l6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
684 PAVGB(%%mm7, %%mm6) // ~l6/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
685 PAVGB(%%mm4, %%mm6) // ~(l6 + 2l4)/4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
686 PAVGB(%%mm5, %%mm6) // ~(5l6 + 2l4)/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
687
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
688 "movq (%%"REG_c", %1, 2), %%mm5 \n\t" // l7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
689 "movq %%mm2, %%mm4 \n\t" // l5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
690 PAVGB(%%mm7, %%mm2) // ~l5/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
691 PAVGB(%%mm5, %%mm2) // ~(l5 + 2l7)/4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
692 PAVGB(%%mm4, %%mm2) // ~(5l5 + 2l7)/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
693
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
694 "movq %%mm6, %%mm4 \n\t" // ~(5l6 + 2l4)/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
695 "psubusb %%mm2, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
696 "psubusb %%mm4, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
697 "por %%mm6, %%mm2 \n\t" // ~|2l4 - 5l5 + 5l6 - 2l7|/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
698 // mm0= SIGN(menergy), mm1= |lenergy|/8, mm2= |renergy|/8, mm3= |menergy|/8, mm7=0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
699
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
700
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
701 PMINUB(%%mm2, %%mm1, %%mm4) // MIN(|lenergy|,|renergy|)/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
702 "movq %2, %%mm4 \n\t" // QP //FIXME QP+1 ?
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
703 "paddusb "MANGLE(b01)", %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
704 "pcmpgtb %%mm3, %%mm4 \n\t" // |menergy|/8 < QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
705 "psubusb %%mm1, %%mm3 \n\t" // d=|menergy|/8-MIN(|lenergy|,|renergy|)/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
706 "pand %%mm4, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
707
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
708 "movq %%mm3, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
709 // "psubusb "MANGLE(b01)", %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
710 PAVGB(%%mm7, %%mm3)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
711 PAVGB(%%mm7, %%mm3)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
712 "paddusb %%mm1, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
713 // "paddusb "MANGLE(b01)", %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
714
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
715 "movq (%%"REG_a", %1, 2), %%mm6 \n\t" //l3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
716 "movq (%0, %1, 4), %%mm5 \n\t" //l4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
717 "movq (%0, %1, 4), %%mm4 \n\t" //l4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
718 "psubusb %%mm6, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
719 "psubusb %%mm4, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
720 "por %%mm6, %%mm5 \n\t" // |l3-l4|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
721 "pcmpeqb %%mm7, %%mm6 \n\t" // SIGN(l3-l4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
722 "pxor %%mm6, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
723 "pand %%mm0, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
724 PMINUB(%%mm5, %%mm3, %%mm0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
725
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
726 "psubusb "MANGLE(b01)", %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
727 PAVGB(%%mm7, %%mm3)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
728
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
729 "movq (%%"REG_a", %1, 2), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
730 "movq (%0, %1, 4), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
731 "pxor %%mm6, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
732 "pxor %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
733 "psubb %%mm3, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
734 "paddb %%mm3, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
735 "pxor %%mm6, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
736 "pxor %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
737 "movq %%mm0, (%%"REG_a", %1, 2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
738 "movq %%mm2, (%0, %1, 4) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
739 #endif //0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
740
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
741 "lea (%0, %1), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
742 "pcmpeqb %%mm6, %%mm6 \n\t" // -1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
743 // 0 1 2 3 4 5 6 7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
744 // %0 %0+%1 %0+2%1 eax+2%1 %0+4%1 eax+4%1 ecx+%1 ecx+2%1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
745 // %0 eax eax+%1 eax+2%1 %0+4%1 ecx ecx+%1 ecx+2%1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
746
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
747
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
748 "movq (%%"REG_a", %1, 2), %%mm1 \n\t" // l3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
749 "movq (%0, %1, 4), %%mm0 \n\t" // l4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
750 "pxor %%mm6, %%mm1 \n\t" // -l3-1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
751 PAVGB(%%mm1, %%mm0) // -q+128 = (l4-l3+256)/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
752 // mm1=-l3-1, mm0=128-q
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
753
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
754 "movq (%%"REG_a", %1, 4), %%mm2 \n\t" // l5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
755 "movq (%%"REG_a", %1), %%mm3 \n\t" // l2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
756 "pxor %%mm6, %%mm2 \n\t" // -l5-1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
757 "movq %%mm2, %%mm5 \n\t" // -l5-1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
758 "movq "MANGLE(b80)", %%mm4 \n\t" // 128
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
759 "lea (%%"REG_a", %1, 4), %%"REG_c" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
760 PAVGB(%%mm3, %%mm2) // (l2-l5+256)/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
761 PAVGB(%%mm0, %%mm4) // ~(l4-l3)/4 + 128
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
762 PAVGB(%%mm2, %%mm4) // ~(l2-l5)/4 +(l4-l3)/8 + 128
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
763 PAVGB(%%mm0, %%mm4) // ~(l2-l5)/8 +5(l4-l3)/16 + 128
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
764 // mm1=-l3-1, mm0=128-q, mm3=l2, mm4=menergy/16 + 128, mm5= -l5-1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
765
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
766 "movq (%%"REG_a"), %%mm2 \n\t" // l1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
767 "pxor %%mm6, %%mm2 \n\t" // -l1-1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
768 PAVGB(%%mm3, %%mm2) // (l2-l1+256)/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
769 PAVGB((%0), %%mm1) // (l0-l3+256)/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
770 "movq "MANGLE(b80)", %%mm3 \n\t" // 128
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
771 PAVGB(%%mm2, %%mm3) // ~(l2-l1)/4 + 128
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
772 PAVGB(%%mm1, %%mm3) // ~(l0-l3)/4 +(l2-l1)/8 + 128
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
773 PAVGB(%%mm2, %%mm3) // ~(l0-l3)/8 +5(l2-l1)/16 + 128
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
774 // mm0=128-q, mm3=lenergy/16 + 128, mm4= menergy/16 + 128, mm5= -l5-1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
775
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
776 PAVGB((%%REGc, %1), %%mm5) // (l6-l5+256)/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
777 "movq (%%"REG_c", %1, 2), %%mm1 \n\t" // l7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
778 "pxor %%mm6, %%mm1 \n\t" // -l7-1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
779 PAVGB((%0, %1, 4), %%mm1) // (l4-l7+256)/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
780 "movq "MANGLE(b80)", %%mm2 \n\t" // 128
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
781 PAVGB(%%mm5, %%mm2) // ~(l6-l5)/4 + 128
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
782 PAVGB(%%mm1, %%mm2) // ~(l4-l7)/4 +(l6-l5)/8 + 128
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
783 PAVGB(%%mm5, %%mm2) // ~(l4-l7)/8 +5(l6-l5)/16 + 128
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
784 // mm0=128-q, mm2=renergy/16 + 128, mm3=lenergy/16 + 128, mm4= menergy/16 + 128
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
785
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
786 "movq "MANGLE(b00)", %%mm1 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
787 "movq "MANGLE(b00)", %%mm5 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
788 "psubb %%mm2, %%mm1 \n\t" // 128 - renergy/16
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
789 "psubb %%mm3, %%mm5 \n\t" // 128 - lenergy/16
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
790 PMAXUB(%%mm1, %%mm2) // 128 + |renergy/16|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
791 PMAXUB(%%mm5, %%mm3) // 128 + |lenergy/16|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
792 PMINUB(%%mm2, %%mm3, %%mm1) // 128 + MIN(|lenergy|,|renergy|)/16
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
793
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
794 // mm0=128-q, mm3=128 + MIN(|lenergy|,|renergy|)/16, mm4= menergy/16 + 128
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
795
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
796 "movq "MANGLE(b00)", %%mm7 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
797 "movq %2, %%mm2 \n\t" // QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
798 PAVGB(%%mm6, %%mm2) // 128 + QP/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
799 "psubb %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
800
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
801 "movq %%mm4, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
802 "pcmpgtb %%mm7, %%mm1 \n\t" // SIGN(menergy)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
803 "pxor %%mm1, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
804 "psubb %%mm1, %%mm4 \n\t" // 128 + |menergy|/16
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
805 "pcmpgtb %%mm4, %%mm2 \n\t" // |menergy|/16 < QP/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
806 "psubusb %%mm3, %%mm4 \n\t" //d=|menergy|/16 - MIN(|lenergy|,|renergy|)/16
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
807 // mm0=128-q, mm1= SIGN(menergy), mm2= |menergy|/16 < QP/2, mm4= d/16
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
808
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
809 "movq %%mm4, %%mm3 \n\t" // d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
810 "psubusb "MANGLE(b01)", %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
811 PAVGB(%%mm7, %%mm4) // d/32
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
812 PAVGB(%%mm7, %%mm4) // (d + 32)/64
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
813 "paddb %%mm3, %%mm4 \n\t" // 5d/64
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
814 "pand %%mm2, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
815
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
816 "movq "MANGLE(b80)", %%mm5 \n\t" // 128
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
817 "psubb %%mm0, %%mm5 \n\t" // q
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
818 "paddsb %%mm6, %%mm5 \n\t" // fix bad rounding
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
819 "pcmpgtb %%mm5, %%mm7 \n\t" // SIGN(q)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
820 "pxor %%mm7, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
821
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
822 PMINUB(%%mm5, %%mm4, %%mm3) // MIN(|q|, 5d/64)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
823 "pxor %%mm1, %%mm7 \n\t" // SIGN(d*q)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
824
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
825 "pand %%mm7, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
826 "movq (%%"REG_a", %1, 2), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
827 "movq (%0, %1, 4), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
828 "pxor %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
829 "pxor %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
830 "paddb %%mm4, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
831 "psubb %%mm4, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
832 "pxor %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
833 "pxor %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
834 "movq %%mm0, (%%"REG_a", %1, 2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
835 "movq %%mm2, (%0, %1, 4) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
836
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
837 :
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
838 : "r" (src), "r" ((long)stride), "m" (c->pQPb)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
839 : "%"REG_a, "%"REG_c
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
840 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
841
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
842 /*
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
843 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
844 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
845 src-= stride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
846 for(x=0; x<BLOCK_SIZE; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
847 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
848 const int middleEnergy= 5*(src[l5] - src[l4]) + 2*(src[l3] - src[l6]);
32
cb746db3fd32 Rename ABS macro to FFABS.
diego
parents: 31
diff changeset
849 if(FFABS(middleEnergy)< 8*QP)
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
850 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
851 const int q=(src[l4] - src[l5])/2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
852 const int leftEnergy= 5*(src[l3] - src[l2]) + 2*(src[l1] - src[l4]);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
853 const int rightEnergy= 5*(src[l7] - src[l6]) + 2*(src[l5] - src[l8]);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
854
32
cb746db3fd32 Rename ABS macro to FFABS.
diego
parents: 31
diff changeset
855 int d= FFABS(middleEnergy) - FFMIN( FFABS(leftEnergy), FFABS(rightEnergy) );
27
c83a71c1729d Change libpostproc to use the FFMIN/FFMAX macros from libavutil.
diego
parents: 22
diff changeset
856 d= FFMAX(d, 0);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
857
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
858 d= (5*d + 32) >> 6;
31
81ad3274583c Rename SIGN macro to FFSIGN to avoid clashes with system headers.
diego
parents: 29
diff changeset
859 d*= FFSIGN(-middleEnergy);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
860
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
861 if(q>0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
862 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
863 d= d<0 ? 0 : d;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
864 d= d>q ? q : d;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
865 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
866 else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
867 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
868 d= d>0 ? 0 : d;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
869 d= d<q ? q : d;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
870 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
871
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
872 src[l4]-= d;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
873 src[l5]+= d;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
874 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
875 src++;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
876 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
877 src-=8;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
878 for(x=0; x<8; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
879 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
880 int y;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
881 for(y=4; y<6; y++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
882 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
883 int d= src[x+y*stride] - tmp[x+(y-4)*8];
32
cb746db3fd32 Rename ABS macro to FFABS.
diego
parents: 31
diff changeset
884 int ad= FFABS(d);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
885 static int max=0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
886 static int sum=0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
887 static int num=0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
888 static int bias=0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
889
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
890 if(max<ad) max=ad;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
891 sum+= ad>3 ? 1 : 0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
892 if(ad>3)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
893 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
894 src[0] = src[7] = src[stride*7] = src[(stride+1)*7]=255;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
895 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
896 if(y==4) bias+=d;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
897 num++;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
898 if(num%1000000 == 0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
899 {
29
2e855f3f4e0b printf --> av_log with some help from Oded
diego
parents: 27
diff changeset
900 av_log(c, AV_LOG_INFO, " %d %d %d %d\n", num, sum, max, bias);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
901 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
902 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
903 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
904 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
905 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
906 #elif defined (HAVE_MMX)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
907 src+= stride*4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
908 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
909 "pxor %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
910 "lea -40(%%"REG_SP"), %%"REG_c" \n\t" // make space for 4 8-byte vars
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
911 "and "ALIGN_MASK", %%"REG_c" \n\t" // align
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
912 // 0 1 2 3 4 5 6 7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
913 // %0 %0+%1 %0+2%1 eax+2%1 %0+4%1 eax+4%1 edx+%1 edx+2%1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
914 // %0 eax eax+%1 eax+2%1 %0+4%1 edx edx+%1 edx+2%1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
915
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
916 "movq (%0), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
917 "movq %%mm0, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
918 "punpcklbw %%mm7, %%mm0 \n\t" // low part of line 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
919 "punpckhbw %%mm7, %%mm1 \n\t" // high part of line 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
920
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
921 "movq (%0, %1), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
922 "lea (%0, %1, 2), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
923 "movq %%mm2, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
924 "punpcklbw %%mm7, %%mm2 \n\t" // low part of line 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
925 "punpckhbw %%mm7, %%mm3 \n\t" // high part of line 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
926
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
927 "movq (%%"REG_a"), %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
928 "movq %%mm4, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
929 "punpcklbw %%mm7, %%mm4 \n\t" // low part of line 2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
930 "punpckhbw %%mm7, %%mm5 \n\t" // high part of line 2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
931
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
932 "paddw %%mm0, %%mm0 \n\t" // 2L0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
933 "paddw %%mm1, %%mm1 \n\t" // 2H0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
934 "psubw %%mm4, %%mm2 \n\t" // L1 - L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
935 "psubw %%mm5, %%mm3 \n\t" // H1 - H2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
936 "psubw %%mm2, %%mm0 \n\t" // 2L0 - L1 + L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
937 "psubw %%mm3, %%mm1 \n\t" // 2H0 - H1 + H2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
938
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
939 "psllw $2, %%mm2 \n\t" // 4L1 - 4L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
940 "psllw $2, %%mm3 \n\t" // 4H1 - 4H2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
941 "psubw %%mm2, %%mm0 \n\t" // 2L0 - 5L1 + 5L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
942 "psubw %%mm3, %%mm1 \n\t" // 2H0 - 5H1 + 5H2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
943
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
944 "movq (%%"REG_a", %1), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
945 "movq %%mm2, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
946 "punpcklbw %%mm7, %%mm2 \n\t" // L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
947 "punpckhbw %%mm7, %%mm3 \n\t" // H3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
948
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
949 "psubw %%mm2, %%mm0 \n\t" // 2L0 - 5L1 + 5L2 - L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
950 "psubw %%mm3, %%mm1 \n\t" // 2H0 - 5H1 + 5H2 - H3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
951 "psubw %%mm2, %%mm0 \n\t" // 2L0 - 5L1 + 5L2 - 2L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
952 "psubw %%mm3, %%mm1 \n\t" // 2H0 - 5H1 + 5H2 - 2H3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
953 "movq %%mm0, (%%"REG_c") \n\t" // 2L0 - 5L1 + 5L2 - 2L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
954 "movq %%mm1, 8(%%"REG_c") \n\t" // 2H0 - 5H1 + 5H2 - 2H3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
955
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
956 "movq (%%"REG_a", %1, 2), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
957 "movq %%mm0, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
958 "punpcklbw %%mm7, %%mm0 \n\t" // L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
959 "punpckhbw %%mm7, %%mm1 \n\t" // H4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
960
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
961 "psubw %%mm0, %%mm2 \n\t" // L3 - L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
962 "psubw %%mm1, %%mm3 \n\t" // H3 - H4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
963 "movq %%mm2, 16(%%"REG_c") \n\t" // L3 - L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
964 "movq %%mm3, 24(%%"REG_c") \n\t" // H3 - H4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
965 "paddw %%mm4, %%mm4 \n\t" // 2L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
966 "paddw %%mm5, %%mm5 \n\t" // 2H2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
967 "psubw %%mm2, %%mm4 \n\t" // 2L2 - L3 + L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
968 "psubw %%mm3, %%mm5 \n\t" // 2H2 - H3 + H4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
969
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
970 "lea (%%"REG_a", %1), %0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
971 "psllw $2, %%mm2 \n\t" // 4L3 - 4L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
972 "psllw $2, %%mm3 \n\t" // 4H3 - 4H4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
973 "psubw %%mm2, %%mm4 \n\t" // 2L2 - 5L3 + 5L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
974 "psubw %%mm3, %%mm5 \n\t" // 2H2 - 5H3 + 5H4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
975 //50 opcodes so far
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
976 "movq (%0, %1, 2), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
977 "movq %%mm2, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
978 "punpcklbw %%mm7, %%mm2 \n\t" // L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
979 "punpckhbw %%mm7, %%mm3 \n\t" // H5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
980 "psubw %%mm2, %%mm4 \n\t" // 2L2 - 5L3 + 5L4 - L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
981 "psubw %%mm3, %%mm5 \n\t" // 2H2 - 5H3 + 5H4 - H5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
982 "psubw %%mm2, %%mm4 \n\t" // 2L2 - 5L3 + 5L4 - 2L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
983 "psubw %%mm3, %%mm5 \n\t" // 2H2 - 5H3 + 5H4 - 2H5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
984
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
985 "movq (%%"REG_a", %1, 4), %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
986 "punpcklbw %%mm7, %%mm6 \n\t" // L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
987 "psubw %%mm6, %%mm2 \n\t" // L5 - L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
988 "movq (%%"REG_a", %1, 4), %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
989 "punpckhbw %%mm7, %%mm6 \n\t" // H6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
990 "psubw %%mm6, %%mm3 \n\t" // H5 - H6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
991
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
992 "paddw %%mm0, %%mm0 \n\t" // 2L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
993 "paddw %%mm1, %%mm1 \n\t" // 2H4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
994 "psubw %%mm2, %%mm0 \n\t" // 2L4 - L5 + L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
995 "psubw %%mm3, %%mm1 \n\t" // 2H4 - H5 + H6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
996
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
997 "psllw $2, %%mm2 \n\t" // 4L5 - 4L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
998 "psllw $2, %%mm3 \n\t" // 4H5 - 4H6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
999 "psubw %%mm2, %%mm0 \n\t" // 2L4 - 5L5 + 5L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1000 "psubw %%mm3, %%mm1 \n\t" // 2H4 - 5H5 + 5H6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1001
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1002 "movq (%0, %1, 4), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1003 "movq %%mm2, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1004 "punpcklbw %%mm7, %%mm2 \n\t" // L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1005 "punpckhbw %%mm7, %%mm3 \n\t" // H7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1006
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1007 "paddw %%mm2, %%mm2 \n\t" // 2L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1008 "paddw %%mm3, %%mm3 \n\t" // 2H7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1009 "psubw %%mm2, %%mm0 \n\t" // 2L4 - 5L5 + 5L6 - 2L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1010 "psubw %%mm3, %%mm1 \n\t" // 2H4 - 5H5 + 5H6 - 2H7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1011
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1012 "movq (%%"REG_c"), %%mm2 \n\t" // 2L0 - 5L1 + 5L2 - 2L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1013 "movq 8(%%"REG_c"), %%mm3 \n\t" // 2H0 - 5H1 + 5H2 - 2H3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1014
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1015 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1016 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1017 "psubw %%mm0, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1018 "pmaxsw %%mm6, %%mm0 \n\t" // |2L4 - 5L5 + 5L6 - 2L7|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1019 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1020 "psubw %%mm1, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1021 "pmaxsw %%mm6, %%mm1 \n\t" // |2H4 - 5H5 + 5H6 - 2H7|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1022 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1023 "psubw %%mm2, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1024 "pmaxsw %%mm6, %%mm2 \n\t" // |2L0 - 5L1 + 5L2 - 2L3|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1025 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1026 "psubw %%mm3, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1027 "pmaxsw %%mm6, %%mm3 \n\t" // |2H0 - 5H1 + 5H2 - 2H3|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1028 #else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1029 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1030 "pcmpgtw %%mm0, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1031 "pxor %%mm6, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1032 "psubw %%mm6, %%mm0 \n\t" // |2L4 - 5L5 + 5L6 - 2L7|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1033 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1034 "pcmpgtw %%mm1, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1035 "pxor %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1036 "psubw %%mm6, %%mm1 \n\t" // |2H4 - 5H5 + 5H6 - 2H7|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1037 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1038 "pcmpgtw %%mm2, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1039 "pxor %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1040 "psubw %%mm6, %%mm2 \n\t" // |2L0 - 5L1 + 5L2 - 2L3|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1041 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1042 "pcmpgtw %%mm3, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1043 "pxor %%mm6, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1044 "psubw %%mm6, %%mm3 \n\t" // |2H0 - 5H1 + 5H2 - 2H3|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1045 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1046
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1047 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1048 "pminsw %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1049 "pminsw %%mm3, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1050 #else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1051 "movq %%mm0, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1052 "psubusw %%mm2, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1053 "psubw %%mm6, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1054 "movq %%mm1, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1055 "psubusw %%mm3, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1056 "psubw %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1057 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1058
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1059 "movd %2, %%mm2 \n\t" // QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1060 "punpcklbw %%mm7, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1061
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1062 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1063 "pcmpgtw %%mm4, %%mm6 \n\t" // sign(2L2 - 5L3 + 5L4 - 2L5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1064 "pxor %%mm6, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1065 "psubw %%mm6, %%mm4 \n\t" // |2L2 - 5L3 + 5L4 - 2L5|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1066 "pcmpgtw %%mm5, %%mm7 \n\t" // sign(2H2 - 5H3 + 5H4 - 2H5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1067 "pxor %%mm7, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1068 "psubw %%mm7, %%mm5 \n\t" // |2H2 - 5H3 + 5H4 - 2H5|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1069 // 100 opcodes
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1070 "psllw $3, %%mm2 \n\t" // 8QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1071 "movq %%mm2, %%mm3 \n\t" // 8QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1072 "pcmpgtw %%mm4, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1073 "pcmpgtw %%mm5, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1074 "pand %%mm2, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1075 "pand %%mm3, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1076
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1077
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1078 "psubusw %%mm0, %%mm4 \n\t" // hd
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1079 "psubusw %%mm1, %%mm5 \n\t" // ld
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1080
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1081
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1082 "movq "MANGLE(w05)", %%mm2 \n\t" // 5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1083 "pmullw %%mm2, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1084 "pmullw %%mm2, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1085 "movq "MANGLE(w20)", %%mm2 \n\t" // 32
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1086 "paddw %%mm2, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1087 "paddw %%mm2, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1088 "psrlw $6, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1089 "psrlw $6, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1090
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1091 "movq 16(%%"REG_c"), %%mm0 \n\t" // L3 - L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1092 "movq 24(%%"REG_c"), %%mm1 \n\t" // H3 - H4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1093
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1094 "pxor %%mm2, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1095 "pxor %%mm3, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1096
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1097 "pcmpgtw %%mm0, %%mm2 \n\t" // sign (L3-L4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1098 "pcmpgtw %%mm1, %%mm3 \n\t" // sign (H3-H4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1099 "pxor %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1100 "pxor %%mm3, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1101 "psubw %%mm2, %%mm0 \n\t" // |L3-L4|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1102 "psubw %%mm3, %%mm1 \n\t" // |H3-H4|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1103 "psrlw $1, %%mm0 \n\t" // |L3 - L4|/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1104 "psrlw $1, %%mm1 \n\t" // |H3 - H4|/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1105
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1106 "pxor %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1107 "pxor %%mm7, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1108 "pand %%mm2, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1109 "pand %%mm3, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1110
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1111 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1112 "pminsw %%mm0, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1113 "pminsw %%mm1, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1114 #else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1115 "movq %%mm4, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1116 "psubusw %%mm0, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1117 "psubw %%mm2, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1118 "movq %%mm5, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1119 "psubusw %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1120 "psubw %%mm2, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1121 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1122 "pxor %%mm6, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1123 "pxor %%mm7, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1124 "psubw %%mm6, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1125 "psubw %%mm7, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1126 "packsswb %%mm5, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1127 "movq (%0), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1128 "paddb %%mm4, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1129 "movq %%mm0, (%0) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1130 "movq (%0, %1), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1131 "psubb %%mm4, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1132 "movq %%mm0, (%0, %1) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1133
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1134 : "+r" (src)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1135 : "r" ((long)stride), "m" (c->pQPb)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1136 : "%"REG_a, "%"REG_c
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1137 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1138 #else //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1139 const int l1= stride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1140 const int l2= stride + l1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1141 const int l3= stride + l2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1142 const int l4= stride + l3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1143 const int l5= stride + l4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1144 const int l6= stride + l5;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1145 const int l7= stride + l6;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1146 const int l8= stride + l7;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1147 // const int l9= stride + l8;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1148 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1149 src+= stride*3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1150 for(x=0; x<BLOCK_SIZE; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1151 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1152 const int middleEnergy= 5*(src[l5] - src[l4]) + 2*(src[l3] - src[l6]);
32
cb746db3fd32 Rename ABS macro to FFABS.
diego
parents: 31
diff changeset
1153 if(FFABS(middleEnergy) < 8*c->QP)
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1154 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1155 const int q=(src[l4] - src[l5])/2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1156 const int leftEnergy= 5*(src[l3] - src[l2]) + 2*(src[l1] - src[l4]);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1157 const int rightEnergy= 5*(src[l7] - src[l6]) + 2*(src[l5] - src[l8]);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1158
32
cb746db3fd32 Rename ABS macro to FFABS.
diego
parents: 31
diff changeset
1159 int d= FFABS(middleEnergy) - FFMIN( FFABS(leftEnergy), FFABS(rightEnergy) );
27
c83a71c1729d Change libpostproc to use the FFMIN/FFMAX macros from libavutil.
diego
parents: 22
diff changeset
1160 d= FFMAX(d, 0);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1161
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1162 d= (5*d + 32) >> 6;
31
81ad3274583c Rename SIGN macro to FFSIGN to avoid clashes with system headers.
diego
parents: 29
diff changeset
1163 d*= FFSIGN(-middleEnergy);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1164
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1165 if(q>0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1166 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1167 d= d<0 ? 0 : d;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1168 d= d>q ? q : d;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1169 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1170 else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1171 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1172 d= d>0 ? 0 : d;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1173 d= d<q ? q : d;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1174 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1175
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1176 src[l4]-= d;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1177 src[l5]+= d;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1178 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1179 src++;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1180 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1181 #endif //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1182 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1183 #endif //HAVE_ALTIVEC
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1184
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1185 #ifndef HAVE_ALTIVEC
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1186 static inline void RENAME(dering)(uint8_t src[], int stride, PPContext *c)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1187 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1188 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1189 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1190 "pxor %%mm6, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1191 "pcmpeqb %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1192 "movq %2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1193 "punpcklbw %%mm6, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1194 "psrlw $1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1195 "psubw %%mm7, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1196 "packuswb %%mm0, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1197 "movq %%mm0, %3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1198
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1199 "lea (%0, %1), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1200 "lea (%%"REG_a", %1, 4), %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1201
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1202 // 0 1 2 3 4 5 6 7 8 9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1203 // %0 eax eax+%1 eax+2%1 %0+4%1 edx edx+%1 edx+2%1 %0+8%1 edx+4%1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1204
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1205 #undef FIND_MIN_MAX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1206 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1207 #define REAL_FIND_MIN_MAX(addr)\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1208 "movq " #addr ", %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1209 "pminub %%mm0, %%mm7 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1210 "pmaxub %%mm0, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1211 #else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1212 #define REAL_FIND_MIN_MAX(addr)\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1213 "movq " #addr ", %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1214 "movq %%mm7, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1215 "psubusb %%mm0, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1216 "paddb %%mm0, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1217 "psubusb %%mm0, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1218 "psubb %%mm1, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1219 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1220 #define FIND_MIN_MAX(addr) REAL_FIND_MIN_MAX(addr)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1221
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1222 FIND_MIN_MAX((%%REGa))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1223 FIND_MIN_MAX((%%REGa, %1))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1224 FIND_MIN_MAX((%%REGa, %1, 2))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1225 FIND_MIN_MAX((%0, %1, 4))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1226 FIND_MIN_MAX((%%REGd))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1227 FIND_MIN_MAX((%%REGd, %1))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1228 FIND_MIN_MAX((%%REGd, %1, 2))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1229 FIND_MIN_MAX((%0, %1, 8))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1230
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1231 "movq %%mm7, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1232 "psrlq $8, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1233 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1234 "pminub %%mm4, %%mm7 \n\t" // min of pixels
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1235 "pshufw $0xF9, %%mm7, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1236 "pminub %%mm4, %%mm7 \n\t" // min of pixels
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1237 "pshufw $0xFE, %%mm7, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1238 "pminub %%mm4, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1239 #else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1240 "movq %%mm7, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1241 "psubusb %%mm4, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1242 "psubb %%mm1, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1243 "movq %%mm7, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1244 "psrlq $16, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1245 "movq %%mm7, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1246 "psubusb %%mm4, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1247 "psubb %%mm1, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1248 "movq %%mm7, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1249 "psrlq $32, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1250 "movq %%mm7, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1251 "psubusb %%mm4, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1252 "psubb %%mm1, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1253 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1254
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1255
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1256 "movq %%mm6, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1257 "psrlq $8, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1258 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1259 "pmaxub %%mm4, %%mm6 \n\t" // max of pixels
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1260 "pshufw $0xF9, %%mm6, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1261 "pmaxub %%mm4, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1262 "pshufw $0xFE, %%mm6, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1263 "pmaxub %%mm4, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1264 #else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1265 "psubusb %%mm4, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1266 "paddb %%mm4, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1267 "movq %%mm6, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1268 "psrlq $16, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1269 "psubusb %%mm4, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1270 "paddb %%mm4, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1271 "movq %%mm6, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1272 "psrlq $32, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1273 "psubusb %%mm4, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1274 "paddb %%mm4, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1275 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1276 "movq %%mm6, %%mm0 \n\t" // max
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1277 "psubb %%mm7, %%mm6 \n\t" // max - min
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1278 "movd %%mm6, %%ecx \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1279 "cmpb "MANGLE(deringThreshold)", %%cl \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1280 " jb 1f \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1281 "lea -24(%%"REG_SP"), %%"REG_c" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1282 "and "ALIGN_MASK", %%"REG_c" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1283 PAVGB(%%mm0, %%mm7) // a=(max + min)/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1284 "punpcklbw %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1285 "punpcklbw %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1286 "punpcklbw %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1287 "movq %%mm7, (%%"REG_c") \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1288
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1289 "movq (%0), %%mm0 \n\t" // L10
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1290 "movq %%mm0, %%mm1 \n\t" // L10
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1291 "movq %%mm0, %%mm2 \n\t" // L10
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1292 "psllq $8, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1293 "psrlq $8, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1294 "movd -4(%0), %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1295 "movd 8(%0), %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1296 "psrlq $24, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1297 "psllq $56, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1298 "por %%mm3, %%mm1 \n\t" // L00
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1299 "por %%mm4, %%mm2 \n\t" // L20
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1300 "movq %%mm1, %%mm3 \n\t" // L00
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1301 PAVGB(%%mm2, %%mm1) // (L20 + L00)/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1302 PAVGB(%%mm0, %%mm1) // (L20 + L00 + 2L10)/4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1303 "psubusb %%mm7, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1304 "psubusb %%mm7, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1305 "psubusb %%mm7, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1306 "pcmpeqb "MANGLE(b00)", %%mm0 \n\t" // L10 > a ? 0 : -1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1307 "pcmpeqb "MANGLE(b00)", %%mm2 \n\t" // L20 > a ? 0 : -1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1308 "pcmpeqb "MANGLE(b00)", %%mm3 \n\t" // L00 > a ? 0 : -1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1309 "paddb %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1310 "paddb %%mm3, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1311
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1312 "movq (%%"REG_a"), %%mm2 \n\t" // L11
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1313 "movq %%mm2, %%mm3 \n\t" // L11
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1314 "movq %%mm2, %%mm4 \n\t" // L11
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1315 "psllq $8, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1316 "psrlq $8, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1317 "movd -4(%%"REG_a"), %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1318 "movd 8(%%"REG_a"), %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1319 "psrlq $24, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1320 "psllq $56, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1321 "por %%mm5, %%mm3 \n\t" // L01
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1322 "por %%mm6, %%mm4 \n\t" // L21
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1323 "movq %%mm3, %%mm5 \n\t" // L01
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1324 PAVGB(%%mm4, %%mm3) // (L21 + L01)/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1325 PAVGB(%%mm2, %%mm3) // (L21 + L01 + 2L11)/4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1326 "psubusb %%mm7, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1327 "psubusb %%mm7, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1328 "psubusb %%mm7, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1329 "pcmpeqb "MANGLE(b00)", %%mm2 \n\t" // L11 > a ? 0 : -1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1330 "pcmpeqb "MANGLE(b00)", %%mm4 \n\t" // L21 > a ? 0 : -1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1331 "pcmpeqb "MANGLE(b00)", %%mm5 \n\t" // L01 > a ? 0 : -1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1332 "paddb %%mm4, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1333 "paddb %%mm5, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1334 // 0, 2, 3, 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1335 #define REAL_DERING_CORE(dst,src,ppsx,psx,sx,pplx,plx,lx,t0,t1) \
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1336 "movq " #src ", " #sx " \n\t" /* src[0] */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1337 "movq " #sx ", " #lx " \n\t" /* src[0] */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1338 "movq " #sx ", " #t0 " \n\t" /* src[0] */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1339 "psllq $8, " #lx " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1340 "psrlq $8, " #t0 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1341 "movd -4" #src ", " #t1 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1342 "psrlq $24, " #t1 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1343 "por " #t1 ", " #lx " \n\t" /* src[-1] */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1344 "movd 8" #src ", " #t1 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1345 "psllq $56, " #t1 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1346 "por " #t1 ", " #t0 " \n\t" /* src[+1] */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1347 "movq " #lx ", " #t1 " \n\t" /* src[-1] */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1348 PAVGB(t0, lx) /* (src[-1] + src[+1])/2 */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1349 PAVGB(sx, lx) /* (src[-1] + 2src[0] + src[+1])/4 */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1350 PAVGB(lx, pplx) \
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1351 "movq " #lx ", 8(%%"REG_c") \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1352 "movq (%%"REG_c"), " #lx " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1353 "psubusb " #lx ", " #t1 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1354 "psubusb " #lx ", " #t0 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1355 "psubusb " #lx ", " #sx " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1356 "movq "MANGLE(b00)", " #lx " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1357 "pcmpeqb " #lx ", " #t1 " \n\t" /* src[-1] > a ? 0 : -1*/\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1358 "pcmpeqb " #lx ", " #t0 " \n\t" /* src[+1] > a ? 0 : -1*/\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1359 "pcmpeqb " #lx ", " #sx " \n\t" /* src[0] > a ? 0 : -1*/\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1360 "paddb " #t1 ", " #t0 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1361 "paddb " #t0 ", " #sx " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1362 \
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1363 PAVGB(plx, pplx) /* filtered */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1364 "movq " #dst ", " #t0 " \n\t" /* dst */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1365 "movq " #t0 ", " #t1 " \n\t" /* dst */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1366 "psubusb %3, " #t0 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1367 "paddusb %3, " #t1 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1368 PMAXUB(t0, pplx)\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1369 PMINUB(t1, pplx, t0)\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1370 "paddb " #sx ", " #ppsx " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1371 "paddb " #psx ", " #ppsx " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1372 "#paddb "MANGLE(b02)", " #ppsx " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1373 "pand "MANGLE(b08)", " #ppsx " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1374 "pcmpeqb " #lx ", " #ppsx " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1375 "pand " #ppsx ", " #pplx " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1376 "pandn " #dst ", " #ppsx " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1377 "por " #pplx ", " #ppsx " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1378 "movq " #ppsx ", " #dst " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1379 "movq 8(%%"REG_c"), " #lx " \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1380
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1381 #define DERING_CORE(dst,src,ppsx,psx,sx,pplx,plx,lx,t0,t1) \
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1382 REAL_DERING_CORE(dst,src,ppsx,psx,sx,pplx,plx,lx,t0,t1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1383 /*
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1384 0000000
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1385 1111111
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1386
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1387 1111110
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1388 1111101
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1389 1111100
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1390 1111011
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1391 1111010
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1392 1111001
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1393
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1394 1111000
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1395 1110111
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1396
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1397 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1398 //DERING_CORE(dst ,src ,ppsx ,psx ,sx ,pplx ,plx ,lx ,t0 ,t1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1399 DERING_CORE((%%REGa) ,(%%REGa, %1) ,%%mm0,%%mm2,%%mm4,%%mm1,%%mm3,%%mm5,%%mm6,%%mm7)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1400 DERING_CORE((%%REGa, %1) ,(%%REGa, %1, 2),%%mm2,%%mm4,%%mm0,%%mm3,%%mm5,%%mm1,%%mm6,%%mm7)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1401 DERING_CORE((%%REGa, %1, 2),(%0, %1, 4) ,%%mm4,%%mm0,%%mm2,%%mm5,%%mm1,%%mm3,%%mm6,%%mm7)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1402 DERING_CORE((%0, %1, 4) ,(%%REGd) ,%%mm0,%%mm2,%%mm4,%%mm1,%%mm3,%%mm5,%%mm6,%%mm7)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1403 DERING_CORE((%%REGd) ,(%%REGd, %1) ,%%mm2,%%mm4,%%mm0,%%mm3,%%mm5,%%mm1,%%mm6,%%mm7)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1404 DERING_CORE((%%REGd, %1) ,(%%REGd, %1, 2),%%mm4,%%mm0,%%mm2,%%mm5,%%mm1,%%mm3,%%mm6,%%mm7)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1405 DERING_CORE((%%REGd, %1, 2),(%0, %1, 8) ,%%mm0,%%mm2,%%mm4,%%mm1,%%mm3,%%mm5,%%mm6,%%mm7)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1406 DERING_CORE((%0, %1, 8) ,(%%REGd, %1, 4),%%mm2,%%mm4,%%mm0,%%mm3,%%mm5,%%mm1,%%mm6,%%mm7)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1407
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1408 "1: \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1409 : : "r" (src), "r" ((long)stride), "m" (c->pQPb), "m"(c->pQPb2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1410 : "%"REG_a, "%"REG_d, "%"REG_c
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1411 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1412 #else //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1413 int y;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1414 int min=255;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1415 int max=0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1416 int avg;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1417 uint8_t *p;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1418 int s[10];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1419 const int QP2= c->QP/2 + 1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1420
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1421 for(y=1; y<9; y++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1422 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1423 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1424 p= src + stride*y;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1425 for(x=1; x<9; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1426 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1427 p++;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1428 if(*p > max) max= *p;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1429 if(*p < min) min= *p;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1430 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1431 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1432 avg= (min + max + 1)>>1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1433
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1434 if(max - min <deringThreshold) return;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1435
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1436 for(y=0; y<10; y++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1437 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1438 int t = 0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1439
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1440 if(src[stride*y + 0] > avg) t+= 1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1441 if(src[stride*y + 1] > avg) t+= 2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1442 if(src[stride*y + 2] > avg) t+= 4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1443 if(src[stride*y + 3] > avg) t+= 8;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1444 if(src[stride*y + 4] > avg) t+= 16;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1445 if(src[stride*y + 5] > avg) t+= 32;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1446 if(src[stride*y + 6] > avg) t+= 64;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1447 if(src[stride*y + 7] > avg) t+= 128;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1448 if(src[stride*y + 8] > avg) t+= 256;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1449 if(src[stride*y + 9] > avg) t+= 512;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1450
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1451 t |= (~t)<<16;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1452 t &= (t<<1) & (t>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1453 s[y] = t;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1454 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1455
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1456 for(y=1; y<9; y++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1457 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1458 int t = s[y-1] & s[y] & s[y+1];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1459 t|= t>>16;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1460 s[y-1]= t;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1461 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1462
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1463 for(y=1; y<9; y++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1464 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1465 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1466 int t = s[y-1];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1467
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1468 p= src + stride*y;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1469 for(x=1; x<9; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1470 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1471 p++;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1472 if(t & (1<<x))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1473 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1474 int f= (*(p-stride-1)) + 2*(*(p-stride)) + (*(p-stride+1))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1475 +2*(*(p -1)) + 4*(*p ) + 2*(*(p +1))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1476 +(*(p+stride-1)) + 2*(*(p+stride)) + (*(p+stride+1));
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1477 f= (f + 8)>>4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1478
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1479 #ifdef DEBUG_DERING_THRESHOLD
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1480 asm volatile("emms\n\t":);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1481 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1482 static long long numPixels=0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1483 if(x!=1 && x!=8 && y!=1 && y!=8) numPixels++;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1484 // if((max-min)<20 || (max-min)*QP<200)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1485 // if((max-min)*QP < 500)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1486 // if(max-min<QP/2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1487 if(max-min < 20)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1488 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1489 static int numSkiped=0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1490 static int errorSum=0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1491 static int worstQP=0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1492 static int worstRange=0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1493 static int worstDiff=0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1494 int diff= (f - *p);
32
cb746db3fd32 Rename ABS macro to FFABS.
diego
parents: 31
diff changeset
1495 int absDiff= FFABS(diff);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1496 int error= diff*diff;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1497
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1498 if(x==1 || x==8 || y==1 || y==8) continue;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1499
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1500 numSkiped++;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1501 if(absDiff > worstDiff)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1502 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1503 worstDiff= absDiff;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1504 worstQP= QP;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1505 worstRange= max-min;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1506 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1507 errorSum+= error;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1508
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1509 if(1024LL*1024LL*1024LL % numSkiped == 0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1510 {
29
2e855f3f4e0b printf --> av_log with some help from Oded
diego
parents: 27
diff changeset
1511 av_log(c, AV_LOG_INFO, "sum:%1.3f, skip:%d, wQP:%d, "
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1512 "wRange:%d, wDiff:%d, relSkip:%1.3f\n",
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1513 (float)errorSum/numSkiped, numSkiped, worstQP, worstRange,
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1514 worstDiff, (float)numSkiped/numPixels);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1515 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1516 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1517 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1518 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1519 if (*p + QP2 < f) *p= *p + QP2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1520 else if(*p - QP2 > f) *p= *p - QP2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1521 else *p=f;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1522 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1523 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1524 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1525 #ifdef DEBUG_DERING_THRESHOLD
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1526 if(max-min < 20)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1527 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1528 for(y=1; y<9; y++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1529 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1530 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1531 int t = 0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1532 p= src + stride*y;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1533 for(x=1; x<9; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1534 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1535 p++;
27
c83a71c1729d Change libpostproc to use the FFMIN/FFMAX macros from libavutil.
diego
parents: 22
diff changeset
1536 *p = FFMIN(*p + 20, 255);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1537 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1538 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1539 // src[0] = src[7]=src[stride*7]=src[stride*7 + 7]=255;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1540 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1541 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1542 #endif //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1543 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1544 #endif //HAVE_ALTIVEC
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1545
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1546 /**
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1547 * Deinterlaces the given block by linearly interpolating every second line.
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1548 * will be called for every 8x8 block and can read & write from line 4-15
90
8e738e0a16f5 typo fixes
diego
parents: 78
diff changeset
1549 * lines 0-3 have been passed through the deblock / dering filters already, but can be read, too.
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1550 * lines 4-12 will be read into the deblocking filter and should be deinterlaced
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1551 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1552 static inline void RENAME(deInterlaceInterpolateLinear)(uint8_t src[], int stride)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1553 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1554 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1555 src+= 4*stride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1556 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1557 "lea (%0, %1), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1558 "lea (%%"REG_a", %1, 4), %%"REG_c" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1559 // 0 1 2 3 4 5 6 7 8 9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1560 // %0 eax eax+%1 eax+2%1 %0+4%1 ecx ecx+%1 ecx+2%1 %0+8%1 ecx+4%1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1561
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1562 "movq (%0), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1563 "movq (%%"REG_a", %1), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1564 PAVGB(%%mm1, %%mm0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1565 "movq %%mm0, (%%"REG_a") \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1566 "movq (%0, %1, 4), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1567 PAVGB(%%mm0, %%mm1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1568 "movq %%mm1, (%%"REG_a", %1, 2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1569 "movq (%%"REG_c", %1), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1570 PAVGB(%%mm1, %%mm0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1571 "movq %%mm0, (%%"REG_c") \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1572 "movq (%0, %1, 8), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1573 PAVGB(%%mm0, %%mm1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1574 "movq %%mm1, (%%"REG_c", %1, 2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1575
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1576 : : "r" (src), "r" ((long)stride)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1577 : "%"REG_a, "%"REG_c
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1578 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1579 #else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1580 int a, b, x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1581 src+= 4*stride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1582
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1583 for(x=0; x<2; x++){
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1584 a= *(uint32_t*)&src[stride*0];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1585 b= *(uint32_t*)&src[stride*2];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1586 *(uint32_t*)&src[stride*1]= (a|b) - (((a^b)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1587 a= *(uint32_t*)&src[stride*4];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1588 *(uint32_t*)&src[stride*3]= (a|b) - (((a^b)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1589 b= *(uint32_t*)&src[stride*6];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1590 *(uint32_t*)&src[stride*5]= (a|b) - (((a^b)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1591 a= *(uint32_t*)&src[stride*8];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1592 *(uint32_t*)&src[stride*7]= (a|b) - (((a^b)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1593 src += 4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1594 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1595 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1596 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1597
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1598 /**
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1599 * Deinterlaces the given block by cubic interpolating every second line.
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1600 * will be called for every 8x8 block and can read & write from line 4-15
90
8e738e0a16f5 typo fixes
diego
parents: 78
diff changeset
1601 * lines 0-3 have been passed through the deblock / dering filters already, but can be read, too.
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1602 * lines 4-12 will be read into the deblocking filter and should be deinterlaced
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1603 * this filter will read lines 3-15 and write 7-13
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1604 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1605 static inline void RENAME(deInterlaceInterpolateCubic)(uint8_t src[], int stride)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1606 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1607 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1608 src+= stride*3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1609 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1610 "lea (%0, %1), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1611 "lea (%%"REG_a", %1, 4), %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1612 "lea (%%"REG_d", %1, 4), %%"REG_c" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1613 "add %1, %%"REG_c" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1614 "pxor %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1615 // 0 1 2 3 4 5 6 7 8 9 10
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1616 // %0 eax eax+%1 eax+2%1 %0+4%1 edx edx+%1 edx+2%1 %0+8%1 edx+4%1 ecx
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1617
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1618 #define REAL_DEINT_CUBIC(a,b,c,d,e)\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1619 "movq " #a ", %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1620 "movq " #b ", %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1621 "movq " #d ", %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1622 "movq " #e ", %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1623 PAVGB(%%mm2, %%mm1) /* (b+d) /2 */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1624 PAVGB(%%mm3, %%mm0) /* a(a+e) /2 */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1625 "movq %%mm0, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1626 "punpcklbw %%mm7, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1627 "punpckhbw %%mm7, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1628 "movq %%mm1, %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1629 "punpcklbw %%mm7, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1630 "punpckhbw %%mm7, %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1631 "psubw %%mm1, %%mm0 \n\t" /* L(a+e - (b+d))/2 */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1632 "psubw %%mm3, %%mm2 \n\t" /* H(a+e - (b+d))/2 */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1633 "psraw $3, %%mm0 \n\t" /* L(a+e - (b+d))/16 */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1634 "psraw $3, %%mm2 \n\t" /* H(a+e - (b+d))/16 */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1635 "psubw %%mm0, %%mm1 \n\t" /* L(9b + 9d - a - e)/16 */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1636 "psubw %%mm2, %%mm3 \n\t" /* H(9b + 9d - a - e)/16 */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1637 "packuswb %%mm3, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1638 "movq %%mm1, " #c " \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1639 #define DEINT_CUBIC(a,b,c,d,e) REAL_DEINT_CUBIC(a,b,c,d,e)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1640
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1641 DEINT_CUBIC((%0) , (%%REGa, %1), (%%REGa, %1, 2), (%0, %1, 4) , (%%REGd, %1))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1642 DEINT_CUBIC((%%REGa, %1), (%0, %1, 4) , (%%REGd) , (%%REGd, %1), (%0, %1, 8))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1643 DEINT_CUBIC((%0, %1, 4) , (%%REGd, %1), (%%REGd, %1, 2), (%0, %1, 8) , (%%REGc))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1644 DEINT_CUBIC((%%REGd, %1), (%0, %1, 8) , (%%REGd, %1, 4), (%%REGc) , (%%REGc, %1, 2))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1645
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1646 : : "r" (src), "r" ((long)stride)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1647 : "%"REG_a, "%"REG_d, "%"REG_c
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1648 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1649 #else //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1650 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1651 src+= stride*3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1652 for(x=0; x<8; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1653 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1654 src[stride*3] = CLIP((-src[0] + 9*src[stride*2] + 9*src[stride*4] - src[stride*6])>>4);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1655 src[stride*5] = CLIP((-src[stride*2] + 9*src[stride*4] + 9*src[stride*6] - src[stride*8])>>4);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1656 src[stride*7] = CLIP((-src[stride*4] + 9*src[stride*6] + 9*src[stride*8] - src[stride*10])>>4);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1657 src[stride*9] = CLIP((-src[stride*6] + 9*src[stride*8] + 9*src[stride*10] - src[stride*12])>>4);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1658 src++;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1659 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1660 #endif //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1661 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1662
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1663 /**
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1664 * Deinterlaces the given block by filtering every second line with a (-1 4 2 4 -1) filter.
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1665 * will be called for every 8x8 block and can read & write from line 4-15
90
8e738e0a16f5 typo fixes
diego
parents: 78
diff changeset
1666 * lines 0-3 have been passed through the deblock / dering filters already, but can be read, too.
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1667 * lines 4-12 will be read into the deblocking filter and should be deinterlaced
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1668 * this filter will read lines 4-13 and write 5-11
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1669 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1670 static inline void RENAME(deInterlaceFF)(uint8_t src[], int stride, uint8_t *tmp)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1671 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1672 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1673 src+= stride*4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1674 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1675 "lea (%0, %1), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1676 "lea (%%"REG_a", %1, 4), %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1677 "pxor %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1678 "movq (%2), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1679 // 0 1 2 3 4 5 6 7 8 9 10
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1680 // %0 eax eax+%1 eax+2%1 %0+4%1 edx edx+%1 edx+2%1 %0+8%1 edx+4%1 ecx
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1681
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1682 #define REAL_DEINT_FF(a,b,c,d)\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1683 "movq " #a ", %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1684 "movq " #b ", %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1685 "movq " #c ", %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1686 "movq " #d ", %%mm4 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1687 PAVGB(%%mm3, %%mm1) \
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1688 PAVGB(%%mm4, %%mm0) \
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1689 "movq %%mm0, %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1690 "punpcklbw %%mm7, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1691 "punpckhbw %%mm7, %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1692 "movq %%mm1, %%mm4 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1693 "punpcklbw %%mm7, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1694 "punpckhbw %%mm7, %%mm4 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1695 "psllw $2, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1696 "psllw $2, %%mm4 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1697 "psubw %%mm0, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1698 "psubw %%mm3, %%mm4 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1699 "movq %%mm2, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1700 "movq %%mm2, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1701 "punpcklbw %%mm7, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1702 "punpckhbw %%mm7, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1703 "paddw %%mm2, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1704 "paddw %%mm5, %%mm4 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1705 "psraw $2, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1706 "psraw $2, %%mm4 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1707 "packuswb %%mm4, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1708 "movq %%mm1, " #b " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1709
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1710 #define DEINT_FF(a,b,c,d) REAL_DEINT_FF(a,b,c,d)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1711
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1712 DEINT_FF((%0) , (%%REGa) , (%%REGa, %1), (%%REGa, %1, 2))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1713 DEINT_FF((%%REGa, %1), (%%REGa, %1, 2), (%0, %1, 4) , (%%REGd) )
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1714 DEINT_FF((%0, %1, 4) , (%%REGd) , (%%REGd, %1), (%%REGd, %1, 2))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1715 DEINT_FF((%%REGd, %1), (%%REGd, %1, 2), (%0, %1, 8) , (%%REGd, %1, 4))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1716
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1717 "movq %%mm0, (%2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1718 : : "r" (src), "r" ((long)stride), "r"(tmp)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1719 : "%"REG_a, "%"REG_d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1720 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1721 #else //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1722 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1723 src+= stride*4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1724 for(x=0; x<8; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1725 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1726 int t1= tmp[x];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1727 int t2= src[stride*1];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1728
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1729 src[stride*1]= CLIP((-t1 + 4*src[stride*0] + 2*t2 + 4*src[stride*2] - src[stride*3] + 4)>>3);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1730 t1= src[stride*4];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1731 src[stride*3]= CLIP((-t2 + 4*src[stride*2] + 2*t1 + 4*src[stride*4] - src[stride*5] + 4)>>3);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1732 t2= src[stride*6];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1733 src[stride*5]= CLIP((-t1 + 4*src[stride*4] + 2*t2 + 4*src[stride*6] - src[stride*7] + 4)>>3);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1734 t1= src[stride*8];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1735 src[stride*7]= CLIP((-t2 + 4*src[stride*6] + 2*t1 + 4*src[stride*8] - src[stride*9] + 4)>>3);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1736 tmp[x]= t1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1737
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1738 src++;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1739 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1740 #endif //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1741 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1742
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1743 /**
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1744 * Deinterlaces the given block by filtering every line with a (-1 2 6 2 -1) filter.
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1745 * will be called for every 8x8 block and can read & write from line 4-15
90
8e738e0a16f5 typo fixes
diego
parents: 78
diff changeset
1746 * lines 0-3 have been passed through the deblock / dering filters already, but can be read, too.
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1747 * lines 4-12 will be read into the deblocking filter and should be deinterlaced
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1748 * this filter will read lines 4-13 and write 4-11
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1749 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1750 static inline void RENAME(deInterlaceL5)(uint8_t src[], int stride, uint8_t *tmp, uint8_t *tmp2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1751 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1752 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1753 src+= stride*4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1754 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1755 "lea (%0, %1), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1756 "lea (%%"REG_a", %1, 4), %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1757 "pxor %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1758 "movq (%2), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1759 "movq (%3), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1760 // 0 1 2 3 4 5 6 7 8 9 10
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1761 // %0 eax eax+%1 eax+2%1 %0+4%1 edx edx+%1 edx+2%1 %0+8%1 edx+4%1 ecx
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1762
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1763 #define REAL_DEINT_L5(t1,t2,a,b,c)\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1764 "movq " #a ", %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1765 "movq " #b ", %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1766 "movq " #c ", %%mm4 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1767 PAVGB(t2, %%mm3) \
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1768 PAVGB(t1, %%mm4) \
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1769 "movq %%mm2, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1770 "movq %%mm2, " #t1 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1771 "punpcklbw %%mm7, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1772 "punpckhbw %%mm7, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1773 "movq %%mm2, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1774 "paddw %%mm2, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1775 "paddw %%mm6, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1776 "movq %%mm5, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1777 "paddw %%mm5, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1778 "paddw %%mm6, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1779 "movq %%mm3, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1780 "punpcklbw %%mm7, %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1781 "punpckhbw %%mm7, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1782 "paddw %%mm3, %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1783 "paddw %%mm6, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1784 "paddw %%mm3, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1785 "paddw %%mm6, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1786 "movq %%mm4, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1787 "punpcklbw %%mm7, %%mm4 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1788 "punpckhbw %%mm7, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1789 "psubw %%mm4, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1790 "psubw %%mm6, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1791 "psraw $2, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1792 "psraw $2, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1793 "packuswb %%mm5, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1794 "movq %%mm2, " #a " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1795
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1796 #define DEINT_L5(t1,t2,a,b,c) REAL_DEINT_L5(t1,t2,a,b,c)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1797
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1798 DEINT_L5(%%mm0, %%mm1, (%0) , (%%REGa) , (%%REGa, %1) )
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1799 DEINT_L5(%%mm1, %%mm0, (%%REGa) , (%%REGa, %1) , (%%REGa, %1, 2))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1800 DEINT_L5(%%mm0, %%mm1, (%%REGa, %1) , (%%REGa, %1, 2), (%0, %1, 4) )
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1801 DEINT_L5(%%mm1, %%mm0, (%%REGa, %1, 2), (%0, %1, 4) , (%%REGd) )
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1802 DEINT_L5(%%mm0, %%mm1, (%0, %1, 4) , (%%REGd) , (%%REGd, %1) )
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1803 DEINT_L5(%%mm1, %%mm0, (%%REGd) , (%%REGd, %1) , (%%REGd, %1, 2))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1804 DEINT_L5(%%mm0, %%mm1, (%%REGd, %1) , (%%REGd, %1, 2), (%0, %1, 8) )
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1805 DEINT_L5(%%mm1, %%mm0, (%%REGd, %1, 2), (%0, %1, 8) , (%%REGd, %1, 4))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1806
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1807 "movq %%mm0, (%2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1808 "movq %%mm1, (%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1809 : : "r" (src), "r" ((long)stride), "r"(tmp), "r"(tmp2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1810 : "%"REG_a, "%"REG_d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1811 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1812 #else //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1813 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1814 src+= stride*4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1815 for(x=0; x<8; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1816 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1817 int t1= tmp[x];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1818 int t2= tmp2[x];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1819 int t3= src[0];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1820
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1821 src[stride*0]= CLIP((-(t1 + src[stride*2]) + 2*(t2 + src[stride*1]) + 6*t3 + 4)>>3);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1822 t1= src[stride*1];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1823 src[stride*1]= CLIP((-(t2 + src[stride*3]) + 2*(t3 + src[stride*2]) + 6*t1 + 4)>>3);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1824 t2= src[stride*2];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1825 src[stride*2]= CLIP((-(t3 + src[stride*4]) + 2*(t1 + src[stride*3]) + 6*t2 + 4)>>3);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1826 t3= src[stride*3];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1827 src[stride*3]= CLIP((-(t1 + src[stride*5]) + 2*(t2 + src[stride*4]) + 6*t3 + 4)>>3);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1828 t1= src[stride*4];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1829 src[stride*4]= CLIP((-(t2 + src[stride*6]) + 2*(t3 + src[stride*5]) + 6*t1 + 4)>>3);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1830 t2= src[stride*5];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1831 src[stride*5]= CLIP((-(t3 + src[stride*7]) + 2*(t1 + src[stride*6]) + 6*t2 + 4)>>3);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1832 t3= src[stride*6];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1833 src[stride*6]= CLIP((-(t1 + src[stride*8]) + 2*(t2 + src[stride*7]) + 6*t3 + 4)>>3);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1834 t1= src[stride*7];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1835 src[stride*7]= CLIP((-(t2 + src[stride*9]) + 2*(t3 + src[stride*8]) + 6*t1 + 4)>>3);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1836
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1837 tmp[x]= t3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1838 tmp2[x]= t1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1839
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1840 src++;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1841 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1842 #endif //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1843 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1844
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1845 /**
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1846 * Deinterlaces the given block by filtering all lines with a (1 2 1) filter.
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1847 * will be called for every 8x8 block and can read & write from line 4-15
90
8e738e0a16f5 typo fixes
diego
parents: 78
diff changeset
1848 * lines 0-3 have been passed through the deblock / dering filters already, but can be read, too.
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1849 * lines 4-12 will be read into the deblocking filter and should be deinterlaced
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1850 * this filter will read lines 4-13 and write 4-11
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1851 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1852 static inline void RENAME(deInterlaceBlendLinear)(uint8_t src[], int stride, uint8_t *tmp)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1853 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1854 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1855 src+= 4*stride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1856 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1857 "lea (%0, %1), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1858 "lea (%%"REG_a", %1, 4), %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1859 // 0 1 2 3 4 5 6 7 8 9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1860 // %0 eax eax+%1 eax+2%1 %0+4%1 edx edx+%1 edx+2%1 %0+8%1 edx+4%1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1861
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1862 "movq (%2), %%mm0 \n\t" // L0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1863 "movq (%%"REG_a"), %%mm1 \n\t" // L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1864 PAVGB(%%mm1, %%mm0) // L0+L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1865 "movq (%0), %%mm2 \n\t" // L1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1866 PAVGB(%%mm2, %%mm0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1867 "movq %%mm0, (%0) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1868 "movq (%%"REG_a", %1), %%mm0 \n\t" // L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1869 PAVGB(%%mm0, %%mm2) // L1+L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1870 PAVGB(%%mm1, %%mm2) // 2L2 + L1 + L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1871 "movq %%mm2, (%%"REG_a") \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1872 "movq (%%"REG_a", %1, 2), %%mm2 \n\t" // L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1873 PAVGB(%%mm2, %%mm1) // L2+L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1874 PAVGB(%%mm0, %%mm1) // 2L3 + L2 + L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1875 "movq %%mm1, (%%"REG_a", %1) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1876 "movq (%0, %1, 4), %%mm1 \n\t" // L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1877 PAVGB(%%mm1, %%mm0) // L3+L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1878 PAVGB(%%mm2, %%mm0) // 2L4 + L3 + L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1879 "movq %%mm0, (%%"REG_a", %1, 2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1880 "movq (%%"REG_d"), %%mm0 \n\t" // L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1881 PAVGB(%%mm0, %%mm2) // L4+L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1882 PAVGB(%%mm1, %%mm2) // 2L5 + L4 + L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1883 "movq %%mm2, (%0, %1, 4) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1884 "movq (%%"REG_d", %1), %%mm2 \n\t" // L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1885 PAVGB(%%mm2, %%mm1) // L5+L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1886 PAVGB(%%mm0, %%mm1) // 2L6 + L5 + L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1887 "movq %%mm1, (%%"REG_d") \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1888 "movq (%%"REG_d", %1, 2), %%mm1 \n\t" // L8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1889 PAVGB(%%mm1, %%mm0) // L6+L8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1890 PAVGB(%%mm2, %%mm0) // 2L7 + L6 + L8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1891 "movq %%mm0, (%%"REG_d", %1) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1892 "movq (%0, %1, 8), %%mm0 \n\t" // L9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1893 PAVGB(%%mm0, %%mm2) // L7+L9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1894 PAVGB(%%mm1, %%mm2) // 2L8 + L7 + L9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1895 "movq %%mm2, (%%"REG_d", %1, 2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1896 "movq %%mm1, (%2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1897
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1898 : : "r" (src), "r" ((long)stride), "r" (tmp)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1899 : "%"REG_a, "%"REG_d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1900 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1901 #else //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1902 int a, b, c, x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1903 src+= 4*stride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1904
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1905 for(x=0; x<2; x++){
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1906 a= *(uint32_t*)&tmp[stride*0];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1907 b= *(uint32_t*)&src[stride*0];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1908 c= *(uint32_t*)&src[stride*1];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1909 a= (a&c) + (((a^c)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1910 *(uint32_t*)&src[stride*0]= (a|b) - (((a^b)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1911
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1912 a= *(uint32_t*)&src[stride*2];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1913 b= (a&b) + (((a^b)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1914 *(uint32_t*)&src[stride*1]= (c|b) - (((c^b)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1915
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1916 b= *(uint32_t*)&src[stride*3];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1917 c= (b&c) + (((b^c)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1918 *(uint32_t*)&src[stride*2]= (c|a) - (((c^a)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1919
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1920 c= *(uint32_t*)&src[stride*4];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1921 a= (a&c) + (((a^c)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1922 *(uint32_t*)&src[stride*3]= (a|b) - (((a^b)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1923
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1924 a= *(uint32_t*)&src[stride*5];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1925 b= (a&b) + (((a^b)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1926 *(uint32_t*)&src[stride*4]= (c|b) - (((c^b)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1927
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1928 b= *(uint32_t*)&src[stride*6];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1929 c= (b&c) + (((b^c)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1930 *(uint32_t*)&src[stride*5]= (c|a) - (((c^a)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1931
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1932 c= *(uint32_t*)&src[stride*7];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1933 a= (a&c) + (((a^c)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1934 *(uint32_t*)&src[stride*6]= (a|b) - (((a^b)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1935
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1936 a= *(uint32_t*)&src[stride*8];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1937 b= (a&b) + (((a^b)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1938 *(uint32_t*)&src[stride*7]= (c|b) - (((c^b)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1939
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1940 *(uint32_t*)&tmp[stride*0]= c;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1941 src += 4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1942 tmp += 4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1943 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1944 #endif //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1945 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1946
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1947 /**
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1948 * Deinterlaces the given block by applying a median filter to every second line.
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1949 * will be called for every 8x8 block and can read & write from line 4-15,
90
8e738e0a16f5 typo fixes
diego
parents: 78
diff changeset
1950 * lines 0-3 have been passed through the deblock / dering filters already, but can be read, too.
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1951 * lines 4-12 will be read into the deblocking filter and should be deinterlaced
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1952 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1953 static inline void RENAME(deInterlaceMedian)(uint8_t src[], int stride)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1954 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1955 #ifdef HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1956 src+= 4*stride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1957 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1958 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1959 "lea (%0, %1), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1960 "lea (%%"REG_a", %1, 4), %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1961 // 0 1 2 3 4 5 6 7 8 9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1962 // %0 eax eax+%1 eax+2%1 %0+4%1 edx edx+%1 edx+2%1 %0+8%1 edx+4%1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1963
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1964 "movq (%0), %%mm0 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1965 "movq (%%"REG_a", %1), %%mm2 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1966 "movq (%%"REG_a"), %%mm1 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1967 "movq %%mm0, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1968 "pmaxub %%mm1, %%mm0 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1969 "pminub %%mm3, %%mm1 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1970 "pmaxub %%mm2, %%mm1 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1971 "pminub %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1972 "movq %%mm0, (%%"REG_a") \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1973
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1974 "movq (%0, %1, 4), %%mm0 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1975 "movq (%%"REG_a", %1, 2), %%mm1 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1976 "movq %%mm2, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1977 "pmaxub %%mm1, %%mm2 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1978 "pminub %%mm3, %%mm1 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1979 "pmaxub %%mm0, %%mm1 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1980 "pminub %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1981 "movq %%mm2, (%%"REG_a", %1, 2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1982
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1983 "movq (%%"REG_d"), %%mm2 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1984 "movq (%%"REG_d", %1), %%mm1 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1985 "movq %%mm2, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1986 "pmaxub %%mm0, %%mm2 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1987 "pminub %%mm3, %%mm0 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1988 "pmaxub %%mm1, %%mm0 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1989 "pminub %%mm0, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1990 "movq %%mm2, (%%"REG_d") \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1991
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1992 "movq (%%"REG_d", %1, 2), %%mm2 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1993 "movq (%0, %1, 8), %%mm0 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1994 "movq %%mm2, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1995 "pmaxub %%mm0, %%mm2 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1996 "pminub %%mm3, %%mm0 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1997 "pmaxub %%mm1, %%mm0 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1998 "pminub %%mm0, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1999 "movq %%mm2, (%%"REG_d", %1, 2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2000
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2001
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2002 : : "r" (src), "r" ((long)stride)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2003 : "%"REG_a, "%"REG_d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2004 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2005
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2006 #else // MMX without MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2007 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2008 "lea (%0, %1), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2009 "lea (%%"REG_a", %1, 4), %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2010 // 0 1 2 3 4 5 6 7 8 9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2011 // %0 eax eax+%1 eax+2%1 %0+4%1 edx edx+%1 edx+2%1 %0+8%1 edx+4%1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2012 "pxor %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2013
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2014 #define REAL_MEDIAN(a,b,c)\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2015 "movq " #a ", %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2016 "movq " #b ", %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2017 "movq " #c ", %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2018 "movq %%mm0, %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2019 "movq %%mm1, %%mm4 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2020 "movq %%mm2, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2021 "psubusb %%mm1, %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2022 "psubusb %%mm2, %%mm4 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2023 "psubusb %%mm0, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2024 "pcmpeqb %%mm7, %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2025 "pcmpeqb %%mm7, %%mm4 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2026 "pcmpeqb %%mm7, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2027 "movq %%mm3, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2028 "pxor %%mm4, %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2029 "pxor %%mm5, %%mm4 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2030 "pxor %%mm6, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2031 "por %%mm3, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2032 "por %%mm4, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2033 "por %%mm5, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2034 "pand %%mm2, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2035 "pand %%mm1, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2036 "movq %%mm0, " #b " \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2037 #define MEDIAN(a,b,c) REAL_MEDIAN(a,b,c)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2038
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2039 MEDIAN((%0) , (%%REGa) , (%%REGa, %1))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2040 MEDIAN((%%REGa, %1), (%%REGa, %1, 2), (%0, %1, 4))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2041 MEDIAN((%0, %1, 4) , (%%REGd) , (%%REGd, %1))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2042 MEDIAN((%%REGd, %1), (%%REGd, %1, 2), (%0, %1, 8))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2043
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2044 : : "r" (src), "r" ((long)stride)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2045 : "%"REG_a, "%"REG_d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2046 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2047 #endif //HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2048 #else //HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2049 int x, y;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2050 src+= 4*stride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2051 // FIXME - there should be a way to do a few columns in parallel like w/mmx
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2052 for(x=0; x<8; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2053 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2054 uint8_t *colsrc = src;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2055 for (y=0; y<4; y++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2056 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2057 int a, b, c, d, e, f;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2058 a = colsrc[0 ];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2059 b = colsrc[stride ];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2060 c = colsrc[stride*2];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2061 d = (a-b)>>31;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2062 e = (b-c)>>31;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2063 f = (c-a)>>31;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2064 colsrc[stride ] = (a|(d^f)) & (b|(d^e)) & (c|(e^f));
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2065 colsrc += stride*2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2066 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2067 src++;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2068 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2069 #endif //HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2070 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2071
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2072 #ifdef HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2073 /**
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2074 * transposes and shift the given 8x8 Block into dst1 and dst2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2075 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2076 static inline void RENAME(transpose1)(uint8_t *dst1, uint8_t *dst2, uint8_t *src, int srcStride)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2077 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2078 asm(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2079 "lea (%0, %1), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2080 // 0 1 2 3 4 5 6 7 8 9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2081 // %0 eax eax+%1 eax+2%1 %0+4%1 edx edx+%1 edx+2%1 %0+8%1 edx+4%1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2082 "movq (%0), %%mm0 \n\t" // 12345678
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2083 "movq (%%"REG_a"), %%mm1 \n\t" // abcdefgh
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2084 "movq %%mm0, %%mm2 \n\t" // 12345678
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2085 "punpcklbw %%mm1, %%mm0 \n\t" // 1a2b3c4d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2086 "punpckhbw %%mm1, %%mm2 \n\t" // 5e6f7g8h
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2087
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2088 "movq (%%"REG_a", %1), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2089 "movq (%%"REG_a", %1, 2), %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2090 "movq %%mm1, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2091 "punpcklbw %%mm3, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2092 "punpckhbw %%mm3, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2093
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2094 "movq %%mm0, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2095 "punpcklwd %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2096 "punpckhwd %%mm1, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2097 "movq %%mm2, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2098 "punpcklwd %%mm4, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2099 "punpckhwd %%mm4, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2100
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2101 "movd %%mm0, 128(%2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2102 "psrlq $32, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2103 "movd %%mm0, 144(%2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2104 "movd %%mm3, 160(%2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2105 "psrlq $32, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2106 "movd %%mm3, 176(%2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2107 "movd %%mm3, 48(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2108 "movd %%mm2, 192(%2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2109 "movd %%mm2, 64(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2110 "psrlq $32, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2111 "movd %%mm2, 80(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2112 "movd %%mm1, 96(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2113 "psrlq $32, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2114 "movd %%mm1, 112(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2115
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2116 "lea (%%"REG_a", %1, 4), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2117
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2118 "movq (%0, %1, 4), %%mm0 \n\t" // 12345678
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2119 "movq (%%"REG_a"), %%mm1 \n\t" // abcdefgh
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2120 "movq %%mm0, %%mm2 \n\t" // 12345678
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2121 "punpcklbw %%mm1, %%mm0 \n\t" // 1a2b3c4d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2122 "punpckhbw %%mm1, %%mm2 \n\t" // 5e6f7g8h
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2123
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2124 "movq (%%"REG_a", %1), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2125 "movq (%%"REG_a", %1, 2), %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2126 "movq %%mm1, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2127 "punpcklbw %%mm3, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2128 "punpckhbw %%mm3, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2129
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2130 "movq %%mm0, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2131 "punpcklwd %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2132 "punpckhwd %%mm1, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2133 "movq %%mm2, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2134 "punpcklwd %%mm4, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2135 "punpckhwd %%mm4, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2136
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2137 "movd %%mm0, 132(%2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2138 "psrlq $32, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2139 "movd %%mm0, 148(%2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2140 "movd %%mm3, 164(%2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2141 "psrlq $32, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2142 "movd %%mm3, 180(%2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2143 "movd %%mm3, 52(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2144 "movd %%mm2, 196(%2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2145 "movd %%mm2, 68(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2146 "psrlq $32, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2147 "movd %%mm2, 84(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2148 "movd %%mm1, 100(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2149 "psrlq $32, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2150 "movd %%mm1, 116(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2151
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2152
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2153 :: "r" (src), "r" ((long)srcStride), "r" (dst1), "r" (dst2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2154 : "%"REG_a
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2155 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2156 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2157
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2158 /**
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2159 * transposes the given 8x8 block
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2160 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2161 static inline void RENAME(transpose2)(uint8_t *dst, int dstStride, uint8_t *src)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2162 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2163 asm(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2164 "lea (%0, %1), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2165 "lea (%%"REG_a",%1,4), %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2166 // 0 1 2 3 4 5 6 7 8 9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2167 // %0 eax eax+%1 eax+2%1 %0+4%1 edx edx+%1 edx+2%1 %0+8%1 edx+4%1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2168 "movq (%2), %%mm0 \n\t" // 12345678
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2169 "movq 16(%2), %%mm1 \n\t" // abcdefgh
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2170 "movq %%mm0, %%mm2 \n\t" // 12345678
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2171 "punpcklbw %%mm1, %%mm0 \n\t" // 1a2b3c4d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2172 "punpckhbw %%mm1, %%mm2 \n\t" // 5e6f7g8h
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2173
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2174 "movq 32(%2), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2175 "movq 48(%2), %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2176 "movq %%mm1, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2177 "punpcklbw %%mm3, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2178 "punpckhbw %%mm3, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2179
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2180 "movq %%mm0, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2181 "punpcklwd %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2182 "punpckhwd %%mm1, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2183 "movq %%mm2, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2184 "punpcklwd %%mm4, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2185 "punpckhwd %%mm4, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2186
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2187 "movd %%mm0, (%0) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2188 "psrlq $32, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2189 "movd %%mm0, (%%"REG_a") \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2190 "movd %%mm3, (%%"REG_a", %1) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2191 "psrlq $32, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2192 "movd %%mm3, (%%"REG_a", %1, 2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2193 "movd %%mm2, (%0, %1, 4) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2194 "psrlq $32, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2195 "movd %%mm2, (%%"REG_d") \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2196 "movd %%mm1, (%%"REG_d", %1) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2197 "psrlq $32, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2198 "movd %%mm1, (%%"REG_d", %1, 2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2199
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2200
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2201 "movq 64(%2), %%mm0 \n\t" // 12345678
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2202 "movq 80(%2), %%mm1 \n\t" // abcdefgh
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2203 "movq %%mm0, %%mm2 \n\t" // 12345678
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2204 "punpcklbw %%mm1, %%mm0 \n\t" // 1a2b3c4d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2205 "punpckhbw %%mm1, %%mm2 \n\t" // 5e6f7g8h
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2206
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2207 "movq 96(%2), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2208 "movq 112(%2), %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2209 "movq %%mm1, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2210 "punpcklbw %%mm3, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2211 "punpckhbw %%mm3, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2212
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2213 "movq %%mm0, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2214 "punpcklwd %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2215 "punpckhwd %%mm1, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2216 "movq %%mm2, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2217 "punpcklwd %%mm4, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2218 "punpckhwd %%mm4, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2219
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2220 "movd %%mm0, 4(%0) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2221 "psrlq $32, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2222 "movd %%mm0, 4(%%"REG_a") \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2223 "movd %%mm3, 4(%%"REG_a", %1) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2224 "psrlq $32, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2225 "movd %%mm3, 4(%%"REG_a", %1, 2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2226 "movd %%mm2, 4(%0, %1, 4) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2227 "psrlq $32, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2228 "movd %%mm2, 4(%%"REG_d") \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2229 "movd %%mm1, 4(%%"REG_d", %1) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2230 "psrlq $32, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2231 "movd %%mm1, 4(%%"REG_d", %1, 2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2232
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2233 :: "r" (dst), "r" ((long)dstStride), "r" (src)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2234 : "%"REG_a, "%"REG_d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2235 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2236 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2237 #endif //HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2238 //static long test=0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2239
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2240 #ifndef HAVE_ALTIVEC
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2241 static inline void RENAME(tempNoiseReducer)(uint8_t *src, int stride,
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2242 uint8_t *tempBlured, uint32_t *tempBluredPast, int *maxNoise)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2243 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2244 // to save a register (FIXME do this outside of the loops)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2245 tempBluredPast[127]= maxNoise[0];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2246 tempBluredPast[128]= maxNoise[1];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2247 tempBluredPast[129]= maxNoise[2];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2248
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2249 #define FAST_L2_DIFF
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2250 //#define L1_DIFF //u should change the thresholds too if u try that one
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2251 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2252 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2253 "lea (%2, %2, 2), %%"REG_a" \n\t" // 3*stride
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2254 "lea (%2, %2, 4), %%"REG_d" \n\t" // 5*stride
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2255 "lea (%%"REG_d", %2, 2), %%"REG_c" \n\t" // 7*stride
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2256 // 0 1 2 3 4 5 6 7 8 9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2257 // %x %x+%2 %x+2%2 %x+eax %x+4%2 %x+edx %x+2eax %x+ecx %x+8%2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2258 //FIXME reorder?
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2259 #ifdef L1_DIFF //needs mmx2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2260 "movq (%0), %%mm0 \n\t" // L0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2261 "psadbw (%1), %%mm0 \n\t" // |L0-R0|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2262 "movq (%0, %2), %%mm1 \n\t" // L1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2263 "psadbw (%1, %2), %%mm1 \n\t" // |L1-R1|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2264 "movq (%0, %2, 2), %%mm2 \n\t" // L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2265 "psadbw (%1, %2, 2), %%mm2 \n\t" // |L2-R2|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2266 "movq (%0, %%"REG_a"), %%mm3 \n\t" // L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2267 "psadbw (%1, %%"REG_a"), %%mm3 \n\t" // |L3-R3|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2268
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2269 "movq (%0, %2, 4), %%mm4 \n\t" // L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2270 "paddw %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2271 "psadbw (%1, %2, 4), %%mm4 \n\t" // |L4-R4|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2272 "movq (%0, %%"REG_d"), %%mm5 \n\t" // L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2273 "paddw %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2274 "psadbw (%1, %%"REG_d"), %%mm5 \n\t" // |L5-R5|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2275 "movq (%0, %%"REG_a", 2), %%mm6 \n\t" // L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2276 "paddw %%mm3, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2277 "psadbw (%1, %%"REG_a", 2), %%mm6 \n\t" // |L6-R6|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2278 "movq (%0, %%"REG_c"), %%mm7 \n\t" // L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2279 "paddw %%mm4, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2280 "psadbw (%1, %%"REG_c"), %%mm7 \n\t" // |L7-R7|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2281 "paddw %%mm5, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2282 "paddw %%mm7, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2283 "paddw %%mm6, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2284 #else //L1_DIFF
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2285 #if defined (FAST_L2_DIFF)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2286 "pcmpeqb %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2287 "movq "MANGLE(b80)", %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2288 "pxor %%mm0, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2289 #define REAL_L2_DIFF_CORE(a, b)\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2290 "movq " #a ", %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2291 "movq " #b ", %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2292 "pxor %%mm7, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2293 PAVGB(%%mm2, %%mm5)\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2294 "paddb %%mm6, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2295 "movq %%mm5, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2296 "psllw $8, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2297 "pmaddwd %%mm5, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2298 "pmaddwd %%mm2, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2299 "paddd %%mm2, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2300 "psrld $14, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2301 "paddd %%mm5, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2302
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2303 #else //defined (FAST_L2_DIFF)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2304 "pxor %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2305 "pxor %%mm0, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2306 #define REAL_L2_DIFF_CORE(a, b)\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2307 "movq " #a ", %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2308 "movq " #b ", %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2309 "movq %%mm5, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2310 "movq %%mm2, %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2311 "punpcklbw %%mm7, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2312 "punpckhbw %%mm7, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2313 "punpcklbw %%mm7, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2314 "punpckhbw %%mm7, %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2315 "psubw %%mm2, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2316 "psubw %%mm3, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2317 "pmaddwd %%mm5, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2318 "pmaddwd %%mm1, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2319 "paddd %%mm1, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2320 "paddd %%mm5, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2321
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2322 #endif //defined (FAST_L2_DIFF)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2323
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2324 #define L2_DIFF_CORE(a, b) REAL_L2_DIFF_CORE(a, b)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2325
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2326 L2_DIFF_CORE((%0) , (%1))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2327 L2_DIFF_CORE((%0, %2) , (%1, %2))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2328 L2_DIFF_CORE((%0, %2, 2) , (%1, %2, 2))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2329 L2_DIFF_CORE((%0, %%REGa) , (%1, %%REGa))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2330 L2_DIFF_CORE((%0, %2, 4) , (%1, %2, 4))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2331 L2_DIFF_CORE((%0, %%REGd) , (%1, %%REGd))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2332 L2_DIFF_CORE((%0, %%REGa,2), (%1, %%REGa,2))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2333 L2_DIFF_CORE((%0, %%REGc) , (%1, %%REGc))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2334
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2335 #endif //L1_DIFF
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2336
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2337 "movq %%mm0, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2338 "psrlq $32, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2339 "paddd %%mm0, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2340 "movd %%mm4, %%ecx \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2341 "shll $2, %%ecx \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2342 "mov %3, %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2343 "addl -4(%%"REG_d"), %%ecx \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2344 "addl 4(%%"REG_d"), %%ecx \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2345 "addl -1024(%%"REG_d"), %%ecx \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2346 "addl $4, %%ecx \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2347 "addl 1024(%%"REG_d"), %%ecx \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2348 "shrl $3, %%ecx \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2349 "movl %%ecx, (%%"REG_d") \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2350
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2351 // "mov %3, %%"REG_c" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2352 // "mov %%"REG_c", test \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2353 // "jmp 4f \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2354 "cmpl 512(%%"REG_d"), %%ecx \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2355 " jb 2f \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2356 "cmpl 516(%%"REG_d"), %%ecx \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2357 " jb 1f \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2358
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2359 "lea (%%"REG_a", %2, 2), %%"REG_d" \n\t" // 5*stride
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2360 "lea (%%"REG_d", %2, 2), %%"REG_c" \n\t" // 7*stride
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2361 "movq (%0), %%mm0 \n\t" // L0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2362 "movq (%0, %2), %%mm1 \n\t" // L1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2363 "movq (%0, %2, 2), %%mm2 \n\t" // L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2364 "movq (%0, %%"REG_a"), %%mm3 \n\t" // L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2365 "movq (%0, %2, 4), %%mm4 \n\t" // L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2366 "movq (%0, %%"REG_d"), %%mm5 \n\t" // L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2367 "movq (%0, %%"REG_a", 2), %%mm6 \n\t" // L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2368 "movq (%0, %%"REG_c"), %%mm7 \n\t" // L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2369 "movq %%mm0, (%1) \n\t" // L0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2370 "movq %%mm1, (%1, %2) \n\t" // L1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2371 "movq %%mm2, (%1, %2, 2) \n\t" // L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2372 "movq %%mm3, (%1, %%"REG_a") \n\t" // L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2373 "movq %%mm4, (%1, %2, 4) \n\t" // L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2374 "movq %%mm5, (%1, %%"REG_d") \n\t" // L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2375 "movq %%mm6, (%1, %%"REG_a", 2) \n\t" // L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2376 "movq %%mm7, (%1, %%"REG_c") \n\t" // L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2377 "jmp 4f \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2378
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2379 "1: \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2380 "lea (%%"REG_a", %2, 2), %%"REG_d" \n\t" // 5*stride
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2381 "lea (%%"REG_d", %2, 2), %%"REG_c" \n\t" // 7*stride
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2382 "movq (%0), %%mm0 \n\t" // L0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2383 PAVGB((%1), %%mm0) // L0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2384 "movq (%0, %2), %%mm1 \n\t" // L1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2385 PAVGB((%1, %2), %%mm1) // L1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2386 "movq (%0, %2, 2), %%mm2 \n\t" // L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2387 PAVGB((%1, %2, 2), %%mm2) // L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2388 "movq (%0, %%"REG_a"), %%mm3 \n\t" // L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2389 PAVGB((%1, %%REGa), %%mm3) // L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2390 "movq (%0, %2, 4), %%mm4 \n\t" // L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2391 PAVGB((%1, %2, 4), %%mm4) // L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2392 "movq (%0, %%"REG_d"), %%mm5 \n\t" // L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2393 PAVGB((%1, %%REGd), %%mm5) // L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2394 "movq (%0, %%"REG_a", 2), %%mm6 \n\t" // L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2395 PAVGB((%1, %%REGa, 2), %%mm6) // L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2396 "movq (%0, %%"REG_c"), %%mm7 \n\t" // L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2397 PAVGB((%1, %%REGc), %%mm7) // L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2398 "movq %%mm0, (%1) \n\t" // R0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2399 "movq %%mm1, (%1, %2) \n\t" // R1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2400 "movq %%mm2, (%1, %2, 2) \n\t" // R2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2401 "movq %%mm3, (%1, %%"REG_a") \n\t" // R3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2402 "movq %%mm4, (%1, %2, 4) \n\t" // R4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2403 "movq %%mm5, (%1, %%"REG_d") \n\t" // R5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2404 "movq %%mm6, (%1, %%"REG_a", 2) \n\t" // R6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2405 "movq %%mm7, (%1, %%"REG_c") \n\t" // R7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2406 "movq %%mm0, (%0) \n\t" // L0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2407 "movq %%mm1, (%0, %2) \n\t" // L1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2408 "movq %%mm2, (%0, %2, 2) \n\t" // L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2409 "movq %%mm3, (%0, %%"REG_a") \n\t" // L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2410 "movq %%mm4, (%0, %2, 4) \n\t" // L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2411 "movq %%mm5, (%0, %%"REG_d") \n\t" // L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2412 "movq %%mm6, (%0, %%"REG_a", 2) \n\t" // L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2413 "movq %%mm7, (%0, %%"REG_c") \n\t" // L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2414 "jmp 4f \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2415
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2416 "2: \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2417 "cmpl 508(%%"REG_d"), %%ecx \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2418 " jb 3f \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2419
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2420 "lea (%%"REG_a", %2, 2), %%"REG_d" \n\t" // 5*stride
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2421 "lea (%%"REG_d", %2, 2), %%"REG_c" \n\t" // 7*stride
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2422 "movq (%0), %%mm0 \n\t" // L0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2423 "movq (%0, %2), %%mm1 \n\t" // L1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2424 "movq (%0, %2, 2), %%mm2 \n\t" // L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2425 "movq (%0, %%"REG_a"), %%mm3 \n\t" // L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2426 "movq (%1), %%mm4 \n\t" // R0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2427 "movq (%1, %2), %%mm5 \n\t" // R1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2428 "movq (%1, %2, 2), %%mm6 \n\t" // R2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2429 "movq (%1, %%"REG_a"), %%mm7 \n\t" // R3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2430 PAVGB(%%mm4, %%mm0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2431 PAVGB(%%mm5, %%mm1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2432 PAVGB(%%mm6, %%mm2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2433 PAVGB(%%mm7, %%mm3)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2434 PAVGB(%%mm4, %%mm0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2435 PAVGB(%%mm5, %%mm1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2436 PAVGB(%%mm6, %%mm2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2437 PAVGB(%%mm7, %%mm3)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2438 "movq %%mm0, (%1) \n\t" // R0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2439 "movq %%mm1, (%1, %2) \n\t" // R1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2440 "movq %%mm2, (%1, %2, 2) \n\t" // R2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2441 "movq %%mm3, (%1, %%"REG_a") \n\t" // R3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2442 "movq %%mm0, (%0) \n\t" // L0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2443 "movq %%mm1, (%0, %2) \n\t" // L1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2444 "movq %%mm2, (%0, %2, 2) \n\t" // L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2445 "movq %%mm3, (%0, %%"REG_a") \n\t" // L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2446
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2447 "movq (%0, %2, 4), %%mm0 \n\t" // L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2448 "movq (%0, %%"REG_d"), %%mm1 \n\t" // L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2449 "movq (%0, %%"REG_a", 2), %%mm2 \n\t" // L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2450 "movq (%0, %%"REG_c"), %%mm3 \n\t" // L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2451 "movq (%1, %2, 4), %%mm4 \n\t" // R4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2452 "movq (%1, %%"REG_d"), %%mm5 \n\t" // R5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2453 "movq (%1, %%"REG_a", 2), %%mm6 \n\t" // R6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2454 "movq (%1, %%"REG_c"), %%mm7 \n\t" // R7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2455 PAVGB(%%mm4, %%mm0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2456 PAVGB(%%mm5, %%mm1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2457 PAVGB(%%mm6, %%mm2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2458 PAVGB(%%mm7, %%mm3)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2459 PAVGB(%%mm4, %%mm0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2460 PAVGB(%%mm5, %%mm1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2461 PAVGB(%%mm6, %%mm2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2462 PAVGB(%%mm7, %%mm3)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2463 "movq %%mm0, (%1, %2, 4) \n\t" // R4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2464 "movq %%mm1, (%1, %%"REG_d") \n\t" // R5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2465 "movq %%mm2, (%1, %%"REG_a", 2) \n\t" // R6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2466 "movq %%mm3, (%1, %%"REG_c") \n\t" // R7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2467 "movq %%mm0, (%0, %2, 4) \n\t" // L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2468 "movq %%mm1, (%0, %%"REG_d") \n\t" // L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2469 "movq %%mm2, (%0, %%"REG_a", 2) \n\t" // L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2470 "movq %%mm3, (%0, %%"REG_c") \n\t" // L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2471 "jmp 4f \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2472
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2473 "3: \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2474 "lea (%%"REG_a", %2, 2), %%"REG_d" \n\t" // 5*stride
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2475 "lea (%%"REG_d", %2, 2), %%"REG_c" \n\t" // 7*stride
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2476 "movq (%0), %%mm0 \n\t" // L0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2477 "movq (%0, %2), %%mm1 \n\t" // L1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2478 "movq (%0, %2, 2), %%mm2 \n\t" // L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2479 "movq (%0, %%"REG_a"), %%mm3 \n\t" // L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2480 "movq (%1), %%mm4 \n\t" // R0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2481 "movq (%1, %2), %%mm5 \n\t" // R1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2482 "movq (%1, %2, 2), %%mm6 \n\t" // R2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2483 "movq (%1, %%"REG_a"), %%mm7 \n\t" // R3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2484 PAVGB(%%mm4, %%mm0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2485 PAVGB(%%mm5, %%mm1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2486 PAVGB(%%mm6, %%mm2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2487 PAVGB(%%mm7, %%mm3)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2488 PAVGB(%%mm4, %%mm0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2489 PAVGB(%%mm5, %%mm1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2490 PAVGB(%%mm6, %%mm2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2491 PAVGB(%%mm7, %%mm3)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2492 PAVGB(%%mm4, %%mm0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2493 PAVGB(%%mm5, %%mm1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2494 PAVGB(%%mm6, %%mm2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2495 PAVGB(%%mm7, %%mm3)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2496 "movq %%mm0, (%1) \n\t" // R0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2497 "movq %%mm1, (%1, %2) \n\t" // R1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2498 "movq %%mm2, (%1, %2, 2) \n\t" // R2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2499 "movq %%mm3, (%1, %%"REG_a") \n\t" // R3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2500 "movq %%mm0, (%0) \n\t" // L0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2501 "movq %%mm1, (%0, %2) \n\t" // L1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2502 "movq %%mm2, (%0, %2, 2) \n\t" // L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2503 "movq %%mm3, (%0, %%"REG_a") \n\t" // L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2504
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2505 "movq (%0, %2, 4), %%mm0 \n\t" // L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2506 "movq (%0, %%"REG_d"), %%mm1 \n\t" // L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2507 "movq (%0, %%"REG_a", 2), %%mm2 \n\t" // L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2508 "movq (%0, %%"REG_c"), %%mm3 \n\t" // L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2509 "movq (%1, %2, 4), %%mm4 \n\t" // R4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2510 "movq (%1, %%"REG_d"), %%mm5 \n\t" // R5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2511 "movq (%1, %%"REG_a", 2), %%mm6 \n\t" // R6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2512 "movq (%1, %%"REG_c"), %%mm7 \n\t" // R7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2513 PAVGB(%%mm4, %%mm0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2514 PAVGB(%%mm5, %%mm1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2515 PAVGB(%%mm6, %%mm2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2516 PAVGB(%%mm7, %%mm3)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2517 PAVGB(%%mm4, %%mm0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2518 PAVGB(%%mm5, %%mm1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2519 PAVGB(%%mm6, %%mm2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2520 PAVGB(%%mm7, %%mm3)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2521 PAVGB(%%mm4, %%mm0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2522 PAVGB(%%mm5, %%mm1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2523 PAVGB(%%mm6, %%mm2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2524 PAVGB(%%mm7, %%mm3)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2525 "movq %%mm0, (%1, %2, 4) \n\t" // R4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2526 "movq %%mm1, (%1, %%"REG_d") \n\t" // R5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2527 "movq %%mm2, (%1, %%"REG_a", 2) \n\t" // R6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2528 "movq %%mm3, (%1, %%"REG_c") \n\t" // R7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2529 "movq %%mm0, (%0, %2, 4) \n\t" // L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2530 "movq %%mm1, (%0, %%"REG_d") \n\t" // L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2531 "movq %%mm2, (%0, %%"REG_a", 2) \n\t" // L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2532 "movq %%mm3, (%0, %%"REG_c") \n\t" // L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2533
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2534 "4: \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2535
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2536 :: "r" (src), "r" (tempBlured), "r"((long)stride), "m" (tempBluredPast)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2537 : "%"REG_a, "%"REG_d, "%"REG_c, "memory"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2538 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2539 #else //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2540 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2541 int y;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2542 int d=0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2543 // int sysd=0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2544 int i;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2545
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2546 for(y=0; y<8; y++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2547 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2548 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2549 for(x=0; x<8; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2550 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2551 int ref= tempBlured[ x + y*stride ];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2552 int cur= src[ x + y*stride ];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2553 int d1=ref - cur;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2554 // if(x==0 || x==7) d1+= d1>>1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2555 // if(y==0 || y==7) d1+= d1>>1;
32
cb746db3fd32 Rename ABS macro to FFABS.
diego
parents: 31
diff changeset
2556 // d+= FFABS(d1);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2557 d+= d1*d1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2558 // sysd+= d1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2559 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2560 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2561 i=d;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2562 d= (
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2563 4*d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2564 +(*(tempBluredPast-256))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2565 +(*(tempBluredPast-1))+ (*(tempBluredPast+1))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2566 +(*(tempBluredPast+256))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2567 +4)>>3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2568 *tempBluredPast=i;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2569 // ((*tempBluredPast)*3 + d + 2)>>2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2570
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2571 /*
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2572 Switch between
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2573 1 0 0 0 0 0 0 (0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2574 64 32 16 8 4 2 1 (1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2575 64 48 36 27 20 15 11 (33) (approx)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2576 64 56 49 43 37 33 29 (200) (approx)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2577 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2578 if(d > maxNoise[1])
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2579 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2580 if(d < maxNoise[2])
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2581 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2582 for(y=0; y<8; y++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2583 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2584 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2585 for(x=0; x<8; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2586 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2587 int ref= tempBlured[ x + y*stride ];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2588 int cur= src[ x + y*stride ];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2589 tempBlured[ x + y*stride ]=
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2590 src[ x + y*stride ]=
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2591 (ref + cur + 1)>>1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2592 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2593 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2594 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2595 else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2596 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2597 for(y=0; y<8; y++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2598 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2599 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2600 for(x=0; x<8; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2601 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2602 tempBlured[ x + y*stride ]= src[ x + y*stride ];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2603 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2604 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2605 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2606 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2607 else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2608 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2609 if(d < maxNoise[0])
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2610 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2611 for(y=0; y<8; y++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2612 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2613 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2614 for(x=0; x<8; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2615 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2616 int ref= tempBlured[ x + y*stride ];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2617 int cur= src[ x + y*stride ];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2618 tempBlured[ x + y*stride ]=
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2619 src[ x + y*stride ]=
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2620 (ref*7 + cur + 4)>>3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2621 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2622 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2623 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2624 else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2625 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2626 for(y=0; y<8; y++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2627 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2628 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2629 for(x=0; x<8; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2630 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2631 int ref= tempBlured[ x + y*stride ];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2632 int cur= src[ x + y*stride ];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2633 tempBlured[ x + y*stride ]=
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2634 src[ x + y*stride ]=
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2635 (ref*3 + cur + 2)>>2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2636 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2637 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2638 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2639 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2640 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2641 #endif //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2642 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2643 #endif //HAVE_ALTIVEC
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2644
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2645 #ifdef HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2646 /**
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2647 * accurate deblock filter
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2648 */
38
63d07317cd7a rename always_inline to av_always_inline and move to common.h
mru
parents: 32
diff changeset
2649 static av_always_inline void RENAME(do_a_deblock)(uint8_t *src, int step, int stride, PPContext *c){
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2650 int64_t dc_mask, eq_mask, both_masks;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2651 int64_t sums[10*8*2];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2652 src+= step*3; // src points to begin of the 8x8 Block
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2653 //START_TIMER
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2654 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2655 "movq %0, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2656 "movq %1, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2657 : : "m" (c->mmxDcOffset[c->nonBQP]), "m" (c->mmxDcThreshold[c->nonBQP])
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2658 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2659
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2660 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2661 "lea (%2, %3), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2662 // 0 1 2 3 4 5 6 7 8 9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2663 // %1 eax eax+%2 eax+2%2 %1+4%2 ecx ecx+%2 ecx+2%2 %1+8%2 ecx+4%2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2664
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2665 "movq (%2), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2666 "movq (%%"REG_a"), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2667 "movq %%mm1, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2668 "movq %%mm1, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2669 "psubb %%mm1, %%mm0 \n\t" // mm0 = differnece
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2670 "paddb %%mm7, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2671 "pcmpgtb %%mm6, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2672
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2673 "movq (%%"REG_a",%3), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2674 PMAXUB(%%mm2, %%mm4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2675 PMINUB(%%mm2, %%mm3, %%mm5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2676 "psubb %%mm2, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2677 "paddb %%mm7, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2678 "pcmpgtb %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2679 "paddb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2680
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2681 "movq (%%"REG_a", %3, 2), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2682 PMAXUB(%%mm1, %%mm4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2683 PMINUB(%%mm1, %%mm3, %%mm5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2684 "psubb %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2685 "paddb %%mm7, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2686 "pcmpgtb %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2687 "paddb %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2688
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2689 "lea (%%"REG_a", %3, 4), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2690
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2691 "movq (%2, %3, 4), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2692 PMAXUB(%%mm2, %%mm4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2693 PMINUB(%%mm2, %%mm3, %%mm5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2694 "psubb %%mm2, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2695 "paddb %%mm7, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2696 "pcmpgtb %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2697 "paddb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2698
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2699 "movq (%%"REG_a"), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2700 PMAXUB(%%mm1, %%mm4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2701 PMINUB(%%mm1, %%mm3, %%mm5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2702 "psubb %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2703 "paddb %%mm7, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2704 "pcmpgtb %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2705 "paddb %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2706
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2707 "movq (%%"REG_a", %3), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2708 PMAXUB(%%mm2, %%mm4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2709 PMINUB(%%mm2, %%mm3, %%mm5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2710 "psubb %%mm2, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2711 "paddb %%mm7, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2712 "pcmpgtb %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2713 "paddb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2714
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2715 "movq (%%"REG_a", %3, 2), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2716 PMAXUB(%%mm1, %%mm4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2717 PMINUB(%%mm1, %%mm3, %%mm5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2718 "psubb %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2719 "paddb %%mm7, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2720 "pcmpgtb %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2721 "paddb %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2722
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2723 "movq (%2, %3, 8), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2724 PMAXUB(%%mm2, %%mm4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2725 PMINUB(%%mm2, %%mm3, %%mm5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2726 "psubb %%mm2, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2727 "paddb %%mm7, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2728 "pcmpgtb %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2729 "paddb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2730
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2731 "movq (%%"REG_a", %3, 4), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2732 "psubb %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2733 "paddb %%mm7, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2734 "pcmpgtb %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2735 "paddb %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2736 "psubusb %%mm3, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2737
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2738 "pxor %%mm6, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2739 "movq %4, %%mm7 \n\t" // QP,..., QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2740 "paddusb %%mm7, %%mm7 \n\t" // 2QP ... 2QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2741 "psubusb %%mm4, %%mm7 \n\t" // Diff >=2QP -> 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2742 "pcmpeqb %%mm6, %%mm7 \n\t" // Diff < 2QP -> 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2743 "pcmpeqb %%mm6, %%mm7 \n\t" // Diff < 2QP -> 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2744 "movq %%mm7, %1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2745
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2746 "movq %5, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2747 "punpcklbw %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2748 "punpcklbw %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2749 "punpcklbw %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2750 "psubb %%mm0, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2751 "pcmpgtb %%mm7, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2752 "movq %%mm6, %0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2753
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2754 : "=m" (eq_mask), "=m" (dc_mask)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2755 : "r" (src), "r" ((long)step), "m" (c->pQPb), "m"(c->ppMode.flatnessThreshold)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2756 : "%"REG_a
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2757 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2758
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2759 both_masks = dc_mask & eq_mask;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2760
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2761 if(both_masks){
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2762 long offset= -8*step;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2763 int64_t *temp_sums= sums;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2764
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2765 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2766 "movq %2, %%mm0 \n\t" // QP,..., QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2767 "pxor %%mm4, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2768
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2769 "movq (%0), %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2770 "movq (%0, %1), %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2771 "movq %%mm5, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2772 "movq %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2773 "psubusb %%mm6, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2774 "psubusb %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2775 "por %%mm5, %%mm2 \n\t" // ABS Diff of lines
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2776 "psubusb %%mm2, %%mm0 \n\t" // diff >= QP -> 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2777 "pcmpeqb %%mm4, %%mm0 \n\t" // diff >= QP -> FF
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2778
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2779 "pxor %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2780 "pand %%mm0, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2781 "pxor %%mm1, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2782 // 0:QP 6:First
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2783
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2784 "movq (%0, %1, 8), %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2785 "add %1, %0 \n\t" // %0 points to line 1 not 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2786 "movq (%0, %1, 8), %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2787 "movq %%mm5, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2788 "movq %%mm7, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2789 "psubusb %%mm7, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2790 "psubusb %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2791 "por %%mm5, %%mm2 \n\t" // ABS Diff of lines
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2792 "movq %2, %%mm0 \n\t" // QP,..., QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2793 "psubusb %%mm2, %%mm0 \n\t" // diff >= QP -> 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2794 "pcmpeqb %%mm4, %%mm0 \n\t" // diff >= QP -> FF
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2795
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2796 "pxor %%mm7, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2797 "pand %%mm0, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2798 "pxor %%mm1, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2799
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2800 "movq %%mm6, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2801 "punpckhbw %%mm4, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2802 "punpcklbw %%mm4, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2803 // 4:0 5/6:First 7:Last
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2804
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2805 "movq %%mm5, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2806 "movq %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2807 "psllw $2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2808 "psllw $2, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2809 "paddw "MANGLE(w04)", %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2810 "paddw "MANGLE(w04)", %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2811
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2812 #define NEXT\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2813 "movq (%0), %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2814 "movq (%0), %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2815 "add %1, %0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2816 "punpcklbw %%mm4, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2817 "punpckhbw %%mm4, %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2818 "paddw %%mm2, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2819 "paddw %%mm3, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2820
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2821 #define PREV\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2822 "movq (%0), %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2823 "movq (%0), %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2824 "add %1, %0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2825 "punpcklbw %%mm4, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2826 "punpckhbw %%mm4, %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2827 "psubw %%mm2, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2828 "psubw %%mm3, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2829
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2830
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2831 NEXT //0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2832 NEXT //1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2833 NEXT //2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2834 "movq %%mm0, (%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2835 "movq %%mm1, 8(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2836
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2837 NEXT //3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2838 "psubw %%mm5, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2839 "psubw %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2840 "movq %%mm0, 16(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2841 "movq %%mm1, 24(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2842
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2843 NEXT //4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2844 "psubw %%mm5, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2845 "psubw %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2846 "movq %%mm0, 32(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2847 "movq %%mm1, 40(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2848
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2849 NEXT //5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2850 "psubw %%mm5, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2851 "psubw %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2852 "movq %%mm0, 48(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2853 "movq %%mm1, 56(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2854
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2855 NEXT //6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2856 "psubw %%mm5, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2857 "psubw %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2858 "movq %%mm0, 64(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2859 "movq %%mm1, 72(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2860
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2861 "movq %%mm7, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2862 "punpckhbw %%mm4, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2863 "punpcklbw %%mm4, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2864
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2865 NEXT //7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2866 "mov %4, %0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2867 "add %1, %0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2868 PREV //0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2869 "movq %%mm0, 80(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2870 "movq %%mm1, 88(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2871
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2872 PREV //1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2873 "paddw %%mm6, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2874 "paddw %%mm7, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2875 "movq %%mm0, 96(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2876 "movq %%mm1, 104(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2877
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2878 PREV //2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2879 "paddw %%mm6, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2880 "paddw %%mm7, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2881 "movq %%mm0, 112(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2882 "movq %%mm1, 120(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2883
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2884 PREV //3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2885 "paddw %%mm6, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2886 "paddw %%mm7, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2887 "movq %%mm0, 128(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2888 "movq %%mm1, 136(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2889
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2890 PREV //4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2891 "paddw %%mm6, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2892 "paddw %%mm7, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2893 "movq %%mm0, 144(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2894 "movq %%mm1, 152(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2895
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2896 "mov %4, %0 \n\t" //FIXME
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2897
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2898 : "+&r"(src)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2899 : "r" ((long)step), "m" (c->pQPb), "r"(sums), "g"(src)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2900 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2901
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2902 src+= step; // src points to begin of the 8x8 Block
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2903
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2904 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2905 "movq %4, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2906 "pcmpeqb %%mm5, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2907 "pxor %%mm6, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2908 "pxor %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2909
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2910 "1: \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2911 "movq (%1), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2912 "movq 8(%1), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2913 "paddw 32(%1), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2914 "paddw 40(%1), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2915 "movq (%0, %3), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2916 "movq %%mm2, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2917 "movq %%mm2, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2918 "punpcklbw %%mm7, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2919 "punpckhbw %%mm7, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2920 "paddw %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2921 "paddw %%mm3, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2922 "paddw %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2923 "paddw %%mm3, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2924 "psrlw $4, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2925 "psrlw $4, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2926 "packuswb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2927 "pand %%mm6, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2928 "pand %%mm5, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2929 "por %%mm4, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2930 "movq %%mm0, (%0, %3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2931 "add $16, %1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2932 "add %2, %0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2933 " js 1b \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2934
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2935 : "+r"(offset), "+r"(temp_sums)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2936 : "r" ((long)step), "r"(src - offset), "m"(both_masks)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2937 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2938 }else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2939 src+= step; // src points to begin of the 8x8 Block
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2940
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2941 if(eq_mask != -1LL){
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2942 uint8_t *temp_src= src;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2943 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2944 "pxor %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2945 "lea -40(%%"REG_SP"), %%"REG_c" \n\t" // make space for 4 8-byte vars
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2946 "and "ALIGN_MASK", %%"REG_c" \n\t" // align
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2947 // 0 1 2 3 4 5 6 7 8 9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2948 // %0 eax eax+%1 eax+2%1 %0+4%1 ecx ecx+%1 ecx+2%1 %1+8%1 ecx+4%1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2949
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2950 "movq (%0), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2951 "movq %%mm0, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2952 "punpcklbw %%mm7, %%mm0 \n\t" // low part of line 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2953 "punpckhbw %%mm7, %%mm1 \n\t" // high part of line 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2954
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2955 "movq (%0, %1), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2956 "lea (%0, %1, 2), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2957 "movq %%mm2, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2958 "punpcklbw %%mm7, %%mm2 \n\t" // low part of line 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2959 "punpckhbw %%mm7, %%mm3 \n\t" // high part of line 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2960
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2961 "movq (%%"REG_a"), %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2962 "movq %%mm4, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2963 "punpcklbw %%mm7, %%mm4 \n\t" // low part of line 2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2964 "punpckhbw %%mm7, %%mm5 \n\t" // high part of line 2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2965
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2966 "paddw %%mm0, %%mm0 \n\t" // 2L0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2967 "paddw %%mm1, %%mm1 \n\t" // 2H0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2968 "psubw %%mm4, %%mm2 \n\t" // L1 - L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2969 "psubw %%mm5, %%mm3 \n\t" // H1 - H2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2970 "psubw %%mm2, %%mm0 \n\t" // 2L0 - L1 + L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2971 "psubw %%mm3, %%mm1 \n\t" // 2H0 - H1 + H2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2972
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2973 "psllw $2, %%mm2 \n\t" // 4L1 - 4L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2974 "psllw $2, %%mm3 \n\t" // 4H1 - 4H2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2975 "psubw %%mm2, %%mm0 \n\t" // 2L0 - 5L1 + 5L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2976 "psubw %%mm3, %%mm1 \n\t" // 2H0 - 5H1 + 5H2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2977
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2978 "movq (%%"REG_a", %1), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2979 "movq %%mm2, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2980 "punpcklbw %%mm7, %%mm2 \n\t" // L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2981 "punpckhbw %%mm7, %%mm3 \n\t" // H3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2982
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2983 "psubw %%mm2, %%mm0 \n\t" // 2L0 - 5L1 + 5L2 - L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2984 "psubw %%mm3, %%mm1 \n\t" // 2H0 - 5H1 + 5H2 - H3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2985 "psubw %%mm2, %%mm0 \n\t" // 2L0 - 5L1 + 5L2 - 2L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2986 "psubw %%mm3, %%mm1 \n\t" // 2H0 - 5H1 + 5H2 - 2H3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2987 "movq %%mm0, (%%"REG_c") \n\t" // 2L0 - 5L1 + 5L2 - 2L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2988 "movq %%mm1, 8(%%"REG_c") \n\t" // 2H0 - 5H1 + 5H2 - 2H3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2989
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2990 "movq (%%"REG_a", %1, 2), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2991 "movq %%mm0, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2992 "punpcklbw %%mm7, %%mm0 \n\t" // L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2993 "punpckhbw %%mm7, %%mm1 \n\t" // H4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2994
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2995 "psubw %%mm0, %%mm2 \n\t" // L3 - L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2996 "psubw %%mm1, %%mm3 \n\t" // H3 - H4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2997 "movq %%mm2, 16(%%"REG_c") \n\t" // L3 - L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2998 "movq %%mm3, 24(%%"REG_c") \n\t" // H3 - H4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2999 "paddw %%mm4, %%mm4 \n\t" // 2L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3000 "paddw %%mm5, %%mm5 \n\t" // 2H2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3001 "psubw %%mm2, %%mm4 \n\t" // 2L2 - L3 + L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3002 "psubw %%mm3, %%mm5 \n\t" // 2H2 - H3 + H4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3003
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3004 "lea (%%"REG_a", %1), %0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3005 "psllw $2, %%mm2 \n\t" // 4L3 - 4L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3006 "psllw $2, %%mm3 \n\t" // 4H3 - 4H4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3007 "psubw %%mm2, %%mm4 \n\t" // 2L2 - 5L3 + 5L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3008 "psubw %%mm3, %%mm5 \n\t" // 2H2 - 5H3 + 5H4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3009 //50 opcodes so far
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3010 "movq (%0, %1, 2), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3011 "movq %%mm2, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3012 "punpcklbw %%mm7, %%mm2 \n\t" // L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3013 "punpckhbw %%mm7, %%mm3 \n\t" // H5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3014 "psubw %%mm2, %%mm4 \n\t" // 2L2 - 5L3 + 5L4 - L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3015 "psubw %%mm3, %%mm5 \n\t" // 2H2 - 5H3 + 5H4 - H5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3016 "psubw %%mm2, %%mm4 \n\t" // 2L2 - 5L3 + 5L4 - 2L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3017 "psubw %%mm3, %%mm5 \n\t" // 2H2 - 5H3 + 5H4 - 2H5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3018
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3019 "movq (%%"REG_a", %1, 4), %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3020 "punpcklbw %%mm7, %%mm6 \n\t" // L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3021 "psubw %%mm6, %%mm2 \n\t" // L5 - L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3022 "movq (%%"REG_a", %1, 4), %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3023 "punpckhbw %%mm7, %%mm6 \n\t" // H6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3024 "psubw %%mm6, %%mm3 \n\t" // H5 - H6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3025
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3026 "paddw %%mm0, %%mm0 \n\t" // 2L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3027 "paddw %%mm1, %%mm1 \n\t" // 2H4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3028 "psubw %%mm2, %%mm0 \n\t" // 2L4 - L5 + L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3029 "psubw %%mm3, %%mm1 \n\t" // 2H4 - H5 + H6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3030
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3031 "psllw $2, %%mm2 \n\t" // 4L5 - 4L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3032 "psllw $2, %%mm3 \n\t" // 4H5 - 4H6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3033 "psubw %%mm2, %%mm0 \n\t" // 2L4 - 5L5 + 5L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3034 "psubw %%mm3, %%mm1 \n\t" // 2H4 - 5H5 + 5H6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3035
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3036 "movq (%0, %1, 4), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3037 "movq %%mm2, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3038 "punpcklbw %%mm7, %%mm2 \n\t" // L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3039 "punpckhbw %%mm7, %%mm3 \n\t" // H7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3040
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3041 "paddw %%mm2, %%mm2 \n\t" // 2L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3042 "paddw %%mm3, %%mm3 \n\t" // 2H7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3043 "psubw %%mm2, %%mm0 \n\t" // 2L4 - 5L5 + 5L6 - 2L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3044 "psubw %%mm3, %%mm1 \n\t" // 2H4 - 5H5 + 5H6 - 2H7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3045
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3046 "movq (%%"REG_c"), %%mm2 \n\t" // 2L0 - 5L1 + 5L2 - 2L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3047 "movq 8(%%"REG_c"), %%mm3 \n\t" // 2H0 - 5H1 + 5H2 - 2H3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3048
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3049 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3050 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3051 "psubw %%mm0, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3052 "pmaxsw %%mm6, %%mm0 \n\t" // |2L4 - 5L5 + 5L6 - 2L7|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3053 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3054 "psubw %%mm1, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3055 "pmaxsw %%mm6, %%mm1 \n\t" // |2H4 - 5H5 + 5H6 - 2H7|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3056 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3057 "psubw %%mm2, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3058 "pmaxsw %%mm6, %%mm2 \n\t" // |2L0 - 5L1 + 5L2 - 2L3|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3059 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3060 "psubw %%mm3, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3061 "pmaxsw %%mm6, %%mm3 \n\t" // |2H0 - 5H1 + 5H2 - 2H3|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3062 #else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3063 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3064 "pcmpgtw %%mm0, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3065 "pxor %%mm6, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3066 "psubw %%mm6, %%mm0 \n\t" // |2L4 - 5L5 + 5L6 - 2L7|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3067 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3068 "pcmpgtw %%mm1, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3069 "pxor %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3070 "psubw %%mm6, %%mm1 \n\t" // |2H4 - 5H5 + 5H6 - 2H7|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3071 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3072 "pcmpgtw %%mm2, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3073 "pxor %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3074 "psubw %%mm6, %%mm2 \n\t" // |2L0 - 5L1 + 5L2 - 2L3|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3075 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3076 "pcmpgtw %%mm3, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3077 "pxor %%mm6, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3078 "psubw %%mm6, %%mm3 \n\t" // |2H0 - 5H1 + 5H2 - 2H3|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3079 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3080
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3081 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3082 "pminsw %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3083 "pminsw %%mm3, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3084 #else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3085 "movq %%mm0, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3086 "psubusw %%mm2, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3087 "psubw %%mm6, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3088 "movq %%mm1, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3089 "psubusw %%mm3, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3090 "psubw %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3091 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3092
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3093 "movd %2, %%mm2 \n\t" // QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3094 "punpcklbw %%mm7, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3095
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3096 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3097 "pcmpgtw %%mm4, %%mm6 \n\t" // sign(2L2 - 5L3 + 5L4 - 2L5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3098 "pxor %%mm6, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3099 "psubw %%mm6, %%mm4 \n\t" // |2L2 - 5L3 + 5L4 - 2L5|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3100 "pcmpgtw %%mm5, %%mm7 \n\t" // sign(2H2 - 5H3 + 5H4 - 2H5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3101 "pxor %%mm7, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3102 "psubw %%mm7, %%mm5 \n\t" // |2H2 - 5H3 + 5H4 - 2H5|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3103 // 100 opcodes
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3104 "psllw $3, %%mm2 \n\t" // 8QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3105 "movq %%mm2, %%mm3 \n\t" // 8QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3106 "pcmpgtw %%mm4, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3107 "pcmpgtw %%mm5, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3108 "pand %%mm2, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3109 "pand %%mm3, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3110
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3111
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3112 "psubusw %%mm0, %%mm4 \n\t" // hd
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3113 "psubusw %%mm1, %%mm5 \n\t" // ld
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3114
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3115
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3116 "movq "MANGLE(w05)", %%mm2 \n\t" // 5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3117 "pmullw %%mm2, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3118 "pmullw %%mm2, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3119 "movq "MANGLE(w20)", %%mm2 \n\t" // 32
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3120 "paddw %%mm2, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3121 "paddw %%mm2, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3122 "psrlw $6, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3123 "psrlw $6, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3124
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3125 "movq 16(%%"REG_c"), %%mm0 \n\t" // L3 - L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3126 "movq 24(%%"REG_c"), %%mm1 \n\t" // H3 - H4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3127
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3128 "pxor %%mm2, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3129 "pxor %%mm3, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3130
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3131 "pcmpgtw %%mm0, %%mm2 \n\t" // sign (L3-L4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3132 "pcmpgtw %%mm1, %%mm3 \n\t" // sign (H3-H4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3133 "pxor %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3134 "pxor %%mm3, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3135 "psubw %%mm2, %%mm0 \n\t" // |L3-L4|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3136 "psubw %%mm3, %%mm1 \n\t" // |H3-H4|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3137 "psrlw $1, %%mm0 \n\t" // |L3 - L4|/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3138 "psrlw $1, %%mm1 \n\t" // |H3 - H4|/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3139
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3140 "pxor %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3141 "pxor %%mm7, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3142 "pand %%mm2, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3143 "pand %%mm3, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3144
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3145 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3146 "pminsw %%mm0, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3147 "pminsw %%mm1, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3148 #else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3149 "movq %%mm4, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3150 "psubusw %%mm0, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3151 "psubw %%mm2, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3152 "movq %%mm5, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3153 "psubusw %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3154 "psubw %%mm2, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3155 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3156 "pxor %%mm6, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3157 "pxor %%mm7, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3158 "psubw %%mm6, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3159 "psubw %%mm7, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3160 "packsswb %%mm5, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3161 "movq %3, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3162 "pandn %%mm4, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3163 "movq (%0), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3164 "paddb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3165 "movq %%mm0, (%0) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3166 "movq (%0, %1), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3167 "psubb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3168 "movq %%mm0, (%0, %1) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3169
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3170 : "+r" (temp_src)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3171 : "r" ((long)step), "m" (c->pQPb), "m"(eq_mask)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3172 : "%"REG_a, "%"REG_c
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3173 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3174 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3175 /*if(step==16){
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3176 STOP_TIMER("step16")
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3177 }else{
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3178 STOP_TIMER("stepX")
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3179 }*/
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3180 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3181 #endif //HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3182
78
michael
parents: 55
diff changeset
3183 static void RENAME(postProcess)(const uint8_t src[], int srcStride, uint8_t dst[], int dstStride, int width, int height,
michael
parents: 55
diff changeset
3184 const QP_STORE_T QPs[], int QPStride, int isColor, PPContext *c);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3185
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3186 /**
48
72675332ed82 misc spelling fixes
diego
parents: 45
diff changeset
3187 * Copies a block from src to dst and fixes the blacklevel.
72675332ed82 misc spelling fixes
diego
parents: 45
diff changeset
3188 * levelFix == 0 -> do not touch the brighness & contrast
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3189 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3190 #undef SCALED_CPY
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3191
78
michael
parents: 55
diff changeset
3192 static inline void RENAME(blockCopy)(uint8_t dst[], int dstStride, const uint8_t src[], int srcStride,
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3193 int levelFix, int64_t *packedOffsetAndScale)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3194 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3195 #ifndef HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3196 int i;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3197 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3198 if(levelFix)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3199 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3200 #ifdef HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3201 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3202 "movq (%%"REG_a"), %%mm2 \n\t" // packedYOffset
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3203 "movq 8(%%"REG_a"), %%mm3 \n\t" // packedYScale
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3204 "lea (%2,%4), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3205 "lea (%3,%5), %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3206 "pxor %%mm4, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3207 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3208 #define REAL_SCALED_CPY(src1, src2, dst1, dst2) \
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3209 "movq " #src1 ", %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3210 "movq " #src1 ", %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3211 "movq " #src2 ", %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3212 "movq " #src2 ", %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3213 "punpcklbw %%mm0, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3214 "punpckhbw %%mm5, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3215 "punpcklbw %%mm1, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3216 "punpckhbw %%mm6, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3217 "pmulhuw %%mm3, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3218 "pmulhuw %%mm3, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3219 "pmulhuw %%mm3, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3220 "pmulhuw %%mm3, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3221 "psubw %%mm2, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3222 "psubw %%mm2, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3223 "psubw %%mm2, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3224 "psubw %%mm2, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3225 "packuswb %%mm5, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3226 "packuswb %%mm6, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3227 "movq %%mm0, " #dst1 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3228 "movq %%mm1, " #dst2 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3229
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3230 #else //HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3231 #define REAL_SCALED_CPY(src1, src2, dst1, dst2) \
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3232 "movq " #src1 ", %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3233 "movq " #src1 ", %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3234 "punpcklbw %%mm4, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3235 "punpckhbw %%mm4, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3236 "psubw %%mm2, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3237 "psubw %%mm2, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3238 "movq " #src2 ", %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3239 "psllw $6, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3240 "psllw $6, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3241 "pmulhw %%mm3, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3242 "movq " #src2 ", %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3243 "pmulhw %%mm3, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3244 "punpcklbw %%mm4, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3245 "punpckhbw %%mm4, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3246 "psubw %%mm2, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3247 "psubw %%mm2, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3248 "psllw $6, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3249 "psllw $6, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3250 "pmulhw %%mm3, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3251 "pmulhw %%mm3, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3252 "packuswb %%mm5, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3253 "packuswb %%mm6, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3254 "movq %%mm0, " #dst1 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3255 "movq %%mm1, " #dst2 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3256
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3257 #endif //HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3258 #define SCALED_CPY(src1, src2, dst1, dst2)\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3259 REAL_SCALED_CPY(src1, src2, dst1, dst2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3260
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3261 SCALED_CPY((%2) , (%2, %4) , (%3) , (%3, %5))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3262 SCALED_CPY((%2, %4, 2), (%%REGa, %4, 2), (%3, %5, 2), (%%REGd, %5, 2))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3263 SCALED_CPY((%2, %4, 4), (%%REGa, %4, 4), (%3, %5, 4), (%%REGd, %5, 4))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3264 "lea (%%"REG_a",%4,4), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3265 "lea (%%"REG_d",%5,4), %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3266 SCALED_CPY((%%REGa, %4), (%%REGa, %4, 2), (%%REGd, %5), (%%REGd, %5, 2))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3267
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3268
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3269 : "=&a" (packedOffsetAndScale)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3270 : "0" (packedOffsetAndScale),
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3271 "r"(src),
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3272 "r"(dst),
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3273 "r" ((long)srcStride),
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3274 "r" ((long)dstStride)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3275 : "%"REG_d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3276 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3277 #else //HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3278 for(i=0; i<8; i++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3279 memcpy( &(dst[dstStride*i]),
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3280 &(src[srcStride*i]), BLOCK_SIZE);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3281 #endif //HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3282 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3283 else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3284 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3285 #ifdef HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3286 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3287 "lea (%0,%2), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3288 "lea (%1,%3), %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3289
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3290 #define REAL_SIMPLE_CPY(src1, src2, dst1, dst2) \
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3291 "movq " #src1 ", %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3292 "movq " #src2 ", %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3293 "movq %%mm0, " #dst1 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3294 "movq %%mm1, " #dst2 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3295
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3296 #define SIMPLE_CPY(src1, src2, dst1, dst2)\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3297 REAL_SIMPLE_CPY(src1, src2, dst1, dst2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3298
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3299 SIMPLE_CPY((%0) , (%0, %2) , (%1) , (%1, %3))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3300 SIMPLE_CPY((%0, %2, 2), (%%REGa, %2, 2), (%1, %3, 2), (%%REGd, %3, 2))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3301 SIMPLE_CPY((%0, %2, 4), (%%REGa, %2, 4), (%1, %3, 4), (%%REGd, %3, 4))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3302 "lea (%%"REG_a",%2,4), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3303 "lea (%%"REG_d",%3,4), %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3304 SIMPLE_CPY((%%REGa, %2), (%%REGa, %2, 2), (%%REGd, %3), (%%REGd, %3, 2))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3305
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3306 : : "r" (src),
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3307 "r" (dst),
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3308 "r" ((long)srcStride),
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3309 "r" ((long)dstStride)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3310 : "%"REG_a, "%"REG_d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3311 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3312 #else //HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3313 for(i=0; i<8; i++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3314 memcpy( &(dst[dstStride*i]),
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3315 &(src[srcStride*i]), BLOCK_SIZE);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3316 #endif //HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3317 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3318 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3319
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3320 /**
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3321 * Duplicates the given 8 src pixels ? times upward
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3322 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3323 static inline void RENAME(duplicate)(uint8_t src[], int stride)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3324 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3325 #ifdef HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3326 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3327 "movq (%0), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3328 "add %1, %0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3329 "movq %%mm0, (%0) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3330 "movq %%mm0, (%0, %1) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3331 "movq %%mm0, (%0, %1, 2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3332 : "+r" (src)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3333 : "r" ((long)-stride)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3334 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3335 #else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3336 int i;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3337 uint8_t *p=src;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3338 for(i=0; i<3; i++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3339 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3340 p-= stride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3341 memcpy(p, src, 8);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3342 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3343 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3344 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3345
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3346 /**
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3347 * Filters array of bytes (Y or U or V values)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3348 */
78
michael
parents: 55
diff changeset
3349 static void RENAME(postProcess)(const uint8_t src[], int srcStride, uint8_t dst[], int dstStride, int width, int height,
michael
parents: 55
diff changeset
3350 const QP_STORE_T QPs[], int QPStride, int isColor, PPContext *c2)
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3351 {
45
0e28dba3f9e7 Use DECLARE_ALIGNED for alignment in libpostprocess
reimar
parents: 43
diff changeset
3352 DECLARE_ALIGNED(8, PPContext, c)= *c2; //copy to stack for faster access
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3353 int x,y;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3354 #ifdef COMPILE_TIME_MODE
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3355 const int mode= COMPILE_TIME_MODE;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3356 #else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3357 const int mode= isColor ? c.ppMode.chromMode : c.ppMode.lumMode;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3358 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3359 int black=0, white=255; // blackest black and whitest white in the picture
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3360 int QPCorrecture= 256*256;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3361
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3362 int copyAhead;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3363 #ifdef HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3364 int i;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3365 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3366
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3367 const int qpHShift= isColor ? 4-c.hChromaSubSample : 4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3368 const int qpVShift= isColor ? 4-c.vChromaSubSample : 4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3369
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3370 //FIXME remove
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3371 uint64_t * const yHistogram= c.yHistogram;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3372 uint8_t * const tempSrc= srcStride > 0 ? c.tempSrc : c.tempSrc - 23*srcStride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3373 uint8_t * const tempDst= dstStride > 0 ? c.tempDst : c.tempDst - 23*dstStride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3374 //const int mbWidth= isColor ? (width+7)>>3 : (width+15)>>4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3375
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3376 #ifdef HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3377 for(i=0; i<57; i++){
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3378 int offset= ((i*c.ppMode.baseDcDiff)>>8) + 1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3379 int threshold= offset*2 + 1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3380 c.mmxDcOffset[i]= 0x7F - offset;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3381 c.mmxDcThreshold[i]= 0x7F - threshold;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3382 c.mmxDcOffset[i]*= 0x0101010101010101LL;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3383 c.mmxDcThreshold[i]*= 0x0101010101010101LL;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3384 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3385 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3386
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3387 if(mode & CUBIC_IPOL_DEINT_FILTER) copyAhead=16;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3388 else if( (mode & LINEAR_BLEND_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3389 || (mode & FFMPEG_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3390 || (mode & LOWPASS5_DEINT_FILTER)) copyAhead=14;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3391 else if( (mode & V_DEBLOCK)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3392 || (mode & LINEAR_IPOL_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3393 || (mode & MEDIAN_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3394 || (mode & V_A_DEBLOCK)) copyAhead=13;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3395 else if(mode & V_X1_FILTER) copyAhead=11;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3396 // else if(mode & V_RK1_FILTER) copyAhead=10;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3397 else if(mode & DERING) copyAhead=9;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3398 else copyAhead=8;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3399
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3400 copyAhead-= 8;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3401
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3402 if(!isColor)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3403 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3404 uint64_t sum= 0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3405 int i;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3406 uint64_t maxClipped;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3407 uint64_t clipped;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3408 double scale;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3409
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3410 c.frameNum++;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3411 // first frame is fscked so we ignore it
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3412 if(c.frameNum == 1) yHistogram[0]= width*height/64*15/256;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3413
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3414 for(i=0; i<256; i++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3415 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3416 sum+= yHistogram[i];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3417 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3418
43
00ab07579dc3 typos/grammar
diego
parents: 39
diff changeset
3419 /* We always get a completely black picture first. */
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3420 maxClipped= (uint64_t)(sum * c.ppMode.maxClippedThreshold);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3421
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3422 clipped= sum;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3423 for(black=255; black>0; black--)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3424 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3425 if(clipped < maxClipped) break;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3426 clipped-= yHistogram[black];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3427 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3428
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3429 clipped= sum;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3430 for(white=0; white<256; white++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3431 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3432 if(clipped < maxClipped) break;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3433 clipped-= yHistogram[white];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3434 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3435
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3436 scale= (double)(c.ppMode.maxAllowedY - c.ppMode.minAllowedY) / (double)(white-black);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3437
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3438 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3439 c.packedYScale= (uint16_t)(scale*256.0 + 0.5);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3440 c.packedYOffset= (((black*c.packedYScale)>>8) - c.ppMode.minAllowedY) & 0xFFFF;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3441 #else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3442 c.packedYScale= (uint16_t)(scale*1024.0 + 0.5);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3443 c.packedYOffset= (black - c.ppMode.minAllowedY) & 0xFFFF;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3444 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3445
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3446 c.packedYOffset|= c.packedYOffset<<32;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3447 c.packedYOffset|= c.packedYOffset<<16;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3448
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3449 c.packedYScale|= c.packedYScale<<32;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3450 c.packedYScale|= c.packedYScale<<16;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3451
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3452 if(mode & LEVEL_FIX) QPCorrecture= (int)(scale*256*256 + 0.5);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3453 else QPCorrecture= 256*256;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3454 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3455 else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3456 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3457 c.packedYScale= 0x0100010001000100LL;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3458 c.packedYOffset= 0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3459 QPCorrecture= 256*256;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3460 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3461
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3462 /* copy & deinterlace first row of blocks */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3463 y=-BLOCK_SIZE;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3464 {
78
michael
parents: 55
diff changeset
3465 const uint8_t *srcBlock= &(src[y*srcStride]);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3466 uint8_t *dstBlock= tempDst + dstStride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3467
39
2c0d7e00db4d cosmetics: Fix another common typo, gurantee --> guArantee.
diego
parents: 38
diff changeset
3468 // From this point on it is guaranteed that we can read and write 16 lines downward
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3469 // finish 1 block before the next otherwise we might have a problem
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3470 // with the L1 Cache of the P4 ... or only a few blocks at a time or soemthing
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3471 for(x=0; x<width; x+=BLOCK_SIZE)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3472 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3473
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3474 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3475 /*
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3476 prefetchnta(srcBlock + (((x>>2)&6) + 5)*srcStride + 32);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3477 prefetchnta(srcBlock + (((x>>2)&6) + 6)*srcStride + 32);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3478 prefetcht0(dstBlock + (((x>>2)&6) + 5)*dstStride + 32);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3479 prefetcht0(dstBlock + (((x>>2)&6) + 6)*dstStride + 32);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3480 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3481
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3482 asm(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3483 "mov %4, %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3484 "shr $2, %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3485 "and $6, %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3486 "add %5, %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3487 "mov %%"REG_a", %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3488 "imul %1, %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3489 "imul %3, %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3490 "prefetchnta 32(%%"REG_a", %0) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3491 "prefetcht0 32(%%"REG_d", %2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3492 "add %1, %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3493 "add %3, %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3494 "prefetchnta 32(%%"REG_a", %0) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3495 "prefetcht0 32(%%"REG_d", %2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3496 :: "r" (srcBlock), "r" ((long)srcStride), "r" (dstBlock), "r" ((long)dstStride),
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3497 "g" ((long)x), "g" ((long)copyAhead)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3498 : "%"REG_a, "%"REG_d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3499 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3500
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3501 #elif defined(HAVE_3DNOW)
49
cdfe8fc50090 misc typo fixes
diego
parents: 48
diff changeset
3502 //FIXME check if this is faster on an 3dnow chip or if it is faster without the prefetch or ...
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3503 /* prefetch(srcBlock + (((x>>3)&3) + 5)*srcStride + 32);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3504 prefetch(srcBlock + (((x>>3)&3) + 9)*srcStride + 32);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3505 prefetchw(dstBlock + (((x>>3)&3) + 5)*dstStride + 32);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3506 prefetchw(dstBlock + (((x>>3)&3) + 9)*dstStride + 32);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3507 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3508 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3509
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3510 RENAME(blockCopy)(dstBlock + dstStride*8, dstStride,
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3511 srcBlock + srcStride*8, srcStride, mode & LEVEL_FIX, &c.packedYOffset);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3512
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3513 RENAME(duplicate)(dstBlock + dstStride*8, dstStride);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3514
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3515 if(mode & LINEAR_IPOL_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3516 RENAME(deInterlaceInterpolateLinear)(dstBlock, dstStride);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3517 else if(mode & LINEAR_BLEND_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3518 RENAME(deInterlaceBlendLinear)(dstBlock, dstStride, c.deintTemp + x);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3519 else if(mode & MEDIAN_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3520 RENAME(deInterlaceMedian)(dstBlock, dstStride);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3521 else if(mode & CUBIC_IPOL_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3522 RENAME(deInterlaceInterpolateCubic)(dstBlock, dstStride);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3523 else if(mode & FFMPEG_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3524 RENAME(deInterlaceFF)(dstBlock, dstStride, c.deintTemp + x);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3525 else if(mode & LOWPASS5_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3526 RENAME(deInterlaceL5)(dstBlock, dstStride, c.deintTemp + x, c.deintTemp + width + x);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3527 /* else if(mode & CUBIC_BLEND_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3528 RENAME(deInterlaceBlendCubic)(dstBlock, dstStride);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3529 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3530 dstBlock+=8;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3531 srcBlock+=8;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3532 }
32
cb746db3fd32 Rename ABS macro to FFABS.
diego
parents: 31
diff changeset
3533 if(width==FFABS(dstStride))
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3534 linecpy(dst, tempDst + 9*dstStride, copyAhead, dstStride);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3535 else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3536 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3537 int i;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3538 for(i=0; i<copyAhead; i++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3539 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3540 memcpy(dst + i*dstStride, tempDst + (9+i)*dstStride, width);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3541 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3542 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3543 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3544
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3545 for(y=0; y<height; y+=BLOCK_SIZE)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3546 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3547 //1% speedup if these are here instead of the inner loop
78
michael
parents: 55
diff changeset
3548 const uint8_t *srcBlock= &(src[y*srcStride]);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3549 uint8_t *dstBlock= &(dst[y*dstStride]);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3550 #ifdef HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3551 uint8_t *tempBlock1= c.tempBlocks;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3552 uint8_t *tempBlock2= c.tempBlocks + 8;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3553 #endif
78
michael
parents: 55
diff changeset
3554 const int8_t *QPptr= &QPs[(y>>qpVShift)*QPStride];
32
cb746db3fd32 Rename ABS macro to FFABS.
diego
parents: 31
diff changeset
3555 int8_t *nonBQPptr= &c.nonBQPTable[(y>>qpVShift)*FFABS(QPStride)];
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3556 int QP=0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3557 /* can we mess with a 8x16 block from srcBlock/dstBlock downwards and 1 line upwards
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3558 if not than use a temporary buffer */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3559 if(y+15 >= height)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3560 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3561 int i;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3562 /* copy from line (copyAhead) to (copyAhead+7) of src, these will be copied with
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3563 blockcopy to dst later */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3564 linecpy(tempSrc + srcStride*copyAhead, srcBlock + srcStride*copyAhead,
27
c83a71c1729d Change libpostproc to use the FFMIN/FFMAX macros from libavutil.
diego
parents: 22
diff changeset
3565 FFMAX(height-y-copyAhead, 0), srcStride);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3566
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3567 /* duplicate last line of src to fill the void upto line (copyAhead+7) */
27
c83a71c1729d Change libpostproc to use the FFMIN/FFMAX macros from libavutil.
diego
parents: 22
diff changeset
3568 for(i=FFMAX(height-y, 8); i<copyAhead+8; i++)
32
cb746db3fd32 Rename ABS macro to FFABS.
diego
parents: 31
diff changeset
3569 memcpy(tempSrc + srcStride*i, src + srcStride*(height-1), FFABS(srcStride));
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3570
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3571 /* copy up to (copyAhead+1) lines of dst (line -1 to (copyAhead-1))*/
27
c83a71c1729d Change libpostproc to use the FFMIN/FFMAX macros from libavutil.
diego
parents: 22
diff changeset
3572 linecpy(tempDst, dstBlock - dstStride, FFMIN(height-y+1, copyAhead+1), dstStride);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3573
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3574 /* duplicate last line of dst to fill the void upto line (copyAhead) */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3575 for(i=height-y+1; i<=copyAhead; i++)
32
cb746db3fd32 Rename ABS macro to FFABS.
diego
parents: 31
diff changeset
3576 memcpy(tempDst + dstStride*i, dst + dstStride*(height-1), FFABS(dstStride));
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3577
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3578 dstBlock= tempDst + dstStride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3579 srcBlock= tempSrc;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3580 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3581
39
2c0d7e00db4d cosmetics: Fix another common typo, gurantee --> guArantee.
diego
parents: 38
diff changeset
3582 // From this point on it is guaranteed that we can read and write 16 lines downward
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3583 // finish 1 block before the next otherwise we might have a problem
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3584 // with the L1 Cache of the P4 ... or only a few blocks at a time or soemthing
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3585 for(x=0; x<width; x+=BLOCK_SIZE)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3586 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3587 const int stride= dstStride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3588 #ifdef HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3589 uint8_t *tmpXchg;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3590 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3591 if(isColor)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3592 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3593 QP= QPptr[x>>qpHShift];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3594 c.nonBQP= nonBQPptr[x>>qpHShift];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3595 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3596 else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3597 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3598 QP= QPptr[x>>4];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3599 QP= (QP* QPCorrecture + 256*128)>>16;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3600 c.nonBQP= nonBQPptr[x>>4];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3601 c.nonBQP= (c.nonBQP* QPCorrecture + 256*128)>>16;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3602 yHistogram[ srcBlock[srcStride*12 + 4] ]++;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3603 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3604 c.QP= QP;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3605 #ifdef HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3606 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3607 "movd %1, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3608 "packuswb %%mm7, %%mm7 \n\t" // 0, 0, 0, QP, 0, 0, 0, QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3609 "packuswb %%mm7, %%mm7 \n\t" // 0,QP, 0, QP, 0,QP, 0, QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3610 "packuswb %%mm7, %%mm7 \n\t" // QP,..., QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3611 "movq %%mm7, %0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3612 : "=m" (c.pQPb)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3613 : "r" (QP)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3614 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3615 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3616
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3617
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3618 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3619 /*
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3620 prefetchnta(srcBlock + (((x>>2)&6) + 5)*srcStride + 32);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3621 prefetchnta(srcBlock + (((x>>2)&6) + 6)*srcStride + 32);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3622 prefetcht0(dstBlock + (((x>>2)&6) + 5)*dstStride + 32);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3623 prefetcht0(dstBlock + (((x>>2)&6) + 6)*dstStride + 32);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3624 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3625
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3626 asm(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3627 "mov %4, %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3628 "shr $2, %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3629 "and $6, %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3630 "add %5, %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3631 "mov %%"REG_a", %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3632 "imul %1, %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3633 "imul %3, %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3634 "prefetchnta 32(%%"REG_a", %0) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3635 "prefetcht0 32(%%"REG_d", %2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3636 "add %1, %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3637 "add %3, %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3638 "prefetchnta 32(%%"REG_a", %0) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3639 "prefetcht0 32(%%"REG_d", %2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3640 :: "r" (srcBlock), "r" ((long)srcStride), "r" (dstBlock), "r" ((long)dstStride),
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3641 "g" ((long)x), "g" ((long)copyAhead)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3642 : "%"REG_a, "%"REG_d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3643 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3644
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3645 #elif defined(HAVE_3DNOW)
49
cdfe8fc50090 misc typo fixes
diego
parents: 48
diff changeset
3646 //FIXME check if this is faster on an 3dnow chip or if it is faster without the prefetch or ...
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3647 /* prefetch(srcBlock + (((x>>3)&3) + 5)*srcStride + 32);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3648 prefetch(srcBlock + (((x>>3)&3) + 9)*srcStride + 32);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3649 prefetchw(dstBlock + (((x>>3)&3) + 5)*dstStride + 32);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3650 prefetchw(dstBlock + (((x>>3)&3) + 9)*dstStride + 32);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3651 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3652 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3653
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3654 RENAME(blockCopy)(dstBlock + dstStride*copyAhead, dstStride,
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3655 srcBlock + srcStride*copyAhead, srcStride, mode & LEVEL_FIX, &c.packedYOffset);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3656
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3657 if(mode & LINEAR_IPOL_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3658 RENAME(deInterlaceInterpolateLinear)(dstBlock, dstStride);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3659 else if(mode & LINEAR_BLEND_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3660 RENAME(deInterlaceBlendLinear)(dstBlock, dstStride, c.deintTemp + x);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3661 else if(mode & MEDIAN_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3662 RENAME(deInterlaceMedian)(dstBlock, dstStride);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3663 else if(mode & CUBIC_IPOL_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3664 RENAME(deInterlaceInterpolateCubic)(dstBlock, dstStride);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3665 else if(mode & FFMPEG_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3666 RENAME(deInterlaceFF)(dstBlock, dstStride, c.deintTemp + x);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3667 else if(mode & LOWPASS5_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3668 RENAME(deInterlaceL5)(dstBlock, dstStride, c.deintTemp + x, c.deintTemp + width + x);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3669 /* else if(mode & CUBIC_BLEND_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3670 RENAME(deInterlaceBlendCubic)(dstBlock, dstStride);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3671 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3672
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3673 /* only deblock if we have 2 blocks */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3674 if(y + 8 < height)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3675 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3676 if(mode & V_X1_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3677 RENAME(vertX1Filter)(dstBlock, stride, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3678 else if(mode & V_DEBLOCK)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3679 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3680 const int t= RENAME(vertClassify)(dstBlock, stride, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3681
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3682 if(t==1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3683 RENAME(doVertLowPass)(dstBlock, stride, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3684 else if(t==2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3685 RENAME(doVertDefFilter)(dstBlock, stride, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3686 }else if(mode & V_A_DEBLOCK){
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3687 RENAME(do_a_deblock)(dstBlock, stride, 1, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3688 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3689 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3690
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3691 #ifdef HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3692 RENAME(transpose1)(tempBlock1, tempBlock2, dstBlock, dstStride);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3693 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3694 /* check if we have a previous block to deblock it with dstBlock */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3695 if(x - 8 >= 0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3696 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3697 #ifdef HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3698 if(mode & H_X1_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3699 RENAME(vertX1Filter)(tempBlock1, 16, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3700 else if(mode & H_DEBLOCK)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3701 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3702 //START_TIMER
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3703 const int t= RENAME(vertClassify)(tempBlock1, 16, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3704 //STOP_TIMER("dc & minmax")
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3705 if(t==1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3706 RENAME(doVertLowPass)(tempBlock1, 16, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3707 else if(t==2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3708 RENAME(doVertDefFilter)(tempBlock1, 16, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3709 }else if(mode & H_A_DEBLOCK){
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3710 RENAME(do_a_deblock)(tempBlock1, 16, 1, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3711 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3712
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3713 RENAME(transpose2)(dstBlock-4, dstStride, tempBlock1 + 4*16);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3714
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3715 #else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3716 if(mode & H_X1_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3717 horizX1Filter(dstBlock-4, stride, QP);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3718 else if(mode & H_DEBLOCK)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3719 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3720 #ifdef HAVE_ALTIVEC
45
0e28dba3f9e7 Use DECLARE_ALIGNED for alignment in libpostprocess
reimar
parents: 43
diff changeset
3721 DECLARE_ALIGNED(16, unsigned char, tempBlock[272]);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3722 transpose_16x8_char_toPackedAlign_altivec(tempBlock, dstBlock - (4 + 1), stride);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3723
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3724 const int t=vertClassify_altivec(tempBlock-48, 16, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3725 if(t==1) {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3726 doVertLowPass_altivec(tempBlock-48, 16, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3727 transpose_8x16_char_fromPackedAlign_altivec(dstBlock - (4 + 1), tempBlock, stride);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3728 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3729 else if(t==2) {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3730 doVertDefFilter_altivec(tempBlock-48, 16, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3731 transpose_8x16_char_fromPackedAlign_altivec(dstBlock - (4 + 1), tempBlock, stride);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3732 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3733 #else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3734 const int t= RENAME(horizClassify)(dstBlock-4, stride, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3735
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3736 if(t==1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3737 RENAME(doHorizLowPass)(dstBlock-4, stride, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3738 else if(t==2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3739 RENAME(doHorizDefFilter)(dstBlock-4, stride, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3740 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3741 }else if(mode & H_A_DEBLOCK){
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3742 RENAME(do_a_deblock)(dstBlock-8, 1, stride, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3743 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3744 #endif //HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3745 if(mode & DERING)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3746 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3747 //FIXME filter first line
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3748 if(y>0) RENAME(dering)(dstBlock - stride - 8, stride, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3749 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3750
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3751 if(mode & TEMP_NOISE_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3752 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3753 RENAME(tempNoiseReducer)(dstBlock-8, stride,
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3754 c.tempBlured[isColor] + y*dstStride + x,
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3755 c.tempBluredPast[isColor] + (y>>3)*256 + (x>>3),
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3756 c.ppMode.maxTmpNoise);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3757 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3758 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3759
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3760 dstBlock+=8;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3761 srcBlock+=8;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3762
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3763 #ifdef HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3764 tmpXchg= tempBlock1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3765 tempBlock1= tempBlock2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3766 tempBlock2 = tmpXchg;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3767 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3768 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3769
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3770 if(mode & DERING)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3771 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3772 if(y > 0) RENAME(dering)(dstBlock - dstStride - 8, dstStride, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3773 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3774
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3775 if((mode & TEMP_NOISE_FILTER))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3776 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3777 RENAME(tempNoiseReducer)(dstBlock-8, dstStride,
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3778 c.tempBlured[isColor] + y*dstStride + x,
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3779 c.tempBluredPast[isColor] + (y>>3)*256 + (x>>3),
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3780 c.ppMode.maxTmpNoise);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3781 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3782
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3783 /* did we use a tmp buffer for the last lines*/
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3784 if(y+15 >= height)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3785 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3786 uint8_t *dstBlock= &(dst[y*dstStride]);
32
cb746db3fd32 Rename ABS macro to FFABS.
diego
parents: 31
diff changeset
3787 if(width==FFABS(dstStride))
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3788 linecpy(dstBlock, tempDst + dstStride, height-y, dstStride);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3789 else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3790 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3791 int i;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3792 for(i=0; i<height-y; i++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3793 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3794 memcpy(dstBlock + i*dstStride, tempDst + (i+1)*dstStride, width);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3795 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3796 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3797 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3798 /*
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3799 for(x=0; x<width; x+=32)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3800 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3801 volatile int i;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3802 i+= + dstBlock[x + 7*dstStride] + dstBlock[x + 8*dstStride]
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3803 + dstBlock[x + 9*dstStride] + dstBlock[x +10*dstStride]
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3804 + dstBlock[x +11*dstStride] + dstBlock[x +12*dstStride];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3805 // + dstBlock[x +13*dstStride]
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3806 // + dstBlock[x +14*dstStride] + dstBlock[x +15*dstStride];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3807 }*/
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3808 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3809 #ifdef HAVE_3DNOW
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3810 asm volatile("femms");
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3811 #elif defined (HAVE_MMX)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3812 asm volatile("emms");
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3813 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3814
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3815 #ifdef DEBUG_BRIGHTNESS
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3816 if(!isColor)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3817 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3818 int max=1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3819 int i;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3820 for(i=0; i<256; i++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3821 if(yHistogram[i] > max) max=yHistogram[i];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3822
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3823 for(i=1; i<256; i++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3824 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3825 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3826 int start=yHistogram[i-1]/(max/256+1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3827 int end=yHistogram[i]/(max/256+1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3828 int inc= end > start ? 1 : -1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3829 for(x=start; x!=end+inc; x+=inc)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3830 dst[ i*dstStride + x]+=128;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3831 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3832
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3833 for(i=0; i<100; i+=2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3834 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3835 dst[ (white)*dstStride + i]+=128;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3836 dst[ (black)*dstStride + i]+=128;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3837 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3838
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3839 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3840 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3841
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3842 *c2= c; //copy local context back
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3843
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3844 }