annotate postprocess_template.c @ 92:a8ed701a0873 libpostproc

simplify ALIGN_MASK definition
author mru
date Mon, 17 Mar 2008 23:44:46 +0000
parents 8879eafb9431
children c24dab9bca80
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1 /*
22
da3bfee1fa67 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 0
diff changeset
2 * Copyright (C) 2001-2002 Michael Niedermayer (michaelni@gmx.at)
da3bfee1fa67 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 0
diff changeset
3 *
da3bfee1fa67 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 0
diff changeset
4 * This file is part of FFmpeg.
da3bfee1fa67 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 0
diff changeset
5 *
da3bfee1fa67 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 0
diff changeset
6 * FFmpeg is free software; you can redistribute it and/or modify
da3bfee1fa67 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 0
diff changeset
7 * it under the terms of the GNU General Public License as published by
da3bfee1fa67 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 0
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
da3bfee1fa67 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 0
diff changeset
9 * (at your option) any later version.
da3bfee1fa67 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 0
diff changeset
10 *
da3bfee1fa67 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 0
diff changeset
11 * FFmpeg is distributed in the hope that it will be useful,
da3bfee1fa67 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 0
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
da3bfee1fa67 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 0
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
da3bfee1fa67 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 0
diff changeset
14 * GNU General Public License for more details.
da3bfee1fa67 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 0
diff changeset
15 *
da3bfee1fa67 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 0
diff changeset
16 * You should have received a copy of the GNU General Public License
da3bfee1fa67 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 0
diff changeset
17 * along with FFmpeg; if not, write to the Free Software
da3bfee1fa67 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 0
diff changeset
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
55
95d9409452f2 license header consistency cosmetics
diego
parents: 49
diff changeset
19 */
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
20
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
21 /**
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
22 * @file postprocess_template.c
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
23 * mmx/mmx2/3dnow postprocess code.
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
24 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
25
91
8879eafb9431 get register names from x86_cpu.h
mru
parents: 90
diff changeset
26 #include "x86_cpu.h"
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
27
92
a8ed701a0873 simplify ALIGN_MASK definition
mru
parents: 91
diff changeset
28 #define ALIGN_MASK "$-8"
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
29
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
30 #undef PAVGB
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
31 #undef PMINUB
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
32 #undef PMAXUB
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
33
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
34 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
35 #define REAL_PAVGB(a,b) "pavgb " #a ", " #b " \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
36 #elif defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
37 #define REAL_PAVGB(a,b) "pavgusb " #a ", " #b " \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
38 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
39 #define PAVGB(a,b) REAL_PAVGB(a,b)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
40
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
41 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
42 #define PMINUB(a,b,t) "pminub " #a ", " #b " \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
43 #elif defined (HAVE_MMX)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
44 #define PMINUB(b,a,t) \
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
45 "movq " #a ", " #t " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
46 "psubusb " #b ", " #t " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
47 "psubb " #t ", " #a " \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
48 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
49
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
50 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
51 #define PMAXUB(a,b) "pmaxub " #a ", " #b " \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
52 #elif defined (HAVE_MMX)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
53 #define PMAXUB(a,b) \
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
54 "psubusb " #a ", " #b " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
55 "paddb " #a ", " #b " \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
56 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
57
48
72675332ed82 misc spelling fixes
diego
parents: 45
diff changeset
58 //FIXME? |255-0| = 1 (should not be a problem ...)
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
59 #ifdef HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
60 /**
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
61 * Check if the middle 8x8 Block in the given 8x16 block is flat
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
62 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
63 static inline int RENAME(vertClassify)(uint8_t src[], int stride, PPContext *c){
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
64 int numEq= 0, dcOk;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
65 src+= stride*4; // src points to begin of the 8x8 Block
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
66 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
67 "movq %0, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
68 "movq %1, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
69 : : "m" (c->mmxDcOffset[c->nonBQP]), "m" (c->mmxDcThreshold[c->nonBQP])
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
70 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
71
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
72 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
73 "lea (%2, %3), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
74 // 0 1 2 3 4 5 6 7 8 9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
75 // %1 eax eax+%2 eax+2%2 %1+4%2 ecx ecx+%2 ecx+2%2 %1+8%2 ecx+4%2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
76
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
77 "movq (%2), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
78 "movq (%%"REG_a"), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
79 "movq %%mm0, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
80 "movq %%mm0, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
81 PMAXUB(%%mm1, %%mm4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
82 PMINUB(%%mm1, %%mm3, %%mm5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
83 "psubb %%mm1, %%mm0 \n\t" // mm0 = differnece
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
84 "paddb %%mm7, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
85 "pcmpgtb %%mm6, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
86
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
87 "movq (%%"REG_a",%3), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
88 PMAXUB(%%mm2, %%mm4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
89 PMINUB(%%mm2, %%mm3, %%mm5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
90 "psubb %%mm2, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
91 "paddb %%mm7, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
92 "pcmpgtb %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
93 "paddb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
94
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
95 "movq (%%"REG_a", %3, 2), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
96 PMAXUB(%%mm1, %%mm4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
97 PMINUB(%%mm1, %%mm3, %%mm5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
98 "psubb %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
99 "paddb %%mm7, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
100 "pcmpgtb %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
101 "paddb %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
102
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
103 "lea (%%"REG_a", %3, 4), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
104
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
105 "movq (%2, %3, 4), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
106 PMAXUB(%%mm2, %%mm4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
107 PMINUB(%%mm2, %%mm3, %%mm5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
108 "psubb %%mm2, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
109 "paddb %%mm7, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
110 "pcmpgtb %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
111 "paddb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
112
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
113 "movq (%%"REG_a"), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
114 PMAXUB(%%mm1, %%mm4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
115 PMINUB(%%mm1, %%mm3, %%mm5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
116 "psubb %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
117 "paddb %%mm7, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
118 "pcmpgtb %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
119 "paddb %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
120
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
121 "movq (%%"REG_a", %3), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
122 PMAXUB(%%mm2, %%mm4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
123 PMINUB(%%mm2, %%mm3, %%mm5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
124 "psubb %%mm2, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
125 "paddb %%mm7, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
126 "pcmpgtb %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
127 "paddb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
128
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
129 "movq (%%"REG_a", %3, 2), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
130 PMAXUB(%%mm1, %%mm4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
131 PMINUB(%%mm1, %%mm3, %%mm5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
132 "psubb %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
133 "paddb %%mm7, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
134 "pcmpgtb %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
135 "paddb %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
136 "psubusb %%mm3, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
137
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
138 " \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
139 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
140 "pxor %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
141 "psadbw %%mm7, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
142 #else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
143 "movq %%mm0, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
144 "psrlw $8, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
145 "paddb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
146 "movq %%mm0, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
147 "psrlq $16, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
148 "paddb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
149 "movq %%mm0, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
150 "psrlq $32, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
151 "paddb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
152 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
153 "movq %4, %%mm7 \n\t" // QP,..., QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
154 "paddusb %%mm7, %%mm7 \n\t" // 2QP ... 2QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
155 "psubusb %%mm7, %%mm4 \n\t" // Diff <= 2QP -> 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
156 "packssdw %%mm4, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
157 "movd %%mm0, %0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
158 "movd %%mm4, %1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
159
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
160 : "=r" (numEq), "=r" (dcOk)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
161 : "r" (src), "r" ((long)stride), "m" (c->pQPb)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
162 : "%"REG_a
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
163 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
164
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
165 numEq= (-numEq) &0xFF;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
166 if(numEq > c->ppMode.flatnessThreshold){
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
167 if(dcOk) return 0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
168 else return 1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
169 }else{
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
170 return 2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
171 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
172 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
173 #endif //HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
174
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
175 /**
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
176 * Do a vertical low pass filter on the 8x16 block (only write to the 8x8 block in the middle)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
177 * using the 9-Tap Filter (1,1,2,2,4,2,2,1,1)/16
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
178 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
179 #ifndef HAVE_ALTIVEC
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
180 static inline void RENAME(doVertLowPass)(uint8_t *src, int stride, PPContext *c)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
181 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
182 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
183 src+= stride*3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
184 asm volatile( //"movv %0 %1 %2\n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
185 "movq %2, %%mm0 \n\t" // QP,..., QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
186 "pxor %%mm4, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
187
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
188 "movq (%0), %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
189 "movq (%0, %1), %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
190 "movq %%mm5, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
191 "movq %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
192 "psubusb %%mm6, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
193 "psubusb %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
194 "por %%mm5, %%mm2 \n\t" // ABS Diff of lines
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
195 "psubusb %%mm0, %%mm2 \n\t" // diff <= QP -> 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
196 "pcmpeqb %%mm4, %%mm2 \n\t" // diff <= QP -> FF
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
197
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
198 "pand %%mm2, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
199 "pandn %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
200 "por %%mm2, %%mm6 \n\t"// First Line to Filter
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
201
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
202 "movq (%0, %1, 8), %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
203 "lea (%0, %1, 4), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
204 "lea (%0, %1, 8), %%"REG_c" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
205 "sub %1, %%"REG_c" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
206 "add %1, %0 \n\t" // %0 points to line 1 not 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
207 "movq (%0, %1, 8), %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
208 "movq %%mm5, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
209 "movq %%mm7, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
210 "psubusb %%mm7, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
211 "psubusb %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
212 "por %%mm5, %%mm2 \n\t" // ABS Diff of lines
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
213 "psubusb %%mm0, %%mm2 \n\t" // diff <= QP -> 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
214 "pcmpeqb %%mm4, %%mm2 \n\t" // diff <= QP -> FF
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
215
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
216 "pand %%mm2, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
217 "pandn %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
218 "por %%mm2, %%mm7 \n\t" // First Line to Filter
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
219
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
220
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
221 // 1 2 3 4 5 6 7 8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
222 // %0 %0+%1 %0+2%1 eax %0+4%1 eax+2%1 ecx eax+4%1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
223 // 6 4 2 2 1 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
224 // 6 4 4 2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
225 // 6 8 2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
226
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
227 "movq (%0, %1), %%mm0 \n\t" // 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
228 "movq %%mm0, %%mm1 \n\t" // 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
229 PAVGB(%%mm6, %%mm0) //1 1 /2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
230 PAVGB(%%mm6, %%mm0) //3 1 /4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
231
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
232 "movq (%0, %1, 4), %%mm2 \n\t" // 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
233 "movq %%mm2, %%mm5 \n\t" // 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
234 PAVGB((%%REGa), %%mm2) // 11 /2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
235 PAVGB((%0, %1, 2), %%mm2) // 211 /4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
236 "movq %%mm2, %%mm3 \n\t" // 211 /4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
237 "movq (%0), %%mm4 \n\t" // 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
238 PAVGB(%%mm4, %%mm3) // 4 211 /8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
239 PAVGB(%%mm0, %%mm3) //642211 /16
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
240 "movq %%mm3, (%0) \n\t" // X
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
241 // mm1=2 mm2=3(211) mm4=1 mm5=5 mm6=0 mm7=9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
242 "movq %%mm1, %%mm0 \n\t" // 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
243 PAVGB(%%mm6, %%mm0) //1 1 /2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
244 "movq %%mm4, %%mm3 \n\t" // 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
245 PAVGB((%0,%1,2), %%mm3) // 1 1 /2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
246 PAVGB((%%REGa,%1,2), %%mm5) // 11 /2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
247 PAVGB((%%REGa), %%mm5) // 211 /4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
248 PAVGB(%%mm5, %%mm3) // 2 2211 /8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
249 PAVGB(%%mm0, %%mm3) //4242211 /16
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
250 "movq %%mm3, (%0,%1) \n\t" // X
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
251 // mm1=2 mm2=3(211) mm4=1 mm5=4(211) mm6=0 mm7=9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
252 PAVGB(%%mm4, %%mm6) //11 /2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
253 "movq (%%"REG_c"), %%mm0 \n\t" // 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
254 PAVGB((%%REGa, %1, 2), %%mm0) // 11/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
255 "movq %%mm0, %%mm3 \n\t" // 11/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
256 PAVGB(%%mm1, %%mm0) // 2 11/4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
257 PAVGB(%%mm6, %%mm0) //222 11/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
258 PAVGB(%%mm2, %%mm0) //22242211/16
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
259 "movq (%0, %1, 2), %%mm2 \n\t" // 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
260 "movq %%mm0, (%0, %1, 2) \n\t" // X
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
261 // mm1=2 mm2=3 mm3=6(11) mm4=1 mm5=4(211) mm6=0(11) mm7=9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
262 "movq (%%"REG_a", %1, 4), %%mm0 \n\t" // 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
263 PAVGB((%%REGc), %%mm0) // 11 /2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
264 PAVGB(%%mm0, %%mm6) //11 11 /4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
265 PAVGB(%%mm1, %%mm4) // 11 /2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
266 PAVGB(%%mm2, %%mm1) // 11 /2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
267 PAVGB(%%mm1, %%mm6) //1122 11 /8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
268 PAVGB(%%mm5, %%mm6) //112242211 /16
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
269 "movq (%%"REG_a"), %%mm5 \n\t" // 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
270 "movq %%mm6, (%%"REG_a") \n\t" // X
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
271 // mm0=7(11) mm1=2(11) mm2=3 mm3=6(11) mm4=1(11) mm5=4 mm7=9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
272 "movq (%%"REG_a", %1, 4), %%mm6 \n\t" // 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
273 PAVGB(%%mm7, %%mm6) // 11 /2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
274 PAVGB(%%mm4, %%mm6) // 11 11 /4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
275 PAVGB(%%mm3, %%mm6) // 11 2211 /8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
276 PAVGB(%%mm5, %%mm2) // 11 /2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
277 "movq (%0, %1, 4), %%mm4 \n\t" // 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
278 PAVGB(%%mm4, %%mm2) // 112 /4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
279 PAVGB(%%mm2, %%mm6) // 112242211 /16
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
280 "movq %%mm6, (%0, %1, 4) \n\t" // X
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
281 // mm0=7(11) mm1=2(11) mm2=3(112) mm3=6(11) mm4=5 mm5=4 mm7=9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
282 PAVGB(%%mm7, %%mm1) // 11 2 /4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
283 PAVGB(%%mm4, %%mm5) // 11 /2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
284 PAVGB(%%mm5, %%mm0) // 11 11 /4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
285 "movq (%%"REG_a", %1, 2), %%mm6 \n\t" // 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
286 PAVGB(%%mm6, %%mm1) // 11 4 2 /8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
287 PAVGB(%%mm0, %%mm1) // 11224222 /16
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
288 "movq %%mm1, (%%"REG_a", %1, 2) \n\t" // X
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
289 // mm2=3(112) mm3=6(11) mm4=5 mm5=4(11) mm6=6 mm7=9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
290 PAVGB((%%REGc), %%mm2) // 112 4 /8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
291 "movq (%%"REG_a", %1, 4), %%mm0 \n\t" // 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
292 PAVGB(%%mm0, %%mm6) // 1 1 /2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
293 PAVGB(%%mm7, %%mm6) // 1 12 /4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
294 PAVGB(%%mm2, %%mm6) // 1122424 /4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
295 "movq %%mm6, (%%"REG_c") \n\t" // X
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
296 // mm0=8 mm3=6(11) mm4=5 mm5=4(11) mm7=9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
297 PAVGB(%%mm7, %%mm5) // 11 2 /4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
298 PAVGB(%%mm7, %%mm5) // 11 6 /8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
299
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
300 PAVGB(%%mm3, %%mm0) // 112 /4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
301 PAVGB(%%mm0, %%mm5) // 112246 /16
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
302 "movq %%mm5, (%%"REG_a", %1, 4) \n\t" // X
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
303 "sub %1, %0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
304
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
305 :
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
306 : "r" (src), "r" ((long)stride), "m" (c->pQPb)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
307 : "%"REG_a, "%"REG_c
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
308 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
309 #else //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
310 const int l1= stride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
311 const int l2= stride + l1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
312 const int l3= stride + l2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
313 const int l4= stride + l3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
314 const int l5= stride + l4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
315 const int l6= stride + l5;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
316 const int l7= stride + l6;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
317 const int l8= stride + l7;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
318 const int l9= stride + l8;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
319 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
320 src+= stride*3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
321 for(x=0; x<BLOCK_SIZE; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
322 {
32
cb746db3fd32 Rename ABS macro to FFABS.
diego
parents: 31
diff changeset
323 const int first= FFABS(src[0] - src[l1]) < c->QP ? src[0] : src[l1];
cb746db3fd32 Rename ABS macro to FFABS.
diego
parents: 31
diff changeset
324 const int last= FFABS(src[l8] - src[l9]) < c->QP ? src[l9] : src[l8];
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
325
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
326 int sums[10];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
327 sums[0] = 4*first + src[l1] + src[l2] + src[l3] + 4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
328 sums[1] = sums[0] - first + src[l4];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
329 sums[2] = sums[1] - first + src[l5];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
330 sums[3] = sums[2] - first + src[l6];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
331 sums[4] = sums[3] - first + src[l7];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
332 sums[5] = sums[4] - src[l1] + src[l8];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
333 sums[6] = sums[5] - src[l2] + last;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
334 sums[7] = sums[6] - src[l3] + last;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
335 sums[8] = sums[7] - src[l4] + last;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
336 sums[9] = sums[8] - src[l5] + last;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
337
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
338 src[l1]= (sums[0] + sums[2] + 2*src[l1])>>4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
339 src[l2]= (sums[1] + sums[3] + 2*src[l2])>>4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
340 src[l3]= (sums[2] + sums[4] + 2*src[l3])>>4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
341 src[l4]= (sums[3] + sums[5] + 2*src[l4])>>4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
342 src[l5]= (sums[4] + sums[6] + 2*src[l5])>>4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
343 src[l6]= (sums[5] + sums[7] + 2*src[l6])>>4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
344 src[l7]= (sums[6] + sums[8] + 2*src[l7])>>4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
345 src[l8]= (sums[7] + sums[9] + 2*src[l8])>>4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
346
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
347 src++;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
348 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
349 #endif //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
350 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
351 #endif //HAVE_ALTIVEC
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
352
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
353 #if 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
354 /**
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
355 * Experimental implementation of the filter (Algorithm 1) described in a paper from Ramkishor & Karandikar
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
356 * values are correctly clipped (MMX2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
357 * values are wraparound (C)
49
cdfe8fc50090 misc typo fixes
diego
parents: 48
diff changeset
358 * Conclusion: It is fast, but introduces ugly horizontal patterns
cdfe8fc50090 misc typo fixes
diego
parents: 48
diff changeset
359 * if there is a continuous gradient.
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
360 0 8 16 24
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
361 x = 8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
362 x/2 = 4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
363 x/8 = 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
364 1 12 12 23
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
365 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
366 static inline void RENAME(vertRK1Filter)(uint8_t *src, int stride, int QP)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
367 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
368 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
369 src+= stride*3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
370 // FIXME rounding
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
371 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
372 "pxor %%mm7, %%mm7 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
373 "movq "MANGLE(b80)", %%mm6 \n\t" // MIN_SIGNED_BYTE
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
374 "leal (%0, %1), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
375 "leal (%%"REG_a", %1, 4), %%"REG_c" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
376 // 0 1 2 3 4 5 6 7 8 9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
377 // %0 eax eax+%1 eax+2%1 %0+4%1 ecx ecx+%1 ecx+2%1 %0+8%1 ecx+4%1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
378 "movq "MANGLE(pQPb)", %%mm0 \n\t" // QP,..., QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
379 "movq %%mm0, %%mm1 \n\t" // QP,..., QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
380 "paddusb "MANGLE(b02)", %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
381 "psrlw $2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
382 "pand "MANGLE(b3F)", %%mm0 \n\t" // QP/4,..., QP/4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
383 "paddusb %%mm1, %%mm0 \n\t" // QP*1.25 ...
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
384 "movq (%0, %1, 4), %%mm2 \n\t" // line 4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
385 "movq (%%"REG_c"), %%mm3 \n\t" // line 5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
386 "movq %%mm2, %%mm4 \n\t" // line 4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
387 "pcmpeqb %%mm5, %%mm5 \n\t" // -1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
388 "pxor %%mm2, %%mm5 \n\t" // -line 4 - 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
389 PAVGB(%%mm3, %%mm5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
390 "paddb %%mm6, %%mm5 \n\t" // (l5-l4)/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
391 "psubusb %%mm3, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
392 "psubusb %%mm2, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
393 "por %%mm3, %%mm4 \n\t" // |l4 - l5|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
394 "psubusb %%mm0, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
395 "pcmpeqb %%mm7, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
396 "pand %%mm4, %%mm5 \n\t" // d/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
397
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
398 // "paddb %%mm6, %%mm2 \n\t" // line 4 + 0x80
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
399 "paddb %%mm5, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
400 // "psubb %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
401 "movq %%mm2, (%0,%1, 4) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
402
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
403 "movq (%%"REG_c"), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
404 // "paddb %%mm6, %%mm2 \n\t" // line 5 + 0x80
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
405 "psubb %%mm5, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
406 // "psubb %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
407 "movq %%mm2, (%%"REG_c") \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
408
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
409 "paddb %%mm6, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
410 "psrlw $2, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
411 "pand "MANGLE(b3F)", %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
412 "psubb "MANGLE(b20)", %%mm5 \n\t" // (l5-l4)/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
413
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
414 "movq (%%"REG_a", %1, 2), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
415 "paddb %%mm6, %%mm2 \n\t" // line 3 + 0x80
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
416 "paddsb %%mm5, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
417 "psubb %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
418 "movq %%mm2, (%%"REG_a", %1, 2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
419
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
420 "movq (%%"REG_c", %1), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
421 "paddb %%mm6, %%mm2 \n\t" // line 6 + 0x80
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
422 "psubsb %%mm5, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
423 "psubb %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
424 "movq %%mm2, (%%"REG_c", %1) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
425
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
426 :
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
427 : "r" (src), "r" ((long)stride)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
428 : "%"REG_a, "%"REG_c
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
429 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
430 #else //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
431 const int l1= stride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
432 const int l2= stride + l1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
433 const int l3= stride + l2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
434 const int l4= stride + l3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
435 const int l5= stride + l4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
436 const int l6= stride + l5;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
437 // const int l7= stride + l6;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
438 // const int l8= stride + l7;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
439 // const int l9= stride + l8;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
440 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
441 const int QP15= QP + (QP>>2);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
442 src+= stride*3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
443 for(x=0; x<BLOCK_SIZE; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
444 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
445 const int v = (src[x+l5] - src[x+l4]);
32
cb746db3fd32 Rename ABS macro to FFABS.
diego
parents: 31
diff changeset
446 if(FFABS(v) < QP15)
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
447 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
448 src[x+l3] +=v>>3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
449 src[x+l4] +=v>>1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
450 src[x+l5] -=v>>1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
451 src[x+l6] -=v>>3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
452
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
453 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
454 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
455
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
456 #endif //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
457 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
458 #endif //0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
459
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
460 /**
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
461 * Experimental Filter 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
462 * will not damage linear gradients
90
8e738e0a16f5 typo fixes
diego
parents: 78
diff changeset
463 * Flat blocks should look like they were passed through the (1,1,2,2,4,2,2,1,1) 9-Tap filter
48
72675332ed82 misc spelling fixes
diego
parents: 45
diff changeset
464 * can only smooth blocks at the expected locations (it cannot smooth them if they did move)
72675332ed82 misc spelling fixes
diego
parents: 45
diff changeset
465 * MMX2 version does correct clipping C version does not
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
466 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
467 static inline void RENAME(vertX1Filter)(uint8_t *src, int stride, PPContext *co)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
468 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
469 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
470 src+= stride*3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
471
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
472 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
473 "pxor %%mm7, %%mm7 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
474 "lea (%0, %1), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
475 "lea (%%"REG_a", %1, 4), %%"REG_c" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
476 // 0 1 2 3 4 5 6 7 8 9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
477 // %0 eax eax+%1 eax+2%1 %0+4%1 ecx ecx+%1 ecx+2%1 %0+8%1 ecx+4%1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
478 "movq (%%"REG_a", %1, 2), %%mm0 \n\t" // line 3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
479 "movq (%0, %1, 4), %%mm1 \n\t" // line 4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
480 "movq %%mm1, %%mm2 \n\t" // line 4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
481 "psubusb %%mm0, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
482 "psubusb %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
483 "por %%mm1, %%mm0 \n\t" // |l2 - l3|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
484 "movq (%%"REG_c"), %%mm3 \n\t" // line 5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
485 "movq (%%"REG_c", %1), %%mm4 \n\t" // line 6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
486 "movq %%mm3, %%mm5 \n\t" // line 5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
487 "psubusb %%mm4, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
488 "psubusb %%mm5, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
489 "por %%mm4, %%mm3 \n\t" // |l5 - l6|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
490 PAVGB(%%mm3, %%mm0) // (|l2 - l3| + |l5 - l6|)/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
491 "movq %%mm2, %%mm1 \n\t" // line 4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
492 "psubusb %%mm5, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
493 "movq %%mm2, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
494 "pcmpeqb %%mm7, %%mm2 \n\t" // (l4 - l5) <= 0 ? -1 : 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
495 "psubusb %%mm1, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
496 "por %%mm5, %%mm4 \n\t" // |l4 - l5|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
497 "psubusb %%mm0, %%mm4 \n\t" //d = MAX(0, |l4-l5| - (|l2-l3| + |l5-l6|)/2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
498 "movq %%mm4, %%mm3 \n\t" // d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
499 "movq %2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
500 "paddusb %%mm0, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
501 "psubusb %%mm0, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
502 "pcmpeqb %%mm7, %%mm4 \n\t" // d <= QP ? -1 : 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
503 "psubusb "MANGLE(b01)", %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
504 "pand %%mm4, %%mm3 \n\t" // d <= QP ? d : 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
505
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
506 PAVGB(%%mm7, %%mm3) // d/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
507 "movq %%mm3, %%mm1 \n\t" // d/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
508 PAVGB(%%mm7, %%mm3) // d/4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
509 PAVGB(%%mm1, %%mm3) // 3*d/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
510
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
511 "movq (%0, %1, 4), %%mm0 \n\t" // line 4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
512 "pxor %%mm2, %%mm0 \n\t" //(l4 - l5) <= 0 ? -l4-1 : l4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
513 "psubusb %%mm3, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
514 "pxor %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
515 "movq %%mm0, (%0, %1, 4) \n\t" // line 4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
516
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
517 "movq (%%"REG_c"), %%mm0 \n\t" // line 5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
518 "pxor %%mm2, %%mm0 \n\t" //(l4 - l5) <= 0 ? -l5-1 : l5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
519 "paddusb %%mm3, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
520 "pxor %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
521 "movq %%mm0, (%%"REG_c") \n\t" // line 5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
522
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
523 PAVGB(%%mm7, %%mm1) // d/4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
524
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
525 "movq (%%"REG_a", %1, 2), %%mm0 \n\t" // line 3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
526 "pxor %%mm2, %%mm0 \n\t" //(l4 - l5) <= 0 ? -l4-1 : l4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
527 "psubusb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
528 "pxor %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
529 "movq %%mm0, (%%"REG_a", %1, 2) \n\t" // line 3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
530
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
531 "movq (%%"REG_c", %1), %%mm0 \n\t" // line 6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
532 "pxor %%mm2, %%mm0 \n\t" //(l4 - l5) <= 0 ? -l5-1 : l5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
533 "paddusb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
534 "pxor %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
535 "movq %%mm0, (%%"REG_c", %1) \n\t" // line 6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
536
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
537 PAVGB(%%mm7, %%mm1) // d/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
538
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
539 "movq (%%"REG_a", %1), %%mm0 \n\t" // line 2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
540 "pxor %%mm2, %%mm0 \n\t" //(l4 - l5) <= 0 ? -l2-1 : l2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
541 "psubusb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
542 "pxor %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
543 "movq %%mm0, (%%"REG_a", %1) \n\t" // line 2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
544
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
545 "movq (%%"REG_c", %1, 2), %%mm0 \n\t" // line 7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
546 "pxor %%mm2, %%mm0 \n\t" //(l4 - l5) <= 0 ? -l7-1 : l7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
547 "paddusb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
548 "pxor %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
549 "movq %%mm0, (%%"REG_c", %1, 2) \n\t" // line 7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
550
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
551 :
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
552 : "r" (src), "r" ((long)stride), "m" (co->pQPb)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
553 : "%"REG_a, "%"REG_c
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
554 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
555 #else //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
556
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
557 const int l1= stride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
558 const int l2= stride + l1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
559 const int l3= stride + l2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
560 const int l4= stride + l3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
561 const int l5= stride + l4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
562 const int l6= stride + l5;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
563 const int l7= stride + l6;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
564 // const int l8= stride + l7;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
565 // const int l9= stride + l8;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
566 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
567
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
568 src+= stride*3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
569 for(x=0; x<BLOCK_SIZE; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
570 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
571 int a= src[l3] - src[l4];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
572 int b= src[l4] - src[l5];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
573 int c= src[l5] - src[l6];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
574
32
cb746db3fd32 Rename ABS macro to FFABS.
diego
parents: 31
diff changeset
575 int d= FFABS(b) - ((FFABS(a) + FFABS(c))>>1);
27
c83a71c1729d Change libpostproc to use the FFMIN/FFMAX macros from libavutil.
diego
parents: 22
diff changeset
576 d= FFMAX(d, 0);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
577
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
578 if(d < co->QP*2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
579 {
31
81ad3274583c Rename SIGN macro to FFSIGN to avoid clashes with system headers.
diego
parents: 29
diff changeset
580 int v = d * FFSIGN(-b);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
581
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
582 src[l2] +=v>>3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
583 src[l3] +=v>>2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
584 src[l4] +=(3*v)>>3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
585 src[l5] -=(3*v)>>3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
586 src[l6] -=v>>2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
587 src[l7] -=v>>3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
588
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
589 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
590 src++;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
591 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
592 #endif //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
593 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
594
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
595 #ifndef HAVE_ALTIVEC
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
596 static inline void RENAME(doVertDefFilter)(uint8_t src[], int stride, PPContext *c)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
597 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
598 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
599 /*
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
600 uint8_t tmp[16];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
601 const int l1= stride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
602 const int l2= stride + l1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
603 const int l3= stride + l2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
604 const int l4= (int)tmp - (int)src - stride*3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
605 const int l5= (int)tmp - (int)src - stride*3 + 8;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
606 const int l6= stride*3 + l3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
607 const int l7= stride + l6;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
608 const int l8= stride + l7;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
609
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
610 memcpy(tmp, src+stride*7, 8);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
611 memcpy(tmp+8, src+stride*8, 8);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
612 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
613 src+= stride*4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
614 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
615
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
616 #if 0 //sligtly more accurate and slightly slower
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
617 "pxor %%mm7, %%mm7 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
618 "lea (%0, %1), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
619 "lea (%%"REG_a", %1, 4), %%"REG_c" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
620 // 0 1 2 3 4 5 6 7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
621 // %0 %0+%1 %0+2%1 eax+2%1 %0+4%1 eax+4%1 ecx+%1 ecx+2%1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
622 // %0 eax eax+%1 eax+2%1 %0+4%1 ecx ecx+%1 ecx+2%1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
623
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
624
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
625 "movq (%0, %1, 2), %%mm0 \n\t" // l2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
626 "movq (%0), %%mm1 \n\t" // l0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
627 "movq %%mm0, %%mm2 \n\t" // l2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
628 PAVGB(%%mm7, %%mm0) // ~l2/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
629 PAVGB(%%mm1, %%mm0) // ~(l2 + 2l0)/4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
630 PAVGB(%%mm2, %%mm0) // ~(5l2 + 2l0)/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
631
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
632 "movq (%%"REG_a"), %%mm1 \n\t" // l1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
633 "movq (%%"REG_a", %1, 2), %%mm3 \n\t" // l3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
634 "movq %%mm1, %%mm4 \n\t" // l1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
635 PAVGB(%%mm7, %%mm1) // ~l1/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
636 PAVGB(%%mm3, %%mm1) // ~(l1 + 2l3)/4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
637 PAVGB(%%mm4, %%mm1) // ~(5l1 + 2l3)/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
638
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
639 "movq %%mm0, %%mm4 \n\t" // ~(5l2 + 2l0)/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
640 "psubusb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
641 "psubusb %%mm4, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
642 "por %%mm0, %%mm1 \n\t" // ~|2l0 - 5l1 + 5l2 - 2l3|/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
643 // mm1= |lenergy|, mm2= l2, mm3= l3, mm7=0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
644
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
645 "movq (%0, %1, 4), %%mm0 \n\t" // l4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
646 "movq %%mm0, %%mm4 \n\t" // l4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
647 PAVGB(%%mm7, %%mm0) // ~l4/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
648 PAVGB(%%mm2, %%mm0) // ~(l4 + 2l2)/4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
649 PAVGB(%%mm4, %%mm0) // ~(5l4 + 2l2)/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
650
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
651 "movq (%%"REG_c"), %%mm2 \n\t" // l5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
652 "movq %%mm3, %%mm5 \n\t" // l3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
653 PAVGB(%%mm7, %%mm3) // ~l3/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
654 PAVGB(%%mm2, %%mm3) // ~(l3 + 2l5)/4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
655 PAVGB(%%mm5, %%mm3) // ~(5l3 + 2l5)/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
656
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
657 "movq %%mm0, %%mm6 \n\t" // ~(5l4 + 2l2)/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
658 "psubusb %%mm3, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
659 "psubusb %%mm6, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
660 "por %%mm0, %%mm3 \n\t" // ~|2l2 - 5l3 + 5l4 - 2l5|/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
661 "pcmpeqb %%mm7, %%mm0 \n\t" // SIGN(2l2 - 5l3 + 5l4 - 2l5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
662 // mm0= SIGN(menergy), mm1= |lenergy|, mm2= l5, mm3= |menergy|, mm4=l4, mm5= l3, mm7=0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
663
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
664 "movq (%%"REG_c", %1), %%mm6 \n\t" // l6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
665 "movq %%mm6, %%mm5 \n\t" // l6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
666 PAVGB(%%mm7, %%mm6) // ~l6/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
667 PAVGB(%%mm4, %%mm6) // ~(l6 + 2l4)/4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
668 PAVGB(%%mm5, %%mm6) // ~(5l6 + 2l4)/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
669
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
670 "movq (%%"REG_c", %1, 2), %%mm5 \n\t" // l7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
671 "movq %%mm2, %%mm4 \n\t" // l5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
672 PAVGB(%%mm7, %%mm2) // ~l5/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
673 PAVGB(%%mm5, %%mm2) // ~(l5 + 2l7)/4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
674 PAVGB(%%mm4, %%mm2) // ~(5l5 + 2l7)/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
675
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
676 "movq %%mm6, %%mm4 \n\t" // ~(5l6 + 2l4)/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
677 "psubusb %%mm2, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
678 "psubusb %%mm4, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
679 "por %%mm6, %%mm2 \n\t" // ~|2l4 - 5l5 + 5l6 - 2l7|/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
680 // mm0= SIGN(menergy), mm1= |lenergy|/8, mm2= |renergy|/8, mm3= |menergy|/8, mm7=0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
681
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
682
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
683 PMINUB(%%mm2, %%mm1, %%mm4) // MIN(|lenergy|,|renergy|)/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
684 "movq %2, %%mm4 \n\t" // QP //FIXME QP+1 ?
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
685 "paddusb "MANGLE(b01)", %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
686 "pcmpgtb %%mm3, %%mm4 \n\t" // |menergy|/8 < QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
687 "psubusb %%mm1, %%mm3 \n\t" // d=|menergy|/8-MIN(|lenergy|,|renergy|)/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
688 "pand %%mm4, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
689
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
690 "movq %%mm3, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
691 // "psubusb "MANGLE(b01)", %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
692 PAVGB(%%mm7, %%mm3)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
693 PAVGB(%%mm7, %%mm3)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
694 "paddusb %%mm1, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
695 // "paddusb "MANGLE(b01)", %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
696
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
697 "movq (%%"REG_a", %1, 2), %%mm6 \n\t" //l3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
698 "movq (%0, %1, 4), %%mm5 \n\t" //l4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
699 "movq (%0, %1, 4), %%mm4 \n\t" //l4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
700 "psubusb %%mm6, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
701 "psubusb %%mm4, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
702 "por %%mm6, %%mm5 \n\t" // |l3-l4|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
703 "pcmpeqb %%mm7, %%mm6 \n\t" // SIGN(l3-l4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
704 "pxor %%mm6, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
705 "pand %%mm0, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
706 PMINUB(%%mm5, %%mm3, %%mm0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
707
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
708 "psubusb "MANGLE(b01)", %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
709 PAVGB(%%mm7, %%mm3)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
710
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
711 "movq (%%"REG_a", %1, 2), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
712 "movq (%0, %1, 4), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
713 "pxor %%mm6, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
714 "pxor %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
715 "psubb %%mm3, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
716 "paddb %%mm3, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
717 "pxor %%mm6, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
718 "pxor %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
719 "movq %%mm0, (%%"REG_a", %1, 2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
720 "movq %%mm2, (%0, %1, 4) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
721 #endif //0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
722
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
723 "lea (%0, %1), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
724 "pcmpeqb %%mm6, %%mm6 \n\t" // -1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
725 // 0 1 2 3 4 5 6 7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
726 // %0 %0+%1 %0+2%1 eax+2%1 %0+4%1 eax+4%1 ecx+%1 ecx+2%1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
727 // %0 eax eax+%1 eax+2%1 %0+4%1 ecx ecx+%1 ecx+2%1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
728
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
729
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
730 "movq (%%"REG_a", %1, 2), %%mm1 \n\t" // l3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
731 "movq (%0, %1, 4), %%mm0 \n\t" // l4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
732 "pxor %%mm6, %%mm1 \n\t" // -l3-1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
733 PAVGB(%%mm1, %%mm0) // -q+128 = (l4-l3+256)/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
734 // mm1=-l3-1, mm0=128-q
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
735
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
736 "movq (%%"REG_a", %1, 4), %%mm2 \n\t" // l5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
737 "movq (%%"REG_a", %1), %%mm3 \n\t" // l2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
738 "pxor %%mm6, %%mm2 \n\t" // -l5-1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
739 "movq %%mm2, %%mm5 \n\t" // -l5-1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
740 "movq "MANGLE(b80)", %%mm4 \n\t" // 128
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
741 "lea (%%"REG_a", %1, 4), %%"REG_c" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
742 PAVGB(%%mm3, %%mm2) // (l2-l5+256)/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
743 PAVGB(%%mm0, %%mm4) // ~(l4-l3)/4 + 128
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
744 PAVGB(%%mm2, %%mm4) // ~(l2-l5)/4 +(l4-l3)/8 + 128
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
745 PAVGB(%%mm0, %%mm4) // ~(l2-l5)/8 +5(l4-l3)/16 + 128
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
746 // mm1=-l3-1, mm0=128-q, mm3=l2, mm4=menergy/16 + 128, mm5= -l5-1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
747
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
748 "movq (%%"REG_a"), %%mm2 \n\t" // l1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
749 "pxor %%mm6, %%mm2 \n\t" // -l1-1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
750 PAVGB(%%mm3, %%mm2) // (l2-l1+256)/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
751 PAVGB((%0), %%mm1) // (l0-l3+256)/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
752 "movq "MANGLE(b80)", %%mm3 \n\t" // 128
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
753 PAVGB(%%mm2, %%mm3) // ~(l2-l1)/4 + 128
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
754 PAVGB(%%mm1, %%mm3) // ~(l0-l3)/4 +(l2-l1)/8 + 128
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
755 PAVGB(%%mm2, %%mm3) // ~(l0-l3)/8 +5(l2-l1)/16 + 128
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
756 // mm0=128-q, mm3=lenergy/16 + 128, mm4= menergy/16 + 128, mm5= -l5-1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
757
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
758 PAVGB((%%REGc, %1), %%mm5) // (l6-l5+256)/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
759 "movq (%%"REG_c", %1, 2), %%mm1 \n\t" // l7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
760 "pxor %%mm6, %%mm1 \n\t" // -l7-1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
761 PAVGB((%0, %1, 4), %%mm1) // (l4-l7+256)/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
762 "movq "MANGLE(b80)", %%mm2 \n\t" // 128
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
763 PAVGB(%%mm5, %%mm2) // ~(l6-l5)/4 + 128
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
764 PAVGB(%%mm1, %%mm2) // ~(l4-l7)/4 +(l6-l5)/8 + 128
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
765 PAVGB(%%mm5, %%mm2) // ~(l4-l7)/8 +5(l6-l5)/16 + 128
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
766 // mm0=128-q, mm2=renergy/16 + 128, mm3=lenergy/16 + 128, mm4= menergy/16 + 128
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
767
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
768 "movq "MANGLE(b00)", %%mm1 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
769 "movq "MANGLE(b00)", %%mm5 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
770 "psubb %%mm2, %%mm1 \n\t" // 128 - renergy/16
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
771 "psubb %%mm3, %%mm5 \n\t" // 128 - lenergy/16
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
772 PMAXUB(%%mm1, %%mm2) // 128 + |renergy/16|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
773 PMAXUB(%%mm5, %%mm3) // 128 + |lenergy/16|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
774 PMINUB(%%mm2, %%mm3, %%mm1) // 128 + MIN(|lenergy|,|renergy|)/16
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
775
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
776 // mm0=128-q, mm3=128 + MIN(|lenergy|,|renergy|)/16, mm4= menergy/16 + 128
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
777
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
778 "movq "MANGLE(b00)", %%mm7 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
779 "movq %2, %%mm2 \n\t" // QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
780 PAVGB(%%mm6, %%mm2) // 128 + QP/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
781 "psubb %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
782
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
783 "movq %%mm4, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
784 "pcmpgtb %%mm7, %%mm1 \n\t" // SIGN(menergy)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
785 "pxor %%mm1, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
786 "psubb %%mm1, %%mm4 \n\t" // 128 + |menergy|/16
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
787 "pcmpgtb %%mm4, %%mm2 \n\t" // |menergy|/16 < QP/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
788 "psubusb %%mm3, %%mm4 \n\t" //d=|menergy|/16 - MIN(|lenergy|,|renergy|)/16
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
789 // mm0=128-q, mm1= SIGN(menergy), mm2= |menergy|/16 < QP/2, mm4= d/16
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
790
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
791 "movq %%mm4, %%mm3 \n\t" // d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
792 "psubusb "MANGLE(b01)", %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
793 PAVGB(%%mm7, %%mm4) // d/32
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
794 PAVGB(%%mm7, %%mm4) // (d + 32)/64
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
795 "paddb %%mm3, %%mm4 \n\t" // 5d/64
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
796 "pand %%mm2, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
797
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
798 "movq "MANGLE(b80)", %%mm5 \n\t" // 128
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
799 "psubb %%mm0, %%mm5 \n\t" // q
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
800 "paddsb %%mm6, %%mm5 \n\t" // fix bad rounding
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
801 "pcmpgtb %%mm5, %%mm7 \n\t" // SIGN(q)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
802 "pxor %%mm7, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
803
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
804 PMINUB(%%mm5, %%mm4, %%mm3) // MIN(|q|, 5d/64)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
805 "pxor %%mm1, %%mm7 \n\t" // SIGN(d*q)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
806
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
807 "pand %%mm7, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
808 "movq (%%"REG_a", %1, 2), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
809 "movq (%0, %1, 4), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
810 "pxor %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
811 "pxor %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
812 "paddb %%mm4, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
813 "psubb %%mm4, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
814 "pxor %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
815 "pxor %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
816 "movq %%mm0, (%%"REG_a", %1, 2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
817 "movq %%mm2, (%0, %1, 4) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
818
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
819 :
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
820 : "r" (src), "r" ((long)stride), "m" (c->pQPb)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
821 : "%"REG_a, "%"REG_c
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
822 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
823
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
824 /*
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
825 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
826 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
827 src-= stride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
828 for(x=0; x<BLOCK_SIZE; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
829 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
830 const int middleEnergy= 5*(src[l5] - src[l4]) + 2*(src[l3] - src[l6]);
32
cb746db3fd32 Rename ABS macro to FFABS.
diego
parents: 31
diff changeset
831 if(FFABS(middleEnergy)< 8*QP)
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
832 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
833 const int q=(src[l4] - src[l5])/2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
834 const int leftEnergy= 5*(src[l3] - src[l2]) + 2*(src[l1] - src[l4]);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
835 const int rightEnergy= 5*(src[l7] - src[l6]) + 2*(src[l5] - src[l8]);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
836
32
cb746db3fd32 Rename ABS macro to FFABS.
diego
parents: 31
diff changeset
837 int d= FFABS(middleEnergy) - FFMIN( FFABS(leftEnergy), FFABS(rightEnergy) );
27
c83a71c1729d Change libpostproc to use the FFMIN/FFMAX macros from libavutil.
diego
parents: 22
diff changeset
838 d= FFMAX(d, 0);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
839
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
840 d= (5*d + 32) >> 6;
31
81ad3274583c Rename SIGN macro to FFSIGN to avoid clashes with system headers.
diego
parents: 29
diff changeset
841 d*= FFSIGN(-middleEnergy);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
842
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
843 if(q>0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
844 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
845 d= d<0 ? 0 : d;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
846 d= d>q ? q : d;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
847 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
848 else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
849 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
850 d= d>0 ? 0 : d;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
851 d= d<q ? q : d;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
852 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
853
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
854 src[l4]-= d;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
855 src[l5]+= d;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
856 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
857 src++;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
858 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
859 src-=8;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
860 for(x=0; x<8; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
861 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
862 int y;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
863 for(y=4; y<6; y++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
864 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
865 int d= src[x+y*stride] - tmp[x+(y-4)*8];
32
cb746db3fd32 Rename ABS macro to FFABS.
diego
parents: 31
diff changeset
866 int ad= FFABS(d);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
867 static int max=0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
868 static int sum=0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
869 static int num=0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
870 static int bias=0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
871
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
872 if(max<ad) max=ad;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
873 sum+= ad>3 ? 1 : 0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
874 if(ad>3)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
875 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
876 src[0] = src[7] = src[stride*7] = src[(stride+1)*7]=255;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
877 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
878 if(y==4) bias+=d;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
879 num++;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
880 if(num%1000000 == 0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
881 {
29
2e855f3f4e0b printf --> av_log with some help from Oded
diego
parents: 27
diff changeset
882 av_log(c, AV_LOG_INFO, " %d %d %d %d\n", num, sum, max, bias);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
883 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
884 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
885 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
886 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
887 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
888 #elif defined (HAVE_MMX)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
889 src+= stride*4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
890 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
891 "pxor %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
892 "lea -40(%%"REG_SP"), %%"REG_c" \n\t" // make space for 4 8-byte vars
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
893 "and "ALIGN_MASK", %%"REG_c" \n\t" // align
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
894 // 0 1 2 3 4 5 6 7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
895 // %0 %0+%1 %0+2%1 eax+2%1 %0+4%1 eax+4%1 edx+%1 edx+2%1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
896 // %0 eax eax+%1 eax+2%1 %0+4%1 edx edx+%1 edx+2%1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
897
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
898 "movq (%0), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
899 "movq %%mm0, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
900 "punpcklbw %%mm7, %%mm0 \n\t" // low part of line 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
901 "punpckhbw %%mm7, %%mm1 \n\t" // high part of line 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
902
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
903 "movq (%0, %1), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
904 "lea (%0, %1, 2), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
905 "movq %%mm2, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
906 "punpcklbw %%mm7, %%mm2 \n\t" // low part of line 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
907 "punpckhbw %%mm7, %%mm3 \n\t" // high part of line 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
908
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
909 "movq (%%"REG_a"), %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
910 "movq %%mm4, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
911 "punpcklbw %%mm7, %%mm4 \n\t" // low part of line 2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
912 "punpckhbw %%mm7, %%mm5 \n\t" // high part of line 2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
913
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
914 "paddw %%mm0, %%mm0 \n\t" // 2L0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
915 "paddw %%mm1, %%mm1 \n\t" // 2H0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
916 "psubw %%mm4, %%mm2 \n\t" // L1 - L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
917 "psubw %%mm5, %%mm3 \n\t" // H1 - H2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
918 "psubw %%mm2, %%mm0 \n\t" // 2L0 - L1 + L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
919 "psubw %%mm3, %%mm1 \n\t" // 2H0 - H1 + H2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
920
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
921 "psllw $2, %%mm2 \n\t" // 4L1 - 4L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
922 "psllw $2, %%mm3 \n\t" // 4H1 - 4H2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
923 "psubw %%mm2, %%mm0 \n\t" // 2L0 - 5L1 + 5L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
924 "psubw %%mm3, %%mm1 \n\t" // 2H0 - 5H1 + 5H2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
925
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
926 "movq (%%"REG_a", %1), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
927 "movq %%mm2, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
928 "punpcklbw %%mm7, %%mm2 \n\t" // L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
929 "punpckhbw %%mm7, %%mm3 \n\t" // H3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
930
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
931 "psubw %%mm2, %%mm0 \n\t" // 2L0 - 5L1 + 5L2 - L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
932 "psubw %%mm3, %%mm1 \n\t" // 2H0 - 5H1 + 5H2 - H3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
933 "psubw %%mm2, %%mm0 \n\t" // 2L0 - 5L1 + 5L2 - 2L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
934 "psubw %%mm3, %%mm1 \n\t" // 2H0 - 5H1 + 5H2 - 2H3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
935 "movq %%mm0, (%%"REG_c") \n\t" // 2L0 - 5L1 + 5L2 - 2L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
936 "movq %%mm1, 8(%%"REG_c") \n\t" // 2H0 - 5H1 + 5H2 - 2H3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
937
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
938 "movq (%%"REG_a", %1, 2), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
939 "movq %%mm0, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
940 "punpcklbw %%mm7, %%mm0 \n\t" // L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
941 "punpckhbw %%mm7, %%mm1 \n\t" // H4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
942
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
943 "psubw %%mm0, %%mm2 \n\t" // L3 - L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
944 "psubw %%mm1, %%mm3 \n\t" // H3 - H4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
945 "movq %%mm2, 16(%%"REG_c") \n\t" // L3 - L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
946 "movq %%mm3, 24(%%"REG_c") \n\t" // H3 - H4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
947 "paddw %%mm4, %%mm4 \n\t" // 2L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
948 "paddw %%mm5, %%mm5 \n\t" // 2H2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
949 "psubw %%mm2, %%mm4 \n\t" // 2L2 - L3 + L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
950 "psubw %%mm3, %%mm5 \n\t" // 2H2 - H3 + H4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
951
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
952 "lea (%%"REG_a", %1), %0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
953 "psllw $2, %%mm2 \n\t" // 4L3 - 4L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
954 "psllw $2, %%mm3 \n\t" // 4H3 - 4H4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
955 "psubw %%mm2, %%mm4 \n\t" // 2L2 - 5L3 + 5L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
956 "psubw %%mm3, %%mm5 \n\t" // 2H2 - 5H3 + 5H4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
957 //50 opcodes so far
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
958 "movq (%0, %1, 2), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
959 "movq %%mm2, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
960 "punpcklbw %%mm7, %%mm2 \n\t" // L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
961 "punpckhbw %%mm7, %%mm3 \n\t" // H5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
962 "psubw %%mm2, %%mm4 \n\t" // 2L2 - 5L3 + 5L4 - L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
963 "psubw %%mm3, %%mm5 \n\t" // 2H2 - 5H3 + 5H4 - H5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
964 "psubw %%mm2, %%mm4 \n\t" // 2L2 - 5L3 + 5L4 - 2L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
965 "psubw %%mm3, %%mm5 \n\t" // 2H2 - 5H3 + 5H4 - 2H5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
966
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
967 "movq (%%"REG_a", %1, 4), %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
968 "punpcklbw %%mm7, %%mm6 \n\t" // L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
969 "psubw %%mm6, %%mm2 \n\t" // L5 - L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
970 "movq (%%"REG_a", %1, 4), %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
971 "punpckhbw %%mm7, %%mm6 \n\t" // H6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
972 "psubw %%mm6, %%mm3 \n\t" // H5 - H6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
973
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
974 "paddw %%mm0, %%mm0 \n\t" // 2L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
975 "paddw %%mm1, %%mm1 \n\t" // 2H4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
976 "psubw %%mm2, %%mm0 \n\t" // 2L4 - L5 + L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
977 "psubw %%mm3, %%mm1 \n\t" // 2H4 - H5 + H6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
978
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
979 "psllw $2, %%mm2 \n\t" // 4L5 - 4L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
980 "psllw $2, %%mm3 \n\t" // 4H5 - 4H6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
981 "psubw %%mm2, %%mm0 \n\t" // 2L4 - 5L5 + 5L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
982 "psubw %%mm3, %%mm1 \n\t" // 2H4 - 5H5 + 5H6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
983
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
984 "movq (%0, %1, 4), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
985 "movq %%mm2, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
986 "punpcklbw %%mm7, %%mm2 \n\t" // L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
987 "punpckhbw %%mm7, %%mm3 \n\t" // H7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
988
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
989 "paddw %%mm2, %%mm2 \n\t" // 2L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
990 "paddw %%mm3, %%mm3 \n\t" // 2H7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
991 "psubw %%mm2, %%mm0 \n\t" // 2L4 - 5L5 + 5L6 - 2L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
992 "psubw %%mm3, %%mm1 \n\t" // 2H4 - 5H5 + 5H6 - 2H7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
993
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
994 "movq (%%"REG_c"), %%mm2 \n\t" // 2L0 - 5L1 + 5L2 - 2L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
995 "movq 8(%%"REG_c"), %%mm3 \n\t" // 2H0 - 5H1 + 5H2 - 2H3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
996
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
997 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
998 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
999 "psubw %%mm0, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1000 "pmaxsw %%mm6, %%mm0 \n\t" // |2L4 - 5L5 + 5L6 - 2L7|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1001 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1002 "psubw %%mm1, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1003 "pmaxsw %%mm6, %%mm1 \n\t" // |2H4 - 5H5 + 5H6 - 2H7|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1004 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1005 "psubw %%mm2, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1006 "pmaxsw %%mm6, %%mm2 \n\t" // |2L0 - 5L1 + 5L2 - 2L3|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1007 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1008 "psubw %%mm3, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1009 "pmaxsw %%mm6, %%mm3 \n\t" // |2H0 - 5H1 + 5H2 - 2H3|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1010 #else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1011 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1012 "pcmpgtw %%mm0, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1013 "pxor %%mm6, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1014 "psubw %%mm6, %%mm0 \n\t" // |2L4 - 5L5 + 5L6 - 2L7|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1015 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1016 "pcmpgtw %%mm1, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1017 "pxor %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1018 "psubw %%mm6, %%mm1 \n\t" // |2H4 - 5H5 + 5H6 - 2H7|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1019 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1020 "pcmpgtw %%mm2, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1021 "pxor %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1022 "psubw %%mm6, %%mm2 \n\t" // |2L0 - 5L1 + 5L2 - 2L3|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1023 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1024 "pcmpgtw %%mm3, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1025 "pxor %%mm6, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1026 "psubw %%mm6, %%mm3 \n\t" // |2H0 - 5H1 + 5H2 - 2H3|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1027 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1028
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1029 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1030 "pminsw %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1031 "pminsw %%mm3, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1032 #else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1033 "movq %%mm0, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1034 "psubusw %%mm2, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1035 "psubw %%mm6, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1036 "movq %%mm1, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1037 "psubusw %%mm3, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1038 "psubw %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1039 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1040
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1041 "movd %2, %%mm2 \n\t" // QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1042 "punpcklbw %%mm7, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1043
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1044 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1045 "pcmpgtw %%mm4, %%mm6 \n\t" // sign(2L2 - 5L3 + 5L4 - 2L5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1046 "pxor %%mm6, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1047 "psubw %%mm6, %%mm4 \n\t" // |2L2 - 5L3 + 5L4 - 2L5|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1048 "pcmpgtw %%mm5, %%mm7 \n\t" // sign(2H2 - 5H3 + 5H4 - 2H5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1049 "pxor %%mm7, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1050 "psubw %%mm7, %%mm5 \n\t" // |2H2 - 5H3 + 5H4 - 2H5|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1051 // 100 opcodes
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1052 "psllw $3, %%mm2 \n\t" // 8QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1053 "movq %%mm2, %%mm3 \n\t" // 8QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1054 "pcmpgtw %%mm4, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1055 "pcmpgtw %%mm5, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1056 "pand %%mm2, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1057 "pand %%mm3, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1058
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1059
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1060 "psubusw %%mm0, %%mm4 \n\t" // hd
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1061 "psubusw %%mm1, %%mm5 \n\t" // ld
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1062
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1063
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1064 "movq "MANGLE(w05)", %%mm2 \n\t" // 5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1065 "pmullw %%mm2, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1066 "pmullw %%mm2, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1067 "movq "MANGLE(w20)", %%mm2 \n\t" // 32
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1068 "paddw %%mm2, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1069 "paddw %%mm2, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1070 "psrlw $6, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1071 "psrlw $6, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1072
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1073 "movq 16(%%"REG_c"), %%mm0 \n\t" // L3 - L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1074 "movq 24(%%"REG_c"), %%mm1 \n\t" // H3 - H4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1075
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1076 "pxor %%mm2, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1077 "pxor %%mm3, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1078
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1079 "pcmpgtw %%mm0, %%mm2 \n\t" // sign (L3-L4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1080 "pcmpgtw %%mm1, %%mm3 \n\t" // sign (H3-H4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1081 "pxor %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1082 "pxor %%mm3, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1083 "psubw %%mm2, %%mm0 \n\t" // |L3-L4|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1084 "psubw %%mm3, %%mm1 \n\t" // |H3-H4|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1085 "psrlw $1, %%mm0 \n\t" // |L3 - L4|/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1086 "psrlw $1, %%mm1 \n\t" // |H3 - H4|/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1087
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1088 "pxor %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1089 "pxor %%mm7, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1090 "pand %%mm2, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1091 "pand %%mm3, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1092
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1093 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1094 "pminsw %%mm0, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1095 "pminsw %%mm1, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1096 #else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1097 "movq %%mm4, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1098 "psubusw %%mm0, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1099 "psubw %%mm2, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1100 "movq %%mm5, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1101 "psubusw %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1102 "psubw %%mm2, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1103 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1104 "pxor %%mm6, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1105 "pxor %%mm7, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1106 "psubw %%mm6, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1107 "psubw %%mm7, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1108 "packsswb %%mm5, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1109 "movq (%0), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1110 "paddb %%mm4, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1111 "movq %%mm0, (%0) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1112 "movq (%0, %1), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1113 "psubb %%mm4, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1114 "movq %%mm0, (%0, %1) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1115
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1116 : "+r" (src)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1117 : "r" ((long)stride), "m" (c->pQPb)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1118 : "%"REG_a, "%"REG_c
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1119 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1120 #else //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1121 const int l1= stride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1122 const int l2= stride + l1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1123 const int l3= stride + l2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1124 const int l4= stride + l3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1125 const int l5= stride + l4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1126 const int l6= stride + l5;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1127 const int l7= stride + l6;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1128 const int l8= stride + l7;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1129 // const int l9= stride + l8;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1130 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1131 src+= stride*3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1132 for(x=0; x<BLOCK_SIZE; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1133 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1134 const int middleEnergy= 5*(src[l5] - src[l4]) + 2*(src[l3] - src[l6]);
32
cb746db3fd32 Rename ABS macro to FFABS.
diego
parents: 31
diff changeset
1135 if(FFABS(middleEnergy) < 8*c->QP)
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1136 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1137 const int q=(src[l4] - src[l5])/2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1138 const int leftEnergy= 5*(src[l3] - src[l2]) + 2*(src[l1] - src[l4]);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1139 const int rightEnergy= 5*(src[l7] - src[l6]) + 2*(src[l5] - src[l8]);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1140
32
cb746db3fd32 Rename ABS macro to FFABS.
diego
parents: 31
diff changeset
1141 int d= FFABS(middleEnergy) - FFMIN( FFABS(leftEnergy), FFABS(rightEnergy) );
27
c83a71c1729d Change libpostproc to use the FFMIN/FFMAX macros from libavutil.
diego
parents: 22
diff changeset
1142 d= FFMAX(d, 0);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1143
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1144 d= (5*d + 32) >> 6;
31
81ad3274583c Rename SIGN macro to FFSIGN to avoid clashes with system headers.
diego
parents: 29
diff changeset
1145 d*= FFSIGN(-middleEnergy);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1146
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1147 if(q>0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1148 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1149 d= d<0 ? 0 : d;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1150 d= d>q ? q : d;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1151 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1152 else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1153 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1154 d= d>0 ? 0 : d;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1155 d= d<q ? q : d;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1156 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1157
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1158 src[l4]-= d;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1159 src[l5]+= d;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1160 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1161 src++;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1162 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1163 #endif //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1164 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1165 #endif //HAVE_ALTIVEC
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1166
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1167 #ifndef HAVE_ALTIVEC
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1168 static inline void RENAME(dering)(uint8_t src[], int stride, PPContext *c)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1169 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1170 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1171 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1172 "pxor %%mm6, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1173 "pcmpeqb %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1174 "movq %2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1175 "punpcklbw %%mm6, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1176 "psrlw $1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1177 "psubw %%mm7, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1178 "packuswb %%mm0, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1179 "movq %%mm0, %3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1180
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1181 "lea (%0, %1), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1182 "lea (%%"REG_a", %1, 4), %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1183
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1184 // 0 1 2 3 4 5 6 7 8 9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1185 // %0 eax eax+%1 eax+2%1 %0+4%1 edx edx+%1 edx+2%1 %0+8%1 edx+4%1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1186
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1187 #undef FIND_MIN_MAX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1188 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1189 #define REAL_FIND_MIN_MAX(addr)\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1190 "movq " #addr ", %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1191 "pminub %%mm0, %%mm7 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1192 "pmaxub %%mm0, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1193 #else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1194 #define REAL_FIND_MIN_MAX(addr)\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1195 "movq " #addr ", %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1196 "movq %%mm7, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1197 "psubusb %%mm0, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1198 "paddb %%mm0, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1199 "psubusb %%mm0, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1200 "psubb %%mm1, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1201 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1202 #define FIND_MIN_MAX(addr) REAL_FIND_MIN_MAX(addr)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1203
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1204 FIND_MIN_MAX((%%REGa))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1205 FIND_MIN_MAX((%%REGa, %1))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1206 FIND_MIN_MAX((%%REGa, %1, 2))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1207 FIND_MIN_MAX((%0, %1, 4))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1208 FIND_MIN_MAX((%%REGd))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1209 FIND_MIN_MAX((%%REGd, %1))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1210 FIND_MIN_MAX((%%REGd, %1, 2))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1211 FIND_MIN_MAX((%0, %1, 8))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1212
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1213 "movq %%mm7, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1214 "psrlq $8, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1215 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1216 "pminub %%mm4, %%mm7 \n\t" // min of pixels
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1217 "pshufw $0xF9, %%mm7, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1218 "pminub %%mm4, %%mm7 \n\t" // min of pixels
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1219 "pshufw $0xFE, %%mm7, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1220 "pminub %%mm4, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1221 #else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1222 "movq %%mm7, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1223 "psubusb %%mm4, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1224 "psubb %%mm1, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1225 "movq %%mm7, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1226 "psrlq $16, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1227 "movq %%mm7, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1228 "psubusb %%mm4, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1229 "psubb %%mm1, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1230 "movq %%mm7, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1231 "psrlq $32, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1232 "movq %%mm7, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1233 "psubusb %%mm4, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1234 "psubb %%mm1, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1235 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1236
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1237
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1238 "movq %%mm6, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1239 "psrlq $8, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1240 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1241 "pmaxub %%mm4, %%mm6 \n\t" // max of pixels
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1242 "pshufw $0xF9, %%mm6, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1243 "pmaxub %%mm4, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1244 "pshufw $0xFE, %%mm6, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1245 "pmaxub %%mm4, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1246 #else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1247 "psubusb %%mm4, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1248 "paddb %%mm4, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1249 "movq %%mm6, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1250 "psrlq $16, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1251 "psubusb %%mm4, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1252 "paddb %%mm4, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1253 "movq %%mm6, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1254 "psrlq $32, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1255 "psubusb %%mm4, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1256 "paddb %%mm4, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1257 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1258 "movq %%mm6, %%mm0 \n\t" // max
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1259 "psubb %%mm7, %%mm6 \n\t" // max - min
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1260 "movd %%mm6, %%ecx \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1261 "cmpb "MANGLE(deringThreshold)", %%cl \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1262 " jb 1f \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1263 "lea -24(%%"REG_SP"), %%"REG_c" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1264 "and "ALIGN_MASK", %%"REG_c" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1265 PAVGB(%%mm0, %%mm7) // a=(max + min)/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1266 "punpcklbw %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1267 "punpcklbw %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1268 "punpcklbw %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1269 "movq %%mm7, (%%"REG_c") \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1270
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1271 "movq (%0), %%mm0 \n\t" // L10
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1272 "movq %%mm0, %%mm1 \n\t" // L10
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1273 "movq %%mm0, %%mm2 \n\t" // L10
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1274 "psllq $8, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1275 "psrlq $8, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1276 "movd -4(%0), %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1277 "movd 8(%0), %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1278 "psrlq $24, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1279 "psllq $56, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1280 "por %%mm3, %%mm1 \n\t" // L00
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1281 "por %%mm4, %%mm2 \n\t" // L20
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1282 "movq %%mm1, %%mm3 \n\t" // L00
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1283 PAVGB(%%mm2, %%mm1) // (L20 + L00)/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1284 PAVGB(%%mm0, %%mm1) // (L20 + L00 + 2L10)/4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1285 "psubusb %%mm7, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1286 "psubusb %%mm7, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1287 "psubusb %%mm7, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1288 "pcmpeqb "MANGLE(b00)", %%mm0 \n\t" // L10 > a ? 0 : -1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1289 "pcmpeqb "MANGLE(b00)", %%mm2 \n\t" // L20 > a ? 0 : -1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1290 "pcmpeqb "MANGLE(b00)", %%mm3 \n\t" // L00 > a ? 0 : -1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1291 "paddb %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1292 "paddb %%mm3, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1293
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1294 "movq (%%"REG_a"), %%mm2 \n\t" // L11
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1295 "movq %%mm2, %%mm3 \n\t" // L11
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1296 "movq %%mm2, %%mm4 \n\t" // L11
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1297 "psllq $8, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1298 "psrlq $8, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1299 "movd -4(%%"REG_a"), %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1300 "movd 8(%%"REG_a"), %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1301 "psrlq $24, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1302 "psllq $56, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1303 "por %%mm5, %%mm3 \n\t" // L01
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1304 "por %%mm6, %%mm4 \n\t" // L21
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1305 "movq %%mm3, %%mm5 \n\t" // L01
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1306 PAVGB(%%mm4, %%mm3) // (L21 + L01)/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1307 PAVGB(%%mm2, %%mm3) // (L21 + L01 + 2L11)/4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1308 "psubusb %%mm7, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1309 "psubusb %%mm7, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1310 "psubusb %%mm7, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1311 "pcmpeqb "MANGLE(b00)", %%mm2 \n\t" // L11 > a ? 0 : -1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1312 "pcmpeqb "MANGLE(b00)", %%mm4 \n\t" // L21 > a ? 0 : -1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1313 "pcmpeqb "MANGLE(b00)", %%mm5 \n\t" // L01 > a ? 0 : -1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1314 "paddb %%mm4, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1315 "paddb %%mm5, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1316 // 0, 2, 3, 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1317 #define REAL_DERING_CORE(dst,src,ppsx,psx,sx,pplx,plx,lx,t0,t1) \
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1318 "movq " #src ", " #sx " \n\t" /* src[0] */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1319 "movq " #sx ", " #lx " \n\t" /* src[0] */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1320 "movq " #sx ", " #t0 " \n\t" /* src[0] */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1321 "psllq $8, " #lx " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1322 "psrlq $8, " #t0 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1323 "movd -4" #src ", " #t1 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1324 "psrlq $24, " #t1 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1325 "por " #t1 ", " #lx " \n\t" /* src[-1] */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1326 "movd 8" #src ", " #t1 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1327 "psllq $56, " #t1 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1328 "por " #t1 ", " #t0 " \n\t" /* src[+1] */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1329 "movq " #lx ", " #t1 " \n\t" /* src[-1] */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1330 PAVGB(t0, lx) /* (src[-1] + src[+1])/2 */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1331 PAVGB(sx, lx) /* (src[-1] + 2src[0] + src[+1])/4 */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1332 PAVGB(lx, pplx) \
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1333 "movq " #lx ", 8(%%"REG_c") \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1334 "movq (%%"REG_c"), " #lx " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1335 "psubusb " #lx ", " #t1 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1336 "psubusb " #lx ", " #t0 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1337 "psubusb " #lx ", " #sx " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1338 "movq "MANGLE(b00)", " #lx " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1339 "pcmpeqb " #lx ", " #t1 " \n\t" /* src[-1] > a ? 0 : -1*/\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1340 "pcmpeqb " #lx ", " #t0 " \n\t" /* src[+1] > a ? 0 : -1*/\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1341 "pcmpeqb " #lx ", " #sx " \n\t" /* src[0] > a ? 0 : -1*/\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1342 "paddb " #t1 ", " #t0 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1343 "paddb " #t0 ", " #sx " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1344 \
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1345 PAVGB(plx, pplx) /* filtered */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1346 "movq " #dst ", " #t0 " \n\t" /* dst */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1347 "movq " #t0 ", " #t1 " \n\t" /* dst */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1348 "psubusb %3, " #t0 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1349 "paddusb %3, " #t1 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1350 PMAXUB(t0, pplx)\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1351 PMINUB(t1, pplx, t0)\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1352 "paddb " #sx ", " #ppsx " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1353 "paddb " #psx ", " #ppsx " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1354 "#paddb "MANGLE(b02)", " #ppsx " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1355 "pand "MANGLE(b08)", " #ppsx " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1356 "pcmpeqb " #lx ", " #ppsx " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1357 "pand " #ppsx ", " #pplx " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1358 "pandn " #dst ", " #ppsx " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1359 "por " #pplx ", " #ppsx " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1360 "movq " #ppsx ", " #dst " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1361 "movq 8(%%"REG_c"), " #lx " \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1362
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1363 #define DERING_CORE(dst,src,ppsx,psx,sx,pplx,plx,lx,t0,t1) \
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1364 REAL_DERING_CORE(dst,src,ppsx,psx,sx,pplx,plx,lx,t0,t1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1365 /*
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1366 0000000
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1367 1111111
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1368
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1369 1111110
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1370 1111101
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1371 1111100
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1372 1111011
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1373 1111010
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1374 1111001
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1375
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1376 1111000
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1377 1110111
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1378
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1379 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1380 //DERING_CORE(dst ,src ,ppsx ,psx ,sx ,pplx ,plx ,lx ,t0 ,t1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1381 DERING_CORE((%%REGa) ,(%%REGa, %1) ,%%mm0,%%mm2,%%mm4,%%mm1,%%mm3,%%mm5,%%mm6,%%mm7)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1382 DERING_CORE((%%REGa, %1) ,(%%REGa, %1, 2),%%mm2,%%mm4,%%mm0,%%mm3,%%mm5,%%mm1,%%mm6,%%mm7)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1383 DERING_CORE((%%REGa, %1, 2),(%0, %1, 4) ,%%mm4,%%mm0,%%mm2,%%mm5,%%mm1,%%mm3,%%mm6,%%mm7)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1384 DERING_CORE((%0, %1, 4) ,(%%REGd) ,%%mm0,%%mm2,%%mm4,%%mm1,%%mm3,%%mm5,%%mm6,%%mm7)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1385 DERING_CORE((%%REGd) ,(%%REGd, %1) ,%%mm2,%%mm4,%%mm0,%%mm3,%%mm5,%%mm1,%%mm6,%%mm7)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1386 DERING_CORE((%%REGd, %1) ,(%%REGd, %1, 2),%%mm4,%%mm0,%%mm2,%%mm5,%%mm1,%%mm3,%%mm6,%%mm7)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1387 DERING_CORE((%%REGd, %1, 2),(%0, %1, 8) ,%%mm0,%%mm2,%%mm4,%%mm1,%%mm3,%%mm5,%%mm6,%%mm7)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1388 DERING_CORE((%0, %1, 8) ,(%%REGd, %1, 4),%%mm2,%%mm4,%%mm0,%%mm3,%%mm5,%%mm1,%%mm6,%%mm7)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1389
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1390 "1: \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1391 : : "r" (src), "r" ((long)stride), "m" (c->pQPb), "m"(c->pQPb2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1392 : "%"REG_a, "%"REG_d, "%"REG_c
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1393 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1394 #else //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1395 int y;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1396 int min=255;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1397 int max=0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1398 int avg;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1399 uint8_t *p;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1400 int s[10];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1401 const int QP2= c->QP/2 + 1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1402
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1403 for(y=1; y<9; y++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1404 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1405 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1406 p= src + stride*y;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1407 for(x=1; x<9; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1408 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1409 p++;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1410 if(*p > max) max= *p;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1411 if(*p < min) min= *p;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1412 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1413 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1414 avg= (min + max + 1)>>1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1415
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1416 if(max - min <deringThreshold) return;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1417
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1418 for(y=0; y<10; y++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1419 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1420 int t = 0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1421
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1422 if(src[stride*y + 0] > avg) t+= 1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1423 if(src[stride*y + 1] > avg) t+= 2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1424 if(src[stride*y + 2] > avg) t+= 4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1425 if(src[stride*y + 3] > avg) t+= 8;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1426 if(src[stride*y + 4] > avg) t+= 16;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1427 if(src[stride*y + 5] > avg) t+= 32;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1428 if(src[stride*y + 6] > avg) t+= 64;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1429 if(src[stride*y + 7] > avg) t+= 128;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1430 if(src[stride*y + 8] > avg) t+= 256;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1431 if(src[stride*y + 9] > avg) t+= 512;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1432
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1433 t |= (~t)<<16;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1434 t &= (t<<1) & (t>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1435 s[y] = t;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1436 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1437
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1438 for(y=1; y<9; y++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1439 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1440 int t = s[y-1] & s[y] & s[y+1];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1441 t|= t>>16;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1442 s[y-1]= t;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1443 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1444
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1445 for(y=1; y<9; y++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1446 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1447 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1448 int t = s[y-1];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1449
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1450 p= src + stride*y;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1451 for(x=1; x<9; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1452 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1453 p++;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1454 if(t & (1<<x))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1455 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1456 int f= (*(p-stride-1)) + 2*(*(p-stride)) + (*(p-stride+1))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1457 +2*(*(p -1)) + 4*(*p ) + 2*(*(p +1))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1458 +(*(p+stride-1)) + 2*(*(p+stride)) + (*(p+stride+1));
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1459 f= (f + 8)>>4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1460
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1461 #ifdef DEBUG_DERING_THRESHOLD
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1462 asm volatile("emms\n\t":);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1463 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1464 static long long numPixels=0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1465 if(x!=1 && x!=8 && y!=1 && y!=8) numPixels++;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1466 // if((max-min)<20 || (max-min)*QP<200)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1467 // if((max-min)*QP < 500)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1468 // if(max-min<QP/2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1469 if(max-min < 20)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1470 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1471 static int numSkiped=0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1472 static int errorSum=0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1473 static int worstQP=0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1474 static int worstRange=0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1475 static int worstDiff=0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1476 int diff= (f - *p);
32
cb746db3fd32 Rename ABS macro to FFABS.
diego
parents: 31
diff changeset
1477 int absDiff= FFABS(diff);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1478 int error= diff*diff;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1479
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1480 if(x==1 || x==8 || y==1 || y==8) continue;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1481
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1482 numSkiped++;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1483 if(absDiff > worstDiff)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1484 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1485 worstDiff= absDiff;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1486 worstQP= QP;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1487 worstRange= max-min;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1488 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1489 errorSum+= error;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1490
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1491 if(1024LL*1024LL*1024LL % numSkiped == 0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1492 {
29
2e855f3f4e0b printf --> av_log with some help from Oded
diego
parents: 27
diff changeset
1493 av_log(c, AV_LOG_INFO, "sum:%1.3f, skip:%d, wQP:%d, "
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1494 "wRange:%d, wDiff:%d, relSkip:%1.3f\n",
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1495 (float)errorSum/numSkiped, numSkiped, worstQP, worstRange,
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1496 worstDiff, (float)numSkiped/numPixels);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1497 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1498 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1499 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1500 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1501 if (*p + QP2 < f) *p= *p + QP2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1502 else if(*p - QP2 > f) *p= *p - QP2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1503 else *p=f;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1504 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1505 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1506 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1507 #ifdef DEBUG_DERING_THRESHOLD
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1508 if(max-min < 20)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1509 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1510 for(y=1; y<9; y++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1511 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1512 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1513 int t = 0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1514 p= src + stride*y;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1515 for(x=1; x<9; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1516 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1517 p++;
27
c83a71c1729d Change libpostproc to use the FFMIN/FFMAX macros from libavutil.
diego
parents: 22
diff changeset
1518 *p = FFMIN(*p + 20, 255);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1519 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1520 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1521 // src[0] = src[7]=src[stride*7]=src[stride*7 + 7]=255;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1522 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1523 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1524 #endif //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1525 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1526 #endif //HAVE_ALTIVEC
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1527
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1528 /**
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1529 * Deinterlaces the given block by linearly interpolating every second line.
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1530 * will be called for every 8x8 block and can read & write from line 4-15
90
8e738e0a16f5 typo fixes
diego
parents: 78
diff changeset
1531 * lines 0-3 have been passed through the deblock / dering filters already, but can be read, too.
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1532 * lines 4-12 will be read into the deblocking filter and should be deinterlaced
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1533 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1534 static inline void RENAME(deInterlaceInterpolateLinear)(uint8_t src[], int stride)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1535 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1536 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1537 src+= 4*stride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1538 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1539 "lea (%0, %1), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1540 "lea (%%"REG_a", %1, 4), %%"REG_c" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1541 // 0 1 2 3 4 5 6 7 8 9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1542 // %0 eax eax+%1 eax+2%1 %0+4%1 ecx ecx+%1 ecx+2%1 %0+8%1 ecx+4%1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1543
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1544 "movq (%0), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1545 "movq (%%"REG_a", %1), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1546 PAVGB(%%mm1, %%mm0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1547 "movq %%mm0, (%%"REG_a") \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1548 "movq (%0, %1, 4), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1549 PAVGB(%%mm0, %%mm1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1550 "movq %%mm1, (%%"REG_a", %1, 2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1551 "movq (%%"REG_c", %1), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1552 PAVGB(%%mm1, %%mm0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1553 "movq %%mm0, (%%"REG_c") \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1554 "movq (%0, %1, 8), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1555 PAVGB(%%mm0, %%mm1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1556 "movq %%mm1, (%%"REG_c", %1, 2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1557
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1558 : : "r" (src), "r" ((long)stride)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1559 : "%"REG_a, "%"REG_c
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1560 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1561 #else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1562 int a, b, x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1563 src+= 4*stride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1564
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1565 for(x=0; x<2; x++){
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1566 a= *(uint32_t*)&src[stride*0];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1567 b= *(uint32_t*)&src[stride*2];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1568 *(uint32_t*)&src[stride*1]= (a|b) - (((a^b)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1569 a= *(uint32_t*)&src[stride*4];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1570 *(uint32_t*)&src[stride*3]= (a|b) - (((a^b)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1571 b= *(uint32_t*)&src[stride*6];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1572 *(uint32_t*)&src[stride*5]= (a|b) - (((a^b)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1573 a= *(uint32_t*)&src[stride*8];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1574 *(uint32_t*)&src[stride*7]= (a|b) - (((a^b)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1575 src += 4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1576 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1577 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1578 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1579
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1580 /**
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1581 * Deinterlaces the given block by cubic interpolating every second line.
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1582 * will be called for every 8x8 block and can read & write from line 4-15
90
8e738e0a16f5 typo fixes
diego
parents: 78
diff changeset
1583 * lines 0-3 have been passed through the deblock / dering filters already, but can be read, too.
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1584 * lines 4-12 will be read into the deblocking filter and should be deinterlaced
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1585 * this filter will read lines 3-15 and write 7-13
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1586 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1587 static inline void RENAME(deInterlaceInterpolateCubic)(uint8_t src[], int stride)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1588 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1589 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1590 src+= stride*3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1591 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1592 "lea (%0, %1), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1593 "lea (%%"REG_a", %1, 4), %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1594 "lea (%%"REG_d", %1, 4), %%"REG_c" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1595 "add %1, %%"REG_c" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1596 "pxor %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1597 // 0 1 2 3 4 5 6 7 8 9 10
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1598 // %0 eax eax+%1 eax+2%1 %0+4%1 edx edx+%1 edx+2%1 %0+8%1 edx+4%1 ecx
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1599
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1600 #define REAL_DEINT_CUBIC(a,b,c,d,e)\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1601 "movq " #a ", %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1602 "movq " #b ", %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1603 "movq " #d ", %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1604 "movq " #e ", %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1605 PAVGB(%%mm2, %%mm1) /* (b+d) /2 */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1606 PAVGB(%%mm3, %%mm0) /* a(a+e) /2 */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1607 "movq %%mm0, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1608 "punpcklbw %%mm7, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1609 "punpckhbw %%mm7, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1610 "movq %%mm1, %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1611 "punpcklbw %%mm7, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1612 "punpckhbw %%mm7, %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1613 "psubw %%mm1, %%mm0 \n\t" /* L(a+e - (b+d))/2 */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1614 "psubw %%mm3, %%mm2 \n\t" /* H(a+e - (b+d))/2 */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1615 "psraw $3, %%mm0 \n\t" /* L(a+e - (b+d))/16 */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1616 "psraw $3, %%mm2 \n\t" /* H(a+e - (b+d))/16 */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1617 "psubw %%mm0, %%mm1 \n\t" /* L(9b + 9d - a - e)/16 */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1618 "psubw %%mm2, %%mm3 \n\t" /* H(9b + 9d - a - e)/16 */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1619 "packuswb %%mm3, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1620 "movq %%mm1, " #c " \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1621 #define DEINT_CUBIC(a,b,c,d,e) REAL_DEINT_CUBIC(a,b,c,d,e)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1622
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1623 DEINT_CUBIC((%0) , (%%REGa, %1), (%%REGa, %1, 2), (%0, %1, 4) , (%%REGd, %1))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1624 DEINT_CUBIC((%%REGa, %1), (%0, %1, 4) , (%%REGd) , (%%REGd, %1), (%0, %1, 8))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1625 DEINT_CUBIC((%0, %1, 4) , (%%REGd, %1), (%%REGd, %1, 2), (%0, %1, 8) , (%%REGc))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1626 DEINT_CUBIC((%%REGd, %1), (%0, %1, 8) , (%%REGd, %1, 4), (%%REGc) , (%%REGc, %1, 2))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1627
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1628 : : "r" (src), "r" ((long)stride)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1629 : "%"REG_a, "%"REG_d, "%"REG_c
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1630 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1631 #else //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1632 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1633 src+= stride*3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1634 for(x=0; x<8; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1635 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1636 src[stride*3] = CLIP((-src[0] + 9*src[stride*2] + 9*src[stride*4] - src[stride*6])>>4);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1637 src[stride*5] = CLIP((-src[stride*2] + 9*src[stride*4] + 9*src[stride*6] - src[stride*8])>>4);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1638 src[stride*7] = CLIP((-src[stride*4] + 9*src[stride*6] + 9*src[stride*8] - src[stride*10])>>4);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1639 src[stride*9] = CLIP((-src[stride*6] + 9*src[stride*8] + 9*src[stride*10] - src[stride*12])>>4);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1640 src++;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1641 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1642 #endif //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1643 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1644
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1645 /**
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1646 * Deinterlaces the given block by filtering every second line with a (-1 4 2 4 -1) filter.
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1647 * will be called for every 8x8 block and can read & write from line 4-15
90
8e738e0a16f5 typo fixes
diego
parents: 78
diff changeset
1648 * lines 0-3 have been passed through the deblock / dering filters already, but can be read, too.
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1649 * lines 4-12 will be read into the deblocking filter and should be deinterlaced
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1650 * this filter will read lines 4-13 and write 5-11
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1651 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1652 static inline void RENAME(deInterlaceFF)(uint8_t src[], int stride, uint8_t *tmp)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1653 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1654 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1655 src+= stride*4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1656 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1657 "lea (%0, %1), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1658 "lea (%%"REG_a", %1, 4), %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1659 "pxor %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1660 "movq (%2), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1661 // 0 1 2 3 4 5 6 7 8 9 10
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1662 // %0 eax eax+%1 eax+2%1 %0+4%1 edx edx+%1 edx+2%1 %0+8%1 edx+4%1 ecx
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1663
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1664 #define REAL_DEINT_FF(a,b,c,d)\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1665 "movq " #a ", %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1666 "movq " #b ", %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1667 "movq " #c ", %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1668 "movq " #d ", %%mm4 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1669 PAVGB(%%mm3, %%mm1) \
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1670 PAVGB(%%mm4, %%mm0) \
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1671 "movq %%mm0, %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1672 "punpcklbw %%mm7, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1673 "punpckhbw %%mm7, %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1674 "movq %%mm1, %%mm4 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1675 "punpcklbw %%mm7, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1676 "punpckhbw %%mm7, %%mm4 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1677 "psllw $2, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1678 "psllw $2, %%mm4 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1679 "psubw %%mm0, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1680 "psubw %%mm3, %%mm4 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1681 "movq %%mm2, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1682 "movq %%mm2, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1683 "punpcklbw %%mm7, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1684 "punpckhbw %%mm7, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1685 "paddw %%mm2, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1686 "paddw %%mm5, %%mm4 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1687 "psraw $2, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1688 "psraw $2, %%mm4 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1689 "packuswb %%mm4, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1690 "movq %%mm1, " #b " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1691
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1692 #define DEINT_FF(a,b,c,d) REAL_DEINT_FF(a,b,c,d)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1693
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1694 DEINT_FF((%0) , (%%REGa) , (%%REGa, %1), (%%REGa, %1, 2))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1695 DEINT_FF((%%REGa, %1), (%%REGa, %1, 2), (%0, %1, 4) , (%%REGd) )
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1696 DEINT_FF((%0, %1, 4) , (%%REGd) , (%%REGd, %1), (%%REGd, %1, 2))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1697 DEINT_FF((%%REGd, %1), (%%REGd, %1, 2), (%0, %1, 8) , (%%REGd, %1, 4))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1698
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1699 "movq %%mm0, (%2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1700 : : "r" (src), "r" ((long)stride), "r"(tmp)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1701 : "%"REG_a, "%"REG_d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1702 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1703 #else //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1704 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1705 src+= stride*4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1706 for(x=0; x<8; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1707 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1708 int t1= tmp[x];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1709 int t2= src[stride*1];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1710
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1711 src[stride*1]= CLIP((-t1 + 4*src[stride*0] + 2*t2 + 4*src[stride*2] - src[stride*3] + 4)>>3);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1712 t1= src[stride*4];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1713 src[stride*3]= CLIP((-t2 + 4*src[stride*2] + 2*t1 + 4*src[stride*4] - src[stride*5] + 4)>>3);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1714 t2= src[stride*6];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1715 src[stride*5]= CLIP((-t1 + 4*src[stride*4] + 2*t2 + 4*src[stride*6] - src[stride*7] + 4)>>3);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1716 t1= src[stride*8];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1717 src[stride*7]= CLIP((-t2 + 4*src[stride*6] + 2*t1 + 4*src[stride*8] - src[stride*9] + 4)>>3);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1718 tmp[x]= t1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1719
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1720 src++;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1721 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1722 #endif //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1723 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1724
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1725 /**
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1726 * Deinterlaces the given block by filtering every line with a (-1 2 6 2 -1) filter.
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1727 * will be called for every 8x8 block and can read & write from line 4-15
90
8e738e0a16f5 typo fixes
diego
parents: 78
diff changeset
1728 * lines 0-3 have been passed through the deblock / dering filters already, but can be read, too.
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1729 * lines 4-12 will be read into the deblocking filter and should be deinterlaced
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1730 * this filter will read lines 4-13 and write 4-11
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1731 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1732 static inline void RENAME(deInterlaceL5)(uint8_t src[], int stride, uint8_t *tmp, uint8_t *tmp2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1733 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1734 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1735 src+= stride*4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1736 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1737 "lea (%0, %1), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1738 "lea (%%"REG_a", %1, 4), %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1739 "pxor %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1740 "movq (%2), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1741 "movq (%3), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1742 // 0 1 2 3 4 5 6 7 8 9 10
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1743 // %0 eax eax+%1 eax+2%1 %0+4%1 edx edx+%1 edx+2%1 %0+8%1 edx+4%1 ecx
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1744
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1745 #define REAL_DEINT_L5(t1,t2,a,b,c)\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1746 "movq " #a ", %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1747 "movq " #b ", %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1748 "movq " #c ", %%mm4 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1749 PAVGB(t2, %%mm3) \
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1750 PAVGB(t1, %%mm4) \
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1751 "movq %%mm2, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1752 "movq %%mm2, " #t1 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1753 "punpcklbw %%mm7, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1754 "punpckhbw %%mm7, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1755 "movq %%mm2, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1756 "paddw %%mm2, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1757 "paddw %%mm6, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1758 "movq %%mm5, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1759 "paddw %%mm5, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1760 "paddw %%mm6, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1761 "movq %%mm3, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1762 "punpcklbw %%mm7, %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1763 "punpckhbw %%mm7, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1764 "paddw %%mm3, %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1765 "paddw %%mm6, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1766 "paddw %%mm3, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1767 "paddw %%mm6, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1768 "movq %%mm4, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1769 "punpcklbw %%mm7, %%mm4 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1770 "punpckhbw %%mm7, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1771 "psubw %%mm4, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1772 "psubw %%mm6, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1773 "psraw $2, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1774 "psraw $2, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1775 "packuswb %%mm5, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1776 "movq %%mm2, " #a " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1777
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1778 #define DEINT_L5(t1,t2,a,b,c) REAL_DEINT_L5(t1,t2,a,b,c)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1779
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1780 DEINT_L5(%%mm0, %%mm1, (%0) , (%%REGa) , (%%REGa, %1) )
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1781 DEINT_L5(%%mm1, %%mm0, (%%REGa) , (%%REGa, %1) , (%%REGa, %1, 2))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1782 DEINT_L5(%%mm0, %%mm1, (%%REGa, %1) , (%%REGa, %1, 2), (%0, %1, 4) )
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1783 DEINT_L5(%%mm1, %%mm0, (%%REGa, %1, 2), (%0, %1, 4) , (%%REGd) )
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1784 DEINT_L5(%%mm0, %%mm1, (%0, %1, 4) , (%%REGd) , (%%REGd, %1) )
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1785 DEINT_L5(%%mm1, %%mm0, (%%REGd) , (%%REGd, %1) , (%%REGd, %1, 2))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1786 DEINT_L5(%%mm0, %%mm1, (%%REGd, %1) , (%%REGd, %1, 2), (%0, %1, 8) )
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1787 DEINT_L5(%%mm1, %%mm0, (%%REGd, %1, 2), (%0, %1, 8) , (%%REGd, %1, 4))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1788
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1789 "movq %%mm0, (%2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1790 "movq %%mm1, (%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1791 : : "r" (src), "r" ((long)stride), "r"(tmp), "r"(tmp2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1792 : "%"REG_a, "%"REG_d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1793 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1794 #else //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1795 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1796 src+= stride*4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1797 for(x=0; x<8; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1798 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1799 int t1= tmp[x];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1800 int t2= tmp2[x];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1801 int t3= src[0];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1802
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1803 src[stride*0]= CLIP((-(t1 + src[stride*2]) + 2*(t2 + src[stride*1]) + 6*t3 + 4)>>3);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1804 t1= src[stride*1];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1805 src[stride*1]= CLIP((-(t2 + src[stride*3]) + 2*(t3 + src[stride*2]) + 6*t1 + 4)>>3);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1806 t2= src[stride*2];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1807 src[stride*2]= CLIP((-(t3 + src[stride*4]) + 2*(t1 + src[stride*3]) + 6*t2 + 4)>>3);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1808 t3= src[stride*3];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1809 src[stride*3]= CLIP((-(t1 + src[stride*5]) + 2*(t2 + src[stride*4]) + 6*t3 + 4)>>3);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1810 t1= src[stride*4];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1811 src[stride*4]= CLIP((-(t2 + src[stride*6]) + 2*(t3 + src[stride*5]) + 6*t1 + 4)>>3);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1812 t2= src[stride*5];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1813 src[stride*5]= CLIP((-(t3 + src[stride*7]) + 2*(t1 + src[stride*6]) + 6*t2 + 4)>>3);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1814 t3= src[stride*6];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1815 src[stride*6]= CLIP((-(t1 + src[stride*8]) + 2*(t2 + src[stride*7]) + 6*t3 + 4)>>3);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1816 t1= src[stride*7];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1817 src[stride*7]= CLIP((-(t2 + src[stride*9]) + 2*(t3 + src[stride*8]) + 6*t1 + 4)>>3);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1818
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1819 tmp[x]= t3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1820 tmp2[x]= t1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1821
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1822 src++;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1823 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1824 #endif //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1825 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1826
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1827 /**
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1828 * Deinterlaces the given block by filtering all lines with a (1 2 1) filter.
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1829 * will be called for every 8x8 block and can read & write from line 4-15
90
8e738e0a16f5 typo fixes
diego
parents: 78
diff changeset
1830 * lines 0-3 have been passed through the deblock / dering filters already, but can be read, too.
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1831 * lines 4-12 will be read into the deblocking filter and should be deinterlaced
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1832 * this filter will read lines 4-13 and write 4-11
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1833 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1834 static inline void RENAME(deInterlaceBlendLinear)(uint8_t src[], int stride, uint8_t *tmp)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1835 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1836 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1837 src+= 4*stride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1838 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1839 "lea (%0, %1), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1840 "lea (%%"REG_a", %1, 4), %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1841 // 0 1 2 3 4 5 6 7 8 9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1842 // %0 eax eax+%1 eax+2%1 %0+4%1 edx edx+%1 edx+2%1 %0+8%1 edx+4%1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1843
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1844 "movq (%2), %%mm0 \n\t" // L0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1845 "movq (%%"REG_a"), %%mm1 \n\t" // L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1846 PAVGB(%%mm1, %%mm0) // L0+L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1847 "movq (%0), %%mm2 \n\t" // L1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1848 PAVGB(%%mm2, %%mm0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1849 "movq %%mm0, (%0) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1850 "movq (%%"REG_a", %1), %%mm0 \n\t" // L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1851 PAVGB(%%mm0, %%mm2) // L1+L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1852 PAVGB(%%mm1, %%mm2) // 2L2 + L1 + L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1853 "movq %%mm2, (%%"REG_a") \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1854 "movq (%%"REG_a", %1, 2), %%mm2 \n\t" // L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1855 PAVGB(%%mm2, %%mm1) // L2+L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1856 PAVGB(%%mm0, %%mm1) // 2L3 + L2 + L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1857 "movq %%mm1, (%%"REG_a", %1) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1858 "movq (%0, %1, 4), %%mm1 \n\t" // L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1859 PAVGB(%%mm1, %%mm0) // L3+L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1860 PAVGB(%%mm2, %%mm0) // 2L4 + L3 + L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1861 "movq %%mm0, (%%"REG_a", %1, 2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1862 "movq (%%"REG_d"), %%mm0 \n\t" // L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1863 PAVGB(%%mm0, %%mm2) // L4+L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1864 PAVGB(%%mm1, %%mm2) // 2L5 + L4 + L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1865 "movq %%mm2, (%0, %1, 4) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1866 "movq (%%"REG_d", %1), %%mm2 \n\t" // L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1867 PAVGB(%%mm2, %%mm1) // L5+L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1868 PAVGB(%%mm0, %%mm1) // 2L6 + L5 + L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1869 "movq %%mm1, (%%"REG_d") \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1870 "movq (%%"REG_d", %1, 2), %%mm1 \n\t" // L8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1871 PAVGB(%%mm1, %%mm0) // L6+L8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1872 PAVGB(%%mm2, %%mm0) // 2L7 + L6 + L8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1873 "movq %%mm0, (%%"REG_d", %1) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1874 "movq (%0, %1, 8), %%mm0 \n\t" // L9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1875 PAVGB(%%mm0, %%mm2) // L7+L9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1876 PAVGB(%%mm1, %%mm2) // 2L8 + L7 + L9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1877 "movq %%mm2, (%%"REG_d", %1, 2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1878 "movq %%mm1, (%2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1879
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1880 : : "r" (src), "r" ((long)stride), "r" (tmp)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1881 : "%"REG_a, "%"REG_d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1882 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1883 #else //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1884 int a, b, c, x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1885 src+= 4*stride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1886
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1887 for(x=0; x<2; x++){
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1888 a= *(uint32_t*)&tmp[stride*0];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1889 b= *(uint32_t*)&src[stride*0];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1890 c= *(uint32_t*)&src[stride*1];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1891 a= (a&c) + (((a^c)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1892 *(uint32_t*)&src[stride*0]= (a|b) - (((a^b)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1893
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1894 a= *(uint32_t*)&src[stride*2];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1895 b= (a&b) + (((a^b)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1896 *(uint32_t*)&src[stride*1]= (c|b) - (((c^b)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1897
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1898 b= *(uint32_t*)&src[stride*3];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1899 c= (b&c) + (((b^c)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1900 *(uint32_t*)&src[stride*2]= (c|a) - (((c^a)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1901
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1902 c= *(uint32_t*)&src[stride*4];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1903 a= (a&c) + (((a^c)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1904 *(uint32_t*)&src[stride*3]= (a|b) - (((a^b)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1905
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1906 a= *(uint32_t*)&src[stride*5];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1907 b= (a&b) + (((a^b)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1908 *(uint32_t*)&src[stride*4]= (c|b) - (((c^b)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1909
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1910 b= *(uint32_t*)&src[stride*6];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1911 c= (b&c) + (((b^c)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1912 *(uint32_t*)&src[stride*5]= (c|a) - (((c^a)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1913
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1914 c= *(uint32_t*)&src[stride*7];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1915 a= (a&c) + (((a^c)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1916 *(uint32_t*)&src[stride*6]= (a|b) - (((a^b)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1917
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1918 a= *(uint32_t*)&src[stride*8];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1919 b= (a&b) + (((a^b)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1920 *(uint32_t*)&src[stride*7]= (c|b) - (((c^b)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1921
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1922 *(uint32_t*)&tmp[stride*0]= c;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1923 src += 4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1924 tmp += 4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1925 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1926 #endif //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1927 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1928
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1929 /**
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1930 * Deinterlaces the given block by applying a median filter to every second line.
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1931 * will be called for every 8x8 block and can read & write from line 4-15,
90
8e738e0a16f5 typo fixes
diego
parents: 78
diff changeset
1932 * lines 0-3 have been passed through the deblock / dering filters already, but can be read, too.
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1933 * lines 4-12 will be read into the deblocking filter and should be deinterlaced
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1934 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1935 static inline void RENAME(deInterlaceMedian)(uint8_t src[], int stride)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1936 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1937 #ifdef HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1938 src+= 4*stride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1939 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1940 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1941 "lea (%0, %1), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1942 "lea (%%"REG_a", %1, 4), %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1943 // 0 1 2 3 4 5 6 7 8 9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1944 // %0 eax eax+%1 eax+2%1 %0+4%1 edx edx+%1 edx+2%1 %0+8%1 edx+4%1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1945
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1946 "movq (%0), %%mm0 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1947 "movq (%%"REG_a", %1), %%mm2 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1948 "movq (%%"REG_a"), %%mm1 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1949 "movq %%mm0, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1950 "pmaxub %%mm1, %%mm0 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1951 "pminub %%mm3, %%mm1 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1952 "pmaxub %%mm2, %%mm1 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1953 "pminub %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1954 "movq %%mm0, (%%"REG_a") \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1955
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1956 "movq (%0, %1, 4), %%mm0 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1957 "movq (%%"REG_a", %1, 2), %%mm1 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1958 "movq %%mm2, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1959 "pmaxub %%mm1, %%mm2 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1960 "pminub %%mm3, %%mm1 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1961 "pmaxub %%mm0, %%mm1 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1962 "pminub %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1963 "movq %%mm2, (%%"REG_a", %1, 2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1964
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1965 "movq (%%"REG_d"), %%mm2 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1966 "movq (%%"REG_d", %1), %%mm1 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1967 "movq %%mm2, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1968 "pmaxub %%mm0, %%mm2 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1969 "pminub %%mm3, %%mm0 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1970 "pmaxub %%mm1, %%mm0 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1971 "pminub %%mm0, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1972 "movq %%mm2, (%%"REG_d") \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1973
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1974 "movq (%%"REG_d", %1, 2), %%mm2 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1975 "movq (%0, %1, 8), %%mm0 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1976 "movq %%mm2, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1977 "pmaxub %%mm0, %%mm2 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1978 "pminub %%mm3, %%mm0 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1979 "pmaxub %%mm1, %%mm0 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1980 "pminub %%mm0, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1981 "movq %%mm2, (%%"REG_d", %1, 2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1982
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1983
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1984 : : "r" (src), "r" ((long)stride)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1985 : "%"REG_a, "%"REG_d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1986 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1987
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1988 #else // MMX without MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1989 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1990 "lea (%0, %1), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1991 "lea (%%"REG_a", %1, 4), %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1992 // 0 1 2 3 4 5 6 7 8 9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1993 // %0 eax eax+%1 eax+2%1 %0+4%1 edx edx+%1 edx+2%1 %0+8%1 edx+4%1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1994 "pxor %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1995
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1996 #define REAL_MEDIAN(a,b,c)\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1997 "movq " #a ", %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1998 "movq " #b ", %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1999 "movq " #c ", %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2000 "movq %%mm0, %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2001 "movq %%mm1, %%mm4 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2002 "movq %%mm2, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2003 "psubusb %%mm1, %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2004 "psubusb %%mm2, %%mm4 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2005 "psubusb %%mm0, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2006 "pcmpeqb %%mm7, %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2007 "pcmpeqb %%mm7, %%mm4 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2008 "pcmpeqb %%mm7, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2009 "movq %%mm3, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2010 "pxor %%mm4, %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2011 "pxor %%mm5, %%mm4 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2012 "pxor %%mm6, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2013 "por %%mm3, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2014 "por %%mm4, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2015 "por %%mm5, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2016 "pand %%mm2, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2017 "pand %%mm1, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2018 "movq %%mm0, " #b " \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2019 #define MEDIAN(a,b,c) REAL_MEDIAN(a,b,c)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2020
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2021 MEDIAN((%0) , (%%REGa) , (%%REGa, %1))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2022 MEDIAN((%%REGa, %1), (%%REGa, %1, 2), (%0, %1, 4))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2023 MEDIAN((%0, %1, 4) , (%%REGd) , (%%REGd, %1))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2024 MEDIAN((%%REGd, %1), (%%REGd, %1, 2), (%0, %1, 8))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2025
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2026 : : "r" (src), "r" ((long)stride)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2027 : "%"REG_a, "%"REG_d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2028 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2029 #endif //HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2030 #else //HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2031 int x, y;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2032 src+= 4*stride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2033 // FIXME - there should be a way to do a few columns in parallel like w/mmx
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2034 for(x=0; x<8; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2035 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2036 uint8_t *colsrc = src;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2037 for (y=0; y<4; y++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2038 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2039 int a, b, c, d, e, f;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2040 a = colsrc[0 ];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2041 b = colsrc[stride ];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2042 c = colsrc[stride*2];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2043 d = (a-b)>>31;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2044 e = (b-c)>>31;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2045 f = (c-a)>>31;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2046 colsrc[stride ] = (a|(d^f)) & (b|(d^e)) & (c|(e^f));
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2047 colsrc += stride*2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2048 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2049 src++;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2050 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2051 #endif //HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2052 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2053
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2054 #ifdef HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2055 /**
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2056 * transposes and shift the given 8x8 Block into dst1 and dst2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2057 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2058 static inline void RENAME(transpose1)(uint8_t *dst1, uint8_t *dst2, uint8_t *src, int srcStride)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2059 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2060 asm(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2061 "lea (%0, %1), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2062 // 0 1 2 3 4 5 6 7 8 9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2063 // %0 eax eax+%1 eax+2%1 %0+4%1 edx edx+%1 edx+2%1 %0+8%1 edx+4%1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2064 "movq (%0), %%mm0 \n\t" // 12345678
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2065 "movq (%%"REG_a"), %%mm1 \n\t" // abcdefgh
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2066 "movq %%mm0, %%mm2 \n\t" // 12345678
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2067 "punpcklbw %%mm1, %%mm0 \n\t" // 1a2b3c4d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2068 "punpckhbw %%mm1, %%mm2 \n\t" // 5e6f7g8h
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2069
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2070 "movq (%%"REG_a", %1), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2071 "movq (%%"REG_a", %1, 2), %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2072 "movq %%mm1, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2073 "punpcklbw %%mm3, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2074 "punpckhbw %%mm3, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2075
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2076 "movq %%mm0, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2077 "punpcklwd %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2078 "punpckhwd %%mm1, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2079 "movq %%mm2, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2080 "punpcklwd %%mm4, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2081 "punpckhwd %%mm4, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2082
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2083 "movd %%mm0, 128(%2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2084 "psrlq $32, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2085 "movd %%mm0, 144(%2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2086 "movd %%mm3, 160(%2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2087 "psrlq $32, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2088 "movd %%mm3, 176(%2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2089 "movd %%mm3, 48(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2090 "movd %%mm2, 192(%2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2091 "movd %%mm2, 64(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2092 "psrlq $32, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2093 "movd %%mm2, 80(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2094 "movd %%mm1, 96(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2095 "psrlq $32, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2096 "movd %%mm1, 112(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2097
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2098 "lea (%%"REG_a", %1, 4), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2099
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2100 "movq (%0, %1, 4), %%mm0 \n\t" // 12345678
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2101 "movq (%%"REG_a"), %%mm1 \n\t" // abcdefgh
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2102 "movq %%mm0, %%mm2 \n\t" // 12345678
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2103 "punpcklbw %%mm1, %%mm0 \n\t" // 1a2b3c4d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2104 "punpckhbw %%mm1, %%mm2 \n\t" // 5e6f7g8h
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2105
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2106 "movq (%%"REG_a", %1), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2107 "movq (%%"REG_a", %1, 2), %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2108 "movq %%mm1, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2109 "punpcklbw %%mm3, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2110 "punpckhbw %%mm3, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2111
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2112 "movq %%mm0, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2113 "punpcklwd %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2114 "punpckhwd %%mm1, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2115 "movq %%mm2, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2116 "punpcklwd %%mm4, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2117 "punpckhwd %%mm4, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2118
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2119 "movd %%mm0, 132(%2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2120 "psrlq $32, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2121 "movd %%mm0, 148(%2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2122 "movd %%mm3, 164(%2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2123 "psrlq $32, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2124 "movd %%mm3, 180(%2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2125 "movd %%mm3, 52(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2126 "movd %%mm2, 196(%2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2127 "movd %%mm2, 68(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2128 "psrlq $32, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2129 "movd %%mm2, 84(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2130 "movd %%mm1, 100(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2131 "psrlq $32, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2132 "movd %%mm1, 116(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2133
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2134
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2135 :: "r" (src), "r" ((long)srcStride), "r" (dst1), "r" (dst2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2136 : "%"REG_a
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2137 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2138 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2139
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2140 /**
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2141 * transposes the given 8x8 block
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2142 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2143 static inline void RENAME(transpose2)(uint8_t *dst, int dstStride, uint8_t *src)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2144 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2145 asm(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2146 "lea (%0, %1), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2147 "lea (%%"REG_a",%1,4), %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2148 // 0 1 2 3 4 5 6 7 8 9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2149 // %0 eax eax+%1 eax+2%1 %0+4%1 edx edx+%1 edx+2%1 %0+8%1 edx+4%1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2150 "movq (%2), %%mm0 \n\t" // 12345678
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2151 "movq 16(%2), %%mm1 \n\t" // abcdefgh
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2152 "movq %%mm0, %%mm2 \n\t" // 12345678
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2153 "punpcklbw %%mm1, %%mm0 \n\t" // 1a2b3c4d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2154 "punpckhbw %%mm1, %%mm2 \n\t" // 5e6f7g8h
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2155
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2156 "movq 32(%2), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2157 "movq 48(%2), %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2158 "movq %%mm1, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2159 "punpcklbw %%mm3, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2160 "punpckhbw %%mm3, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2161
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2162 "movq %%mm0, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2163 "punpcklwd %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2164 "punpckhwd %%mm1, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2165 "movq %%mm2, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2166 "punpcklwd %%mm4, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2167 "punpckhwd %%mm4, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2168
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2169 "movd %%mm0, (%0) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2170 "psrlq $32, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2171 "movd %%mm0, (%%"REG_a") \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2172 "movd %%mm3, (%%"REG_a", %1) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2173 "psrlq $32, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2174 "movd %%mm3, (%%"REG_a", %1, 2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2175 "movd %%mm2, (%0, %1, 4) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2176 "psrlq $32, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2177 "movd %%mm2, (%%"REG_d") \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2178 "movd %%mm1, (%%"REG_d", %1) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2179 "psrlq $32, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2180 "movd %%mm1, (%%"REG_d", %1, 2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2181
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2182
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2183 "movq 64(%2), %%mm0 \n\t" // 12345678
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2184 "movq 80(%2), %%mm1 \n\t" // abcdefgh
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2185 "movq %%mm0, %%mm2 \n\t" // 12345678
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2186 "punpcklbw %%mm1, %%mm0 \n\t" // 1a2b3c4d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2187 "punpckhbw %%mm1, %%mm2 \n\t" // 5e6f7g8h
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2188
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2189 "movq 96(%2), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2190 "movq 112(%2), %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2191 "movq %%mm1, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2192 "punpcklbw %%mm3, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2193 "punpckhbw %%mm3, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2194
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2195 "movq %%mm0, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2196 "punpcklwd %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2197 "punpckhwd %%mm1, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2198 "movq %%mm2, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2199 "punpcklwd %%mm4, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2200 "punpckhwd %%mm4, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2201
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2202 "movd %%mm0, 4(%0) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2203 "psrlq $32, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2204 "movd %%mm0, 4(%%"REG_a") \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2205 "movd %%mm3, 4(%%"REG_a", %1) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2206 "psrlq $32, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2207 "movd %%mm3, 4(%%"REG_a", %1, 2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2208 "movd %%mm2, 4(%0, %1, 4) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2209 "psrlq $32, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2210 "movd %%mm2, 4(%%"REG_d") \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2211 "movd %%mm1, 4(%%"REG_d", %1) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2212 "psrlq $32, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2213 "movd %%mm1, 4(%%"REG_d", %1, 2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2214
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2215 :: "r" (dst), "r" ((long)dstStride), "r" (src)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2216 : "%"REG_a, "%"REG_d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2217 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2218 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2219 #endif //HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2220 //static long test=0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2221
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2222 #ifndef HAVE_ALTIVEC
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2223 static inline void RENAME(tempNoiseReducer)(uint8_t *src, int stride,
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2224 uint8_t *tempBlured, uint32_t *tempBluredPast, int *maxNoise)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2225 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2226 // to save a register (FIXME do this outside of the loops)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2227 tempBluredPast[127]= maxNoise[0];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2228 tempBluredPast[128]= maxNoise[1];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2229 tempBluredPast[129]= maxNoise[2];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2230
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2231 #define FAST_L2_DIFF
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2232 //#define L1_DIFF //u should change the thresholds too if u try that one
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2233 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2234 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2235 "lea (%2, %2, 2), %%"REG_a" \n\t" // 3*stride
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2236 "lea (%2, %2, 4), %%"REG_d" \n\t" // 5*stride
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2237 "lea (%%"REG_d", %2, 2), %%"REG_c" \n\t" // 7*stride
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2238 // 0 1 2 3 4 5 6 7 8 9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2239 // %x %x+%2 %x+2%2 %x+eax %x+4%2 %x+edx %x+2eax %x+ecx %x+8%2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2240 //FIXME reorder?
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2241 #ifdef L1_DIFF //needs mmx2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2242 "movq (%0), %%mm0 \n\t" // L0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2243 "psadbw (%1), %%mm0 \n\t" // |L0-R0|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2244 "movq (%0, %2), %%mm1 \n\t" // L1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2245 "psadbw (%1, %2), %%mm1 \n\t" // |L1-R1|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2246 "movq (%0, %2, 2), %%mm2 \n\t" // L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2247 "psadbw (%1, %2, 2), %%mm2 \n\t" // |L2-R2|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2248 "movq (%0, %%"REG_a"), %%mm3 \n\t" // L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2249 "psadbw (%1, %%"REG_a"), %%mm3 \n\t" // |L3-R3|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2250
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2251 "movq (%0, %2, 4), %%mm4 \n\t" // L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2252 "paddw %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2253 "psadbw (%1, %2, 4), %%mm4 \n\t" // |L4-R4|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2254 "movq (%0, %%"REG_d"), %%mm5 \n\t" // L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2255 "paddw %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2256 "psadbw (%1, %%"REG_d"), %%mm5 \n\t" // |L5-R5|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2257 "movq (%0, %%"REG_a", 2), %%mm6 \n\t" // L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2258 "paddw %%mm3, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2259 "psadbw (%1, %%"REG_a", 2), %%mm6 \n\t" // |L6-R6|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2260 "movq (%0, %%"REG_c"), %%mm7 \n\t" // L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2261 "paddw %%mm4, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2262 "psadbw (%1, %%"REG_c"), %%mm7 \n\t" // |L7-R7|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2263 "paddw %%mm5, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2264 "paddw %%mm7, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2265 "paddw %%mm6, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2266 #else //L1_DIFF
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2267 #if defined (FAST_L2_DIFF)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2268 "pcmpeqb %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2269 "movq "MANGLE(b80)", %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2270 "pxor %%mm0, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2271 #define REAL_L2_DIFF_CORE(a, b)\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2272 "movq " #a ", %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2273 "movq " #b ", %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2274 "pxor %%mm7, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2275 PAVGB(%%mm2, %%mm5)\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2276 "paddb %%mm6, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2277 "movq %%mm5, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2278 "psllw $8, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2279 "pmaddwd %%mm5, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2280 "pmaddwd %%mm2, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2281 "paddd %%mm2, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2282 "psrld $14, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2283 "paddd %%mm5, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2284
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2285 #else //defined (FAST_L2_DIFF)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2286 "pxor %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2287 "pxor %%mm0, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2288 #define REAL_L2_DIFF_CORE(a, b)\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2289 "movq " #a ", %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2290 "movq " #b ", %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2291 "movq %%mm5, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2292 "movq %%mm2, %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2293 "punpcklbw %%mm7, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2294 "punpckhbw %%mm7, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2295 "punpcklbw %%mm7, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2296 "punpckhbw %%mm7, %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2297 "psubw %%mm2, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2298 "psubw %%mm3, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2299 "pmaddwd %%mm5, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2300 "pmaddwd %%mm1, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2301 "paddd %%mm1, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2302 "paddd %%mm5, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2303
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2304 #endif //defined (FAST_L2_DIFF)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2305
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2306 #define L2_DIFF_CORE(a, b) REAL_L2_DIFF_CORE(a, b)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2307
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2308 L2_DIFF_CORE((%0) , (%1))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2309 L2_DIFF_CORE((%0, %2) , (%1, %2))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2310 L2_DIFF_CORE((%0, %2, 2) , (%1, %2, 2))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2311 L2_DIFF_CORE((%0, %%REGa) , (%1, %%REGa))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2312 L2_DIFF_CORE((%0, %2, 4) , (%1, %2, 4))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2313 L2_DIFF_CORE((%0, %%REGd) , (%1, %%REGd))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2314 L2_DIFF_CORE((%0, %%REGa,2), (%1, %%REGa,2))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2315 L2_DIFF_CORE((%0, %%REGc) , (%1, %%REGc))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2316
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2317 #endif //L1_DIFF
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2318
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2319 "movq %%mm0, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2320 "psrlq $32, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2321 "paddd %%mm0, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2322 "movd %%mm4, %%ecx \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2323 "shll $2, %%ecx \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2324 "mov %3, %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2325 "addl -4(%%"REG_d"), %%ecx \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2326 "addl 4(%%"REG_d"), %%ecx \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2327 "addl -1024(%%"REG_d"), %%ecx \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2328 "addl $4, %%ecx \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2329 "addl 1024(%%"REG_d"), %%ecx \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2330 "shrl $3, %%ecx \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2331 "movl %%ecx, (%%"REG_d") \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2332
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2333 // "mov %3, %%"REG_c" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2334 // "mov %%"REG_c", test \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2335 // "jmp 4f \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2336 "cmpl 512(%%"REG_d"), %%ecx \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2337 " jb 2f \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2338 "cmpl 516(%%"REG_d"), %%ecx \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2339 " jb 1f \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2340
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2341 "lea (%%"REG_a", %2, 2), %%"REG_d" \n\t" // 5*stride
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2342 "lea (%%"REG_d", %2, 2), %%"REG_c" \n\t" // 7*stride
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2343 "movq (%0), %%mm0 \n\t" // L0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2344 "movq (%0, %2), %%mm1 \n\t" // L1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2345 "movq (%0, %2, 2), %%mm2 \n\t" // L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2346 "movq (%0, %%"REG_a"), %%mm3 \n\t" // L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2347 "movq (%0, %2, 4), %%mm4 \n\t" // L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2348 "movq (%0, %%"REG_d"), %%mm5 \n\t" // L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2349 "movq (%0, %%"REG_a", 2), %%mm6 \n\t" // L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2350 "movq (%0, %%"REG_c"), %%mm7 \n\t" // L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2351 "movq %%mm0, (%1) \n\t" // L0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2352 "movq %%mm1, (%1, %2) \n\t" // L1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2353 "movq %%mm2, (%1, %2, 2) \n\t" // L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2354 "movq %%mm3, (%1, %%"REG_a") \n\t" // L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2355 "movq %%mm4, (%1, %2, 4) \n\t" // L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2356 "movq %%mm5, (%1, %%"REG_d") \n\t" // L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2357 "movq %%mm6, (%1, %%"REG_a", 2) \n\t" // L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2358 "movq %%mm7, (%1, %%"REG_c") \n\t" // L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2359 "jmp 4f \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2360
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2361 "1: \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2362 "lea (%%"REG_a", %2, 2), %%"REG_d" \n\t" // 5*stride
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2363 "lea (%%"REG_d", %2, 2), %%"REG_c" \n\t" // 7*stride
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2364 "movq (%0), %%mm0 \n\t" // L0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2365 PAVGB((%1), %%mm0) // L0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2366 "movq (%0, %2), %%mm1 \n\t" // L1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2367 PAVGB((%1, %2), %%mm1) // L1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2368 "movq (%0, %2, 2), %%mm2 \n\t" // L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2369 PAVGB((%1, %2, 2), %%mm2) // L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2370 "movq (%0, %%"REG_a"), %%mm3 \n\t" // L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2371 PAVGB((%1, %%REGa), %%mm3) // L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2372 "movq (%0, %2, 4), %%mm4 \n\t" // L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2373 PAVGB((%1, %2, 4), %%mm4) // L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2374 "movq (%0, %%"REG_d"), %%mm5 \n\t" // L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2375 PAVGB((%1, %%REGd), %%mm5) // L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2376 "movq (%0, %%"REG_a", 2), %%mm6 \n\t" // L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2377 PAVGB((%1, %%REGa, 2), %%mm6) // L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2378 "movq (%0, %%"REG_c"), %%mm7 \n\t" // L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2379 PAVGB((%1, %%REGc), %%mm7) // L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2380 "movq %%mm0, (%1) \n\t" // R0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2381 "movq %%mm1, (%1, %2) \n\t" // R1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2382 "movq %%mm2, (%1, %2, 2) \n\t" // R2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2383 "movq %%mm3, (%1, %%"REG_a") \n\t" // R3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2384 "movq %%mm4, (%1, %2, 4) \n\t" // R4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2385 "movq %%mm5, (%1, %%"REG_d") \n\t" // R5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2386 "movq %%mm6, (%1, %%"REG_a", 2) \n\t" // R6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2387 "movq %%mm7, (%1, %%"REG_c") \n\t" // R7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2388 "movq %%mm0, (%0) \n\t" // L0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2389 "movq %%mm1, (%0, %2) \n\t" // L1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2390 "movq %%mm2, (%0, %2, 2) \n\t" // L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2391 "movq %%mm3, (%0, %%"REG_a") \n\t" // L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2392 "movq %%mm4, (%0, %2, 4) \n\t" // L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2393 "movq %%mm5, (%0, %%"REG_d") \n\t" // L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2394 "movq %%mm6, (%0, %%"REG_a", 2) \n\t" // L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2395 "movq %%mm7, (%0, %%"REG_c") \n\t" // L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2396 "jmp 4f \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2397
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2398 "2: \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2399 "cmpl 508(%%"REG_d"), %%ecx \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2400 " jb 3f \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2401
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2402 "lea (%%"REG_a", %2, 2), %%"REG_d" \n\t" // 5*stride
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2403 "lea (%%"REG_d", %2, 2), %%"REG_c" \n\t" // 7*stride
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2404 "movq (%0), %%mm0 \n\t" // L0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2405 "movq (%0, %2), %%mm1 \n\t" // L1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2406 "movq (%0, %2, 2), %%mm2 \n\t" // L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2407 "movq (%0, %%"REG_a"), %%mm3 \n\t" // L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2408 "movq (%1), %%mm4 \n\t" // R0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2409 "movq (%1, %2), %%mm5 \n\t" // R1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2410 "movq (%1, %2, 2), %%mm6 \n\t" // R2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2411 "movq (%1, %%"REG_a"), %%mm7 \n\t" // R3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2412 PAVGB(%%mm4, %%mm0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2413 PAVGB(%%mm5, %%mm1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2414 PAVGB(%%mm6, %%mm2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2415 PAVGB(%%mm7, %%mm3)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2416 PAVGB(%%mm4, %%mm0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2417 PAVGB(%%mm5, %%mm1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2418 PAVGB(%%mm6, %%mm2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2419 PAVGB(%%mm7, %%mm3)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2420 "movq %%mm0, (%1) \n\t" // R0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2421 "movq %%mm1, (%1, %2) \n\t" // R1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2422 "movq %%mm2, (%1, %2, 2) \n\t" // R2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2423 "movq %%mm3, (%1, %%"REG_a") \n\t" // R3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2424 "movq %%mm0, (%0) \n\t" // L0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2425 "movq %%mm1, (%0, %2) \n\t" // L1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2426 "movq %%mm2, (%0, %2, 2) \n\t" // L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2427 "movq %%mm3, (%0, %%"REG_a") \n\t" // L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2428
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2429 "movq (%0, %2, 4), %%mm0 \n\t" // L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2430 "movq (%0, %%"REG_d"), %%mm1 \n\t" // L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2431 "movq (%0, %%"REG_a", 2), %%mm2 \n\t" // L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2432 "movq (%0, %%"REG_c"), %%mm3 \n\t" // L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2433 "movq (%1, %2, 4), %%mm4 \n\t" // R4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2434 "movq (%1, %%"REG_d"), %%mm5 \n\t" // R5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2435 "movq (%1, %%"REG_a", 2), %%mm6 \n\t" // R6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2436 "movq (%1, %%"REG_c"), %%mm7 \n\t" // R7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2437 PAVGB(%%mm4, %%mm0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2438 PAVGB(%%mm5, %%mm1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2439 PAVGB(%%mm6, %%mm2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2440 PAVGB(%%mm7, %%mm3)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2441 PAVGB(%%mm4, %%mm0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2442 PAVGB(%%mm5, %%mm1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2443 PAVGB(%%mm6, %%mm2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2444 PAVGB(%%mm7, %%mm3)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2445 "movq %%mm0, (%1, %2, 4) \n\t" // R4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2446 "movq %%mm1, (%1, %%"REG_d") \n\t" // R5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2447 "movq %%mm2, (%1, %%"REG_a", 2) \n\t" // R6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2448 "movq %%mm3, (%1, %%"REG_c") \n\t" // R7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2449 "movq %%mm0, (%0, %2, 4) \n\t" // L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2450 "movq %%mm1, (%0, %%"REG_d") \n\t" // L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2451 "movq %%mm2, (%0, %%"REG_a", 2) \n\t" // L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2452 "movq %%mm3, (%0, %%"REG_c") \n\t" // L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2453 "jmp 4f \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2454
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2455 "3: \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2456 "lea (%%"REG_a", %2, 2), %%"REG_d" \n\t" // 5*stride
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2457 "lea (%%"REG_d", %2, 2), %%"REG_c" \n\t" // 7*stride
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2458 "movq (%0), %%mm0 \n\t" // L0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2459 "movq (%0, %2), %%mm1 \n\t" // L1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2460 "movq (%0, %2, 2), %%mm2 \n\t" // L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2461 "movq (%0, %%"REG_a"), %%mm3 \n\t" // L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2462 "movq (%1), %%mm4 \n\t" // R0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2463 "movq (%1, %2), %%mm5 \n\t" // R1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2464 "movq (%1, %2, 2), %%mm6 \n\t" // R2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2465 "movq (%1, %%"REG_a"), %%mm7 \n\t" // R3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2466 PAVGB(%%mm4, %%mm0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2467 PAVGB(%%mm5, %%mm1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2468 PAVGB(%%mm6, %%mm2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2469 PAVGB(%%mm7, %%mm3)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2470 PAVGB(%%mm4, %%mm0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2471 PAVGB(%%mm5, %%mm1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2472 PAVGB(%%mm6, %%mm2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2473 PAVGB(%%mm7, %%mm3)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2474 PAVGB(%%mm4, %%mm0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2475 PAVGB(%%mm5, %%mm1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2476 PAVGB(%%mm6, %%mm2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2477 PAVGB(%%mm7, %%mm3)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2478 "movq %%mm0, (%1) \n\t" // R0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2479 "movq %%mm1, (%1, %2) \n\t" // R1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2480 "movq %%mm2, (%1, %2, 2) \n\t" // R2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2481 "movq %%mm3, (%1, %%"REG_a") \n\t" // R3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2482 "movq %%mm0, (%0) \n\t" // L0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2483 "movq %%mm1, (%0, %2) \n\t" // L1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2484 "movq %%mm2, (%0, %2, 2) \n\t" // L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2485 "movq %%mm3, (%0, %%"REG_a") \n\t" // L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2486
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2487 "movq (%0, %2, 4), %%mm0 \n\t" // L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2488 "movq (%0, %%"REG_d"), %%mm1 \n\t" // L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2489 "movq (%0, %%"REG_a", 2), %%mm2 \n\t" // L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2490 "movq (%0, %%"REG_c"), %%mm3 \n\t" // L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2491 "movq (%1, %2, 4), %%mm4 \n\t" // R4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2492 "movq (%1, %%"REG_d"), %%mm5 \n\t" // R5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2493 "movq (%1, %%"REG_a", 2), %%mm6 \n\t" // R6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2494 "movq (%1, %%"REG_c"), %%mm7 \n\t" // R7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2495 PAVGB(%%mm4, %%mm0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2496 PAVGB(%%mm5, %%mm1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2497 PAVGB(%%mm6, %%mm2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2498 PAVGB(%%mm7, %%mm3)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2499 PAVGB(%%mm4, %%mm0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2500 PAVGB(%%mm5, %%mm1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2501 PAVGB(%%mm6, %%mm2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2502 PAVGB(%%mm7, %%mm3)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2503 PAVGB(%%mm4, %%mm0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2504 PAVGB(%%mm5, %%mm1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2505 PAVGB(%%mm6, %%mm2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2506 PAVGB(%%mm7, %%mm3)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2507 "movq %%mm0, (%1, %2, 4) \n\t" // R4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2508 "movq %%mm1, (%1, %%"REG_d") \n\t" // R5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2509 "movq %%mm2, (%1, %%"REG_a", 2) \n\t" // R6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2510 "movq %%mm3, (%1, %%"REG_c") \n\t" // R7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2511 "movq %%mm0, (%0, %2, 4) \n\t" // L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2512 "movq %%mm1, (%0, %%"REG_d") \n\t" // L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2513 "movq %%mm2, (%0, %%"REG_a", 2) \n\t" // L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2514 "movq %%mm3, (%0, %%"REG_c") \n\t" // L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2515
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2516 "4: \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2517
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2518 :: "r" (src), "r" (tempBlured), "r"((long)stride), "m" (tempBluredPast)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2519 : "%"REG_a, "%"REG_d, "%"REG_c, "memory"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2520 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2521 #else //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2522 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2523 int y;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2524 int d=0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2525 // int sysd=0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2526 int i;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2527
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2528 for(y=0; y<8; y++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2529 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2530 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2531 for(x=0; x<8; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2532 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2533 int ref= tempBlured[ x + y*stride ];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2534 int cur= src[ x + y*stride ];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2535 int d1=ref - cur;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2536 // if(x==0 || x==7) d1+= d1>>1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2537 // if(y==0 || y==7) d1+= d1>>1;
32
cb746db3fd32 Rename ABS macro to FFABS.
diego
parents: 31
diff changeset
2538 // d+= FFABS(d1);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2539 d+= d1*d1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2540 // sysd+= d1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2541 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2542 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2543 i=d;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2544 d= (
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2545 4*d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2546 +(*(tempBluredPast-256))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2547 +(*(tempBluredPast-1))+ (*(tempBluredPast+1))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2548 +(*(tempBluredPast+256))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2549 +4)>>3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2550 *tempBluredPast=i;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2551 // ((*tempBluredPast)*3 + d + 2)>>2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2552
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2553 /*
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2554 Switch between
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2555 1 0 0 0 0 0 0 (0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2556 64 32 16 8 4 2 1 (1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2557 64 48 36 27 20 15 11 (33) (approx)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2558 64 56 49 43 37 33 29 (200) (approx)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2559 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2560 if(d > maxNoise[1])
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2561 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2562 if(d < maxNoise[2])
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2563 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2564 for(y=0; y<8; y++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2565 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2566 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2567 for(x=0; x<8; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2568 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2569 int ref= tempBlured[ x + y*stride ];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2570 int cur= src[ x + y*stride ];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2571 tempBlured[ x + y*stride ]=
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2572 src[ x + y*stride ]=
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2573 (ref + cur + 1)>>1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2574 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2575 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2576 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2577 else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2578 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2579 for(y=0; y<8; y++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2580 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2581 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2582 for(x=0; x<8; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2583 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2584 tempBlured[ x + y*stride ]= src[ x + y*stride ];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2585 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2586 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2587 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2588 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2589 else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2590 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2591 if(d < maxNoise[0])
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2592 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2593 for(y=0; y<8; y++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2594 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2595 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2596 for(x=0; x<8; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2597 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2598 int ref= tempBlured[ x + y*stride ];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2599 int cur= src[ x + y*stride ];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2600 tempBlured[ x + y*stride ]=
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2601 src[ x + y*stride ]=
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2602 (ref*7 + cur + 4)>>3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2603 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2604 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2605 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2606 else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2607 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2608 for(y=0; y<8; y++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2609 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2610 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2611 for(x=0; x<8; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2612 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2613 int ref= tempBlured[ x + y*stride ];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2614 int cur= src[ x + y*stride ];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2615 tempBlured[ x + y*stride ]=
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2616 src[ x + y*stride ]=
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2617 (ref*3 + cur + 2)>>2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2618 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2619 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2620 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2621 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2622 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2623 #endif //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2624 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2625 #endif //HAVE_ALTIVEC
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2626
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2627 #ifdef HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2628 /**
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2629 * accurate deblock filter
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2630 */
38
63d07317cd7a rename always_inline to av_always_inline and move to common.h
mru
parents: 32
diff changeset
2631 static av_always_inline void RENAME(do_a_deblock)(uint8_t *src, int step, int stride, PPContext *c){
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2632 int64_t dc_mask, eq_mask, both_masks;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2633 int64_t sums[10*8*2];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2634 src+= step*3; // src points to begin of the 8x8 Block
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2635 //START_TIMER
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2636 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2637 "movq %0, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2638 "movq %1, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2639 : : "m" (c->mmxDcOffset[c->nonBQP]), "m" (c->mmxDcThreshold[c->nonBQP])
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2640 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2641
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2642 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2643 "lea (%2, %3), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2644 // 0 1 2 3 4 5 6 7 8 9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2645 // %1 eax eax+%2 eax+2%2 %1+4%2 ecx ecx+%2 ecx+2%2 %1+8%2 ecx+4%2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2646
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2647 "movq (%2), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2648 "movq (%%"REG_a"), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2649 "movq %%mm1, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2650 "movq %%mm1, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2651 "psubb %%mm1, %%mm0 \n\t" // mm0 = differnece
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2652 "paddb %%mm7, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2653 "pcmpgtb %%mm6, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2654
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2655 "movq (%%"REG_a",%3), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2656 PMAXUB(%%mm2, %%mm4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2657 PMINUB(%%mm2, %%mm3, %%mm5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2658 "psubb %%mm2, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2659 "paddb %%mm7, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2660 "pcmpgtb %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2661 "paddb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2662
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2663 "movq (%%"REG_a", %3, 2), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2664 PMAXUB(%%mm1, %%mm4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2665 PMINUB(%%mm1, %%mm3, %%mm5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2666 "psubb %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2667 "paddb %%mm7, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2668 "pcmpgtb %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2669 "paddb %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2670
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2671 "lea (%%"REG_a", %3, 4), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2672
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2673 "movq (%2, %3, 4), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2674 PMAXUB(%%mm2, %%mm4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2675 PMINUB(%%mm2, %%mm3, %%mm5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2676 "psubb %%mm2, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2677 "paddb %%mm7, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2678 "pcmpgtb %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2679 "paddb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2680
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2681 "movq (%%"REG_a"), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2682 PMAXUB(%%mm1, %%mm4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2683 PMINUB(%%mm1, %%mm3, %%mm5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2684 "psubb %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2685 "paddb %%mm7, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2686 "pcmpgtb %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2687 "paddb %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2688
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2689 "movq (%%"REG_a", %3), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2690 PMAXUB(%%mm2, %%mm4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2691 PMINUB(%%mm2, %%mm3, %%mm5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2692 "psubb %%mm2, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2693 "paddb %%mm7, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2694 "pcmpgtb %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2695 "paddb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2696
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2697 "movq (%%"REG_a", %3, 2), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2698 PMAXUB(%%mm1, %%mm4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2699 PMINUB(%%mm1, %%mm3, %%mm5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2700 "psubb %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2701 "paddb %%mm7, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2702 "pcmpgtb %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2703 "paddb %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2704
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2705 "movq (%2, %3, 8), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2706 PMAXUB(%%mm2, %%mm4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2707 PMINUB(%%mm2, %%mm3, %%mm5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2708 "psubb %%mm2, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2709 "paddb %%mm7, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2710 "pcmpgtb %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2711 "paddb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2712
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2713 "movq (%%"REG_a", %3, 4), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2714 "psubb %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2715 "paddb %%mm7, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2716 "pcmpgtb %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2717 "paddb %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2718 "psubusb %%mm3, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2719
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2720 "pxor %%mm6, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2721 "movq %4, %%mm7 \n\t" // QP,..., QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2722 "paddusb %%mm7, %%mm7 \n\t" // 2QP ... 2QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2723 "psubusb %%mm4, %%mm7 \n\t" // Diff >=2QP -> 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2724 "pcmpeqb %%mm6, %%mm7 \n\t" // Diff < 2QP -> 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2725 "pcmpeqb %%mm6, %%mm7 \n\t" // Diff < 2QP -> 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2726 "movq %%mm7, %1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2727
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2728 "movq %5, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2729 "punpcklbw %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2730 "punpcklbw %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2731 "punpcklbw %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2732 "psubb %%mm0, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2733 "pcmpgtb %%mm7, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2734 "movq %%mm6, %0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2735
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2736 : "=m" (eq_mask), "=m" (dc_mask)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2737 : "r" (src), "r" ((long)step), "m" (c->pQPb), "m"(c->ppMode.flatnessThreshold)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2738 : "%"REG_a
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2739 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2740
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2741 both_masks = dc_mask & eq_mask;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2742
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2743 if(both_masks){
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2744 long offset= -8*step;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2745 int64_t *temp_sums= sums;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2746
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2747 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2748 "movq %2, %%mm0 \n\t" // QP,..., QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2749 "pxor %%mm4, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2750
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2751 "movq (%0), %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2752 "movq (%0, %1), %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2753 "movq %%mm5, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2754 "movq %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2755 "psubusb %%mm6, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2756 "psubusb %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2757 "por %%mm5, %%mm2 \n\t" // ABS Diff of lines
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2758 "psubusb %%mm2, %%mm0 \n\t" // diff >= QP -> 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2759 "pcmpeqb %%mm4, %%mm0 \n\t" // diff >= QP -> FF
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2760
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2761 "pxor %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2762 "pand %%mm0, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2763 "pxor %%mm1, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2764 // 0:QP 6:First
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2765
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2766 "movq (%0, %1, 8), %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2767 "add %1, %0 \n\t" // %0 points to line 1 not 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2768 "movq (%0, %1, 8), %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2769 "movq %%mm5, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2770 "movq %%mm7, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2771 "psubusb %%mm7, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2772 "psubusb %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2773 "por %%mm5, %%mm2 \n\t" // ABS Diff of lines
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2774 "movq %2, %%mm0 \n\t" // QP,..., QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2775 "psubusb %%mm2, %%mm0 \n\t" // diff >= QP -> 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2776 "pcmpeqb %%mm4, %%mm0 \n\t" // diff >= QP -> FF
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2777
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2778 "pxor %%mm7, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2779 "pand %%mm0, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2780 "pxor %%mm1, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2781
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2782 "movq %%mm6, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2783 "punpckhbw %%mm4, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2784 "punpcklbw %%mm4, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2785 // 4:0 5/6:First 7:Last
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2786
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2787 "movq %%mm5, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2788 "movq %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2789 "psllw $2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2790 "psllw $2, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2791 "paddw "MANGLE(w04)", %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2792 "paddw "MANGLE(w04)", %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2793
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2794 #define NEXT\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2795 "movq (%0), %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2796 "movq (%0), %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2797 "add %1, %0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2798 "punpcklbw %%mm4, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2799 "punpckhbw %%mm4, %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2800 "paddw %%mm2, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2801 "paddw %%mm3, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2802
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2803 #define PREV\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2804 "movq (%0), %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2805 "movq (%0), %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2806 "add %1, %0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2807 "punpcklbw %%mm4, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2808 "punpckhbw %%mm4, %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2809 "psubw %%mm2, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2810 "psubw %%mm3, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2811
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2812
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2813 NEXT //0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2814 NEXT //1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2815 NEXT //2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2816 "movq %%mm0, (%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2817 "movq %%mm1, 8(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2818
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2819 NEXT //3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2820 "psubw %%mm5, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2821 "psubw %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2822 "movq %%mm0, 16(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2823 "movq %%mm1, 24(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2824
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2825 NEXT //4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2826 "psubw %%mm5, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2827 "psubw %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2828 "movq %%mm0, 32(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2829 "movq %%mm1, 40(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2830
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2831 NEXT //5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2832 "psubw %%mm5, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2833 "psubw %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2834 "movq %%mm0, 48(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2835 "movq %%mm1, 56(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2836
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2837 NEXT //6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2838 "psubw %%mm5, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2839 "psubw %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2840 "movq %%mm0, 64(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2841 "movq %%mm1, 72(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2842
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2843 "movq %%mm7, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2844 "punpckhbw %%mm4, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2845 "punpcklbw %%mm4, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2846
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2847 NEXT //7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2848 "mov %4, %0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2849 "add %1, %0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2850 PREV //0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2851 "movq %%mm0, 80(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2852 "movq %%mm1, 88(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2853
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2854 PREV //1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2855 "paddw %%mm6, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2856 "paddw %%mm7, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2857 "movq %%mm0, 96(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2858 "movq %%mm1, 104(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2859
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2860 PREV //2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2861 "paddw %%mm6, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2862 "paddw %%mm7, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2863 "movq %%mm0, 112(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2864 "movq %%mm1, 120(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2865
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2866 PREV //3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2867 "paddw %%mm6, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2868 "paddw %%mm7, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2869 "movq %%mm0, 128(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2870 "movq %%mm1, 136(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2871
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2872 PREV //4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2873 "paddw %%mm6, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2874 "paddw %%mm7, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2875 "movq %%mm0, 144(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2876 "movq %%mm1, 152(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2877
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2878 "mov %4, %0 \n\t" //FIXME
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2879
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2880 : "+&r"(src)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2881 : "r" ((long)step), "m" (c->pQPb), "r"(sums), "g"(src)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2882 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2883
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2884 src+= step; // src points to begin of the 8x8 Block
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2885
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2886 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2887 "movq %4, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2888 "pcmpeqb %%mm5, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2889 "pxor %%mm6, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2890 "pxor %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2891
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2892 "1: \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2893 "movq (%1), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2894 "movq 8(%1), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2895 "paddw 32(%1), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2896 "paddw 40(%1), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2897 "movq (%0, %3), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2898 "movq %%mm2, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2899 "movq %%mm2, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2900 "punpcklbw %%mm7, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2901 "punpckhbw %%mm7, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2902 "paddw %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2903 "paddw %%mm3, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2904 "paddw %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2905 "paddw %%mm3, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2906 "psrlw $4, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2907 "psrlw $4, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2908 "packuswb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2909 "pand %%mm6, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2910 "pand %%mm5, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2911 "por %%mm4, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2912 "movq %%mm0, (%0, %3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2913 "add $16, %1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2914 "add %2, %0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2915 " js 1b \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2916
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2917 : "+r"(offset), "+r"(temp_sums)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2918 : "r" ((long)step), "r"(src - offset), "m"(both_masks)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2919 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2920 }else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2921 src+= step; // src points to begin of the 8x8 Block
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2922
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2923 if(eq_mask != -1LL){
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2924 uint8_t *temp_src= src;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2925 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2926 "pxor %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2927 "lea -40(%%"REG_SP"), %%"REG_c" \n\t" // make space for 4 8-byte vars
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2928 "and "ALIGN_MASK", %%"REG_c" \n\t" // align
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2929 // 0 1 2 3 4 5 6 7 8 9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2930 // %0 eax eax+%1 eax+2%1 %0+4%1 ecx ecx+%1 ecx+2%1 %1+8%1 ecx+4%1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2931
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2932 "movq (%0), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2933 "movq %%mm0, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2934 "punpcklbw %%mm7, %%mm0 \n\t" // low part of line 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2935 "punpckhbw %%mm7, %%mm1 \n\t" // high part of line 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2936
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2937 "movq (%0, %1), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2938 "lea (%0, %1, 2), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2939 "movq %%mm2, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2940 "punpcklbw %%mm7, %%mm2 \n\t" // low part of line 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2941 "punpckhbw %%mm7, %%mm3 \n\t" // high part of line 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2942
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2943 "movq (%%"REG_a"), %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2944 "movq %%mm4, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2945 "punpcklbw %%mm7, %%mm4 \n\t" // low part of line 2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2946 "punpckhbw %%mm7, %%mm5 \n\t" // high part of line 2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2947
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2948 "paddw %%mm0, %%mm0 \n\t" // 2L0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2949 "paddw %%mm1, %%mm1 \n\t" // 2H0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2950 "psubw %%mm4, %%mm2 \n\t" // L1 - L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2951 "psubw %%mm5, %%mm3 \n\t" // H1 - H2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2952 "psubw %%mm2, %%mm0 \n\t" // 2L0 - L1 + L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2953 "psubw %%mm3, %%mm1 \n\t" // 2H0 - H1 + H2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2954
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2955 "psllw $2, %%mm2 \n\t" // 4L1 - 4L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2956 "psllw $2, %%mm3 \n\t" // 4H1 - 4H2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2957 "psubw %%mm2, %%mm0 \n\t" // 2L0 - 5L1 + 5L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2958 "psubw %%mm3, %%mm1 \n\t" // 2H0 - 5H1 + 5H2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2959
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2960 "movq (%%"REG_a", %1), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2961 "movq %%mm2, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2962 "punpcklbw %%mm7, %%mm2 \n\t" // L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2963 "punpckhbw %%mm7, %%mm3 \n\t" // H3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2964
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2965 "psubw %%mm2, %%mm0 \n\t" // 2L0 - 5L1 + 5L2 - L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2966 "psubw %%mm3, %%mm1 \n\t" // 2H0 - 5H1 + 5H2 - H3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2967 "psubw %%mm2, %%mm0 \n\t" // 2L0 - 5L1 + 5L2 - 2L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2968 "psubw %%mm3, %%mm1 \n\t" // 2H0 - 5H1 + 5H2 - 2H3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2969 "movq %%mm0, (%%"REG_c") \n\t" // 2L0 - 5L1 + 5L2 - 2L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2970 "movq %%mm1, 8(%%"REG_c") \n\t" // 2H0 - 5H1 + 5H2 - 2H3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2971
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2972 "movq (%%"REG_a", %1, 2), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2973 "movq %%mm0, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2974 "punpcklbw %%mm7, %%mm0 \n\t" // L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2975 "punpckhbw %%mm7, %%mm1 \n\t" // H4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2976
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2977 "psubw %%mm0, %%mm2 \n\t" // L3 - L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2978 "psubw %%mm1, %%mm3 \n\t" // H3 - H4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2979 "movq %%mm2, 16(%%"REG_c") \n\t" // L3 - L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2980 "movq %%mm3, 24(%%"REG_c") \n\t" // H3 - H4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2981 "paddw %%mm4, %%mm4 \n\t" // 2L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2982 "paddw %%mm5, %%mm5 \n\t" // 2H2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2983 "psubw %%mm2, %%mm4 \n\t" // 2L2 - L3 + L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2984 "psubw %%mm3, %%mm5 \n\t" // 2H2 - H3 + H4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2985
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2986 "lea (%%"REG_a", %1), %0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2987 "psllw $2, %%mm2 \n\t" // 4L3 - 4L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2988 "psllw $2, %%mm3 \n\t" // 4H3 - 4H4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2989 "psubw %%mm2, %%mm4 \n\t" // 2L2 - 5L3 + 5L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2990 "psubw %%mm3, %%mm5 \n\t" // 2H2 - 5H3 + 5H4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2991 //50 opcodes so far
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2992 "movq (%0, %1, 2), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2993 "movq %%mm2, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2994 "punpcklbw %%mm7, %%mm2 \n\t" // L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2995 "punpckhbw %%mm7, %%mm3 \n\t" // H5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2996 "psubw %%mm2, %%mm4 \n\t" // 2L2 - 5L3 + 5L4 - L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2997 "psubw %%mm3, %%mm5 \n\t" // 2H2 - 5H3 + 5H4 - H5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2998 "psubw %%mm2, %%mm4 \n\t" // 2L2 - 5L3 + 5L4 - 2L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2999 "psubw %%mm3, %%mm5 \n\t" // 2H2 - 5H3 + 5H4 - 2H5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3000
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3001 "movq (%%"REG_a", %1, 4), %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3002 "punpcklbw %%mm7, %%mm6 \n\t" // L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3003 "psubw %%mm6, %%mm2 \n\t" // L5 - L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3004 "movq (%%"REG_a", %1, 4), %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3005 "punpckhbw %%mm7, %%mm6 \n\t" // H6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3006 "psubw %%mm6, %%mm3 \n\t" // H5 - H6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3007
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3008 "paddw %%mm0, %%mm0 \n\t" // 2L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3009 "paddw %%mm1, %%mm1 \n\t" // 2H4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3010 "psubw %%mm2, %%mm0 \n\t" // 2L4 - L5 + L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3011 "psubw %%mm3, %%mm1 \n\t" // 2H4 - H5 + H6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3012
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3013 "psllw $2, %%mm2 \n\t" // 4L5 - 4L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3014 "psllw $2, %%mm3 \n\t" // 4H5 - 4H6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3015 "psubw %%mm2, %%mm0 \n\t" // 2L4 - 5L5 + 5L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3016 "psubw %%mm3, %%mm1 \n\t" // 2H4 - 5H5 + 5H6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3017
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3018 "movq (%0, %1, 4), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3019 "movq %%mm2, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3020 "punpcklbw %%mm7, %%mm2 \n\t" // L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3021 "punpckhbw %%mm7, %%mm3 \n\t" // H7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3022
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3023 "paddw %%mm2, %%mm2 \n\t" // 2L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3024 "paddw %%mm3, %%mm3 \n\t" // 2H7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3025 "psubw %%mm2, %%mm0 \n\t" // 2L4 - 5L5 + 5L6 - 2L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3026 "psubw %%mm3, %%mm1 \n\t" // 2H4 - 5H5 + 5H6 - 2H7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3027
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3028 "movq (%%"REG_c"), %%mm2 \n\t" // 2L0 - 5L1 + 5L2 - 2L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3029 "movq 8(%%"REG_c"), %%mm3 \n\t" // 2H0 - 5H1 + 5H2 - 2H3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3030
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3031 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3032 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3033 "psubw %%mm0, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3034 "pmaxsw %%mm6, %%mm0 \n\t" // |2L4 - 5L5 + 5L6 - 2L7|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3035 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3036 "psubw %%mm1, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3037 "pmaxsw %%mm6, %%mm1 \n\t" // |2H4 - 5H5 + 5H6 - 2H7|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3038 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3039 "psubw %%mm2, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3040 "pmaxsw %%mm6, %%mm2 \n\t" // |2L0 - 5L1 + 5L2 - 2L3|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3041 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3042 "psubw %%mm3, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3043 "pmaxsw %%mm6, %%mm3 \n\t" // |2H0 - 5H1 + 5H2 - 2H3|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3044 #else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3045 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3046 "pcmpgtw %%mm0, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3047 "pxor %%mm6, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3048 "psubw %%mm6, %%mm0 \n\t" // |2L4 - 5L5 + 5L6 - 2L7|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3049 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3050 "pcmpgtw %%mm1, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3051 "pxor %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3052 "psubw %%mm6, %%mm1 \n\t" // |2H4 - 5H5 + 5H6 - 2H7|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3053 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3054 "pcmpgtw %%mm2, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3055 "pxor %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3056 "psubw %%mm6, %%mm2 \n\t" // |2L0 - 5L1 + 5L2 - 2L3|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3057 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3058 "pcmpgtw %%mm3, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3059 "pxor %%mm6, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3060 "psubw %%mm6, %%mm3 \n\t" // |2H0 - 5H1 + 5H2 - 2H3|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3061 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3062
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3063 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3064 "pminsw %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3065 "pminsw %%mm3, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3066 #else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3067 "movq %%mm0, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3068 "psubusw %%mm2, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3069 "psubw %%mm6, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3070 "movq %%mm1, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3071 "psubusw %%mm3, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3072 "psubw %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3073 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3074
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3075 "movd %2, %%mm2 \n\t" // QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3076 "punpcklbw %%mm7, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3077
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3078 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3079 "pcmpgtw %%mm4, %%mm6 \n\t" // sign(2L2 - 5L3 + 5L4 - 2L5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3080 "pxor %%mm6, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3081 "psubw %%mm6, %%mm4 \n\t" // |2L2 - 5L3 + 5L4 - 2L5|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3082 "pcmpgtw %%mm5, %%mm7 \n\t" // sign(2H2 - 5H3 + 5H4 - 2H5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3083 "pxor %%mm7, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3084 "psubw %%mm7, %%mm5 \n\t" // |2H2 - 5H3 + 5H4 - 2H5|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3085 // 100 opcodes
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3086 "psllw $3, %%mm2 \n\t" // 8QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3087 "movq %%mm2, %%mm3 \n\t" // 8QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3088 "pcmpgtw %%mm4, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3089 "pcmpgtw %%mm5, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3090 "pand %%mm2, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3091 "pand %%mm3, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3092
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3093
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3094 "psubusw %%mm0, %%mm4 \n\t" // hd
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3095 "psubusw %%mm1, %%mm5 \n\t" // ld
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3096
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3097
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3098 "movq "MANGLE(w05)", %%mm2 \n\t" // 5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3099 "pmullw %%mm2, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3100 "pmullw %%mm2, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3101 "movq "MANGLE(w20)", %%mm2 \n\t" // 32
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3102 "paddw %%mm2, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3103 "paddw %%mm2, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3104 "psrlw $6, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3105 "psrlw $6, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3106
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3107 "movq 16(%%"REG_c"), %%mm0 \n\t" // L3 - L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3108 "movq 24(%%"REG_c"), %%mm1 \n\t" // H3 - H4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3109
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3110 "pxor %%mm2, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3111 "pxor %%mm3, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3112
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3113 "pcmpgtw %%mm0, %%mm2 \n\t" // sign (L3-L4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3114 "pcmpgtw %%mm1, %%mm3 \n\t" // sign (H3-H4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3115 "pxor %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3116 "pxor %%mm3, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3117 "psubw %%mm2, %%mm0 \n\t" // |L3-L4|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3118 "psubw %%mm3, %%mm1 \n\t" // |H3-H4|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3119 "psrlw $1, %%mm0 \n\t" // |L3 - L4|/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3120 "psrlw $1, %%mm1 \n\t" // |H3 - H4|/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3121
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3122 "pxor %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3123 "pxor %%mm7, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3124 "pand %%mm2, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3125 "pand %%mm3, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3126
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3127 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3128 "pminsw %%mm0, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3129 "pminsw %%mm1, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3130 #else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3131 "movq %%mm4, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3132 "psubusw %%mm0, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3133 "psubw %%mm2, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3134 "movq %%mm5, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3135 "psubusw %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3136 "psubw %%mm2, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3137 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3138 "pxor %%mm6, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3139 "pxor %%mm7, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3140 "psubw %%mm6, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3141 "psubw %%mm7, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3142 "packsswb %%mm5, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3143 "movq %3, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3144 "pandn %%mm4, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3145 "movq (%0), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3146 "paddb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3147 "movq %%mm0, (%0) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3148 "movq (%0, %1), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3149 "psubb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3150 "movq %%mm0, (%0, %1) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3151
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3152 : "+r" (temp_src)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3153 : "r" ((long)step), "m" (c->pQPb), "m"(eq_mask)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3154 : "%"REG_a, "%"REG_c
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3155 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3156 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3157 /*if(step==16){
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3158 STOP_TIMER("step16")
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3159 }else{
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3160 STOP_TIMER("stepX")
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3161 }*/
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3162 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3163 #endif //HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3164
78
michael
parents: 55
diff changeset
3165 static void RENAME(postProcess)(const uint8_t src[], int srcStride, uint8_t dst[], int dstStride, int width, int height,
michael
parents: 55
diff changeset
3166 const QP_STORE_T QPs[], int QPStride, int isColor, PPContext *c);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3167
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3168 /**
48
72675332ed82 misc spelling fixes
diego
parents: 45
diff changeset
3169 * Copies a block from src to dst and fixes the blacklevel.
72675332ed82 misc spelling fixes
diego
parents: 45
diff changeset
3170 * levelFix == 0 -> do not touch the brighness & contrast
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3171 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3172 #undef SCALED_CPY
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3173
78
michael
parents: 55
diff changeset
3174 static inline void RENAME(blockCopy)(uint8_t dst[], int dstStride, const uint8_t src[], int srcStride,
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3175 int levelFix, int64_t *packedOffsetAndScale)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3176 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3177 #ifndef HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3178 int i;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3179 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3180 if(levelFix)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3181 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3182 #ifdef HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3183 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3184 "movq (%%"REG_a"), %%mm2 \n\t" // packedYOffset
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3185 "movq 8(%%"REG_a"), %%mm3 \n\t" // packedYScale
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3186 "lea (%2,%4), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3187 "lea (%3,%5), %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3188 "pxor %%mm4, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3189 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3190 #define REAL_SCALED_CPY(src1, src2, dst1, dst2) \
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3191 "movq " #src1 ", %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3192 "movq " #src1 ", %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3193 "movq " #src2 ", %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3194 "movq " #src2 ", %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3195 "punpcklbw %%mm0, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3196 "punpckhbw %%mm5, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3197 "punpcklbw %%mm1, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3198 "punpckhbw %%mm6, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3199 "pmulhuw %%mm3, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3200 "pmulhuw %%mm3, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3201 "pmulhuw %%mm3, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3202 "pmulhuw %%mm3, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3203 "psubw %%mm2, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3204 "psubw %%mm2, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3205 "psubw %%mm2, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3206 "psubw %%mm2, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3207 "packuswb %%mm5, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3208 "packuswb %%mm6, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3209 "movq %%mm0, " #dst1 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3210 "movq %%mm1, " #dst2 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3211
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3212 #else //HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3213 #define REAL_SCALED_CPY(src1, src2, dst1, dst2) \
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3214 "movq " #src1 ", %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3215 "movq " #src1 ", %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3216 "punpcklbw %%mm4, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3217 "punpckhbw %%mm4, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3218 "psubw %%mm2, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3219 "psubw %%mm2, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3220 "movq " #src2 ", %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3221 "psllw $6, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3222 "psllw $6, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3223 "pmulhw %%mm3, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3224 "movq " #src2 ", %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3225 "pmulhw %%mm3, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3226 "punpcklbw %%mm4, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3227 "punpckhbw %%mm4, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3228 "psubw %%mm2, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3229 "psubw %%mm2, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3230 "psllw $6, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3231 "psllw $6, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3232 "pmulhw %%mm3, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3233 "pmulhw %%mm3, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3234 "packuswb %%mm5, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3235 "packuswb %%mm6, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3236 "movq %%mm0, " #dst1 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3237 "movq %%mm1, " #dst2 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3238
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3239 #endif //HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3240 #define SCALED_CPY(src1, src2, dst1, dst2)\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3241 REAL_SCALED_CPY(src1, src2, dst1, dst2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3242
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3243 SCALED_CPY((%2) , (%2, %4) , (%3) , (%3, %5))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3244 SCALED_CPY((%2, %4, 2), (%%REGa, %4, 2), (%3, %5, 2), (%%REGd, %5, 2))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3245 SCALED_CPY((%2, %4, 4), (%%REGa, %4, 4), (%3, %5, 4), (%%REGd, %5, 4))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3246 "lea (%%"REG_a",%4,4), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3247 "lea (%%"REG_d",%5,4), %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3248 SCALED_CPY((%%REGa, %4), (%%REGa, %4, 2), (%%REGd, %5), (%%REGd, %5, 2))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3249
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3250
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3251 : "=&a" (packedOffsetAndScale)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3252 : "0" (packedOffsetAndScale),
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3253 "r"(src),
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3254 "r"(dst),
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3255 "r" ((long)srcStride),
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3256 "r" ((long)dstStride)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3257 : "%"REG_d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3258 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3259 #else //HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3260 for(i=0; i<8; i++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3261 memcpy( &(dst[dstStride*i]),
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3262 &(src[srcStride*i]), BLOCK_SIZE);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3263 #endif //HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3264 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3265 else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3266 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3267 #ifdef HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3268 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3269 "lea (%0,%2), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3270 "lea (%1,%3), %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3271
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3272 #define REAL_SIMPLE_CPY(src1, src2, dst1, dst2) \
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3273 "movq " #src1 ", %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3274 "movq " #src2 ", %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3275 "movq %%mm0, " #dst1 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3276 "movq %%mm1, " #dst2 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3277
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3278 #define SIMPLE_CPY(src1, src2, dst1, dst2)\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3279 REAL_SIMPLE_CPY(src1, src2, dst1, dst2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3280
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3281 SIMPLE_CPY((%0) , (%0, %2) , (%1) , (%1, %3))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3282 SIMPLE_CPY((%0, %2, 2), (%%REGa, %2, 2), (%1, %3, 2), (%%REGd, %3, 2))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3283 SIMPLE_CPY((%0, %2, 4), (%%REGa, %2, 4), (%1, %3, 4), (%%REGd, %3, 4))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3284 "lea (%%"REG_a",%2,4), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3285 "lea (%%"REG_d",%3,4), %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3286 SIMPLE_CPY((%%REGa, %2), (%%REGa, %2, 2), (%%REGd, %3), (%%REGd, %3, 2))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3287
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3288 : : "r" (src),
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3289 "r" (dst),
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3290 "r" ((long)srcStride),
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3291 "r" ((long)dstStride)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3292 : "%"REG_a, "%"REG_d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3293 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3294 #else //HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3295 for(i=0; i<8; i++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3296 memcpy( &(dst[dstStride*i]),
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3297 &(src[srcStride*i]), BLOCK_SIZE);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3298 #endif //HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3299 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3300 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3301
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3302 /**
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3303 * Duplicates the given 8 src pixels ? times upward
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3304 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3305 static inline void RENAME(duplicate)(uint8_t src[], int stride)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3306 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3307 #ifdef HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3308 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3309 "movq (%0), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3310 "add %1, %0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3311 "movq %%mm0, (%0) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3312 "movq %%mm0, (%0, %1) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3313 "movq %%mm0, (%0, %1, 2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3314 : "+r" (src)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3315 : "r" ((long)-stride)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3316 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3317 #else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3318 int i;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3319 uint8_t *p=src;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3320 for(i=0; i<3; i++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3321 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3322 p-= stride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3323 memcpy(p, src, 8);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3324 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3325 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3326 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3327
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3328 /**
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3329 * Filters array of bytes (Y or U or V values)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3330 */
78
michael
parents: 55
diff changeset
3331 static void RENAME(postProcess)(const uint8_t src[], int srcStride, uint8_t dst[], int dstStride, int width, int height,
michael
parents: 55
diff changeset
3332 const QP_STORE_T QPs[], int QPStride, int isColor, PPContext *c2)
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3333 {
45
0e28dba3f9e7 Use DECLARE_ALIGNED for alignment in libpostprocess
reimar
parents: 43
diff changeset
3334 DECLARE_ALIGNED(8, PPContext, c)= *c2; //copy to stack for faster access
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3335 int x,y;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3336 #ifdef COMPILE_TIME_MODE
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3337 const int mode= COMPILE_TIME_MODE;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3338 #else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3339 const int mode= isColor ? c.ppMode.chromMode : c.ppMode.lumMode;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3340 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3341 int black=0, white=255; // blackest black and whitest white in the picture
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3342 int QPCorrecture= 256*256;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3343
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3344 int copyAhead;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3345 #ifdef HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3346 int i;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3347 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3348
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3349 const int qpHShift= isColor ? 4-c.hChromaSubSample : 4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3350 const int qpVShift= isColor ? 4-c.vChromaSubSample : 4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3351
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3352 //FIXME remove
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3353 uint64_t * const yHistogram= c.yHistogram;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3354 uint8_t * const tempSrc= srcStride > 0 ? c.tempSrc : c.tempSrc - 23*srcStride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3355 uint8_t * const tempDst= dstStride > 0 ? c.tempDst : c.tempDst - 23*dstStride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3356 //const int mbWidth= isColor ? (width+7)>>3 : (width+15)>>4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3357
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3358 #ifdef HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3359 for(i=0; i<57; i++){
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3360 int offset= ((i*c.ppMode.baseDcDiff)>>8) + 1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3361 int threshold= offset*2 + 1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3362 c.mmxDcOffset[i]= 0x7F - offset;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3363 c.mmxDcThreshold[i]= 0x7F - threshold;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3364 c.mmxDcOffset[i]*= 0x0101010101010101LL;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3365 c.mmxDcThreshold[i]*= 0x0101010101010101LL;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3366 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3367 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3368
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3369 if(mode & CUBIC_IPOL_DEINT_FILTER) copyAhead=16;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3370 else if( (mode & LINEAR_BLEND_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3371 || (mode & FFMPEG_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3372 || (mode & LOWPASS5_DEINT_FILTER)) copyAhead=14;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3373 else if( (mode & V_DEBLOCK)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3374 || (mode & LINEAR_IPOL_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3375 || (mode & MEDIAN_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3376 || (mode & V_A_DEBLOCK)) copyAhead=13;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3377 else if(mode & V_X1_FILTER) copyAhead=11;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3378 // else if(mode & V_RK1_FILTER) copyAhead=10;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3379 else if(mode & DERING) copyAhead=9;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3380 else copyAhead=8;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3381
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3382 copyAhead-= 8;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3383
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3384 if(!isColor)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3385 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3386 uint64_t sum= 0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3387 int i;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3388 uint64_t maxClipped;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3389 uint64_t clipped;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3390 double scale;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3391
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3392 c.frameNum++;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3393 // first frame is fscked so we ignore it
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3394 if(c.frameNum == 1) yHistogram[0]= width*height/64*15/256;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3395
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3396 for(i=0; i<256; i++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3397 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3398 sum+= yHistogram[i];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3399 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3400
43
00ab07579dc3 typos/grammar
diego
parents: 39
diff changeset
3401 /* We always get a completely black picture first. */
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3402 maxClipped= (uint64_t)(sum * c.ppMode.maxClippedThreshold);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3403
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3404 clipped= sum;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3405 for(black=255; black>0; black--)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3406 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3407 if(clipped < maxClipped) break;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3408 clipped-= yHistogram[black];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3409 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3410
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3411 clipped= sum;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3412 for(white=0; white<256; white++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3413 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3414 if(clipped < maxClipped) break;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3415 clipped-= yHistogram[white];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3416 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3417
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3418 scale= (double)(c.ppMode.maxAllowedY - c.ppMode.minAllowedY) / (double)(white-black);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3419
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3420 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3421 c.packedYScale= (uint16_t)(scale*256.0 + 0.5);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3422 c.packedYOffset= (((black*c.packedYScale)>>8) - c.ppMode.minAllowedY) & 0xFFFF;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3423 #else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3424 c.packedYScale= (uint16_t)(scale*1024.0 + 0.5);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3425 c.packedYOffset= (black - c.ppMode.minAllowedY) & 0xFFFF;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3426 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3427
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3428 c.packedYOffset|= c.packedYOffset<<32;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3429 c.packedYOffset|= c.packedYOffset<<16;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3430
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3431 c.packedYScale|= c.packedYScale<<32;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3432 c.packedYScale|= c.packedYScale<<16;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3433
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3434 if(mode & LEVEL_FIX) QPCorrecture= (int)(scale*256*256 + 0.5);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3435 else QPCorrecture= 256*256;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3436 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3437 else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3438 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3439 c.packedYScale= 0x0100010001000100LL;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3440 c.packedYOffset= 0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3441 QPCorrecture= 256*256;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3442 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3443
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3444 /* copy & deinterlace first row of blocks */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3445 y=-BLOCK_SIZE;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3446 {
78
michael
parents: 55
diff changeset
3447 const uint8_t *srcBlock= &(src[y*srcStride]);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3448 uint8_t *dstBlock= tempDst + dstStride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3449
39
2c0d7e00db4d cosmetics: Fix another common typo, gurantee --> guArantee.
diego
parents: 38
diff changeset
3450 // From this point on it is guaranteed that we can read and write 16 lines downward
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3451 // finish 1 block before the next otherwise we might have a problem
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3452 // with the L1 Cache of the P4 ... or only a few blocks at a time or soemthing
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3453 for(x=0; x<width; x+=BLOCK_SIZE)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3454 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3455
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3456 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3457 /*
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3458 prefetchnta(srcBlock + (((x>>2)&6) + 5)*srcStride + 32);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3459 prefetchnta(srcBlock + (((x>>2)&6) + 6)*srcStride + 32);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3460 prefetcht0(dstBlock + (((x>>2)&6) + 5)*dstStride + 32);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3461 prefetcht0(dstBlock + (((x>>2)&6) + 6)*dstStride + 32);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3462 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3463
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3464 asm(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3465 "mov %4, %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3466 "shr $2, %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3467 "and $6, %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3468 "add %5, %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3469 "mov %%"REG_a", %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3470 "imul %1, %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3471 "imul %3, %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3472 "prefetchnta 32(%%"REG_a", %0) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3473 "prefetcht0 32(%%"REG_d", %2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3474 "add %1, %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3475 "add %3, %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3476 "prefetchnta 32(%%"REG_a", %0) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3477 "prefetcht0 32(%%"REG_d", %2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3478 :: "r" (srcBlock), "r" ((long)srcStride), "r" (dstBlock), "r" ((long)dstStride),
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3479 "g" ((long)x), "g" ((long)copyAhead)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3480 : "%"REG_a, "%"REG_d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3481 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3482
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3483 #elif defined(HAVE_3DNOW)
49
cdfe8fc50090 misc typo fixes
diego
parents: 48
diff changeset
3484 //FIXME check if this is faster on an 3dnow chip or if it is faster without the prefetch or ...
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3485 /* prefetch(srcBlock + (((x>>3)&3) + 5)*srcStride + 32);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3486 prefetch(srcBlock + (((x>>3)&3) + 9)*srcStride + 32);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3487 prefetchw(dstBlock + (((x>>3)&3) + 5)*dstStride + 32);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3488 prefetchw(dstBlock + (((x>>3)&3) + 9)*dstStride + 32);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3489 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3490 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3491
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3492 RENAME(blockCopy)(dstBlock + dstStride*8, dstStride,
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3493 srcBlock + srcStride*8, srcStride, mode & LEVEL_FIX, &c.packedYOffset);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3494
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3495 RENAME(duplicate)(dstBlock + dstStride*8, dstStride);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3496
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3497 if(mode & LINEAR_IPOL_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3498 RENAME(deInterlaceInterpolateLinear)(dstBlock, dstStride);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3499 else if(mode & LINEAR_BLEND_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3500 RENAME(deInterlaceBlendLinear)(dstBlock, dstStride, c.deintTemp + x);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3501 else if(mode & MEDIAN_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3502 RENAME(deInterlaceMedian)(dstBlock, dstStride);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3503 else if(mode & CUBIC_IPOL_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3504 RENAME(deInterlaceInterpolateCubic)(dstBlock, dstStride);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3505 else if(mode & FFMPEG_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3506 RENAME(deInterlaceFF)(dstBlock, dstStride, c.deintTemp + x);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3507 else if(mode & LOWPASS5_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3508 RENAME(deInterlaceL5)(dstBlock, dstStride, c.deintTemp + x, c.deintTemp + width + x);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3509 /* else if(mode & CUBIC_BLEND_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3510 RENAME(deInterlaceBlendCubic)(dstBlock, dstStride);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3511 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3512 dstBlock+=8;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3513 srcBlock+=8;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3514 }
32
cb746db3fd32 Rename ABS macro to FFABS.
diego
parents: 31
diff changeset
3515 if(width==FFABS(dstStride))
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3516 linecpy(dst, tempDst + 9*dstStride, copyAhead, dstStride);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3517 else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3518 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3519 int i;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3520 for(i=0; i<copyAhead; i++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3521 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3522 memcpy(dst + i*dstStride, tempDst + (9+i)*dstStride, width);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3523 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3524 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3525 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3526
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3527 for(y=0; y<height; y+=BLOCK_SIZE)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3528 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3529 //1% speedup if these are here instead of the inner loop
78
michael
parents: 55
diff changeset
3530 const uint8_t *srcBlock= &(src[y*srcStride]);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3531 uint8_t *dstBlock= &(dst[y*dstStride]);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3532 #ifdef HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3533 uint8_t *tempBlock1= c.tempBlocks;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3534 uint8_t *tempBlock2= c.tempBlocks + 8;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3535 #endif
78
michael
parents: 55
diff changeset
3536 const int8_t *QPptr= &QPs[(y>>qpVShift)*QPStride];
32
cb746db3fd32 Rename ABS macro to FFABS.
diego
parents: 31
diff changeset
3537 int8_t *nonBQPptr= &c.nonBQPTable[(y>>qpVShift)*FFABS(QPStride)];
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3538 int QP=0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3539 /* can we mess with a 8x16 block from srcBlock/dstBlock downwards and 1 line upwards
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3540 if not than use a temporary buffer */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3541 if(y+15 >= height)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3542 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3543 int i;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3544 /* copy from line (copyAhead) to (copyAhead+7) of src, these will be copied with
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3545 blockcopy to dst later */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3546 linecpy(tempSrc + srcStride*copyAhead, srcBlock + srcStride*copyAhead,
27
c83a71c1729d Change libpostproc to use the FFMIN/FFMAX macros from libavutil.
diego
parents: 22
diff changeset
3547 FFMAX(height-y-copyAhead, 0), srcStride);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3548
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3549 /* duplicate last line of src to fill the void upto line (copyAhead+7) */
27
c83a71c1729d Change libpostproc to use the FFMIN/FFMAX macros from libavutil.
diego
parents: 22
diff changeset
3550 for(i=FFMAX(height-y, 8); i<copyAhead+8; i++)
32
cb746db3fd32 Rename ABS macro to FFABS.
diego
parents: 31
diff changeset
3551 memcpy(tempSrc + srcStride*i, src + srcStride*(height-1), FFABS(srcStride));
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3552
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3553 /* copy up to (copyAhead+1) lines of dst (line -1 to (copyAhead-1))*/
27
c83a71c1729d Change libpostproc to use the FFMIN/FFMAX macros from libavutil.
diego
parents: 22
diff changeset
3554 linecpy(tempDst, dstBlock - dstStride, FFMIN(height-y+1, copyAhead+1), dstStride);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3555
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3556 /* duplicate last line of dst to fill the void upto line (copyAhead) */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3557 for(i=height-y+1; i<=copyAhead; i++)
32
cb746db3fd32 Rename ABS macro to FFABS.
diego
parents: 31
diff changeset
3558 memcpy(tempDst + dstStride*i, dst + dstStride*(height-1), FFABS(dstStride));
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3559
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3560 dstBlock= tempDst + dstStride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3561 srcBlock= tempSrc;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3562 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3563
39
2c0d7e00db4d cosmetics: Fix another common typo, gurantee --> guArantee.
diego
parents: 38
diff changeset
3564 // From this point on it is guaranteed that we can read and write 16 lines downward
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3565 // finish 1 block before the next otherwise we might have a problem
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3566 // with the L1 Cache of the P4 ... or only a few blocks at a time or soemthing
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3567 for(x=0; x<width; x+=BLOCK_SIZE)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3568 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3569 const int stride= dstStride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3570 #ifdef HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3571 uint8_t *tmpXchg;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3572 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3573 if(isColor)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3574 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3575 QP= QPptr[x>>qpHShift];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3576 c.nonBQP= nonBQPptr[x>>qpHShift];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3577 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3578 else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3579 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3580 QP= QPptr[x>>4];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3581 QP= (QP* QPCorrecture + 256*128)>>16;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3582 c.nonBQP= nonBQPptr[x>>4];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3583 c.nonBQP= (c.nonBQP* QPCorrecture + 256*128)>>16;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3584 yHistogram[ srcBlock[srcStride*12 + 4] ]++;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3585 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3586 c.QP= QP;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3587 #ifdef HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3588 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3589 "movd %1, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3590 "packuswb %%mm7, %%mm7 \n\t" // 0, 0, 0, QP, 0, 0, 0, QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3591 "packuswb %%mm7, %%mm7 \n\t" // 0,QP, 0, QP, 0,QP, 0, QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3592 "packuswb %%mm7, %%mm7 \n\t" // QP,..., QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3593 "movq %%mm7, %0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3594 : "=m" (c.pQPb)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3595 : "r" (QP)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3596 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3597 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3598
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3599
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3600 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3601 /*
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3602 prefetchnta(srcBlock + (((x>>2)&6) + 5)*srcStride + 32);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3603 prefetchnta(srcBlock + (((x>>2)&6) + 6)*srcStride + 32);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3604 prefetcht0(dstBlock + (((x>>2)&6) + 5)*dstStride + 32);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3605 prefetcht0(dstBlock + (((x>>2)&6) + 6)*dstStride + 32);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3606 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3607
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3608 asm(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3609 "mov %4, %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3610 "shr $2, %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3611 "and $6, %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3612 "add %5, %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3613 "mov %%"REG_a", %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3614 "imul %1, %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3615 "imul %3, %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3616 "prefetchnta 32(%%"REG_a", %0) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3617 "prefetcht0 32(%%"REG_d", %2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3618 "add %1, %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3619 "add %3, %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3620 "prefetchnta 32(%%"REG_a", %0) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3621 "prefetcht0 32(%%"REG_d", %2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3622 :: "r" (srcBlock), "r" ((long)srcStride), "r" (dstBlock), "r" ((long)dstStride),
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3623 "g" ((long)x), "g" ((long)copyAhead)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3624 : "%"REG_a, "%"REG_d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3625 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3626
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3627 #elif defined(HAVE_3DNOW)
49
cdfe8fc50090 misc typo fixes
diego
parents: 48
diff changeset
3628 //FIXME check if this is faster on an 3dnow chip or if it is faster without the prefetch or ...
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3629 /* prefetch(srcBlock + (((x>>3)&3) + 5)*srcStride + 32);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3630 prefetch(srcBlock + (((x>>3)&3) + 9)*srcStride + 32);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3631 prefetchw(dstBlock + (((x>>3)&3) + 5)*dstStride + 32);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3632 prefetchw(dstBlock + (((x>>3)&3) + 9)*dstStride + 32);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3633 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3634 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3635
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3636 RENAME(blockCopy)(dstBlock + dstStride*copyAhead, dstStride,
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3637 srcBlock + srcStride*copyAhead, srcStride, mode & LEVEL_FIX, &c.packedYOffset);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3638
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3639 if(mode & LINEAR_IPOL_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3640 RENAME(deInterlaceInterpolateLinear)(dstBlock, dstStride);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3641 else if(mode & LINEAR_BLEND_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3642 RENAME(deInterlaceBlendLinear)(dstBlock, dstStride, c.deintTemp + x);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3643 else if(mode & MEDIAN_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3644 RENAME(deInterlaceMedian)(dstBlock, dstStride);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3645 else if(mode & CUBIC_IPOL_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3646 RENAME(deInterlaceInterpolateCubic)(dstBlock, dstStride);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3647 else if(mode & FFMPEG_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3648 RENAME(deInterlaceFF)(dstBlock, dstStride, c.deintTemp + x);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3649 else if(mode & LOWPASS5_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3650 RENAME(deInterlaceL5)(dstBlock, dstStride, c.deintTemp + x, c.deintTemp + width + x);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3651 /* else if(mode & CUBIC_BLEND_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3652 RENAME(deInterlaceBlendCubic)(dstBlock, dstStride);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3653 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3654
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3655 /* only deblock if we have 2 blocks */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3656 if(y + 8 < height)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3657 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3658 if(mode & V_X1_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3659 RENAME(vertX1Filter)(dstBlock, stride, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3660 else if(mode & V_DEBLOCK)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3661 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3662 const int t= RENAME(vertClassify)(dstBlock, stride, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3663
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3664 if(t==1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3665 RENAME(doVertLowPass)(dstBlock, stride, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3666 else if(t==2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3667 RENAME(doVertDefFilter)(dstBlock, stride, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3668 }else if(mode & V_A_DEBLOCK){
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3669 RENAME(do_a_deblock)(dstBlock, stride, 1, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3670 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3671 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3672
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3673 #ifdef HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3674 RENAME(transpose1)(tempBlock1, tempBlock2, dstBlock, dstStride);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3675 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3676 /* check if we have a previous block to deblock it with dstBlock */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3677 if(x - 8 >= 0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3678 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3679 #ifdef HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3680 if(mode & H_X1_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3681 RENAME(vertX1Filter)(tempBlock1, 16, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3682 else if(mode & H_DEBLOCK)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3683 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3684 //START_TIMER
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3685 const int t= RENAME(vertClassify)(tempBlock1, 16, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3686 //STOP_TIMER("dc & minmax")
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3687 if(t==1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3688 RENAME(doVertLowPass)(tempBlock1, 16, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3689 else if(t==2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3690 RENAME(doVertDefFilter)(tempBlock1, 16, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3691 }else if(mode & H_A_DEBLOCK){
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3692 RENAME(do_a_deblock)(tempBlock1, 16, 1, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3693 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3694
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3695 RENAME(transpose2)(dstBlock-4, dstStride, tempBlock1 + 4*16);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3696
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3697 #else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3698 if(mode & H_X1_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3699 horizX1Filter(dstBlock-4, stride, QP);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3700 else if(mode & H_DEBLOCK)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3701 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3702 #ifdef HAVE_ALTIVEC
45
0e28dba3f9e7 Use DECLARE_ALIGNED for alignment in libpostprocess
reimar
parents: 43
diff changeset
3703 DECLARE_ALIGNED(16, unsigned char, tempBlock[272]);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3704 transpose_16x8_char_toPackedAlign_altivec(tempBlock, dstBlock - (4 + 1), stride);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3705
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3706 const int t=vertClassify_altivec(tempBlock-48, 16, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3707 if(t==1) {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3708 doVertLowPass_altivec(tempBlock-48, 16, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3709 transpose_8x16_char_fromPackedAlign_altivec(dstBlock - (4 + 1), tempBlock, stride);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3710 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3711 else if(t==2) {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3712 doVertDefFilter_altivec(tempBlock-48, 16, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3713 transpose_8x16_char_fromPackedAlign_altivec(dstBlock - (4 + 1), tempBlock, stride);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3714 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3715 #else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3716 const int t= RENAME(horizClassify)(dstBlock-4, stride, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3717
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3718 if(t==1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3719 RENAME(doHorizLowPass)(dstBlock-4, stride, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3720 else if(t==2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3721 RENAME(doHorizDefFilter)(dstBlock-4, stride, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3722 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3723 }else if(mode & H_A_DEBLOCK){
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3724 RENAME(do_a_deblock)(dstBlock-8, 1, stride, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3725 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3726 #endif //HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3727 if(mode & DERING)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3728 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3729 //FIXME filter first line
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3730 if(y>0) RENAME(dering)(dstBlock - stride - 8, stride, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3731 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3732
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3733 if(mode & TEMP_NOISE_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3734 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3735 RENAME(tempNoiseReducer)(dstBlock-8, stride,
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3736 c.tempBlured[isColor] + y*dstStride + x,
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3737 c.tempBluredPast[isColor] + (y>>3)*256 + (x>>3),
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3738 c.ppMode.maxTmpNoise);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3739 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3740 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3741
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3742 dstBlock+=8;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3743 srcBlock+=8;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3744
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3745 #ifdef HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3746 tmpXchg= tempBlock1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3747 tempBlock1= tempBlock2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3748 tempBlock2 = tmpXchg;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3749 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3750 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3751
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3752 if(mode & DERING)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3753 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3754 if(y > 0) RENAME(dering)(dstBlock - dstStride - 8, dstStride, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3755 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3756
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3757 if((mode & TEMP_NOISE_FILTER))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3758 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3759 RENAME(tempNoiseReducer)(dstBlock-8, dstStride,
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3760 c.tempBlured[isColor] + y*dstStride + x,
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3761 c.tempBluredPast[isColor] + (y>>3)*256 + (x>>3),
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3762 c.ppMode.maxTmpNoise);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3763 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3764
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3765 /* did we use a tmp buffer for the last lines*/
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3766 if(y+15 >= height)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3767 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3768 uint8_t *dstBlock= &(dst[y*dstStride]);
32
cb746db3fd32 Rename ABS macro to FFABS.
diego
parents: 31
diff changeset
3769 if(width==FFABS(dstStride))
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3770 linecpy(dstBlock, tempDst + dstStride, height-y, dstStride);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3771 else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3772 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3773 int i;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3774 for(i=0; i<height-y; i++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3775 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3776 memcpy(dstBlock + i*dstStride, tempDst + (i+1)*dstStride, width);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3777 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3778 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3779 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3780 /*
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3781 for(x=0; x<width; x+=32)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3782 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3783 volatile int i;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3784 i+= + dstBlock[x + 7*dstStride] + dstBlock[x + 8*dstStride]
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3785 + dstBlock[x + 9*dstStride] + dstBlock[x +10*dstStride]
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3786 + dstBlock[x +11*dstStride] + dstBlock[x +12*dstStride];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3787 // + dstBlock[x +13*dstStride]
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3788 // + dstBlock[x +14*dstStride] + dstBlock[x +15*dstStride];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3789 }*/
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3790 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3791 #ifdef HAVE_3DNOW
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3792 asm volatile("femms");
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3793 #elif defined (HAVE_MMX)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3794 asm volatile("emms");
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3795 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3796
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3797 #ifdef DEBUG_BRIGHTNESS
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3798 if(!isColor)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3799 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3800 int max=1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3801 int i;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3802 for(i=0; i<256; i++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3803 if(yHistogram[i] > max) max=yHistogram[i];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3804
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3805 for(i=1; i<256; i++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3806 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3807 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3808 int start=yHistogram[i-1]/(max/256+1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3809 int end=yHistogram[i]/(max/256+1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3810 int inc= end > start ? 1 : -1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3811 for(x=start; x!=end+inc; x+=inc)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3812 dst[ i*dstStride + x]+=128;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3813 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3814
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3815 for(i=0; i<100; i+=2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3816 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3817 dst[ (white)*dstStride + i]+=128;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3818 dst[ (black)*dstStride + i]+=128;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3819 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3820
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3821 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3822 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3823
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3824 *c2= c; //copy local context back
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3825
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3826 }