[cvs] / xvidcore / src / image / qpel.c Repository:
ViewVC logotype

Annotation of /xvidcore/src/image/qpel.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (view) (download)

1 : edgomez 1.2 /*****************************************************************************
2 :     *
3 :     * XVID MPEG-4 VIDEO CODEC
4 :     * - QPel interpolation -
5 :     *
6 :     * Copyright(C) 2003 Pascal Massimino <skal@planet-d.net>
7 :     *
8 :     * This program is free software ; you can redistribute it and/or modify
9 :     * it under the terms of the GNU General Public License as published by
10 :     * the Free Software Foundation ; either version 2 of the License, or
11 :     * (at your option) any later version.
12 :     *
13 :     * This program is distributed in the hope that it will be useful,
14 :     * but WITHOUT ANY WARRANTY ; without even the implied warranty of
15 :     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 :     * GNU General Public License for more details.
17 :     *
18 :     * You should have received a copy of the GNU General Public License
19 :     * along with this program ; if not, write to the Free Software
20 :     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 :     *
22 :     * $Id$
23 :     *
24 :     ****************************************************************************/
25 :    
26 :     #ifndef XVID_AUTO_INCLUDE
27 :    
28 :     #include "../portab.h"
29 :     #include "qpel.h"
30 :    
31 :     /* Quarterpel FIR definition
32 :     ****************************************************************************/
33 :    
34 :     static const int32_t FIR_Tab_8[9][8] = {
35 :     { 14, -3, 2, -1, 0, 0, 0, 0 },
36 :     { 23, 19, -6, 3, -1, 0, 0, 0 },
37 :     { -7, 20, 20, -6, 3, -1, 0, 0 },
38 :     { 3, -6, 20, 20, -6, 3, -1, 0 },
39 :     { -1, 3, -6, 20, 20, -6, 3, -1 },
40 :     { 0, -1, 3, -6, 20, 20, -6, 3 },
41 :     { 0, 0, -1, 3, -6, 20, 20, -7 },
42 :     { 0, 0, 0, -1, 3, -6, 19, 23 },
43 :     { 0, 0, 0, 0, -1, 2, -3, 14 }
44 :     };
45 :    
46 :     static const int32_t FIR_Tab_16[17][16] = {
47 :     { 14, -3, 2, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
48 :     { 23, 19, -6, 3, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
49 :     { -7, 20, 20, -6, 3, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
50 :     { 3, -6, 20, 20, -6, 3, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
51 :     { -1, 3, -6, 20, 20, -6, 3, -1, 0, 0, 0, 0, 0, 0, 0, 0 },
52 :     { 0, -1, 3, -6, 20, 20, -6, 3, -1, 0, 0, 0, 0, 0, 0, 0 },
53 :     { 0, 0, -1, 3, -6, 20, 20, -6, 3, -1, 0, 0, 0, 0, 0, 0 },
54 :     { 0, 0, 0, -1, 3, -6, 20, 20, -6, 3, -1, 0, 0, 0, 0, 0 },
55 :     { 0, 0, 0, 0, -1, 3, -6, 20, 20, -6, 3, -1, 0, 0, 0, 0 },
56 :     { 0, 0, 0, 0, 0, -1, 3, -6, 20, 20, -6, 3, -1, 0, 0, 0 },
57 :     { 0, 0, 0, 0, 0, 0, -1, 3, -6, 20, 20, -6, 3, -1, 0, 0 },
58 :     { 0, 0, 0, 0, 0, 0, 0, -1, 3, -6, 20, 20, -6, 3, -1, 0 },
59 :     { 0, 0, 0, 0, 0, 0, 0, 0, -1, 3, -6, 20, 20, -6, 3, -1 },
60 :     { 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 3, -6, 20, 20, -6, 3 },
61 :     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 3, -6, 20, 20, -7 },
62 :     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 3, -6, 19, 23 },
63 :     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 2, -3, 14 }
64 :     };
65 :    
66 :     /* Implementation
67 :     ****************************************************************************/
68 :    
69 :     #define XVID_AUTO_INCLUDE
70 : edgomez 1.3 /* First auto include this file to generate reference code for SIMD versions
71 :     * This set of functions are good for educational purpose, because they're
72 :     * straightforward to understand, use loops and so on... But obviously they
73 :     * sux when it comes to speed */
74 :     #define REFERENCE_CODE
75 : edgomez 1.2
76 :     /* 16x? filters */
77 :    
78 :     #define SIZE 16
79 :     #define TABLE FIR_Tab_16
80 :    
81 :     #define STORE(d,s) (d) = (s)
82 : edgomez 1.3 #define FUNC_H H_Pass_16_C_ref
83 :     #define FUNC_V V_Pass_16_C_ref
84 :     #define FUNC_HA H_Pass_Avrg_16_C_ref
85 :     #define FUNC_VA V_Pass_Avrg_16_C_ref
86 :     #define FUNC_HA_UP H_Pass_Avrg_Up_16_C_ref
87 :     #define FUNC_VA_UP V_Pass_Avrg_Up_16_C_ref
88 :    
89 :     #include "qpel.c"
90 :    
91 :     /* note: B-frame always uses Rnd=0... */
92 :     #define STORE(d,s) (d) = ( (s)+(d)+1 ) >> 1
93 :     #define FUNC_H H_Pass_16_Add_C_ref
94 :     #define FUNC_V V_Pass_16_Add_C_ref
95 :     #define FUNC_HA H_Pass_Avrg_16_Add_C_ref
96 :     #define FUNC_VA V_Pass_Avrg_16_Add_C_ref
97 :     #define FUNC_HA_UP H_Pass_Avrg_Up_16_Add_C_ref
98 :     #define FUNC_VA_UP V_Pass_Avrg_Up_16_Add_C_ref
99 :    
100 :     #include "qpel.c"
101 :    
102 :     #undef SIZE
103 :     #undef TABLE
104 :    
105 :     /* 8x? filters */
106 :    
107 :     #define SIZE 8
108 :     #define TABLE FIR_Tab_8
109 :    
110 :     #define STORE(d,s) (d) = (s)
111 :     #define FUNC_H H_Pass_8_C_ref
112 :     #define FUNC_V V_Pass_8_C_ref
113 :     #define FUNC_HA H_Pass_Avrg_8_C_ref
114 :     #define FUNC_VA V_Pass_Avrg_8_C_ref
115 :     #define FUNC_HA_UP H_Pass_Avrg_Up_8_C_ref
116 :     #define FUNC_VA_UP V_Pass_Avrg_Up_8_C_ref
117 :    
118 :     #include "qpel.c"
119 :    
120 :     /* note: B-frame always uses Rnd=0... */
121 :     #define STORE(d,s) (d) = ( (s)+(d)+1 ) >> 1
122 :     #define FUNC_H H_Pass_8_Add_C_ref
123 :     #define FUNC_V V_Pass_8_Add_C_ref
124 :     #define FUNC_HA H_Pass_Avrg_8_Add_C_ref
125 :     #define FUNC_VA V_Pass_Avrg_8_Add_C_ref
126 :     #define FUNC_HA_UP H_Pass_Avrg_Up_8_Add_C_ref
127 :     #define FUNC_VA_UP V_Pass_Avrg_Up_8_Add_C_ref
128 :    
129 :     #include "qpel.c"
130 :    
131 :     #undef SIZE
132 :     #undef TABLE
133 :    
134 :     /* Then we define more optimized C version where loops are unrolled, where
135 :     * FIR coeffcients are not read from memory but are hardcoded in instructions
136 :     * They should be faster */
137 :     #undef REFERENCE_CODE
138 :    
139 :     /* 16x? filters */
140 :    
141 :     #define SIZE 16
142 :    
143 :     #define STORE(d,s) (d) = (s)
144 : edgomez 1.2 #define FUNC_H H_Pass_16_C
145 :     #define FUNC_V V_Pass_16_C
146 :     #define FUNC_HA H_Pass_Avrg_16_C
147 :     #define FUNC_VA V_Pass_Avrg_16_C
148 :     #define FUNC_HA_UP H_Pass_Avrg_Up_16_C
149 :     #define FUNC_VA_UP V_Pass_Avrg_Up_16_C
150 :    
151 : edgomez 1.3 #include "qpel.c"
152 : edgomez 1.2
153 :     /* note: B-frame always uses Rnd=0... */
154 :     #define STORE(d,s) (d) = ( (s)+(d)+1 ) >> 1
155 :     #define FUNC_H H_Pass_16_Add_C
156 :     #define FUNC_V V_Pass_16_Add_C
157 :     #define FUNC_HA H_Pass_Avrg_16_Add_C
158 :     #define FUNC_VA V_Pass_Avrg_16_Add_C
159 :     #define FUNC_HA_UP H_Pass_Avrg_Up_16_Add_C
160 :     #define FUNC_VA_UP V_Pass_Avrg_Up_16_Add_C
161 :    
162 : edgomez 1.3 #include "qpel.c"
163 : edgomez 1.2
164 :     #undef SIZE
165 :     #undef TABLE
166 :    
167 :     /* 8x? filters */
168 :    
169 :     #define SIZE 8
170 :     #define TABLE FIR_Tab_8
171 :    
172 :     #define STORE(d,s) (d) = (s)
173 :     #define FUNC_H H_Pass_8_C
174 :     #define FUNC_V V_Pass_8_C
175 :     #define FUNC_HA H_Pass_Avrg_8_C
176 :     #define FUNC_VA V_Pass_Avrg_8_C
177 :     #define FUNC_HA_UP H_Pass_Avrg_Up_8_C
178 :     #define FUNC_VA_UP V_Pass_Avrg_Up_8_C
179 :    
180 : edgomez 1.3 #include "qpel.c"
181 : edgomez 1.2
182 :     /* note: B-frame always uses Rnd=0... */
183 :     #define STORE(d,s) (d) = ( (s)+(d)+1 ) >> 1
184 :     #define FUNC_H H_Pass_8_Add_C
185 :     #define FUNC_V V_Pass_8_Add_C
186 :     #define FUNC_HA H_Pass_Avrg_8_Add_C
187 :     #define FUNC_VA V_Pass_Avrg_8_Add_C
188 :     #define FUNC_HA_UP H_Pass_Avrg_Up_8_Add_C
189 :     #define FUNC_VA_UP V_Pass_Avrg_Up_8_Add_C
190 :    
191 : edgomez 1.3 #include "qpel.c"
192 : edgomez 1.2
193 :     #undef SIZE
194 :     #undef TABLE
195 :     #undef XVID_AUTO_INCLUDE
196 :    
197 : edgomez 1.3 /* Global scope hooks
198 : edgomez 1.2 ****************************************************************************/
199 :    
200 :     XVID_QP_FUNCS *xvid_QP_Funcs = 0;
201 :     XVID_QP_FUNCS *xvid_QP_Add_Funcs = 0;
202 :    
203 : edgomez 1.3 /* Reference plain C impl. declaration
204 :     ****************************************************************************/
205 :    
206 :     XVID_QP_FUNCS xvid_QP_Funcs_C_ref = {
207 :     H_Pass_16_C_ref, H_Pass_Avrg_16_C_ref, H_Pass_Avrg_Up_16_C_ref,
208 :     V_Pass_16_C_ref, V_Pass_Avrg_16_C_ref, V_Pass_Avrg_Up_16_C_ref,
209 :    
210 :     H_Pass_8_C_ref, H_Pass_Avrg_8_C_ref, H_Pass_Avrg_Up_8_C_ref,
211 :     V_Pass_8_C_ref, V_Pass_Avrg_8_C_ref, V_Pass_Avrg_Up_8_C_ref
212 :     };
213 :    
214 :     XVID_QP_FUNCS xvid_QP_Add_Funcs_C_ref = {
215 :     H_Pass_16_Add_C_ref, H_Pass_Avrg_16_Add_C_ref, H_Pass_Avrg_Up_16_Add_C_ref,
216 :     V_Pass_16_Add_C_ref, V_Pass_Avrg_16_Add_C_ref, V_Pass_Avrg_Up_16_Add_C_ref,
217 :    
218 :     H_Pass_8_Add_C_ref, H_Pass_Avrg_8_Add_C_ref, H_Pass_Avrg_Up_8_Add_C_ref,
219 :     V_Pass_8_Add_C_ref, V_Pass_Avrg_8_Add_C_ref, V_Pass_Avrg_Up_8_Add_C_ref
220 :     };
221 :    
222 :     /* Plain C impl. declaration (faster than ref one)
223 : edgomez 1.2 ****************************************************************************/
224 :    
225 :     XVID_QP_FUNCS xvid_QP_Funcs_C = {
226 :     H_Pass_16_C, H_Pass_Avrg_16_C, H_Pass_Avrg_Up_16_C,
227 :     V_Pass_16_C, V_Pass_Avrg_16_C, V_Pass_Avrg_Up_16_C,
228 :    
229 :     H_Pass_8_C, H_Pass_Avrg_8_C, H_Pass_Avrg_Up_8_C,
230 :     V_Pass_8_C, V_Pass_Avrg_8_C, V_Pass_Avrg_Up_8_C
231 :     };
232 :    
233 :     XVID_QP_FUNCS xvid_QP_Add_Funcs_C = {
234 :     H_Pass_16_Add_C, H_Pass_Avrg_16_Add_C, H_Pass_Avrg_Up_16_Add_C,
235 :     V_Pass_16_Add_C, V_Pass_Avrg_16_Add_C, V_Pass_Avrg_Up_16_Add_C,
236 :    
237 :     H_Pass_8_Add_C, H_Pass_Avrg_8_Add_C, H_Pass_Avrg_Up_8_Add_C,
238 :     V_Pass_8_Add_C, V_Pass_Avrg_8_Add_C, V_Pass_Avrg_Up_8_Add_C
239 :     };
240 :    
241 :     /* mmx impl. declaration (see. qpel_mmx.asm
242 :     ****************************************************************************/
243 :    
244 :     #ifdef ARCH_IS_IA32
245 :     extern XVID_QP_PASS_SIGNATURE(xvid_H_Pass_16_mmx);
246 :     extern XVID_QP_PASS_SIGNATURE(xvid_H_Pass_Avrg_16_mmx);
247 :     extern XVID_QP_PASS_SIGNATURE(xvid_H_Pass_Avrg_Up_16_mmx);
248 :     extern XVID_QP_PASS_SIGNATURE(xvid_V_Pass_16_mmx);
249 :     extern XVID_QP_PASS_SIGNATURE(xvid_V_Pass_Avrg_16_mmx);
250 :     extern XVID_QP_PASS_SIGNATURE(xvid_V_Pass_Avrg_Up_16_mmx);
251 :    
252 :     extern XVID_QP_PASS_SIGNATURE(xvid_H_Pass_8_mmx);
253 :     extern XVID_QP_PASS_SIGNATURE(xvid_H_Pass_Avrg_8_mmx);
254 :     extern XVID_QP_PASS_SIGNATURE(xvid_H_Pass_Avrg_Up_8_mmx);
255 :     extern XVID_QP_PASS_SIGNATURE(xvid_V_Pass_8_mmx);
256 :     extern XVID_QP_PASS_SIGNATURE(xvid_V_Pass_Avrg_8_mmx);
257 :     extern XVID_QP_PASS_SIGNATURE(xvid_V_Pass_Avrg_Up_8_mmx);
258 :    
259 :     extern XVID_QP_PASS_SIGNATURE(xvid_H_Pass_Add_16_mmx);
260 :     extern XVID_QP_PASS_SIGNATURE(xvid_H_Pass_Avrg_Add_16_mmx);
261 :     extern XVID_QP_PASS_SIGNATURE(xvid_H_Pass_Avrg_Up_Add_16_mmx);
262 :     extern XVID_QP_PASS_SIGNATURE(xvid_V_Pass_Add_16_mmx);
263 :     extern XVID_QP_PASS_SIGNATURE(xvid_V_Pass_Avrg_Add_16_mmx);
264 :     extern XVID_QP_PASS_SIGNATURE(xvid_V_Pass_Avrg_Up_Add_16_mmx);
265 :    
266 :     extern XVID_QP_PASS_SIGNATURE(xvid_H_Pass_8_Add_mmx);
267 :     extern XVID_QP_PASS_SIGNATURE(xvid_H_Pass_Avrg_8_Add_mmx);
268 :     extern XVID_QP_PASS_SIGNATURE(xvid_H_Pass_Avrg_Up_8_Add_mmx);
269 :     extern XVID_QP_PASS_SIGNATURE(xvid_V_Pass_8_Add_mmx);
270 :     extern XVID_QP_PASS_SIGNATURE(xvid_V_Pass_Avrg_8_Add_mmx);
271 :     extern XVID_QP_PASS_SIGNATURE(xvid_V_Pass_Avrg_Up_8_Add_mmx);
272 :    
273 : edgomez 1.3 XVID_QP_FUNCS xvid_QP_Funcs_mmx = {
274 :     xvid_H_Pass_16_mmx, xvid_H_Pass_Avrg_16_mmx, xvid_H_Pass_Avrg_Up_16_mmx,
275 :     xvid_V_Pass_16_mmx, xvid_V_Pass_Avrg_16_mmx, xvid_V_Pass_Avrg_Up_16_mmx,
276 :    
277 :     xvid_H_Pass_8_mmx, xvid_H_Pass_Avrg_8_mmx, xvid_H_Pass_Avrg_Up_8_mmx,
278 :     xvid_V_Pass_8_mmx, xvid_V_Pass_Avrg_8_mmx, xvid_V_Pass_Avrg_Up_8_mmx
279 :     };
280 :    
281 : edgomez 1.2 XVID_QP_FUNCS xvid_QP_Add_Funcs_mmx = {
282 :     xvid_H_Pass_Add_16_mmx, xvid_H_Pass_Avrg_Add_16_mmx, xvid_H_Pass_Avrg_Up_Add_16_mmx,
283 :     xvid_V_Pass_Add_16_mmx, xvid_V_Pass_Avrg_Add_16_mmx, xvid_V_Pass_Avrg_Up_Add_16_mmx,
284 :    
285 :     xvid_H_Pass_8_Add_mmx, xvid_H_Pass_Avrg_8_Add_mmx, xvid_H_Pass_Avrg_Up_8_Add_mmx,
286 :     xvid_V_Pass_8_Add_mmx, xvid_V_Pass_Avrg_8_Add_mmx, xvid_V_Pass_Avrg_Up_8_Add_mmx,
287 :     };
288 :     #endif /* ARCH_IS_IA32 */
289 :    
290 : edgomez 1.4
291 :     /* altivec impl. declaration (see qpel_altivec.c)
292 :     ****************************************************************************/
293 :    
294 :     #ifdef ARCH_IS_PPC
295 :    
296 :     extern XVID_QP_PASS_SIGNATURE(H_Pass_16_Altivec_C);
297 :     extern XVID_QP_PASS_SIGNATURE(H_Pass_Avrg_16_Altivec_C);
298 :     extern XVID_QP_PASS_SIGNATURE(H_Pass_Avrg_Up_16_Altivec_C);
299 :     extern XVID_QP_PASS_SIGNATURE(V_Pass_16_Altivec_C);
300 :     extern XVID_QP_PASS_SIGNATURE(V_Pass_Avrg_16_Altivec_C);
301 :     extern XVID_QP_PASS_SIGNATURE(V_Pass_Avrg_Up_16_Altivec_C);
302 :    
303 :     extern XVID_QP_PASS_SIGNATURE(H_Pass_8_Altivec_C);
304 :     extern XVID_QP_PASS_SIGNATURE(H_Pass_Avrg_8_Altivec_C);
305 :     extern XVID_QP_PASS_SIGNATURE(H_Pass_Avrg_Up_8_Altivec_C);
306 :     extern XVID_QP_PASS_SIGNATURE(V_Pass_8_Altivec_C);
307 :     extern XVID_QP_PASS_SIGNATURE(V_Pass_Avrg_8_Altivec_C);
308 :     extern XVID_QP_PASS_SIGNATURE(V_Pass_Avrg_Up_8_Altivec_C);
309 :    
310 :    
311 :     extern XVID_QP_PASS_SIGNATURE(H_Pass_16_Add_Altivec_C);
312 :     extern XVID_QP_PASS_SIGNATURE(H_Pass_Avrg_16_Add_Altivec_C);
313 :     extern XVID_QP_PASS_SIGNATURE(H_Pass_Avrg_Up_16_Add_Altivec_C);
314 :     extern XVID_QP_PASS_SIGNATURE(V_Pass_16_Add_Altivec_C);
315 :     extern XVID_QP_PASS_SIGNATURE(V_Pass_Avrg_16_Add_Altivec_C);
316 :     extern XVID_QP_PASS_SIGNATURE(V_Pass_Avrg_Up_16_Add_Altivec_C);
317 :    
318 :     extern XVID_QP_PASS_SIGNATURE(H_Pass_8_Add_Altivec_C);
319 :     extern XVID_QP_PASS_SIGNATURE(H_Pass_Avrg_8_Add_Altivec_C);
320 :     extern XVID_QP_PASS_SIGNATURE(H_Pass_Avrg_Up_8_Add_Altivec_C);
321 :     extern XVID_QP_PASS_SIGNATURE(V_Pass_8_Add_Altivec_C);
322 :     extern XVID_QP_PASS_SIGNATURE(V_Pass_Avrg_8_Add_Altivec_C);
323 :     extern XVID_QP_PASS_SIGNATURE(V_Pass_Avrg_Up_8_Add_Altivec_C);
324 :    
325 :     XVID_QP_FUNCS xvid_QP_Funcs_Altivec_C = {
326 :     H_Pass_16_Altivec_C, H_Pass_Avrg_16_Altivec_C, H_Pass_Avrg_Up_16_Altivec_C,
327 :     V_Pass_16_Altivec_C, V_Pass_Avrg_16_Altivec_C, V_Pass_Avrg_Up_16_Altivec_C,
328 :    
329 :     H_Pass_8_Altivec_C, H_Pass_Avrg_8_Altivec_C, H_Pass_Avrg_Up_8_Altivec_C,
330 :     V_Pass_8_Altivec_C, V_Pass_Avrg_8_Altivec_C, V_Pass_Avrg_Up_8_Altivec_C
331 :     };
332 :    
333 :     XVID_QP_FUNCS xvid_QP_Add_Funcs_Altivec_C = {
334 :     H_Pass_16_Add_Altivec_C, H_Pass_Avrg_16_Add_Altivec_C, H_Pass_Avrg_Up_16_Add_Altivec_C,
335 :     V_Pass_16_Add_Altivec_C, V_Pass_Avrg_16_Add_Altivec_C, V_Pass_Avrg_Up_16_Add_Altivec_C,
336 :    
337 :     H_Pass_8_Add_Altivec_C, H_Pass_Avrg_8_Add_Altivec_C, H_Pass_Avrg_Up_8_Add_Altivec_C,
338 :     V_Pass_8_Add_Altivec_C, V_Pass_Avrg_8_Add_Altivec_C, V_Pass_Avrg_Up_8_Add_Altivec_C
339 :     };
340 :    
341 :     #endif /* ARCH_IS_PPC */
342 :    
343 : edgomez 1.2 /* tables for ASM
344 :     ****************************************************************************/
345 :    
346 :     #ifdef ARCH_IS_IA32
347 :     uint16_t xvid_Expand_mmx[256][4]; /* 8b -> 64b expansion table */
348 :     #endif
349 :    
350 :     /* Alternate way of filtering (cf. USE_TABLES flag in qpel_mmx.asm)
351 :     *
352 :     * 17 tables, 2K each => 34K
353 :     * Mirroring can be acheived composing 11 basic tables
354 :     * (for instance: (23,19,-6,3)=(20,20,-6,3)+(3,-1,0,0)
355 :     * Using Symmetries (and bswap) could reduce further
356 :     * the memory to 7 tables (->14K). */
357 :    
358 :     int16_t xvid_FIR_1_0_0_0[256][4];
359 :     int16_t xvid_FIR_3_1_0_0[256][4];
360 :     int16_t xvid_FIR_6_3_1_0[256][4];
361 :     int16_t xvid_FIR_14_3_2_1[256][4];
362 :     int16_t xvid_FIR_20_6_3_1[256][4];
363 :     int16_t xvid_FIR_20_20_6_3[256][4];
364 :     int16_t xvid_FIR_23_19_6_3[256][4];
365 :     int16_t xvid_FIR_7_20_20_6[256][4];
366 :     int16_t xvid_FIR_6_20_20_6[256][4];
367 :     int16_t xvid_FIR_6_20_20_7[256][4];
368 :     int16_t xvid_FIR_3_6_20_20[256][4];
369 :     int16_t xvid_FIR_3_6_19_23[256][4];
370 :     int16_t xvid_FIR_1_3_6_20[256][4];
371 :     int16_t xvid_FIR_1_2_3_14[256][4];
372 :     int16_t xvid_FIR_0_1_3_6[256][4];
373 :     int16_t xvid_FIR_0_0_1_3[256][4];
374 :     int16_t xvid_FIR_0_0_0_1[256][4];
375 :    
376 :     static void Init_FIR_Table(int16_t Tab[][4],
377 :     int A, int B, int C, int D)
378 :     {
379 :     int i;
380 :     for(i=0; i<256; ++i) {
381 :     Tab[i][0] = i*A;
382 :     Tab[i][1] = i*B;
383 :     Tab[i][2] = i*C;
384 :     Tab[i][3] = i*D;
385 :     }
386 :     }
387 :    
388 :    
389 :     void xvid_Init_QP()
390 :     {
391 :     #ifdef ARCH_IS_IA32
392 :     int i;
393 :    
394 :     for(i=0; i<256; ++i) {
395 :     xvid_Expand_mmx[i][0] = i;
396 :     xvid_Expand_mmx[i][1] = i;
397 :     xvid_Expand_mmx[i][2] = i;
398 :     xvid_Expand_mmx[i][3] = i;
399 :     }
400 :     #endif
401 :    
402 :     /* Alternate way of filtering (cf. USE_TABLES flag in qpel_mmx.asm) */
403 :    
404 :     Init_FIR_Table(xvid_FIR_1_0_0_0, -1, 0, 0, 0);
405 :     Init_FIR_Table(xvid_FIR_3_1_0_0, 3, -1, 0, 0);
406 :     Init_FIR_Table(xvid_FIR_6_3_1_0, -6, 3, -1, 0);
407 :     Init_FIR_Table(xvid_FIR_14_3_2_1, 14, -3, 2, -1);
408 :     Init_FIR_Table(xvid_FIR_20_6_3_1, 20, -6, 3, -1);
409 :     Init_FIR_Table(xvid_FIR_20_20_6_3, 20, 20, -6, 3);
410 :     Init_FIR_Table(xvid_FIR_23_19_6_3, 23, 19, -6, 3);
411 :     Init_FIR_Table(xvid_FIR_7_20_20_6, -7, 20, 20, -6);
412 :     Init_FIR_Table(xvid_FIR_6_20_20_6, -6, 20, 20, -6);
413 :     Init_FIR_Table(xvid_FIR_6_20_20_7, -6, 20, 20, -7);
414 :     Init_FIR_Table(xvid_FIR_3_6_20_20, 3, -6, 20, 20);
415 :     Init_FIR_Table(xvid_FIR_3_6_19_23, 3, -6, 19, 23);
416 :     Init_FIR_Table(xvid_FIR_1_3_6_20, -1, 3, -6, 20);
417 :     Init_FIR_Table(xvid_FIR_1_2_3_14, -1, 2, -3, 14);
418 :     Init_FIR_Table(xvid_FIR_0_1_3_6, 0, -1, 3, -6);
419 :     Init_FIR_Table(xvid_FIR_0_0_1_3, 0, 0, -1, 3);
420 :     Init_FIR_Table(xvid_FIR_0_0_0_1, 0, 0, 0, -1);
421 :    
422 :     }
423 :    
424 :     #endif /* !XVID_AUTO_INCLUDE */
425 :    
426 : edgomez 1.3 #if defined(XVID_AUTO_INCLUDE) && defined(REFERENCE_CODE)
427 :    
428 : edgomez 1.2 /*****************************************************************************
429 :     * "reference" filters impl. in plain C
430 :     ****************************************************************************/
431 :    
432 :     static
433 :     void FUNC_H(uint8_t *Dst, const uint8_t *Src, int32_t H, int32_t BpS, int32_t Rnd)
434 :     {
435 :     while(H-->0) {
436 :     int32_t i, k;
437 :     int32_t Sums[SIZE] = { 0 };
438 :     for(i=0; i<=SIZE; ++i)
439 :     for(k=0; k<SIZE; ++k)
440 :     Sums[k] += TABLE[i][k] * Src[i];
441 :    
442 :     for(i=0; i<SIZE; ++i) {
443 :     int32_t C = ( Sums[i] + 16-Rnd ) >> 5;
444 :     if (C<0) C = 0; else if (C>255) C = 255;
445 :     STORE(Dst[i], C);
446 :     }
447 :     Src += BpS;
448 :     Dst += BpS;
449 :     }
450 :     }
451 :    
452 :     static
453 :     void FUNC_V(uint8_t *Dst, const uint8_t *Src, int32_t W, int32_t BpS, int32_t Rnd)
454 :     {
455 :     while(W-->0) {
456 :     int32_t i, k;
457 :     int32_t Sums[SIZE] = { 0 };
458 :     const uint8_t *S = Src++;
459 :     uint8_t *D = Dst++;
460 :     for(i=0; i<=SIZE; ++i) {
461 :     for(k=0; k<SIZE; ++k)
462 :     Sums[k] += TABLE[i][k] * S[0];
463 :     S += BpS;
464 :     }
465 :    
466 :     for(i=0; i<SIZE; ++i) {
467 :     int32_t C = ( Sums[i] + 16-Rnd )>>5;
468 :     if (C<0) C = 0; else if (C>255) C = 255;
469 :     STORE(D[0], C);
470 :     D += BpS;
471 :     }
472 :     }
473 :     }
474 :    
475 :     static
476 :     void FUNC_HA(uint8_t *Dst, const uint8_t *Src, int32_t H, int32_t BpS, int32_t Rnd)
477 :     {
478 :     while(H-->0) {
479 :     int32_t i, k;
480 :     int32_t Sums[SIZE] = { 0 };
481 :     for(i=0; i<=SIZE; ++i)
482 :     for(k=0; k<SIZE; ++k)
483 :     Sums[k] += TABLE[i][k] * Src[i];
484 :    
485 :     for(i=0; i<SIZE; ++i) {
486 :     int32_t C = ( Sums[i] + 16-Rnd ) >> 5;
487 :     if (C<0) C = 0; else if (C>255) C = 255;
488 :     C = (C+Src[i]+1-Rnd) >> 1;
489 :     STORE(Dst[i], C);
490 :     }
491 :     Src += BpS;
492 :     Dst += BpS;
493 :     }
494 :     }
495 :    
496 :     static
497 :     void FUNC_HA_UP(uint8_t *Dst, const uint8_t *Src, int32_t H, int32_t BpS, int32_t Rnd)
498 :     {
499 :     while(H-->0) {
500 :     int32_t i, k;
501 :     int32_t Sums[SIZE] = { 0 };
502 :     for(i=0; i<=SIZE; ++i)
503 :     for(k=0; k<SIZE; ++k)
504 :     Sums[k] += TABLE[i][k] * Src[i];
505 :    
506 :     for(i=0; i<SIZE; ++i) {
507 :     int32_t C = ( Sums[i] + 16-Rnd ) >> 5;
508 :     if (C<0) C = 0; else if (C>255) C = 255;
509 :     C = (C+Src[i+1]+1-Rnd) >> 1;
510 :     STORE(Dst[i], C);
511 :     }
512 :     Src += BpS;
513 :     Dst += BpS;
514 :     }
515 :     }
516 :    
517 :     static
518 :     void FUNC_VA(uint8_t *Dst, const uint8_t *Src, int32_t W, int32_t BpS, int32_t Rnd)
519 :     {
520 :     while(W-->0) {
521 :     int32_t i, k;
522 :     int32_t Sums[SIZE] = { 0 };
523 :     const uint8_t *S = Src;
524 :     uint8_t *D = Dst;
525 :    
526 :     for(i=0; i<=SIZE; ++i) {
527 :     for(k=0; k<SIZE; ++k)
528 :     Sums[k] += TABLE[i][k] * S[0];
529 :     S += BpS;
530 :     }
531 :    
532 :     S = Src;
533 :     for(i=0; i<SIZE; ++i) {
534 :     int32_t C = ( Sums[i] + 16-Rnd )>>5;
535 :     if (C<0) C = 0; else if (C>255) C = 255;
536 :     C = ( C+S[0]+1-Rnd ) >> 1;
537 :     STORE(D[0], C);
538 :     D += BpS;
539 :     S += BpS;
540 :     }
541 :     Src++;
542 :     Dst++;
543 :     }
544 :     }
545 :    
546 :     static
547 :     void FUNC_VA_UP(uint8_t *Dst, const uint8_t *Src, int32_t W, int32_t BpS, int32_t Rnd)
548 :     {
549 :     while(W-->0) {
550 :     int32_t i, k;
551 :     int32_t Sums[SIZE] = { 0 };
552 :     const uint8_t *S = Src;
553 :     uint8_t *D = Dst;
554 :    
555 :     for(i=0; i<=SIZE; ++i) {
556 :     for(k=0; k<SIZE; ++k)
557 :     Sums[k] += TABLE[i][k] * S[0];
558 :     S += BpS;
559 :     }
560 :    
561 :     S = Src + BpS;
562 :     for(i=0; i<SIZE; ++i) {
563 :     int32_t C = ( Sums[i] + 16-Rnd )>>5;
564 :     if (C<0) C = 0; else if (C>255) C = 255;
565 :     C = ( C+S[0]+1-Rnd ) >> 1;
566 :     STORE(D[0], C);
567 :     D += BpS;
568 :     S += BpS;
569 :     }
570 :     Dst++;
571 :     Src++;
572 :     }
573 :     }
574 :    
575 :     #undef STORE
576 :     #undef FUNC_H
577 :     #undef FUNC_V
578 :     #undef FUNC_HA
579 :     #undef FUNC_VA
580 :     #undef FUNC_HA_UP
581 :     #undef FUNC_VA_UP
582 :    
583 : edgomez 1.3 #elif defined(XVID_AUTO_INCLUDE) && !defined(REFERENCE_CODE)
584 :    
585 :     /*****************************************************************************
586 :     * "fast" filters impl. in plain C
587 :     ****************************************************************************/
588 :    
589 :     #define CLIP_STORE(D,C) \
590 :     if (C<0) C = 0; else if (C>(255<<5)) C = 255; else C = C>>5; \
591 :     STORE(D, C)
592 :    
593 :     static void
594 :     FUNC_H(uint8_t *Dst, const uint8_t *Src, int32_t H, int32_t BpS, int32_t RND)
595 :     {
596 :     #if (SIZE==16)
597 :     while(H-->0) {
598 :     int C;
599 :     C = 16-RND +14*Src[0] +23*Src[1] - 7*Src[2] + 3*Src[3] - Src[4];
600 :     CLIP_STORE(Dst[ 0],C);
601 :     C = 16-RND - 3*(Src[0]-Src[4]) +19*Src[1] +20*Src[2] - 6*Src[3] - Src[5];
602 :     CLIP_STORE(Dst[ 1],C);
603 :     C = 16-RND + 2*Src[0] - 6*(Src[1]+Src[4]) +20*(Src[2]+Src[3]) + 3*Src[5] - Src[6];
604 :     CLIP_STORE(Dst[ 2],C);
605 :     C = 16-RND - (Src[0]+Src[7 ]) + 3*(Src[ 1]+Src[ 6])-6*(Src[ 2]+Src[ 5]) + 20*(Src[ 3]+Src[ 4]);
606 :     CLIP_STORE(Dst[ 3],C);
607 :     C = 16-RND - (Src[1]+Src[8 ]) + 3*(Src[ 2]+Src[ 7])-6*(Src[ 3]+Src[ 6]) + 20*(Src[ 4]+Src[ 5]);
608 :     CLIP_STORE(Dst[ 4],C);
609 :     C = 16-RND - (Src[2]+Src[9 ]) + 3*(Src[ 3]+Src[ 8])-6*(Src[ 4]+Src[ 7]) + 20*(Src[ 5]+Src[ 6]);
610 :     CLIP_STORE(Dst[ 5],C);
611 :     C = 16-RND - (Src[3]+Src[10]) + 3*(Src[ 4]+Src[ 9])-6*(Src[ 5]+Src[ 8]) + 20*(Src[ 6]+Src[ 7]);
612 :     CLIP_STORE(Dst[ 6],C);
613 :     C = 16-RND - (Src[4]+Src[11]) + 3*(Src[ 5]+Src[10])-6*(Src[ 6]+Src[ 9]) + 20*(Src[ 7]+Src[ 8]);
614 :     CLIP_STORE(Dst[ 7],C);
615 :     C = 16-RND - (Src[5]+Src[12]) + 3*(Src[ 6]+Src[11])-6*(Src[ 7]+Src[10]) + 20*(Src[ 8]+Src[ 9]);
616 :     CLIP_STORE(Dst[ 8],C);
617 :     C = 16-RND - (Src[6]+Src[13]) + 3*(Src[ 7]+Src[12])-6*(Src[ 8]+Src[11]) + 20*(Src[ 9]+Src[10]);
618 :     CLIP_STORE(Dst[ 9],C);
619 :     C = 16-RND - (Src[7]+Src[14]) + 3*(Src[ 8]+Src[13])-6*(Src[ 9]+Src[12]) + 20*(Src[10]+Src[11]);
620 :     CLIP_STORE(Dst[10],C);
621 :     C = 16-RND - (Src[8]+Src[15]) + 3*(Src[ 9]+Src[14])-6*(Src[10]+Src[13]) + 20*(Src[11]+Src[12]);
622 :     CLIP_STORE(Dst[11],C);
623 :     C = 16-RND - (Src[9]+Src[16]) + 3*(Src[10]+Src[15])-6*(Src[11]+Src[14]) + 20*(Src[12]+Src[13]);
624 :     CLIP_STORE(Dst[12],C);
625 :     C = 16-RND - Src[10] +3*Src[11] -6*(Src[12]+Src[15]) + 20*(Src[13]+Src[14]) +2*Src[16];
626 :     CLIP_STORE(Dst[13],C);
627 :     C = 16-RND - Src[11] +3*(Src[12]-Src[16]) -6*Src[13] + 20*Src[14] + 19*Src[15];
628 :     CLIP_STORE(Dst[14],C);
629 :     C = 16-RND - Src[12] +3*Src[13] -7*Src[14] + 23*Src[15] + 14*Src[16];
630 :     CLIP_STORE(Dst[15],C);
631 :     Src += BpS;
632 :     Dst += BpS;
633 :     }
634 :     #else
635 :     while(H-->0) {
636 :     int C;
637 :     C = 16-RND +14*Src[0] +23*Src[1] - 7*Src[2] + 3*Src[3] - Src[4];
638 :     CLIP_STORE(Dst[0],C);
639 :     C = 16-RND - 3*(Src[0]-Src[4]) +19*Src[1] +20*Src[2] - 6*Src[3] - Src[5];
640 :     CLIP_STORE(Dst[1],C);
641 :     C = 16-RND + 2*Src[0] - 6*(Src[1]+Src[4]) +20*(Src[2]+Src[3]) + 3*Src[5] - Src[6];
642 :     CLIP_STORE(Dst[2],C);
643 :     C = 16-RND - (Src[0]+Src[7]) + 3*(Src[1]+Src[6])-6*(Src[2]+Src[5]) + 20*(Src[3]+Src[4]);
644 :     CLIP_STORE(Dst[3],C);
645 :     C = 16-RND - (Src[1]+Src[8]) + 3*(Src[2]+Src[7])-6*(Src[3]+Src[6]) + 20*(Src[4]+Src[5]);
646 :     CLIP_STORE(Dst[4],C);
647 :     C = 16-RND - Src[2] +3*Src[3] -6*(Src[4]+Src[7]) + 20*(Src[5]+Src[6]) +2*Src[8];
648 :     CLIP_STORE(Dst[5],C);
649 :     C = 16-RND - Src[3] +3*(Src[4]-Src[8]) -6*Src[5] + 20*Src[6] + 19*Src[7];
650 :     CLIP_STORE(Dst[6],C);
651 :     C = 16-RND - Src[4] +3*Src[5] -7*Src[6] + 23*Src[7] + 14*Src[8];
652 :     CLIP_STORE(Dst[7],C);
653 :     Src += BpS;
654 :     Dst += BpS;
655 :     }
656 :     #endif
657 :     }
658 :     #undef CLIP_STORE
659 :    
660 :     #define CLIP_STORE(i,C) \
661 :     if (C<0) C = 0; else if (C>(255<<5)) C = 255; else C = C>>5; \
662 :     C = (C+Src[i]+1-RND) >> 1; \
663 :     STORE(Dst[i], C)
664 :    
665 :     static void
666 :     FUNC_HA(uint8_t *Dst, const uint8_t *Src, int32_t H, int32_t BpS, int32_t RND)
667 :     {
668 :     #if (SIZE==16)
669 :     while(H-->0) {
670 :     int C;
671 :     C = 16-RND +14*Src[0] +23*Src[1] - 7*Src[2] + 3*Src[3] - Src[4];
672 :     CLIP_STORE(0,C);
673 :     C = 16-RND - 3*(Src[0]-Src[4]) +19*Src[1] +20*Src[2] - 6*Src[3] - Src[5];
674 :     CLIP_STORE( 1,C);
675 :     C = 16-RND + 2*Src[0] - 6*(Src[1]+Src[4]) +20*(Src[2]+Src[3]) + 3*Src[5] - Src[6];
676 :     CLIP_STORE( 2,C);
677 :     C = 16-RND - (Src[0]+Src[7 ]) + 3*(Src[ 1]+Src[ 6])-6*(Src[ 2]+Src[ 5]) + 20*(Src[ 3]+Src[ 4]);
678 :     CLIP_STORE( 3,C);
679 :     C = 16-RND - (Src[1]+Src[8 ]) + 3*(Src[ 2]+Src[ 7])-6*(Src[ 3]+Src[ 6]) + 20*(Src[ 4]+Src[ 5]);
680 :     CLIP_STORE( 4,C);
681 :     C = 16-RND - (Src[2]+Src[9 ]) + 3*(Src[ 3]+Src[ 8])-6*(Src[ 4]+Src[ 7]) + 20*(Src[ 5]+Src[ 6]);
682 :     CLIP_STORE( 5,C);
683 :     C = 16-RND - (Src[3]+Src[10]) + 3*(Src[ 4]+Src[ 9])-6*(Src[ 5]+Src[ 8]) + 20*(Src[ 6]+Src[ 7]);
684 :     CLIP_STORE( 6,C);
685 :     C = 16-RND - (Src[4]+Src[11]) + 3*(Src[ 5]+Src[10])-6*(Src[ 6]+Src[ 9]) + 20*(Src[ 7]+Src[ 8]);
686 :     CLIP_STORE( 7,C);
687 :     C = 16-RND - (Src[5]+Src[12]) + 3*(Src[ 6]+Src[11])-6*(Src[ 7]+Src[10]) + 20*(Src[ 8]+Src[ 9]);
688 :     CLIP_STORE( 8,C);
689 :     C = 16-RND - (Src[6]+Src[13]) + 3*(Src[ 7]+Src[12])-6*(Src[ 8]+Src[11]) + 20*(Src[ 9]+Src[10]);
690 :     CLIP_STORE( 9,C);
691 :     C = 16-RND - (Src[7]+Src[14]) + 3*(Src[ 8]+Src[13])-6*(Src[ 9]+Src[12]) + 20*(Src[10]+Src[11]);
692 :     CLIP_STORE(10,C);
693 :     C = 16-RND - (Src[8]+Src[15]) + 3*(Src[ 9]+Src[14])-6*(Src[10]+Src[13]) + 20*(Src[11]+Src[12]);
694 :     CLIP_STORE(11,C);
695 :     C = 16-RND - (Src[9]+Src[16]) + 3*(Src[10]+Src[15])-6*(Src[11]+Src[14]) + 20*(Src[12]+Src[13]);
696 :     CLIP_STORE(12,C);
697 :     C = 16-RND - Src[10] +3*Src[11] -6*(Src[12]+Src[15]) + 20*(Src[13]+Src[14]) +2*Src[16];
698 :     CLIP_STORE(13,C);
699 :     C = 16-RND - Src[11] +3*(Src[12]-Src[16]) -6*Src[13] + 20*Src[14] + 19*Src[15];
700 :     CLIP_STORE(14,C);
701 :     C = 16-RND - Src[12] +3*Src[13] -7*Src[14] + 23*Src[15] + 14*Src[16];
702 :     CLIP_STORE(15,C);
703 :     Src += BpS;
704 :     Dst += BpS;
705 :     }
706 :     #else
707 :     while(H-->0) {
708 :     int C;
709 :     C = 16-RND +14*Src[0] +23*Src[1] - 7*Src[2] + 3*Src[3] - Src[4];
710 :     CLIP_STORE(0,C);
711 :     C = 16-RND - 3*(Src[0]-Src[4]) +19*Src[1] +20*Src[2] - 6*Src[3] - Src[5];
712 :     CLIP_STORE(1,C);
713 :     C = 16-RND + 2*Src[0] - 6*(Src[1]+Src[4]) +20*(Src[2]+Src[3]) + 3*Src[5] - Src[6];
714 :     CLIP_STORE(2,C);
715 :     C = 16-RND - (Src[0]+Src[7]) + 3*(Src[1]+Src[6])-6*(Src[2]+Src[5]) + 20*(Src[3]+Src[4]);
716 :     CLIP_STORE(3,C);
717 :     C = 16-RND - (Src[1]+Src[8]) + 3*(Src[2]+Src[7])-6*(Src[3]+Src[6]) + 20*(Src[4]+Src[5]);
718 :     CLIP_STORE(4,C);
719 :     C = 16-RND - Src[2] +3*Src[3] -6*(Src[4]+Src[7]) + 20*(Src[5]+Src[6]) +2*Src[8];
720 :     CLIP_STORE(5,C);
721 :     C = 16-RND - Src[3] +3*(Src[4]-Src[8]) -6*Src[5] + 20*Src[6] + 19*Src[7];
722 :     CLIP_STORE(6,C);
723 :     C = 16-RND - Src[4] +3*Src[5] -7*Src[6] + 23*Src[7] + 14*Src[8];
724 :     CLIP_STORE(7,C);
725 :     Src += BpS;
726 :     Dst += BpS;
727 :     }
728 :     #endif
729 :     }
730 :     #undef CLIP_STORE
731 :    
732 :     #define CLIP_STORE(i,C) \
733 :     if (C<0) C = 0; else if (C>(255<<5)) C = 255; else C = C>>5; \
734 :     C = (C+Src[i+1]+1-RND) >> 1; \
735 :     STORE(Dst[i], C)
736 :    
737 :     static void
738 :     FUNC_HA_UP(uint8_t *Dst, const uint8_t *Src, int32_t H, int32_t BpS, int32_t RND)
739 :     {
740 :     #if (SIZE==16)
741 :     while(H-->0) {
742 :     int C;
743 :     C = 16-RND +14*Src[0] +23*Src[1] - 7*Src[2] + 3*Src[3] - Src[4];
744 :     CLIP_STORE(0,C);
745 :     C = 16-RND - 3*(Src[0]-Src[4]) +19*Src[1] +20*Src[2] - 6*Src[3] - Src[5];
746 :     CLIP_STORE( 1,C);
747 :     C = 16-RND + 2*Src[0] - 6*(Src[1]+Src[4]) +20*(Src[2]+Src[3]) + 3*Src[5] - Src[6];
748 :     CLIP_STORE( 2,C);
749 :     C = 16-RND - (Src[0]+Src[7 ]) + 3*(Src[ 1]+Src[ 6])-6*(Src[ 2]+Src[ 5]) + 20*(Src[ 3]+Src[ 4]);
750 :     CLIP_STORE( 3,C);
751 :     C = 16-RND - (Src[1]+Src[8 ]) + 3*(Src[ 2]+Src[ 7])-6*(Src[ 3]+Src[ 6]) + 20*(Src[ 4]+Src[ 5]);
752 :     CLIP_STORE( 4,C);
753 :     C = 16-RND - (Src[2]+Src[9 ]) + 3*(Src[ 3]+Src[ 8])-6*(Src[ 4]+Src[ 7]) + 20*(Src[ 5]+Src[ 6]);
754 :     CLIP_STORE( 5,C);
755 :     C = 16-RND - (Src[3]+Src[10]) + 3*(Src[ 4]+Src[ 9])-6*(Src[ 5]+Src[ 8]) + 20*(Src[ 6]+Src[ 7]);
756 :     CLIP_STORE( 6,C);
757 :     C = 16-RND - (Src[4]+Src[11]) + 3*(Src[ 5]+Src[10])-6*(Src[ 6]+Src[ 9]) + 20*(Src[ 7]+Src[ 8]);
758 :     CLIP_STORE( 7,C);
759 :     C = 16-RND - (Src[5]+Src[12]) + 3*(Src[ 6]+Src[11])-6*(Src[ 7]+Src[10]) + 20*(Src[ 8]+Src[ 9]);
760 :     CLIP_STORE( 8,C);
761 :     C = 16-RND - (Src[6]+Src[13]) + 3*(Src[ 7]+Src[12])-6*(Src[ 8]+Src[11]) + 20*(Src[ 9]+Src[10]);
762 :     CLIP_STORE( 9,C);
763 :     C = 16-RND - (Src[7]+Src[14]) + 3*(Src[ 8]+Src[13])-6*(Src[ 9]+Src[12]) + 20*(Src[10]+Src[11]);
764 :     CLIP_STORE(10,C);
765 :     C = 16-RND - (Src[8]+Src[15]) + 3*(Src[ 9]+Src[14])-6*(Src[10]+Src[13]) + 20*(Src[11]+Src[12]);
766 :     CLIP_STORE(11,C);
767 :     C = 16-RND - (Src[9]+Src[16]) + 3*(Src[10]+Src[15])-6*(Src[11]+Src[14]) + 20*(Src[12]+Src[13]);
768 :     CLIP_STORE(12,C);
769 :     C = 16-RND - Src[10] +3*Src[11] -6*(Src[12]+Src[15]) + 20*(Src[13]+Src[14]) +2*Src[16];
770 :     CLIP_STORE(13,C);
771 :     C = 16-RND - Src[11] +3*(Src[12]-Src[16]) -6*Src[13] + 20*Src[14] + 19*Src[15];
772 :     CLIP_STORE(14,C);
773 :     C = 16-RND - Src[12] +3*Src[13] -7*Src[14] + 23*Src[15] + 14*Src[16];
774 :     CLIP_STORE(15,C);
775 :     Src += BpS;
776 :     Dst += BpS;
777 :     }
778 :     #else
779 :     while(H-->0) {
780 :     int C;
781 :     C = 16-RND +14*Src[0] +23*Src[1] - 7*Src[2] + 3*Src[3] - Src[4];
782 :     CLIP_STORE(0,C);
783 :     C = 16-RND - 3*(Src[0]-Src[4]) +19*Src[1] +20*Src[2] - 6*Src[3] - Src[5];
784 :     CLIP_STORE(1,C);
785 :     C = 16-RND + 2*Src[0] - 6*(Src[1]+Src[4]) +20*(Src[2]+Src[3]) + 3*Src[5] - Src[6];
786 :     CLIP_STORE(2,C);
787 :     C = 16-RND - (Src[0]+Src[7]) + 3*(Src[1]+Src[6])-6*(Src[2]+Src[5]) + 20*(Src[3]+Src[4]);
788 :     CLIP_STORE(3,C);
789 :     C = 16-RND - (Src[1]+Src[8]) + 3*(Src[2]+Src[7])-6*(Src[3]+Src[6]) + 20*(Src[4]+Src[5]);
790 :     CLIP_STORE(4,C);
791 :     C = 16-RND - Src[2] +3*Src[3] -6*(Src[4]+Src[7]) + 20*(Src[5]+Src[6]) +2*Src[8];
792 :     CLIP_STORE(5,C);
793 :     C = 16-RND - Src[3] +3*(Src[4]-Src[8]) -6*Src[5] + 20*Src[6] + 19*Src[7];
794 :     CLIP_STORE(6,C);
795 :     C = 16-RND - Src[4] +3*Src[5] -7*Src[6] + 23*Src[7] + 14*Src[8];
796 :     CLIP_STORE(7,C);
797 :     Src += BpS;
798 :     Dst += BpS;
799 :     }
800 :     #endif
801 :     }
802 :     #undef CLIP_STORE
803 :    
804 :     //////////////////////////////////////////////////////////
805 :     // vertical passes
806 :     //////////////////////////////////////////////////////////
807 :     // Note: for vertical passes, width (W) needs only be 8 or 16.
808 :    
809 :     #define CLIP_STORE(D,C) \
810 :     if (C<0) C = 0; else if (C>(255<<5)) C = 255; else C = C>>5; \
811 :     STORE(D, C)
812 :    
813 :     static void
814 :     FUNC_V(uint8_t *Dst, const uint8_t *Src, int32_t H, int32_t BpS, int32_t RND)
815 :     {
816 :     #if (SIZE==16)
817 :     while(H-->0) {
818 :     int C;
819 :     C = 16-RND +14*Src[BpS*0] +23*Src[BpS*1] - 7*Src[BpS*2] + 3*Src[BpS*3] - Src[BpS*4];
820 :     CLIP_STORE(Dst[BpS* 0],C);
821 :     C = 16-RND - 3*(Src[BpS*0]-Src[BpS*4]) +19*Src[BpS*1] +20*Src[BpS*2] - 6*Src[BpS*3] - Src[BpS*5];
822 :     CLIP_STORE(Dst[BpS* 1],C);
823 :     C = 16-RND + 2*Src[BpS*0] - 6*(Src[BpS*1]+Src[BpS*4]) +20*(Src[BpS*2]+Src[BpS*3]) + 3*Src[BpS*5] - Src[BpS*6];
824 :     CLIP_STORE(Dst[BpS* 2],C);
825 :     C = 16-RND - (Src[BpS*0]+Src[BpS*7 ]) + 3*(Src[BpS* 1]+Src[BpS* 6])-6*(Src[BpS* 2]+Src[BpS* 5]) + 20*(Src[BpS* 3]+Src[BpS* 4]);
826 :     CLIP_STORE(Dst[BpS* 3],C);
827 :     C = 16-RND - (Src[BpS*1]+Src[BpS*8 ]) + 3*(Src[BpS* 2]+Src[BpS* 7])-6*(Src[BpS* 3]+Src[BpS* 6]) + 20*(Src[BpS* 4]+Src[BpS* 5]);
828 :     CLIP_STORE(Dst[BpS* 4],C);
829 :     C = 16-RND - (Src[BpS*2]+Src[BpS*9 ]) + 3*(Src[BpS* 3]+Src[BpS* 8])-6*(Src[BpS* 4]+Src[BpS* 7]) + 20*(Src[BpS* 5]+Src[BpS* 6]);
830 :     CLIP_STORE(Dst[BpS* 5],C);
831 :     C = 16-RND - (Src[BpS*3]+Src[BpS*10]) + 3*(Src[BpS* 4]+Src[BpS* 9])-6*(Src[BpS* 5]+Src[BpS* 8]) + 20*(Src[BpS* 6]+Src[BpS* 7]);
832 :     CLIP_STORE(Dst[BpS* 6],C);
833 :     C = 16-RND - (Src[BpS*4]+Src[BpS*11]) + 3*(Src[BpS* 5]+Src[BpS*10])-6*(Src[BpS* 6]+Src[BpS* 9]) + 20*(Src[BpS* 7]+Src[BpS* 8]);
834 :     CLIP_STORE(Dst[BpS* 7],C);
835 :     C = 16-RND - (Src[BpS*5]+Src[BpS*12]) + 3*(Src[BpS* 6]+Src[BpS*11])-6*(Src[BpS* 7]+Src[BpS*10]) + 20*(Src[BpS* 8]+Src[BpS* 9]);
836 :     CLIP_STORE(Dst[BpS* 8],C);
837 :     C = 16-RND - (Src[BpS*6]+Src[BpS*13]) + 3*(Src[BpS* 7]+Src[BpS*12])-6*(Src[BpS* 8]+Src[BpS*11]) + 20*(Src[BpS* 9]+Src[BpS*10]);
838 :     CLIP_STORE(Dst[BpS* 9],C);
839 :     C = 16-RND - (Src[BpS*7]+Src[BpS*14]) + 3*(Src[BpS* 8]+Src[BpS*13])-6*(Src[BpS* 9]+Src[BpS*12]) + 20*(Src[BpS*10]+Src[BpS*11]);
840 :     CLIP_STORE(Dst[BpS*10],C);
841 :     C = 16-RND - (Src[BpS*8]+Src[BpS*15]) + 3*(Src[BpS* 9]+Src[BpS*14])-6*(Src[BpS*10]+Src[BpS*13]) + 20*(Src[BpS*11]+Src[BpS*12]);
842 :     CLIP_STORE(Dst[BpS*11],C);
843 :     C = 16-RND - (Src[BpS*9]+Src[BpS*16]) + 3*(Src[BpS*10]+Src[BpS*15])-6*(Src[BpS*11]+Src[BpS*14]) + 20*(Src[BpS*12]+Src[BpS*13]);
844 :     CLIP_STORE(Dst[BpS*12],C);
845 :     C = 16-RND - Src[BpS*10] +3*Src[BpS*11] -6*(Src[BpS*12]+Src[BpS*15]) + 20*(Src[BpS*13]+Src[BpS*14]) +2*Src[BpS*16];
846 :     CLIP_STORE(Dst[BpS*13],C);
847 :     C = 16-RND - Src[BpS*11] +3*(Src[BpS*12]-Src[BpS*16]) -6*Src[BpS*13] + 20*Src[BpS*14] + 19*Src[BpS*15];
848 :     CLIP_STORE(Dst[BpS*14],C);
849 :     C = 16-RND - Src[BpS*12] +3*Src[BpS*13] -7*Src[BpS*14] + 23*Src[BpS*15] + 14*Src[BpS*16];
850 :     CLIP_STORE(Dst[BpS*15],C);
851 :     Src += 1;
852 :     Dst += 1;
853 :     }
854 :     #else
855 :     while(H-->0) {
856 :     int C;
857 :     C = 16-RND +14*Src[BpS*0] +23*Src[BpS*1] - 7*Src[BpS*2] + 3*Src[BpS*3] - Src[BpS*4];
858 :     CLIP_STORE(Dst[BpS*0],C);
859 :     C = 16-RND - 3*(Src[BpS*0]-Src[BpS*4]) +19*Src[BpS*1] +20*Src[BpS*2] - 6*Src[BpS*3] - Src[BpS*5];
860 :     CLIP_STORE(Dst[BpS*1],C);
861 :     C = 16-RND + 2*Src[BpS*0] - 6*(Src[BpS*1]+Src[BpS*4]) +20*(Src[BpS*2]+Src[BpS*3]) + 3*Src[BpS*5] - Src[BpS*6];
862 :     CLIP_STORE(Dst[BpS*2],C);
863 :     C = 16-RND - (Src[BpS*0]+Src[BpS*7]) + 3*(Src[BpS*1]+Src[BpS*6])-6*(Src[BpS*2]+Src[BpS*5]) + 20*(Src[BpS*3]+Src[BpS*4]);
864 :     CLIP_STORE(Dst[BpS*3],C);
865 :     C = 16-RND - (Src[BpS*1]+Src[BpS*8]) + 3*(Src[BpS*2]+Src[BpS*7])-6*(Src[BpS*3]+Src[BpS*6]) + 20*(Src[BpS*4]+Src[BpS*5]);
866 :     CLIP_STORE(Dst[BpS*4],C);
867 :     C = 16-RND - Src[BpS*2] +3*Src[BpS*3] -6*(Src[BpS*4]+Src[BpS*7]) + 20*(Src[BpS*5]+Src[BpS*6]) +2*Src[BpS*8];
868 :     CLIP_STORE(Dst[BpS*5],C);
869 :     C = 16-RND - Src[BpS*3] +3*(Src[BpS*4]-Src[BpS*8]) -6*Src[BpS*5] + 20*Src[BpS*6] + 19*Src[BpS*7];
870 :     CLIP_STORE(Dst[BpS*6],C);
871 :     C = 16-RND - Src[BpS*4] +3*Src[BpS*5] -7*Src[BpS*6] + 23*Src[BpS*7] + 14*Src[BpS*8];
872 :     CLIP_STORE(Dst[BpS*7],C);
873 :     Src += 1;
874 :     Dst += 1;
875 :     }
876 :     #endif
877 :     }
878 :     #undef CLIP_STORE
879 :    
880 :     #define CLIP_STORE(i,C) \
881 :     if (C<0) C = 0; else if (C>(255<<5)) C = 255; else C = C>>5; \
882 :     C = (C+Src[BpS*i]+1-RND) >> 1; \
883 :     STORE(Dst[BpS*i], C)
884 :    
885 :     static void
886 :     FUNC_VA(uint8_t *Dst, const uint8_t *Src, int32_t H, int32_t BpS, int32_t RND)
887 :     {
888 :     #if (SIZE==16)
889 :     while(H-->0) {
890 :     int C;
891 :     C = 16-RND +14*Src[BpS*0] +23*Src[BpS*1] - 7*Src[BpS*2] + 3*Src[BpS*3] - Src[BpS*4];
892 :     CLIP_STORE(0,C);
893 :     C = 16-RND - 3*(Src[BpS*0]-Src[BpS*4]) +19*Src[BpS*1] +20*Src[BpS*2] - 6*Src[BpS*3] - Src[BpS*5];
894 :     CLIP_STORE( 1,C);
895 :     C = 16-RND + 2*Src[BpS*0] - 6*(Src[BpS*1]+Src[BpS*4]) +20*(Src[BpS*2]+Src[BpS*3]) + 3*Src[BpS*5] - Src[BpS*6];
896 :     CLIP_STORE( 2,C);
897 :     C = 16-RND - (Src[BpS*0]+Src[BpS*7 ]) + 3*(Src[BpS* 1]+Src[BpS* 6])-6*(Src[BpS* 2]+Src[BpS* 5]) + 20*(Src[BpS* 3]+Src[BpS* 4]);
898 :     CLIP_STORE( 3,C);
899 :     C = 16-RND - (Src[BpS*1]+Src[BpS*8 ]) + 3*(Src[BpS* 2]+Src[BpS* 7])-6*(Src[BpS* 3]+Src[BpS* 6]) + 20*(Src[BpS* 4]+Src[BpS* 5]);
900 :     CLIP_STORE( 4,C);
901 :     C = 16-RND - (Src[BpS*2]+Src[BpS*9 ]) + 3*(Src[BpS* 3]+Src[BpS* 8])-6*(Src[BpS* 4]+Src[BpS* 7]) + 20*(Src[BpS* 5]+Src[BpS* 6]);
902 :     CLIP_STORE( 5,C);
903 :     C = 16-RND - (Src[BpS*3]+Src[BpS*10]) + 3*(Src[BpS* 4]+Src[BpS* 9])-6*(Src[BpS* 5]+Src[BpS* 8]) + 20*(Src[BpS* 6]+Src[BpS* 7]);
904 :     CLIP_STORE( 6,C);
905 :     C = 16-RND - (Src[BpS*4]+Src[BpS*11]) + 3*(Src[BpS* 5]+Src[BpS*10])-6*(Src[BpS* 6]+Src[BpS* 9]) + 20*(Src[BpS* 7]+Src[BpS* 8]);
906 :     CLIP_STORE( 7,C);
907 :     C = 16-RND - (Src[BpS*5]+Src[BpS*12]) + 3*(Src[BpS* 6]+Src[BpS*11])-6*(Src[BpS* 7]+Src[BpS*10]) + 20*(Src[BpS* 8]+Src[BpS* 9]);
908 :     CLIP_STORE( 8,C);
909 :     C = 16-RND - (Src[BpS*6]+Src[BpS*13]) + 3*(Src[BpS* 7]+Src[BpS*12])-6*(Src[BpS* 8]+Src[BpS*11]) + 20*(Src[BpS* 9]+Src[BpS*10]);
910 :     CLIP_STORE( 9,C);
911 :     C = 16-RND - (Src[BpS*7]+Src[BpS*14]) + 3*(Src[BpS* 8]+Src[BpS*13])-6*(Src[BpS* 9]+Src[BpS*12]) + 20*(Src[BpS*10]+Src[BpS*11]);
912 :     CLIP_STORE(10,C);
913 :     C = 16-RND - (Src[BpS*8]+Src[BpS*15]) + 3*(Src[BpS* 9]+Src[BpS*14])-6*(Src[BpS*10]+Src[BpS*13]) + 20*(Src[BpS*11]+Src[BpS*12]);
914 :     CLIP_STORE(11,C);
915 :     C = 16-RND - (Src[BpS*9]+Src[BpS*16]) + 3*(Src[BpS*10]+Src[BpS*15])-6*(Src[BpS*11]+Src[BpS*14]) + 20*(Src[BpS*12]+Src[BpS*13]);
916 :     CLIP_STORE(12,C);
917 :     C = 16-RND - Src[BpS*10] +3*Src[BpS*11] -6*(Src[BpS*12]+Src[BpS*15]) + 20*(Src[BpS*13]+Src[BpS*14]) +2*Src[BpS*16];
918 :     CLIP_STORE(13,C);
919 :     C = 16-RND - Src[BpS*11] +3*(Src[BpS*12]-Src[BpS*16]) -6*Src[BpS*13] + 20*Src[BpS*14] + 19*Src[BpS*15];
920 :     CLIP_STORE(14,C);
921 :     C = 16-RND - Src[BpS*12] +3*Src[BpS*13] -7*Src[BpS*14] + 23*Src[BpS*15] + 14*Src[BpS*16];
922 :     CLIP_STORE(15,C);
923 :     Src += 1;
924 :     Dst += 1;
925 :     }
926 :     #else
927 :     while(H-->0) {
928 :     int C;
929 :     C = 16-RND +14*Src[BpS*0] +23*Src[BpS*1] - 7*Src[BpS*2] + 3*Src[BpS*3] - Src[BpS*4];
930 :     CLIP_STORE(0,C);
931 :     C = 16-RND - 3*(Src[BpS*0]-Src[BpS*4]) +19*Src[BpS*1] +20*Src[BpS*2] - 6*Src[BpS*3] - Src[BpS*5];
932 :     CLIP_STORE(1,C);
933 :     C = 16-RND + 2*Src[BpS*0] - 6*(Src[BpS*1]+Src[BpS*4]) +20*(Src[BpS*2]+Src[BpS*3]) + 3*Src[BpS*5] - Src[BpS*6];
934 :     CLIP_STORE(2,C);
935 :     C = 16-RND - (Src[BpS*0]+Src[BpS*7]) + 3*(Src[BpS*1]+Src[BpS*6])-6*(Src[BpS*2]+Src[BpS*5]) + 20*(Src[BpS*3]+Src[BpS*4]);
936 :     CLIP_STORE(3,C);
937 :     C = 16-RND - (Src[BpS*1]+Src[BpS*8]) + 3*(Src[BpS*2]+Src[BpS*7])-6*(Src[BpS*3]+Src[BpS*6]) + 20*(Src[BpS*4]+Src[BpS*5]);
938 :     CLIP_STORE(4,C);
939 :     C = 16-RND - Src[BpS*2] +3*Src[BpS*3] -6*(Src[BpS*4]+Src[BpS*7]) + 20*(Src[BpS*5]+Src[BpS*6]) +2*Src[BpS*8];
940 :     CLIP_STORE(5,C);
941 :     C = 16-RND - Src[BpS*3] +3*(Src[BpS*4]-Src[BpS*8]) -6*Src[BpS*5] + 20*Src[BpS*6] + 19*Src[BpS*7];
942 :     CLIP_STORE(6,C);
943 :     C = 16-RND - Src[BpS*4] +3*Src[BpS*5] -7*Src[BpS*6] + 23*Src[BpS*7] + 14*Src[BpS*8];
944 :     CLIP_STORE(7,C);
945 :     Src += 1;
946 :     Dst += 1;
947 :     }
948 :     #endif
949 :     }
950 :     #undef CLIP_STORE
951 :    
952 :     #define CLIP_STORE(i,C) \
953 :     if (C<0) C = 0; else if (C>(255<<5)) C = 255; else C = C>>5; \
954 :     C = (C+Src[BpS*i+BpS]+1-RND) >> 1; \
955 :     STORE(Dst[BpS*i], C)
956 :    
957 :     static void
958 :     FUNC_VA_UP(uint8_t *Dst, const uint8_t *Src, int32_t H, int32_t BpS, int32_t RND)
959 :     {
960 :     #if (SIZE==16)
961 :     while(H-->0) {
962 :     int C;
963 :     C = 16-RND +14*Src[BpS*0] +23*Src[BpS*1] - 7*Src[BpS*2] + 3*Src[BpS*3] - Src[BpS*4];
964 :     CLIP_STORE(0,C);
965 :     C = 16-RND - 3*(Src[BpS*0]-Src[BpS*4]) +19*Src[BpS*1] +20*Src[BpS*2] - 6*Src[BpS*3] - Src[BpS*5];
966 :     CLIP_STORE( 1,C);
967 :     C = 16-RND + 2*Src[BpS*0] - 6*(Src[BpS*1]+Src[BpS*4]) +20*(Src[BpS*2]+Src[BpS*3]) + 3*Src[BpS*5] - Src[BpS*6];
968 :     CLIP_STORE( 2,C);
969 :     C = 16-RND - (Src[BpS*0]+Src[BpS*7 ]) + 3*(Src[BpS* 1]+Src[BpS* 6])-6*(Src[BpS* 2]+Src[BpS* 5]) + 20*(Src[BpS* 3]+Src[BpS* 4]);
970 :     CLIP_STORE( 3,C);
971 :     C = 16-RND - (Src[BpS*1]+Src[BpS*8 ]) + 3*(Src[BpS* 2]+Src[BpS* 7])-6*(Src[BpS* 3]+Src[BpS* 6]) + 20*(Src[BpS* 4]+Src[BpS* 5]);
972 :     CLIP_STORE( 4,C);
973 :     C = 16-RND - (Src[BpS*2]+Src[BpS*9 ]) + 3*(Src[BpS* 3]+Src[BpS* 8])-6*(Src[BpS* 4]+Src[BpS* 7]) + 20*(Src[BpS* 5]+Src[BpS* 6]);
974 :     CLIP_STORE( 5,C);
975 :     C = 16-RND - (Src[BpS*3]+Src[BpS*10]) + 3*(Src[BpS* 4]+Src[BpS* 9])-6*(Src[BpS* 5]+Src[BpS* 8]) + 20*(Src[BpS* 6]+Src[BpS* 7]);
976 :     CLIP_STORE( 6,C);
977 :     C = 16-RND - (Src[BpS*4]+Src[BpS*11]) + 3*(Src[BpS* 5]+Src[BpS*10])-6*(Src[BpS* 6]+Src[BpS* 9]) + 20*(Src[BpS* 7]+Src[BpS* 8]);
978 :     CLIP_STORE( 7,C);
979 :     C = 16-RND - (Src[BpS*5]+Src[BpS*12]) + 3*(Src[BpS* 6]+Src[BpS*11])-6*(Src[BpS* 7]+Src[BpS*10]) + 20*(Src[BpS* 8]+Src[BpS* 9]);
980 :     CLIP_STORE( 8,C);
981 :     C = 16-RND - (Src[BpS*6]+Src[BpS*13]) + 3*(Src[BpS* 7]+Src[BpS*12])-6*(Src[BpS* 8]+Src[BpS*11]) + 20*(Src[BpS* 9]+Src[BpS*10]);
982 :     CLIP_STORE( 9,C);
983 :     C = 16-RND - (Src[BpS*7]+Src[BpS*14]) + 3*(Src[BpS* 8]+Src[BpS*13])-6*(Src[BpS* 9]+Src[BpS*12]) + 20*(Src[BpS*10]+Src[BpS*11]);
984 :     CLIP_STORE(10,C);
985 :     C = 16-RND - (Src[BpS*8]+Src[BpS*15]) + 3*(Src[BpS* 9]+Src[BpS*14])-6*(Src[BpS*10]+Src[BpS*13]) + 20*(Src[BpS*11]+Src[BpS*12]);
986 :     CLIP_STORE(11,C);
987 :     C = 16-RND - (Src[BpS*9]+Src[BpS*16]) + 3*(Src[BpS*10]+Src[BpS*15])-6*(Src[BpS*11]+Src[BpS*14]) + 20*(Src[BpS*12]+Src[BpS*13]);
988 :     CLIP_STORE(12,C);
989 :     C = 16-RND - Src[BpS*10] +3*Src[BpS*11] -6*(Src[BpS*12]+Src[BpS*15]) + 20*(Src[BpS*13]+Src[BpS*14]) +2*Src[BpS*16];
990 :     CLIP_STORE(13,C);
991 :     C = 16-RND - Src[BpS*11] +3*(Src[BpS*12]-Src[BpS*16]) -6*Src[BpS*13] + 20*Src[BpS*14] + 19*Src[BpS*15];
992 :     CLIP_STORE(14,C);
993 :     C = 16-RND - Src[BpS*12] +3*Src[BpS*13] -7*Src[BpS*14] + 23*Src[BpS*15] + 14*Src[BpS*16];
994 :     CLIP_STORE(15,C);
995 :     Src += 1;
996 :     Dst += 1;
997 :     }
998 :     #else
999 :     while(H-->0) {
1000 :     int C;
1001 :     C = 16-RND +14*Src[BpS*0] +23*Src[BpS*1] - 7*Src[BpS*2] + 3*Src[BpS*3] - Src[BpS*4];
1002 :     CLIP_STORE(0,C);
1003 :     C = 16-RND - 3*(Src[BpS*0]-Src[BpS*4]) +19*Src[BpS*1] +20*Src[BpS*2] - 6*Src[BpS*3] - Src[BpS*5];
1004 :     CLIP_STORE(1,C);
1005 :     C = 16-RND + 2*Src[BpS*0] - 6*(Src[BpS*1]+Src[BpS*4]) +20*(Src[BpS*2]+Src[BpS*3]) + 3*Src[BpS*5] - Src[BpS*6];
1006 :     CLIP_STORE(2,C);
1007 :     C = 16-RND - (Src[BpS*0]+Src[BpS*7]) + 3*(Src[BpS*1]+Src[BpS*6])-6*(Src[BpS*2]+Src[BpS*5]) + 20*(Src[BpS*3]+Src[BpS*4]);
1008 :     CLIP_STORE(3,C);
1009 :     C = 16-RND - (Src[BpS*1]+Src[BpS*8]) + 3*(Src[BpS*2]+Src[BpS*7])-6*(Src[BpS*3]+Src[BpS*6]) + 20*(Src[BpS*4]+Src[BpS*5]);
1010 :     CLIP_STORE(4,C);
1011 :     C = 16-RND - Src[BpS*2] +3*Src[BpS*3] -6*(Src[BpS*4]+Src[BpS*7]) + 20*(Src[BpS*5]+Src[BpS*6]) +2*Src[BpS*8];
1012 :     CLIP_STORE(5,C);
1013 :     C = 16-RND - Src[BpS*3] +3*(Src[BpS*4]-Src[BpS*8]) -6*Src[BpS*5] + 20*Src[BpS*6] + 19*Src[BpS*7];
1014 :     CLIP_STORE(6,C);
1015 :     C = 16-RND - Src[BpS*4] +3*Src[BpS*5] -7*Src[BpS*6] + 23*Src[BpS*7] + 14*Src[BpS*8];
1016 :     CLIP_STORE(7,C);
1017 :     Src += 1;
1018 :     Dst += 1;
1019 :     }
1020 :     #endif
1021 :     }
1022 :     #undef CLIP_STORE
1023 :    
1024 :     #undef STORE
1025 :     #undef FUNC_H
1026 :     #undef FUNC_V
1027 :     #undef FUNC_HA
1028 :     #undef FUNC_VA
1029 :     #undef FUNC_HA_UP
1030 :     #undef FUNC_VA_UP
1031 :    
1032 :    
1033 :     #endif /* XVID_AUTO_INCLUDE && !defined(REF) */

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4