Mercurial > libavcodec.hg
annotate libpostproc/postprocess_template.c @ 983:ca2a303ea039 libavcodec
fixed wmv2 slices
| author | michaelni |
|---|---|
| date | Thu, 09 Jan 2003 11:37:08 +0000 |
| parents | 8a95bda80fdc |
| children | 804cc05a3f61 |
| rev | line source |
|---|---|
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1 /* |
| 223 | 2 Copyright (C) 2001-2002 Michael Niedermayer (michaelni@gmx.at) |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
4 This program is free software; you can redistribute it and/or modify |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
5 it under the terms of the GNU General Public License as published by |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
6 the Free Software Foundation; either version 2 of the License, or |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
7 (at your option) any later version. |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
8 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
9 This program is distributed in the hope that it will be useful, |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
10 but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
12 GNU General Public License for more details. |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
13 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
14 You should have received a copy of the GNU General Public License |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
15 along with this program; if not, write to the Free Software |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
17 */ |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
18 |
| 169 | 19 #undef PAVGB |
| 20 #undef PMINUB | |
| 21 #undef PMAXUB | |
| 104 | 22 |
| 23 #ifdef HAVE_MMX2 | |
| 24 #define PAVGB(a,b) "pavgb " #a ", " #b " \n\t" | |
| 25 #elif defined (HAVE_3DNOW) | |
| 26 #define PAVGB(a,b) "pavgusb " #a ", " #b " \n\t" | |
| 27 #endif | |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
28 |
| 134 | 29 #ifdef HAVE_MMX2 |
| 30 #define PMINUB(a,b,t) "pminub " #a ", " #b " \n\t" | |
| 31 #elif defined (HAVE_MMX) | |
| 32 #define PMINUB(b,a,t) \ | |
| 33 "movq " #a ", " #t " \n\t"\ | |
| 34 "psubusb " #b ", " #t " \n\t"\ | |
| 35 "psubb " #t ", " #a " \n\t" | |
| 36 #endif | |
| 37 | |
| 38 #ifdef HAVE_MMX2 | |
| 39 #define PMAXUB(a,b) "pmaxub " #a ", " #b " \n\t" | |
| 40 #elif defined (HAVE_MMX) | |
| 41 #define PMAXUB(a,b) \ | |
| 42 "psubusb " #a ", " #b " \n\t"\ | |
| 43 "paddb " #a ", " #b " \n\t" | |
| 44 #endif | |
| 45 | |
| 46 | |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
47 //FIXME? |255-0| = 1 (shouldnt be a problem ...) |
| 787 | 48 #ifdef HAVE_MMX |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
49 /** |
| 111 | 50 * Check if the middle 8x8 Block in the given 8x16 block is flat |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
51 */ |
| 787 | 52 static inline int RENAME(isVertDC)(uint8_t src[], int stride, PPContext *c){ |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
53 int numEq= 0; |
| 111 | 54 src+= stride*4; // src points to begin of the 8x8 Block |
| 119 | 55 asm volatile( |
| 56 "leal (%1, %2), %%eax \n\t" | |
| 57 // 0 1 2 3 4 5 6 7 8 9 | |
| 787 | 58 // %1 eax eax+%2 eax+2%2 %1+4%2 ecx ecx+%2 ecx+2%2 %1+8%2 ecx+4%2 |
| 791 | 59 "movq %3, %%mm7 \n\t" |
| 60 "movq %4, %%mm6 \n\t" | |
| 61 | |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
62 "movq (%1), %%mm0 \n\t" |
| 119 | 63 "movq (%%eax), %%mm1 \n\t" |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
64 "psubb %%mm1, %%mm0 \n\t" // mm0 = differnece |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
65 "paddb %%mm7, %%mm0 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
66 "pcmpgtb %%mm6, %%mm0 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
67 |
| 119 | 68 "movq (%%eax,%2), %%mm2 \n\t" |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
69 "psubb %%mm2, %%mm1 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
70 "paddb %%mm7, %%mm1 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
71 "pcmpgtb %%mm6, %%mm1 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
72 "paddb %%mm1, %%mm0 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
73 |
| 119 | 74 "movq (%%eax, %2, 2), %%mm1 \n\t" |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
75 "psubb %%mm1, %%mm2 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
76 "paddb %%mm7, %%mm2 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
77 "pcmpgtb %%mm6, %%mm2 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
78 "paddb %%mm2, %%mm0 \n\t" |
| 787 | 79 |
| 80 "leal (%%eax, %2, 4), %%eax \n\t" | |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
81 |
| 119 | 82 "movq (%1, %2, 4), %%mm2 \n\t" |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
83 "psubb %%mm2, %%mm1 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
84 "paddb %%mm7, %%mm1 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
85 "pcmpgtb %%mm6, %%mm1 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
86 "paddb %%mm1, %%mm0 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
87 |
| 787 | 88 "movq (%%eax), %%mm1 \n\t" |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
89 "psubb %%mm1, %%mm2 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
90 "paddb %%mm7, %%mm2 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
91 "pcmpgtb %%mm6, %%mm2 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
92 "paddb %%mm2, %%mm0 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
93 |
| 787 | 94 "movq (%%eax, %2), %%mm2 \n\t" |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
95 "psubb %%mm2, %%mm1 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
96 "paddb %%mm7, %%mm1 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
97 "pcmpgtb %%mm6, %%mm1 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
98 "paddb %%mm1, %%mm0 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
99 |
| 787 | 100 "movq (%%eax, %2, 2), %%mm1 \n\t" |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
101 "psubb %%mm1, %%mm2 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
102 "paddb %%mm7, %%mm2 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
103 "pcmpgtb %%mm6, %%mm2 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
104 "paddb %%mm2, %%mm0 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
105 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
106 " \n\t" |
| 167 | 107 #ifdef HAVE_MMX2 |
| 108 "pxor %%mm7, %%mm7 \n\t" | |
| 109 "psadbw %%mm7, %%mm0 \n\t" | |
| 110 #else | |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
111 "movq %%mm0, %%mm1 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
112 "psrlw $8, %%mm0 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
113 "paddb %%mm1, %%mm0 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
114 "movq %%mm0, %%mm1 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
115 "psrlq $16, %%mm0 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
116 "paddb %%mm1, %%mm0 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
117 "movq %%mm0, %%mm1 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
118 "psrlq $32, %%mm0 \n\t" |
| 167 | 119 "paddb %%mm1, %%mm0 \n\t" |
|
129
be35346e27c1
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
128
diff
changeset
|
120 #endif |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
121 "movd %%mm0, %0 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
122 : "=r" (numEq) |
| 791 | 123 : "r" (src), "r" (stride), "m" (c->mmxDcOffset[c->nonBQP]), "m" (c->mmxDcThreshold[c->nonBQP]) |
| 787 | 124 : "%eax" |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
125 ); |
| 167 | 126 numEq= (-numEq) &0xFF; |
| 787 | 127 return numEq > c->ppMode.flatnessThreshold; |
| 128 } | |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
129 #endif |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
130 |
| 787 | 131 static inline int RENAME(isVertMinMaxOk)(uint8_t src[], int stride, PPContext *c) |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
132 { |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
133 #ifdef HAVE_MMX |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
134 int isOk; |
| 111 | 135 src+= stride*3; |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
136 asm volatile( |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
137 "movq (%1, %2), %%mm0 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
138 "movq (%1, %2, 8), %%mm1 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
139 "movq %%mm0, %%mm2 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
140 "psubusb %%mm1, %%mm0 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
141 "psubusb %%mm2, %%mm1 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
142 "por %%mm1, %%mm0 \n\t" // ABS Diff |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
143 |
| 787 | 144 "movq %3, %%mm7 \n\t" // QP,..., QP |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
145 "paddusb %%mm7, %%mm7 \n\t" // 2QP ... 2QP |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
146 "psubusb %%mm7, %%mm0 \n\t" // Diff <= 2QP -> 0 |
| 787 | 147 "packssdw %%mm0, %%mm0 \n\t" |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
148 "movd %%mm0, %0 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
149 : "=r" (isOk) |
| 787 | 150 : "r" (src), "r" (stride), "m" (c->pQPb) |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
151 ); |
| 787 | 152 return isOk==0; |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
153 #else |
| 791 | 154 #if 1 |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
155 int x; |
| 787 | 156 const int QP= c->QP; |
| 111 | 157 src+= stride*3; |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
158 for(x=0; x<BLOCK_SIZE; x++) |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
159 { |
| 787 | 160 if((unsigned)(src[x + stride] - src[x + (stride<<3)] + 2*QP) > 4*QP) return 0; |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
161 } |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
162 |
| 787 | 163 return 1; |
| 791 | 164 #else |
| 165 int x; | |
| 166 const int QP= c->QP; | |
| 167 src+= stride*4; | |
| 168 for(x=0; x<BLOCK_SIZE; x++) | |
| 169 { | |
| 170 int min=255; | |
| 171 int max=0; | |
| 172 int y; | |
| 173 for(y=0; y<8; y++){ | |
| 174 int v= src[x + y*stride]; | |
| 175 if(v>max) max=v; | |
| 176 if(v<min) min=v; | |
| 177 } | |
| 178 if(max-min > 2*QP) return 0; | |
| 179 } | |
| 180 return 1; | |
| 181 #endif | |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
182 #endif |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
183 } |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
184 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
185 /** |
| 111 | 186 * Do a vertical low pass filter on the 8x16 block (only write to the 8x8 block in the middle) |
| 107 | 187 * using the 9-Tap Filter (1,1,2,2,4,2,2,1,1)/16 |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
188 */ |
| 787 | 189 static inline void RENAME(doVertLowPass)(uint8_t *src, int stride, PPContext *c) |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
190 { |
| 96 | 191 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW) |
| 111 | 192 src+= stride*3; |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
193 asm volatile( //"movv %0 %1 %2\n\t" |
| 787 | 194 "movq %2, %%mm0 \n\t" // QP,..., QP |
| 195 "pxor %%mm4, %%mm4 \n\t" | |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
196 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
197 "movq (%0), %%mm6 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
198 "movq (%0, %1), %%mm5 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
199 "movq %%mm5, %%mm1 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
200 "movq %%mm6, %%mm2 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
201 "psubusb %%mm6, %%mm5 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
202 "psubusb %%mm1, %%mm2 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
203 "por %%mm5, %%mm2 \n\t" // ABS Diff of lines |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
204 "psubusb %%mm0, %%mm2 \n\t" // diff <= QP -> 0 |
| 787 | 205 "pcmpeqb %%mm4, %%mm2 \n\t" // diff <= QP -> FF |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
206 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
207 "pand %%mm2, %%mm6 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
208 "pandn %%mm1, %%mm2 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
209 "por %%mm2, %%mm6 \n\t"// First Line to Filter |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
210 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
211 "movq (%0, %1, 8), %%mm5 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
212 "leal (%0, %1, 4), %%eax \n\t" |
| 787 | 213 "leal (%0, %1, 8), %%ecx \n\t" |
| 214 "subl %1, %%ecx \n\t" | |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
215 "addl %1, %0 \n\t" // %0 points to line 1 not 0 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
216 "movq (%0, %1, 8), %%mm7 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
217 "movq %%mm5, %%mm1 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
218 "movq %%mm7, %%mm2 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
219 "psubusb %%mm7, %%mm5 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
220 "psubusb %%mm1, %%mm2 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
221 "por %%mm5, %%mm2 \n\t" // ABS Diff of lines |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
222 "psubusb %%mm0, %%mm2 \n\t" // diff <= QP -> 0 |
| 787 | 223 "pcmpeqb %%mm4, %%mm2 \n\t" // diff <= QP -> FF |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
224 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
225 "pand %%mm2, %%mm7 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
226 "pandn %%mm1, %%mm2 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
227 "por %%mm2, %%mm7 \n\t" // First Line to Filter |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
228 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
229 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
230 // 1 2 3 4 5 6 7 8 |
| 787 | 231 // %0 %0+%1 %0+2%1 eax %0+4%1 eax+2%1 ecx eax+4%1 |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
232 // 6 4 2 2 1 1 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
233 // 6 4 4 2 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
234 // 6 8 2 |
| 111 | 235 |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
236 "movq (%0, %1), %%mm0 \n\t" // 1 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
237 "movq %%mm0, %%mm1 \n\t" // 1 |
| 96 | 238 PAVGB(%%mm6, %%mm0) //1 1 /2 |
| 239 PAVGB(%%mm6, %%mm0) //3 1 /4 | |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
240 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
241 "movq (%0, %1, 4), %%mm2 \n\t" // 1 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
242 "movq %%mm2, %%mm5 \n\t" // 1 |
| 96 | 243 PAVGB((%%eax), %%mm2) // 11 /2 |
| 244 PAVGB((%0, %1, 2), %%mm2) // 211 /4 | |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
245 "movq %%mm2, %%mm3 \n\t" // 211 /4 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
246 "movq (%0), %%mm4 \n\t" // 1 |
| 96 | 247 PAVGB(%%mm4, %%mm3) // 4 211 /8 |
| 248 PAVGB(%%mm0, %%mm3) //642211 /16 | |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
249 "movq %%mm3, (%0) \n\t" // X |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
250 // mm1=2 mm2=3(211) mm4=1 mm5=5 mm6=0 mm7=9 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
251 "movq %%mm1, %%mm0 \n\t" // 1 |
| 96 | 252 PAVGB(%%mm6, %%mm0) //1 1 /2 |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
253 "movq %%mm4, %%mm3 \n\t" // 1 |
| 96 | 254 PAVGB((%0,%1,2), %%mm3) // 1 1 /2 |
| 255 PAVGB((%%eax,%1,2), %%mm5) // 11 /2 | |
| 256 PAVGB((%%eax), %%mm5) // 211 /4 | |
| 257 PAVGB(%%mm5, %%mm3) // 2 2211 /8 | |
| 258 PAVGB(%%mm0, %%mm3) //4242211 /16 | |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
259 "movq %%mm3, (%0,%1) \n\t" // X |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
260 // mm1=2 mm2=3(211) mm4=1 mm5=4(211) mm6=0 mm7=9 |
| 96 | 261 PAVGB(%%mm4, %%mm6) //11 /2 |
| 787 | 262 "movq (%%ecx), %%mm0 \n\t" // 1 |
| 96 | 263 PAVGB((%%eax, %1, 2), %%mm0) // 11/2 |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
264 "movq %%mm0, %%mm3 \n\t" // 11/2 |
| 96 | 265 PAVGB(%%mm1, %%mm0) // 2 11/4 |
| 266 PAVGB(%%mm6, %%mm0) //222 11/8 | |
| 267 PAVGB(%%mm2, %%mm0) //22242211/16 | |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
268 "movq (%0, %1, 2), %%mm2 \n\t" // 1 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
269 "movq %%mm0, (%0, %1, 2) \n\t" // X |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
270 // mm1=2 mm2=3 mm3=6(11) mm4=1 mm5=4(211) mm6=0(11) mm7=9 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
271 "movq (%%eax, %1, 4), %%mm0 \n\t" // 1 |
| 787 | 272 PAVGB((%%ecx), %%mm0) // 11 /2 |
| 96 | 273 PAVGB(%%mm0, %%mm6) //11 11 /4 |
| 274 PAVGB(%%mm1, %%mm4) // 11 /2 | |
| 275 PAVGB(%%mm2, %%mm1) // 11 /2 | |
| 276 PAVGB(%%mm1, %%mm6) //1122 11 /8 | |
| 277 PAVGB(%%mm5, %%mm6) //112242211 /16 | |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
278 "movq (%%eax), %%mm5 \n\t" // 1 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
279 "movq %%mm6, (%%eax) \n\t" // X |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
280 // mm0=7(11) mm1=2(11) mm2=3 mm3=6(11) mm4=1(11) mm5=4 mm7=9 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
281 "movq (%%eax, %1, 4), %%mm6 \n\t" // 1 |
| 96 | 282 PAVGB(%%mm7, %%mm6) // 11 /2 |
| 283 PAVGB(%%mm4, %%mm6) // 11 11 /4 | |
| 284 PAVGB(%%mm3, %%mm6) // 11 2211 /8 | |
| 285 PAVGB(%%mm5, %%mm2) // 11 /2 | |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
286 "movq (%0, %1, 4), %%mm4 \n\t" // 1 |
| 96 | 287 PAVGB(%%mm4, %%mm2) // 112 /4 |
| 288 PAVGB(%%mm2, %%mm6) // 112242211 /16 | |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
289 "movq %%mm6, (%0, %1, 4) \n\t" // X |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
290 // mm0=7(11) mm1=2(11) mm2=3(112) mm3=6(11) mm4=5 mm5=4 mm7=9 |
| 96 | 291 PAVGB(%%mm7, %%mm1) // 11 2 /4 |
| 292 PAVGB(%%mm4, %%mm5) // 11 /2 | |
| 293 PAVGB(%%mm5, %%mm0) // 11 11 /4 | |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
294 "movq (%%eax, %1, 2), %%mm6 \n\t" // 1 |
| 96 | 295 PAVGB(%%mm6, %%mm1) // 11 4 2 /8 |
| 296 PAVGB(%%mm0, %%mm1) // 11224222 /16 | |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
297 "movq %%mm1, (%%eax, %1, 2) \n\t" // X |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
298 // mm2=3(112) mm3=6(11) mm4=5 mm5=4(11) mm6=6 mm7=9 |
| 787 | 299 PAVGB((%%ecx), %%mm2) // 112 4 /8 |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
300 "movq (%%eax, %1, 4), %%mm0 \n\t" // 1 |
| 96 | 301 PAVGB(%%mm0, %%mm6) // 1 1 /2 |
| 302 PAVGB(%%mm7, %%mm6) // 1 12 /4 | |
| 303 PAVGB(%%mm2, %%mm6) // 1122424 /4 | |
| 787 | 304 "movq %%mm6, (%%ecx) \n\t" // X |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
305 // mm0=8 mm3=6(11) mm4=5 mm5=4(11) mm7=9 |
| 96 | 306 PAVGB(%%mm7, %%mm5) // 11 2 /4 |
| 307 PAVGB(%%mm7, %%mm5) // 11 6 /8 | |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
308 |
| 96 | 309 PAVGB(%%mm3, %%mm0) // 112 /4 |
| 310 PAVGB(%%mm0, %%mm5) // 112246 /16 | |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
311 "movq %%mm5, (%%eax, %1, 4) \n\t" // X |
| 140 | 312 "subl %1, %0 \n\t" |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
313 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
314 : |
| 787 | 315 : "r" (src), "r" (stride), "m" (c->pQPb) |
| 316 : "%eax", "%ecx" | |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
317 ); |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
318 #else |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
319 const int l1= stride; |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
320 const int l2= stride + l1; |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
321 const int l3= stride + l2; |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
322 const int l4= stride + l3; |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
323 const int l5= stride + l4; |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
324 const int l6= stride + l5; |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
325 const int l7= stride + l6; |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
326 const int l8= stride + l7; |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
327 const int l9= stride + l8; |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
328 int x; |
| 111 | 329 src+= stride*3; |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
330 for(x=0; x<BLOCK_SIZE; x++) |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
331 { |
| 787 | 332 const int first= ABS(src[0] - src[l1]) < c->QP ? src[0] : src[l1]; |
| 333 const int last= ABS(src[l8] - src[l9]) < c->QP ? src[l9] : src[l8]; | |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
334 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
335 int sums[9]; |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
336 sums[0] = first + src[l1]; |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
337 sums[1] = src[l1] + src[l2]; |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
338 sums[2] = src[l2] + src[l3]; |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
339 sums[3] = src[l3] + src[l4]; |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
340 sums[4] = src[l4] + src[l5]; |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
341 sums[5] = src[l5] + src[l6]; |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
342 sums[6] = src[l6] + src[l7]; |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
343 sums[7] = src[l7] + src[l8]; |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
344 sums[8] = src[l8] + last; |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
345 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
346 src[l1]= ((sums[0]<<2) + ((first + sums[2])<<1) + sums[4] + 8)>>4; |
|
129
be35346e27c1
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
128
diff
changeset
|
347 src[l2]= ((src[l2]<<2) + ((first + sums[0] + sums[3])<<1) + sums[5] + 8)>>4; |
|
be35346e27c1
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
128
diff
changeset
|
348 src[l3]= ((src[l3]<<2) + ((first + sums[1] + sums[4])<<1) + sums[6] + 8)>>4; |
|
be35346e27c1
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
128
diff
changeset
|
349 src[l4]= ((src[l4]<<2) + ((sums[2] + sums[5])<<1) + sums[0] + sums[7] + 8)>>4; |
|
be35346e27c1
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
128
diff
changeset
|
350 src[l5]= ((src[l5]<<2) + ((sums[3] + sums[6])<<1) + sums[1] + sums[8] + 8)>>4; |
|
be35346e27c1
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
128
diff
changeset
|
351 src[l6]= ((src[l6]<<2) + ((last + sums[7] + sums[4])<<1) + sums[2] + 8)>>4; |
|
be35346e27c1
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
128
diff
changeset
|
352 src[l7]= (((last + src[l7])<<2) + ((src[l8] + sums[5])<<1) + sums[3] + 8)>>4; |
|
be35346e27c1
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
128
diff
changeset
|
353 src[l8]= ((sums[8]<<2) + ((last + sums[6])<<1) + sums[4] + 8)>>4; |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
354 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
355 src++; |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
356 } |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
357 #endif |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
358 } |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
359 |
| 787 | 360 #if 0 |
| 96 | 361 /** |
| 362 * Experimental implementation of the filter (Algorithm 1) described in a paper from Ramkishor & Karandikar | |
| 363 * values are correctly clipped (MMX2) | |
| 364 * values are wraparound (C) | |
| 365 * conclusion: its fast, but introduces ugly horizontal patterns if there is a continious gradient | |
| 366 0 8 16 24 | |
| 367 x = 8 | |
| 368 x/2 = 4 | |
| 369 x/8 = 1 | |
| 370 1 12 12 23 | |
| 371 */ | |
| 169 | 372 static inline void RENAME(vertRK1Filter)(uint8_t *src, int stride, int QP) |
| 96 | 373 { |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
374 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW) |
| 111 | 375 src+= stride*3; |
| 96 | 376 // FIXME rounding |
| 377 asm volatile( | |
| 378 "pxor %%mm7, %%mm7 \n\t" // 0 | |
| 210 | 379 "movq "MANGLE(b80)", %%mm6 \n\t" // MIN_SIGNED_BYTE |
| 96 | 380 "leal (%0, %1), %%eax \n\t" |
| 787 | 381 "leal (%%eax, %1, 4), %%ecx \n\t" |
| 96 | 382 // 0 1 2 3 4 5 6 7 8 9 |
| 787 | 383 // %0 eax eax+%1 eax+2%1 %0+4%1 ecx ecx+%1 ecx+2%1 %0+8%1 ecx+4%1 |
| 210 | 384 "movq "MANGLE(pQPb)", %%mm0 \n\t" // QP,..., QP |
| 96 | 385 "movq %%mm0, %%mm1 \n\t" // QP,..., QP |
| 210 | 386 "paddusb "MANGLE(b02)", %%mm0 \n\t" |
| 96 | 387 "psrlw $2, %%mm0 \n\t" |
| 210 | 388 "pand "MANGLE(b3F)", %%mm0 \n\t" // QP/4,..., QP/4 |
| 96 | 389 "paddusb %%mm1, %%mm0 \n\t" // QP*1.25 ... |
| 390 "movq (%0, %1, 4), %%mm2 \n\t" // line 4 | |
| 787 | 391 "movq (%%ecx), %%mm3 \n\t" // line 5 |
| 96 | 392 "movq %%mm2, %%mm4 \n\t" // line 4 |
| 393 "pcmpeqb %%mm5, %%mm5 \n\t" // -1 | |
| 394 "pxor %%mm2, %%mm5 \n\t" // -line 4 - 1 | |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
395 PAVGB(%%mm3, %%mm5) |
| 96 | 396 "paddb %%mm6, %%mm5 \n\t" // (l5-l4)/2 |
| 397 "psubusb %%mm3, %%mm4 \n\t" | |
| 398 "psubusb %%mm2, %%mm3 \n\t" | |
| 399 "por %%mm3, %%mm4 \n\t" // |l4 - l5| | |
| 400 "psubusb %%mm0, %%mm4 \n\t" | |
| 401 "pcmpeqb %%mm7, %%mm4 \n\t" | |
| 402 "pand %%mm4, %%mm5 \n\t" // d/2 | |
| 403 | |
| 404 // "paddb %%mm6, %%mm2 \n\t" // line 4 + 0x80 | |
| 405 "paddb %%mm5, %%mm2 \n\t" | |
| 406 // "psubb %%mm6, %%mm2 \n\t" | |
| 407 "movq %%mm2, (%0,%1, 4) \n\t" | |
| 408 | |
| 787 | 409 "movq (%%ecx), %%mm2 \n\t" |
| 96 | 410 // "paddb %%mm6, %%mm2 \n\t" // line 5 + 0x80 |
| 411 "psubb %%mm5, %%mm2 \n\t" | |
| 412 // "psubb %%mm6, %%mm2 \n\t" | |
| 787 | 413 "movq %%mm2, (%%ecx) \n\t" |
| 96 | 414 |
| 415 "paddb %%mm6, %%mm5 \n\t" | |
| 416 "psrlw $2, %%mm5 \n\t" | |
| 210 | 417 "pand "MANGLE(b3F)", %%mm5 \n\t" |
| 418 "psubb "MANGLE(b20)", %%mm5 \n\t" // (l5-l4)/8 | |
| 96 | 419 |
| 420 "movq (%%eax, %1, 2), %%mm2 \n\t" | |
| 421 "paddb %%mm6, %%mm2 \n\t" // line 3 + 0x80 | |
| 422 "paddsb %%mm5, %%mm2 \n\t" | |
| 423 "psubb %%mm6, %%mm2 \n\t" | |
| 424 "movq %%mm2, (%%eax, %1, 2) \n\t" | |
| 425 | |
| 787 | 426 "movq (%%ecx, %1), %%mm2 \n\t" |
| 96 | 427 "paddb %%mm6, %%mm2 \n\t" // line 6 + 0x80 |
| 428 "psubsb %%mm5, %%mm2 \n\t" | |
| 429 "psubb %%mm6, %%mm2 \n\t" | |
| 787 | 430 "movq %%mm2, (%%ecx, %1) \n\t" |
| 96 | 431 |
| 432 : | |
| 433 : "r" (src), "r" (stride) | |
| 787 | 434 : "%eax", "%ecx" |
| 96 | 435 ); |
| 436 #else | |
| 437 const int l1= stride; | |
| 438 const int l2= stride + l1; | |
| 439 const int l3= stride + l2; | |
| 440 const int l4= stride + l3; | |
| 441 const int l5= stride + l4; | |
| 442 const int l6= stride + l5; | |
|
129
be35346e27c1
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
128
diff
changeset
|
443 // const int l7= stride + l6; |
|
be35346e27c1
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
128
diff
changeset
|
444 // const int l8= stride + l7; |
|
be35346e27c1
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
128
diff
changeset
|
445 // const int l9= stride + l8; |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
446 int x; |
| 141 | 447 const int QP15= QP + (QP>>2); |
| 111 | 448 src+= stride*3; |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
449 for(x=0; x<BLOCK_SIZE; x++) |
| 96 | 450 { |
| 141 | 451 const int v = (src[x+l5] - src[x+l4]); |
| 452 if(ABS(v) < QP15) | |
| 96 | 453 { |
| 141 | 454 src[x+l3] +=v>>3; |
| 455 src[x+l4] +=v>>1; | |
| 456 src[x+l5] -=v>>1; | |
| 457 src[x+l6] -=v>>3; | |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
458 |
| 96 | 459 } |
| 460 } | |
| 461 | |
| 462 #endif | |
| 463 } | |
| 787 | 464 #endif |
| 96 | 465 |
| 466 /** | |
| 467 * Experimental Filter 1 | |
| 99 | 468 * will not damage linear gradients |
| 469 * Flat blocks should look like they where passed through the (1,1,2,2,4,2,2,1,1) 9-Tap filter | |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
470 * can only smooth blocks at the expected locations (it cant smooth them if they did move) |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
471 * MMX2 version does correct clipping C version doesnt |
| 96 | 472 */ |
| 787 | 473 static inline void RENAME(vertX1Filter)(uint8_t *src, int stride, PPContext *co) |
| 96 | 474 { |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
475 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW) |
| 111 | 476 src+= stride*3; |
| 477 | |
| 96 | 478 asm volatile( |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
479 "pxor %%mm7, %%mm7 \n\t" // 0 |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
480 "leal (%0, %1), %%eax \n\t" |
| 787 | 481 "leal (%%eax, %1, 4), %%ecx \n\t" |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
482 // 0 1 2 3 4 5 6 7 8 9 |
| 787 | 483 // %0 eax eax+%1 eax+2%1 %0+4%1 ecx ecx+%1 ecx+2%1 %0+8%1 ecx+4%1 |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
484 "movq (%%eax, %1, 2), %%mm0 \n\t" // line 3 |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
485 "movq (%0, %1, 4), %%mm1 \n\t" // line 4 |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
486 "movq %%mm1, %%mm2 \n\t" // line 4 |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
487 "psubusb %%mm0, %%mm1 \n\t" |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
488 "psubusb %%mm2, %%mm0 \n\t" |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
489 "por %%mm1, %%mm0 \n\t" // |l2 - l3| |
| 787 | 490 "movq (%%ecx), %%mm3 \n\t" // line 5 |
| 491 "movq (%%ecx, %1), %%mm4 \n\t" // line 6 | |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
492 "movq %%mm3, %%mm5 \n\t" // line 5 |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
493 "psubusb %%mm4, %%mm3 \n\t" |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
494 "psubusb %%mm5, %%mm4 \n\t" |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
495 "por %%mm4, %%mm3 \n\t" // |l5 - l6| |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
496 PAVGB(%%mm3, %%mm0) // (|l2 - l3| + |l5 - l6|)/2 |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
497 "movq %%mm2, %%mm1 \n\t" // line 4 |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
498 "psubusb %%mm5, %%mm2 \n\t" |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
499 "movq %%mm2, %%mm4 \n\t" |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
500 "pcmpeqb %%mm7, %%mm2 \n\t" // (l4 - l5) <= 0 ? -1 : 0 |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
501 "psubusb %%mm1, %%mm5 \n\t" |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
502 "por %%mm5, %%mm4 \n\t" // |l4 - l5| |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
503 "psubusb %%mm0, %%mm4 \n\t" //d = MAX(0, |l4-l5| - (|l2-l3| + |l5-l6|)/2) |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
504 "movq %%mm4, %%mm3 \n\t" // d |
| 787 | 505 "movq %2, %%mm0 \n\t" |
| 334 | 506 "paddusb %%mm0, %%mm0 \n\t" |
| 507 "psubusb %%mm0, %%mm4 \n\t" | |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
508 "pcmpeqb %%mm7, %%mm4 \n\t" // d <= QP ? -1 : 0 |
| 210 | 509 "psubusb "MANGLE(b01)", %%mm3 \n\t" |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
510 "pand %%mm4, %%mm3 \n\t" // d <= QP ? d : 0 |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
511 |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
512 PAVGB(%%mm7, %%mm3) // d/2 |
| 99 | 513 "movq %%mm3, %%mm1 \n\t" // d/2 |
| 514 PAVGB(%%mm7, %%mm3) // d/4 | |
| 515 PAVGB(%%mm1, %%mm3) // 3*d/8 | |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
516 |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
517 "movq (%0, %1, 4), %%mm0 \n\t" // line 4 |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
518 "pxor %%mm2, %%mm0 \n\t" //(l4 - l5) <= 0 ? -l4-1 : l4 |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
519 "psubusb %%mm3, %%mm0 \n\t" |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
520 "pxor %%mm2, %%mm0 \n\t" |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
521 "movq %%mm0, (%0, %1, 4) \n\t" // line 4 |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
522 |
| 787 | 523 "movq (%%ecx), %%mm0 \n\t" // line 5 |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
524 "pxor %%mm2, %%mm0 \n\t" //(l4 - l5) <= 0 ? -l5-1 : l5 |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
525 "paddusb %%mm3, %%mm0 \n\t" |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
526 "pxor %%mm2, %%mm0 \n\t" |
| 787 | 527 "movq %%mm0, (%%ecx) \n\t" // line 5 |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
528 |
| 99 | 529 PAVGB(%%mm7, %%mm1) // d/4 |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
530 |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
531 "movq (%%eax, %1, 2), %%mm0 \n\t" // line 3 |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
532 "pxor %%mm2, %%mm0 \n\t" //(l4 - l5) <= 0 ? -l4-1 : l4 |
| 99 | 533 "psubusb %%mm1, %%mm0 \n\t" |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
534 "pxor %%mm2, %%mm0 \n\t" |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
535 "movq %%mm0, (%%eax, %1, 2) \n\t" // line 3 |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
536 |
| 787 | 537 "movq (%%ecx, %1), %%mm0 \n\t" // line 6 |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
538 "pxor %%mm2, %%mm0 \n\t" //(l4 - l5) <= 0 ? -l5-1 : l5 |
| 99 | 539 "paddusb %%mm1, %%mm0 \n\t" |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
540 "pxor %%mm2, %%mm0 \n\t" |
| 787 | 541 "movq %%mm0, (%%ecx, %1) \n\t" // line 6 |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
542 |
| 99 | 543 PAVGB(%%mm7, %%mm1) // d/8 |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
544 |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
545 "movq (%%eax, %1), %%mm0 \n\t" // line 2 |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
546 "pxor %%mm2, %%mm0 \n\t" //(l4 - l5) <= 0 ? -l2-1 : l2 |
| 99 | 547 "psubusb %%mm1, %%mm0 \n\t" |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
548 "pxor %%mm2, %%mm0 \n\t" |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
549 "movq %%mm0, (%%eax, %1) \n\t" // line 2 |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
550 |
| 787 | 551 "movq (%%ecx, %1, 2), %%mm0 \n\t" // line 7 |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
552 "pxor %%mm2, %%mm0 \n\t" //(l4 - l5) <= 0 ? -l7-1 : l7 |
| 99 | 553 "paddusb %%mm1, %%mm0 \n\t" |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
554 "pxor %%mm2, %%mm0 \n\t" |
| 787 | 555 "movq %%mm0, (%%ecx, %1, 2) \n\t" // line 7 |
| 96 | 556 |
| 557 : | |
| 787 | 558 : "r" (src), "r" (stride), "m" (co->pQPb) |
| 559 : "%eax", "%ecx" | |
| 96 | 560 ); |
| 561 #else | |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
562 |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
563 const int l1= stride; |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
564 const int l2= stride + l1; |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
565 const int l3= stride + l2; |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
566 const int l4= stride + l3; |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
567 const int l5= stride + l4; |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
568 const int l6= stride + l5; |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
569 const int l7= stride + l6; |
|
129
be35346e27c1
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
128
diff
changeset
|
570 // const int l8= stride + l7; |
|
be35346e27c1
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
128
diff
changeset
|
571 // const int l9= stride + l8; |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
572 int x; |
| 111 | 573 |
| 574 src+= stride*3; | |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
575 for(x=0; x<BLOCK_SIZE; x++) |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
576 { |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
577 int a= src[l3] - src[l4]; |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
578 int b= src[l4] - src[l5]; |
| 99 | 579 int c= src[l5] - src[l6]; |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
580 |
| 141 | 581 int d= ABS(b) - ((ABS(a) + ABS(c))>>1); |
| 582 d= MAX(d, 0); | |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
583 |
| 787 | 584 if(d < co->QP*2) |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
585 { |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
586 int v = d * SIGN(-b); |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
587 |
| 141 | 588 src[l2] +=v>>3; |
| 589 src[l3] +=v>>2; | |
| 590 src[l4] +=(3*v)>>3; | |
| 591 src[l5] -=(3*v)>>3; | |
| 592 src[l6] -=v>>2; | |
| 593 src[l7] -=v>>3; | |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
594 |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
595 } |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
596 src++; |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
597 } |
| 96 | 598 #endif |
| 599 } | |
| 600 | |
| 787 | 601 static inline void RENAME(doVertDefFilter)(uint8_t src[], int stride, PPContext *c) |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
602 { |
| 163 | 603 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW) |
| 604 /* | |
| 605 uint8_t tmp[16]; | |
| 606 const int l1= stride; | |
| 607 const int l2= stride + l1; | |
| 608 const int l3= stride + l2; | |
| 609 const int l4= (int)tmp - (int)src - stride*3; | |
| 610 const int l5= (int)tmp - (int)src - stride*3 + 8; | |
| 611 const int l6= stride*3 + l3; | |
| 612 const int l7= stride + l6; | |
| 613 const int l8= stride + l7; | |
| 614 | |
| 615 memcpy(tmp, src+stride*7, 8); | |
| 616 memcpy(tmp+8, src+stride*8, 8); | |
| 617 */ | |
| 111 | 618 src+= stride*4; |
| 163 | 619 asm volatile( |
| 620 | |
| 621 #if 0 //sligtly more accurate and slightly slower | |
| 622 "pxor %%mm7, %%mm7 \n\t" // 0 | |
| 623 "leal (%0, %1), %%eax \n\t" | |
| 787 | 624 "leal (%%eax, %1, 4), %%ecx \n\t" |
| 163 | 625 // 0 1 2 3 4 5 6 7 |
| 787 | 626 // %0 %0+%1 %0+2%1 eax+2%1 %0+4%1 eax+4%1 ecx+%1 ecx+2%1 |
| 627 // %0 eax eax+%1 eax+2%1 %0+4%1 ecx ecx+%1 ecx+2%1 | |
| 163 | 628 |
| 629 | |
| 630 "movq (%0, %1, 2), %%mm0 \n\t" // l2 | |
| 631 "movq (%0), %%mm1 \n\t" // l0 | |
| 632 "movq %%mm0, %%mm2 \n\t" // l2 | |
| 633 PAVGB(%%mm7, %%mm0) // ~l2/2 | |
| 634 PAVGB(%%mm1, %%mm0) // ~(l2 + 2l0)/4 | |
| 635 PAVGB(%%mm2, %%mm0) // ~(5l2 + 2l0)/8 | |
| 636 | |
| 637 "movq (%%eax), %%mm1 \n\t" // l1 | |
| 638 "movq (%%eax, %1, 2), %%mm3 \n\t" // l3 | |
| 639 "movq %%mm1, %%mm4 \n\t" // l1 | |
| 640 PAVGB(%%mm7, %%mm1) // ~l1/2 | |
| 641 PAVGB(%%mm3, %%mm1) // ~(l1 + 2l3)/4 | |
| 642 PAVGB(%%mm4, %%mm1) // ~(5l1 + 2l3)/8 | |
| 643 | |
| 644 "movq %%mm0, %%mm4 \n\t" // ~(5l2 + 2l0)/8 | |
| 645 "psubusb %%mm1, %%mm0 \n\t" | |
| 646 "psubusb %%mm4, %%mm1 \n\t" | |
| 647 "por %%mm0, %%mm1 \n\t" // ~|2l0 - 5l1 + 5l2 - 2l3|/8 | |
| 648 // mm1= |lenergy|, mm2= l2, mm3= l3, mm7=0 | |
| 649 | |
| 650 "movq (%0, %1, 4), %%mm0 \n\t" // l4 | |
| 651 "movq %%mm0, %%mm4 \n\t" // l4 | |
| 652 PAVGB(%%mm7, %%mm0) // ~l4/2 | |
| 653 PAVGB(%%mm2, %%mm0) // ~(l4 + 2l2)/4 | |
| 654 PAVGB(%%mm4, %%mm0) // ~(5l4 + 2l2)/8 | |
| 655 | |
| 787 | 656 "movq (%%ecx), %%mm2 \n\t" // l5 |
| 163 | 657 "movq %%mm3, %%mm5 \n\t" // l3 |
| 658 PAVGB(%%mm7, %%mm3) // ~l3/2 | |
| 659 PAVGB(%%mm2, %%mm3) // ~(l3 + 2l5)/4 | |
| 660 PAVGB(%%mm5, %%mm3) // ~(5l3 + 2l5)/8 | |
| 661 | |
| 662 "movq %%mm0, %%mm6 \n\t" // ~(5l4 + 2l2)/8 | |
| 663 "psubusb %%mm3, %%mm0 \n\t" | |
| 664 "psubusb %%mm6, %%mm3 \n\t" | |
| 665 "por %%mm0, %%mm3 \n\t" // ~|2l2 - 5l3 + 5l4 - 2l5|/8 | |
| 666 "pcmpeqb %%mm7, %%mm0 \n\t" // SIGN(2l2 - 5l3 + 5l4 - 2l5) | |
| 667 // mm0= SIGN(menergy), mm1= |lenergy|, mm2= l5, mm3= |menergy|, mm4=l4, mm5= l3, mm7=0 | |
| 668 | |
| 787 | 669 "movq (%%ecx, %1), %%mm6 \n\t" // l6 |
| 163 | 670 "movq %%mm6, %%mm5 \n\t" // l6 |
| 671 PAVGB(%%mm7, %%mm6) // ~l6/2 | |
| 672 PAVGB(%%mm4, %%mm6) // ~(l6 + 2l4)/4 | |
| 673 PAVGB(%%mm5, %%mm6) // ~(5l6 + 2l4)/8 | |
| 674 | |
| 787 | 675 "movq (%%ecx, %1, 2), %%mm5 \n\t" // l7 |
| 163 | 676 "movq %%mm2, %%mm4 \n\t" // l5 |
| 677 PAVGB(%%mm7, %%mm2) // ~l5/2 | |
| 678 PAVGB(%%mm5, %%mm2) // ~(l5 + 2l7)/4 | |
| 679 PAVGB(%%mm4, %%mm2) // ~(5l5 + 2l7)/8 | |
| 680 | |
| 681 "movq %%mm6, %%mm4 \n\t" // ~(5l6 + 2l4)/8 | |
| 682 "psubusb %%mm2, %%mm6 \n\t" | |
| 683 "psubusb %%mm4, %%mm2 \n\t" | |
| 684 "por %%mm6, %%mm2 \n\t" // ~|2l4 - 5l5 + 5l6 - 2l7|/8 | |
| 685 // mm0= SIGN(menergy), mm1= |lenergy|/8, mm2= |renergy|/8, mm3= |menergy|/8, mm7=0 | |
| 686 | |
| 687 | |
| 688 PMINUB(%%mm2, %%mm1, %%mm4) // MIN(|lenergy|,|renergy|)/8 | |
| 787 | 689 "movq %2, %%mm4 \n\t" // QP //FIXME QP+1 ? |
| 210 | 690 "paddusb "MANGLE(b01)", %%mm4 \n\t" |
| 163 | 691 "pcmpgtb %%mm3, %%mm4 \n\t" // |menergy|/8 < QP |
| 692 "psubusb %%mm1, %%mm3 \n\t" // d=|menergy|/8-MIN(|lenergy|,|renergy|)/8 | |
| 693 "pand %%mm4, %%mm3 \n\t" | |
| 694 | |
| 695 "movq %%mm3, %%mm1 \n\t" | |
| 210 | 696 // "psubusb "MANGLE(b01)", %%mm3 \n\t" |
| 163 | 697 PAVGB(%%mm7, %%mm3) |
| 698 PAVGB(%%mm7, %%mm3) | |
| 699 "paddusb %%mm1, %%mm3 \n\t" | |
| 210 | 700 // "paddusb "MANGLE(b01)", %%mm3 \n\t" |
| 163 | 701 |
| 702 "movq (%%eax, %1, 2), %%mm6 \n\t" //l3 | |
| 703 "movq (%0, %1, 4), %%mm5 \n\t" //l4 | |
| 704 "movq (%0, %1, 4), %%mm4 \n\t" //l4 | |
| 705 "psubusb %%mm6, %%mm5 \n\t" | |
| 706 "psubusb %%mm4, %%mm6 \n\t" | |
| 707 "por %%mm6, %%mm5 \n\t" // |l3-l4| | |
| 708 "pcmpeqb %%mm7, %%mm6 \n\t" // SIGN(l3-l4) | |
| 709 "pxor %%mm6, %%mm0 \n\t" | |
| 710 "pand %%mm0, %%mm3 \n\t" | |
| 711 PMINUB(%%mm5, %%mm3, %%mm0) | |
| 712 | |
| 210 | 713 "psubusb "MANGLE(b01)", %%mm3 \n\t" |
| 163 | 714 PAVGB(%%mm7, %%mm3) |
| 715 | |
| 716 "movq (%%eax, %1, 2), %%mm0 \n\t" | |
| 717 "movq (%0, %1, 4), %%mm2 \n\t" | |
| 718 "pxor %%mm6, %%mm0 \n\t" | |
| 719 "pxor %%mm6, %%mm2 \n\t" | |
| 720 "psubb %%mm3, %%mm0 \n\t" | |
| 721 "paddb %%mm3, %%mm2 \n\t" | |
| 722 "pxor %%mm6, %%mm0 \n\t" | |
| 723 "pxor %%mm6, %%mm2 \n\t" | |
| 724 "movq %%mm0, (%%eax, %1, 2) \n\t" | |
| 725 "movq %%mm2, (%0, %1, 4) \n\t" | |
| 726 #endif | |
| 727 | |
| 728 "leal (%0, %1), %%eax \n\t" | |
| 729 "pcmpeqb %%mm6, %%mm6 \n\t" // -1 | |
| 730 // 0 1 2 3 4 5 6 7 | |
| 787 | 731 // %0 %0+%1 %0+2%1 eax+2%1 %0+4%1 eax+4%1 ecx+%1 ecx+2%1 |
| 732 // %0 eax eax+%1 eax+2%1 %0+4%1 ecx ecx+%1 ecx+2%1 | |
| 163 | 733 |
| 734 | |
| 735 "movq (%%eax, %1, 2), %%mm1 \n\t" // l3 | |
| 736 "movq (%0, %1, 4), %%mm0 \n\t" // l4 | |
| 737 "pxor %%mm6, %%mm1 \n\t" // -l3-1 | |
| 738 PAVGB(%%mm1, %%mm0) // -q+128 = (l4-l3+256)/2 | |
| 739 // mm1=-l3-1, mm0=128-q | |
| 740 | |
| 741 "movq (%%eax, %1, 4), %%mm2 \n\t" // l5 | |
| 742 "movq (%%eax, %1), %%mm3 \n\t" // l2 | |
| 743 "pxor %%mm6, %%mm2 \n\t" // -l5-1 | |
| 744 "movq %%mm2, %%mm5 \n\t" // -l5-1 | |
| 210 | 745 "movq "MANGLE(b80)", %%mm4 \n\t" // 128 |
| 787 | 746 "leal (%%eax, %1, 4), %%ecx \n\t" |
| 163 | 747 PAVGB(%%mm3, %%mm2) // (l2-l5+256)/2 |
| 748 PAVGB(%%mm0, %%mm4) // ~(l4-l3)/4 + 128 | |
| 749 PAVGB(%%mm2, %%mm4) // ~(l2-l5)/4 +(l4-l3)/8 + 128 | |
| 750 PAVGB(%%mm0, %%mm4) // ~(l2-l5)/8 +5(l4-l3)/16 + 128 | |
| 751 // mm1=-l3-1, mm0=128-q, mm3=l2, mm4=menergy/16 + 128, mm5= -l5-1 | |
| 752 | |
| 753 "movq (%%eax), %%mm2 \n\t" // l1 | |
| 754 "pxor %%mm6, %%mm2 \n\t" // -l1-1 | |
| 755 PAVGB(%%mm3, %%mm2) // (l2-l1+256)/2 | |
| 756 PAVGB((%0), %%mm1) // (l0-l3+256)/2 | |
| 210 | 757 "movq "MANGLE(b80)", %%mm3 \n\t" // 128 |
| 163 | 758 PAVGB(%%mm2, %%mm3) // ~(l2-l1)/4 + 128 |
| 759 PAVGB(%%mm1, %%mm3) // ~(l0-l3)/4 +(l2-l1)/8 + 128 | |
| 760 PAVGB(%%mm2, %%mm3) // ~(l0-l3)/8 +5(l2-l1)/16 + 128 | |
| 761 // mm0=128-q, mm3=lenergy/16 + 128, mm4= menergy/16 + 128, mm5= -l5-1 | |
| 762 | |
| 787 | 763 PAVGB((%%ecx, %1), %%mm5) // (l6-l5+256)/2 |
| 764 "movq (%%ecx, %1, 2), %%mm1 \n\t" // l7 | |
| 163 | 765 "pxor %%mm6, %%mm1 \n\t" // -l7-1 |
| 766 PAVGB((%0, %1, 4), %%mm1) // (l4-l7+256)/2 | |
| 210 | 767 "movq "MANGLE(b80)", %%mm2 \n\t" // 128 |
| 163 | 768 PAVGB(%%mm5, %%mm2) // ~(l6-l5)/4 + 128 |
| 769 PAVGB(%%mm1, %%mm2) // ~(l4-l7)/4 +(l6-l5)/8 + 128 | |
| 770 PAVGB(%%mm5, %%mm2) // ~(l4-l7)/8 +5(l6-l5)/16 + 128 | |
| 771 // mm0=128-q, mm2=renergy/16 + 128, mm3=lenergy/16 + 128, mm4= menergy/16 + 128 | |
| 772 | |
| 210 | 773 "movq "MANGLE(b00)", %%mm1 \n\t" // 0 |
| 774 "movq "MANGLE(b00)", %%mm5 \n\t" // 0 | |
| 163 | 775 "psubb %%mm2, %%mm1 \n\t" // 128 - renergy/16 |
| 776 "psubb %%mm3, %%mm5 \n\t" // 128 - lenergy/16 | |
| 777 PMAXUB(%%mm1, %%mm2) // 128 + |renergy/16| | |
| 778 PMAXUB(%%mm5, %%mm3) // 128 + |lenergy/16| | |
| 779 PMINUB(%%mm2, %%mm3, %%mm1) // 128 + MIN(|lenergy|,|renergy|)/16 | |
| 780 | |
| 781 // mm0=128-q, mm3=128 + MIN(|lenergy|,|renergy|)/16, mm4= menergy/16 + 128 | |
| 782 | |
| 210 | 783 "movq "MANGLE(b00)", %%mm7 \n\t" // 0 |
| 787 | 784 "movq %2, %%mm2 \n\t" // QP |
| 163 | 785 PAVGB(%%mm6, %%mm2) // 128 + QP/2 |
| 786 "psubb %%mm6, %%mm2 \n\t" | |
| 787 | |
| 788 "movq %%mm4, %%mm1 \n\t" | |
| 789 "pcmpgtb %%mm7, %%mm1 \n\t" // SIGN(menergy) | |
| 790 "pxor %%mm1, %%mm4 \n\t" | |
| 791 "psubb %%mm1, %%mm4 \n\t" // 128 + |menergy|/16 | |
| 792 "pcmpgtb %%mm4, %%mm2 \n\t" // |menergy|/16 < QP/2 | |
| 793 "psubusb %%mm3, %%mm4 \n\t" //d=|menergy|/16 - MIN(|lenergy|,|renergy|)/16 | |
| 794 // mm0=128-q, mm1= SIGN(menergy), mm2= |menergy|/16 < QP/2, mm4= d/16 | |
| 795 | |
| 796 "movq %%mm4, %%mm3 \n\t" // d | |
| 210 | 797 "psubusb "MANGLE(b01)", %%mm4 \n\t" |
| 163 | 798 PAVGB(%%mm7, %%mm4) // d/32 |
| 799 PAVGB(%%mm7, %%mm4) // (d + 32)/64 | |
| 800 "paddb %%mm3, %%mm4 \n\t" // 5d/64 | |
| 801 "pand %%mm2, %%mm4 \n\t" | |
| 802 | |
| 210 | 803 "movq "MANGLE(b80)", %%mm5 \n\t" // 128 |
| 163 | 804 "psubb %%mm0, %%mm5 \n\t" // q |
| 805 "paddsb %%mm6, %%mm5 \n\t" // fix bad rounding | |
| 806 "pcmpgtb %%mm5, %%mm7 \n\t" // SIGN(q) | |
| 807 "pxor %%mm7, %%mm5 \n\t" | |
| 808 | |
| 809 PMINUB(%%mm5, %%mm4, %%mm3) // MIN(|q|, 5d/64) | |
| 810 "pxor %%mm1, %%mm7 \n\t" // SIGN(d*q) | |
| 811 | |
| 812 "pand %%mm7, %%mm4 \n\t" | |
| 813 "movq (%%eax, %1, 2), %%mm0 \n\t" | |
| 814 "movq (%0, %1, 4), %%mm2 \n\t" | |
| 815 "pxor %%mm1, %%mm0 \n\t" | |
| 816 "pxor %%mm1, %%mm2 \n\t" | |
| 817 "paddb %%mm4, %%mm0 \n\t" | |
| 818 "psubb %%mm4, %%mm2 \n\t" | |
| 819 "pxor %%mm1, %%mm0 \n\t" | |
| 820 "pxor %%mm1, %%mm2 \n\t" | |
| 821 "movq %%mm0, (%%eax, %1, 2) \n\t" | |
| 822 "movq %%mm2, (%0, %1, 4) \n\t" | |
| 823 | |
| 824 : | |
| 787 | 825 : "r" (src), "r" (stride), "m" (c->pQPb) |
| 826 : "%eax", "%ecx" | |
| 163 | 827 ); |
| 828 | |
| 829 /* | |
| 830 { | |
| 831 int x; | |
| 832 src-= stride; | |
| 833 for(x=0; x<BLOCK_SIZE; x++) | |
| 834 { | |
| 835 const int middleEnergy= 5*(src[l5] - src[l4]) + 2*(src[l3] - src[l6]); | |
| 836 if(ABS(middleEnergy)< 8*QP) | |
| 837 { | |
| 838 const int q=(src[l4] - src[l5])/2; | |
| 839 const int leftEnergy= 5*(src[l3] - src[l2]) + 2*(src[l1] - src[l4]); | |
| 840 const int rightEnergy= 5*(src[l7] - src[l6]) + 2*(src[l5] - src[l8]); | |
| 841 | |
| 842 int d= ABS(middleEnergy) - MIN( ABS(leftEnergy), ABS(rightEnergy) ); | |
| 843 d= MAX(d, 0); | |
| 844 | |
| 845 d= (5*d + 32) >> 6; | |
| 846 d*= SIGN(-middleEnergy); | |
| 847 | |
| 848 if(q>0) | |
| 849 { | |
| 850 d= d<0 ? 0 : d; | |
| 851 d= d>q ? q : d; | |
| 852 } | |
| 853 else | |
| 854 { | |
| 855 d= d>0 ? 0 : d; | |
| 856 d= d<q ? q : d; | |
| 857 } | |
| 858 | |
| 859 src[l4]-= d; | |
| 860 src[l5]+= d; | |
| 861 } | |
| 862 src++; | |
| 863 } | |
| 864 src-=8; | |
| 865 for(x=0; x<8; x++) | |
| 866 { | |
| 867 int y; | |
| 868 for(y=4; y<6; y++) | |
| 869 { | |
| 870 int d= src[x+y*stride] - tmp[x+(y-4)*8]; | |
| 871 int ad= ABS(d); | |
| 872 static int max=0; | |
| 873 static int sum=0; | |
| 874 static int num=0; | |
| 875 static int bias=0; | |
| 876 | |
| 877 if(max<ad) max=ad; | |
| 878 sum+= ad>3 ? 1 : 0; | |
| 879 if(ad>3) | |
| 880 { | |
| 881 src[0] = src[7] = src[stride*7] = src[(stride+1)*7]=255; | |
| 882 } | |
| 883 if(y==4) bias+=d; | |
| 884 num++; | |
| 885 if(num%1000000 == 0) | |
| 886 { | |
| 887 printf(" %d %d %d %d\n", num, sum, max, bias); | |
| 888 } | |
| 889 } | |
| 890 } | |
| 891 } | |
| 892 */ | |
| 893 #elif defined (HAVE_MMX) | |
| 894 src+= stride*4; | |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
895 asm volatile( |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
896 "pxor %%mm7, %%mm7 \n\t" |
| 787 | 897 "leal -40(%%esp), %%ecx \n\t" // make space for 4 8-byte vars |
| 898 "andl $0xFFFFFFF8, %%ecx \n\t" // align | |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
899 // 0 1 2 3 4 5 6 7 |
| 787 | 900 // %0 %0+%1 %0+2%1 eax+2%1 %0+4%1 eax+4%1 edx+%1 edx+2%1 |
| 901 // %0 eax eax+%1 eax+2%1 %0+4%1 edx edx+%1 edx+2%1 | |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
902 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
903 "movq (%0), %%mm0 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
904 "movq %%mm0, %%mm1 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
905 "punpcklbw %%mm7, %%mm0 \n\t" // low part of line 0 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
906 "punpckhbw %%mm7, %%mm1 \n\t" // high part of line 0 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
907 |
| 810 | 908 "movq (%0, %1), %%mm2 \n\t" |
| 909 "leal (%0, %1, 2), %%eax \n\t" | |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
910 "movq %%mm2, %%mm3 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
911 "punpcklbw %%mm7, %%mm2 \n\t" // low part of line 1 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
912 "punpckhbw %%mm7, %%mm3 \n\t" // high part of line 1 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
913 |
| 810 | 914 "movq (%%eax), %%mm4 \n\t" |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
915 "movq %%mm4, %%mm5 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
916 "punpcklbw %%mm7, %%mm4 \n\t" // low part of line 2 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
917 "punpckhbw %%mm7, %%mm5 \n\t" // high part of line 2 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
918 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
919 "paddw %%mm0, %%mm0 \n\t" // 2L0 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
920 "paddw %%mm1, %%mm1 \n\t" // 2H0 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
921 "psubw %%mm4, %%mm2 \n\t" // L1 - L2 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
922 "psubw %%mm5, %%mm3 \n\t" // H1 - H2 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
923 "psubw %%mm2, %%mm0 \n\t" // 2L0 - L1 + L2 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
924 "psubw %%mm3, %%mm1 \n\t" // 2H0 - H1 + H2 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
925 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
926 "psllw $2, %%mm2 \n\t" // 4L1 - 4L2 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
927 "psllw $2, %%mm3 \n\t" // 4H1 - 4H2 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
928 "psubw %%mm2, %%mm0 \n\t" // 2L0 - 5L1 + 5L2 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
929 "psubw %%mm3, %%mm1 \n\t" // 2H0 - 5H1 + 5H2 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
930 |
| 810 | 931 "movq (%%eax, %1), %%mm2 \n\t" |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
932 "movq %%mm2, %%mm3 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
933 "punpcklbw %%mm7, %%mm2 \n\t" // L3 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
934 "punpckhbw %%mm7, %%mm3 \n\t" // H3 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
935 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
936 "psubw %%mm2, %%mm0 \n\t" // 2L0 - 5L1 + 5L2 - L3 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
937 "psubw %%mm3, %%mm1 \n\t" // 2H0 - 5H1 + 5H2 - H3 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
938 "psubw %%mm2, %%mm0 \n\t" // 2L0 - 5L1 + 5L2 - 2L3 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
939 "psubw %%mm3, %%mm1 \n\t" // 2H0 - 5H1 + 5H2 - 2H3 |
| 787 | 940 "movq %%mm0, (%%ecx) \n\t" // 2L0 - 5L1 + 5L2 - 2L3 |
| 941 "movq %%mm1, 8(%%ecx) \n\t" // 2H0 - 5H1 + 5H2 - 2H3 | |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
942 |
| 810 | 943 "movq (%%eax, %1, 2), %%mm0 \n\t" |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
944 "movq %%mm0, %%mm1 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
945 "punpcklbw %%mm7, %%mm0 \n\t" // L4 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
946 "punpckhbw %%mm7, %%mm1 \n\t" // H4 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
947 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
948 "psubw %%mm0, %%mm2 \n\t" // L3 - L4 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
949 "psubw %%mm1, %%mm3 \n\t" // H3 - H4 |
| 787 | 950 "movq %%mm2, 16(%%ecx) \n\t" // L3 - L4 |
| 951 "movq %%mm3, 24(%%ecx) \n\t" // H3 - H4 | |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
952 "paddw %%mm4, %%mm4 \n\t" // 2L2 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
953 "paddw %%mm5, %%mm5 \n\t" // 2H2 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
954 "psubw %%mm2, %%mm4 \n\t" // 2L2 - L3 + L4 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
955 "psubw %%mm3, %%mm5 \n\t" // 2H2 - H3 + H4 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
956 |
| 810 | 957 "leal (%%eax, %1), %0 \n\t" |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
958 "psllw $2, %%mm2 \n\t" // 4L3 - 4L4 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
959 "psllw $2, %%mm3 \n\t" // 4H3 - 4H4 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
960 "psubw %%mm2, %%mm4 \n\t" // 2L2 - 5L3 + 5L4 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
961 "psubw %%mm3, %%mm5 \n\t" // 2H2 - 5H3 + 5H4 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
962 //50 opcodes so far |
| 810 | 963 "movq (%0, %1, 2), %%mm2 \n\t" |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
964 "movq %%mm2, %%mm3 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
965 "punpcklbw %%mm7, %%mm2 \n\t" // L5 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
966 "punpckhbw %%mm7, %%mm3 \n\t" // H5 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
967 "psubw %%mm2, %%mm4 \n\t" // 2L2 - 5L3 + 5L4 - L5 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
968 "psubw %%mm3, %%mm5 \n\t" // 2H2 - 5H3 + 5H4 - H5 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
969 "psubw %%mm2, %%mm4 \n\t" // 2L2 - 5L3 + 5L4 - 2L5 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
970 "psubw %%mm3, %%mm5 \n\t" // 2H2 - 5H3 + 5H4 - 2H5 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
971 |
| 810 | 972 "movq (%%eax, %1, 4), %%mm6 \n\t" |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
973 "punpcklbw %%mm7, %%mm6 \n\t" // L6 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
974 "psubw %%mm6, %%mm2 \n\t" // L5 - L6 |
| 810 | 975 "movq (%%eax, %1, 4), %%mm6 \n\t" |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
976 "punpckhbw %%mm7, %%mm6 \n\t" // H6 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
977 "psubw %%mm6, %%mm3 \n\t" // H5 - H6 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
978 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
979 "paddw %%mm0, %%mm0 \n\t" // 2L4 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
980 "paddw %%mm1, %%mm1 \n\t" // 2H4 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
981 "psubw %%mm2, %%mm0 \n\t" // 2L4 - L5 + L6 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
982 "psubw %%mm3, %%mm1 \n\t" // 2H4 - H5 + H6 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
983 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
984 "psllw $2, %%mm2 \n\t" // 4L5 - 4L6 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
985 "psllw $2, %%mm3 \n\t" // 4H5 - 4H6 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
986 "psubw %%mm2, %%mm0 \n\t" // 2L4 - 5L5 + 5L6 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
987 "psubw %%mm3, %%mm1 \n\t" // 2H4 - 5H5 + 5H6 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
988 |
| 810 | 989 "movq (%0, %1, 4), %%mm2 \n\t" |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
990 "movq %%mm2, %%mm3 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
991 "punpcklbw %%mm7, %%mm2 \n\t" // L7 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
992 "punpckhbw %%mm7, %%mm3 \n\t" // H7 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
993 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
994 "paddw %%mm2, %%mm2 \n\t" // 2L7 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
995 "paddw %%mm3, %%mm3 \n\t" // 2H7 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
996 "psubw %%mm2, %%mm0 \n\t" // 2L4 - 5L5 + 5L6 - 2L7 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
997 "psubw %%mm3, %%mm1 \n\t" // 2H4 - 5H5 + 5H6 - 2H7 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
998 |
| 787 | 999 "movq (%%ecx), %%mm2 \n\t" // 2L0 - 5L1 + 5L2 - 2L3 |
| 1000 "movq 8(%%ecx), %%mm3 \n\t" // 2H0 - 5H1 + 5H2 - 2H3 | |
| 140 | 1001 |
| 1002 #ifdef HAVE_MMX2 | |
| 1003 "movq %%mm7, %%mm6 \n\t" // 0 | |
| 1004 "psubw %%mm0, %%mm6 \n\t" | |
| 1005 "pmaxsw %%mm6, %%mm0 \n\t" // |2L4 - 5L5 + 5L6 - 2L7| | |
| 1006 "movq %%mm7, %%mm6 \n\t" // 0 | |
| 1007 "psubw %%mm1, %%mm6 \n\t" | |
| 1008 "pmaxsw %%mm6, %%mm1 \n\t" // |2H4 - 5H5 + 5H6 - 2H7| | |
| 1009 "movq %%mm7, %%mm6 \n\t" // 0 | |
| 1010 "psubw %%mm2, %%mm6 \n\t" | |
| 1011 "pmaxsw %%mm6, %%mm2 \n\t" // |2L0 - 5L1 + 5L2 - 2L3| | |
| 1012 "movq %%mm7, %%mm6 \n\t" // 0 | |
| 1013 "psubw %%mm3, %%mm6 \n\t" | |
| 1014 "pmaxsw %%mm6, %%mm3 \n\t" // |2H0 - 5H1 + 5H2 - 2H3| | |
| 1015 #else | |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1016 "movq %%mm7, %%mm6 \n\t" // 0 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1017 "pcmpgtw %%mm0, %%mm6 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1018 "pxor %%mm6, %%mm0 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1019 "psubw %%mm6, %%mm0 \n\t" // |2L4 - 5L5 + 5L6 - 2L7| |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1020 "movq %%mm7, %%mm6 \n\t" // 0 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1021 "pcmpgtw %%mm1, %%mm6 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1022 "pxor %%mm6, %%mm1 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1023 "psubw %%mm6, %%mm1 \n\t" // |2H4 - 5H5 + 5H6 - 2H7| |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1024 "movq %%mm7, %%mm6 \n\t" // 0 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1025 "pcmpgtw %%mm2, %%mm6 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1026 "pxor %%mm6, %%mm2 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1027 "psubw %%mm6, %%mm2 \n\t" // |2L0 - 5L1 + 5L2 - 2L3| |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1028 "movq %%mm7, %%mm6 \n\t" // 0 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1029 "pcmpgtw %%mm3, %%mm6 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1030 "pxor %%mm6, %%mm3 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1031 "psubw %%mm6, %%mm3 \n\t" // |2H0 - 5H1 + 5H2 - 2H3| |
| 140 | 1032 #endif |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1033 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1034 #ifdef HAVE_MMX2 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1035 "pminsw %%mm2, %%mm0 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1036 "pminsw %%mm3, %%mm1 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1037 #else |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1038 "movq %%mm0, %%mm6 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1039 "psubusw %%mm2, %%mm6 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1040 "psubw %%mm6, %%mm0 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1041 "movq %%mm1, %%mm6 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1042 "psubusw %%mm3, %%mm6 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1043 "psubw %%mm6, %%mm1 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1044 #endif |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1045 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1046 "movq %%mm7, %%mm6 \n\t" // 0 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1047 "pcmpgtw %%mm4, %%mm6 \n\t" // sign(2L2 - 5L3 + 5L4 - 2L5) |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1048 "pxor %%mm6, %%mm4 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1049 "psubw %%mm6, %%mm4 \n\t" // |2L2 - 5L3 + 5L4 - 2L5| |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1050 "pcmpgtw %%mm5, %%mm7 \n\t" // sign(2H2 - 5H3 + 5H4 - 2H5) |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1051 "pxor %%mm7, %%mm5 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1052 "psubw %%mm7, %%mm5 \n\t" // |2H2 - 5H3 + 5H4 - 2H5| |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1053 // 100 opcodes |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1054 "movd %2, %%mm2 \n\t" // QP |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1055 "psllw $3, %%mm2 \n\t" // 8QP |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1056 "movq %%mm2, %%mm3 \n\t" // 8QP |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1057 "pcmpgtw %%mm4, %%mm2 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1058 "pcmpgtw %%mm5, %%mm3 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1059 "pand %%mm2, %%mm4 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1060 "pand %%mm3, %%mm5 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1061 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1062 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1063 "psubusw %%mm0, %%mm4 \n\t" // hd |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1064 "psubusw %%mm1, %%mm5 \n\t" // ld |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1065 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1066 |
| 211 | 1067 "movq "MANGLE(w05)", %%mm2 \n\t" // 5 |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1068 "pmullw %%mm2, %%mm4 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1069 "pmullw %%mm2, %%mm5 \n\t" |
| 211 | 1070 "movq "MANGLE(w20)", %%mm2 \n\t" // 32 |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1071 "paddw %%mm2, %%mm4 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1072 "paddw %%mm2, %%mm5 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1073 "psrlw $6, %%mm4 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1074 "psrlw $6, %%mm5 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1075 |
| 787 | 1076 "movq 16(%%ecx), %%mm0 \n\t" // L3 - L4 |
| 1077 "movq 24(%%ecx), %%mm1 \n\t" // H3 - H4 | |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1078 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1079 "pxor %%mm2, %%mm2 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1080 "pxor %%mm3, %%mm3 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1081 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1082 "pcmpgtw %%mm0, %%mm2 \n\t" // sign (L3-L4) |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1083 "pcmpgtw %%mm1, %%mm3 \n\t" // sign (H3-H4) |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1084 "pxor %%mm2, %%mm0 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1085 "pxor %%mm3, %%mm1 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1086 "psubw %%mm2, %%mm0 \n\t" // |L3-L4| |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1087 "psubw %%mm3, %%mm1 \n\t" // |H3-H4| |
|
129
be35346e27c1
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
128
diff
changeset
|
1088 "psrlw $1, %%mm0 \n\t" // |L3 - L4|/2 |
|
be35346e27c1
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
128
diff
changeset
|
1089 "psrlw $1, %%mm1 \n\t" // |H3 - H4|/2 |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1090 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1091 "pxor %%mm6, %%mm2 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1092 "pxor %%mm7, %%mm3 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1093 "pand %%mm2, %%mm4 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1094 "pand %%mm3, %%mm5 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1095 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1096 #ifdef HAVE_MMX2 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1097 "pminsw %%mm0, %%mm4 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1098 "pminsw %%mm1, %%mm5 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1099 #else |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1100 "movq %%mm4, %%mm2 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1101 "psubusw %%mm0, %%mm2 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1102 "psubw %%mm2, %%mm4 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1103 "movq %%mm5, %%mm2 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1104 "psubusw %%mm1, %%mm2 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1105 "psubw %%mm2, %%mm5 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1106 #endif |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1107 "pxor %%mm6, %%mm4 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1108 "pxor %%mm7, %%mm5 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1109 "psubw %%mm6, %%mm4 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1110 "psubw %%mm7, %%mm5 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1111 "packsswb %%mm5, %%mm4 \n\t" |
| 810 | 1112 "movq (%0), %%mm0 \n\t" |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1113 "paddb %%mm4, %%mm0 \n\t" |
| 810 | 1114 "movq %%mm0, (%0) \n\t" |
| 1115 "movq (%0, %1), %%mm0 \n\t" | |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1116 "psubb %%mm4, %%mm0 \n\t" |
| 810 | 1117 "movq %%mm0, (%0, %1) \n\t" |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1118 |
| 810 | 1119 : "+r" (src) |
| 1120 : "r" (stride), "m" (c->pQPb) | |
| 1121 : "%eax", "%ecx" | |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1122 ); |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1123 #else |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1124 const int l1= stride; |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1125 const int l2= stride + l1; |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1126 const int l3= stride + l2; |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1127 const int l4= stride + l3; |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1128 const int l5= stride + l4; |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1129 const int l6= stride + l5; |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1130 const int l7= stride + l6; |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1131 const int l8= stride + l7; |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1132 // const int l9= stride + l8; |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
1133 int x; |
| 111 | 1134 src+= stride*3; |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
1135 for(x=0; x<BLOCK_SIZE; x++) |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1136 { |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1137 const int middleEnergy= 5*(src[l5] - src[l4]) + 2*(src[l3] - src[l6]); |
| 787 | 1138 if(ABS(middleEnergy) < 8*c->QP) |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1139 { |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1140 const int q=(src[l4] - src[l5])/2; |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1141 const int leftEnergy= 5*(src[l3] - src[l2]) + 2*(src[l1] - src[l4]); |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1142 const int rightEnergy= 5*(src[l7] - src[l6]) + 2*(src[l5] - src[l8]); |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1143 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1144 int d= ABS(middleEnergy) - MIN( ABS(leftEnergy), ABS(rightEnergy) ); |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1145 d= MAX(d, 0); |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1146 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1147 d= (5*d + 32) >> 6; |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1148 d*= SIGN(-middleEnergy); |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1149 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1150 if(q>0) |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1151 { |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1152 d= d<0 ? 0 : d; |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1153 d= d>q ? q : d; |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1154 } |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1155 else |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1156 { |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1157 d= d>0 ? 0 : d; |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1158 d= d<q ? q : d; |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1159 } |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1160 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1161 src[l4]-= d; |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1162 src[l5]+= d; |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1163 } |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1164 src++; |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1165 } |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1166 #endif |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1167 } |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1168 |
| 787 | 1169 static inline void RENAME(dering)(uint8_t src[], int stride, PPContext *c) |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1170 { |
| 132 | 1171 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW) |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1172 asm volatile( |
| 787 | 1173 "pxor %%mm6, %%mm6 \n\t" |
| 1174 "pcmpeqb %%mm7, %%mm7 \n\t" | |
| 1175 "movq %2, %%mm0 \n\t" | |
| 1176 "punpcklbw %%mm6, %%mm0 \n\t" | |
| 1177 "psrlw $1, %%mm0 \n\t" | |
| 1178 "psubw %%mm7, %%mm0 \n\t" | |
| 1179 "packuswb %%mm0, %%mm0 \n\t" | |
| 1180 "movq %%mm0, %3 \n\t" | |
| 130 | 1181 |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1182 "leal (%0, %1), %%eax \n\t" |
| 787 | 1183 "leal (%%eax, %1, 4), %%edx \n\t" |
| 1184 | |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1185 // 0 1 2 3 4 5 6 7 8 9 |
| 787 | 1186 // %0 eax eax+%1 eax+2%1 %0+4%1 edx edx+%1 edx+2%1 %0+8%1 edx+4%1 |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1187 |
| 169 | 1188 #undef FIND_MIN_MAX |
| 132 | 1189 #ifdef HAVE_MMX2 |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1190 #define FIND_MIN_MAX(addr)\ |
| 130 | 1191 "movq " #addr ", %%mm0 \n\t"\ |
| 167 | 1192 "pminub %%mm0, %%mm7 \n\t"\ |
| 1193 "pmaxub %%mm0, %%mm6 \n\t" | |
| 132 | 1194 #else |
| 1195 #define FIND_MIN_MAX(addr)\ | |
| 1196 "movq " #addr ", %%mm0 \n\t"\ | |
| 167 | 1197 "movq %%mm7, %%mm1 \n\t"\ |
| 1198 "psubusb %%mm0, %%mm6 \n\t"\ | |
| 1199 "paddb %%mm0, %%mm6 \n\t"\ | |
| 132 | 1200 "psubusb %%mm0, %%mm1 \n\t"\ |
| 167 | 1201 "psubb %%mm1, %%mm7 \n\t" |
| 132 | 1202 #endif |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1203 |
| 130 | 1204 FIND_MIN_MAX((%%eax)) |
| 1205 FIND_MIN_MAX((%%eax, %1)) | |
| 1206 FIND_MIN_MAX((%%eax, %1, 2)) | |
| 1207 FIND_MIN_MAX((%0, %1, 4)) | |
| 787 | 1208 FIND_MIN_MAX((%%edx)) |
| 1209 FIND_MIN_MAX((%%edx, %1)) | |
| 1210 FIND_MIN_MAX((%%edx, %1, 2)) | |
| 130 | 1211 FIND_MIN_MAX((%0, %1, 8)) |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1212 |
| 167 | 1213 "movq %%mm7, %%mm4 \n\t" |
| 1214 "psrlq $8, %%mm7 \n\t" | |
| 1215 #ifdef HAVE_MMX2 | |
| 1216 "pminub %%mm4, %%mm7 \n\t" // min of pixels | |
| 1217 "pshufw $0xF9, %%mm7, %%mm4 \n\t" | |
| 1218 "pminub %%mm4, %%mm7 \n\t" // min of pixels | |
| 1219 "pshufw $0xFE, %%mm7, %%mm4 \n\t" | |
| 1220 "pminub %%mm4, %%mm7 \n\t" | |
| 1221 #else | |
| 1222 "movq %%mm7, %%mm1 \n\t" | |
| 1223 "psubusb %%mm4, %%mm1 \n\t" | |
| 1224 "psubb %%mm1, %%mm7 \n\t" | |
| 1225 "movq %%mm7, %%mm4 \n\t" | |
| 1226 "psrlq $16, %%mm7 \n\t" | |
| 1227 "movq %%mm7, %%mm1 \n\t" | |
| 1228 "psubusb %%mm4, %%mm1 \n\t" | |
| 1229 "psubb %%mm1, %%mm7 \n\t" | |
| 1230 "movq %%mm7, %%mm4 \n\t" | |
| 1231 "psrlq $32, %%mm7 \n\t" | |
| 1232 "movq %%mm7, %%mm1 \n\t" | |
| 1233 "psubusb %%mm4, %%mm1 \n\t" | |
| 1234 "psubb %%mm1, %%mm7 \n\t" | |
| 1235 #endif | |
| 1236 | |
| 1237 | |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1238 "movq %%mm6, %%mm4 \n\t" |
|
129
be35346e27c1
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
128
diff
changeset
|
1239 "psrlq $8, %%mm6 \n\t" |
| 132 | 1240 #ifdef HAVE_MMX2 |
| 167 | 1241 "pmaxub %%mm4, %%mm6 \n\t" // max of pixels |
|
129
be35346e27c1
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
128
diff
changeset
|
1242 "pshufw $0xF9, %%mm6, %%mm4 \n\t" |
| 167 | 1243 "pmaxub %%mm4, %%mm6 \n\t" |
|
129
be35346e27c1
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
128
diff
changeset
|
1244 "pshufw $0xFE, %%mm6, %%mm4 \n\t" |
| 167 | 1245 "pmaxub %%mm4, %%mm6 \n\t" |
|
129
be35346e27c1
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
128
diff
changeset
|
1246 #else |
| 167 | 1247 "psubusb %%mm4, %%mm6 \n\t" |
| 1248 "paddb %%mm4, %%mm6 \n\t" | |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1249 "movq %%mm6, %%mm4 \n\t" |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1250 "psrlq $16, %%mm6 \n\t" |
| 167 | 1251 "psubusb %%mm4, %%mm6 \n\t" |
| 1252 "paddb %%mm4, %%mm6 \n\t" | |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1253 "movq %%mm6, %%mm4 \n\t" |
|
129
be35346e27c1
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
128
diff
changeset
|
1254 "psrlq $32, %%mm6 \n\t" |
| 167 | 1255 "psubusb %%mm4, %%mm6 \n\t" |
| 1256 "paddb %%mm4, %%mm6 \n\t" | |
|
129
be35346e27c1
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
128
diff
changeset
|
1257 #endif |
| 167 | 1258 "movq %%mm6, %%mm0 \n\t" // max |
| 1259 "psubb %%mm7, %%mm6 \n\t" // max - min | |
| 1260 "movd %%mm6, %%ecx \n\t" | |
| 210 | 1261 "cmpb "MANGLE(deringThreshold)", %%cl \n\t" |
| 167 | 1262 " jb 1f \n\t" |
| 787 | 1263 "leal -24(%%esp), %%ecx \n\t" |
| 1264 "andl $0xFFFFFFF8, %%ecx \n\t" | |
| 167 | 1265 PAVGB(%%mm0, %%mm7) // a=(max + min)/2 |
|
129
be35346e27c1
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
128
diff
changeset
|
1266 "punpcklbw %%mm7, %%mm7 \n\t" |
|
be35346e27c1
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
128
diff
changeset
|
1267 "punpcklbw %%mm7, %%mm7 \n\t" |
|
be35346e27c1
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
128
diff
changeset
|
1268 "punpcklbw %%mm7, %%mm7 \n\t" |
| 787 | 1269 "movq %%mm7, (%%ecx) \n\t" |
| 130 | 1270 |
| 1271 "movq (%0), %%mm0 \n\t" // L10 | |
| 1272 "movq %%mm0, %%mm1 \n\t" // L10 | |
| 1273 "movq %%mm0, %%mm2 \n\t" // L10 | |
| 1274 "psllq $8, %%mm1 \n\t" | |
| 1275 "psrlq $8, %%mm2 \n\t" | |
| 1276 "movd -4(%0), %%mm3 \n\t" | |
| 1277 "movd 8(%0), %%mm4 \n\t" | |
| 1278 "psrlq $24, %%mm3 \n\t" | |
| 1279 "psllq $56, %%mm4 \n\t" | |
| 1280 "por %%mm3, %%mm1 \n\t" // L00 | |
| 1281 "por %%mm4, %%mm2 \n\t" // L20 | |
| 1282 "movq %%mm1, %%mm3 \n\t" // L00 | |
| 1283 PAVGB(%%mm2, %%mm1) // (L20 + L00)/2 | |
| 1284 PAVGB(%%mm0, %%mm1) // (L20 + L00 + 2L10)/4 | |
| 1285 "psubusb %%mm7, %%mm0 \n\t" | |
| 1286 "psubusb %%mm7, %%mm2 \n\t" | |
| 1287 "psubusb %%mm7, %%mm3 \n\t" | |
| 210 | 1288 "pcmpeqb "MANGLE(b00)", %%mm0 \n\t" // L10 > a ? 0 : -1 |
| 1289 "pcmpeqb "MANGLE(b00)", %%mm2 \n\t" // L20 > a ? 0 : -1 | |
| 1290 "pcmpeqb "MANGLE(b00)", %%mm3 \n\t" // L00 > a ? 0 : -1 | |
| 130 | 1291 "paddb %%mm2, %%mm0 \n\t" |
| 1292 "paddb %%mm3, %%mm0 \n\t" | |
| 1293 | |
| 1294 "movq (%%eax), %%mm2 \n\t" // L11 | |
| 1295 "movq %%mm2, %%mm3 \n\t" // L11 | |
| 1296 "movq %%mm2, %%mm4 \n\t" // L11 | |
| 1297 "psllq $8, %%mm3 \n\t" | |
| 1298 "psrlq $8, %%mm4 \n\t" | |
| 1299 "movd -4(%%eax), %%mm5 \n\t" | |
| 1300 "movd 8(%%eax), %%mm6 \n\t" | |
| 1301 "psrlq $24, %%mm5 \n\t" | |
| 1302 "psllq $56, %%mm6 \n\t" | |
| 1303 "por %%mm5, %%mm3 \n\t" // L01 | |
| 1304 "por %%mm6, %%mm4 \n\t" // L21 | |
| 1305 "movq %%mm3, %%mm5 \n\t" // L01 | |
| 1306 PAVGB(%%mm4, %%mm3) // (L21 + L01)/2 | |
| 1307 PAVGB(%%mm2, %%mm3) // (L21 + L01 + 2L11)/4 | |
| 1308 "psubusb %%mm7, %%mm2 \n\t" | |
| 1309 "psubusb %%mm7, %%mm4 \n\t" | |
| 1310 "psubusb %%mm7, %%mm5 \n\t" | |
| 210 | 1311 "pcmpeqb "MANGLE(b00)", %%mm2 \n\t" // L11 > a ? 0 : -1 |
| 1312 "pcmpeqb "MANGLE(b00)", %%mm4 \n\t" // L21 > a ? 0 : -1 | |
| 1313 "pcmpeqb "MANGLE(b00)", %%mm5 \n\t" // L01 > a ? 0 : -1 | |
| 130 | 1314 "paddb %%mm4, %%mm2 \n\t" |
| 1315 "paddb %%mm5, %%mm2 \n\t" | |
| 1316 // 0, 2, 3, 1 | |
| 1317 #define DERING_CORE(dst,src,ppsx,psx,sx,pplx,plx,lx,t0,t1) \ | |
| 1318 "movq " #src ", " #sx " \n\t" /* src[0] */\ | |
| 1319 "movq " #sx ", " #lx " \n\t" /* src[0] */\ | |
| 1320 "movq " #sx ", " #t0 " \n\t" /* src[0] */\ | |
| 1321 "psllq $8, " #lx " \n\t"\ | |
| 1322 "psrlq $8, " #t0 " \n\t"\ | |
| 1323 "movd -4" #src ", " #t1 " \n\t"\ | |
| 1324 "psrlq $24, " #t1 " \n\t"\ | |
| 1325 "por " #t1 ", " #lx " \n\t" /* src[-1] */\ | |
| 1326 "movd 8" #src ", " #t1 " \n\t"\ | |
| 1327 "psllq $56, " #t1 " \n\t"\ | |
| 1328 "por " #t1 ", " #t0 " \n\t" /* src[+1] */\ | |
| 1329 "movq " #lx ", " #t1 " \n\t" /* src[-1] */\ | |
| 1330 PAVGB(t0, lx) /* (src[-1] + src[+1])/2 */\ | |
| 1331 PAVGB(sx, lx) /* (src[-1] + 2src[0] + src[+1])/4 */\ | |
| 135 | 1332 PAVGB(lx, pplx) \ |
| 787 | 1333 "movq " #lx ", 8(%%ecx) \n\t"\ |
| 1334 "movq (%%ecx), " #lx " \n\t"\ | |
| 140 | 1335 "psubusb " #lx ", " #t1 " \n\t"\ |
| 1336 "psubusb " #lx ", " #t0 " \n\t"\ | |
| 1337 "psubusb " #lx ", " #sx " \n\t"\ | |
| 210 | 1338 "movq "MANGLE(b00)", " #lx " \n\t"\ |
| 140 | 1339 "pcmpeqb " #lx ", " #t1 " \n\t" /* src[-1] > a ? 0 : -1*/\ |
| 1340 "pcmpeqb " #lx ", " #t0 " \n\t" /* src[+1] > a ? 0 : -1*/\ | |
| 1341 "pcmpeqb " #lx ", " #sx " \n\t" /* src[0] > a ? 0 : -1*/\ | |
| 130 | 1342 "paddb " #t1 ", " #t0 " \n\t"\ |
| 1343 "paddb " #t0 ", " #sx " \n\t"\ | |
| 1344 \ | |
| 1345 PAVGB(plx, pplx) /* filtered */\ | |
| 1346 "movq " #dst ", " #t0 " \n\t" /* dst */\ | |
| 134 | 1347 "movq " #t0 ", " #t1 " \n\t" /* dst */\ |
| 787 | 1348 "psubusb %3, " #t0 " \n\t"\ |
| 1349 "paddusb %3, " #t1 " \n\t"\ | |
| 134 | 1350 PMAXUB(t0, pplx)\ |
| 1351 PMINUB(t1, pplx, t0)\ | |
| 130 | 1352 "paddb " #sx ", " #ppsx " \n\t"\ |
| 1353 "paddb " #psx ", " #ppsx " \n\t"\ | |
| 210 | 1354 "#paddb "MANGLE(b02)", " #ppsx " \n\t"\ |
| 1355 "pand "MANGLE(b08)", " #ppsx " \n\t"\ | |
| 140 | 1356 "pcmpeqb " #lx ", " #ppsx " \n\t"\ |
| 134 | 1357 "pand " #ppsx ", " #pplx " \n\t"\ |
| 130 | 1358 "pandn " #dst ", " #ppsx " \n\t"\ |
| 140 | 1359 "por " #pplx ", " #ppsx " \n\t"\ |
| 135 | 1360 "movq " #ppsx ", " #dst " \n\t"\ |
| 787 | 1361 "movq 8(%%ecx), " #lx " \n\t" |
| 134 | 1362 |
| 130 | 1363 /* |
| 1364 0000000 | |
| 1365 1111111 | |
| 1366 | |
| 1367 1111110 | |
| 1368 1111101 | |
| 1369 1111100 | |
| 1370 1111011 | |
| 1371 1111010 | |
| 1372 1111001 | |
| 1373 | |
| 1374 1111000 | |
| 1375 1110111 | |
| 1376 | |
| 1377 */ | |
| 1378 //DERING_CORE(dst,src ,ppsx ,psx ,sx ,pplx ,plx ,lx ,t0 ,t1) | |
| 1379 DERING_CORE((%%eax),(%%eax, %1) ,%%mm0,%%mm2,%%mm4,%%mm1,%%mm3,%%mm5,%%mm6,%%mm7) | |
| 1380 DERING_CORE((%%eax, %1),(%%eax, %1, 2) ,%%mm2,%%mm4,%%mm0,%%mm3,%%mm5,%%mm1,%%mm6,%%mm7) | |
| 1381 DERING_CORE((%%eax, %1, 2),(%0, %1, 4) ,%%mm4,%%mm0,%%mm2,%%mm5,%%mm1,%%mm3,%%mm6,%%mm7) | |
| 787 | 1382 DERING_CORE((%0, %1, 4),(%%edx) ,%%mm0,%%mm2,%%mm4,%%mm1,%%mm3,%%mm5,%%mm6,%%mm7) |
| 1383 DERING_CORE((%%edx),(%%edx, %1) ,%%mm2,%%mm4,%%mm0,%%mm3,%%mm5,%%mm1,%%mm6,%%mm7) | |
| 1384 DERING_CORE((%%edx, %1), (%%edx, %1, 2),%%mm4,%%mm0,%%mm2,%%mm5,%%mm1,%%mm3,%%mm6,%%mm7) | |
| 1385 DERING_CORE((%%edx, %1, 2),(%0, %1, 8) ,%%mm0,%%mm2,%%mm4,%%mm1,%%mm3,%%mm5,%%mm6,%%mm7) | |
| 1386 DERING_CORE((%0, %1, 8),(%%edx, %1, 4) ,%%mm2,%%mm4,%%mm0,%%mm3,%%mm5,%%mm1,%%mm6,%%mm7) | |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1387 |
| 167 | 1388 "1: \n\t" |
| 787 | 1389 : : "r" (src), "r" (stride), "m" (c->pQPb), "m"(c->pQPb2) |
| 1390 : "%eax", "%edx", "%ecx" | |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1391 ); |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1392 #else |
| 134 | 1393 int y; |
| 1394 int min=255; | |
| 1395 int max=0; | |
| 1396 int avg; | |
| 1397 uint8_t *p; | |
| 1398 int s[10]; | |
| 787 | 1399 const int QP2= c->QP/2 + 1; |
| 134 | 1400 |
| 1401 for(y=1; y<9; y++) | |
| 1402 { | |
| 1403 int x; | |
| 1404 p= src + stride*y; | |
| 1405 for(x=1; x<9; x++) | |
| 1406 { | |
| 1407 p++; | |
| 1408 if(*p > max) max= *p; | |
| 1409 if(*p < min) min= *p; | |
| 1410 } | |
| 1411 } | |
| 787 | 1412 avg= (min + max + 1)>>1; |
| 134 | 1413 |
| 167 | 1414 if(max - min <deringThreshold) return; |
| 1415 | |
| 134 | 1416 for(y=0; y<10; y++) |
| 1417 { | |
| 1418 int t = 0; | |
| 787 | 1419 |
| 1420 if(src[stride*y + 0] > avg) t+= 1; | |
| 1421 if(src[stride*y + 1] > avg) t+= 2; | |
| 1422 if(src[stride*y + 2] > avg) t+= 4; | |
| 1423 if(src[stride*y + 3] > avg) t+= 8; | |
| 1424 if(src[stride*y + 4] > avg) t+= 16; | |
| 1425 if(src[stride*y + 5] > avg) t+= 32; | |
| 1426 if(src[stride*y + 6] > avg) t+= 64; | |
| 1427 if(src[stride*y + 7] > avg) t+= 128; | |
| 1428 if(src[stride*y + 8] > avg) t+= 256; | |
| 1429 if(src[stride*y + 9] > avg) t+= 512; | |
| 1430 | |
| 134 | 1431 t |= (~t)<<16; |
| 1432 t &= (t<<1) & (t>>1); | |
| 1433 s[y] = t; | |
| 1434 } | |
| 787 | 1435 |
| 1436 for(y=1; y<9; y++) | |
| 1437 { | |
| 1438 int t = s[y-1] & s[y] & s[y+1]; | |
| 1439 t|= t>>16; | |
| 1440 s[y-1]= t; | |
| 1441 } | |
| 134 | 1442 |
| 1443 for(y=1; y<9; y++) | |
| 1444 { | |
| 1445 int x; | |
| 787 | 1446 int t = s[y-1]; |
| 134 | 1447 |
| 1448 p= src + stride*y; | |
| 1449 for(x=1; x<9; x++) | |
| 1450 { | |
| 1451 p++; | |
| 1452 if(t & (1<<x)) | |
| 1453 { | |
| 1454 int f= (*(p-stride-1)) + 2*(*(p-stride)) + (*(p-stride+1)) | |
| 1455 +2*(*(p -1)) + 4*(*p ) + 2*(*(p +1)) | |
| 1456 +(*(p+stride-1)) + 2*(*(p+stride)) + (*(p+stride+1)); | |
| 1457 f= (f + 8)>>4; | |
| 1458 | |
| 167 | 1459 #ifdef DEBUG_DERING_THRESHOLD |
| 1460 asm volatile("emms\n\t":); | |
| 1461 { | |
| 1462 static long long numPixels=0; | |
| 1463 if(x!=1 && x!=8 && y!=1 && y!=8) numPixels++; | |
| 1464 // if((max-min)<20 || (max-min)*QP<200) | |
| 1465 // if((max-min)*QP < 500) | |
| 1466 // if(max-min<QP/2) | |
| 1467 if(max-min < 20) | |
| 1468 { | |
| 1469 static int numSkiped=0; | |
| 1470 static int errorSum=0; | |
| 1471 static int worstQP=0; | |
| 1472 static int worstRange=0; | |
| 1473 static int worstDiff=0; | |
| 1474 int diff= (f - *p); | |
| 1475 int absDiff= ABS(diff); | |
| 1476 int error= diff*diff; | |
| 1477 | |
| 1478 if(x==1 || x==8 || y==1 || y==8) continue; | |
| 1479 | |
| 1480 numSkiped++; | |
| 1481 if(absDiff > worstDiff) | |
| 1482 { | |
| 1483 worstDiff= absDiff; | |
| 1484 worstQP= QP; | |
| 1485 worstRange= max-min; | |
| 1486 } | |
| 1487 errorSum+= error; | |
| 1488 | |
| 1489 if(1024LL*1024LL*1024LL % numSkiped == 0) | |
| 1490 { | |
| 1491 printf( "sum:%1.3f, skip:%d, wQP:%d, " | |
| 1492 "wRange:%d, wDiff:%d, relSkip:%1.3f\n", | |
| 1493 (float)errorSum/numSkiped, numSkiped, worstQP, worstRange, | |
| 1494 worstDiff, (float)numSkiped/numPixels); | |
| 1495 } | |
| 1496 } | |
| 1497 } | |
| 1498 #endif | |
| 787 | 1499 if (*p + QP2 < f) *p= *p + QP2; |
| 1500 else if(*p - QP2 > f) *p= *p - QP2; | |
| 134 | 1501 else *p=f; |
| 1502 } | |
| 1503 } | |
| 1504 } | |
| 167 | 1505 #ifdef DEBUG_DERING_THRESHOLD |
| 1506 if(max-min < 20) | |
| 1507 { | |
| 1508 for(y=1; y<9; y++) | |
| 1509 { | |
| 1510 int x; | |
| 1511 int t = 0; | |
| 1512 p= src + stride*y; | |
| 1513 for(x=1; x<9; x++) | |
| 1514 { | |
| 1515 p++; | |
| 1516 *p = MIN(*p + 20, 255); | |
| 1517 } | |
| 1518 } | |
| 1519 // src[0] = src[7]=src[stride*7]=src[stride*7 + 7]=255; | |
| 1520 } | |
| 1521 #endif | |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1522 #endif |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1523 } |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
1524 |
|
106
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1525 /** |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1526 * Deinterlaces the given block |
| 142 | 1527 * will be called for every 8x8 block and can read & write from line 4-15 |
| 1528 * lines 0-3 have been passed through the deblock / dering filters allready, but can be read too | |
| 1529 * lines 4-12 will be read into the deblocking filter and should be deinterlaced | |
|
106
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1530 */ |
| 169 | 1531 static inline void RENAME(deInterlaceInterpolateLinear)(uint8_t src[], int stride) |
|
106
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1532 { |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1533 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW) |
| 142 | 1534 src+= 4*stride; |
|
106
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1535 asm volatile( |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1536 "leal (%0, %1), %%eax \n\t" |
| 787 | 1537 "leal (%%eax, %1, 4), %%ecx \n\t" |
|
106
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1538 // 0 1 2 3 4 5 6 7 8 9 |
| 787 | 1539 // %0 eax eax+%1 eax+2%1 %0+4%1 ecx ecx+%1 ecx+2%1 %0+8%1 ecx+4%1 |
|
106
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1540 |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1541 "movq (%0), %%mm0 \n\t" |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1542 "movq (%%eax, %1), %%mm1 \n\t" |
| 111 | 1543 PAVGB(%%mm1, %%mm0) |
|
106
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1544 "movq %%mm0, (%%eax) \n\t" |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1545 "movq (%0, %1, 4), %%mm0 \n\t" |
| 111 | 1546 PAVGB(%%mm0, %%mm1) |
|
106
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1547 "movq %%mm1, (%%eax, %1, 2) \n\t" |
| 787 | 1548 "movq (%%ecx, %1), %%mm1 \n\t" |
| 111 | 1549 PAVGB(%%mm1, %%mm0) |
| 787 | 1550 "movq %%mm0, (%%ecx) \n\t" |
|
106
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1551 "movq (%0, %1, 8), %%mm0 \n\t" |
| 111 | 1552 PAVGB(%%mm0, %%mm1) |
| 787 | 1553 "movq %%mm1, (%%ecx, %1, 2) \n\t" |
|
106
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1554 |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1555 : : "r" (src), "r" (stride) |
| 787 | 1556 : "%eax", "%ecx" |
|
106
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1557 ); |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1558 #else |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1559 int x; |
| 142 | 1560 src+= 4*stride; |
|
106
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1561 for(x=0; x<8; x++) |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1562 { |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1563 src[stride] = (src[0] + src[stride*2])>>1; |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1564 src[stride*3] = (src[stride*2] + src[stride*4])>>1; |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1565 src[stride*5] = (src[stride*4] + src[stride*6])>>1; |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1566 src[stride*7] = (src[stride*6] + src[stride*8])>>1; |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1567 src++; |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1568 } |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1569 #endif |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1570 } |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1571 |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1572 /** |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1573 * Deinterlaces the given block |
| 142 | 1574 * will be called for every 8x8 block and can read & write from line 4-15 |
| 1575 * lines 0-3 have been passed through the deblock / dering filters allready, but can be read too | |
| 1576 * lines 4-12 will be read into the deblocking filter and should be deinterlaced | |
| 1577 * this filter will read lines 3-15 and write 7-13 | |
| 111 | 1578 * no cliping in C version |
|
106
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1579 */ |
| 169 | 1580 static inline void RENAME(deInterlaceInterpolateCubic)(uint8_t src[], int stride) |
|
106
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1581 { |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1582 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW) |
| 142 | 1583 src+= stride*3; |
|
106
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1584 asm volatile( |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1585 "leal (%0, %1), %%eax \n\t" |
| 787 | 1586 "leal (%%eax, %1, 4), %%edx \n\t" |
| 1587 "leal (%%edx, %1, 4), %%ecx \n\t" | |
| 111 | 1588 "addl %1, %%ecx \n\t" |
| 1589 "pxor %%mm7, %%mm7 \n\t" | |
| 1590 // 0 1 2 3 4 5 6 7 8 9 10 | |
| 787 | 1591 // %0 eax eax+%1 eax+2%1 %0+4%1 edx edx+%1 edx+2%1 %0+8%1 edx+4%1 ecx |
|
106
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1592 |
| 111 | 1593 #define DEINT_CUBIC(a,b,c,d,e)\ |
| 1594 "movq " #a ", %%mm0 \n\t"\ | |
| 1595 "movq " #b ", %%mm1 \n\t"\ | |
| 1596 "movq " #d ", %%mm2 \n\t"\ | |
| 1597 "movq " #e ", %%mm3 \n\t"\ | |
| 1598 PAVGB(%%mm2, %%mm1) /* (b+d) /2 */\ | |
| 1599 PAVGB(%%mm3, %%mm0) /* a(a+e) /2 */\ | |
| 1600 "movq %%mm0, %%mm2 \n\t"\ | |
| 1601 "punpcklbw %%mm7, %%mm0 \n\t"\ | |
| 1602 "punpckhbw %%mm7, %%mm2 \n\t"\ | |
| 1603 "movq %%mm1, %%mm3 \n\t"\ | |
| 1604 "punpcklbw %%mm7, %%mm1 \n\t"\ | |
| 1605 "punpckhbw %%mm7, %%mm3 \n\t"\ | |
| 1606 "psubw %%mm1, %%mm0 \n\t" /* L(a+e - (b+d))/2 */\ | |
| 1607 "psubw %%mm3, %%mm2 \n\t" /* H(a+e - (b+d))/2 */\ | |
| 1608 "psraw $3, %%mm0 \n\t" /* L(a+e - (b+d))/16 */\ | |
| 1609 "psraw $3, %%mm2 \n\t" /* H(a+e - (b+d))/16 */\ | |
| 1610 "psubw %%mm0, %%mm1 \n\t" /* L(9b + 9d - a - e)/16 */\ | |
| 1611 "psubw %%mm2, %%mm3 \n\t" /* H(9b + 9d - a - e)/16 */\ | |
| 1612 "packuswb %%mm3, %%mm1 \n\t"\ | |
| 1613 "movq %%mm1, " #c " \n\t" | |
|
106
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1614 |
| 787 | 1615 DEINT_CUBIC((%0), (%%eax, %1), (%%eax, %1, 2), (%0, %1, 4), (%%edx, %1)) |
| 1616 DEINT_CUBIC((%%eax, %1), (%0, %1, 4), (%%edx), (%%edx, %1), (%0, %1, 8)) | |
| 1617 DEINT_CUBIC((%0, %1, 4), (%%edx, %1), (%%edx, %1, 2), (%0, %1, 8), (%%ecx)) | |
| 1618 DEINT_CUBIC((%%edx, %1), (%0, %1, 8), (%%edx, %1, 4), (%%ecx), (%%ecx, %1, 2)) | |
|
106
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1619 |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1620 : : "r" (src), "r" (stride) |
| 787 | 1621 : "%eax", "%edx", "ecx" |
|
106
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1622 ); |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1623 #else |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1624 int x; |
| 142 | 1625 src+= stride*3; |
|
106
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1626 for(x=0; x<8; x++) |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1627 { |
| 111 | 1628 src[stride*3] = (-src[0] + 9*src[stride*2] + 9*src[stride*4] - src[stride*6])>>4; |
| 1629 src[stride*5] = (-src[stride*2] + 9*src[stride*4] + 9*src[stride*6] - src[stride*8])>>4; | |
| 1630 src[stride*7] = (-src[stride*4] + 9*src[stride*6] + 9*src[stride*8] - src[stride*10])>>4; | |
| 1631 src[stride*9] = (-src[stride*6] + 9*src[stride*8] + 9*src[stride*10] - src[stride*12])>>4; | |
|
106
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1632 src++; |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1633 } |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1634 #endif |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1635 } |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1636 |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1637 /** |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1638 * Deinterlaces the given block |
| 142 | 1639 * will be called for every 8x8 block and can read & write from line 4-15 |
| 1640 * lines 0-3 have been passed through the deblock / dering filters allready, but can be read too | |
| 1641 * lines 4-12 will be read into the deblocking filter and should be deinterlaced | |
| 787 | 1642 * this filter will read lines 4-13 and write 5-11 |
| 1643 * no cliping in C version | |
| 1644 */ | |
| 1645 static inline void RENAME(deInterlaceFF)(uint8_t src[], int stride, uint8_t *tmp) | |
| 1646 { | |
| 1647 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW) | |
| 1648 src+= stride*4; | |
| 1649 asm volatile( | |
| 1650 "leal (%0, %1), %%eax \n\t" | |
| 1651 "leal (%%eax, %1, 4), %%edx \n\t" | |
| 1652 "pxor %%mm7, %%mm7 \n\t" | |
| 1653 "movq (%2), %%mm0 \n\t" | |
| 1654 // 0 1 2 3 4 5 6 7 8 9 10 | |
| 1655 // %0 eax eax+%1 eax+2%1 %0+4%1 edx edx+%1 edx+2%1 %0+8%1 edx+4%1 ecx | |
| 1656 | |
| 1657 #define DEINT_FF(a,b,c,d)\ | |
| 1658 "movq " #a ", %%mm1 \n\t"\ | |
| 1659 "movq " #b ", %%mm2 \n\t"\ | |
| 1660 "movq " #c ", %%mm3 \n\t"\ | |
| 1661 "movq " #d ", %%mm4 \n\t"\ | |
| 1662 PAVGB(%%mm3, %%mm1) \ | |
| 1663 PAVGB(%%mm4, %%mm0) \ | |
| 1664 "movq %%mm0, %%mm3 \n\t"\ | |
| 1665 "punpcklbw %%mm7, %%mm0 \n\t"\ | |
| 1666 "punpckhbw %%mm7, %%mm3 \n\t"\ | |
| 1667 "movq %%mm1, %%mm4 \n\t"\ | |
| 1668 "punpcklbw %%mm7, %%mm1 \n\t"\ | |
| 1669 "punpckhbw %%mm7, %%mm4 \n\t"\ | |
| 1670 "psllw $2, %%mm1 \n\t"\ | |
| 1671 "psllw $2, %%mm4 \n\t"\ | |
| 1672 "psubw %%mm0, %%mm1 \n\t"\ | |
| 1673 "psubw %%mm3, %%mm4 \n\t"\ | |
| 1674 "movq %%mm2, %%mm5 \n\t"\ | |
| 1675 "movq %%mm2, %%mm0 \n\t"\ | |
| 1676 "punpcklbw %%mm7, %%mm2 \n\t"\ | |
| 1677 "punpckhbw %%mm7, %%mm5 \n\t"\ | |
| 1678 "paddw %%mm2, %%mm1 \n\t"\ | |
| 1679 "paddw %%mm5, %%mm4 \n\t"\ | |
| 1680 "psraw $2, %%mm1 \n\t"\ | |
| 1681 "psraw $2, %%mm4 \n\t"\ | |
| 1682 "packuswb %%mm4, %%mm1 \n\t"\ | |
| 1683 "movq %%mm1, " #b " \n\t"\ | |
| 1684 | |
| 1685 DEINT_FF((%0) , (%%eax) , (%%eax, %1), (%%eax, %1, 2)) | |
| 1686 DEINT_FF((%%eax, %1), (%%eax, %1, 2), (%0, %1, 4), (%%edx) ) | |
| 1687 DEINT_FF((%0, %1, 4), (%%edx) , (%%edx, %1), (%%edx, %1, 2)) | |
| 1688 DEINT_FF((%%edx, %1), (%%edx, %1, 2), (%0, %1, 8), (%%edx, %1, 4)) | |
| 1689 | |
| 1690 "movq %%mm0, (%2) \n\t" | |
| 1691 : : "r" (src), "r" (stride), "r"(tmp) | |
| 1692 : "%eax", "%edx" | |
| 1693 ); | |
| 1694 #else | |
| 1695 int x; | |
| 1696 src+= stride*4; | |
| 1697 for(x=0; x<8; x++) | |
| 1698 { | |
| 1699 int t1= tmp[x]; | |
| 1700 int t2= src[stride*1]; | |
| 1701 | |
| 1702 src[stride*1]= (-t1 + 4*src[stride*0] + 2*t2 + 4*src[stride*2] - src[stride*3] + 4)>>3; | |
| 1703 t1= src[stride*4]; | |
| 1704 src[stride*3]= (-t2 + 4*src[stride*2] + 2*t1 + 4*src[stride*4] - src[stride*5] + 4)>>3; | |
| 1705 t2= src[stride*6]; | |
| 1706 src[stride*5]= (-t1 + 4*src[stride*4] + 2*t2 + 4*src[stride*6] - src[stride*7] + 4)>>3; | |
| 1707 t1= src[stride*8]; | |
| 1708 src[stride*7]= (-t2 + 4*src[stride*6] + 2*t1 + 4*src[stride*8] - src[stride*9] + 4)>>3; | |
| 1709 tmp[x]= t1; | |
| 1710 | |
| 1711 src++; | |
| 1712 } | |
| 1713 #endif | |
| 1714 } | |
| 1715 | |
| 1716 /** | |
| 1717 * Deinterlaces the given block | |
| 1718 * will be called for every 8x8 block and can read & write from line 4-15 | |
| 1719 * lines 0-3 have been passed through the deblock / dering filters allready, but can be read too | |
| 1720 * lines 4-12 will be read into the deblocking filter and should be deinterlaced | |
|
106
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1721 * will shift the image up by 1 line (FIXME if this is a problem) |
| 142 | 1722 * this filter will read lines 4-13 and write 4-11 |
|
106
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1723 */ |
| 169 | 1724 static inline void RENAME(deInterlaceBlendLinear)(uint8_t src[], int stride) |
|
106
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1725 { |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1726 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW) |
| 142 | 1727 src+= 4*stride; |
|
106
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1728 asm volatile( |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1729 "leal (%0, %1), %%eax \n\t" |
| 787 | 1730 "leal (%%eax, %1, 4), %%edx \n\t" |
|
106
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1731 // 0 1 2 3 4 5 6 7 8 9 |
| 787 | 1732 // %0 eax eax+%1 eax+2%1 %0+4%1 edx edx+%1 edx+2%1 %0+8%1 edx+4%1 |
|
106
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1733 |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1734 "movq (%0), %%mm0 \n\t" // L0 |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1735 "movq (%%eax, %1), %%mm1 \n\t" // L2 |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1736 PAVGB(%%mm1, %%mm0) // L0+L2 |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1737 "movq (%%eax), %%mm2 \n\t" // L1 |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1738 PAVGB(%%mm2, %%mm0) |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1739 "movq %%mm0, (%0) \n\t" |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1740 "movq (%%eax, %1, 2), %%mm0 \n\t" // L3 |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1741 PAVGB(%%mm0, %%mm2) // L1+L3 |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1742 PAVGB(%%mm1, %%mm2) // 2L2 + L1 + L3 |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1743 "movq %%mm2, (%%eax) \n\t" |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1744 "movq (%0, %1, 4), %%mm2 \n\t" // L4 |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1745 PAVGB(%%mm2, %%mm1) // L2+L4 |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1746 PAVGB(%%mm0, %%mm1) // 2L3 + L2 + L4 |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1747 "movq %%mm1, (%%eax, %1) \n\t" |
| 787 | 1748 "movq (%%edx), %%mm1 \n\t" // L5 |
|
106
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1749 PAVGB(%%mm1, %%mm0) // L3+L5 |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1750 PAVGB(%%mm2, %%mm0) // 2L4 + L3 + L5 |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1751 "movq %%mm0, (%%eax, %1, 2) \n\t" |
| 787 | 1752 "movq (%%edx, %1), %%mm0 \n\t" // L6 |
|
106
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1753 PAVGB(%%mm0, %%mm2) // L4+L6 |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1754 PAVGB(%%mm1, %%mm2) // 2L5 + L4 + L6 |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1755 "movq %%mm2, (%0, %1, 4) \n\t" |
| 787 | 1756 "movq (%%edx, %1, 2), %%mm2 \n\t" // L7 |
|
106
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1757 PAVGB(%%mm2, %%mm1) // L5+L7 |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1758 PAVGB(%%mm0, %%mm1) // 2L6 + L5 + L7 |
| 787 | 1759 "movq %%mm1, (%%edx) \n\t" |
|
106
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1760 "movq (%0, %1, 8), %%mm1 \n\t" // L8 |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1761 PAVGB(%%mm1, %%mm0) // L6+L8 |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1762 PAVGB(%%mm2, %%mm0) // 2L7 + L6 + L8 |
| 787 | 1763 "movq %%mm0, (%%edx, %1) \n\t" |
| 1764 "movq (%%edx, %1, 4), %%mm0 \n\t" // L9 | |
|
106
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1765 PAVGB(%%mm0, %%mm2) // L7+L9 |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1766 PAVGB(%%mm1, %%mm2) // 2L8 + L7 + L9 |
| 787 | 1767 "movq %%mm2, (%%edx, %1, 2) \n\t" |
|
106
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1768 |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1769 |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1770 : : "r" (src), "r" (stride) |
| 787 | 1771 : "%eax", "%edx" |
|
106
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1772 ); |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1773 #else |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1774 int x; |
| 142 | 1775 src+= 4*stride; |
|
106
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1776 for(x=0; x<8; x++) |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1777 { |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1778 src[0 ] = (src[0 ] + 2*src[stride ] + src[stride*2])>>2; |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1779 src[stride ] = (src[stride ] + 2*src[stride*2] + src[stride*3])>>2; |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1780 src[stride*2] = (src[stride*2] + 2*src[stride*3] + src[stride*4])>>2; |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1781 src[stride*3] = (src[stride*3] + 2*src[stride*4] + src[stride*5])>>2; |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1782 src[stride*4] = (src[stride*4] + 2*src[stride*5] + src[stride*6])>>2; |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1783 src[stride*5] = (src[stride*5] + 2*src[stride*6] + src[stride*7])>>2; |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1784 src[stride*6] = (src[stride*6] + 2*src[stride*7] + src[stride*8])>>2; |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1785 src[stride*7] = (src[stride*7] + 2*src[stride*8] + src[stride*9])>>2; |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1786 src++; |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1787 } |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1788 #endif |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1789 } |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1790 |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1791 /** |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1792 * Deinterlaces the given block |
| 142 | 1793 * will be called for every 8x8 block and can read & write from line 4-15, |
| 1794 * lines 0-3 have been passed through the deblock / dering filters allready, but can be read too | |
| 1795 * lines 4-12 will be read into the deblocking filter and should be deinterlaced | |
|
106
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1796 */ |
| 169 | 1797 static inline void RENAME(deInterlaceMedian)(uint8_t src[], int stride) |
|
106
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1798 { |
| 107 | 1799 #ifdef HAVE_MMX |
| 142 | 1800 src+= 4*stride; |
| 107 | 1801 #ifdef HAVE_MMX2 |
|
106
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1802 asm volatile( |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1803 "leal (%0, %1), %%eax \n\t" |
| 787 | 1804 "leal (%%eax, %1, 4), %%edx \n\t" |
|
106
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1805 // 0 1 2 3 4 5 6 7 8 9 |
| 787 | 1806 // %0 eax eax+%1 eax+2%1 %0+4%1 edx edx+%1 edx+2%1 %0+8%1 edx+4%1 |
|
106
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1807 |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1808 "movq (%0), %%mm0 \n\t" // |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1809 "movq (%%eax, %1), %%mm2 \n\t" // |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1810 "movq (%%eax), %%mm1 \n\t" // |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1811 "movq %%mm0, %%mm3 \n\t" |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1812 "pmaxub %%mm1, %%mm0 \n\t" // |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1813 "pminub %%mm3, %%mm1 \n\t" // |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1814 "pmaxub %%mm2, %%mm1 \n\t" // |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1815 "pminub %%mm1, %%mm0 \n\t" |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1816 "movq %%mm0, (%%eax) \n\t" |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1817 |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1818 "movq (%0, %1, 4), %%mm0 \n\t" // |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1819 "movq (%%eax, %1, 2), %%mm1 \n\t" // |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1820 "movq %%mm2, %%mm3 \n\t" |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1821 "pmaxub %%mm1, %%mm2 \n\t" // |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1822 "pminub %%mm3, %%mm1 \n\t" // |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1823 "pmaxub %%mm0, %%mm1 \n\t" // |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1824 "pminub %%mm1, %%mm2 \n\t" |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1825 "movq %%mm2, (%%eax, %1, 2) \n\t" |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1826 |
| 787 | 1827 "movq (%%edx), %%mm2 \n\t" // |
| 1828 "movq (%%edx, %1), %%mm1 \n\t" // | |
|
106
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1829 "movq %%mm2, %%mm3 \n\t" |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1830 "pmaxub %%mm0, %%mm2 \n\t" // |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1831 "pminub %%mm3, %%mm0 \n\t" // |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1832 "pmaxub %%mm1, %%mm0 \n\t" // |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1833 "pminub %%mm0, %%mm2 \n\t" |
| 787 | 1834 "movq %%mm2, (%%edx) \n\t" |
|
106
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1835 |
| 787 | 1836 "movq (%%edx, %1, 2), %%mm2 \n\t" // |
|
106
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1837 "movq (%0, %1, 8), %%mm0 \n\t" // |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1838 "movq %%mm2, %%mm3 \n\t" |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1839 "pmaxub %%mm0, %%mm2 \n\t" // |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1840 "pminub %%mm3, %%mm0 \n\t" // |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1841 "pmaxub %%mm1, %%mm0 \n\t" // |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1842 "pminub %%mm0, %%mm2 \n\t" |
| 787 | 1843 "movq %%mm2, (%%edx, %1, 2) \n\t" |
|
106
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1844 |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1845 |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1846 : : "r" (src), "r" (stride) |
| 787 | 1847 : "%eax", "%edx" |
|
106
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1848 ); |
| 107 | 1849 |
| 1850 #else // MMX without MMX2 | |
| 1851 asm volatile( | |
| 1852 "leal (%0, %1), %%eax \n\t" | |
| 787 | 1853 "leal (%%eax, %1, 4), %%edx \n\t" |
| 107 | 1854 // 0 1 2 3 4 5 6 7 8 9 |
| 787 | 1855 // %0 eax eax+%1 eax+2%1 %0+4%1 edx edx+%1 edx+2%1 %0+8%1 edx+4%1 |
| 107 | 1856 "pxor %%mm7, %%mm7 \n\t" |
| 1857 | |
| 1858 #define MEDIAN(a,b,c)\ | |
| 1859 "movq " #a ", %%mm0 \n\t"\ | |
| 1860 "movq " #b ", %%mm2 \n\t"\ | |
| 1861 "movq " #c ", %%mm1 \n\t"\ | |
| 1862 "movq %%mm0, %%mm3 \n\t"\ | |
| 1863 "movq %%mm1, %%mm4 \n\t"\ | |
| 1864 "movq %%mm2, %%mm5 \n\t"\ | |
| 1865 "psubusb %%mm1, %%mm3 \n\t"\ | |
| 1866 "psubusb %%mm2, %%mm4 \n\t"\ | |
| 1867 "psubusb %%mm0, %%mm5 \n\t"\ | |
| 1868 "pcmpeqb %%mm7, %%mm3 \n\t"\ | |
| 1869 "pcmpeqb %%mm7, %%mm4 \n\t"\ | |
| 1870 "pcmpeqb %%mm7, %%mm5 \n\t"\ | |
| 1871 "movq %%mm3, %%mm6 \n\t"\ | |
| 1872 "pxor %%mm4, %%mm3 \n\t"\ | |
| 1873 "pxor %%mm5, %%mm4 \n\t"\ | |
| 1874 "pxor %%mm6, %%mm5 \n\t"\ | |
| 1875 "por %%mm3, %%mm1 \n\t"\ | |
| 1876 "por %%mm4, %%mm2 \n\t"\ | |
| 1877 "por %%mm5, %%mm0 \n\t"\ | |
| 1878 "pand %%mm2, %%mm0 \n\t"\ | |
| 1879 "pand %%mm1, %%mm0 \n\t"\ | |
| 1880 "movq %%mm0, " #b " \n\t" | |
| 1881 | |
| 1882 MEDIAN((%0), (%%eax), (%%eax, %1)) | |
| 1883 MEDIAN((%%eax, %1), (%%eax, %1, 2), (%0, %1, 4)) | |
| 787 | 1884 MEDIAN((%0, %1, 4), (%%edx), (%%edx, %1)) |
| 1885 MEDIAN((%%edx, %1), (%%edx, %1, 2), (%0, %1, 8)) | |
| 107 | 1886 |
| 1887 : : "r" (src), "r" (stride) | |
| 787 | 1888 : "%eax", "%edx" |
| 107 | 1889 ); |
| 1890 #endif // MMX | |
|
106
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1891 #else |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1892 //FIXME |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1893 int x; |
| 142 | 1894 src+= 4*stride; |
|
106
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1895 for(x=0; x<8; x++) |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1896 { |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1897 src[0 ] = (src[0 ] + 2*src[stride ] + src[stride*2])>>2; |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1898 src[stride ] = (src[stride ] + 2*src[stride*2] + src[stride*3])>>2; |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1899 src[stride*2] = (src[stride*2] + 2*src[stride*3] + src[stride*4])>>2; |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1900 src[stride*3] = (src[stride*3] + 2*src[stride*4] + src[stride*5])>>2; |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1901 src[stride*4] = (src[stride*4] + 2*src[stride*5] + src[stride*6])>>2; |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1902 src[stride*5] = (src[stride*5] + 2*src[stride*6] + src[stride*7])>>2; |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1903 src[stride*6] = (src[stride*6] + 2*src[stride*7] + src[stride*8])>>2; |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1904 src[stride*7] = (src[stride*7] + 2*src[stride*8] + src[stride*9])>>2; |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1905 src++; |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1906 } |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1907 #endif |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1908 } |
|
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
1909 |
|
129
be35346e27c1
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
128
diff
changeset
|
1910 #ifdef HAVE_MMX |
|
128
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1911 /** |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1912 * transposes and shift the given 8x8 Block into dst1 and dst2 |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1913 */ |
| 169 | 1914 static inline void RENAME(transpose1)(uint8_t *dst1, uint8_t *dst2, uint8_t *src, int srcStride) |
|
128
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1915 { |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1916 asm( |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1917 "leal (%0, %1), %%eax \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1918 // 0 1 2 3 4 5 6 7 8 9 |
| 787 | 1919 // %0 eax eax+%1 eax+2%1 %0+4%1 edx edx+%1 edx+2%1 %0+8%1 edx+4%1 |
|
128
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1920 "movq (%0), %%mm0 \n\t" // 12345678 |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1921 "movq (%%eax), %%mm1 \n\t" // abcdefgh |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1922 "movq %%mm0, %%mm2 \n\t" // 12345678 |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1923 "punpcklbw %%mm1, %%mm0 \n\t" // 1a2b3c4d |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1924 "punpckhbw %%mm1, %%mm2 \n\t" // 5e6f7g8h |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1925 |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1926 "movq (%%eax, %1), %%mm1 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1927 "movq (%%eax, %1, 2), %%mm3 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1928 "movq %%mm1, %%mm4 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1929 "punpcklbw %%mm3, %%mm1 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1930 "punpckhbw %%mm3, %%mm4 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1931 |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1932 "movq %%mm0, %%mm3 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1933 "punpcklwd %%mm1, %%mm0 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1934 "punpckhwd %%mm1, %%mm3 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1935 "movq %%mm2, %%mm1 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1936 "punpcklwd %%mm4, %%mm2 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1937 "punpckhwd %%mm4, %%mm1 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1938 |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1939 "movd %%mm0, 128(%2) \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1940 "psrlq $32, %%mm0 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1941 "movd %%mm0, 144(%2) \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1942 "movd %%mm3, 160(%2) \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1943 "psrlq $32, %%mm3 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1944 "movd %%mm3, 176(%2) \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1945 "movd %%mm3, 48(%3) \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1946 "movd %%mm2, 192(%2) \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1947 "movd %%mm2, 64(%3) \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1948 "psrlq $32, %%mm2 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1949 "movd %%mm2, 80(%3) \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1950 "movd %%mm1, 96(%3) \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1951 "psrlq $32, %%mm1 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1952 "movd %%mm1, 112(%3) \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1953 |
|
789
54079a650ba8
using fewer registers (fixes compilation bug hopefully)
michael
parents:
788
diff
changeset
|
1954 "leal (%%eax, %1, 4), %%eax \n\t" |
|
54079a650ba8
using fewer registers (fixes compilation bug hopefully)
michael
parents:
788
diff
changeset
|
1955 |
|
128
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1956 "movq (%0, %1, 4), %%mm0 \n\t" // 12345678 |
|
789
54079a650ba8
using fewer registers (fixes compilation bug hopefully)
michael
parents:
788
diff
changeset
|
1957 "movq (%%eax), %%mm1 \n\t" // abcdefgh |
|
128
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1958 "movq %%mm0, %%mm2 \n\t" // 12345678 |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1959 "punpcklbw %%mm1, %%mm0 \n\t" // 1a2b3c4d |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1960 "punpckhbw %%mm1, %%mm2 \n\t" // 5e6f7g8h |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1961 |
|
789
54079a650ba8
using fewer registers (fixes compilation bug hopefully)
michael
parents:
788
diff
changeset
|
1962 "movq (%%eax, %1), %%mm1 \n\t" |
|
54079a650ba8
using fewer registers (fixes compilation bug hopefully)
michael
parents:
788
diff
changeset
|
1963 "movq (%%eax, %1, 2), %%mm3 \n\t" |
|
128
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1964 "movq %%mm1, %%mm4 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1965 "punpcklbw %%mm3, %%mm1 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1966 "punpckhbw %%mm3, %%mm4 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1967 |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1968 "movq %%mm0, %%mm3 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1969 "punpcklwd %%mm1, %%mm0 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1970 "punpckhwd %%mm1, %%mm3 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1971 "movq %%mm2, %%mm1 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1972 "punpcklwd %%mm4, %%mm2 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1973 "punpckhwd %%mm4, %%mm1 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1974 |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1975 "movd %%mm0, 132(%2) \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1976 "psrlq $32, %%mm0 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1977 "movd %%mm0, 148(%2) \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1978 "movd %%mm3, 164(%2) \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1979 "psrlq $32, %%mm3 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1980 "movd %%mm3, 180(%2) \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1981 "movd %%mm3, 52(%3) \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1982 "movd %%mm2, 196(%2) \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1983 "movd %%mm2, 68(%3) \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1984 "psrlq $32, %%mm2 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1985 "movd %%mm2, 84(%3) \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1986 "movd %%mm1, 100(%3) \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1987 "psrlq $32, %%mm1 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1988 "movd %%mm1, 116(%3) \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1989 |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1990 |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1991 :: "r" (src), "r" (srcStride), "r" (dst1), "r" (dst2) |
|
789
54079a650ba8
using fewer registers (fixes compilation bug hopefully)
michael
parents:
788
diff
changeset
|
1992 : "%eax" |
|
128
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1993 ); |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1994 } |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1995 |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1996 /** |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1997 * transposes the given 8x8 block |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
1998 */ |
| 169 | 1999 static inline void RENAME(transpose2)(uint8_t *dst, int dstStride, uint8_t *src) |
|
128
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2000 { |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2001 asm( |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2002 "leal (%0, %1), %%eax \n\t" |
| 787 | 2003 "leal (%%eax, %1, 4), %%edx \n\t" |
|
128
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2004 // 0 1 2 3 4 5 6 7 8 9 |
| 787 | 2005 // %0 eax eax+%1 eax+2%1 %0+4%1 edx edx+%1 edx+2%1 %0+8%1 edx+4%1 |
|
128
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2006 "movq (%2), %%mm0 \n\t" // 12345678 |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2007 "movq 16(%2), %%mm1 \n\t" // abcdefgh |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2008 "movq %%mm0, %%mm2 \n\t" // 12345678 |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2009 "punpcklbw %%mm1, %%mm0 \n\t" // 1a2b3c4d |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2010 "punpckhbw %%mm1, %%mm2 \n\t" // 5e6f7g8h |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2011 |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2012 "movq 32(%2), %%mm1 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2013 "movq 48(%2), %%mm3 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2014 "movq %%mm1, %%mm4 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2015 "punpcklbw %%mm3, %%mm1 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2016 "punpckhbw %%mm3, %%mm4 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2017 |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2018 "movq %%mm0, %%mm3 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2019 "punpcklwd %%mm1, %%mm0 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2020 "punpckhwd %%mm1, %%mm3 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2021 "movq %%mm2, %%mm1 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2022 "punpcklwd %%mm4, %%mm2 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2023 "punpckhwd %%mm4, %%mm1 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2024 |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2025 "movd %%mm0, (%0) \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2026 "psrlq $32, %%mm0 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2027 "movd %%mm0, (%%eax) \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2028 "movd %%mm3, (%%eax, %1) \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2029 "psrlq $32, %%mm3 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2030 "movd %%mm3, (%%eax, %1, 2) \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2031 "movd %%mm2, (%0, %1, 4) \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2032 "psrlq $32, %%mm2 \n\t" |
| 787 | 2033 "movd %%mm2, (%%edx) \n\t" |
| 2034 "movd %%mm1, (%%edx, %1) \n\t" | |
|
128
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2035 "psrlq $32, %%mm1 \n\t" |
| 787 | 2036 "movd %%mm1, (%%edx, %1, 2) \n\t" |
|
128
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2037 |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2038 |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2039 "movq 64(%2), %%mm0 \n\t" // 12345678 |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2040 "movq 80(%2), %%mm1 \n\t" // abcdefgh |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2041 "movq %%mm0, %%mm2 \n\t" // 12345678 |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2042 "punpcklbw %%mm1, %%mm0 \n\t" // 1a2b3c4d |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2043 "punpckhbw %%mm1, %%mm2 \n\t" // 5e6f7g8h |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2044 |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2045 "movq 96(%2), %%mm1 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2046 "movq 112(%2), %%mm3 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2047 "movq %%mm1, %%mm4 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2048 "punpcklbw %%mm3, %%mm1 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2049 "punpckhbw %%mm3, %%mm4 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2050 |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2051 "movq %%mm0, %%mm3 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2052 "punpcklwd %%mm1, %%mm0 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2053 "punpckhwd %%mm1, %%mm3 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2054 "movq %%mm2, %%mm1 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2055 "punpcklwd %%mm4, %%mm2 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2056 "punpckhwd %%mm4, %%mm1 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2057 |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2058 "movd %%mm0, 4(%0) \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2059 "psrlq $32, %%mm0 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2060 "movd %%mm0, 4(%%eax) \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2061 "movd %%mm3, 4(%%eax, %1) \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2062 "psrlq $32, %%mm3 \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2063 "movd %%mm3, 4(%%eax, %1, 2) \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2064 "movd %%mm2, 4(%0, %1, 4) \n\t" |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2065 "psrlq $32, %%mm2 \n\t" |
| 787 | 2066 "movd %%mm2, 4(%%edx) \n\t" |
| 2067 "movd %%mm1, 4(%%edx, %1) \n\t" | |
|
128
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2068 "psrlq $32, %%mm1 \n\t" |
| 787 | 2069 "movd %%mm1, 4(%%edx, %1, 2) \n\t" |
|
128
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2070 |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2071 :: "r" (dst), "r" (dstStride), "r" (src) |
| 787 | 2072 : "%eax", "%edx" |
|
128
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2073 ); |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2074 } |
|
129
be35346e27c1
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
128
diff
changeset
|
2075 #endif |
|
157
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2076 //static int test=0; |
|
128
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2077 |
| 943 | 2078 static inline void RENAME(tempNoiseReducer)(uint8_t *src, int stride, |
| 158 | 2079 uint8_t *tempBlured, uint32_t *tempBluredPast, int *maxNoise) |
| 156 | 2080 { |
| 787 | 2081 // to save a register (FIXME do this outside of the loops) |
| 2082 tempBluredPast[127]= maxNoise[0]; | |
| 2083 tempBluredPast[128]= maxNoise[1]; | |
| 2084 tempBluredPast[129]= maxNoise[2]; | |
| 2085 | |
|
157
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2086 #define FAST_L2_DIFF |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2087 //#define L1_DIFF //u should change the thresholds too if u try that one |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2088 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2089 asm volatile( |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2090 "leal (%2, %2, 2), %%eax \n\t" // 3*stride |
| 787 | 2091 "leal (%2, %2, 4), %%edx \n\t" // 5*stride |
| 2092 "leal (%%edx, %2, 2), %%ecx \n\t" // 7*stride | |
|
157
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2093 // 0 1 2 3 4 5 6 7 8 9 |
| 787 | 2094 // %x %x+%2 %x+2%2 %x+eax %x+4%2 %x+edx %x+2eax %x+ecx %x+8%2 |
|
157
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2095 //FIXME reorder? |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2096 #ifdef L1_DIFF //needs mmx2 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2097 "movq (%0), %%mm0 \n\t" // L0 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2098 "psadbw (%1), %%mm0 \n\t" // |L0-R0| |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2099 "movq (%0, %2), %%mm1 \n\t" // L1 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2100 "psadbw (%1, %2), %%mm1 \n\t" // |L1-R1| |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2101 "movq (%0, %2, 2), %%mm2 \n\t" // L2 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2102 "psadbw (%1, %2, 2), %%mm2 \n\t" // |L2-R2| |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2103 "movq (%0, %%eax), %%mm3 \n\t" // L3 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2104 "psadbw (%1, %%eax), %%mm3 \n\t" // |L3-R3| |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2105 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2106 "movq (%0, %2, 4), %%mm4 \n\t" // L4 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2107 "paddw %%mm1, %%mm0 \n\t" |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2108 "psadbw (%1, %2, 4), %%mm4 \n\t" // |L4-R4| |
| 787 | 2109 "movq (%0, %%edx), %%mm5 \n\t" // L5 |
|
157
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2110 "paddw %%mm2, %%mm0 \n\t" |
| 787 | 2111 "psadbw (%1, %%edx), %%mm5 \n\t" // |L5-R5| |
|
157
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2112 "movq (%0, %%eax, 2), %%mm6 \n\t" // L6 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2113 "paddw %%mm3, %%mm0 \n\t" |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2114 "psadbw (%1, %%eax, 2), %%mm6 \n\t" // |L6-R6| |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2115 "movq (%0, %%ecx), %%mm7 \n\t" // L7 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2116 "paddw %%mm4, %%mm0 \n\t" |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2117 "psadbw (%1, %%ecx), %%mm7 \n\t" // |L7-R7| |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2118 "paddw %%mm5, %%mm6 \n\t" |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2119 "paddw %%mm7, %%mm6 \n\t" |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2120 "paddw %%mm6, %%mm0 \n\t" |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2121 #elif defined (FAST_L2_DIFF) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2122 "pcmpeqb %%mm7, %%mm7 \n\t" |
| 210 | 2123 "movq "MANGLE(b80)", %%mm6 \n\t" |
|
157
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2124 "pxor %%mm0, %%mm0 \n\t" |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2125 #define L2_DIFF_CORE(a, b)\ |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2126 "movq " #a ", %%mm5 \n\t"\ |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2127 "movq " #b ", %%mm2 \n\t"\ |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2128 "pxor %%mm7, %%mm2 \n\t"\ |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2129 PAVGB(%%mm2, %%mm5)\ |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2130 "paddb %%mm6, %%mm5 \n\t"\ |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2131 "movq %%mm5, %%mm2 \n\t"\ |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2132 "psllw $8, %%mm5 \n\t"\ |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2133 "pmaddwd %%mm5, %%mm5 \n\t"\ |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2134 "pmaddwd %%mm2, %%mm2 \n\t"\ |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2135 "paddd %%mm2, %%mm5 \n\t"\ |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2136 "psrld $14, %%mm5 \n\t"\ |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2137 "paddd %%mm5, %%mm0 \n\t" |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2138 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2139 L2_DIFF_CORE((%0), (%1)) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2140 L2_DIFF_CORE((%0, %2), (%1, %2)) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2141 L2_DIFF_CORE((%0, %2, 2), (%1, %2, 2)) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2142 L2_DIFF_CORE((%0, %%eax), (%1, %%eax)) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2143 L2_DIFF_CORE((%0, %2, 4), (%1, %2, 4)) |
| 787 | 2144 L2_DIFF_CORE((%0, %%edx), (%1, %%edx)) |
|
157
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2145 L2_DIFF_CORE((%0, %%eax,2), (%1, %%eax,2)) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2146 L2_DIFF_CORE((%0, %%ecx), (%1, %%ecx)) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2147 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2148 #else |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2149 "pxor %%mm7, %%mm7 \n\t" |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2150 "pxor %%mm0, %%mm0 \n\t" |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2151 #define L2_DIFF_CORE(a, b)\ |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2152 "movq " #a ", %%mm5 \n\t"\ |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2153 "movq " #b ", %%mm2 \n\t"\ |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2154 "movq %%mm5, %%mm1 \n\t"\ |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2155 "movq %%mm2, %%mm3 \n\t"\ |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2156 "punpcklbw %%mm7, %%mm5 \n\t"\ |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2157 "punpckhbw %%mm7, %%mm1 \n\t"\ |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2158 "punpcklbw %%mm7, %%mm2 \n\t"\ |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2159 "punpckhbw %%mm7, %%mm3 \n\t"\ |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2160 "psubw %%mm2, %%mm5 \n\t"\ |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2161 "psubw %%mm3, %%mm1 \n\t"\ |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2162 "pmaddwd %%mm5, %%mm5 \n\t"\ |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2163 "pmaddwd %%mm1, %%mm1 \n\t"\ |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2164 "paddd %%mm1, %%mm5 \n\t"\ |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2165 "paddd %%mm5, %%mm0 \n\t" |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2166 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2167 L2_DIFF_CORE((%0), (%1)) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2168 L2_DIFF_CORE((%0, %2), (%1, %2)) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2169 L2_DIFF_CORE((%0, %2, 2), (%1, %2, 2)) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2170 L2_DIFF_CORE((%0, %%eax), (%1, %%eax)) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2171 L2_DIFF_CORE((%0, %2, 4), (%1, %2, 4)) |
| 787 | 2172 L2_DIFF_CORE((%0, %%edx), (%1, %%edx)) |
|
157
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2173 L2_DIFF_CORE((%0, %%eax,2), (%1, %%eax,2)) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2174 L2_DIFF_CORE((%0, %%ecx), (%1, %%ecx)) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2175 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2176 #endif |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2177 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2178 "movq %%mm0, %%mm4 \n\t" |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2179 "psrlq $32, %%mm0 \n\t" |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2180 "paddd %%mm0, %%mm4 \n\t" |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2181 "movd %%mm4, %%ecx \n\t" |
| 158 | 2182 "shll $2, %%ecx \n\t" |
| 787 | 2183 "movl %3, %%edx \n\t" |
| 2184 "addl -4(%%edx), %%ecx \n\t" | |
| 2185 "addl 4(%%edx), %%ecx \n\t" | |
| 2186 "addl -1024(%%edx), %%ecx \n\t" | |
| 158 | 2187 "addl $4, %%ecx \n\t" |
| 787 | 2188 "addl 1024(%%edx), %%ecx \n\t" |
| 158 | 2189 "shrl $3, %%ecx \n\t" |
| 787 | 2190 "movl %%ecx, (%%edx) \n\t" |
| 158 | 2191 |
| 210 | 2192 // "movl %3, %%ecx \n\t" |
|
157
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2193 // "movl %%ecx, test \n\t" |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2194 // "jmp 4f \n\t" |
| 787 | 2195 "cmpl 512(%%edx), %%ecx \n\t" |
|
157
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2196 " jb 2f \n\t" |
| 787 | 2197 "cmpl 516(%%edx), %%ecx \n\t" |
|
157
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2198 " jb 1f \n\t" |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2199 |
| 787 | 2200 "leal (%%eax, %2, 2), %%edx \n\t" // 5*stride |
| 2201 "leal (%%edx, %2, 2), %%ecx \n\t" // 7*stride | |
|
157
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2202 "movq (%0), %%mm0 \n\t" // L0 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2203 "movq (%0, %2), %%mm1 \n\t" // L1 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2204 "movq (%0, %2, 2), %%mm2 \n\t" // L2 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2205 "movq (%0, %%eax), %%mm3 \n\t" // L3 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2206 "movq (%0, %2, 4), %%mm4 \n\t" // L4 |
| 787 | 2207 "movq (%0, %%edx), %%mm5 \n\t" // L5 |
|
157
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2208 "movq (%0, %%eax, 2), %%mm6 \n\t" // L6 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2209 "movq (%0, %%ecx), %%mm7 \n\t" // L7 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2210 "movq %%mm0, (%1) \n\t" // L0 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2211 "movq %%mm1, (%1, %2) \n\t" // L1 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2212 "movq %%mm2, (%1, %2, 2) \n\t" // L2 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2213 "movq %%mm3, (%1, %%eax) \n\t" // L3 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2214 "movq %%mm4, (%1, %2, 4) \n\t" // L4 |
| 787 | 2215 "movq %%mm5, (%1, %%edx) \n\t" // L5 |
|
157
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2216 "movq %%mm6, (%1, %%eax, 2) \n\t" // L6 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2217 "movq %%mm7, (%1, %%ecx) \n\t" // L7 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2218 "jmp 4f \n\t" |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2219 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2220 "1: \n\t" |
| 787 | 2221 "leal (%%eax, %2, 2), %%edx \n\t" // 5*stride |
| 2222 "leal (%%edx, %2, 2), %%ecx \n\t" // 7*stride | |
|
157
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2223 "movq (%0), %%mm0 \n\t" // L0 |
|
363
ff766a367974
3dnow temporal denoiser bugfix by R?mi Guyomarch <rguyom@pobox.com>
michael
parents:
334
diff
changeset
|
2224 PAVGB((%1), %%mm0) // L0 |
|
157
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2225 "movq (%0, %2), %%mm1 \n\t" // L1 |
|
363
ff766a367974
3dnow temporal denoiser bugfix by R?mi Guyomarch <rguyom@pobox.com>
michael
parents:
334
diff
changeset
|
2226 PAVGB((%1, %2), %%mm1) // L1 |
|
157
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2227 "movq (%0, %2, 2), %%mm2 \n\t" // L2 |
|
363
ff766a367974
3dnow temporal denoiser bugfix by R?mi Guyomarch <rguyom@pobox.com>
michael
parents:
334
diff
changeset
|
2228 PAVGB((%1, %2, 2), %%mm2) // L2 |
|
157
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2229 "movq (%0, %%eax), %%mm3 \n\t" // L3 |
|
363
ff766a367974
3dnow temporal denoiser bugfix by R?mi Guyomarch <rguyom@pobox.com>
michael
parents:
334
diff
changeset
|
2230 PAVGB((%1, %%eax), %%mm3) // L3 |
|
157
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2231 "movq (%0, %2, 4), %%mm4 \n\t" // L4 |
|
363
ff766a367974
3dnow temporal denoiser bugfix by R?mi Guyomarch <rguyom@pobox.com>
michael
parents:
334
diff
changeset
|
2232 PAVGB((%1, %2, 4), %%mm4) // L4 |
| 787 | 2233 "movq (%0, %%edx), %%mm5 \n\t" // L5 |
| 2234 PAVGB((%1, %%edx), %%mm5) // L5 | |
|
157
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2235 "movq (%0, %%eax, 2), %%mm6 \n\t" // L6 |
|
363
ff766a367974
3dnow temporal denoiser bugfix by R?mi Guyomarch <rguyom@pobox.com>
michael
parents:
334
diff
changeset
|
2236 PAVGB((%1, %%eax, 2), %%mm6) // L6 |
|
157
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2237 "movq (%0, %%ecx), %%mm7 \n\t" // L7 |
|
363
ff766a367974
3dnow temporal denoiser bugfix by R?mi Guyomarch <rguyom@pobox.com>
michael
parents:
334
diff
changeset
|
2238 PAVGB((%1, %%ecx), %%mm7) // L7 |
|
157
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2239 "movq %%mm0, (%1) \n\t" // R0 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2240 "movq %%mm1, (%1, %2) \n\t" // R1 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2241 "movq %%mm2, (%1, %2, 2) \n\t" // R2 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2242 "movq %%mm3, (%1, %%eax) \n\t" // R3 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2243 "movq %%mm4, (%1, %2, 4) \n\t" // R4 |
| 787 | 2244 "movq %%mm5, (%1, %%edx) \n\t" // R5 |
|
157
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2245 "movq %%mm6, (%1, %%eax, 2) \n\t" // R6 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2246 "movq %%mm7, (%1, %%ecx) \n\t" // R7 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2247 "movq %%mm0, (%0) \n\t" // L0 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2248 "movq %%mm1, (%0, %2) \n\t" // L1 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2249 "movq %%mm2, (%0, %2, 2) \n\t" // L2 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2250 "movq %%mm3, (%0, %%eax) \n\t" // L3 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2251 "movq %%mm4, (%0, %2, 4) \n\t" // L4 |
| 787 | 2252 "movq %%mm5, (%0, %%edx) \n\t" // L5 |
|
157
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2253 "movq %%mm6, (%0, %%eax, 2) \n\t" // L6 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2254 "movq %%mm7, (%0, %%ecx) \n\t" // L7 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2255 "jmp 4f \n\t" |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2256 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2257 "2: \n\t" |
| 787 | 2258 "cmpl 508(%%edx), %%ecx \n\t" |
|
157
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2259 " jb 3f \n\t" |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2260 |
| 787 | 2261 "leal (%%eax, %2, 2), %%edx \n\t" // 5*stride |
| 2262 "leal (%%edx, %2, 2), %%ecx \n\t" // 7*stride | |
|
157
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2263 "movq (%0), %%mm0 \n\t" // L0 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2264 "movq (%0, %2), %%mm1 \n\t" // L1 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2265 "movq (%0, %2, 2), %%mm2 \n\t" // L2 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2266 "movq (%0, %%eax), %%mm3 \n\t" // L3 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2267 "movq (%1), %%mm4 \n\t" // R0 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2268 "movq (%1, %2), %%mm5 \n\t" // R1 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2269 "movq (%1, %2, 2), %%mm6 \n\t" // R2 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2270 "movq (%1, %%eax), %%mm7 \n\t" // R3 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2271 PAVGB(%%mm4, %%mm0) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2272 PAVGB(%%mm5, %%mm1) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2273 PAVGB(%%mm6, %%mm2) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2274 PAVGB(%%mm7, %%mm3) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2275 PAVGB(%%mm4, %%mm0) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2276 PAVGB(%%mm5, %%mm1) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2277 PAVGB(%%mm6, %%mm2) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2278 PAVGB(%%mm7, %%mm3) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2279 "movq %%mm0, (%1) \n\t" // R0 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2280 "movq %%mm1, (%1, %2) \n\t" // R1 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2281 "movq %%mm2, (%1, %2, 2) \n\t" // R2 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2282 "movq %%mm3, (%1, %%eax) \n\t" // R3 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2283 "movq %%mm0, (%0) \n\t" // L0 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2284 "movq %%mm1, (%0, %2) \n\t" // L1 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2285 "movq %%mm2, (%0, %2, 2) \n\t" // L2 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2286 "movq %%mm3, (%0, %%eax) \n\t" // L3 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2287 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2288 "movq (%0, %2, 4), %%mm0 \n\t" // L4 |
| 787 | 2289 "movq (%0, %%edx), %%mm1 \n\t" // L5 |
|
157
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2290 "movq (%0, %%eax, 2), %%mm2 \n\t" // L6 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2291 "movq (%0, %%ecx), %%mm3 \n\t" // L7 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2292 "movq (%1, %2, 4), %%mm4 \n\t" // R4 |
| 787 | 2293 "movq (%1, %%edx), %%mm5 \n\t" // R5 |
|
157
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2294 "movq (%1, %%eax, 2), %%mm6 \n\t" // R6 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2295 "movq (%1, %%ecx), %%mm7 \n\t" // R7 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2296 PAVGB(%%mm4, %%mm0) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2297 PAVGB(%%mm5, %%mm1) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2298 PAVGB(%%mm6, %%mm2) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2299 PAVGB(%%mm7, %%mm3) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2300 PAVGB(%%mm4, %%mm0) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2301 PAVGB(%%mm5, %%mm1) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2302 PAVGB(%%mm6, %%mm2) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2303 PAVGB(%%mm7, %%mm3) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2304 "movq %%mm0, (%1, %2, 4) \n\t" // R4 |
| 787 | 2305 "movq %%mm1, (%1, %%edx) \n\t" // R5 |
|
157
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2306 "movq %%mm2, (%1, %%eax, 2) \n\t" // R6 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2307 "movq %%mm3, (%1, %%ecx) \n\t" // R7 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2308 "movq %%mm0, (%0, %2, 4) \n\t" // L4 |
| 787 | 2309 "movq %%mm1, (%0, %%edx) \n\t" // L5 |
|
157
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2310 "movq %%mm2, (%0, %%eax, 2) \n\t" // L6 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2311 "movq %%mm3, (%0, %%ecx) \n\t" // L7 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2312 "jmp 4f \n\t" |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2313 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2314 "3: \n\t" |
| 787 | 2315 "leal (%%eax, %2, 2), %%edx \n\t" // 5*stride |
| 2316 "leal (%%edx, %2, 2), %%ecx \n\t" // 7*stride | |
|
157
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2317 "movq (%0), %%mm0 \n\t" // L0 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2318 "movq (%0, %2), %%mm1 \n\t" // L1 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2319 "movq (%0, %2, 2), %%mm2 \n\t" // L2 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2320 "movq (%0, %%eax), %%mm3 \n\t" // L3 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2321 "movq (%1), %%mm4 \n\t" // R0 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2322 "movq (%1, %2), %%mm5 \n\t" // R1 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2323 "movq (%1, %2, 2), %%mm6 \n\t" // R2 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2324 "movq (%1, %%eax), %%mm7 \n\t" // R3 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2325 PAVGB(%%mm4, %%mm0) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2326 PAVGB(%%mm5, %%mm1) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2327 PAVGB(%%mm6, %%mm2) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2328 PAVGB(%%mm7, %%mm3) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2329 PAVGB(%%mm4, %%mm0) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2330 PAVGB(%%mm5, %%mm1) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2331 PAVGB(%%mm6, %%mm2) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2332 PAVGB(%%mm7, %%mm3) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2333 PAVGB(%%mm4, %%mm0) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2334 PAVGB(%%mm5, %%mm1) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2335 PAVGB(%%mm6, %%mm2) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2336 PAVGB(%%mm7, %%mm3) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2337 "movq %%mm0, (%1) \n\t" // R0 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2338 "movq %%mm1, (%1, %2) \n\t" // R1 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2339 "movq %%mm2, (%1, %2, 2) \n\t" // R2 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2340 "movq %%mm3, (%1, %%eax) \n\t" // R3 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2341 "movq %%mm0, (%0) \n\t" // L0 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2342 "movq %%mm1, (%0, %2) \n\t" // L1 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2343 "movq %%mm2, (%0, %2, 2) \n\t" // L2 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2344 "movq %%mm3, (%0, %%eax) \n\t" // L3 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2345 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2346 "movq (%0, %2, 4), %%mm0 \n\t" // L4 |
| 787 | 2347 "movq (%0, %%edx), %%mm1 \n\t" // L5 |
|
157
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2348 "movq (%0, %%eax, 2), %%mm2 \n\t" // L6 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2349 "movq (%0, %%ecx), %%mm3 \n\t" // L7 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2350 "movq (%1, %2, 4), %%mm4 \n\t" // R4 |
| 787 | 2351 "movq (%1, %%edx), %%mm5 \n\t" // R5 |
|
157
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2352 "movq (%1, %%eax, 2), %%mm6 \n\t" // R6 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2353 "movq (%1, %%ecx), %%mm7 \n\t" // R7 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2354 PAVGB(%%mm4, %%mm0) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2355 PAVGB(%%mm5, %%mm1) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2356 PAVGB(%%mm6, %%mm2) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2357 PAVGB(%%mm7, %%mm3) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2358 PAVGB(%%mm4, %%mm0) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2359 PAVGB(%%mm5, %%mm1) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2360 PAVGB(%%mm6, %%mm2) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2361 PAVGB(%%mm7, %%mm3) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2362 PAVGB(%%mm4, %%mm0) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2363 PAVGB(%%mm5, %%mm1) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2364 PAVGB(%%mm6, %%mm2) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2365 PAVGB(%%mm7, %%mm3) |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2366 "movq %%mm0, (%1, %2, 4) \n\t" // R4 |
| 787 | 2367 "movq %%mm1, (%1, %%edx) \n\t" // R5 |
|
157
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2368 "movq %%mm2, (%1, %%eax, 2) \n\t" // R6 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2369 "movq %%mm3, (%1, %%ecx) \n\t" // R7 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2370 "movq %%mm0, (%0, %2, 4) \n\t" // L4 |
| 787 | 2371 "movq %%mm1, (%0, %%edx) \n\t" // L5 |
|
157
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2372 "movq %%mm2, (%0, %%eax, 2) \n\t" // L6 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2373 "movq %%mm3, (%0, %%ecx) \n\t" // L7 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2374 |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2375 "4: \n\t" |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2376 |
| 158 | 2377 :: "r" (src), "r" (tempBlured), "r"(stride), "m" (tempBluredPast) |
| 787 | 2378 : "%eax", "%edx", "%ecx", "memory" |
|
157
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2379 ); |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2380 //printf("%d\n", test); |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2381 #else |
| 788 | 2382 { |
| 156 | 2383 int y; |
| 2384 int d=0; | |
| 2385 int sysd=0; | |
| 158 | 2386 int i; |
| 156 | 2387 |
| 2388 for(y=0; y<8; y++) | |
| 2389 { | |
| 2390 int x; | |
| 2391 for(x=0; x<8; x++) | |
| 2392 { | |
| 2393 int ref= tempBlured[ x + y*stride ]; | |
| 2394 int cur= src[ x + y*stride ]; | |
| 2395 int d1=ref - cur; | |
|
157
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2396 // if(x==0 || x==7) d1+= d1>>1; |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2397 // if(y==0 || y==7) d1+= d1>>1; |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2398 // d+= ABS(d1); |
|
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2399 d+= d1*d1; |
| 156 | 2400 sysd+= d1; |
| 2401 } | |
| 2402 } | |
| 158 | 2403 i=d; |
| 2404 d= ( | |
| 2405 4*d | |
| 2406 +(*(tempBluredPast-256)) | |
| 2407 +(*(tempBluredPast-1))+ (*(tempBluredPast+1)) | |
| 2408 +(*(tempBluredPast+256)) | |
| 2409 +4)>>3; | |
| 2410 *tempBluredPast=i; | |
| 2411 // ((*tempBluredPast)*3 + d + 2)>>2; | |
| 2412 | |
| 156 | 2413 //printf("%d %d %d\n", maxNoise[0], maxNoise[1], maxNoise[2]); |
| 2414 /* | |
| 2415 Switch between | |
| 2416 1 0 0 0 0 0 0 (0) | |
| 2417 64 32 16 8 4 2 1 (1) | |
| 2418 64 48 36 27 20 15 11 (33) (approx) | |
| 2419 64 56 49 43 37 33 29 (200) (approx) | |
| 2420 */ | |
| 2421 if(d > maxNoise[1]) | |
| 2422 { | |
| 2423 if(d < maxNoise[2]) | |
| 2424 { | |
| 2425 for(y=0; y<8; y++) | |
| 2426 { | |
| 2427 int x; | |
| 2428 for(x=0; x<8; x++) | |
| 2429 { | |
| 2430 int ref= tempBlured[ x + y*stride ]; | |
| 2431 int cur= src[ x + y*stride ]; | |
| 2432 tempBlured[ x + y*stride ]= | |
| 2433 src[ x + y*stride ]= | |
| 2434 (ref + cur + 1)>>1; | |
| 2435 } | |
| 2436 } | |
| 2437 } | |
| 2438 else | |
| 2439 { | |
| 2440 for(y=0; y<8; y++) | |
| 2441 { | |
| 2442 int x; | |
| 2443 for(x=0; x<8; x++) | |
| 2444 { | |
| 2445 tempBlured[ x + y*stride ]= src[ x + y*stride ]; | |
| 2446 } | |
| 2447 } | |
| 2448 } | |
| 2449 } | |
| 2450 else | |
| 2451 { | |
| 2452 if(d < maxNoise[0]) | |
| 2453 { | |
| 2454 for(y=0; y<8; y++) | |
| 2455 { | |
| 2456 int x; | |
| 2457 for(x=0; x<8; x++) | |
| 2458 { | |
| 2459 int ref= tempBlured[ x + y*stride ]; | |
| 2460 int cur= src[ x + y*stride ]; | |
| 2461 tempBlured[ x + y*stride ]= | |
| 2462 src[ x + y*stride ]= | |
| 2463 (ref*7 + cur + 4)>>3; | |
| 2464 } | |
| 2465 } | |
| 2466 } | |
| 2467 else | |
| 2468 { | |
| 2469 for(y=0; y<8; y++) | |
| 2470 { | |
| 2471 int x; | |
| 2472 for(x=0; x<8; x++) | |
| 2473 { | |
| 2474 int ref= tempBlured[ x + y*stride ]; | |
| 2475 int cur= src[ x + y*stride ]; | |
| 2476 tempBlured[ x + y*stride ]= | |
| 2477 src[ x + y*stride ]= | |
| 2478 (ref*3 + cur + 2)>>2; | |
| 2479 } | |
| 2480 } | |
| 2481 } | |
| 2482 } | |
| 788 | 2483 } |
|
157
bc12fd7e6153
temp denoiser changes: (a-b)^2 instead of |a-b| and MMX2/3DNOW version
michael
parents:
156
diff
changeset
|
2484 #endif |
| 156 | 2485 } |
| 2486 | |
| 169 | 2487 static void RENAME(postProcess)(uint8_t src[], int srcStride, uint8_t dst[], int dstStride, int width, int height, |
| 787 | 2488 QP_STORE_T QPs[], int QPStride, int isColor, PPContext *c); |
| 96 | 2489 |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2490 /** |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2491 * Copies a block from src to dst and fixes the blacklevel |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
2492 * levelFix == 0 -> dont touch the brighness & contrast |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2493 */ |
|
634
be1cb0e1f276
warning fixes by Dominik Mierzejewski <dominik@rangers.eu.org>
arpi
parents:
600
diff
changeset
|
2494 #undef SCALED_CPY |
|
be1cb0e1f276
warning fixes by Dominik Mierzejewski <dominik@rangers.eu.org>
arpi
parents:
600
diff
changeset
|
2495 |
| 169 | 2496 static inline void RENAME(blockCopy)(uint8_t dst[], int dstStride, uint8_t src[], int srcStride, |
| 787 | 2497 int levelFix, int64_t *packedOffsetAndScale) |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2498 { |
|
129
be35346e27c1
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
128
diff
changeset
|
2499 #ifndef HAVE_MMX |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
2500 int i; |
|
129
be35346e27c1
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
128
diff
changeset
|
2501 #endif |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
2502 if(levelFix) |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
2503 { |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2504 #ifdef HAVE_MMX |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2505 asm volatile( |
| 787 | 2506 "movq (%%eax), %%mm2 \n\t" // packedYOffset |
| 2507 "movq 8(%%eax), %%mm3 \n\t" // packedYScale | |
| 2508 "leal (%2,%4), %%eax \n\t" | |
| 2509 "leal (%3,%5), %%edx \n\t" | |
|
101
fcf4e8fcb34b
fixed a sig4 bug an non mmx2 cpus (in case of more sig4 errors please send me a "disassemble $eip-16 $eip+16" from gdb)
michael
parents:
100
diff
changeset
|
2510 "pxor %%mm4, %%mm4 \n\t" |
| 173 | 2511 #ifdef HAVE_MMX2 |
| 2512 #define SCALED_CPY(src1, src2, dst1, dst2) \ | |
| 2513 "movq " #src1 ", %%mm0 \n\t"\ | |
| 2514 "movq " #src1 ", %%mm5 \n\t"\ | |
| 2515 "movq " #src2 ", %%mm1 \n\t"\ | |
| 2516 "movq " #src2 ", %%mm6 \n\t"\ | |
| 2517 "punpcklbw %%mm0, %%mm0 \n\t"\ | |
| 2518 "punpckhbw %%mm5, %%mm5 \n\t"\ | |
| 2519 "punpcklbw %%mm1, %%mm1 \n\t"\ | |
| 2520 "punpckhbw %%mm6, %%mm6 \n\t"\ | |
| 2521 "pmulhuw %%mm3, %%mm0 \n\t"\ | |
| 2522 "pmulhuw %%mm3, %%mm5 \n\t"\ | |
| 2523 "pmulhuw %%mm3, %%mm1 \n\t"\ | |
| 2524 "pmulhuw %%mm3, %%mm6 \n\t"\ | |
| 2525 "psubw %%mm2, %%mm0 \n\t"\ | |
| 2526 "psubw %%mm2, %%mm5 \n\t"\ | |
| 2527 "psubw %%mm2, %%mm1 \n\t"\ | |
| 2528 "psubw %%mm2, %%mm6 \n\t"\ | |
| 2529 "packuswb %%mm5, %%mm0 \n\t"\ | |
| 2530 "packuswb %%mm6, %%mm1 \n\t"\ | |
| 2531 "movq %%mm0, " #dst1 " \n\t"\ | |
| 2532 "movq %%mm1, " #dst2 " \n\t"\ | |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2533 |
| 173 | 2534 #else //HAVE_MMX2 |
| 166 | 2535 #define SCALED_CPY(src1, src2, dst1, dst2) \ |
| 2536 "movq " #src1 ", %%mm0 \n\t"\ | |
| 2537 "movq " #src1 ", %%mm5 \n\t"\ | |
|
101
fcf4e8fcb34b
fixed a sig4 bug an non mmx2 cpus (in case of more sig4 errors please send me a "disassemble $eip-16 $eip+16" from gdb)
michael
parents:
100
diff
changeset
|
2538 "punpcklbw %%mm4, %%mm0 \n\t"\ |
|
fcf4e8fcb34b
fixed a sig4 bug an non mmx2 cpus (in case of more sig4 errors please send me a "disassemble $eip-16 $eip+16" from gdb)
michael
parents:
100
diff
changeset
|
2539 "punpckhbw %%mm4, %%mm5 \n\t"\ |
| 117 | 2540 "psubw %%mm2, %%mm0 \n\t"\ |
| 2541 "psubw %%mm2, %%mm5 \n\t"\ | |
| 166 | 2542 "movq " #src2 ", %%mm1 \n\t"\ |
| 117 | 2543 "psllw $6, %%mm0 \n\t"\ |
| 2544 "psllw $6, %%mm5 \n\t"\ | |
|
101
fcf4e8fcb34b
fixed a sig4 bug an non mmx2 cpus (in case of more sig4 errors please send me a "disassemble $eip-16 $eip+16" from gdb)
michael
parents:
100
diff
changeset
|
2545 "pmulhw %%mm3, %%mm0 \n\t"\ |
| 166 | 2546 "movq " #src2 ", %%mm6 \n\t"\ |
|
101
fcf4e8fcb34b
fixed a sig4 bug an non mmx2 cpus (in case of more sig4 errors please send me a "disassemble $eip-16 $eip+16" from gdb)
michael
parents:
100
diff
changeset
|
2547 "pmulhw %%mm3, %%mm5 \n\t"\ |
|
fcf4e8fcb34b
fixed a sig4 bug an non mmx2 cpus (in case of more sig4 errors please send me a "disassemble $eip-16 $eip+16" from gdb)
michael
parents:
100
diff
changeset
|
2548 "punpcklbw %%mm4, %%mm1 \n\t"\ |
|
118
3dd1950ac98d
brightness / contrast fix/copy optimizations +2% speedup
michael
parents:
117
diff
changeset
|
2549 "punpckhbw %%mm4, %%mm6 \n\t"\ |
| 117 | 2550 "psubw %%mm2, %%mm1 \n\t"\ |
|
118
3dd1950ac98d
brightness / contrast fix/copy optimizations +2% speedup
michael
parents:
117
diff
changeset
|
2551 "psubw %%mm2, %%mm6 \n\t"\ |
| 117 | 2552 "psllw $6, %%mm1 \n\t"\ |
|
118
3dd1950ac98d
brightness / contrast fix/copy optimizations +2% speedup
michael
parents:
117
diff
changeset
|
2553 "psllw $6, %%mm6 \n\t"\ |
|
101
fcf4e8fcb34b
fixed a sig4 bug an non mmx2 cpus (in case of more sig4 errors please send me a "disassemble $eip-16 $eip+16" from gdb)
michael
parents:
100
diff
changeset
|
2554 "pmulhw %%mm3, %%mm1 \n\t"\ |
|
118
3dd1950ac98d
brightness / contrast fix/copy optimizations +2% speedup
michael
parents:
117
diff
changeset
|
2555 "pmulhw %%mm3, %%mm6 \n\t"\ |
|
3dd1950ac98d
brightness / contrast fix/copy optimizations +2% speedup
michael
parents:
117
diff
changeset
|
2556 "packuswb %%mm5, %%mm0 \n\t"\ |
|
3dd1950ac98d
brightness / contrast fix/copy optimizations +2% speedup
michael
parents:
117
diff
changeset
|
2557 "packuswb %%mm6, %%mm1 \n\t"\ |
| 166 | 2558 "movq %%mm0, " #dst1 " \n\t"\ |
| 2559 "movq %%mm1, " #dst2 " \n\t"\ | |
| 2560 | |
| 173 | 2561 #endif //!HAVE_MMX2 |
| 2562 | |
| 787 | 2563 SCALED_CPY((%2) , (%2, %4) , (%3) , (%3, %5)) |
| 2564 SCALED_CPY((%2, %4, 2), (%%eax, %4, 2), (%3, %5, 2), (%%edx, %5, 2)) | |
| 2565 SCALED_CPY((%2, %4, 4), (%%eax, %4, 4), (%3, %5, 4), (%%edx, %5, 4)) | |
| 2566 "leal (%%eax,%4,4), %%eax \n\t" | |
| 2567 "leal (%%edx,%5,4), %%edx \n\t" | |
| 2568 SCALED_CPY((%%eax, %4), (%%eax, %4, 2), (%%edx, %5), (%%edx, %5, 2)) | |
| 166 | 2569 |
| 2570 | |
| 787 | 2571 : "=&a" (packedOffsetAndScale) |
| 2572 : "0" (packedOffsetAndScale), | |
| 2573 "r"(src), | |
| 166 | 2574 "r"(dst), |
| 2575 "r" (srcStride), | |
|
118
3dd1950ac98d
brightness / contrast fix/copy optimizations +2% speedup
michael
parents:
117
diff
changeset
|
2576 "r" (dstStride) |
| 787 | 2577 : "%edx" |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2578 ); |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2579 #else |
| 164 | 2580 for(i=0; i<8; i++) |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2581 memcpy( &(dst[dstStride*i]), |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2582 &(src[srcStride*i]), BLOCK_SIZE); |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2583 #endif |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
2584 } |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
2585 else |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
2586 { |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
2587 #ifdef HAVE_MMX |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
2588 asm volatile( |
| 166 | 2589 "leal (%0,%2), %%eax \n\t" |
| 787 | 2590 "leal (%1,%3), %%edx \n\t" |
| 166 | 2591 |
| 2592 #define SIMPLE_CPY(src1, src2, dst1, dst2) \ | |
| 2593 "movq " #src1 ", %%mm0 \n\t"\ | |
| 2594 "movq " #src2 ", %%mm1 \n\t"\ | |
| 2595 "movq %%mm0, " #dst1 " \n\t"\ | |
| 2596 "movq %%mm1, " #dst2 " \n\t"\ | |
| 2597 | |
| 2598 SIMPLE_CPY((%0) , (%0, %2) , (%1) , (%1, %3)) | |
| 787 | 2599 SIMPLE_CPY((%0, %2, 2), (%%eax, %2, 2), (%1, %3, 2), (%%edx, %3, 2)) |
| 2600 SIMPLE_CPY((%0, %2, 4), (%%eax, %2, 4), (%1, %3, 4), (%%edx, %3, 4)) | |
| 166 | 2601 "leal (%%eax,%2,4), %%eax \n\t" |
| 787 | 2602 "leal (%%edx,%3,4), %%edx \n\t" |
| 2603 SIMPLE_CPY((%%eax, %2), (%%eax, %2, 2), (%%edx, %3), (%%edx, %3, 2)) | |
| 166 | 2604 |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
2605 : : "r" (src), |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
2606 "r" (dst), |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
2607 "r" (srcStride), |
| 164 | 2608 "r" (dstStride) |
| 787 | 2609 : "%eax", "%edx" |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
2610 ); |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
2611 #else |
| 164 | 2612 for(i=0; i<8; i++) |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
2613 memcpy( &(dst[dstStride*i]), |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
2614 &(src[srcStride*i]), BLOCK_SIZE); |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
2615 #endif |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
2616 } |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2617 } |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2618 |
| 224 | 2619 /** |
| 2620 * Duplicates the given 8 src pixels ? times upward | |
| 2621 */ | |
| 2622 static inline void RENAME(duplicate)(uint8_t src[], int stride) | |
| 2623 { | |
| 2624 #ifdef HAVE_MMX | |
| 2625 asm volatile( | |
| 2626 "movq (%0), %%mm0 \n\t" | |
| 2627 "addl %1, %0 \n\t" | |
| 2628 "movq %%mm0, (%0) \n\t" | |
| 2629 "movq %%mm0, (%0, %1) \n\t" | |
| 2630 "movq %%mm0, (%0, %1, 2) \n\t" | |
| 2631 : "+r" (src) | |
| 2632 : "r" (-stride) | |
| 2633 ); | |
| 2634 #else | |
| 2635 int i; | |
| 2636 uint8_t *p=src; | |
| 2637 for(i=0; i<3; i++) | |
| 2638 { | |
| 2639 p-= stride; | |
| 2640 memcpy(p, src, 8); | |
| 2641 } | |
| 2642 #endif | |
| 2643 } | |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2644 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2645 /** |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2646 * Filters array of bytes (Y or U or V values) |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2647 */ |
| 169 | 2648 static void RENAME(postProcess)(uint8_t src[], int srcStride, uint8_t dst[], int dstStride, int width, int height, |
| 787 | 2649 QP_STORE_T QPs[], int QPStride, int isColor, PPContext *c2) |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2650 { |
| 787 | 2651 PPContext __attribute__((aligned(8))) c= *c2; //copy to stack for faster access |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
2652 int x,y; |
|
172
a0efaf471d6b
compiletime pp-mode support (luminance = chrominance filters though) 1-2% faster with -benchmark -vo null -nosound
michael
parents:
169
diff
changeset
|
2653 #ifdef COMPILE_TIME_MODE |
|
a0efaf471d6b
compiletime pp-mode support (luminance = chrominance filters though) 1-2% faster with -benchmark -vo null -nosound
michael
parents:
169
diff
changeset
|
2654 const int mode= COMPILE_TIME_MODE; |
|
a0efaf471d6b
compiletime pp-mode support (luminance = chrominance filters though) 1-2% faster with -benchmark -vo null -nosound
michael
parents:
169
diff
changeset
|
2655 #else |
| 787 | 2656 const int mode= isColor ? c.ppMode.chromMode : c.ppMode.lumMode; |
|
172
a0efaf471d6b
compiletime pp-mode support (luminance = chrominance filters though) 1-2% faster with -benchmark -vo null -nosound
michael
parents:
169
diff
changeset
|
2657 #endif |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
2658 int black=0, white=255; // blackest black and whitest white in the picture |
| 223 | 2659 int QPCorrecture= 256*256; |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2660 |
|
886
3abff5a87548
warning patch by (Dominik Mierzejewski <dominik at rangers dot eu dot org>)
michael
parents:
810
diff
changeset
|
2661 int copyAhead; |
|
3abff5a87548
warning patch by (Dominik Mierzejewski <dominik at rangers dot eu dot org>)
michael
parents:
810
diff
changeset
|
2662 #ifdef HAVE_MMX |
|
3abff5a87548
warning patch by (Dominik Mierzejewski <dominik at rangers dot eu dot org>)
michael
parents:
810
diff
changeset
|
2663 int i; |
|
3abff5a87548
warning patch by (Dominik Mierzejewski <dominik at rangers dot eu dot org>)
michael
parents:
810
diff
changeset
|
2664 #endif |
| 164 | 2665 |
| 957 | 2666 const int qpHShift= isColor ? 4-c.hChromaSubSample : 4; |
| 2667 const int qpVShift= isColor ? 4-c.vChromaSubSample : 4; | |
| 2668 | |
| 787 | 2669 //FIXME remove |
| 2670 uint64_t * const yHistogram= c.yHistogram; | |
| 2671 uint8_t * const tempSrc= c.tempSrc; | |
| 2672 uint8_t * const tempDst= c.tempDst; | |
| 791 | 2673 const int mbWidth= isColor ? (width+7)>>3 : (width+15)>>4; |
|
182
3ccd74a91074
minor brightness/contrast bugfix / moved some global vars into ppMode
michael
parents:
181
diff
changeset
|
2674 |
| 158 | 2675 #ifdef HAVE_MMX |
| 791 | 2676 for(i=0; i<32; i++){ |
| 2677 int offset= ((i*c.ppMode.baseDcDiff)>>8) + 1; | |
| 2678 int threshold= offset*2 + 1; | |
| 2679 c.mmxDcOffset[i]= 0x7F - offset; | |
| 2680 c.mmxDcThreshold[i]= 0x7F - threshold; | |
| 2681 c.mmxDcOffset[i]*= 0x0101010101010101LL; | |
| 2682 c.mmxDcThreshold[i]*= 0x0101010101010101LL; | |
| 2683 } | |
| 158 | 2684 #endif |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2685 |
| 164 | 2686 if(mode & CUBIC_IPOL_DEINT_FILTER) copyAhead=16; |
| 787 | 2687 else if( (mode & LINEAR_BLEND_DEINT_FILTER) |
| 2688 || (mode & FFMPEG_DEINT_FILTER)) copyAhead=14; | |
| 164 | 2689 else if( (mode & V_DEBLOCK) |
| 2690 || (mode & LINEAR_IPOL_DEINT_FILTER) | |
| 2691 || (mode & MEDIAN_DEINT_FILTER)) copyAhead=13; | |
| 2692 else if(mode & V_X1_FILTER) copyAhead=11; | |
| 787 | 2693 // else if(mode & V_RK1_FILTER) copyAhead=10; |
| 164 | 2694 else if(mode & DERING) copyAhead=9; |
| 2695 else copyAhead=8; | |
| 2696 | |
| 2697 copyAhead-= 8; | |
| 2698 | |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2699 if(!isColor) |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2700 { |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2701 uint64_t sum= 0; |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
2702 int i; |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
2703 uint64_t maxClipped; |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
2704 uint64_t clipped; |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
2705 double scale; |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
2706 |
| 787 | 2707 c.frameNum++; |
| 2708 // first frame is fscked so we ignore it | |
| 2709 if(c.frameNum == 1) yHistogram[0]= width*height/64*15/256; | |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2710 |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
2711 for(i=0; i<256; i++) |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
2712 { |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
2713 sum+= yHistogram[i]; |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
2714 // printf("%d ", yHistogram[i]); |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
2715 } |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
2716 // printf("\n\n"); |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2717 |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
2718 /* we allways get a completly black picture first */ |
| 793 | 2719 maxClipped= (uint64_t)(sum * c.ppMode.maxClippedThreshold); |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
2720 |
|
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
2721 clipped= sum; |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2722 for(black=255; black>0; black--) |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2723 { |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2724 if(clipped < maxClipped) break; |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2725 clipped-= yHistogram[black]; |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2726 } |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2727 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2728 clipped= sum; |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2729 for(white=0; white<256; white++) |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2730 { |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2731 if(clipped < maxClipped) break; |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2732 clipped-= yHistogram[white]; |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2733 } |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2734 |
| 787 | 2735 scale= (double)(c.ppMode.maxAllowedY - c.ppMode.minAllowedY) / (double)(white-black); |
| 173 | 2736 |
| 2737 #ifdef HAVE_MMX2 | |
| 787 | 2738 c.packedYScale= (uint16_t)(scale*256.0 + 0.5); |
| 2739 c.packedYOffset= (((black*c.packedYScale)>>8) - c.ppMode.minAllowedY) & 0xFFFF; | |
| 173 | 2740 #else |
| 787 | 2741 c.packedYScale= (uint16_t)(scale*1024.0 + 0.5); |
| 2742 c.packedYOffset= (black - c.ppMode.minAllowedY) & 0xFFFF; | |
| 173 | 2743 #endif |
| 2744 | |
| 787 | 2745 c.packedYOffset|= c.packedYOffset<<32; |
| 2746 c.packedYOffset|= c.packedYOffset<<16; | |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2747 |
| 787 | 2748 c.packedYScale|= c.packedYScale<<32; |
| 2749 c.packedYScale|= c.packedYScale<<16; | |
| 223 | 2750 |
| 2751 if(mode & LEVEL_FIX) QPCorrecture= (int)(scale*256*256 + 0.5); | |
| 2752 else QPCorrecture= 256*256; | |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2753 } |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2754 else |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2755 { |
| 787 | 2756 c.packedYScale= 0x0100010001000100LL; |
| 2757 c.packedYOffset= 0; | |
| 223 | 2758 QPCorrecture= 256*256; |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2759 } |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2760 |
|
148
1cfc4d567c0a
minor changes (fixed some warnings, added attribute aligned(8) stuff)
michael
parents:
142
diff
changeset
|
2761 /* copy & deinterlace first row of blocks */ |
| 142 | 2762 y=-BLOCK_SIZE; |
| 2763 { | |
| 2764 uint8_t *srcBlock= &(src[y*srcStride]); | |
| 224 | 2765 uint8_t *dstBlock= tempDst + dstStride; |
| 142 | 2766 |
| 2767 // From this point on it is guranteed that we can read and write 16 lines downward | |
| 2768 // finish 1 block before the next otherwise we´ll might have a problem | |
| 2769 // with the L1 Cache of the P4 ... or only a few blocks at a time or soemthing | |
| 2770 for(x=0; x<width; x+=BLOCK_SIZE) | |
| 2771 { | |
| 2772 | |
| 2773 #ifdef HAVE_MMX2 | |
| 2774 /* | |
| 2775 prefetchnta(srcBlock + (((x>>2)&6) + 5)*srcStride + 32); | |
| 2776 prefetchnta(srcBlock + (((x>>2)&6) + 6)*srcStride + 32); | |
| 2777 prefetcht0(dstBlock + (((x>>2)&6) + 5)*dstStride + 32); | |
| 2778 prefetcht0(dstBlock + (((x>>2)&6) + 6)*dstStride + 32); | |
| 2779 */ | |
| 2780 | |
| 2781 asm( | |
| 2782 "movl %4, %%eax \n\t" | |
| 2783 "shrl $2, %%eax \n\t" | |
| 2784 "andl $6, %%eax \n\t" | |
| 164 | 2785 "addl %5, %%eax \n\t" |
| 787 | 2786 "movl %%eax, %%edx \n\t" |
| 142 | 2787 "imul %1, %%eax \n\t" |
| 787 | 2788 "imul %3, %%edx \n\t" |
| 142 | 2789 "prefetchnta 32(%%eax, %0) \n\t" |
| 787 | 2790 "prefetcht0 32(%%edx, %2) \n\t" |
| 142 | 2791 "addl %1, %%eax \n\t" |
| 787 | 2792 "addl %3, %%edx \n\t" |
| 142 | 2793 "prefetchnta 32(%%eax, %0) \n\t" |
| 787 | 2794 "prefetcht0 32(%%edx, %2) \n\t" |
| 142 | 2795 :: "r" (srcBlock), "r" (srcStride), "r" (dstBlock), "r" (dstStride), |
| 164 | 2796 "m" (x), "m" (copyAhead) |
| 787 | 2797 : "%eax", "%edx" |
| 142 | 2798 ); |
| 2799 | |
| 2800 #elif defined(HAVE_3DNOW) | |
| 2801 //FIXME check if this is faster on an 3dnow chip or if its faster without the prefetch or ... | |
| 2802 /* prefetch(srcBlock + (((x>>3)&3) + 5)*srcStride + 32); | |
| 2803 prefetch(srcBlock + (((x>>3)&3) + 9)*srcStride + 32); | |
| 2804 prefetchw(dstBlock + (((x>>3)&3) + 5)*dstStride + 32); | |
| 2805 prefetchw(dstBlock + (((x>>3)&3) + 9)*dstStride + 32); | |
| 2806 */ | |
| 2807 #endif | |
| 2808 | |
| 224 | 2809 RENAME(blockCopy)(dstBlock + dstStride*8, dstStride, |
| 787 | 2810 srcBlock + srcStride*8, srcStride, mode & LEVEL_FIX, &c.packedYOffset); |
| 224 | 2811 |
| 2812 RENAME(duplicate)(dstBlock + dstStride*8, dstStride); | |
| 142 | 2813 |
| 2814 if(mode & LINEAR_IPOL_DEINT_FILTER) | |
| 169 | 2815 RENAME(deInterlaceInterpolateLinear)(dstBlock, dstStride); |
| 142 | 2816 else if(mode & LINEAR_BLEND_DEINT_FILTER) |
| 169 | 2817 RENAME(deInterlaceBlendLinear)(dstBlock, dstStride); |
| 142 | 2818 else if(mode & MEDIAN_DEINT_FILTER) |
| 169 | 2819 RENAME(deInterlaceMedian)(dstBlock, dstStride); |
| 142 | 2820 else if(mode & CUBIC_IPOL_DEINT_FILTER) |
| 169 | 2821 RENAME(deInterlaceInterpolateCubic)(dstBlock, dstStride); |
| 787 | 2822 else if(mode & FFMPEG_DEINT_FILTER) |
| 2823 RENAME(deInterlaceFF)(dstBlock, dstStride, c.deintTemp + x); | |
| 142 | 2824 /* else if(mode & CUBIC_BLEND_DEINT_FILTER) |
| 169 | 2825 RENAME(deInterlaceBlendCubic)(dstBlock, dstStride); |
| 142 | 2826 */ |
| 2827 dstBlock+=8; | |
| 2828 srcBlock+=8; | |
| 2829 } | |
| 941 | 2830 if(width==dstStride) |
| 2831 memcpy(dst, tempDst + 9*dstStride, copyAhead*dstStride); | |
| 2832 else | |
| 2833 { | |
| 943 | 2834 int i; |
| 941 | 2835 for(i=0; i<copyAhead; i++) |
| 2836 { | |
| 2837 memcpy(dst + i*dstStride, tempDst + (9+i)*dstStride, width); | |
| 2838 } | |
| 2839 } | |
| 142 | 2840 } |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2841 |
| 787 | 2842 //printf("\n"); |
| 111 | 2843 for(y=0; y<height; y+=BLOCK_SIZE) |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2844 { |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2845 //1% speedup if these are here instead of the inner loop |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2846 uint8_t *srcBlock= &(src[y*srcStride]); |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2847 uint8_t *dstBlock= &(dst[y*dstStride]); |
| 169 | 2848 #ifdef HAVE_MMX |
| 787 | 2849 uint8_t *tempBlock1= c.tempBlocks; |
| 2850 uint8_t *tempBlock2= c.tempBlocks + 8; | |
| 169 | 2851 #endif |
| 957 | 2852 int8_t *QPptr= &QPs[(y>>qpVShift)*QPStride]; |
| 2853 int8_t *nonBQPptr= &c.nonBQPTable[(y>>qpVShift)*mbWidth]; | |
| 156 | 2854 int QP=0; |
| 130 | 2855 /* can we mess with a 8x16 block from srcBlock/dstBlock downwards and 1 line upwards |
| 2856 if not than use a temporary buffer */ | |
| 111 | 2857 if(y+15 >= height) |
| 2858 { | |
| 156 | 2859 int i; |
| 164 | 2860 /* copy from line (copyAhead) to (copyAhead+7) of src, these will be copied with |
| 111 | 2861 blockcopy to dst later */ |
| 164 | 2862 memcpy(tempSrc + srcStride*copyAhead, srcBlock + srcStride*copyAhead, |
| 2863 srcStride*MAX(height-y-copyAhead, 0) ); | |
| 2864 | |
| 2865 /* duplicate last line of src to fill the void upto line (copyAhead+7) */ | |
| 2866 for(i=MAX(height-y, 8); i<copyAhead+8; i++) | |
| 156 | 2867 memcpy(tempSrc + srcStride*i, src + srcStride*(height-1), srcStride); |
| 2868 | |
| 164 | 2869 /* copy up to (copyAhead+1) lines of dst (line -1 to (copyAhead-1))*/ |
| 2870 memcpy(tempDst, dstBlock - dstStride, dstStride*MIN(height-y+1, copyAhead+1) ); | |
| 2871 | |
| 2872 /* duplicate last line of dst to fill the void upto line (copyAhead) */ | |
| 2873 for(i=height-y+1; i<=copyAhead; i++) | |
| 156 | 2874 memcpy(tempDst + dstStride*i, dst + dstStride*(height-1), dstStride); |
| 2875 | |
| 130 | 2876 dstBlock= tempDst + dstStride; |
| 111 | 2877 srcBlock= tempSrc; |
| 2878 } | |
| 787 | 2879 //printf("\n"); |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2880 |
| 112 | 2881 // From this point on it is guranteed that we can read and write 16 lines downward |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2882 // finish 1 block before the next otherwise we´ll might have a problem |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2883 // with the L1 Cache of the P4 ... or only a few blocks at a time or soemthing |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
2884 for(x=0; x<width; x+=BLOCK_SIZE) |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2885 { |
|
97
e57b1d38d71f
bugfixes: last 3 lines not brightness/contrast corrected
michael
parents:
96
diff
changeset
|
2886 const int stride= dstStride; |
| 169 | 2887 #ifdef HAVE_MMX |
|
128
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2888 uint8_t *tmpXchg; |
| 169 | 2889 #endif |
| 791 | 2890 if(isColor) |
| 121 | 2891 { |
| 957 | 2892 QP= QPptr[x>>qpHShift]; |
| 2893 c.nonBQP= nonBQPptr[x>>qpHShift]; | |
| 791 | 2894 } |
| 2895 else | |
| 2896 { | |
| 2897 QP= QPptr[x>>4]; | |
| 223 | 2898 QP= (QP* QPCorrecture + 256*128)>>16; |
| 791 | 2899 c.nonBQP= nonBQPptr[x>>4]; |
| 2900 c.nonBQP= (c.nonBQP* QPCorrecture + 256*128)>>16; | |
|
148
1cfc4d567c0a
minor changes (fixed some warnings, added attribute aligned(8) stuff)
michael
parents:
142
diff
changeset
|
2901 yHistogram[ srcBlock[srcStride*12 + 4] ]++; |
| 121 | 2902 } |
| 787 | 2903 c.QP= QP; |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2904 #ifdef HAVE_MMX |
| 111 | 2905 asm volatile( |
| 787 | 2906 "movd %1, %%mm7 \n\t" |
| 111 | 2907 "packuswb %%mm7, %%mm7 \n\t" // 0, 0, 0, QP, 0, 0, 0, QP |
| 2908 "packuswb %%mm7, %%mm7 \n\t" // 0,QP, 0, QP, 0,QP, 0, QP | |
| 2909 "packuswb %%mm7, %%mm7 \n\t" // QP,..., QP | |
| 787 | 2910 "movq %%mm7, %0 \n\t" |
| 2911 : "=m" (c.pQPb) | |
| 2912 : "r" (QP) | |
| 111 | 2913 ); |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2914 #endif |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2915 |
| 96 | 2916 |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2917 #ifdef HAVE_MMX2 |
| 126 | 2918 /* |
| 2919 prefetchnta(srcBlock + (((x>>2)&6) + 5)*srcStride + 32); | |
| 2920 prefetchnta(srcBlock + (((x>>2)&6) + 6)*srcStride + 32); | |
| 2921 prefetcht0(dstBlock + (((x>>2)&6) + 5)*dstStride + 32); | |
| 2922 prefetcht0(dstBlock + (((x>>2)&6) + 6)*dstStride + 32); | |
| 2923 */ | |
| 2924 | |
| 2925 asm( | |
| 2926 "movl %4, %%eax \n\t" | |
| 2927 "shrl $2, %%eax \n\t" | |
| 2928 "andl $6, %%eax \n\t" | |
| 164 | 2929 "addl %5, %%eax \n\t" |
| 787 | 2930 "movl %%eax, %%edx \n\t" |
| 126 | 2931 "imul %1, %%eax \n\t" |
| 787 | 2932 "imul %3, %%edx \n\t" |
| 126 | 2933 "prefetchnta 32(%%eax, %0) \n\t" |
| 787 | 2934 "prefetcht0 32(%%edx, %2) \n\t" |
| 126 | 2935 "addl %1, %%eax \n\t" |
| 787 | 2936 "addl %3, %%edx \n\t" |
| 126 | 2937 "prefetchnta 32(%%eax, %0) \n\t" |
| 787 | 2938 "prefetcht0 32(%%edx, %2) \n\t" |
| 126 | 2939 :: "r" (srcBlock), "r" (srcStride), "r" (dstBlock), "r" (dstStride), |
| 164 | 2940 "m" (x), "m" (copyAhead) |
| 787 | 2941 : "%eax", "%edx" |
| 126 | 2942 ); |
| 2943 | |
| 96 | 2944 #elif defined(HAVE_3DNOW) |
| 2945 //FIXME check if this is faster on an 3dnow chip or if its faster without the prefetch or ... | |
| 111 | 2946 /* prefetch(srcBlock + (((x>>3)&3) + 5)*srcStride + 32); |
| 2947 prefetch(srcBlock + (((x>>3)&3) + 9)*srcStride + 32); | |
| 2948 prefetchw(dstBlock + (((x>>3)&3) + 5)*dstStride + 32); | |
| 2949 prefetchw(dstBlock + (((x>>3)&3) + 9)*dstStride + 32); | |
| 96 | 2950 */ |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2951 #endif |
| 111 | 2952 |
| 169 | 2953 RENAME(blockCopy)(dstBlock + dstStride*copyAhead, dstStride, |
| 787 | 2954 srcBlock + srcStride*copyAhead, srcStride, mode & LEVEL_FIX, &c.packedYOffset); |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2955 |
| 111 | 2956 if(mode & LINEAR_IPOL_DEINT_FILTER) |
| 169 | 2957 RENAME(deInterlaceInterpolateLinear)(dstBlock, dstStride); |
| 111 | 2958 else if(mode & LINEAR_BLEND_DEINT_FILTER) |
| 169 | 2959 RENAME(deInterlaceBlendLinear)(dstBlock, dstStride); |
| 111 | 2960 else if(mode & MEDIAN_DEINT_FILTER) |
| 169 | 2961 RENAME(deInterlaceMedian)(dstBlock, dstStride); |
| 111 | 2962 else if(mode & CUBIC_IPOL_DEINT_FILTER) |
| 169 | 2963 RENAME(deInterlaceInterpolateCubic)(dstBlock, dstStride); |
| 787 | 2964 else if(mode & FFMPEG_DEINT_FILTER) |
| 2965 RENAME(deInterlaceFF)(dstBlock, dstStride, c.deintTemp + x); | |
| 111 | 2966 /* else if(mode & CUBIC_BLEND_DEINT_FILTER) |
| 169 | 2967 RENAME(deInterlaceBlendCubic)(dstBlock, dstStride); |
|
106
389391a6d0bf
rewrote the horizontal lowpass filter to fix a bug which caused a blocky look
michael
parents:
105
diff
changeset
|
2968 */ |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2969 |
| 111 | 2970 /* only deblock if we have 2 blocks */ |
| 2971 if(y + 8 < height) | |
| 2972 { | |
| 787 | 2973 if(mode & V_X1_FILTER) |
| 2974 RENAME(vertX1Filter)(dstBlock, stride, &c); | |
|
115
4514b8e7f0f1
more logic behavior if the altenative deblock filters are used (turning a alt filter on without turning the deblock filter on uses the alt filter instead of using no filter now)
michael
parents:
113
diff
changeset
|
2975 else if(mode & V_DEBLOCK) |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2976 { |
| 787 | 2977 if( RENAME(isVertDC)(dstBlock, stride, &c)) |
| 96 | 2978 { |
| 787 | 2979 if(RENAME(isVertMinMaxOk)(dstBlock, stride, &c)) |
| 2980 RENAME(doVertLowPass)(dstBlock, stride, &c); | |
| 96 | 2981 } |
|
115
4514b8e7f0f1
more logic behavior if the altenative deblock filters are used (turning a alt filter on without turning the deblock filter on uses the alt filter instead of using no filter now)
michael
parents:
113
diff
changeset
|
2982 else |
| 787 | 2983 RENAME(doVertDefFilter)(dstBlock, stride, &c); |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2984 } |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2985 } |
| 130 | 2986 |
|
128
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2987 #ifdef HAVE_MMX |
| 169 | 2988 RENAME(transpose1)(tempBlock1, tempBlock2, dstBlock, dstStride); |
|
128
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2989 #endif |
| 111 | 2990 /* check if we have a previous block to deblock it with dstBlock */ |
| 112 | 2991 if(x - 8 >= 0) |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
2992 { |
|
128
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2993 #ifdef HAVE_MMX |
| 787 | 2994 if(mode & H_X1_FILTER) |
| 2995 RENAME(vertX1Filter)(tempBlock1, 16, &c); | |
|
128
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2996 else if(mode & H_DEBLOCK) |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2997 { |
| 787 | 2998 if( RENAME(isVertDC)(tempBlock1, 16, &c)) |
|
128
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
2999 { |
| 787 | 3000 if(RENAME(isVertMinMaxOk)(tempBlock1, 16, &c)) |
| 3001 RENAME(doVertLowPass)(tempBlock1, 16, &c); | |
|
128
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
3002 } |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
3003 else |
| 787 | 3004 RENAME(doVertDefFilter)(tempBlock1, 16, &c); |
|
128
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
3005 } |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
3006 |
| 169 | 3007 RENAME(transpose2)(dstBlock-4, dstStride, tempBlock1 + 4*16); |
|
128
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
3008 |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
3009 #else |
|
115
4514b8e7f0f1
more logic behavior if the altenative deblock filters are used (turning a alt filter on without turning the deblock filter on uses the alt filter instead of using no filter now)
michael
parents:
113
diff
changeset
|
3010 if(mode & H_X1_FILTER) |
|
4514b8e7f0f1
more logic behavior if the altenative deblock filters are used (turning a alt filter on without turning the deblock filter on uses the alt filter instead of using no filter now)
michael
parents:
113
diff
changeset
|
3011 horizX1Filter(dstBlock-4, stride, QP); |
|
4514b8e7f0f1
more logic behavior if the altenative deblock filters are used (turning a alt filter on without turning the deblock filter on uses the alt filter instead of using no filter now)
michael
parents:
113
diff
changeset
|
3012 else if(mode & H_DEBLOCK) |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3013 { |
| 787 | 3014 if( isHorizDC(dstBlock-4, stride, &c)) |
| 96 | 3015 { |
|
128
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
3016 if(isHorizMinMaxOk(dstBlock-4, stride, QP)) |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
3017 doHorizLowPass(dstBlock-4, stride, QP); |
| 96 | 3018 } |
|
115
4514b8e7f0f1
more logic behavior if the altenative deblock filters are used (turning a alt filter on without turning the deblock filter on uses the alt filter instead of using no filter now)
michael
parents:
113
diff
changeset
|
3019 else |
|
128
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
3020 doHorizDefFilter(dstBlock-4, stride, QP); |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3021 } |
|
128
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
3022 #endif |
| 130 | 3023 if(mode & DERING) |
| 3024 { | |
| 3025 //FIXME filter first line | |
| 787 | 3026 if(y>0) RENAME(dering)(dstBlock - stride - 8, stride, &c); |
| 130 | 3027 } |
| 156 | 3028 |
| 3029 if(mode & TEMP_NOISE_FILTER) | |
| 3030 { | |
| 169 | 3031 RENAME(tempNoiseReducer)(dstBlock-8, stride, |
| 787 | 3032 c.tempBlured[isColor] + y*dstStride + x, |
| 3033 c.tempBluredPast[isColor] + (y>>3)*256 + (x>>3), | |
| 3034 c.ppMode.maxTmpNoise); | |
| 156 | 3035 } |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3036 } |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3037 |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3038 dstBlock+=8; |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3039 srcBlock+=8; |
|
128
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
3040 |
|
129
be35346e27c1
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
128
diff
changeset
|
3041 #ifdef HAVE_MMX |
|
128
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
3042 tmpXchg= tempBlock1; |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
3043 tempBlock1= tempBlock2; |
|
e5266b8e79be
much better horizontal filters (transpose & use the vertical ones) :)
michael
parents:
126
diff
changeset
|
3044 tempBlock2 = tmpXchg; |
|
129
be35346e27c1
fixed difference with -vo md5 between doVertDefFilter() C and MMX / MMX2 versions
michael
parents:
128
diff
changeset
|
3045 #endif |
| 111 | 3046 } |
| 3047 | |
| 156 | 3048 if(mode & DERING) |
| 3049 { | |
| 787 | 3050 if(y > 0) RENAME(dering)(dstBlock - dstStride - 8, dstStride, &c); |
| 156 | 3051 } |
| 3052 | |
| 3053 if((mode & TEMP_NOISE_FILTER)) | |
| 3054 { | |
| 169 | 3055 RENAME(tempNoiseReducer)(dstBlock-8, dstStride, |
| 787 | 3056 c.tempBlured[isColor] + y*dstStride + x, |
| 3057 c.tempBluredPast[isColor] + (y>>3)*256 + (x>>3), | |
| 3058 c.ppMode.maxTmpNoise); | |
| 156 | 3059 } |
| 3060 | |
| 142 | 3061 /* did we use a tmp buffer for the last lines*/ |
| 112 | 3062 if(y+15 >= height) |
| 111 | 3063 { |
| 3064 uint8_t *dstBlock= &(dst[y*dstStride]); | |
| 941 | 3065 if(width==dstStride) |
| 3066 memcpy(dstBlock, tempDst + dstStride, dstStride*(height-y)); | |
| 3067 else | |
| 3068 { | |
| 944 | 3069 int i; |
| 941 | 3070 for(i=0; i<height-y; i++) |
| 3071 { | |
| 3072 memcpy(dstBlock + i*dstStride, tempDst + (i+1)*dstStride, width); | |
| 3073 } | |
| 3074 } | |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3075 } |
| 163 | 3076 /* |
| 3077 for(x=0; x<width; x+=32) | |
| 3078 { | |
| 164 | 3079 volatile int i; |
| 163 | 3080 i+= + dstBlock[x + 7*dstStride] + dstBlock[x + 8*dstStride] |
| 3081 + dstBlock[x + 9*dstStride] + dstBlock[x +10*dstStride] | |
| 164 | 3082 + dstBlock[x +11*dstStride] + dstBlock[x +12*dstStride]; |
| 3083 // + dstBlock[x +13*dstStride] | |
| 3084 // + dstBlock[x +14*dstStride] + dstBlock[x +15*dstStride]; | |
| 3085 }*/ | |
| 3086 } | |
| 96 | 3087 #ifdef HAVE_3DNOW |
| 3088 asm volatile("femms"); | |
| 3089 #elif defined (HAVE_MMX) | |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3090 asm volatile("emms"); |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3091 #endif |
|
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3092 |
| 163 | 3093 #ifdef DEBUG_BRIGHTNESS |
| 3094 if(!isColor) | |
| 3095 { | |
| 3096 int max=1; | |
| 3097 int i; | |
| 3098 for(i=0; i<256; i++) | |
| 3099 if(yHistogram[i] > max) max=yHistogram[i]; | |
| 3100 | |
| 3101 for(i=1; i<256; i++) | |
| 3102 { | |
| 3103 int x; | |
| 3104 int start=yHistogram[i-1]/(max/256+1); | |
| 3105 int end=yHistogram[i]/(max/256+1); | |
| 3106 int inc= end > start ? 1 : -1; | |
| 3107 for(x=start; x!=end+inc; x+=inc) | |
| 3108 dst[ i*dstStride + x]+=128; | |
| 3109 } | |
| 3110 | |
| 3111 for(i=0; i<100; i+=2) | |
| 3112 { | |
| 3113 dst[ (white)*dstStride + i]+=128; | |
| 3114 dst[ (black)*dstStride + i]+=128; | |
| 3115 } | |
| 3116 | |
| 3117 } | |
| 3118 #endif | |
| 3119 | |
| 787 | 3120 *c2= c; //copy local context back |
| 3121 | |
|
95
8bce253b537c
new postprocess code by Michael Niedermayer (michaelni@gmx.at)
arpi
parents:
diff
changeset
|
3122 } |
