annotate postprocess_template.c @ 91:8879eafb9431 libpostproc

get register names from x86_cpu.h
author mru
date Mon, 17 Mar 2008 23:08:19 +0000
parents 8e738e0a16f5
children a8ed701a0873
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
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
28 #ifdef ARCH_X86_64
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
29 # define ALIGN_MASK "$0xFFFFFFFFFFFFFFF8"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
30 #else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
31 # define ALIGN_MASK "$0xFFFFFFF8"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
32 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
33
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
34
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
35 #undef PAVGB
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
36 #undef PMINUB
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
37 #undef PMAXUB
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
38
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
39 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
40 #define REAL_PAVGB(a,b) "pavgb " #a ", " #b " \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
41 #elif defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
42 #define REAL_PAVGB(a,b) "pavgusb " #a ", " #b " \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
43 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
44 #define PAVGB(a,b) REAL_PAVGB(a,b)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
45
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
46 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
47 #define PMINUB(a,b,t) "pminub " #a ", " #b " \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
48 #elif defined (HAVE_MMX)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
49 #define PMINUB(b,a,t) \
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
50 "movq " #a ", " #t " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
51 "psubusb " #b ", " #t " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
52 "psubb " #t ", " #a " \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
53 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
54
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
55 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
56 #define PMAXUB(a,b) "pmaxub " #a ", " #b " \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
57 #elif defined (HAVE_MMX)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
58 #define PMAXUB(a,b) \
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
59 "psubusb " #a ", " #b " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
60 "paddb " #a ", " #b " \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
61 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
62
48
72675332ed82 misc spelling fixes
diego
parents: 45
diff changeset
63 //FIXME? |255-0| = 1 (should not be a problem ...)
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
64 #ifdef HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
65 /**
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
66 * Check if the middle 8x8 Block in the given 8x16 block is flat
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
67 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
68 static inline int RENAME(vertClassify)(uint8_t src[], int stride, PPContext *c){
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
69 int numEq= 0, dcOk;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
70 src+= stride*4; // src points to begin of the 8x8 Block
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
71 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
72 "movq %0, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
73 "movq %1, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
74 : : "m" (c->mmxDcOffset[c->nonBQP]), "m" (c->mmxDcThreshold[c->nonBQP])
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
75 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
76
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
77 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
78 "lea (%2, %3), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
79 // 0 1 2 3 4 5 6 7 8 9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
80 // %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
81
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
82 "movq (%2), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
83 "movq (%%"REG_a"), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
84 "movq %%mm0, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
85 "movq %%mm0, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
86 PMAXUB(%%mm1, %%mm4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
87 PMINUB(%%mm1, %%mm3, %%mm5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
88 "psubb %%mm1, %%mm0 \n\t" // mm0 = differnece
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
89 "paddb %%mm7, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
90 "pcmpgtb %%mm6, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
91
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
92 "movq (%%"REG_a",%3), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
93 PMAXUB(%%mm2, %%mm4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
94 PMINUB(%%mm2, %%mm3, %%mm5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
95 "psubb %%mm2, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
96 "paddb %%mm7, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
97 "pcmpgtb %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
98 "paddb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
99
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
100 "movq (%%"REG_a", %3, 2), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
101 PMAXUB(%%mm1, %%mm4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
102 PMINUB(%%mm1, %%mm3, %%mm5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
103 "psubb %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
104 "paddb %%mm7, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
105 "pcmpgtb %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
106 "paddb %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
107
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
108 "lea (%%"REG_a", %3, 4), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
109
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
110 "movq (%2, %3, 4), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
111 PMAXUB(%%mm2, %%mm4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
112 PMINUB(%%mm2, %%mm3, %%mm5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
113 "psubb %%mm2, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
114 "paddb %%mm7, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
115 "pcmpgtb %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
116 "paddb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
117
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
118 "movq (%%"REG_a"), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
119 PMAXUB(%%mm1, %%mm4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
120 PMINUB(%%mm1, %%mm3, %%mm5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
121 "psubb %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
122 "paddb %%mm7, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
123 "pcmpgtb %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
124 "paddb %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
125
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
126 "movq (%%"REG_a", %3), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
127 PMAXUB(%%mm2, %%mm4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
128 PMINUB(%%mm2, %%mm3, %%mm5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
129 "psubb %%mm2, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
130 "paddb %%mm7, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
131 "pcmpgtb %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
132 "paddb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
133
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
134 "movq (%%"REG_a", %3, 2), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
135 PMAXUB(%%mm1, %%mm4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
136 PMINUB(%%mm1, %%mm3, %%mm5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
137 "psubb %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
138 "paddb %%mm7, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
139 "pcmpgtb %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
140 "paddb %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
141 "psubusb %%mm3, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
142
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
143 " \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
144 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
145 "pxor %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
146 "psadbw %%mm7, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
147 #else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
148 "movq %%mm0, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
149 "psrlw $8, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
150 "paddb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
151 "movq %%mm0, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
152 "psrlq $16, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
153 "paddb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
154 "movq %%mm0, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
155 "psrlq $32, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
156 "paddb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
157 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
158 "movq %4, %%mm7 \n\t" // QP,..., QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
159 "paddusb %%mm7, %%mm7 \n\t" // 2QP ... 2QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
160 "psubusb %%mm7, %%mm4 \n\t" // Diff <= 2QP -> 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
161 "packssdw %%mm4, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
162 "movd %%mm0, %0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
163 "movd %%mm4, %1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
164
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
165 : "=r" (numEq), "=r" (dcOk)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
166 : "r" (src), "r" ((long)stride), "m" (c->pQPb)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
167 : "%"REG_a
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
168 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
169
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
170 numEq= (-numEq) &0xFF;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
171 if(numEq > c->ppMode.flatnessThreshold){
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
172 if(dcOk) return 0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
173 else return 1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
174 }else{
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
175 return 2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
176 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
177 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
178 #endif //HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
179
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
180 /**
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
181 * 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
182 * using the 9-Tap Filter (1,1,2,2,4,2,2,1,1)/16
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
183 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
184 #ifndef HAVE_ALTIVEC
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
185 static inline void RENAME(doVertLowPass)(uint8_t *src, int stride, PPContext *c)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
186 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
187 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
188 src+= stride*3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
189 asm volatile( //"movv %0 %1 %2\n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
190 "movq %2, %%mm0 \n\t" // QP,..., QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
191 "pxor %%mm4, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
192
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
193 "movq (%0), %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
194 "movq (%0, %1), %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
195 "movq %%mm5, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
196 "movq %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
197 "psubusb %%mm6, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
198 "psubusb %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
199 "por %%mm5, %%mm2 \n\t" // ABS Diff of lines
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
200 "psubusb %%mm0, %%mm2 \n\t" // diff <= QP -> 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
201 "pcmpeqb %%mm4, %%mm2 \n\t" // diff <= QP -> FF
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
202
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
203 "pand %%mm2, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
204 "pandn %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
205 "por %%mm2, %%mm6 \n\t"// First Line to Filter
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
206
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
207 "movq (%0, %1, 8), %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
208 "lea (%0, %1, 4), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
209 "lea (%0, %1, 8), %%"REG_c" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
210 "sub %1, %%"REG_c" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
211 "add %1, %0 \n\t" // %0 points to line 1 not 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
212 "movq (%0, %1, 8), %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
213 "movq %%mm5, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
214 "movq %%mm7, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
215 "psubusb %%mm7, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
216 "psubusb %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
217 "por %%mm5, %%mm2 \n\t" // ABS Diff of lines
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
218 "psubusb %%mm0, %%mm2 \n\t" // diff <= QP -> 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
219 "pcmpeqb %%mm4, %%mm2 \n\t" // diff <= QP -> FF
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
220
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
221 "pand %%mm2, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
222 "pandn %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
223 "por %%mm2, %%mm7 \n\t" // First Line to Filter
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
224
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
225
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
226 // 1 2 3 4 5 6 7 8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
227 // %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
228 // 6 4 2 2 1 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
229 // 6 4 4 2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
230 // 6 8 2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
231
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
232 "movq (%0, %1), %%mm0 \n\t" // 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
233 "movq %%mm0, %%mm1 \n\t" // 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
234 PAVGB(%%mm6, %%mm0) //1 1 /2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
235 PAVGB(%%mm6, %%mm0) //3 1 /4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
236
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
237 "movq (%0, %1, 4), %%mm2 \n\t" // 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
238 "movq %%mm2, %%mm5 \n\t" // 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
239 PAVGB((%%REGa), %%mm2) // 11 /2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
240 PAVGB((%0, %1, 2), %%mm2) // 211 /4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
241 "movq %%mm2, %%mm3 \n\t" // 211 /4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
242 "movq (%0), %%mm4 \n\t" // 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
243 PAVGB(%%mm4, %%mm3) // 4 211 /8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
244 PAVGB(%%mm0, %%mm3) //642211 /16
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
245 "movq %%mm3, (%0) \n\t" // X
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
246 // mm1=2 mm2=3(211) mm4=1 mm5=5 mm6=0 mm7=9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
247 "movq %%mm1, %%mm0 \n\t" // 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
248 PAVGB(%%mm6, %%mm0) //1 1 /2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
249 "movq %%mm4, %%mm3 \n\t" // 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
250 PAVGB((%0,%1,2), %%mm3) // 1 1 /2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
251 PAVGB((%%REGa,%1,2), %%mm5) // 11 /2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
252 PAVGB((%%REGa), %%mm5) // 211 /4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
253 PAVGB(%%mm5, %%mm3) // 2 2211 /8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
254 PAVGB(%%mm0, %%mm3) //4242211 /16
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
255 "movq %%mm3, (%0,%1) \n\t" // X
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
256 // mm1=2 mm2=3(211) mm4=1 mm5=4(211) mm6=0 mm7=9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
257 PAVGB(%%mm4, %%mm6) //11 /2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
258 "movq (%%"REG_c"), %%mm0 \n\t" // 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
259 PAVGB((%%REGa, %1, 2), %%mm0) // 11/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
260 "movq %%mm0, %%mm3 \n\t" // 11/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
261 PAVGB(%%mm1, %%mm0) // 2 11/4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
262 PAVGB(%%mm6, %%mm0) //222 11/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
263 PAVGB(%%mm2, %%mm0) //22242211/16
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
264 "movq (%0, %1, 2), %%mm2 \n\t" // 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
265 "movq %%mm0, (%0, %1, 2) \n\t" // X
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
266 // 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
267 "movq (%%"REG_a", %1, 4), %%mm0 \n\t" // 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
268 PAVGB((%%REGc), %%mm0) // 11 /2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
269 PAVGB(%%mm0, %%mm6) //11 11 /4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
270 PAVGB(%%mm1, %%mm4) // 11 /2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
271 PAVGB(%%mm2, %%mm1) // 11 /2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
272 PAVGB(%%mm1, %%mm6) //1122 11 /8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
273 PAVGB(%%mm5, %%mm6) //112242211 /16
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
274 "movq (%%"REG_a"), %%mm5 \n\t" // 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
275 "movq %%mm6, (%%"REG_a") \n\t" // X
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
276 // 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
277 "movq (%%"REG_a", %1, 4), %%mm6 \n\t" // 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
278 PAVGB(%%mm7, %%mm6) // 11 /2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
279 PAVGB(%%mm4, %%mm6) // 11 11 /4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
280 PAVGB(%%mm3, %%mm6) // 11 2211 /8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
281 PAVGB(%%mm5, %%mm2) // 11 /2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
282 "movq (%0, %1, 4), %%mm4 \n\t" // 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
283 PAVGB(%%mm4, %%mm2) // 112 /4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
284 PAVGB(%%mm2, %%mm6) // 112242211 /16
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
285 "movq %%mm6, (%0, %1, 4) \n\t" // X
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
286 // 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
287 PAVGB(%%mm7, %%mm1) // 11 2 /4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
288 PAVGB(%%mm4, %%mm5) // 11 /2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
289 PAVGB(%%mm5, %%mm0) // 11 11 /4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
290 "movq (%%"REG_a", %1, 2), %%mm6 \n\t" // 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
291 PAVGB(%%mm6, %%mm1) // 11 4 2 /8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
292 PAVGB(%%mm0, %%mm1) // 11224222 /16
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
293 "movq %%mm1, (%%"REG_a", %1, 2) \n\t" // X
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
294 // mm2=3(112) mm3=6(11) mm4=5 mm5=4(11) mm6=6 mm7=9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
295 PAVGB((%%REGc), %%mm2) // 112 4 /8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
296 "movq (%%"REG_a", %1, 4), %%mm0 \n\t" // 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
297 PAVGB(%%mm0, %%mm6) // 1 1 /2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
298 PAVGB(%%mm7, %%mm6) // 1 12 /4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
299 PAVGB(%%mm2, %%mm6) // 1122424 /4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
300 "movq %%mm6, (%%"REG_c") \n\t" // X
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
301 // mm0=8 mm3=6(11) mm4=5 mm5=4(11) mm7=9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
302 PAVGB(%%mm7, %%mm5) // 11 2 /4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
303 PAVGB(%%mm7, %%mm5) // 11 6 /8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
304
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
305 PAVGB(%%mm3, %%mm0) // 112 /4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
306 PAVGB(%%mm0, %%mm5) // 112246 /16
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
307 "movq %%mm5, (%%"REG_a", %1, 4) \n\t" // X
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
308 "sub %1, %0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
309
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
310 :
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
311 : "r" (src), "r" ((long)stride), "m" (c->pQPb)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
312 : "%"REG_a, "%"REG_c
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
313 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
314 #else //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
315 const int l1= stride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
316 const int l2= stride + l1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
317 const int l3= stride + l2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
318 const int l4= stride + l3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
319 const int l5= stride + l4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
320 const int l6= stride + l5;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
321 const int l7= stride + l6;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
322 const int l8= stride + l7;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
323 const int l9= stride + l8;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
324 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
325 src+= stride*3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
326 for(x=0; x<BLOCK_SIZE; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
327 {
32
cb746db3fd32 Rename ABS macro to FFABS.
diego
parents: 31
diff changeset
328 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
329 const int last= FFABS(src[l8] - src[l9]) < c->QP ? src[l9] : src[l8];
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
330
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
331 int sums[10];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
332 sums[0] = 4*first + src[l1] + src[l2] + src[l3] + 4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
333 sums[1] = sums[0] - first + src[l4];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
334 sums[2] = sums[1] - first + src[l5];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
335 sums[3] = sums[2] - first + src[l6];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
336 sums[4] = sums[3] - first + src[l7];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
337 sums[5] = sums[4] - src[l1] + src[l8];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
338 sums[6] = sums[5] - src[l2] + last;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
339 sums[7] = sums[6] - src[l3] + last;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
340 sums[8] = sums[7] - src[l4] + last;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
341 sums[9] = sums[8] - src[l5] + last;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
342
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
343 src[l1]= (sums[0] + sums[2] + 2*src[l1])>>4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
344 src[l2]= (sums[1] + sums[3] + 2*src[l2])>>4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
345 src[l3]= (sums[2] + sums[4] + 2*src[l3])>>4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
346 src[l4]= (sums[3] + sums[5] + 2*src[l4])>>4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
347 src[l5]= (sums[4] + sums[6] + 2*src[l5])>>4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
348 src[l6]= (sums[5] + sums[7] + 2*src[l6])>>4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
349 src[l7]= (sums[6] + sums[8] + 2*src[l7])>>4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
350 src[l8]= (sums[7] + sums[9] + 2*src[l8])>>4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
351
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
352 src++;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
353 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
354 #endif //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
355 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
356 #endif //HAVE_ALTIVEC
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
357
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
358 #if 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
359 /**
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
360 * Experimental implementation of the filter (Algorithm 1) described in a paper from Ramkishor & Karandikar
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
361 * values are correctly clipped (MMX2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
362 * values are wraparound (C)
49
cdfe8fc50090 misc typo fixes
diego
parents: 48
diff changeset
363 * Conclusion: It is fast, but introduces ugly horizontal patterns
cdfe8fc50090 misc typo fixes
diego
parents: 48
diff changeset
364 * if there is a continuous gradient.
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
365 0 8 16 24
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
366 x = 8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
367 x/2 = 4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
368 x/8 = 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
369 1 12 12 23
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
370 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
371 static inline void RENAME(vertRK1Filter)(uint8_t *src, int stride, int QP)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
372 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
373 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
374 src+= stride*3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
375 // FIXME rounding
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
376 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
377 "pxor %%mm7, %%mm7 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
378 "movq "MANGLE(b80)", %%mm6 \n\t" // MIN_SIGNED_BYTE
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
379 "leal (%0, %1), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
380 "leal (%%"REG_a", %1, 4), %%"REG_c" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
381 // 0 1 2 3 4 5 6 7 8 9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
382 // %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
383 "movq "MANGLE(pQPb)", %%mm0 \n\t" // QP,..., QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
384 "movq %%mm0, %%mm1 \n\t" // QP,..., QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
385 "paddusb "MANGLE(b02)", %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
386 "psrlw $2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
387 "pand "MANGLE(b3F)", %%mm0 \n\t" // QP/4,..., QP/4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
388 "paddusb %%mm1, %%mm0 \n\t" // QP*1.25 ...
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
389 "movq (%0, %1, 4), %%mm2 \n\t" // line 4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
390 "movq (%%"REG_c"), %%mm3 \n\t" // line 5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
391 "movq %%mm2, %%mm4 \n\t" // line 4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
392 "pcmpeqb %%mm5, %%mm5 \n\t" // -1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
393 "pxor %%mm2, %%mm5 \n\t" // -line 4 - 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
394 PAVGB(%%mm3, %%mm5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
395 "paddb %%mm6, %%mm5 \n\t" // (l5-l4)/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
396 "psubusb %%mm3, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
397 "psubusb %%mm2, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
398 "por %%mm3, %%mm4 \n\t" // |l4 - l5|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
399 "psubusb %%mm0, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
400 "pcmpeqb %%mm7, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
401 "pand %%mm4, %%mm5 \n\t" // d/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
402
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
403 // "paddb %%mm6, %%mm2 \n\t" // line 4 + 0x80
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
404 "paddb %%mm5, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
405 // "psubb %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
406 "movq %%mm2, (%0,%1, 4) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
407
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
408 "movq (%%"REG_c"), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
409 // "paddb %%mm6, %%mm2 \n\t" // line 5 + 0x80
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
410 "psubb %%mm5, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
411 // "psubb %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
412 "movq %%mm2, (%%"REG_c") \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
413
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
414 "paddb %%mm6, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
415 "psrlw $2, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
416 "pand "MANGLE(b3F)", %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
417 "psubb "MANGLE(b20)", %%mm5 \n\t" // (l5-l4)/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
418
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
419 "movq (%%"REG_a", %1, 2), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
420 "paddb %%mm6, %%mm2 \n\t" // line 3 + 0x80
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
421 "paddsb %%mm5, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
422 "psubb %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
423 "movq %%mm2, (%%"REG_a", %1, 2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
424
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
425 "movq (%%"REG_c", %1), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
426 "paddb %%mm6, %%mm2 \n\t" // line 6 + 0x80
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
427 "psubsb %%mm5, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
428 "psubb %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
429 "movq %%mm2, (%%"REG_c", %1) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
430
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
431 :
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
432 : "r" (src), "r" ((long)stride)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
433 : "%"REG_a, "%"REG_c
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
434 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
435 #else //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
436 const int l1= stride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
437 const int l2= stride + l1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
438 const int l3= stride + l2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
439 const int l4= stride + l3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
440 const int l5= stride + l4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
441 const int l6= stride + l5;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
442 // const int l7= stride + l6;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
443 // const int l8= stride + l7;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
444 // const int l9= stride + l8;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
445 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
446 const int QP15= QP + (QP>>2);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
447 src+= stride*3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
448 for(x=0; x<BLOCK_SIZE; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
449 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
450 const int v = (src[x+l5] - src[x+l4]);
32
cb746db3fd32 Rename ABS macro to FFABS.
diego
parents: 31
diff changeset
451 if(FFABS(v) < QP15)
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
452 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
453 src[x+l3] +=v>>3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
454 src[x+l4] +=v>>1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
455 src[x+l5] -=v>>1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
456 src[x+l6] -=v>>3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
457
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
458 }
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 #endif //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
462 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
463 #endif //0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
464
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
465 /**
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
466 * Experimental Filter 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
467 * will not damage linear gradients
90
8e738e0a16f5 typo fixes
diego
parents: 78
diff changeset
468 * 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
469 * 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
470 * MMX2 version does correct clipping C version does not
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
471 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
472 static inline void RENAME(vertX1Filter)(uint8_t *src, int stride, PPContext *co)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
473 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
474 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
475 src+= stride*3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
476
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
477 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
478 "pxor %%mm7, %%mm7 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
479 "lea (%0, %1), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
480 "lea (%%"REG_a", %1, 4), %%"REG_c" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
481 // 0 1 2 3 4 5 6 7 8 9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
482 // %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
483 "movq (%%"REG_a", %1, 2), %%mm0 \n\t" // line 3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
484 "movq (%0, %1, 4), %%mm1 \n\t" // line 4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
485 "movq %%mm1, %%mm2 \n\t" // line 4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
486 "psubusb %%mm0, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
487 "psubusb %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
488 "por %%mm1, %%mm0 \n\t" // |l2 - l3|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
489 "movq (%%"REG_c"), %%mm3 \n\t" // line 5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
490 "movq (%%"REG_c", %1), %%mm4 \n\t" // line 6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
491 "movq %%mm3, %%mm5 \n\t" // line 5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
492 "psubusb %%mm4, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
493 "psubusb %%mm5, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
494 "por %%mm4, %%mm3 \n\t" // |l5 - l6|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
495 PAVGB(%%mm3, %%mm0) // (|l2 - l3| + |l5 - l6|)/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
496 "movq %%mm2, %%mm1 \n\t" // line 4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
497 "psubusb %%mm5, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
498 "movq %%mm2, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
499 "pcmpeqb %%mm7, %%mm2 \n\t" // (l4 - l5) <= 0 ? -1 : 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
500 "psubusb %%mm1, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
501 "por %%mm5, %%mm4 \n\t" // |l4 - l5|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
502 "psubusb %%mm0, %%mm4 \n\t" //d = MAX(0, |l4-l5| - (|l2-l3| + |l5-l6|)/2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
503 "movq %%mm4, %%mm3 \n\t" // d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
504 "movq %2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
505 "paddusb %%mm0, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
506 "psubusb %%mm0, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
507 "pcmpeqb %%mm7, %%mm4 \n\t" // d <= QP ? -1 : 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
508 "psubusb "MANGLE(b01)", %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
509 "pand %%mm4, %%mm3 \n\t" // d <= QP ? d : 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
510
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
511 PAVGB(%%mm7, %%mm3) // d/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
512 "movq %%mm3, %%mm1 \n\t" // d/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
513 PAVGB(%%mm7, %%mm3) // d/4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
514 PAVGB(%%mm1, %%mm3) // 3*d/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
515
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
516 "movq (%0, %1, 4), %%mm0 \n\t" // line 4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
517 "pxor %%mm2, %%mm0 \n\t" //(l4 - l5) <= 0 ? -l4-1 : l4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
518 "psubusb %%mm3, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
519 "pxor %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
520 "movq %%mm0, (%0, %1, 4) \n\t" // line 4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
521
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
522 "movq (%%"REG_c"), %%mm0 \n\t" // line 5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
523 "pxor %%mm2, %%mm0 \n\t" //(l4 - l5) <= 0 ? -l5-1 : l5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
524 "paddusb %%mm3, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
525 "pxor %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
526 "movq %%mm0, (%%"REG_c") \n\t" // line 5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
527
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
528 PAVGB(%%mm7, %%mm1) // d/4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
529
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
530 "movq (%%"REG_a", %1, 2), %%mm0 \n\t" // line 3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
531 "pxor %%mm2, %%mm0 \n\t" //(l4 - l5) <= 0 ? -l4-1 : l4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
532 "psubusb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
533 "pxor %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
534 "movq %%mm0, (%%"REG_a", %1, 2) \n\t" // line 3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
535
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
536 "movq (%%"REG_c", %1), %%mm0 \n\t" // line 6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
537 "pxor %%mm2, %%mm0 \n\t" //(l4 - l5) <= 0 ? -l5-1 : l5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
538 "paddusb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
539 "pxor %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
540 "movq %%mm0, (%%"REG_c", %1) \n\t" // line 6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
541
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
542 PAVGB(%%mm7, %%mm1) // d/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
543
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
544 "movq (%%"REG_a", %1), %%mm0 \n\t" // line 2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
545 "pxor %%mm2, %%mm0 \n\t" //(l4 - l5) <= 0 ? -l2-1 : l2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
546 "psubusb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
547 "pxor %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
548 "movq %%mm0, (%%"REG_a", %1) \n\t" // line 2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
549
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
550 "movq (%%"REG_c", %1, 2), %%mm0 \n\t" // line 7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
551 "pxor %%mm2, %%mm0 \n\t" //(l4 - l5) <= 0 ? -l7-1 : l7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
552 "paddusb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
553 "pxor %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
554 "movq %%mm0, (%%"REG_c", %1, 2) \n\t" // line 7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
555
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
556 :
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
557 : "r" (src), "r" ((long)stride), "m" (co->pQPb)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
558 : "%"REG_a, "%"REG_c
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
559 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
560 #else //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
561
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
562 const int l1= stride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
563 const int l2= stride + l1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
564 const int l3= stride + l2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
565 const int l4= stride + l3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
566 const int l5= stride + l4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
567 const int l6= stride + l5;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
568 const int l7= stride + l6;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
569 // const int l8= stride + l7;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
570 // const int l9= stride + l8;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
571 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
572
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
573 src+= stride*3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
574 for(x=0; x<BLOCK_SIZE; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
575 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
576 int a= src[l3] - src[l4];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
577 int b= src[l4] - src[l5];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
578 int c= src[l5] - src[l6];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
579
32
cb746db3fd32 Rename ABS macro to FFABS.
diego
parents: 31
diff changeset
580 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
581 d= FFMAX(d, 0);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
582
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
583 if(d < co->QP*2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
584 {
31
81ad3274583c Rename SIGN macro to FFSIGN to avoid clashes with system headers.
diego
parents: 29
diff changeset
585 int v = d * FFSIGN(-b);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
586
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
587 src[l2] +=v>>3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
588 src[l3] +=v>>2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
589 src[l4] +=(3*v)>>3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
590 src[l5] -=(3*v)>>3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
591 src[l6] -=v>>2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
592 src[l7] -=v>>3;
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 src++;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
596 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
597 #endif //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
598 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
599
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
600 #ifndef HAVE_ALTIVEC
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
601 static inline void RENAME(doVertDefFilter)(uint8_t src[], int stride, PPContext *c)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
602 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
603 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
604 /*
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
605 uint8_t tmp[16];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
606 const int l1= stride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
607 const int l2= stride + l1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
608 const int l3= stride + l2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
609 const int l4= (int)tmp - (int)src - stride*3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
610 const int l5= (int)tmp - (int)src - stride*3 + 8;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
611 const int l6= stride*3 + l3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
612 const int l7= stride + l6;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
613 const int l8= stride + l7;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
614
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
615 memcpy(tmp, src+stride*7, 8);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
616 memcpy(tmp+8, src+stride*8, 8);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
617 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
618 src+= stride*4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
619 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
620
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
621 #if 0 //sligtly more accurate and slightly slower
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
622 "pxor %%mm7, %%mm7 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
623 "lea (%0, %1), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
624 "lea (%%"REG_a", %1, 4), %%"REG_c" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
625 // 0 1 2 3 4 5 6 7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
626 // %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
627 // %0 eax eax+%1 eax+2%1 %0+4%1 ecx ecx+%1 ecx+2%1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
628
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
629
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
630 "movq (%0, %1, 2), %%mm0 \n\t" // l2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
631 "movq (%0), %%mm1 \n\t" // l0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
632 "movq %%mm0, %%mm2 \n\t" // l2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
633 PAVGB(%%mm7, %%mm0) // ~l2/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
634 PAVGB(%%mm1, %%mm0) // ~(l2 + 2l0)/4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
635 PAVGB(%%mm2, %%mm0) // ~(5l2 + 2l0)/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
636
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
637 "movq (%%"REG_a"), %%mm1 \n\t" // l1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
638 "movq (%%"REG_a", %1, 2), %%mm3 \n\t" // l3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
639 "movq %%mm1, %%mm4 \n\t" // l1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
640 PAVGB(%%mm7, %%mm1) // ~l1/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
641 PAVGB(%%mm3, %%mm1) // ~(l1 + 2l3)/4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
642 PAVGB(%%mm4, %%mm1) // ~(5l1 + 2l3)/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
643
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
644 "movq %%mm0, %%mm4 \n\t" // ~(5l2 + 2l0)/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
645 "psubusb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
646 "psubusb %%mm4, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
647 "por %%mm0, %%mm1 \n\t" // ~|2l0 - 5l1 + 5l2 - 2l3|/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
648 // mm1= |lenergy|, mm2= l2, mm3= l3, mm7=0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
649
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
650 "movq (%0, %1, 4), %%mm0 \n\t" // l4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
651 "movq %%mm0, %%mm4 \n\t" // l4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
652 PAVGB(%%mm7, %%mm0) // ~l4/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
653 PAVGB(%%mm2, %%mm0) // ~(l4 + 2l2)/4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
654 PAVGB(%%mm4, %%mm0) // ~(5l4 + 2l2)/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
655
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
656 "movq (%%"REG_c"), %%mm2 \n\t" // l5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
657 "movq %%mm3, %%mm5 \n\t" // l3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
658 PAVGB(%%mm7, %%mm3) // ~l3/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
659 PAVGB(%%mm2, %%mm3) // ~(l3 + 2l5)/4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
660 PAVGB(%%mm5, %%mm3) // ~(5l3 + 2l5)/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
661
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
662 "movq %%mm0, %%mm6 \n\t" // ~(5l4 + 2l2)/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
663 "psubusb %%mm3, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
664 "psubusb %%mm6, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
665 "por %%mm0, %%mm3 \n\t" // ~|2l2 - 5l3 + 5l4 - 2l5|/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
666 "pcmpeqb %%mm7, %%mm0 \n\t" // SIGN(2l2 - 5l3 + 5l4 - 2l5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
667 // mm0= SIGN(menergy), mm1= |lenergy|, mm2= l5, mm3= |menergy|, mm4=l4, mm5= l3, mm7=0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
668
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
669 "movq (%%"REG_c", %1), %%mm6 \n\t" // l6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
670 "movq %%mm6, %%mm5 \n\t" // l6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
671 PAVGB(%%mm7, %%mm6) // ~l6/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
672 PAVGB(%%mm4, %%mm6) // ~(l6 + 2l4)/4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
673 PAVGB(%%mm5, %%mm6) // ~(5l6 + 2l4)/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
674
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
675 "movq (%%"REG_c", %1, 2), %%mm5 \n\t" // l7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
676 "movq %%mm2, %%mm4 \n\t" // l5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
677 PAVGB(%%mm7, %%mm2) // ~l5/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
678 PAVGB(%%mm5, %%mm2) // ~(l5 + 2l7)/4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
679 PAVGB(%%mm4, %%mm2) // ~(5l5 + 2l7)/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
680
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
681 "movq %%mm6, %%mm4 \n\t" // ~(5l6 + 2l4)/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
682 "psubusb %%mm2, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
683 "psubusb %%mm4, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
684 "por %%mm6, %%mm2 \n\t" // ~|2l4 - 5l5 + 5l6 - 2l7|/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
685 // mm0= SIGN(menergy), mm1= |lenergy|/8, mm2= |renergy|/8, mm3= |menergy|/8, mm7=0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
686
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
687
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
688 PMINUB(%%mm2, %%mm1, %%mm4) // MIN(|lenergy|,|renergy|)/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
689 "movq %2, %%mm4 \n\t" // QP //FIXME QP+1 ?
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
690 "paddusb "MANGLE(b01)", %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
691 "pcmpgtb %%mm3, %%mm4 \n\t" // |menergy|/8 < QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
692 "psubusb %%mm1, %%mm3 \n\t" // d=|menergy|/8-MIN(|lenergy|,|renergy|)/8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
693 "pand %%mm4, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
694
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
695 "movq %%mm3, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
696 // "psubusb "MANGLE(b01)", %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
697 PAVGB(%%mm7, %%mm3)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
698 PAVGB(%%mm7, %%mm3)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
699 "paddusb %%mm1, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
700 // "paddusb "MANGLE(b01)", %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
701
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
702 "movq (%%"REG_a", %1, 2), %%mm6 \n\t" //l3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
703 "movq (%0, %1, 4), %%mm5 \n\t" //l4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
704 "movq (%0, %1, 4), %%mm4 \n\t" //l4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
705 "psubusb %%mm6, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
706 "psubusb %%mm4, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
707 "por %%mm6, %%mm5 \n\t" // |l3-l4|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
708 "pcmpeqb %%mm7, %%mm6 \n\t" // SIGN(l3-l4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
709 "pxor %%mm6, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
710 "pand %%mm0, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
711 PMINUB(%%mm5, %%mm3, %%mm0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
712
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
713 "psubusb "MANGLE(b01)", %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
714 PAVGB(%%mm7, %%mm3)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
715
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
716 "movq (%%"REG_a", %1, 2), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
717 "movq (%0, %1, 4), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
718 "pxor %%mm6, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
719 "pxor %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
720 "psubb %%mm3, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
721 "paddb %%mm3, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
722 "pxor %%mm6, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
723 "pxor %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
724 "movq %%mm0, (%%"REG_a", %1, 2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
725 "movq %%mm2, (%0, %1, 4) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
726 #endif //0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
727
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
728 "lea (%0, %1), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
729 "pcmpeqb %%mm6, %%mm6 \n\t" // -1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
730 // 0 1 2 3 4 5 6 7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
731 // %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
732 // %0 eax eax+%1 eax+2%1 %0+4%1 ecx ecx+%1 ecx+2%1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
733
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
734
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
735 "movq (%%"REG_a", %1, 2), %%mm1 \n\t" // l3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
736 "movq (%0, %1, 4), %%mm0 \n\t" // l4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
737 "pxor %%mm6, %%mm1 \n\t" // -l3-1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
738 PAVGB(%%mm1, %%mm0) // -q+128 = (l4-l3+256)/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
739 // mm1=-l3-1, mm0=128-q
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
740
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
741 "movq (%%"REG_a", %1, 4), %%mm2 \n\t" // l5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
742 "movq (%%"REG_a", %1), %%mm3 \n\t" // l2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
743 "pxor %%mm6, %%mm2 \n\t" // -l5-1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
744 "movq %%mm2, %%mm5 \n\t" // -l5-1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
745 "movq "MANGLE(b80)", %%mm4 \n\t" // 128
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
746 "lea (%%"REG_a", %1, 4), %%"REG_c" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
747 PAVGB(%%mm3, %%mm2) // (l2-l5+256)/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
748 PAVGB(%%mm0, %%mm4) // ~(l4-l3)/4 + 128
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
749 PAVGB(%%mm2, %%mm4) // ~(l2-l5)/4 +(l4-l3)/8 + 128
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
750 PAVGB(%%mm0, %%mm4) // ~(l2-l5)/8 +5(l4-l3)/16 + 128
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
751 // mm1=-l3-1, mm0=128-q, mm3=l2, mm4=menergy/16 + 128, mm5= -l5-1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
752
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
753 "movq (%%"REG_a"), %%mm2 \n\t" // l1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
754 "pxor %%mm6, %%mm2 \n\t" // -l1-1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
755 PAVGB(%%mm3, %%mm2) // (l2-l1+256)/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
756 PAVGB((%0), %%mm1) // (l0-l3+256)/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
757 "movq "MANGLE(b80)", %%mm3 \n\t" // 128
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
758 PAVGB(%%mm2, %%mm3) // ~(l2-l1)/4 + 128
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
759 PAVGB(%%mm1, %%mm3) // ~(l0-l3)/4 +(l2-l1)/8 + 128
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
760 PAVGB(%%mm2, %%mm3) // ~(l0-l3)/8 +5(l2-l1)/16 + 128
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
761 // mm0=128-q, mm3=lenergy/16 + 128, mm4= menergy/16 + 128, mm5= -l5-1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
762
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
763 PAVGB((%%REGc, %1), %%mm5) // (l6-l5+256)/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
764 "movq (%%"REG_c", %1, 2), %%mm1 \n\t" // l7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
765 "pxor %%mm6, %%mm1 \n\t" // -l7-1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
766 PAVGB((%0, %1, 4), %%mm1) // (l4-l7+256)/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
767 "movq "MANGLE(b80)", %%mm2 \n\t" // 128
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
768 PAVGB(%%mm5, %%mm2) // ~(l6-l5)/4 + 128
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
769 PAVGB(%%mm1, %%mm2) // ~(l4-l7)/4 +(l6-l5)/8 + 128
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
770 PAVGB(%%mm5, %%mm2) // ~(l4-l7)/8 +5(l6-l5)/16 + 128
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
771 // mm0=128-q, mm2=renergy/16 + 128, mm3=lenergy/16 + 128, mm4= menergy/16 + 128
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
772
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
773 "movq "MANGLE(b00)", %%mm1 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
774 "movq "MANGLE(b00)", %%mm5 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
775 "psubb %%mm2, %%mm1 \n\t" // 128 - renergy/16
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
776 "psubb %%mm3, %%mm5 \n\t" // 128 - lenergy/16
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
777 PMAXUB(%%mm1, %%mm2) // 128 + |renergy/16|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
778 PMAXUB(%%mm5, %%mm3) // 128 + |lenergy/16|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
779 PMINUB(%%mm2, %%mm3, %%mm1) // 128 + MIN(|lenergy|,|renergy|)/16
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
780
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
781 // mm0=128-q, mm3=128 + MIN(|lenergy|,|renergy|)/16, mm4= menergy/16 + 128
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
782
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
783 "movq "MANGLE(b00)", %%mm7 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
784 "movq %2, %%mm2 \n\t" // QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
785 PAVGB(%%mm6, %%mm2) // 128 + QP/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
786 "psubb %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
787
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
788 "movq %%mm4, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
789 "pcmpgtb %%mm7, %%mm1 \n\t" // SIGN(menergy)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
790 "pxor %%mm1, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
791 "psubb %%mm1, %%mm4 \n\t" // 128 + |menergy|/16
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
792 "pcmpgtb %%mm4, %%mm2 \n\t" // |menergy|/16 < QP/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
793 "psubusb %%mm3, %%mm4 \n\t" //d=|menergy|/16 - MIN(|lenergy|,|renergy|)/16
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
794 // mm0=128-q, mm1= SIGN(menergy), mm2= |menergy|/16 < QP/2, mm4= d/16
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
795
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
796 "movq %%mm4, %%mm3 \n\t" // d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
797 "psubusb "MANGLE(b01)", %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
798 PAVGB(%%mm7, %%mm4) // d/32
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
799 PAVGB(%%mm7, %%mm4) // (d + 32)/64
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
800 "paddb %%mm3, %%mm4 \n\t" // 5d/64
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
801 "pand %%mm2, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
802
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
803 "movq "MANGLE(b80)", %%mm5 \n\t" // 128
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
804 "psubb %%mm0, %%mm5 \n\t" // q
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
805 "paddsb %%mm6, %%mm5 \n\t" // fix bad rounding
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
806 "pcmpgtb %%mm5, %%mm7 \n\t" // SIGN(q)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
807 "pxor %%mm7, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
808
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
809 PMINUB(%%mm5, %%mm4, %%mm3) // MIN(|q|, 5d/64)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
810 "pxor %%mm1, %%mm7 \n\t" // SIGN(d*q)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
811
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
812 "pand %%mm7, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
813 "movq (%%"REG_a", %1, 2), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
814 "movq (%0, %1, 4), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
815 "pxor %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
816 "pxor %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
817 "paddb %%mm4, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
818 "psubb %%mm4, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
819 "pxor %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
820 "pxor %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
821 "movq %%mm0, (%%"REG_a", %1, 2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
822 "movq %%mm2, (%0, %1, 4) \n\t"
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 : "r" (src), "r" ((long)stride), "m" (c->pQPb)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
826 : "%"REG_a, "%"REG_c
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
827 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
828
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
829 /*
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
830 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
831 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
832 src-= stride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
833 for(x=0; x<BLOCK_SIZE; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
834 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
835 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
836 if(FFABS(middleEnergy)< 8*QP)
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
837 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
838 const int q=(src[l4] - src[l5])/2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
839 const int leftEnergy= 5*(src[l3] - src[l2]) + 2*(src[l1] - src[l4]);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
840 const int rightEnergy= 5*(src[l7] - src[l6]) + 2*(src[l5] - src[l8]);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
841
32
cb746db3fd32 Rename ABS macro to FFABS.
diego
parents: 31
diff changeset
842 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
843 d= FFMAX(d, 0);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
844
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
845 d= (5*d + 32) >> 6;
31
81ad3274583c Rename SIGN macro to FFSIGN to avoid clashes with system headers.
diego
parents: 29
diff changeset
846 d*= FFSIGN(-middleEnergy);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
847
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
848 if(q>0)
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 else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
854 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
855 d= d>0 ? 0 : d;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
856 d= d<q ? q : d;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
857 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
858
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
859 src[l4]-= d;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
860 src[l5]+= d;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
861 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
862 src++;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
863 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
864 src-=8;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
865 for(x=0; x<8; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
866 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
867 int y;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
868 for(y=4; y<6; y++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
869 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
870 int d= src[x+y*stride] - tmp[x+(y-4)*8];
32
cb746db3fd32 Rename ABS macro to FFABS.
diego
parents: 31
diff changeset
871 int ad= FFABS(d);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
872 static int max=0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
873 static int sum=0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
874 static int num=0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
875 static int bias=0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
876
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
877 if(max<ad) max=ad;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
878 sum+= ad>3 ? 1 : 0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
879 if(ad>3)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
880 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
881 src[0] = src[7] = src[stride*7] = src[(stride+1)*7]=255;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
882 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
883 if(y==4) bias+=d;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
884 num++;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
885 if(num%1000000 == 0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
886 {
29
2e855f3f4e0b printf --> av_log with some help from Oded
diego
parents: 27
diff changeset
887 av_log(c, AV_LOG_INFO, " %d %d %d %d\n", num, sum, max, bias);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
888 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
889 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
890 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
891 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
892 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
893 #elif defined (HAVE_MMX)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
894 src+= stride*4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
895 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
896 "pxor %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
897 "lea -40(%%"REG_SP"), %%"REG_c" \n\t" // make space for 4 8-byte vars
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
898 "and "ALIGN_MASK", %%"REG_c" \n\t" // align
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
899 // 0 1 2 3 4 5 6 7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
900 // %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
901 // %0 eax eax+%1 eax+2%1 %0+4%1 edx edx+%1 edx+2%1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
902
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
903 "movq (%0), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
904 "movq %%mm0, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
905 "punpcklbw %%mm7, %%mm0 \n\t" // low part of line 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
906 "punpckhbw %%mm7, %%mm1 \n\t" // high part of line 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
907
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
908 "movq (%0, %1), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
909 "lea (%0, %1, 2), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
910 "movq %%mm2, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
911 "punpcklbw %%mm7, %%mm2 \n\t" // low part of line 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
912 "punpckhbw %%mm7, %%mm3 \n\t" // high part of line 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
913
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
914 "movq (%%"REG_a"), %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
915 "movq %%mm4, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
916 "punpcklbw %%mm7, %%mm4 \n\t" // low part of line 2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
917 "punpckhbw %%mm7, %%mm5 \n\t" // high part of line 2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
918
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
919 "paddw %%mm0, %%mm0 \n\t" // 2L0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
920 "paddw %%mm1, %%mm1 \n\t" // 2H0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
921 "psubw %%mm4, %%mm2 \n\t" // L1 - L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
922 "psubw %%mm5, %%mm3 \n\t" // H1 - H2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
923 "psubw %%mm2, %%mm0 \n\t" // 2L0 - L1 + L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
924 "psubw %%mm3, %%mm1 \n\t" // 2H0 - H1 + H2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
925
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
926 "psllw $2, %%mm2 \n\t" // 4L1 - 4L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
927 "psllw $2, %%mm3 \n\t" // 4H1 - 4H2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
928 "psubw %%mm2, %%mm0 \n\t" // 2L0 - 5L1 + 5L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
929 "psubw %%mm3, %%mm1 \n\t" // 2H0 - 5H1 + 5H2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
930
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
931 "movq (%%"REG_a", %1), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
932 "movq %%mm2, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
933 "punpcklbw %%mm7, %%mm2 \n\t" // L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
934 "punpckhbw %%mm7, %%mm3 \n\t" // H3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
935
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
936 "psubw %%mm2, %%mm0 \n\t" // 2L0 - 5L1 + 5L2 - L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
937 "psubw %%mm3, %%mm1 \n\t" // 2H0 - 5H1 + 5H2 - H3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
938 "psubw %%mm2, %%mm0 \n\t" // 2L0 - 5L1 + 5L2 - 2L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
939 "psubw %%mm3, %%mm1 \n\t" // 2H0 - 5H1 + 5H2 - 2H3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
940 "movq %%mm0, (%%"REG_c") \n\t" // 2L0 - 5L1 + 5L2 - 2L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
941 "movq %%mm1, 8(%%"REG_c") \n\t" // 2H0 - 5H1 + 5H2 - 2H3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
942
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
943 "movq (%%"REG_a", %1, 2), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
944 "movq %%mm0, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
945 "punpcklbw %%mm7, %%mm0 \n\t" // L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
946 "punpckhbw %%mm7, %%mm1 \n\t" // H4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
947
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
948 "psubw %%mm0, %%mm2 \n\t" // L3 - L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
949 "psubw %%mm1, %%mm3 \n\t" // H3 - H4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
950 "movq %%mm2, 16(%%"REG_c") \n\t" // L3 - L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
951 "movq %%mm3, 24(%%"REG_c") \n\t" // H3 - H4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
952 "paddw %%mm4, %%mm4 \n\t" // 2L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
953 "paddw %%mm5, %%mm5 \n\t" // 2H2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
954 "psubw %%mm2, %%mm4 \n\t" // 2L2 - L3 + L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
955 "psubw %%mm3, %%mm5 \n\t" // 2H2 - H3 + H4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
956
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
957 "lea (%%"REG_a", %1), %0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
958 "psllw $2, %%mm2 \n\t" // 4L3 - 4L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
959 "psllw $2, %%mm3 \n\t" // 4H3 - 4H4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
960 "psubw %%mm2, %%mm4 \n\t" // 2L2 - 5L3 + 5L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
961 "psubw %%mm3, %%mm5 \n\t" // 2H2 - 5H3 + 5H4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
962 //50 opcodes so far
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
963 "movq (%0, %1, 2), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
964 "movq %%mm2, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
965 "punpcklbw %%mm7, %%mm2 \n\t" // L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
966 "punpckhbw %%mm7, %%mm3 \n\t" // H5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
967 "psubw %%mm2, %%mm4 \n\t" // 2L2 - 5L3 + 5L4 - L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
968 "psubw %%mm3, %%mm5 \n\t" // 2H2 - 5H3 + 5H4 - H5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
969 "psubw %%mm2, %%mm4 \n\t" // 2L2 - 5L3 + 5L4 - 2L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
970 "psubw %%mm3, %%mm5 \n\t" // 2H2 - 5H3 + 5H4 - 2H5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
971
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
972 "movq (%%"REG_a", %1, 4), %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
973 "punpcklbw %%mm7, %%mm6 \n\t" // L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
974 "psubw %%mm6, %%mm2 \n\t" // L5 - L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
975 "movq (%%"REG_a", %1, 4), %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
976 "punpckhbw %%mm7, %%mm6 \n\t" // H6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
977 "psubw %%mm6, %%mm3 \n\t" // H5 - H6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
978
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
979 "paddw %%mm0, %%mm0 \n\t" // 2L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
980 "paddw %%mm1, %%mm1 \n\t" // 2H4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
981 "psubw %%mm2, %%mm0 \n\t" // 2L4 - L5 + L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
982 "psubw %%mm3, %%mm1 \n\t" // 2H4 - H5 + H6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
983
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
984 "psllw $2, %%mm2 \n\t" // 4L5 - 4L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
985 "psllw $2, %%mm3 \n\t" // 4H5 - 4H6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
986 "psubw %%mm2, %%mm0 \n\t" // 2L4 - 5L5 + 5L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
987 "psubw %%mm3, %%mm1 \n\t" // 2H4 - 5H5 + 5H6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
988
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
989 "movq (%0, %1, 4), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
990 "movq %%mm2, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
991 "punpcklbw %%mm7, %%mm2 \n\t" // L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
992 "punpckhbw %%mm7, %%mm3 \n\t" // H7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
993
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
994 "paddw %%mm2, %%mm2 \n\t" // 2L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
995 "paddw %%mm3, %%mm3 \n\t" // 2H7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
996 "psubw %%mm2, %%mm0 \n\t" // 2L4 - 5L5 + 5L6 - 2L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
997 "psubw %%mm3, %%mm1 \n\t" // 2H4 - 5H5 + 5H6 - 2H7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
998
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
999 "movq (%%"REG_c"), %%mm2 \n\t" // 2L0 - 5L1 + 5L2 - 2L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1000 "movq 8(%%"REG_c"), %%mm3 \n\t" // 2H0 - 5H1 + 5H2 - 2H3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1001
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1002 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1003 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1004 "psubw %%mm0, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1005 "pmaxsw %%mm6, %%mm0 \n\t" // |2L4 - 5L5 + 5L6 - 2L7|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1006 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1007 "psubw %%mm1, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1008 "pmaxsw %%mm6, %%mm1 \n\t" // |2H4 - 5H5 + 5H6 - 2H7|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1009 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1010 "psubw %%mm2, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1011 "pmaxsw %%mm6, %%mm2 \n\t" // |2L0 - 5L1 + 5L2 - 2L3|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1012 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1013 "psubw %%mm3, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1014 "pmaxsw %%mm6, %%mm3 \n\t" // |2H0 - 5H1 + 5H2 - 2H3|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1015 #else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1016 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1017 "pcmpgtw %%mm0, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1018 "pxor %%mm6, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1019 "psubw %%mm6, %%mm0 \n\t" // |2L4 - 5L5 + 5L6 - 2L7|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1020 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1021 "pcmpgtw %%mm1, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1022 "pxor %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1023 "psubw %%mm6, %%mm1 \n\t" // |2H4 - 5H5 + 5H6 - 2H7|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1024 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1025 "pcmpgtw %%mm2, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1026 "pxor %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1027 "psubw %%mm6, %%mm2 \n\t" // |2L0 - 5L1 + 5L2 - 2L3|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1028 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1029 "pcmpgtw %%mm3, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1030 "pxor %%mm6, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1031 "psubw %%mm6, %%mm3 \n\t" // |2H0 - 5H1 + 5H2 - 2H3|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1032 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1033
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1034 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1035 "pminsw %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1036 "pminsw %%mm3, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1037 #else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1038 "movq %%mm0, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1039 "psubusw %%mm2, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1040 "psubw %%mm6, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1041 "movq %%mm1, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1042 "psubusw %%mm3, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1043 "psubw %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1044 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1045
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1046 "movd %2, %%mm2 \n\t" // QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1047 "punpcklbw %%mm7, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1048
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1049 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1050 "pcmpgtw %%mm4, %%mm6 \n\t" // sign(2L2 - 5L3 + 5L4 - 2L5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1051 "pxor %%mm6, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1052 "psubw %%mm6, %%mm4 \n\t" // |2L2 - 5L3 + 5L4 - 2L5|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1053 "pcmpgtw %%mm5, %%mm7 \n\t" // sign(2H2 - 5H3 + 5H4 - 2H5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1054 "pxor %%mm7, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1055 "psubw %%mm7, %%mm5 \n\t" // |2H2 - 5H3 + 5H4 - 2H5|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1056 // 100 opcodes
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1057 "psllw $3, %%mm2 \n\t" // 8QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1058 "movq %%mm2, %%mm3 \n\t" // 8QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1059 "pcmpgtw %%mm4, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1060 "pcmpgtw %%mm5, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1061 "pand %%mm2, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1062 "pand %%mm3, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1063
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1064
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1065 "psubusw %%mm0, %%mm4 \n\t" // hd
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1066 "psubusw %%mm1, %%mm5 \n\t" // ld
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1067
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1068
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1069 "movq "MANGLE(w05)", %%mm2 \n\t" // 5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1070 "pmullw %%mm2, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1071 "pmullw %%mm2, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1072 "movq "MANGLE(w20)", %%mm2 \n\t" // 32
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1073 "paddw %%mm2, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1074 "paddw %%mm2, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1075 "psrlw $6, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1076 "psrlw $6, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1077
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1078 "movq 16(%%"REG_c"), %%mm0 \n\t" // L3 - L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1079 "movq 24(%%"REG_c"), %%mm1 \n\t" // H3 - H4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1080
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1081 "pxor %%mm2, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1082 "pxor %%mm3, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1083
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1084 "pcmpgtw %%mm0, %%mm2 \n\t" // sign (L3-L4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1085 "pcmpgtw %%mm1, %%mm3 \n\t" // sign (H3-H4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1086 "pxor %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1087 "pxor %%mm3, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1088 "psubw %%mm2, %%mm0 \n\t" // |L3-L4|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1089 "psubw %%mm3, %%mm1 \n\t" // |H3-H4|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1090 "psrlw $1, %%mm0 \n\t" // |L3 - L4|/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1091 "psrlw $1, %%mm1 \n\t" // |H3 - H4|/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1092
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1093 "pxor %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1094 "pxor %%mm7, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1095 "pand %%mm2, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1096 "pand %%mm3, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1097
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1098 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1099 "pminsw %%mm0, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1100 "pminsw %%mm1, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1101 #else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1102 "movq %%mm4, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1103 "psubusw %%mm0, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1104 "psubw %%mm2, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1105 "movq %%mm5, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1106 "psubusw %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1107 "psubw %%mm2, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1108 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1109 "pxor %%mm6, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1110 "pxor %%mm7, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1111 "psubw %%mm6, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1112 "psubw %%mm7, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1113 "packsswb %%mm5, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1114 "movq (%0), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1115 "paddb %%mm4, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1116 "movq %%mm0, (%0) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1117 "movq (%0, %1), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1118 "psubb %%mm4, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1119 "movq %%mm0, (%0, %1) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1120
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1121 : "+r" (src)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1122 : "r" ((long)stride), "m" (c->pQPb)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1123 : "%"REG_a, "%"REG_c
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1124 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1125 #else //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1126 const int l1= stride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1127 const int l2= stride + l1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1128 const int l3= stride + l2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1129 const int l4= stride + l3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1130 const int l5= stride + l4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1131 const int l6= stride + l5;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1132 const int l7= stride + l6;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1133 const int l8= stride + l7;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1134 // const int l9= stride + l8;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1135 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1136 src+= stride*3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1137 for(x=0; x<BLOCK_SIZE; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1138 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1139 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
1140 if(FFABS(middleEnergy) < 8*c->QP)
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1141 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1142 const int q=(src[l4] - src[l5])/2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1143 const int leftEnergy= 5*(src[l3] - src[l2]) + 2*(src[l1] - src[l4]);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1144 const int rightEnergy= 5*(src[l7] - src[l6]) + 2*(src[l5] - src[l8]);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1145
32
cb746db3fd32 Rename ABS macro to FFABS.
diego
parents: 31
diff changeset
1146 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
1147 d= FFMAX(d, 0);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1148
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1149 d= (5*d + 32) >> 6;
31
81ad3274583c Rename SIGN macro to FFSIGN to avoid clashes with system headers.
diego
parents: 29
diff changeset
1150 d*= FFSIGN(-middleEnergy);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1151
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1152 if(q>0)
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 else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1158 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1159 d= d>0 ? 0 : d;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1160 d= d<q ? q : d;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1161 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1162
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1163 src[l4]-= d;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1164 src[l5]+= d;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1165 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1166 src++;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1167 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1168 #endif //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1169 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1170 #endif //HAVE_ALTIVEC
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1171
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1172 #ifndef HAVE_ALTIVEC
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1173 static inline void RENAME(dering)(uint8_t src[], int stride, PPContext *c)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1174 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1175 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1176 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1177 "pxor %%mm6, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1178 "pcmpeqb %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1179 "movq %2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1180 "punpcklbw %%mm6, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1181 "psrlw $1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1182 "psubw %%mm7, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1183 "packuswb %%mm0, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1184 "movq %%mm0, %3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1185
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1186 "lea (%0, %1), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1187 "lea (%%"REG_a", %1, 4), %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1188
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1189 // 0 1 2 3 4 5 6 7 8 9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1190 // %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
1191
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1192 #undef FIND_MIN_MAX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1193 #ifdef HAVE_MMX2
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 "pminub %%mm0, %%mm7 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1197 "pmaxub %%mm0, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1198 #else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1199 #define REAL_FIND_MIN_MAX(addr)\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1200 "movq " #addr ", %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1201 "movq %%mm7, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1202 "psubusb %%mm0, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1203 "paddb %%mm0, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1204 "psubusb %%mm0, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1205 "psubb %%mm1, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1206 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1207 #define FIND_MIN_MAX(addr) REAL_FIND_MIN_MAX(addr)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1208
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1209 FIND_MIN_MAX((%%REGa))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1210 FIND_MIN_MAX((%%REGa, %1))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1211 FIND_MIN_MAX((%%REGa, %1, 2))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1212 FIND_MIN_MAX((%0, %1, 4))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1213 FIND_MIN_MAX((%%REGd))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1214 FIND_MIN_MAX((%%REGd, %1))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1215 FIND_MIN_MAX((%%REGd, %1, 2))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1216 FIND_MIN_MAX((%0, %1, 8))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1217
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1218 "movq %%mm7, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1219 "psrlq $8, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1220 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1221 "pminub %%mm4, %%mm7 \n\t" // min of pixels
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1222 "pshufw $0xF9, %%mm7, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1223 "pminub %%mm4, %%mm7 \n\t" // min of pixels
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1224 "pshufw $0xFE, %%mm7, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1225 "pminub %%mm4, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1226 #else
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 $16, %%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 "movq %%mm7, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1236 "psrlq $32, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1237 "movq %%mm7, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1238 "psubusb %%mm4, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1239 "psubb %%mm1, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1240 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1241
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1242
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1243 "movq %%mm6, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1244 "psrlq $8, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1245 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1246 "pmaxub %%mm4, %%mm6 \n\t" // max of pixels
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1247 "pshufw $0xF9, %%mm6, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1248 "pmaxub %%mm4, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1249 "pshufw $0xFE, %%mm6, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1250 "pmaxub %%mm4, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1251 #else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1252 "psubusb %%mm4, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1253 "paddb %%mm4, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1254 "movq %%mm6, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1255 "psrlq $16, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1256 "psubusb %%mm4, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1257 "paddb %%mm4, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1258 "movq %%mm6, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1259 "psrlq $32, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1260 "psubusb %%mm4, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1261 "paddb %%mm4, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1262 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1263 "movq %%mm6, %%mm0 \n\t" // max
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1264 "psubb %%mm7, %%mm6 \n\t" // max - min
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1265 "movd %%mm6, %%ecx \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1266 "cmpb "MANGLE(deringThreshold)", %%cl \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1267 " jb 1f \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1268 "lea -24(%%"REG_SP"), %%"REG_c" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1269 "and "ALIGN_MASK", %%"REG_c" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1270 PAVGB(%%mm0, %%mm7) // a=(max + min)/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1271 "punpcklbw %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1272 "punpcklbw %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1273 "punpcklbw %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1274 "movq %%mm7, (%%"REG_c") \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1275
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1276 "movq (%0), %%mm0 \n\t" // L10
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1277 "movq %%mm0, %%mm1 \n\t" // L10
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1278 "movq %%mm0, %%mm2 \n\t" // L10
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1279 "psllq $8, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1280 "psrlq $8, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1281 "movd -4(%0), %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1282 "movd 8(%0), %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1283 "psrlq $24, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1284 "psllq $56, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1285 "por %%mm3, %%mm1 \n\t" // L00
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1286 "por %%mm4, %%mm2 \n\t" // L20
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1287 "movq %%mm1, %%mm3 \n\t" // L00
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1288 PAVGB(%%mm2, %%mm1) // (L20 + L00)/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1289 PAVGB(%%mm0, %%mm1) // (L20 + L00 + 2L10)/4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1290 "psubusb %%mm7, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1291 "psubusb %%mm7, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1292 "psubusb %%mm7, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1293 "pcmpeqb "MANGLE(b00)", %%mm0 \n\t" // L10 > a ? 0 : -1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1294 "pcmpeqb "MANGLE(b00)", %%mm2 \n\t" // L20 > a ? 0 : -1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1295 "pcmpeqb "MANGLE(b00)", %%mm3 \n\t" // L00 > a ? 0 : -1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1296 "paddb %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1297 "paddb %%mm3, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1298
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1299 "movq (%%"REG_a"), %%mm2 \n\t" // L11
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1300 "movq %%mm2, %%mm3 \n\t" // L11
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1301 "movq %%mm2, %%mm4 \n\t" // L11
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1302 "psllq $8, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1303 "psrlq $8, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1304 "movd -4(%%"REG_a"), %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1305 "movd 8(%%"REG_a"), %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1306 "psrlq $24, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1307 "psllq $56, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1308 "por %%mm5, %%mm3 \n\t" // L01
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1309 "por %%mm6, %%mm4 \n\t" // L21
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1310 "movq %%mm3, %%mm5 \n\t" // L01
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1311 PAVGB(%%mm4, %%mm3) // (L21 + L01)/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1312 PAVGB(%%mm2, %%mm3) // (L21 + L01 + 2L11)/4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1313 "psubusb %%mm7, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1314 "psubusb %%mm7, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1315 "psubusb %%mm7, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1316 "pcmpeqb "MANGLE(b00)", %%mm2 \n\t" // L11 > a ? 0 : -1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1317 "pcmpeqb "MANGLE(b00)", %%mm4 \n\t" // L21 > a ? 0 : -1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1318 "pcmpeqb "MANGLE(b00)", %%mm5 \n\t" // L01 > a ? 0 : -1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1319 "paddb %%mm4, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1320 "paddb %%mm5, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1321 // 0, 2, 3, 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1322 #define REAL_DERING_CORE(dst,src,ppsx,psx,sx,pplx,plx,lx,t0,t1) \
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1323 "movq " #src ", " #sx " \n\t" /* src[0] */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1324 "movq " #sx ", " #lx " \n\t" /* src[0] */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1325 "movq " #sx ", " #t0 " \n\t" /* src[0] */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1326 "psllq $8, " #lx " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1327 "psrlq $8, " #t0 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1328 "movd -4" #src ", " #t1 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1329 "psrlq $24, " #t1 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1330 "por " #t1 ", " #lx " \n\t" /* src[-1] */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1331 "movd 8" #src ", " #t1 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1332 "psllq $56, " #t1 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1333 "por " #t1 ", " #t0 " \n\t" /* src[+1] */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1334 "movq " #lx ", " #t1 " \n\t" /* src[-1] */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1335 PAVGB(t0, lx) /* (src[-1] + src[+1])/2 */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1336 PAVGB(sx, lx) /* (src[-1] + 2src[0] + src[+1])/4 */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1337 PAVGB(lx, pplx) \
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1338 "movq " #lx ", 8(%%"REG_c") \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1339 "movq (%%"REG_c"), " #lx " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1340 "psubusb " #lx ", " #t1 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1341 "psubusb " #lx ", " #t0 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1342 "psubusb " #lx ", " #sx " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1343 "movq "MANGLE(b00)", " #lx " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1344 "pcmpeqb " #lx ", " #t1 " \n\t" /* src[-1] > a ? 0 : -1*/\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1345 "pcmpeqb " #lx ", " #t0 " \n\t" /* src[+1] > a ? 0 : -1*/\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1346 "pcmpeqb " #lx ", " #sx " \n\t" /* src[0] > a ? 0 : -1*/\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1347 "paddb " #t1 ", " #t0 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1348 "paddb " #t0 ", " #sx " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1349 \
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1350 PAVGB(plx, pplx) /* filtered */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1351 "movq " #dst ", " #t0 " \n\t" /* dst */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1352 "movq " #t0 ", " #t1 " \n\t" /* dst */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1353 "psubusb %3, " #t0 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1354 "paddusb %3, " #t1 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1355 PMAXUB(t0, pplx)\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1356 PMINUB(t1, pplx, t0)\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1357 "paddb " #sx ", " #ppsx " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1358 "paddb " #psx ", " #ppsx " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1359 "#paddb "MANGLE(b02)", " #ppsx " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1360 "pand "MANGLE(b08)", " #ppsx " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1361 "pcmpeqb " #lx ", " #ppsx " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1362 "pand " #ppsx ", " #pplx " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1363 "pandn " #dst ", " #ppsx " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1364 "por " #pplx ", " #ppsx " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1365 "movq " #ppsx ", " #dst " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1366 "movq 8(%%"REG_c"), " #lx " \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1367
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1368 #define DERING_CORE(dst,src,ppsx,psx,sx,pplx,plx,lx,t0,t1) \
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1369 REAL_DERING_CORE(dst,src,ppsx,psx,sx,pplx,plx,lx,t0,t1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1370 /*
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1371 0000000
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1372 1111111
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1373
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1374 1111110
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1375 1111101
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1376 1111100
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1377 1111011
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1378 1111010
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1379 1111001
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1380
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1381 1111000
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1382 1110111
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1383
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1384 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1385 //DERING_CORE(dst ,src ,ppsx ,psx ,sx ,pplx ,plx ,lx ,t0 ,t1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1386 DERING_CORE((%%REGa) ,(%%REGa, %1) ,%%mm0,%%mm2,%%mm4,%%mm1,%%mm3,%%mm5,%%mm6,%%mm7)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1387 DERING_CORE((%%REGa, %1) ,(%%REGa, %1, 2),%%mm2,%%mm4,%%mm0,%%mm3,%%mm5,%%mm1,%%mm6,%%mm7)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1388 DERING_CORE((%%REGa, %1, 2),(%0, %1, 4) ,%%mm4,%%mm0,%%mm2,%%mm5,%%mm1,%%mm3,%%mm6,%%mm7)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1389 DERING_CORE((%0, %1, 4) ,(%%REGd) ,%%mm0,%%mm2,%%mm4,%%mm1,%%mm3,%%mm5,%%mm6,%%mm7)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1390 DERING_CORE((%%REGd) ,(%%REGd, %1) ,%%mm2,%%mm4,%%mm0,%%mm3,%%mm5,%%mm1,%%mm6,%%mm7)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1391 DERING_CORE((%%REGd, %1) ,(%%REGd, %1, 2),%%mm4,%%mm0,%%mm2,%%mm5,%%mm1,%%mm3,%%mm6,%%mm7)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1392 DERING_CORE((%%REGd, %1, 2),(%0, %1, 8) ,%%mm0,%%mm2,%%mm4,%%mm1,%%mm3,%%mm5,%%mm6,%%mm7)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1393 DERING_CORE((%0, %1, 8) ,(%%REGd, %1, 4),%%mm2,%%mm4,%%mm0,%%mm3,%%mm5,%%mm1,%%mm6,%%mm7)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1394
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1395 "1: \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1396 : : "r" (src), "r" ((long)stride), "m" (c->pQPb), "m"(c->pQPb2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1397 : "%"REG_a, "%"REG_d, "%"REG_c
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1398 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1399 #else //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1400 int y;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1401 int min=255;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1402 int max=0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1403 int avg;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1404 uint8_t *p;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1405 int s[10];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1406 const int QP2= c->QP/2 + 1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1407
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1408 for(y=1; y<9; y++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1409 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1410 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1411 p= src + stride*y;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1412 for(x=1; x<9; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1413 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1414 p++;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1415 if(*p > max) max= *p;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1416 if(*p < min) min= *p;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1417 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1418 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1419 avg= (min + max + 1)>>1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1420
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1421 if(max - min <deringThreshold) return;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1422
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1423 for(y=0; y<10; y++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1424 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1425 int t = 0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1426
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1427 if(src[stride*y + 0] > avg) t+= 1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1428 if(src[stride*y + 1] > avg) t+= 2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1429 if(src[stride*y + 2] > avg) t+= 4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1430 if(src[stride*y + 3] > avg) t+= 8;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1431 if(src[stride*y + 4] > avg) t+= 16;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1432 if(src[stride*y + 5] > avg) t+= 32;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1433 if(src[stride*y + 6] > avg) t+= 64;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1434 if(src[stride*y + 7] > avg) t+= 128;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1435 if(src[stride*y + 8] > avg) t+= 256;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1436 if(src[stride*y + 9] > avg) t+= 512;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1437
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1438 t |= (~t)<<16;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1439 t &= (t<<1) & (t>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1440 s[y] = t;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1441 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1442
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1443 for(y=1; y<9; y++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1444 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1445 int t = s[y-1] & s[y] & s[y+1];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1446 t|= t>>16;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1447 s[y-1]= t;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1448 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1449
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1450 for(y=1; y<9; y++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1451 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1452 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1453 int t = s[y-1];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1454
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1455 p= src + stride*y;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1456 for(x=1; x<9; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1457 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1458 p++;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1459 if(t & (1<<x))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1460 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1461 int f= (*(p-stride-1)) + 2*(*(p-stride)) + (*(p-stride+1))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1462 +2*(*(p -1)) + 4*(*p ) + 2*(*(p +1))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1463 +(*(p+stride-1)) + 2*(*(p+stride)) + (*(p+stride+1));
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1464 f= (f + 8)>>4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1465
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1466 #ifdef DEBUG_DERING_THRESHOLD
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1467 asm volatile("emms\n\t":);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1468 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1469 static long long numPixels=0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1470 if(x!=1 && x!=8 && y!=1 && y!=8) numPixels++;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1471 // if((max-min)<20 || (max-min)*QP<200)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1472 // if((max-min)*QP < 500)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1473 // if(max-min<QP/2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1474 if(max-min < 20)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1475 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1476 static int numSkiped=0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1477 static int errorSum=0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1478 static int worstQP=0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1479 static int worstRange=0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1480 static int worstDiff=0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1481 int diff= (f - *p);
32
cb746db3fd32 Rename ABS macro to FFABS.
diego
parents: 31
diff changeset
1482 int absDiff= FFABS(diff);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1483 int error= diff*diff;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1484
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1485 if(x==1 || x==8 || y==1 || y==8) continue;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1486
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1487 numSkiped++;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1488 if(absDiff > worstDiff)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1489 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1490 worstDiff= absDiff;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1491 worstQP= QP;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1492 worstRange= max-min;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1493 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1494 errorSum+= error;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1495
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1496 if(1024LL*1024LL*1024LL % numSkiped == 0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1497 {
29
2e855f3f4e0b printf --> av_log with some help from Oded
diego
parents: 27
diff changeset
1498 av_log(c, AV_LOG_INFO, "sum:%1.3f, skip:%d, wQP:%d, "
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1499 "wRange:%d, wDiff:%d, relSkip:%1.3f\n",
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1500 (float)errorSum/numSkiped, numSkiped, worstQP, worstRange,
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1501 worstDiff, (float)numSkiped/numPixels);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1502 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1503 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1504 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1505 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1506 if (*p + QP2 < f) *p= *p + QP2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1507 else if(*p - QP2 > f) *p= *p - QP2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1508 else *p=f;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1509 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1510 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1511 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1512 #ifdef DEBUG_DERING_THRESHOLD
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1513 if(max-min < 20)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1514 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1515 for(y=1; y<9; y++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1516 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1517 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1518 int t = 0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1519 p= src + stride*y;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1520 for(x=1; x<9; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1521 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1522 p++;
27
c83a71c1729d Change libpostproc to use the FFMIN/FFMAX macros from libavutil.
diego
parents: 22
diff changeset
1523 *p = FFMIN(*p + 20, 255);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1524 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1525 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1526 // src[0] = src[7]=src[stride*7]=src[stride*7 + 7]=255;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1527 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1528 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1529 #endif //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1530 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1531 #endif //HAVE_ALTIVEC
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1532
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1533 /**
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1534 * Deinterlaces the given block by linearly interpolating every second line.
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1535 * will be called for every 8x8 block and can read & write from line 4-15
90
8e738e0a16f5 typo fixes
diego
parents: 78
diff changeset
1536 * 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
1537 * lines 4-12 will be read into the deblocking filter and should be deinterlaced
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1538 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1539 static inline void RENAME(deInterlaceInterpolateLinear)(uint8_t src[], int stride)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1540 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1541 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1542 src+= 4*stride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1543 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1544 "lea (%0, %1), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1545 "lea (%%"REG_a", %1, 4), %%"REG_c" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1546 // 0 1 2 3 4 5 6 7 8 9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1547 // %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
1548
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1549 "movq (%0), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1550 "movq (%%"REG_a", %1), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1551 PAVGB(%%mm1, %%mm0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1552 "movq %%mm0, (%%"REG_a") \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1553 "movq (%0, %1, 4), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1554 PAVGB(%%mm0, %%mm1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1555 "movq %%mm1, (%%"REG_a", %1, 2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1556 "movq (%%"REG_c", %1), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1557 PAVGB(%%mm1, %%mm0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1558 "movq %%mm0, (%%"REG_c") \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1559 "movq (%0, %1, 8), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1560 PAVGB(%%mm0, %%mm1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1561 "movq %%mm1, (%%"REG_c", %1, 2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1562
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1563 : : "r" (src), "r" ((long)stride)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1564 : "%"REG_a, "%"REG_c
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1565 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1566 #else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1567 int a, b, x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1568 src+= 4*stride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1569
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1570 for(x=0; x<2; x++){
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1571 a= *(uint32_t*)&src[stride*0];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1572 b= *(uint32_t*)&src[stride*2];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1573 *(uint32_t*)&src[stride*1]= (a|b) - (((a^b)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1574 a= *(uint32_t*)&src[stride*4];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1575 *(uint32_t*)&src[stride*3]= (a|b) - (((a^b)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1576 b= *(uint32_t*)&src[stride*6];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1577 *(uint32_t*)&src[stride*5]= (a|b) - (((a^b)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1578 a= *(uint32_t*)&src[stride*8];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1579 *(uint32_t*)&src[stride*7]= (a|b) - (((a^b)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1580 src += 4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1581 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1582 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1583 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1584
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1585 /**
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1586 * Deinterlaces the given block by cubic interpolating every second line.
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1587 * will be called for every 8x8 block and can read & write from line 4-15
90
8e738e0a16f5 typo fixes
diego
parents: 78
diff changeset
1588 * 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
1589 * lines 4-12 will be read into the deblocking filter and should be deinterlaced
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1590 * this filter will read lines 3-15 and write 7-13
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1591 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1592 static inline void RENAME(deInterlaceInterpolateCubic)(uint8_t src[], int stride)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1593 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1594 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1595 src+= stride*3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1596 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1597 "lea (%0, %1), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1598 "lea (%%"REG_a", %1, 4), %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1599 "lea (%%"REG_d", %1, 4), %%"REG_c" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1600 "add %1, %%"REG_c" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1601 "pxor %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1602 // 0 1 2 3 4 5 6 7 8 9 10
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1603 // %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
1604
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1605 #define REAL_DEINT_CUBIC(a,b,c,d,e)\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1606 "movq " #a ", %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1607 "movq " #b ", %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1608 "movq " #d ", %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1609 "movq " #e ", %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1610 PAVGB(%%mm2, %%mm1) /* (b+d) /2 */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1611 PAVGB(%%mm3, %%mm0) /* a(a+e) /2 */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1612 "movq %%mm0, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1613 "punpcklbw %%mm7, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1614 "punpckhbw %%mm7, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1615 "movq %%mm1, %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1616 "punpcklbw %%mm7, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1617 "punpckhbw %%mm7, %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1618 "psubw %%mm1, %%mm0 \n\t" /* L(a+e - (b+d))/2 */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1619 "psubw %%mm3, %%mm2 \n\t" /* H(a+e - (b+d))/2 */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1620 "psraw $3, %%mm0 \n\t" /* L(a+e - (b+d))/16 */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1621 "psraw $3, %%mm2 \n\t" /* H(a+e - (b+d))/16 */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1622 "psubw %%mm0, %%mm1 \n\t" /* L(9b + 9d - a - e)/16 */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1623 "psubw %%mm2, %%mm3 \n\t" /* H(9b + 9d - a - e)/16 */\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1624 "packuswb %%mm3, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1625 "movq %%mm1, " #c " \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1626 #define DEINT_CUBIC(a,b,c,d,e) REAL_DEINT_CUBIC(a,b,c,d,e)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1627
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1628 DEINT_CUBIC((%0) , (%%REGa, %1), (%%REGa, %1, 2), (%0, %1, 4) , (%%REGd, %1))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1629 DEINT_CUBIC((%%REGa, %1), (%0, %1, 4) , (%%REGd) , (%%REGd, %1), (%0, %1, 8))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1630 DEINT_CUBIC((%0, %1, 4) , (%%REGd, %1), (%%REGd, %1, 2), (%0, %1, 8) , (%%REGc))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1631 DEINT_CUBIC((%%REGd, %1), (%0, %1, 8) , (%%REGd, %1, 4), (%%REGc) , (%%REGc, %1, 2))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1632
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1633 : : "r" (src), "r" ((long)stride)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1634 : "%"REG_a, "%"REG_d, "%"REG_c
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1635 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1636 #else //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1637 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1638 src+= stride*3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1639 for(x=0; x<8; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1640 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1641 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
1642 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
1643 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
1644 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
1645 src++;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1646 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1647 #endif //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1648 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1649
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1650 /**
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1651 * 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
1652 * will be called for every 8x8 block and can read & write from line 4-15
90
8e738e0a16f5 typo fixes
diego
parents: 78
diff changeset
1653 * 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
1654 * lines 4-12 will be read into the deblocking filter and should be deinterlaced
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1655 * this filter will read lines 4-13 and write 5-11
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1656 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1657 static inline void RENAME(deInterlaceFF)(uint8_t src[], int stride, uint8_t *tmp)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1658 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1659 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1660 src+= stride*4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1661 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1662 "lea (%0, %1), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1663 "lea (%%"REG_a", %1, 4), %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1664 "pxor %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1665 "movq (%2), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1666 // 0 1 2 3 4 5 6 7 8 9 10
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1667 // %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
1668
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1669 #define REAL_DEINT_FF(a,b,c,d)\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1670 "movq " #a ", %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1671 "movq " #b ", %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1672 "movq " #c ", %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1673 "movq " #d ", %%mm4 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1674 PAVGB(%%mm3, %%mm1) \
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1675 PAVGB(%%mm4, %%mm0) \
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1676 "movq %%mm0, %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1677 "punpcklbw %%mm7, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1678 "punpckhbw %%mm7, %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1679 "movq %%mm1, %%mm4 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1680 "punpcklbw %%mm7, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1681 "punpckhbw %%mm7, %%mm4 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1682 "psllw $2, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1683 "psllw $2, %%mm4 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1684 "psubw %%mm0, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1685 "psubw %%mm3, %%mm4 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1686 "movq %%mm2, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1687 "movq %%mm2, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1688 "punpcklbw %%mm7, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1689 "punpckhbw %%mm7, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1690 "paddw %%mm2, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1691 "paddw %%mm5, %%mm4 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1692 "psraw $2, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1693 "psraw $2, %%mm4 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1694 "packuswb %%mm4, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1695 "movq %%mm1, " #b " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1696
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1697 #define DEINT_FF(a,b,c,d) REAL_DEINT_FF(a,b,c,d)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1698
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1699 DEINT_FF((%0) , (%%REGa) , (%%REGa, %1), (%%REGa, %1, 2))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1700 DEINT_FF((%%REGa, %1), (%%REGa, %1, 2), (%0, %1, 4) , (%%REGd) )
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1701 DEINT_FF((%0, %1, 4) , (%%REGd) , (%%REGd, %1), (%%REGd, %1, 2))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1702 DEINT_FF((%%REGd, %1), (%%REGd, %1, 2), (%0, %1, 8) , (%%REGd, %1, 4))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1703
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1704 "movq %%mm0, (%2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1705 : : "r" (src), "r" ((long)stride), "r"(tmp)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1706 : "%"REG_a, "%"REG_d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1707 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1708 #else //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1709 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1710 src+= stride*4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1711 for(x=0; x<8; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1712 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1713 int t1= tmp[x];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1714 int t2= src[stride*1];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1715
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1716 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
1717 t1= src[stride*4];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1718 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
1719 t2= src[stride*6];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1720 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
1721 t1= src[stride*8];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1722 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
1723 tmp[x]= t1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1724
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1725 src++;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1726 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1727 #endif //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1728 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1729
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1730 /**
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1731 * Deinterlaces the given block by filtering every line with a (-1 2 6 2 -1) filter.
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1732 * will be called for every 8x8 block and can read & write from line 4-15
90
8e738e0a16f5 typo fixes
diego
parents: 78
diff changeset
1733 * 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
1734 * lines 4-12 will be read into the deblocking filter and should be deinterlaced
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1735 * this filter will read lines 4-13 and write 4-11
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1736 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1737 static inline void RENAME(deInterlaceL5)(uint8_t src[], int stride, uint8_t *tmp, uint8_t *tmp2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1738 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1739 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1740 src+= stride*4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1741 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1742 "lea (%0, %1), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1743 "lea (%%"REG_a", %1, 4), %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1744 "pxor %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1745 "movq (%2), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1746 "movq (%3), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1747 // 0 1 2 3 4 5 6 7 8 9 10
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1748 // %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
1749
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1750 #define REAL_DEINT_L5(t1,t2,a,b,c)\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1751 "movq " #a ", %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1752 "movq " #b ", %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1753 "movq " #c ", %%mm4 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1754 PAVGB(t2, %%mm3) \
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1755 PAVGB(t1, %%mm4) \
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1756 "movq %%mm2, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1757 "movq %%mm2, " #t1 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1758 "punpcklbw %%mm7, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1759 "punpckhbw %%mm7, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1760 "movq %%mm2, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1761 "paddw %%mm2, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1762 "paddw %%mm6, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1763 "movq %%mm5, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1764 "paddw %%mm5, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1765 "paddw %%mm6, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1766 "movq %%mm3, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1767 "punpcklbw %%mm7, %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1768 "punpckhbw %%mm7, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1769 "paddw %%mm3, %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1770 "paddw %%mm6, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1771 "paddw %%mm3, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1772 "paddw %%mm6, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1773 "movq %%mm4, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1774 "punpcklbw %%mm7, %%mm4 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1775 "punpckhbw %%mm7, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1776 "psubw %%mm4, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1777 "psubw %%mm6, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1778 "psraw $2, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1779 "psraw $2, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1780 "packuswb %%mm5, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1781 "movq %%mm2, " #a " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1782
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1783 #define DEINT_L5(t1,t2,a,b,c) REAL_DEINT_L5(t1,t2,a,b,c)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1784
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1785 DEINT_L5(%%mm0, %%mm1, (%0) , (%%REGa) , (%%REGa, %1) )
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1786 DEINT_L5(%%mm1, %%mm0, (%%REGa) , (%%REGa, %1) , (%%REGa, %1, 2))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1787 DEINT_L5(%%mm0, %%mm1, (%%REGa, %1) , (%%REGa, %1, 2), (%0, %1, 4) )
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1788 DEINT_L5(%%mm1, %%mm0, (%%REGa, %1, 2), (%0, %1, 4) , (%%REGd) )
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1789 DEINT_L5(%%mm0, %%mm1, (%0, %1, 4) , (%%REGd) , (%%REGd, %1) )
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1790 DEINT_L5(%%mm1, %%mm0, (%%REGd) , (%%REGd, %1) , (%%REGd, %1, 2))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1791 DEINT_L5(%%mm0, %%mm1, (%%REGd, %1) , (%%REGd, %1, 2), (%0, %1, 8) )
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1792 DEINT_L5(%%mm1, %%mm0, (%%REGd, %1, 2), (%0, %1, 8) , (%%REGd, %1, 4))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1793
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1794 "movq %%mm0, (%2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1795 "movq %%mm1, (%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1796 : : "r" (src), "r" ((long)stride), "r"(tmp), "r"(tmp2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1797 : "%"REG_a, "%"REG_d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1798 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1799 #else //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1800 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1801 src+= stride*4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1802 for(x=0; x<8; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1803 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1804 int t1= tmp[x];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1805 int t2= tmp2[x];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1806 int t3= src[0];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1807
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1808 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
1809 t1= src[stride*1];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1810 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
1811 t2= src[stride*2];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1812 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
1813 t3= src[stride*3];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1814 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
1815 t1= src[stride*4];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1816 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
1817 t2= src[stride*5];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1818 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
1819 t3= src[stride*6];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1820 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
1821 t1= src[stride*7];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1822 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
1823
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1824 tmp[x]= t3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1825 tmp2[x]= t1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1826
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1827 src++;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1828 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1829 #endif //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1830 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1831
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1832 /**
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1833 * Deinterlaces the given block by filtering all lines with a (1 2 1) filter.
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1834 * will be called for every 8x8 block and can read & write from line 4-15
90
8e738e0a16f5 typo fixes
diego
parents: 78
diff changeset
1835 * 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
1836 * lines 4-12 will be read into the deblocking filter and should be deinterlaced
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1837 * this filter will read lines 4-13 and write 4-11
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1838 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1839 static inline void RENAME(deInterlaceBlendLinear)(uint8_t src[], int stride, uint8_t *tmp)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1840 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1841 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1842 src+= 4*stride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1843 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1844 "lea (%0, %1), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1845 "lea (%%"REG_a", %1, 4), %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1846 // 0 1 2 3 4 5 6 7 8 9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1847 // %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
1848
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1849 "movq (%2), %%mm0 \n\t" // L0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1850 "movq (%%"REG_a"), %%mm1 \n\t" // L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1851 PAVGB(%%mm1, %%mm0) // L0+L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1852 "movq (%0), %%mm2 \n\t" // L1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1853 PAVGB(%%mm2, %%mm0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1854 "movq %%mm0, (%0) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1855 "movq (%%"REG_a", %1), %%mm0 \n\t" // L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1856 PAVGB(%%mm0, %%mm2) // L1+L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1857 PAVGB(%%mm1, %%mm2) // 2L2 + L1 + L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1858 "movq %%mm2, (%%"REG_a") \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1859 "movq (%%"REG_a", %1, 2), %%mm2 \n\t" // L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1860 PAVGB(%%mm2, %%mm1) // L2+L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1861 PAVGB(%%mm0, %%mm1) // 2L3 + L2 + L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1862 "movq %%mm1, (%%"REG_a", %1) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1863 "movq (%0, %1, 4), %%mm1 \n\t" // L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1864 PAVGB(%%mm1, %%mm0) // L3+L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1865 PAVGB(%%mm2, %%mm0) // 2L4 + L3 + L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1866 "movq %%mm0, (%%"REG_a", %1, 2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1867 "movq (%%"REG_d"), %%mm0 \n\t" // L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1868 PAVGB(%%mm0, %%mm2) // L4+L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1869 PAVGB(%%mm1, %%mm2) // 2L5 + L4 + L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1870 "movq %%mm2, (%0, %1, 4) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1871 "movq (%%"REG_d", %1), %%mm2 \n\t" // L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1872 PAVGB(%%mm2, %%mm1) // L5+L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1873 PAVGB(%%mm0, %%mm1) // 2L6 + L5 + L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1874 "movq %%mm1, (%%"REG_d") \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1875 "movq (%%"REG_d", %1, 2), %%mm1 \n\t" // L8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1876 PAVGB(%%mm1, %%mm0) // L6+L8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1877 PAVGB(%%mm2, %%mm0) // 2L7 + L6 + L8
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1878 "movq %%mm0, (%%"REG_d", %1) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1879 "movq (%0, %1, 8), %%mm0 \n\t" // L9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1880 PAVGB(%%mm0, %%mm2) // L7+L9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1881 PAVGB(%%mm1, %%mm2) // 2L8 + L7 + L9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1882 "movq %%mm2, (%%"REG_d", %1, 2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1883 "movq %%mm1, (%2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1884
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1885 : : "r" (src), "r" ((long)stride), "r" (tmp)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1886 : "%"REG_a, "%"REG_d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1887 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1888 #else //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1889 int a, b, c, x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1890 src+= 4*stride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1891
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1892 for(x=0; x<2; x++){
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1893 a= *(uint32_t*)&tmp[stride*0];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1894 b= *(uint32_t*)&src[stride*0];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1895 c= *(uint32_t*)&src[stride*1];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1896 a= (a&c) + (((a^c)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1897 *(uint32_t*)&src[stride*0]= (a|b) - (((a^b)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1898
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1899 a= *(uint32_t*)&src[stride*2];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1900 b= (a&b) + (((a^b)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1901 *(uint32_t*)&src[stride*1]= (c|b) - (((c^b)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1902
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1903 b= *(uint32_t*)&src[stride*3];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1904 c= (b&c) + (((b^c)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1905 *(uint32_t*)&src[stride*2]= (c|a) - (((c^a)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1906
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1907 c= *(uint32_t*)&src[stride*4];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1908 a= (a&c) + (((a^c)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1909 *(uint32_t*)&src[stride*3]= (a|b) - (((a^b)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1910
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1911 a= *(uint32_t*)&src[stride*5];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1912 b= (a&b) + (((a^b)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1913 *(uint32_t*)&src[stride*4]= (c|b) - (((c^b)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1914
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1915 b= *(uint32_t*)&src[stride*6];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1916 c= (b&c) + (((b^c)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1917 *(uint32_t*)&src[stride*5]= (c|a) - (((c^a)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1918
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1919 c= *(uint32_t*)&src[stride*7];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1920 a= (a&c) + (((a^c)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1921 *(uint32_t*)&src[stride*6]= (a|b) - (((a^b)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1922
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1923 a= *(uint32_t*)&src[stride*8];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1924 b= (a&b) + (((a^b)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1925 *(uint32_t*)&src[stride*7]= (c|b) - (((c^b)&0xFEFEFEFEUL)>>1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1926
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1927 *(uint32_t*)&tmp[stride*0]= c;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1928 src += 4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1929 tmp += 4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1930 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1931 #endif //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1932 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1933
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1934 /**
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1935 * Deinterlaces the given block by applying a median filter to every second line.
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1936 * will be called for every 8x8 block and can read & write from line 4-15,
90
8e738e0a16f5 typo fixes
diego
parents: 78
diff changeset
1937 * 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
1938 * lines 4-12 will be read into the deblocking filter and should be deinterlaced
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1939 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1940 static inline void RENAME(deInterlaceMedian)(uint8_t src[], int stride)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1941 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1942 #ifdef HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1943 src+= 4*stride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1944 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1945 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1946 "lea (%0, %1), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1947 "lea (%%"REG_a", %1, 4), %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1948 // 0 1 2 3 4 5 6 7 8 9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1949 // %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
1950
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1951 "movq (%0), %%mm0 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1952 "movq (%%"REG_a", %1), %%mm2 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1953 "movq (%%"REG_a"), %%mm1 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1954 "movq %%mm0, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1955 "pmaxub %%mm1, %%mm0 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1956 "pminub %%mm3, %%mm1 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1957 "pmaxub %%mm2, %%mm1 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1958 "pminub %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1959 "movq %%mm0, (%%"REG_a") \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1960
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1961 "movq (%0, %1, 4), %%mm0 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1962 "movq (%%"REG_a", %1, 2), %%mm1 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1963 "movq %%mm2, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1964 "pmaxub %%mm1, %%mm2 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1965 "pminub %%mm3, %%mm1 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1966 "pmaxub %%mm0, %%mm1 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1967 "pminub %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1968 "movq %%mm2, (%%"REG_a", %1, 2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1969
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1970 "movq (%%"REG_d"), %%mm2 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1971 "movq (%%"REG_d", %1), %%mm1 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1972 "movq %%mm2, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1973 "pmaxub %%mm0, %%mm2 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1974 "pminub %%mm3, %%mm0 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1975 "pmaxub %%mm1, %%mm0 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1976 "pminub %%mm0, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1977 "movq %%mm2, (%%"REG_d") \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1978
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1979 "movq (%%"REG_d", %1, 2), %%mm2 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1980 "movq (%0, %1, 8), %%mm0 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1981 "movq %%mm2, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1982 "pmaxub %%mm0, %%mm2 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1983 "pminub %%mm3, %%mm0 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1984 "pmaxub %%mm1, %%mm0 \n\t" //
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1985 "pminub %%mm0, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1986 "movq %%mm2, (%%"REG_d", %1, 2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1987
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1988
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1989 : : "r" (src), "r" ((long)stride)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1990 : "%"REG_a, "%"REG_d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1991 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1992
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1993 #else // MMX without MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1994 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1995 "lea (%0, %1), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1996 "lea (%%"REG_a", %1, 4), %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1997 // 0 1 2 3 4 5 6 7 8 9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
1998 // %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
1999 "pxor %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2000
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2001 #define REAL_MEDIAN(a,b,c)\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2002 "movq " #a ", %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2003 "movq " #b ", %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2004 "movq " #c ", %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2005 "movq %%mm0, %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2006 "movq %%mm1, %%mm4 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2007 "movq %%mm2, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2008 "psubusb %%mm1, %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2009 "psubusb %%mm2, %%mm4 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2010 "psubusb %%mm0, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2011 "pcmpeqb %%mm7, %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2012 "pcmpeqb %%mm7, %%mm4 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2013 "pcmpeqb %%mm7, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2014 "movq %%mm3, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2015 "pxor %%mm4, %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2016 "pxor %%mm5, %%mm4 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2017 "pxor %%mm6, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2018 "por %%mm3, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2019 "por %%mm4, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2020 "por %%mm5, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2021 "pand %%mm2, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2022 "pand %%mm1, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2023 "movq %%mm0, " #b " \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2024 #define MEDIAN(a,b,c) REAL_MEDIAN(a,b,c)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2025
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2026 MEDIAN((%0) , (%%REGa) , (%%REGa, %1))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2027 MEDIAN((%%REGa, %1), (%%REGa, %1, 2), (%0, %1, 4))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2028 MEDIAN((%0, %1, 4) , (%%REGd) , (%%REGd, %1))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2029 MEDIAN((%%REGd, %1), (%%REGd, %1, 2), (%0, %1, 8))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2030
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2031 : : "r" (src), "r" ((long)stride)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2032 : "%"REG_a, "%"REG_d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2033 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2034 #endif //HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2035 #else //HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2036 int x, y;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2037 src+= 4*stride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2038 // FIXME - there should be a way to do a few columns in parallel like w/mmx
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2039 for(x=0; x<8; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2040 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2041 uint8_t *colsrc = src;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2042 for (y=0; y<4; y++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2043 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2044 int a, b, c, d, e, f;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2045 a = colsrc[0 ];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2046 b = colsrc[stride ];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2047 c = colsrc[stride*2];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2048 d = (a-b)>>31;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2049 e = (b-c)>>31;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2050 f = (c-a)>>31;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2051 colsrc[stride ] = (a|(d^f)) & (b|(d^e)) & (c|(e^f));
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2052 colsrc += stride*2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2053 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2054 src++;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2055 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2056 #endif //HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2057 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2058
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2059 #ifdef HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2060 /**
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2061 * transposes and shift the given 8x8 Block into dst1 and dst2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2062 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2063 static inline void RENAME(transpose1)(uint8_t *dst1, uint8_t *dst2, uint8_t *src, int srcStride)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2064 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2065 asm(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2066 "lea (%0, %1), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2067 // 0 1 2 3 4 5 6 7 8 9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2068 // %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
2069 "movq (%0), %%mm0 \n\t" // 12345678
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2070 "movq (%%"REG_a"), %%mm1 \n\t" // abcdefgh
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2071 "movq %%mm0, %%mm2 \n\t" // 12345678
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2072 "punpcklbw %%mm1, %%mm0 \n\t" // 1a2b3c4d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2073 "punpckhbw %%mm1, %%mm2 \n\t" // 5e6f7g8h
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2074
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2075 "movq (%%"REG_a", %1), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2076 "movq (%%"REG_a", %1, 2), %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2077 "movq %%mm1, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2078 "punpcklbw %%mm3, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2079 "punpckhbw %%mm3, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2080
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2081 "movq %%mm0, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2082 "punpcklwd %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2083 "punpckhwd %%mm1, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2084 "movq %%mm2, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2085 "punpcklwd %%mm4, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2086 "punpckhwd %%mm4, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2087
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2088 "movd %%mm0, 128(%2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2089 "psrlq $32, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2090 "movd %%mm0, 144(%2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2091 "movd %%mm3, 160(%2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2092 "psrlq $32, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2093 "movd %%mm3, 176(%2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2094 "movd %%mm3, 48(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2095 "movd %%mm2, 192(%2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2096 "movd %%mm2, 64(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2097 "psrlq $32, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2098 "movd %%mm2, 80(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2099 "movd %%mm1, 96(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2100 "psrlq $32, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2101 "movd %%mm1, 112(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2102
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2103 "lea (%%"REG_a", %1, 4), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2104
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2105 "movq (%0, %1, 4), %%mm0 \n\t" // 12345678
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2106 "movq (%%"REG_a"), %%mm1 \n\t" // abcdefgh
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2107 "movq %%mm0, %%mm2 \n\t" // 12345678
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2108 "punpcklbw %%mm1, %%mm0 \n\t" // 1a2b3c4d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2109 "punpckhbw %%mm1, %%mm2 \n\t" // 5e6f7g8h
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2110
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2111 "movq (%%"REG_a", %1), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2112 "movq (%%"REG_a", %1, 2), %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2113 "movq %%mm1, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2114 "punpcklbw %%mm3, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2115 "punpckhbw %%mm3, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2116
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2117 "movq %%mm0, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2118 "punpcklwd %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2119 "punpckhwd %%mm1, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2120 "movq %%mm2, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2121 "punpcklwd %%mm4, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2122 "punpckhwd %%mm4, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2123
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2124 "movd %%mm0, 132(%2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2125 "psrlq $32, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2126 "movd %%mm0, 148(%2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2127 "movd %%mm3, 164(%2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2128 "psrlq $32, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2129 "movd %%mm3, 180(%2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2130 "movd %%mm3, 52(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2131 "movd %%mm2, 196(%2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2132 "movd %%mm2, 68(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2133 "psrlq $32, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2134 "movd %%mm2, 84(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2135 "movd %%mm1, 100(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2136 "psrlq $32, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2137 "movd %%mm1, 116(%3) \n\t"
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 :: "r" (src), "r" ((long)srcStride), "r" (dst1), "r" (dst2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2141 : "%"REG_a
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2142 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2143 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2144
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2145 /**
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2146 * transposes the given 8x8 block
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2147 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2148 static inline void RENAME(transpose2)(uint8_t *dst, int dstStride, uint8_t *src)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2149 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2150 asm(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2151 "lea (%0, %1), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2152 "lea (%%"REG_a",%1,4), %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2153 // 0 1 2 3 4 5 6 7 8 9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2154 // %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
2155 "movq (%2), %%mm0 \n\t" // 12345678
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2156 "movq 16(%2), %%mm1 \n\t" // abcdefgh
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2157 "movq %%mm0, %%mm2 \n\t" // 12345678
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2158 "punpcklbw %%mm1, %%mm0 \n\t" // 1a2b3c4d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2159 "punpckhbw %%mm1, %%mm2 \n\t" // 5e6f7g8h
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2160
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2161 "movq 32(%2), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2162 "movq 48(%2), %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2163 "movq %%mm1, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2164 "punpcklbw %%mm3, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2165 "punpckhbw %%mm3, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2166
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2167 "movq %%mm0, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2168 "punpcklwd %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2169 "punpckhwd %%mm1, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2170 "movq %%mm2, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2171 "punpcklwd %%mm4, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2172 "punpckhwd %%mm4, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2173
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2174 "movd %%mm0, (%0) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2175 "psrlq $32, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2176 "movd %%mm0, (%%"REG_a") \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2177 "movd %%mm3, (%%"REG_a", %1) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2178 "psrlq $32, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2179 "movd %%mm3, (%%"REG_a", %1, 2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2180 "movd %%mm2, (%0, %1, 4) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2181 "psrlq $32, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2182 "movd %%mm2, (%%"REG_d") \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2183 "movd %%mm1, (%%"REG_d", %1) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2184 "psrlq $32, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2185 "movd %%mm1, (%%"REG_d", %1, 2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2186
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2187
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2188 "movq 64(%2), %%mm0 \n\t" // 12345678
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2189 "movq 80(%2), %%mm1 \n\t" // abcdefgh
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2190 "movq %%mm0, %%mm2 \n\t" // 12345678
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2191 "punpcklbw %%mm1, %%mm0 \n\t" // 1a2b3c4d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2192 "punpckhbw %%mm1, %%mm2 \n\t" // 5e6f7g8h
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2193
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2194 "movq 96(%2), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2195 "movq 112(%2), %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2196 "movq %%mm1, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2197 "punpcklbw %%mm3, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2198 "punpckhbw %%mm3, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2199
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2200 "movq %%mm0, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2201 "punpcklwd %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2202 "punpckhwd %%mm1, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2203 "movq %%mm2, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2204 "punpcklwd %%mm4, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2205 "punpckhwd %%mm4, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2206
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2207 "movd %%mm0, 4(%0) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2208 "psrlq $32, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2209 "movd %%mm0, 4(%%"REG_a") \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2210 "movd %%mm3, 4(%%"REG_a", %1) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2211 "psrlq $32, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2212 "movd %%mm3, 4(%%"REG_a", %1, 2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2213 "movd %%mm2, 4(%0, %1, 4) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2214 "psrlq $32, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2215 "movd %%mm2, 4(%%"REG_d") \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2216 "movd %%mm1, 4(%%"REG_d", %1) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2217 "psrlq $32, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2218 "movd %%mm1, 4(%%"REG_d", %1, 2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2219
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2220 :: "r" (dst), "r" ((long)dstStride), "r" (src)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2221 : "%"REG_a, "%"REG_d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2222 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2223 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2224 #endif //HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2225 //static long test=0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2226
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2227 #ifndef HAVE_ALTIVEC
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2228 static inline void RENAME(tempNoiseReducer)(uint8_t *src, int stride,
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2229 uint8_t *tempBlured, uint32_t *tempBluredPast, int *maxNoise)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2230 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2231 // to save a register (FIXME do this outside of the loops)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2232 tempBluredPast[127]= maxNoise[0];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2233 tempBluredPast[128]= maxNoise[1];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2234 tempBluredPast[129]= maxNoise[2];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2235
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2236 #define FAST_L2_DIFF
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2237 //#define L1_DIFF //u should change the thresholds too if u try that one
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2238 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2239 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2240 "lea (%2, %2, 2), %%"REG_a" \n\t" // 3*stride
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2241 "lea (%2, %2, 4), %%"REG_d" \n\t" // 5*stride
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2242 "lea (%%"REG_d", %2, 2), %%"REG_c" \n\t" // 7*stride
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2243 // 0 1 2 3 4 5 6 7 8 9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2244 // %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
2245 //FIXME reorder?
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2246 #ifdef L1_DIFF //needs mmx2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2247 "movq (%0), %%mm0 \n\t" // L0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2248 "psadbw (%1), %%mm0 \n\t" // |L0-R0|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2249 "movq (%0, %2), %%mm1 \n\t" // L1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2250 "psadbw (%1, %2), %%mm1 \n\t" // |L1-R1|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2251 "movq (%0, %2, 2), %%mm2 \n\t" // L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2252 "psadbw (%1, %2, 2), %%mm2 \n\t" // |L2-R2|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2253 "movq (%0, %%"REG_a"), %%mm3 \n\t" // L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2254 "psadbw (%1, %%"REG_a"), %%mm3 \n\t" // |L3-R3|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2255
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2256 "movq (%0, %2, 4), %%mm4 \n\t" // L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2257 "paddw %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2258 "psadbw (%1, %2, 4), %%mm4 \n\t" // |L4-R4|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2259 "movq (%0, %%"REG_d"), %%mm5 \n\t" // L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2260 "paddw %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2261 "psadbw (%1, %%"REG_d"), %%mm5 \n\t" // |L5-R5|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2262 "movq (%0, %%"REG_a", 2), %%mm6 \n\t" // L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2263 "paddw %%mm3, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2264 "psadbw (%1, %%"REG_a", 2), %%mm6 \n\t" // |L6-R6|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2265 "movq (%0, %%"REG_c"), %%mm7 \n\t" // L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2266 "paddw %%mm4, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2267 "psadbw (%1, %%"REG_c"), %%mm7 \n\t" // |L7-R7|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2268 "paddw %%mm5, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2269 "paddw %%mm7, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2270 "paddw %%mm6, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2271 #else //L1_DIFF
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2272 #if defined (FAST_L2_DIFF)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2273 "pcmpeqb %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2274 "movq "MANGLE(b80)", %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2275 "pxor %%mm0, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2276 #define REAL_L2_DIFF_CORE(a, b)\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2277 "movq " #a ", %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2278 "movq " #b ", %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2279 "pxor %%mm7, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2280 PAVGB(%%mm2, %%mm5)\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2281 "paddb %%mm6, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2282 "movq %%mm5, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2283 "psllw $8, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2284 "pmaddwd %%mm5, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2285 "pmaddwd %%mm2, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2286 "paddd %%mm2, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2287 "psrld $14, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2288 "paddd %%mm5, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2289
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2290 #else //defined (FAST_L2_DIFF)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2291 "pxor %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2292 "pxor %%mm0, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2293 #define REAL_L2_DIFF_CORE(a, b)\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2294 "movq " #a ", %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2295 "movq " #b ", %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2296 "movq %%mm5, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2297 "movq %%mm2, %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2298 "punpcklbw %%mm7, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2299 "punpckhbw %%mm7, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2300 "punpcklbw %%mm7, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2301 "punpckhbw %%mm7, %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2302 "psubw %%mm2, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2303 "psubw %%mm3, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2304 "pmaddwd %%mm5, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2305 "pmaddwd %%mm1, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2306 "paddd %%mm1, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2307 "paddd %%mm5, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2308
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2309 #endif //defined (FAST_L2_DIFF)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2310
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2311 #define L2_DIFF_CORE(a, b) REAL_L2_DIFF_CORE(a, b)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2312
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2313 L2_DIFF_CORE((%0) , (%1))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2314 L2_DIFF_CORE((%0, %2) , (%1, %2))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2315 L2_DIFF_CORE((%0, %2, 2) , (%1, %2, 2))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2316 L2_DIFF_CORE((%0, %%REGa) , (%1, %%REGa))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2317 L2_DIFF_CORE((%0, %2, 4) , (%1, %2, 4))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2318 L2_DIFF_CORE((%0, %%REGd) , (%1, %%REGd))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2319 L2_DIFF_CORE((%0, %%REGa,2), (%1, %%REGa,2))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2320 L2_DIFF_CORE((%0, %%REGc) , (%1, %%REGc))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2321
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2322 #endif //L1_DIFF
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2323
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2324 "movq %%mm0, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2325 "psrlq $32, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2326 "paddd %%mm0, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2327 "movd %%mm4, %%ecx \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2328 "shll $2, %%ecx \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2329 "mov %3, %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2330 "addl -4(%%"REG_d"), %%ecx \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2331 "addl 4(%%"REG_d"), %%ecx \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2332 "addl -1024(%%"REG_d"), %%ecx \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2333 "addl $4, %%ecx \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2334 "addl 1024(%%"REG_d"), %%ecx \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2335 "shrl $3, %%ecx \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2336 "movl %%ecx, (%%"REG_d") \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2337
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2338 // "mov %3, %%"REG_c" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2339 // "mov %%"REG_c", test \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2340 // "jmp 4f \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2341 "cmpl 512(%%"REG_d"), %%ecx \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2342 " jb 2f \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2343 "cmpl 516(%%"REG_d"), %%ecx \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2344 " jb 1f \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2345
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2346 "lea (%%"REG_a", %2, 2), %%"REG_d" \n\t" // 5*stride
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2347 "lea (%%"REG_d", %2, 2), %%"REG_c" \n\t" // 7*stride
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2348 "movq (%0), %%mm0 \n\t" // L0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2349 "movq (%0, %2), %%mm1 \n\t" // L1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2350 "movq (%0, %2, 2), %%mm2 \n\t" // L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2351 "movq (%0, %%"REG_a"), %%mm3 \n\t" // L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2352 "movq (%0, %2, 4), %%mm4 \n\t" // L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2353 "movq (%0, %%"REG_d"), %%mm5 \n\t" // L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2354 "movq (%0, %%"REG_a", 2), %%mm6 \n\t" // L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2355 "movq (%0, %%"REG_c"), %%mm7 \n\t" // L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2356 "movq %%mm0, (%1) \n\t" // L0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2357 "movq %%mm1, (%1, %2) \n\t" // L1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2358 "movq %%mm2, (%1, %2, 2) \n\t" // L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2359 "movq %%mm3, (%1, %%"REG_a") \n\t" // L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2360 "movq %%mm4, (%1, %2, 4) \n\t" // L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2361 "movq %%mm5, (%1, %%"REG_d") \n\t" // L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2362 "movq %%mm6, (%1, %%"REG_a", 2) \n\t" // L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2363 "movq %%mm7, (%1, %%"REG_c") \n\t" // L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2364 "jmp 4f \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2365
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2366 "1: \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2367 "lea (%%"REG_a", %2, 2), %%"REG_d" \n\t" // 5*stride
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2368 "lea (%%"REG_d", %2, 2), %%"REG_c" \n\t" // 7*stride
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2369 "movq (%0), %%mm0 \n\t" // L0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2370 PAVGB((%1), %%mm0) // L0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2371 "movq (%0, %2), %%mm1 \n\t" // L1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2372 PAVGB((%1, %2), %%mm1) // L1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2373 "movq (%0, %2, 2), %%mm2 \n\t" // L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2374 PAVGB((%1, %2, 2), %%mm2) // L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2375 "movq (%0, %%"REG_a"), %%mm3 \n\t" // L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2376 PAVGB((%1, %%REGa), %%mm3) // L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2377 "movq (%0, %2, 4), %%mm4 \n\t" // L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2378 PAVGB((%1, %2, 4), %%mm4) // L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2379 "movq (%0, %%"REG_d"), %%mm5 \n\t" // L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2380 PAVGB((%1, %%REGd), %%mm5) // L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2381 "movq (%0, %%"REG_a", 2), %%mm6 \n\t" // L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2382 PAVGB((%1, %%REGa, 2), %%mm6) // L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2383 "movq (%0, %%"REG_c"), %%mm7 \n\t" // L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2384 PAVGB((%1, %%REGc), %%mm7) // L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2385 "movq %%mm0, (%1) \n\t" // R0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2386 "movq %%mm1, (%1, %2) \n\t" // R1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2387 "movq %%mm2, (%1, %2, 2) \n\t" // R2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2388 "movq %%mm3, (%1, %%"REG_a") \n\t" // R3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2389 "movq %%mm4, (%1, %2, 4) \n\t" // R4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2390 "movq %%mm5, (%1, %%"REG_d") \n\t" // R5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2391 "movq %%mm6, (%1, %%"REG_a", 2) \n\t" // R6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2392 "movq %%mm7, (%1, %%"REG_c") \n\t" // R7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2393 "movq %%mm0, (%0) \n\t" // L0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2394 "movq %%mm1, (%0, %2) \n\t" // L1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2395 "movq %%mm2, (%0, %2, 2) \n\t" // L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2396 "movq %%mm3, (%0, %%"REG_a") \n\t" // L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2397 "movq %%mm4, (%0, %2, 4) \n\t" // L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2398 "movq %%mm5, (%0, %%"REG_d") \n\t" // L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2399 "movq %%mm6, (%0, %%"REG_a", 2) \n\t" // L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2400 "movq %%mm7, (%0, %%"REG_c") \n\t" // L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2401 "jmp 4f \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2402
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2403 "2: \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2404 "cmpl 508(%%"REG_d"), %%ecx \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2405 " jb 3f \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2406
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2407 "lea (%%"REG_a", %2, 2), %%"REG_d" \n\t" // 5*stride
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2408 "lea (%%"REG_d", %2, 2), %%"REG_c" \n\t" // 7*stride
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2409 "movq (%0), %%mm0 \n\t" // L0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2410 "movq (%0, %2), %%mm1 \n\t" // L1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2411 "movq (%0, %2, 2), %%mm2 \n\t" // L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2412 "movq (%0, %%"REG_a"), %%mm3 \n\t" // L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2413 "movq (%1), %%mm4 \n\t" // R0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2414 "movq (%1, %2), %%mm5 \n\t" // R1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2415 "movq (%1, %2, 2), %%mm6 \n\t" // R2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2416 "movq (%1, %%"REG_a"), %%mm7 \n\t" // R3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2417 PAVGB(%%mm4, %%mm0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2418 PAVGB(%%mm5, %%mm1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2419 PAVGB(%%mm6, %%mm2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2420 PAVGB(%%mm7, %%mm3)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2421 PAVGB(%%mm4, %%mm0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2422 PAVGB(%%mm5, %%mm1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2423 PAVGB(%%mm6, %%mm2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2424 PAVGB(%%mm7, %%mm3)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2425 "movq %%mm0, (%1) \n\t" // R0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2426 "movq %%mm1, (%1, %2) \n\t" // R1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2427 "movq %%mm2, (%1, %2, 2) \n\t" // R2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2428 "movq %%mm3, (%1, %%"REG_a") \n\t" // R3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2429 "movq %%mm0, (%0) \n\t" // L0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2430 "movq %%mm1, (%0, %2) \n\t" // L1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2431 "movq %%mm2, (%0, %2, 2) \n\t" // L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2432 "movq %%mm3, (%0, %%"REG_a") \n\t" // L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2433
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2434 "movq (%0, %2, 4), %%mm0 \n\t" // L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2435 "movq (%0, %%"REG_d"), %%mm1 \n\t" // L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2436 "movq (%0, %%"REG_a", 2), %%mm2 \n\t" // L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2437 "movq (%0, %%"REG_c"), %%mm3 \n\t" // L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2438 "movq (%1, %2, 4), %%mm4 \n\t" // R4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2439 "movq (%1, %%"REG_d"), %%mm5 \n\t" // R5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2440 "movq (%1, %%"REG_a", 2), %%mm6 \n\t" // R6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2441 "movq (%1, %%"REG_c"), %%mm7 \n\t" // R7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2442 PAVGB(%%mm4, %%mm0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2443 PAVGB(%%mm5, %%mm1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2444 PAVGB(%%mm6, %%mm2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2445 PAVGB(%%mm7, %%mm3)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2446 PAVGB(%%mm4, %%mm0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2447 PAVGB(%%mm5, %%mm1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2448 PAVGB(%%mm6, %%mm2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2449 PAVGB(%%mm7, %%mm3)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2450 "movq %%mm0, (%1, %2, 4) \n\t" // R4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2451 "movq %%mm1, (%1, %%"REG_d") \n\t" // R5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2452 "movq %%mm2, (%1, %%"REG_a", 2) \n\t" // R6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2453 "movq %%mm3, (%1, %%"REG_c") \n\t" // R7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2454 "movq %%mm0, (%0, %2, 4) \n\t" // L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2455 "movq %%mm1, (%0, %%"REG_d") \n\t" // L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2456 "movq %%mm2, (%0, %%"REG_a", 2) \n\t" // L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2457 "movq %%mm3, (%0, %%"REG_c") \n\t" // L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2458 "jmp 4f \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2459
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2460 "3: \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2461 "lea (%%"REG_a", %2, 2), %%"REG_d" \n\t" // 5*stride
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2462 "lea (%%"REG_d", %2, 2), %%"REG_c" \n\t" // 7*stride
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2463 "movq (%0), %%mm0 \n\t" // L0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2464 "movq (%0, %2), %%mm1 \n\t" // L1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2465 "movq (%0, %2, 2), %%mm2 \n\t" // L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2466 "movq (%0, %%"REG_a"), %%mm3 \n\t" // L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2467 "movq (%1), %%mm4 \n\t" // R0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2468 "movq (%1, %2), %%mm5 \n\t" // R1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2469 "movq (%1, %2, 2), %%mm6 \n\t" // R2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2470 "movq (%1, %%"REG_a"), %%mm7 \n\t" // R3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2471 PAVGB(%%mm4, %%mm0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2472 PAVGB(%%mm5, %%mm1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2473 PAVGB(%%mm6, %%mm2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2474 PAVGB(%%mm7, %%mm3)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2475 PAVGB(%%mm4, %%mm0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2476 PAVGB(%%mm5, %%mm1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2477 PAVGB(%%mm6, %%mm2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2478 PAVGB(%%mm7, %%mm3)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2479 PAVGB(%%mm4, %%mm0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2480 PAVGB(%%mm5, %%mm1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2481 PAVGB(%%mm6, %%mm2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2482 PAVGB(%%mm7, %%mm3)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2483 "movq %%mm0, (%1) \n\t" // R0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2484 "movq %%mm1, (%1, %2) \n\t" // R1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2485 "movq %%mm2, (%1, %2, 2) \n\t" // R2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2486 "movq %%mm3, (%1, %%"REG_a") \n\t" // R3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2487 "movq %%mm0, (%0) \n\t" // L0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2488 "movq %%mm1, (%0, %2) \n\t" // L1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2489 "movq %%mm2, (%0, %2, 2) \n\t" // L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2490 "movq %%mm3, (%0, %%"REG_a") \n\t" // L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2491
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2492 "movq (%0, %2, 4), %%mm0 \n\t" // L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2493 "movq (%0, %%"REG_d"), %%mm1 \n\t" // L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2494 "movq (%0, %%"REG_a", 2), %%mm2 \n\t" // L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2495 "movq (%0, %%"REG_c"), %%mm3 \n\t" // L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2496 "movq (%1, %2, 4), %%mm4 \n\t" // R4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2497 "movq (%1, %%"REG_d"), %%mm5 \n\t" // R5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2498 "movq (%1, %%"REG_a", 2), %%mm6 \n\t" // R6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2499 "movq (%1, %%"REG_c"), %%mm7 \n\t" // R7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2500 PAVGB(%%mm4, %%mm0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2501 PAVGB(%%mm5, %%mm1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2502 PAVGB(%%mm6, %%mm2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2503 PAVGB(%%mm7, %%mm3)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2504 PAVGB(%%mm4, %%mm0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2505 PAVGB(%%mm5, %%mm1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2506 PAVGB(%%mm6, %%mm2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2507 PAVGB(%%mm7, %%mm3)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2508 PAVGB(%%mm4, %%mm0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2509 PAVGB(%%mm5, %%mm1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2510 PAVGB(%%mm6, %%mm2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2511 PAVGB(%%mm7, %%mm3)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2512 "movq %%mm0, (%1, %2, 4) \n\t" // R4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2513 "movq %%mm1, (%1, %%"REG_d") \n\t" // R5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2514 "movq %%mm2, (%1, %%"REG_a", 2) \n\t" // R6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2515 "movq %%mm3, (%1, %%"REG_c") \n\t" // R7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2516 "movq %%mm0, (%0, %2, 4) \n\t" // L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2517 "movq %%mm1, (%0, %%"REG_d") \n\t" // L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2518 "movq %%mm2, (%0, %%"REG_a", 2) \n\t" // L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2519 "movq %%mm3, (%0, %%"REG_c") \n\t" // L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2520
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2521 "4: \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2522
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2523 :: "r" (src), "r" (tempBlured), "r"((long)stride), "m" (tempBluredPast)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2524 : "%"REG_a, "%"REG_d, "%"REG_c, "memory"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2525 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2526 #else //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2527 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2528 int y;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2529 int d=0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2530 // int sysd=0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2531 int i;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2532
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2533 for(y=0; y<8; y++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2534 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2535 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2536 for(x=0; x<8; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2537 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2538 int ref= tempBlured[ x + y*stride ];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2539 int cur= src[ x + y*stride ];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2540 int d1=ref - cur;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2541 // if(x==0 || x==7) d1+= d1>>1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2542 // if(y==0 || y==7) d1+= d1>>1;
32
cb746db3fd32 Rename ABS macro to FFABS.
diego
parents: 31
diff changeset
2543 // d+= FFABS(d1);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2544 d+= d1*d1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2545 // sysd+= d1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2546 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2547 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2548 i=d;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2549 d= (
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2550 4*d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2551 +(*(tempBluredPast-256))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2552 +(*(tempBluredPast-1))+ (*(tempBluredPast+1))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2553 +(*(tempBluredPast+256))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2554 +4)>>3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2555 *tempBluredPast=i;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2556 // ((*tempBluredPast)*3 + d + 2)>>2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2557
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2558 /*
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2559 Switch between
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2560 1 0 0 0 0 0 0 (0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2561 64 32 16 8 4 2 1 (1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2562 64 48 36 27 20 15 11 (33) (approx)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2563 64 56 49 43 37 33 29 (200) (approx)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2564 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2565 if(d > maxNoise[1])
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2566 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2567 if(d < maxNoise[2])
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2568 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2569 for(y=0; y<8; y++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2570 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2571 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2572 for(x=0; x<8; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2573 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2574 int ref= tempBlured[ x + y*stride ];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2575 int cur= src[ x + y*stride ];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2576 tempBlured[ x + y*stride ]=
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2577 src[ x + y*stride ]=
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2578 (ref + cur + 1)>>1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2579 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2580 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2581 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2582 else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2583 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2584 for(y=0; y<8; y++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2585 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2586 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2587 for(x=0; x<8; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2588 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2589 tempBlured[ x + y*stride ]= src[ x + y*stride ];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2590 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2591 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2592 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2593 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2594 else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2595 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2596 if(d < maxNoise[0])
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2597 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2598 for(y=0; y<8; y++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2599 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2600 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2601 for(x=0; x<8; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2602 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2603 int ref= tempBlured[ x + y*stride ];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2604 int cur= src[ x + y*stride ];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2605 tempBlured[ x + y*stride ]=
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2606 src[ x + y*stride ]=
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2607 (ref*7 + cur + 4)>>3;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2608 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2609 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2610 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2611 else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2612 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2613 for(y=0; y<8; y++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2614 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2615 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2616 for(x=0; x<8; x++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2617 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2618 int ref= tempBlured[ x + y*stride ];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2619 int cur= src[ x + y*stride ];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2620 tempBlured[ x + y*stride ]=
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2621 src[ x + y*stride ]=
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2622 (ref*3 + cur + 2)>>2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2623 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2624 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2625 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2626 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2627 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2628 #endif //defined (HAVE_MMX2) || defined (HAVE_3DNOW)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2629 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2630 #endif //HAVE_ALTIVEC
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2631
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2632 #ifdef HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2633 /**
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2634 * accurate deblock filter
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2635 */
38
63d07317cd7a rename always_inline to av_always_inline and move to common.h
mru
parents: 32
diff changeset
2636 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
2637 int64_t dc_mask, eq_mask, both_masks;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2638 int64_t sums[10*8*2];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2639 src+= step*3; // src points to begin of the 8x8 Block
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2640 //START_TIMER
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2641 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2642 "movq %0, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2643 "movq %1, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2644 : : "m" (c->mmxDcOffset[c->nonBQP]), "m" (c->mmxDcThreshold[c->nonBQP])
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2645 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2646
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2647 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2648 "lea (%2, %3), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2649 // 0 1 2 3 4 5 6 7 8 9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2650 // %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
2651
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2652 "movq (%2), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2653 "movq (%%"REG_a"), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2654 "movq %%mm1, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2655 "movq %%mm1, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2656 "psubb %%mm1, %%mm0 \n\t" // mm0 = differnece
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2657 "paddb %%mm7, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2658 "pcmpgtb %%mm6, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2659
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2660 "movq (%%"REG_a",%3), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2661 PMAXUB(%%mm2, %%mm4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2662 PMINUB(%%mm2, %%mm3, %%mm5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2663 "psubb %%mm2, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2664 "paddb %%mm7, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2665 "pcmpgtb %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2666 "paddb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2667
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2668 "movq (%%"REG_a", %3, 2), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2669 PMAXUB(%%mm1, %%mm4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2670 PMINUB(%%mm1, %%mm3, %%mm5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2671 "psubb %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2672 "paddb %%mm7, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2673 "pcmpgtb %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2674 "paddb %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2675
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2676 "lea (%%"REG_a", %3, 4), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2677
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2678 "movq (%2, %3, 4), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2679 PMAXUB(%%mm2, %%mm4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2680 PMINUB(%%mm2, %%mm3, %%mm5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2681 "psubb %%mm2, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2682 "paddb %%mm7, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2683 "pcmpgtb %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2684 "paddb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2685
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2686 "movq (%%"REG_a"), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2687 PMAXUB(%%mm1, %%mm4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2688 PMINUB(%%mm1, %%mm3, %%mm5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2689 "psubb %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2690 "paddb %%mm7, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2691 "pcmpgtb %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2692 "paddb %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2693
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2694 "movq (%%"REG_a", %3), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2695 PMAXUB(%%mm2, %%mm4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2696 PMINUB(%%mm2, %%mm3, %%mm5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2697 "psubb %%mm2, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2698 "paddb %%mm7, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2699 "pcmpgtb %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2700 "paddb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2701
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2702 "movq (%%"REG_a", %3, 2), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2703 PMAXUB(%%mm1, %%mm4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2704 PMINUB(%%mm1, %%mm3, %%mm5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2705 "psubb %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2706 "paddb %%mm7, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2707 "pcmpgtb %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2708 "paddb %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2709
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2710 "movq (%2, %3, 8), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2711 PMAXUB(%%mm2, %%mm4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2712 PMINUB(%%mm2, %%mm3, %%mm5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2713 "psubb %%mm2, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2714 "paddb %%mm7, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2715 "pcmpgtb %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2716 "paddb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2717
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2718 "movq (%%"REG_a", %3, 4), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2719 "psubb %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2720 "paddb %%mm7, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2721 "pcmpgtb %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2722 "paddb %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2723 "psubusb %%mm3, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2724
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2725 "pxor %%mm6, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2726 "movq %4, %%mm7 \n\t" // QP,..., QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2727 "paddusb %%mm7, %%mm7 \n\t" // 2QP ... 2QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2728 "psubusb %%mm4, %%mm7 \n\t" // Diff >=2QP -> 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2729 "pcmpeqb %%mm6, %%mm7 \n\t" // Diff < 2QP -> 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2730 "pcmpeqb %%mm6, %%mm7 \n\t" // Diff < 2QP -> 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2731 "movq %%mm7, %1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2732
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2733 "movq %5, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2734 "punpcklbw %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2735 "punpcklbw %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2736 "punpcklbw %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2737 "psubb %%mm0, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2738 "pcmpgtb %%mm7, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2739 "movq %%mm6, %0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2740
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2741 : "=m" (eq_mask), "=m" (dc_mask)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2742 : "r" (src), "r" ((long)step), "m" (c->pQPb), "m"(c->ppMode.flatnessThreshold)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2743 : "%"REG_a
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2744 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2745
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2746 both_masks = dc_mask & eq_mask;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2747
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2748 if(both_masks){
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2749 long offset= -8*step;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2750 int64_t *temp_sums= sums;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2751
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2752 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2753 "movq %2, %%mm0 \n\t" // QP,..., QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2754 "pxor %%mm4, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2755
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2756 "movq (%0), %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2757 "movq (%0, %1), %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2758 "movq %%mm5, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2759 "movq %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2760 "psubusb %%mm6, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2761 "psubusb %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2762 "por %%mm5, %%mm2 \n\t" // ABS Diff of lines
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2763 "psubusb %%mm2, %%mm0 \n\t" // diff >= QP -> 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2764 "pcmpeqb %%mm4, %%mm0 \n\t" // diff >= QP -> FF
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2765
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2766 "pxor %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2767 "pand %%mm0, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2768 "pxor %%mm1, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2769 // 0:QP 6:First
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2770
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2771 "movq (%0, %1, 8), %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2772 "add %1, %0 \n\t" // %0 points to line 1 not 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2773 "movq (%0, %1, 8), %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2774 "movq %%mm5, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2775 "movq %%mm7, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2776 "psubusb %%mm7, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2777 "psubusb %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2778 "por %%mm5, %%mm2 \n\t" // ABS Diff of lines
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2779 "movq %2, %%mm0 \n\t" // QP,..., QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2780 "psubusb %%mm2, %%mm0 \n\t" // diff >= QP -> 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2781 "pcmpeqb %%mm4, %%mm0 \n\t" // diff >= QP -> FF
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2782
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2783 "pxor %%mm7, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2784 "pand %%mm0, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2785 "pxor %%mm1, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2786
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2787 "movq %%mm6, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2788 "punpckhbw %%mm4, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2789 "punpcklbw %%mm4, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2790 // 4:0 5/6:First 7:Last
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2791
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2792 "movq %%mm5, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2793 "movq %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2794 "psllw $2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2795 "psllw $2, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2796 "paddw "MANGLE(w04)", %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2797 "paddw "MANGLE(w04)", %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2798
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2799 #define NEXT\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2800 "movq (%0), %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2801 "movq (%0), %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2802 "add %1, %0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2803 "punpcklbw %%mm4, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2804 "punpckhbw %%mm4, %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2805 "paddw %%mm2, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2806 "paddw %%mm3, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2807
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2808 #define PREV\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2809 "movq (%0), %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2810 "movq (%0), %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2811 "add %1, %0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2812 "punpcklbw %%mm4, %%mm2 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2813 "punpckhbw %%mm4, %%mm3 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2814 "psubw %%mm2, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2815 "psubw %%mm3, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2816
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2817
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2818 NEXT //0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2819 NEXT //1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2820 NEXT //2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2821 "movq %%mm0, (%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2822 "movq %%mm1, 8(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2823
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2824 NEXT //3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2825 "psubw %%mm5, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2826 "psubw %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2827 "movq %%mm0, 16(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2828 "movq %%mm1, 24(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2829
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2830 NEXT //4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2831 "psubw %%mm5, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2832 "psubw %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2833 "movq %%mm0, 32(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2834 "movq %%mm1, 40(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2835
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2836 NEXT //5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2837 "psubw %%mm5, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2838 "psubw %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2839 "movq %%mm0, 48(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2840 "movq %%mm1, 56(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2841
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2842 NEXT //6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2843 "psubw %%mm5, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2844 "psubw %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2845 "movq %%mm0, 64(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2846 "movq %%mm1, 72(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2847
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2848 "movq %%mm7, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2849 "punpckhbw %%mm4, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2850 "punpcklbw %%mm4, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2851
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2852 NEXT //7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2853 "mov %4, %0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2854 "add %1, %0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2855 PREV //0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2856 "movq %%mm0, 80(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2857 "movq %%mm1, 88(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2858
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2859 PREV //1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2860 "paddw %%mm6, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2861 "paddw %%mm7, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2862 "movq %%mm0, 96(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2863 "movq %%mm1, 104(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2864
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2865 PREV //2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2866 "paddw %%mm6, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2867 "paddw %%mm7, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2868 "movq %%mm0, 112(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2869 "movq %%mm1, 120(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2870
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2871 PREV //3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2872 "paddw %%mm6, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2873 "paddw %%mm7, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2874 "movq %%mm0, 128(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2875 "movq %%mm1, 136(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2876
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2877 PREV //4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2878 "paddw %%mm6, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2879 "paddw %%mm7, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2880 "movq %%mm0, 144(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2881 "movq %%mm1, 152(%3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2882
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2883 "mov %4, %0 \n\t" //FIXME
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2884
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2885 : "+&r"(src)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2886 : "r" ((long)step), "m" (c->pQPb), "r"(sums), "g"(src)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2887 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2888
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2889 src+= step; // src points to begin of the 8x8 Block
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2890
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2891 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2892 "movq %4, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2893 "pcmpeqb %%mm5, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2894 "pxor %%mm6, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2895 "pxor %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2896
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2897 "1: \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2898 "movq (%1), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2899 "movq 8(%1), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2900 "paddw 32(%1), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2901 "paddw 40(%1), %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2902 "movq (%0, %3), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2903 "movq %%mm2, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2904 "movq %%mm2, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2905 "punpcklbw %%mm7, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2906 "punpckhbw %%mm7, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2907 "paddw %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2908 "paddw %%mm3, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2909 "paddw %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2910 "paddw %%mm3, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2911 "psrlw $4, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2912 "psrlw $4, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2913 "packuswb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2914 "pand %%mm6, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2915 "pand %%mm5, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2916 "por %%mm4, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2917 "movq %%mm0, (%0, %3) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2918 "add $16, %1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2919 "add %2, %0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2920 " js 1b \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2921
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2922 : "+r"(offset), "+r"(temp_sums)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2923 : "r" ((long)step), "r"(src - offset), "m"(both_masks)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2924 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2925 }else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2926 src+= step; // src points to begin of the 8x8 Block
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2927
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2928 if(eq_mask != -1LL){
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2929 uint8_t *temp_src= src;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2930 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2931 "pxor %%mm7, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2932 "lea -40(%%"REG_SP"), %%"REG_c" \n\t" // make space for 4 8-byte vars
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2933 "and "ALIGN_MASK", %%"REG_c" \n\t" // align
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2934 // 0 1 2 3 4 5 6 7 8 9
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2935 // %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
2936
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2937 "movq (%0), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2938 "movq %%mm0, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2939 "punpcklbw %%mm7, %%mm0 \n\t" // low part of line 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2940 "punpckhbw %%mm7, %%mm1 \n\t" // high part of line 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2941
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2942 "movq (%0, %1), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2943 "lea (%0, %1, 2), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2944 "movq %%mm2, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2945 "punpcklbw %%mm7, %%mm2 \n\t" // low part of line 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2946 "punpckhbw %%mm7, %%mm3 \n\t" // high part of line 1
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2947
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2948 "movq (%%"REG_a"), %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2949 "movq %%mm4, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2950 "punpcklbw %%mm7, %%mm4 \n\t" // low part of line 2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2951 "punpckhbw %%mm7, %%mm5 \n\t" // high part of line 2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2952
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2953 "paddw %%mm0, %%mm0 \n\t" // 2L0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2954 "paddw %%mm1, %%mm1 \n\t" // 2H0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2955 "psubw %%mm4, %%mm2 \n\t" // L1 - L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2956 "psubw %%mm5, %%mm3 \n\t" // H1 - H2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2957 "psubw %%mm2, %%mm0 \n\t" // 2L0 - L1 + L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2958 "psubw %%mm3, %%mm1 \n\t" // 2H0 - H1 + H2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2959
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2960 "psllw $2, %%mm2 \n\t" // 4L1 - 4L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2961 "psllw $2, %%mm3 \n\t" // 4H1 - 4H2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2962 "psubw %%mm2, %%mm0 \n\t" // 2L0 - 5L1 + 5L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2963 "psubw %%mm3, %%mm1 \n\t" // 2H0 - 5H1 + 5H2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2964
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2965 "movq (%%"REG_a", %1), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2966 "movq %%mm2, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2967 "punpcklbw %%mm7, %%mm2 \n\t" // L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2968 "punpckhbw %%mm7, %%mm3 \n\t" // H3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2969
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2970 "psubw %%mm2, %%mm0 \n\t" // 2L0 - 5L1 + 5L2 - L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2971 "psubw %%mm3, %%mm1 \n\t" // 2H0 - 5H1 + 5H2 - H3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2972 "psubw %%mm2, %%mm0 \n\t" // 2L0 - 5L1 + 5L2 - 2L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2973 "psubw %%mm3, %%mm1 \n\t" // 2H0 - 5H1 + 5H2 - 2H3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2974 "movq %%mm0, (%%"REG_c") \n\t" // 2L0 - 5L1 + 5L2 - 2L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2975 "movq %%mm1, 8(%%"REG_c") \n\t" // 2H0 - 5H1 + 5H2 - 2H3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2976
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2977 "movq (%%"REG_a", %1, 2), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2978 "movq %%mm0, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2979 "punpcklbw %%mm7, %%mm0 \n\t" // L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2980 "punpckhbw %%mm7, %%mm1 \n\t" // H4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2981
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2982 "psubw %%mm0, %%mm2 \n\t" // L3 - L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2983 "psubw %%mm1, %%mm3 \n\t" // H3 - H4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2984 "movq %%mm2, 16(%%"REG_c") \n\t" // L3 - L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2985 "movq %%mm3, 24(%%"REG_c") \n\t" // H3 - H4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2986 "paddw %%mm4, %%mm4 \n\t" // 2L2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2987 "paddw %%mm5, %%mm5 \n\t" // 2H2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2988 "psubw %%mm2, %%mm4 \n\t" // 2L2 - L3 + L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2989 "psubw %%mm3, %%mm5 \n\t" // 2H2 - H3 + H4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2990
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2991 "lea (%%"REG_a", %1), %0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2992 "psllw $2, %%mm2 \n\t" // 4L3 - 4L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2993 "psllw $2, %%mm3 \n\t" // 4H3 - 4H4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2994 "psubw %%mm2, %%mm4 \n\t" // 2L2 - 5L3 + 5L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2995 "psubw %%mm3, %%mm5 \n\t" // 2H2 - 5H3 + 5H4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2996 //50 opcodes so far
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2997 "movq (%0, %1, 2), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2998 "movq %%mm2, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
2999 "punpcklbw %%mm7, %%mm2 \n\t" // L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3000 "punpckhbw %%mm7, %%mm3 \n\t" // H5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3001 "psubw %%mm2, %%mm4 \n\t" // 2L2 - 5L3 + 5L4 - L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3002 "psubw %%mm3, %%mm5 \n\t" // 2H2 - 5H3 + 5H4 - H5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3003 "psubw %%mm2, %%mm4 \n\t" // 2L2 - 5L3 + 5L4 - 2L5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3004 "psubw %%mm3, %%mm5 \n\t" // 2H2 - 5H3 + 5H4 - 2H5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3005
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3006 "movq (%%"REG_a", %1, 4), %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3007 "punpcklbw %%mm7, %%mm6 \n\t" // L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3008 "psubw %%mm6, %%mm2 \n\t" // L5 - L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3009 "movq (%%"REG_a", %1, 4), %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3010 "punpckhbw %%mm7, %%mm6 \n\t" // H6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3011 "psubw %%mm6, %%mm3 \n\t" // H5 - H6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3012
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3013 "paddw %%mm0, %%mm0 \n\t" // 2L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3014 "paddw %%mm1, %%mm1 \n\t" // 2H4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3015 "psubw %%mm2, %%mm0 \n\t" // 2L4 - L5 + L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3016 "psubw %%mm3, %%mm1 \n\t" // 2H4 - H5 + H6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3017
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3018 "psllw $2, %%mm2 \n\t" // 4L5 - 4L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3019 "psllw $2, %%mm3 \n\t" // 4H5 - 4H6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3020 "psubw %%mm2, %%mm0 \n\t" // 2L4 - 5L5 + 5L6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3021 "psubw %%mm3, %%mm1 \n\t" // 2H4 - 5H5 + 5H6
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3022
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3023 "movq (%0, %1, 4), %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3024 "movq %%mm2, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3025 "punpcklbw %%mm7, %%mm2 \n\t" // L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3026 "punpckhbw %%mm7, %%mm3 \n\t" // H7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3027
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3028 "paddw %%mm2, %%mm2 \n\t" // 2L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3029 "paddw %%mm3, %%mm3 \n\t" // 2H7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3030 "psubw %%mm2, %%mm0 \n\t" // 2L4 - 5L5 + 5L6 - 2L7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3031 "psubw %%mm3, %%mm1 \n\t" // 2H4 - 5H5 + 5H6 - 2H7
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3032
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3033 "movq (%%"REG_c"), %%mm2 \n\t" // 2L0 - 5L1 + 5L2 - 2L3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3034 "movq 8(%%"REG_c"), %%mm3 \n\t" // 2H0 - 5H1 + 5H2 - 2H3
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3035
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3036 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3037 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3038 "psubw %%mm0, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3039 "pmaxsw %%mm6, %%mm0 \n\t" // |2L4 - 5L5 + 5L6 - 2L7|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3040 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3041 "psubw %%mm1, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3042 "pmaxsw %%mm6, %%mm1 \n\t" // |2H4 - 5H5 + 5H6 - 2H7|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3043 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3044 "psubw %%mm2, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3045 "pmaxsw %%mm6, %%mm2 \n\t" // |2L0 - 5L1 + 5L2 - 2L3|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3046 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3047 "psubw %%mm3, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3048 "pmaxsw %%mm6, %%mm3 \n\t" // |2H0 - 5H1 + 5H2 - 2H3|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3049 #else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3050 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3051 "pcmpgtw %%mm0, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3052 "pxor %%mm6, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3053 "psubw %%mm6, %%mm0 \n\t" // |2L4 - 5L5 + 5L6 - 2L7|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3054 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3055 "pcmpgtw %%mm1, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3056 "pxor %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3057 "psubw %%mm6, %%mm1 \n\t" // |2H4 - 5H5 + 5H6 - 2H7|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3058 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3059 "pcmpgtw %%mm2, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3060 "pxor %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3061 "psubw %%mm6, %%mm2 \n\t" // |2L0 - 5L1 + 5L2 - 2L3|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3062 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3063 "pcmpgtw %%mm3, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3064 "pxor %%mm6, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3065 "psubw %%mm6, %%mm3 \n\t" // |2H0 - 5H1 + 5H2 - 2H3|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3066 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3067
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3068 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3069 "pminsw %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3070 "pminsw %%mm3, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3071 #else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3072 "movq %%mm0, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3073 "psubusw %%mm2, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3074 "psubw %%mm6, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3075 "movq %%mm1, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3076 "psubusw %%mm3, %%mm6 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3077 "psubw %%mm6, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3078 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3079
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3080 "movd %2, %%mm2 \n\t" // QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3081 "punpcklbw %%mm7, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3082
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3083 "movq %%mm7, %%mm6 \n\t" // 0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3084 "pcmpgtw %%mm4, %%mm6 \n\t" // sign(2L2 - 5L3 + 5L4 - 2L5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3085 "pxor %%mm6, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3086 "psubw %%mm6, %%mm4 \n\t" // |2L2 - 5L3 + 5L4 - 2L5|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3087 "pcmpgtw %%mm5, %%mm7 \n\t" // sign(2H2 - 5H3 + 5H4 - 2H5)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3088 "pxor %%mm7, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3089 "psubw %%mm7, %%mm5 \n\t" // |2H2 - 5H3 + 5H4 - 2H5|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3090 // 100 opcodes
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3091 "psllw $3, %%mm2 \n\t" // 8QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3092 "movq %%mm2, %%mm3 \n\t" // 8QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3093 "pcmpgtw %%mm4, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3094 "pcmpgtw %%mm5, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3095 "pand %%mm2, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3096 "pand %%mm3, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3097
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3098
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3099 "psubusw %%mm0, %%mm4 \n\t" // hd
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3100 "psubusw %%mm1, %%mm5 \n\t" // ld
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3101
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3102
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3103 "movq "MANGLE(w05)", %%mm2 \n\t" // 5
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3104 "pmullw %%mm2, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3105 "pmullw %%mm2, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3106 "movq "MANGLE(w20)", %%mm2 \n\t" // 32
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3107 "paddw %%mm2, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3108 "paddw %%mm2, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3109 "psrlw $6, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3110 "psrlw $6, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3111
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3112 "movq 16(%%"REG_c"), %%mm0 \n\t" // L3 - L4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3113 "movq 24(%%"REG_c"), %%mm1 \n\t" // H3 - H4
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3114
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3115 "pxor %%mm2, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3116 "pxor %%mm3, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3117
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3118 "pcmpgtw %%mm0, %%mm2 \n\t" // sign (L3-L4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3119 "pcmpgtw %%mm1, %%mm3 \n\t" // sign (H3-H4)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3120 "pxor %%mm2, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3121 "pxor %%mm3, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3122 "psubw %%mm2, %%mm0 \n\t" // |L3-L4|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3123 "psubw %%mm3, %%mm1 \n\t" // |H3-H4|
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3124 "psrlw $1, %%mm0 \n\t" // |L3 - L4|/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3125 "psrlw $1, %%mm1 \n\t" // |H3 - H4|/2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3126
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3127 "pxor %%mm6, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3128 "pxor %%mm7, %%mm3 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3129 "pand %%mm2, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3130 "pand %%mm3, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3131
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3132 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3133 "pminsw %%mm0, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3134 "pminsw %%mm1, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3135 #else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3136 "movq %%mm4, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3137 "psubusw %%mm0, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3138 "psubw %%mm2, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3139 "movq %%mm5, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3140 "psubusw %%mm1, %%mm2 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3141 "psubw %%mm2, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3142 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3143 "pxor %%mm6, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3144 "pxor %%mm7, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3145 "psubw %%mm6, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3146 "psubw %%mm7, %%mm5 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3147 "packsswb %%mm5, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3148 "movq %3, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3149 "pandn %%mm4, %%mm1 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3150 "movq (%0), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3151 "paddb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3152 "movq %%mm0, (%0) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3153 "movq (%0, %1), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3154 "psubb %%mm1, %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3155 "movq %%mm0, (%0, %1) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3156
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3157 : "+r" (temp_src)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3158 : "r" ((long)step), "m" (c->pQPb), "m"(eq_mask)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3159 : "%"REG_a, "%"REG_c
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3160 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3161 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3162 /*if(step==16){
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3163 STOP_TIMER("step16")
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3164 }else{
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3165 STOP_TIMER("stepX")
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3166 }*/
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3167 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3168 #endif //HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3169
78
michael
parents: 55
diff changeset
3170 static void RENAME(postProcess)(const uint8_t src[], int srcStride, uint8_t dst[], int dstStride, int width, int height,
michael
parents: 55
diff changeset
3171 const QP_STORE_T QPs[], int QPStride, int isColor, PPContext *c);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3172
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3173 /**
48
72675332ed82 misc spelling fixes
diego
parents: 45
diff changeset
3174 * Copies a block from src to dst and fixes the blacklevel.
72675332ed82 misc spelling fixes
diego
parents: 45
diff changeset
3175 * levelFix == 0 -> do not touch the brighness & contrast
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3176 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3177 #undef SCALED_CPY
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3178
78
michael
parents: 55
diff changeset
3179 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
3180 int levelFix, int64_t *packedOffsetAndScale)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3181 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3182 #ifndef HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3183 int i;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3184 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3185 if(levelFix)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3186 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3187 #ifdef HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3188 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3189 "movq (%%"REG_a"), %%mm2 \n\t" // packedYOffset
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3190 "movq 8(%%"REG_a"), %%mm3 \n\t" // packedYScale
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3191 "lea (%2,%4), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3192 "lea (%3,%5), %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3193 "pxor %%mm4, %%mm4 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3194 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3195 #define REAL_SCALED_CPY(src1, src2, dst1, dst2) \
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3196 "movq " #src1 ", %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3197 "movq " #src1 ", %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3198 "movq " #src2 ", %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3199 "movq " #src2 ", %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3200 "punpcklbw %%mm0, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3201 "punpckhbw %%mm5, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3202 "punpcklbw %%mm1, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3203 "punpckhbw %%mm6, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3204 "pmulhuw %%mm3, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3205 "pmulhuw %%mm3, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3206 "pmulhuw %%mm3, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3207 "pmulhuw %%mm3, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3208 "psubw %%mm2, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3209 "psubw %%mm2, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3210 "psubw %%mm2, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3211 "psubw %%mm2, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3212 "packuswb %%mm5, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3213 "packuswb %%mm6, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3214 "movq %%mm0, " #dst1 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3215 "movq %%mm1, " #dst2 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3216
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3217 #else //HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3218 #define REAL_SCALED_CPY(src1, src2, dst1, dst2) \
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3219 "movq " #src1 ", %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3220 "movq " #src1 ", %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3221 "punpcklbw %%mm4, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3222 "punpckhbw %%mm4, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3223 "psubw %%mm2, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3224 "psubw %%mm2, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3225 "movq " #src2 ", %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3226 "psllw $6, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3227 "psllw $6, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3228 "pmulhw %%mm3, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3229 "movq " #src2 ", %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3230 "pmulhw %%mm3, %%mm5 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3231 "punpcklbw %%mm4, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3232 "punpckhbw %%mm4, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3233 "psubw %%mm2, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3234 "psubw %%mm2, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3235 "psllw $6, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3236 "psllw $6, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3237 "pmulhw %%mm3, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3238 "pmulhw %%mm3, %%mm6 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3239 "packuswb %%mm5, %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3240 "packuswb %%mm6, %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3241 "movq %%mm0, " #dst1 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3242 "movq %%mm1, " #dst2 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3243
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3244 #endif //HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3245 #define SCALED_CPY(src1, src2, dst1, dst2)\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3246 REAL_SCALED_CPY(src1, src2, dst1, dst2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3247
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3248 SCALED_CPY((%2) , (%2, %4) , (%3) , (%3, %5))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3249 SCALED_CPY((%2, %4, 2), (%%REGa, %4, 2), (%3, %5, 2), (%%REGd, %5, 2))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3250 SCALED_CPY((%2, %4, 4), (%%REGa, %4, 4), (%3, %5, 4), (%%REGd, %5, 4))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3251 "lea (%%"REG_a",%4,4), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3252 "lea (%%"REG_d",%5,4), %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3253 SCALED_CPY((%%REGa, %4), (%%REGa, %4, 2), (%%REGd, %5), (%%REGd, %5, 2))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3254
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3255
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3256 : "=&a" (packedOffsetAndScale)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3257 : "0" (packedOffsetAndScale),
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3258 "r"(src),
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3259 "r"(dst),
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3260 "r" ((long)srcStride),
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3261 "r" ((long)dstStride)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3262 : "%"REG_d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3263 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3264 #else //HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3265 for(i=0; i<8; i++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3266 memcpy( &(dst[dstStride*i]),
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3267 &(src[srcStride*i]), BLOCK_SIZE);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3268 #endif //HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3269 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3270 else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3271 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3272 #ifdef HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3273 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3274 "lea (%0,%2), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3275 "lea (%1,%3), %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3276
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3277 #define REAL_SIMPLE_CPY(src1, src2, dst1, dst2) \
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3278 "movq " #src1 ", %%mm0 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3279 "movq " #src2 ", %%mm1 \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3280 "movq %%mm0, " #dst1 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3281 "movq %%mm1, " #dst2 " \n\t"\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3282
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3283 #define SIMPLE_CPY(src1, src2, dst1, dst2)\
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3284 REAL_SIMPLE_CPY(src1, src2, dst1, dst2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3285
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3286 SIMPLE_CPY((%0) , (%0, %2) , (%1) , (%1, %3))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3287 SIMPLE_CPY((%0, %2, 2), (%%REGa, %2, 2), (%1, %3, 2), (%%REGd, %3, 2))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3288 SIMPLE_CPY((%0, %2, 4), (%%REGa, %2, 4), (%1, %3, 4), (%%REGd, %3, 4))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3289 "lea (%%"REG_a",%2,4), %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3290 "lea (%%"REG_d",%3,4), %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3291 SIMPLE_CPY((%%REGa, %2), (%%REGa, %2, 2), (%%REGd, %3), (%%REGd, %3, 2))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3292
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3293 : : "r" (src),
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3294 "r" (dst),
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3295 "r" ((long)srcStride),
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3296 "r" ((long)dstStride)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3297 : "%"REG_a, "%"REG_d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3298 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3299 #else //HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3300 for(i=0; i<8; i++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3301 memcpy( &(dst[dstStride*i]),
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3302 &(src[srcStride*i]), BLOCK_SIZE);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3303 #endif //HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3304 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3305 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3306
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3307 /**
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3308 * Duplicates the given 8 src pixels ? times upward
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3309 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3310 static inline void RENAME(duplicate)(uint8_t src[], int stride)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3311 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3312 #ifdef HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3313 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3314 "movq (%0), %%mm0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3315 "add %1, %0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3316 "movq %%mm0, (%0) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3317 "movq %%mm0, (%0, %1) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3318 "movq %%mm0, (%0, %1, 2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3319 : "+r" (src)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3320 : "r" ((long)-stride)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3321 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3322 #else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3323 int i;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3324 uint8_t *p=src;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3325 for(i=0; i<3; i++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3326 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3327 p-= stride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3328 memcpy(p, src, 8);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3329 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3330 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3331 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3332
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3333 /**
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3334 * Filters array of bytes (Y or U or V values)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3335 */
78
michael
parents: 55
diff changeset
3336 static void RENAME(postProcess)(const uint8_t src[], int srcStride, uint8_t dst[], int dstStride, int width, int height,
michael
parents: 55
diff changeset
3337 const QP_STORE_T QPs[], int QPStride, int isColor, PPContext *c2)
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3338 {
45
0e28dba3f9e7 Use DECLARE_ALIGNED for alignment in libpostprocess
reimar
parents: 43
diff changeset
3339 DECLARE_ALIGNED(8, PPContext, c)= *c2; //copy to stack for faster access
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3340 int x,y;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3341 #ifdef COMPILE_TIME_MODE
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3342 const int mode= COMPILE_TIME_MODE;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3343 #else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3344 const int mode= isColor ? c.ppMode.chromMode : c.ppMode.lumMode;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3345 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3346 int black=0, white=255; // blackest black and whitest white in the picture
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3347 int QPCorrecture= 256*256;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3348
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3349 int copyAhead;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3350 #ifdef HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3351 int i;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3352 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3353
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3354 const int qpHShift= isColor ? 4-c.hChromaSubSample : 4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3355 const int qpVShift= isColor ? 4-c.vChromaSubSample : 4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3356
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3357 //FIXME remove
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3358 uint64_t * const yHistogram= c.yHistogram;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3359 uint8_t * const tempSrc= srcStride > 0 ? c.tempSrc : c.tempSrc - 23*srcStride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3360 uint8_t * const tempDst= dstStride > 0 ? c.tempDst : c.tempDst - 23*dstStride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3361 //const int mbWidth= isColor ? (width+7)>>3 : (width+15)>>4;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3362
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3363 #ifdef HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3364 for(i=0; i<57; i++){
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3365 int offset= ((i*c.ppMode.baseDcDiff)>>8) + 1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3366 int threshold= offset*2 + 1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3367 c.mmxDcOffset[i]= 0x7F - offset;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3368 c.mmxDcThreshold[i]= 0x7F - threshold;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3369 c.mmxDcOffset[i]*= 0x0101010101010101LL;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3370 c.mmxDcThreshold[i]*= 0x0101010101010101LL;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3371 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3372 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3373
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3374 if(mode & CUBIC_IPOL_DEINT_FILTER) copyAhead=16;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3375 else if( (mode & LINEAR_BLEND_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3376 || (mode & FFMPEG_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3377 || (mode & LOWPASS5_DEINT_FILTER)) copyAhead=14;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3378 else if( (mode & V_DEBLOCK)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3379 || (mode & LINEAR_IPOL_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3380 || (mode & MEDIAN_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3381 || (mode & V_A_DEBLOCK)) copyAhead=13;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3382 else if(mode & V_X1_FILTER) copyAhead=11;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3383 // else if(mode & V_RK1_FILTER) copyAhead=10;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3384 else if(mode & DERING) copyAhead=9;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3385 else copyAhead=8;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3386
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3387 copyAhead-= 8;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3388
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3389 if(!isColor)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3390 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3391 uint64_t sum= 0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3392 int i;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3393 uint64_t maxClipped;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3394 uint64_t clipped;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3395 double scale;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3396
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3397 c.frameNum++;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3398 // first frame is fscked so we ignore it
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3399 if(c.frameNum == 1) yHistogram[0]= width*height/64*15/256;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3400
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3401 for(i=0; i<256; i++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3402 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3403 sum+= yHistogram[i];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3404 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3405
43
00ab07579dc3 typos/grammar
diego
parents: 39
diff changeset
3406 /* We always get a completely black picture first. */
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3407 maxClipped= (uint64_t)(sum * c.ppMode.maxClippedThreshold);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3408
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3409 clipped= sum;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3410 for(black=255; black>0; black--)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3411 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3412 if(clipped < maxClipped) break;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3413 clipped-= yHistogram[black];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3414 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3415
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3416 clipped= sum;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3417 for(white=0; white<256; white++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3418 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3419 if(clipped < maxClipped) break;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3420 clipped-= yHistogram[white];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3421 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3422
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3423 scale= (double)(c.ppMode.maxAllowedY - c.ppMode.minAllowedY) / (double)(white-black);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3424
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3425 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3426 c.packedYScale= (uint16_t)(scale*256.0 + 0.5);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3427 c.packedYOffset= (((black*c.packedYScale)>>8) - c.ppMode.minAllowedY) & 0xFFFF;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3428 #else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3429 c.packedYScale= (uint16_t)(scale*1024.0 + 0.5);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3430 c.packedYOffset= (black - c.ppMode.minAllowedY) & 0xFFFF;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3431 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3432
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3433 c.packedYOffset|= c.packedYOffset<<32;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3434 c.packedYOffset|= c.packedYOffset<<16;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3435
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3436 c.packedYScale|= c.packedYScale<<32;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3437 c.packedYScale|= c.packedYScale<<16;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3438
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3439 if(mode & LEVEL_FIX) QPCorrecture= (int)(scale*256*256 + 0.5);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3440 else QPCorrecture= 256*256;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3441 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3442 else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3443 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3444 c.packedYScale= 0x0100010001000100LL;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3445 c.packedYOffset= 0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3446 QPCorrecture= 256*256;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3447 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3448
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3449 /* copy & deinterlace first row of blocks */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3450 y=-BLOCK_SIZE;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3451 {
78
michael
parents: 55
diff changeset
3452 const uint8_t *srcBlock= &(src[y*srcStride]);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3453 uint8_t *dstBlock= tempDst + dstStride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3454
39
2c0d7e00db4d cosmetics: Fix another common typo, gurantee --> guArantee.
diego
parents: 38
diff changeset
3455 // 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
3456 // finish 1 block before the next otherwise we might have a problem
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3457 // 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
3458 for(x=0; x<width; x+=BLOCK_SIZE)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3459 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3460
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3461 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3462 /*
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3463 prefetchnta(srcBlock + (((x>>2)&6) + 5)*srcStride + 32);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3464 prefetchnta(srcBlock + (((x>>2)&6) + 6)*srcStride + 32);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3465 prefetcht0(dstBlock + (((x>>2)&6) + 5)*dstStride + 32);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3466 prefetcht0(dstBlock + (((x>>2)&6) + 6)*dstStride + 32);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3467 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3468
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3469 asm(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3470 "mov %4, %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3471 "shr $2, %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3472 "and $6, %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3473 "add %5, %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3474 "mov %%"REG_a", %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3475 "imul %1, %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3476 "imul %3, %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3477 "prefetchnta 32(%%"REG_a", %0) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3478 "prefetcht0 32(%%"REG_d", %2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3479 "add %1, %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3480 "add %3, %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3481 "prefetchnta 32(%%"REG_a", %0) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3482 "prefetcht0 32(%%"REG_d", %2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3483 :: "r" (srcBlock), "r" ((long)srcStride), "r" (dstBlock), "r" ((long)dstStride),
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3484 "g" ((long)x), "g" ((long)copyAhead)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3485 : "%"REG_a, "%"REG_d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3486 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3487
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3488 #elif defined(HAVE_3DNOW)
49
cdfe8fc50090 misc typo fixes
diego
parents: 48
diff changeset
3489 //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
3490 /* prefetch(srcBlock + (((x>>3)&3) + 5)*srcStride + 32);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3491 prefetch(srcBlock + (((x>>3)&3) + 9)*srcStride + 32);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3492 prefetchw(dstBlock + (((x>>3)&3) + 5)*dstStride + 32);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3493 prefetchw(dstBlock + (((x>>3)&3) + 9)*dstStride + 32);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3494 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3495 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3496
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3497 RENAME(blockCopy)(dstBlock + dstStride*8, dstStride,
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3498 srcBlock + srcStride*8, srcStride, mode & LEVEL_FIX, &c.packedYOffset);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3499
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3500 RENAME(duplicate)(dstBlock + dstStride*8, dstStride);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3501
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3502 if(mode & LINEAR_IPOL_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3503 RENAME(deInterlaceInterpolateLinear)(dstBlock, dstStride);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3504 else if(mode & LINEAR_BLEND_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3505 RENAME(deInterlaceBlendLinear)(dstBlock, dstStride, c.deintTemp + x);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3506 else if(mode & MEDIAN_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3507 RENAME(deInterlaceMedian)(dstBlock, dstStride);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3508 else if(mode & CUBIC_IPOL_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3509 RENAME(deInterlaceInterpolateCubic)(dstBlock, dstStride);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3510 else if(mode & FFMPEG_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3511 RENAME(deInterlaceFF)(dstBlock, dstStride, c.deintTemp + x);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3512 else if(mode & LOWPASS5_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3513 RENAME(deInterlaceL5)(dstBlock, dstStride, c.deintTemp + x, c.deintTemp + width + x);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3514 /* else if(mode & CUBIC_BLEND_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3515 RENAME(deInterlaceBlendCubic)(dstBlock, dstStride);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3516 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3517 dstBlock+=8;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3518 srcBlock+=8;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3519 }
32
cb746db3fd32 Rename ABS macro to FFABS.
diego
parents: 31
diff changeset
3520 if(width==FFABS(dstStride))
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3521 linecpy(dst, tempDst + 9*dstStride, copyAhead, dstStride);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3522 else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3523 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3524 int i;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3525 for(i=0; i<copyAhead; i++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3526 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3527 memcpy(dst + i*dstStride, tempDst + (9+i)*dstStride, width);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3528 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3529 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3530 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3531
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3532 for(y=0; y<height; y+=BLOCK_SIZE)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3533 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3534 //1% speedup if these are here instead of the inner loop
78
michael
parents: 55
diff changeset
3535 const uint8_t *srcBlock= &(src[y*srcStride]);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3536 uint8_t *dstBlock= &(dst[y*dstStride]);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3537 #ifdef HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3538 uint8_t *tempBlock1= c.tempBlocks;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3539 uint8_t *tempBlock2= c.tempBlocks + 8;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3540 #endif
78
michael
parents: 55
diff changeset
3541 const int8_t *QPptr= &QPs[(y>>qpVShift)*QPStride];
32
cb746db3fd32 Rename ABS macro to FFABS.
diego
parents: 31
diff changeset
3542 int8_t *nonBQPptr= &c.nonBQPTable[(y>>qpVShift)*FFABS(QPStride)];
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3543 int QP=0;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3544 /* can we mess with a 8x16 block from srcBlock/dstBlock downwards and 1 line upwards
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3545 if not than use a temporary buffer */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3546 if(y+15 >= height)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3547 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3548 int i;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3549 /* copy from line (copyAhead) to (copyAhead+7) of src, these will be copied with
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3550 blockcopy to dst later */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3551 linecpy(tempSrc + srcStride*copyAhead, srcBlock + srcStride*copyAhead,
27
c83a71c1729d Change libpostproc to use the FFMIN/FFMAX macros from libavutil.
diego
parents: 22
diff changeset
3552 FFMAX(height-y-copyAhead, 0), srcStride);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3553
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3554 /* 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
3555 for(i=FFMAX(height-y, 8); i<copyAhead+8; i++)
32
cb746db3fd32 Rename ABS macro to FFABS.
diego
parents: 31
diff changeset
3556 memcpy(tempSrc + srcStride*i, src + srcStride*(height-1), FFABS(srcStride));
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3557
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3558 /* 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
3559 linecpy(tempDst, dstBlock - dstStride, FFMIN(height-y+1, copyAhead+1), dstStride);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3560
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3561 /* duplicate last line of dst to fill the void upto line (copyAhead) */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3562 for(i=height-y+1; i<=copyAhead; i++)
32
cb746db3fd32 Rename ABS macro to FFABS.
diego
parents: 31
diff changeset
3563 memcpy(tempDst + dstStride*i, dst + dstStride*(height-1), FFABS(dstStride));
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3564
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3565 dstBlock= tempDst + dstStride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3566 srcBlock= tempSrc;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3567 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3568
39
2c0d7e00db4d cosmetics: Fix another common typo, gurantee --> guArantee.
diego
parents: 38
diff changeset
3569 // 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
3570 // finish 1 block before the next otherwise we might have a problem
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3571 // 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
3572 for(x=0; x<width; x+=BLOCK_SIZE)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3573 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3574 const int stride= dstStride;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3575 #ifdef HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3576 uint8_t *tmpXchg;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3577 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3578 if(isColor)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3579 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3580 QP= QPptr[x>>qpHShift];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3581 c.nonBQP= nonBQPptr[x>>qpHShift];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3582 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3583 else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3584 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3585 QP= QPptr[x>>4];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3586 QP= (QP* QPCorrecture + 256*128)>>16;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3587 c.nonBQP= nonBQPptr[x>>4];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3588 c.nonBQP= (c.nonBQP* QPCorrecture + 256*128)>>16;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3589 yHistogram[ srcBlock[srcStride*12 + 4] ]++;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3590 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3591 c.QP= QP;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3592 #ifdef HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3593 asm volatile(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3594 "movd %1, %%mm7 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3595 "packuswb %%mm7, %%mm7 \n\t" // 0, 0, 0, QP, 0, 0, 0, QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3596 "packuswb %%mm7, %%mm7 \n\t" // 0,QP, 0, QP, 0,QP, 0, QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3597 "packuswb %%mm7, %%mm7 \n\t" // QP,..., QP
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3598 "movq %%mm7, %0 \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3599 : "=m" (c.pQPb)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3600 : "r" (QP)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3601 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3602 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3603
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3604
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3605 #ifdef HAVE_MMX2
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3606 /*
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3607 prefetchnta(srcBlock + (((x>>2)&6) + 5)*srcStride + 32);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3608 prefetchnta(srcBlock + (((x>>2)&6) + 6)*srcStride + 32);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3609 prefetcht0(dstBlock + (((x>>2)&6) + 5)*dstStride + 32);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3610 prefetcht0(dstBlock + (((x>>2)&6) + 6)*dstStride + 32);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3611 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3612
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3613 asm(
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3614 "mov %4, %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3615 "shr $2, %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3616 "and $6, %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3617 "add %5, %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3618 "mov %%"REG_a", %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3619 "imul %1, %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3620 "imul %3, %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3621 "prefetchnta 32(%%"REG_a", %0) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3622 "prefetcht0 32(%%"REG_d", %2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3623 "add %1, %%"REG_a" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3624 "add %3, %%"REG_d" \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3625 "prefetchnta 32(%%"REG_a", %0) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3626 "prefetcht0 32(%%"REG_d", %2) \n\t"
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3627 :: "r" (srcBlock), "r" ((long)srcStride), "r" (dstBlock), "r" ((long)dstStride),
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3628 "g" ((long)x), "g" ((long)copyAhead)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3629 : "%"REG_a, "%"REG_d
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3630 );
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3631
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3632 #elif defined(HAVE_3DNOW)
49
cdfe8fc50090 misc typo fixes
diego
parents: 48
diff changeset
3633 //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
3634 /* prefetch(srcBlock + (((x>>3)&3) + 5)*srcStride + 32);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3635 prefetch(srcBlock + (((x>>3)&3) + 9)*srcStride + 32);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3636 prefetchw(dstBlock + (((x>>3)&3) + 5)*dstStride + 32);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3637 prefetchw(dstBlock + (((x>>3)&3) + 9)*dstStride + 32);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3638 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3639 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3640
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3641 RENAME(blockCopy)(dstBlock + dstStride*copyAhead, dstStride,
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3642 srcBlock + srcStride*copyAhead, srcStride, mode & LEVEL_FIX, &c.packedYOffset);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3643
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3644 if(mode & LINEAR_IPOL_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3645 RENAME(deInterlaceInterpolateLinear)(dstBlock, dstStride);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3646 else if(mode & LINEAR_BLEND_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3647 RENAME(deInterlaceBlendLinear)(dstBlock, dstStride, c.deintTemp + x);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3648 else if(mode & MEDIAN_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3649 RENAME(deInterlaceMedian)(dstBlock, dstStride);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3650 else if(mode & CUBIC_IPOL_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3651 RENAME(deInterlaceInterpolateCubic)(dstBlock, dstStride);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3652 else if(mode & FFMPEG_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3653 RENAME(deInterlaceFF)(dstBlock, dstStride, c.deintTemp + x);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3654 else if(mode & LOWPASS5_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3655 RENAME(deInterlaceL5)(dstBlock, dstStride, c.deintTemp + x, c.deintTemp + width + x);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3656 /* else if(mode & CUBIC_BLEND_DEINT_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3657 RENAME(deInterlaceBlendCubic)(dstBlock, dstStride);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3658 */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3659
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3660 /* only deblock if we have 2 blocks */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3661 if(y + 8 < height)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3662 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3663 if(mode & V_X1_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3664 RENAME(vertX1Filter)(dstBlock, stride, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3665 else if(mode & V_DEBLOCK)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3666 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3667 const int t= RENAME(vertClassify)(dstBlock, stride, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3668
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3669 if(t==1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3670 RENAME(doVertLowPass)(dstBlock, stride, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3671 else if(t==2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3672 RENAME(doVertDefFilter)(dstBlock, stride, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3673 }else if(mode & V_A_DEBLOCK){
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3674 RENAME(do_a_deblock)(dstBlock, stride, 1, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3675 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3676 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3677
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3678 #ifdef HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3679 RENAME(transpose1)(tempBlock1, tempBlock2, dstBlock, dstStride);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3680 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3681 /* check if we have a previous block to deblock it with dstBlock */
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3682 if(x - 8 >= 0)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3683 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3684 #ifdef HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3685 if(mode & H_X1_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3686 RENAME(vertX1Filter)(tempBlock1, 16, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3687 else if(mode & H_DEBLOCK)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3688 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3689 //START_TIMER
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3690 const int t= RENAME(vertClassify)(tempBlock1, 16, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3691 //STOP_TIMER("dc & minmax")
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3692 if(t==1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3693 RENAME(doVertLowPass)(tempBlock1, 16, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3694 else if(t==2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3695 RENAME(doVertDefFilter)(tempBlock1, 16, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3696 }else if(mode & H_A_DEBLOCK){
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3697 RENAME(do_a_deblock)(tempBlock1, 16, 1, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3698 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3699
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3700 RENAME(transpose2)(dstBlock-4, dstStride, tempBlock1 + 4*16);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3701
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3702 #else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3703 if(mode & H_X1_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3704 horizX1Filter(dstBlock-4, stride, QP);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3705 else if(mode & H_DEBLOCK)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3706 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3707 #ifdef HAVE_ALTIVEC
45
0e28dba3f9e7 Use DECLARE_ALIGNED for alignment in libpostprocess
reimar
parents: 43
diff changeset
3708 DECLARE_ALIGNED(16, unsigned char, tempBlock[272]);
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3709 transpose_16x8_char_toPackedAlign_altivec(tempBlock, dstBlock - (4 + 1), stride);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3710
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3711 const int t=vertClassify_altivec(tempBlock-48, 16, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3712 if(t==1) {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3713 doVertLowPass_altivec(tempBlock-48, 16, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3714 transpose_8x16_char_fromPackedAlign_altivec(dstBlock - (4 + 1), tempBlock, stride);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3715 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3716 else if(t==2) {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3717 doVertDefFilter_altivec(tempBlock-48, 16, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3718 transpose_8x16_char_fromPackedAlign_altivec(dstBlock - (4 + 1), tempBlock, stride);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3719 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3720 #else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3721 const int t= RENAME(horizClassify)(dstBlock-4, stride, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3722
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3723 if(t==1)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3724 RENAME(doHorizLowPass)(dstBlock-4, stride, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3725 else if(t==2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3726 RENAME(doHorizDefFilter)(dstBlock-4, stride, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3727 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3728 }else if(mode & H_A_DEBLOCK){
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3729 RENAME(do_a_deblock)(dstBlock-8, 1, stride, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3730 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3731 #endif //HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3732 if(mode & DERING)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3733 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3734 //FIXME filter first line
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3735 if(y>0) RENAME(dering)(dstBlock - stride - 8, stride, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3736 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3737
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3738 if(mode & TEMP_NOISE_FILTER)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3739 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3740 RENAME(tempNoiseReducer)(dstBlock-8, stride,
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3741 c.tempBlured[isColor] + y*dstStride + x,
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3742 c.tempBluredPast[isColor] + (y>>3)*256 + (x>>3),
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3743 c.ppMode.maxTmpNoise);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3744 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3745 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3746
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3747 dstBlock+=8;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3748 srcBlock+=8;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3749
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3750 #ifdef HAVE_MMX
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3751 tmpXchg= tempBlock1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3752 tempBlock1= tempBlock2;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3753 tempBlock2 = tmpXchg;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3754 #endif
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 & DERING)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3758 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3759 if(y > 0) RENAME(dering)(dstBlock - dstStride - 8, dstStride, &c);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3760 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3761
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3762 if((mode & TEMP_NOISE_FILTER))
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3763 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3764 RENAME(tempNoiseReducer)(dstBlock-8, dstStride,
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3765 c.tempBlured[isColor] + y*dstStride + x,
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3766 c.tempBluredPast[isColor] + (y>>3)*256 + (x>>3),
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3767 c.ppMode.maxTmpNoise);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3768 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3769
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3770 /* did we use a tmp buffer for the last lines*/
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3771 if(y+15 >= height)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3772 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3773 uint8_t *dstBlock= &(dst[y*dstStride]);
32
cb746db3fd32 Rename ABS macro to FFABS.
diego
parents: 31
diff changeset
3774 if(width==FFABS(dstStride))
0
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3775 linecpy(dstBlock, tempDst + dstStride, height-y, dstStride);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3776 else
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3777 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3778 int i;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3779 for(i=0; i<height-y; i++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3780 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3781 memcpy(dstBlock + i*dstStride, tempDst + (i+1)*dstStride, width);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3782 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3783 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3784 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3785 /*
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3786 for(x=0; x<width; x+=32)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3787 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3788 volatile int i;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3789 i+= + dstBlock[x + 7*dstStride] + dstBlock[x + 8*dstStride]
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3790 + dstBlock[x + 9*dstStride] + dstBlock[x +10*dstStride]
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3791 + dstBlock[x +11*dstStride] + dstBlock[x +12*dstStride];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3792 // + dstBlock[x +13*dstStride]
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3793 // + dstBlock[x +14*dstStride] + dstBlock[x +15*dstStride];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3794 }*/
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3795 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3796 #ifdef HAVE_3DNOW
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3797 asm volatile("femms");
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3798 #elif defined (HAVE_MMX)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3799 asm volatile("emms");
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3800 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3801
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3802 #ifdef DEBUG_BRIGHTNESS
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3803 if(!isColor)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3804 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3805 int max=1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3806 int i;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3807 for(i=0; i<256; i++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3808 if(yHistogram[i] > max) max=yHistogram[i];
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3809
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3810 for(i=1; i<256; i++)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3811 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3812 int x;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3813 int start=yHistogram[i-1]/(max/256+1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3814 int end=yHistogram[i]/(max/256+1);
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3815 int inc= end > start ? 1 : -1;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3816 for(x=start; x!=end+inc; x+=inc)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3817 dst[ i*dstStride + x]+=128;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3818 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3819
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3820 for(i=0; i<100; i+=2)
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3821 {
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3822 dst[ (white)*dstStride + i]+=128;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3823 dst[ (black)*dstStride + i]+=128;
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3824 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3825
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3826 }
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3827 #endif
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3828
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3829 *c2= c; //copy local context back
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3830
7c419ceafa6a libavcodec/libpostproc ---> libpostproc
diego
parents:
diff changeset
3831 }