Parent Directory | Revision Log
Revision 1.8 - (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 : | Isibaar | 1.8 | * $Id: qpel.h,v 1.7 2005/10/26 12:38:34 Skal Exp $ |
23 : | edgomez | 1.2 | * |
24 : | ****************************************************************************/ | ||
25 : | |||
26 : | #ifndef _XVID_QPEL_H_ | ||
27 : | #define _XVID_QPEL_H_ | ||
28 : | |||
29 : | edgomez | 1.3 | #include "interpolate8x8.h" |
30 : | edgomez | 1.2 | #include "../utils/mem_transfer.h" |
31 : | |||
32 : | /***************************************************************************** | ||
33 : | * Signatures | ||
34 : | ****************************************************************************/ | ||
35 : | |||
36 : | #define XVID_QP_PASS_SIGNATURE(NAME) \ | ||
37 : | void (NAME)(uint8_t *dst, const uint8_t *src, int32_t length, int32_t BpS, int32_t rounding) | ||
38 : | |||
39 : | typedef XVID_QP_PASS_SIGNATURE(XVID_QP_PASS); | ||
40 : | |||
41 : | /* We put everything in a single struct so it can easily be passed | ||
42 : | * to prediction functions as a whole... */ | ||
43 : | |||
44 : | typedef struct _XVID_QP_FUNCS { | ||
45 : | |||
46 : | /* filter for QPel 16x? prediction */ | ||
47 : | |||
48 : | XVID_QP_PASS *H_Pass; | ||
49 : | XVID_QP_PASS *H_Pass_Avrg; | ||
50 : | XVID_QP_PASS *H_Pass_Avrg_Up; | ||
51 : | XVID_QP_PASS *V_Pass; | ||
52 : | XVID_QP_PASS *V_Pass_Avrg; | ||
53 : | XVID_QP_PASS *V_Pass_Avrg_Up; | ||
54 : | |||
55 : | /* filter for QPel 8x? prediction */ | ||
56 : | |||
57 : | XVID_QP_PASS *H_Pass_8; | ||
58 : | XVID_QP_PASS *H_Pass_Avrg_8; | ||
59 : | XVID_QP_PASS *H_Pass_Avrg_Up_8; | ||
60 : | XVID_QP_PASS *V_Pass_8; | ||
61 : | XVID_QP_PASS *V_Pass_Avrg_8; | ||
62 : | XVID_QP_PASS *V_Pass_Avrg_Up_8; | ||
63 : | } XVID_QP_FUNCS; | ||
64 : | |||
65 : | /***************************************************************************** | ||
66 : | * fwd dcl | ||
67 : | ****************************************************************************/ | ||
68 : | extern void xvid_Init_QP(); | ||
69 : | |||
70 : | edgomez | 1.3 | extern XVID_QP_FUNCS xvid_QP_Funcs_C_ref; /* for P-frames */ |
71 : | extern XVID_QP_FUNCS xvid_QP_Add_Funcs_C_ref; /* for B-frames */ | ||
72 : | |||
73 : | edgomez | 1.2 | extern XVID_QP_FUNCS xvid_QP_Funcs_C; /* for P-frames */ |
74 : | extern XVID_QP_FUNCS xvid_QP_Add_Funcs_C; /* for B-frames */ | ||
75 : | |||
76 : | Isibaar | 1.8 | #if defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64) |
77 : | edgomez | 1.2 | extern XVID_QP_FUNCS xvid_QP_Funcs_mmx; |
78 : | extern XVID_QP_FUNCS xvid_QP_Add_Funcs_mmx; | ||
79 : | #endif | ||
80 : | |||
81 : | edgomez | 1.5 | #ifdef ARCH_IS_PPC |
82 : | extern XVID_QP_FUNCS xvid_QP_Funcs_Altivec_C; | ||
83 : | extern XVID_QP_FUNCS xvid_QP_Add_Funcs_Altivec_C; | ||
84 : | #endif | ||
85 : | |||
86 : | edgomez | 1.2 | extern XVID_QP_FUNCS *xvid_QP_Funcs; /* <- main pointer for enc/dec structure */ |
87 : | extern XVID_QP_FUNCS *xvid_QP_Add_Funcs; /* <- main pointer for enc/dec structure */ | ||
88 : | |||
89 : | /***************************************************************************** | ||
90 : | * macros | ||
91 : | ****************************************************************************/ | ||
92 : | |||
93 : | /***************************************************************************** | ||
94 : | |||
95 : | Passes to be performed | ||
96 : | |||
97 : | case 0: copy | ||
98 : | case 2: h-pass | ||
99 : | case 1/3: h-pass + h-avrg | ||
100 : | case 8: v-pass | ||
101 : | case 10: h-pass + v-pass | ||
102 : | case 9/11: h-pass + h-avrg + v-pass | ||
103 : | case 4/12: v-pass + v-avrg | ||
104 : | case 6/14: h-pass + v-pass + v-avrg | ||
105 : | case 5/13/7/15: h-pass + h-avrg + v-pass + v-avrg | ||
106 : | |||
107 : | ****************************************************************************/ | ||
108 : | |||
109 : | edgomez | 1.3 | static void __inline |
110 : | interpolate16x16_quarterpel(uint8_t * const cur, | ||
111 : | edgomez | 1.2 | uint8_t * const refn, |
112 : | uint8_t * const refh, | ||
113 : | uint8_t * const refv, | ||
114 : | uint8_t * const refhv, | ||
115 : | const uint32_t x, const uint32_t y, | ||
116 : | const int32_t dx, const int dy, | ||
117 : | const uint32_t stride, | ||
118 : | const uint32_t rounding) | ||
119 : | { | ||
120 : | const uint8_t *src; | ||
121 : | uint8_t *dst; | ||
122 : | uint8_t *tmp; | ||
123 : | int32_t quads; | ||
124 : | const XVID_QP_FUNCS *Ops; | ||
125 : | |||
126 : | int32_t x_int, y_int; | ||
127 : | |||
128 : | edgomez | 1.4 | const int32_t xRef = (int)x*4 + dx; |
129 : | const int32_t yRef = (int)y*4 + dy; | ||
130 : | edgomez | 1.2 | |
131 : | edgomez | 1.3 | Ops = xvid_QP_Funcs; |
132 : | edgomez | 1.2 | quads = (dx&3) | ((dy&3)<<2); |
133 : | |||
134 : | Skal | 1.7 | x_int = xRef >> 2; |
135 : | y_int = yRef >> 2; | ||
136 : | edgomez | 1.2 | |
137 : | dst = cur + y * stride + x; | ||
138 : | edgomez | 1.4 | src = refn + y_int * (int)stride + x_int; |
139 : | edgomez | 1.2 | |
140 : | tmp = refh; /* we need at least a 16 x stride scratch block */ | ||
141 : | |||
142 : | switch(quads) { | ||
143 : | case 0: | ||
144 : | edgomez | 1.3 | transfer8x8_copy(dst, src, stride); |
145 : | transfer8x8_copy(dst+8, src+8, stride); | ||
146 : | transfer8x8_copy(dst+8*stride, src+8*stride, stride); | ||
147 : | transfer8x8_copy(dst+8*stride+8, src+8*stride+8, stride); | ||
148 : | edgomez | 1.2 | break; |
149 : | case 1: | ||
150 : | Ops->H_Pass_Avrg(dst, src, 16, stride, rounding); | ||
151 : | break; | ||
152 : | case 2: | ||
153 : | Ops->H_Pass(dst, src, 16, stride, rounding); | ||
154 : | break; | ||
155 : | case 3: | ||
156 : | Ops->H_Pass_Avrg_Up(dst, src, 16, stride, rounding); | ||
157 : | break; | ||
158 : | case 4: | ||
159 : | Ops->V_Pass_Avrg(dst, src, 16, stride, rounding); | ||
160 : | break; | ||
161 : | case 5: | ||
162 : | Ops->H_Pass_Avrg(tmp, src, 17, stride, rounding); | ||
163 : | Ops->V_Pass_Avrg(dst, tmp, 16, stride, rounding); | ||
164 : | break; | ||
165 : | case 6: | ||
166 : | Ops->H_Pass(tmp, src, 17, stride, rounding); | ||
167 : | Ops->V_Pass_Avrg(dst, tmp, 16, stride, rounding); | ||
168 : | break; | ||
169 : | case 7: | ||
170 : | Ops->H_Pass_Avrg_Up(tmp, src, 17, stride, rounding); | ||
171 : | Ops->V_Pass_Avrg(dst, tmp, 16, stride, rounding); | ||
172 : | break; | ||
173 : | case 8: | ||
174 : | Ops->V_Pass(dst, src, 16, stride, rounding); | ||
175 : | break; | ||
176 : | case 9: | ||
177 : | Ops->H_Pass_Avrg(tmp, src, 17, stride, rounding); | ||
178 : | Ops->V_Pass(dst, tmp, 16, stride, rounding); | ||
179 : | break; | ||
180 : | case 10: | ||
181 : | Ops->H_Pass(tmp, src, 17, stride, rounding); | ||
182 : | Ops->V_Pass(dst, tmp, 16, stride, rounding); | ||
183 : | break; | ||
184 : | case 11: | ||
185 : | Ops->H_Pass_Avrg_Up(tmp, src, 17, stride, rounding); | ||
186 : | Ops->V_Pass(dst, tmp, 16, stride, rounding); | ||
187 : | break; | ||
188 : | case 12: | ||
189 : | Ops->V_Pass_Avrg_Up(dst, src, 16, stride, rounding); | ||
190 : | break; | ||
191 : | case 13: | ||
192 : | Ops->H_Pass_Avrg(tmp, src, 17, stride, rounding); | ||
193 : | Ops->V_Pass_Avrg_Up(dst, tmp, 16, stride, rounding); | ||
194 : | break; | ||
195 : | case 14: | ||
196 : | Ops->H_Pass(tmp, src, 17, stride, rounding); | ||
197 : | Ops->V_Pass_Avrg_Up( dst, tmp, 16, stride, rounding); | ||
198 : | break; | ||
199 : | case 15: | ||
200 : | Ops->H_Pass_Avrg_Up(tmp, src, 17, stride, rounding); | ||
201 : | Ops->V_Pass_Avrg_Up(dst, tmp, 16, stride, rounding); | ||
202 : | break; | ||
203 : | } | ||
204 : | } | ||
205 : | |||
206 : | edgomez | 1.3 | static void __inline |
207 : | interpolate16x16_add_quarterpel(uint8_t * const cur, | ||
208 : | uint8_t * const refn, | ||
209 : | uint8_t * const refh, | ||
210 : | uint8_t * const refv, | ||
211 : | uint8_t * const refhv, | ||
212 : | const uint32_t x, const uint32_t y, | ||
213 : | const int32_t dx, const int dy, | ||
214 : | const uint32_t stride, | ||
215 : | const uint32_t rounding) | ||
216 : | { | ||
217 : | const uint8_t *src; | ||
218 : | uint8_t *dst; | ||
219 : | uint8_t *tmp; | ||
220 : | int32_t quads; | ||
221 : | const XVID_QP_FUNCS *Ops; | ||
222 : | const XVID_QP_FUNCS *Ops_Copy; | ||
223 : | |||
224 : | int32_t x_int, y_int; | ||
225 : | |||
226 : | edgomez | 1.4 | const int32_t xRef = (int)x*4 + dx; |
227 : | const int32_t yRef = (int)y*4 + dy; | ||
228 : | edgomez | 1.3 | |
229 : | Ops = xvid_QP_Add_Funcs; | ||
230 : | Ops_Copy = xvid_QP_Funcs; | ||
231 : | quads = (dx&3) | ((dy&3)<<2); | ||
232 : | |||
233 : | Skal | 1.7 | x_int = xRef >> 2; |
234 : | y_int = yRef >> 2; | ||
235 : | edgomez | 1.3 | |
236 : | dst = cur + y * stride + x; | ||
237 : | edgomez | 1.4 | src = refn + y_int * (int)stride + x_int; |
238 : | edgomez | 1.3 | |
239 : | tmp = refh; /* we need at least a 16 x stride scratch block */ | ||
240 : | |||
241 : | switch(quads) { | ||
242 : | case 0: | ||
243 : | /* NB: there is no halfpel involved ! the name's function can be | ||
244 : | * misleading */ | ||
245 : | interpolate8x8_halfpel_add(dst, src, stride, rounding); | ||
246 : | interpolate8x8_halfpel_add(dst+8, src+8, stride, rounding); | ||
247 : | interpolate8x8_halfpel_add(dst+8*stride, src+8*stride, stride, rounding); | ||
248 : | interpolate8x8_halfpel_add(dst+8*stride+8, src+8*stride+8, stride, rounding); | ||
249 : | break; | ||
250 : | case 1: | ||
251 : | Ops->H_Pass_Avrg(dst, src, 16, stride, rounding); | ||
252 : | break; | ||
253 : | case 2: | ||
254 : | Ops->H_Pass(dst, src, 16, stride, rounding); | ||
255 : | break; | ||
256 : | case 3: | ||
257 : | Ops->H_Pass_Avrg_Up(dst, src, 16, stride, rounding); | ||
258 : | break; | ||
259 : | case 4: | ||
260 : | Ops->V_Pass_Avrg(dst, src, 16, stride, rounding); | ||
261 : | break; | ||
262 : | case 5: | ||
263 : | Ops_Copy->H_Pass_Avrg(tmp, src, 17, stride, rounding); | ||
264 : | Ops->V_Pass_Avrg(dst, tmp, 16, stride, rounding); | ||
265 : | break; | ||
266 : | case 6: | ||
267 : | Ops_Copy->H_Pass(tmp, src, 17, stride, rounding); | ||
268 : | Ops->V_Pass_Avrg(dst, tmp, 16, stride, rounding); | ||
269 : | break; | ||
270 : | case 7: | ||
271 : | Ops_Copy->H_Pass_Avrg_Up(tmp, src, 17, stride, rounding); | ||
272 : | Ops->V_Pass_Avrg(dst, tmp, 16, stride, rounding); | ||
273 : | break; | ||
274 : | case 8: | ||
275 : | Ops->V_Pass(dst, src, 16, stride, rounding); | ||
276 : | break; | ||
277 : | case 9: | ||
278 : | Ops_Copy->H_Pass_Avrg(tmp, src, 17, stride, rounding); | ||
279 : | Ops->V_Pass(dst, tmp, 16, stride, rounding); | ||
280 : | break; | ||
281 : | case 10: | ||
282 : | Ops_Copy->H_Pass(tmp, src, 17, stride, rounding); | ||
283 : | Ops->V_Pass(dst, tmp, 16, stride, rounding); | ||
284 : | break; | ||
285 : | case 11: | ||
286 : | Ops_Copy->H_Pass_Avrg_Up(tmp, src, 17, stride, rounding); | ||
287 : | Ops->V_Pass(dst, tmp, 16, stride, rounding); | ||
288 : | break; | ||
289 : | case 12: | ||
290 : | Ops->V_Pass_Avrg_Up(dst, src, 16, stride, rounding); | ||
291 : | break; | ||
292 : | case 13: | ||
293 : | Ops_Copy->H_Pass_Avrg(tmp, src, 17, stride, rounding); | ||
294 : | Ops->V_Pass_Avrg_Up(dst, tmp, 16, stride, rounding); | ||
295 : | break; | ||
296 : | case 14: | ||
297 : | Ops_Copy->H_Pass(tmp, src, 17, stride, rounding); | ||
298 : | Ops->V_Pass_Avrg_Up( dst, tmp, 16, stride, rounding); | ||
299 : | break; | ||
300 : | case 15: | ||
301 : | Ops_Copy->H_Pass_Avrg_Up(tmp, src, 17, stride, rounding); | ||
302 : | Ops->V_Pass_Avrg_Up(dst, tmp, 16, stride, rounding); | ||
303 : | break; | ||
304 : | } | ||
305 : | } | ||
306 : | |||
307 : | edgomez | 1.2 | static void __inline |
308 : | edgomez | 1.3 | interpolate16x8_quarterpel(uint8_t * const cur, |
309 : | edgomez | 1.2 | uint8_t * const refn, |
310 : | uint8_t * const refh, | ||
311 : | uint8_t * const refv, | ||
312 : | uint8_t * const refhv, | ||
313 : | const uint32_t x, const uint32_t y, | ||
314 : | const int32_t dx, const int dy, | ||
315 : | const uint32_t stride, | ||
316 : | const uint32_t rounding) | ||
317 : | { | ||
318 : | const uint8_t *src; | ||
319 : | uint8_t *dst; | ||
320 : | uint8_t *tmp; | ||
321 : | int32_t quads; | ||
322 : | const XVID_QP_FUNCS *Ops; | ||
323 : | |||
324 : | int32_t x_int, y_int; | ||
325 : | |||
326 : | edgomez | 1.4 | const int32_t xRef = (int)x*4 + dx; |
327 : | const int32_t yRef = (int)y*4 + dy; | ||
328 : | edgomez | 1.2 | |
329 : | edgomez | 1.3 | Ops = xvid_QP_Funcs; |
330 : | edgomez | 1.2 | quads = (dx&3) | ((dy&3)<<2); |
331 : | |||
332 : | Skal | 1.7 | x_int = xRef >> 2; |
333 : | y_int = yRef >> 2; | ||
334 : | edgomez | 1.2 | |
335 : | dst = cur + y * stride + x; | ||
336 : | edgomez | 1.4 | src = refn + y_int * (int)stride + x_int; |
337 : | edgomez | 1.2 | |
338 : | tmp = refh; /* we need at least a 16 x stride scratch block */ | ||
339 : | |||
340 : | switch(quads) { | ||
341 : | case 0: | ||
342 : | transfer8x8_copy( dst, src, stride); | ||
343 : | transfer8x8_copy( dst+8, src+8, stride); | ||
344 : | break; | ||
345 : | case 1: | ||
346 : | Ops->H_Pass_Avrg(dst, src, 8, stride, rounding); | ||
347 : | break; | ||
348 : | case 2: | ||
349 : | Ops->H_Pass(dst, src, 8, stride, rounding); | ||
350 : | break; | ||
351 : | case 3: | ||
352 : | Ops->H_Pass_Avrg_Up(dst, src, 8, stride, rounding); | ||
353 : | break; | ||
354 : | case 4: | ||
355 : | Ops->V_Pass_Avrg_8(dst, src, 16, stride, rounding); | ||
356 : | break; | ||
357 : | case 5: | ||
358 : | Ops->H_Pass_Avrg(tmp, src, 9, stride, rounding); | ||
359 : | Ops->V_Pass_Avrg_8(dst, tmp, 16, stride, rounding); | ||
360 : | break; | ||
361 : | case 6: | ||
362 : | Ops->H_Pass(tmp, src, 9, stride, rounding); | ||
363 : | Ops->V_Pass_Avrg_8(dst, tmp, 16, stride, rounding); | ||
364 : | break; | ||
365 : | case 7: | ||
366 : | Ops->H_Pass_Avrg_Up(tmp, src, 9, stride, rounding); | ||
367 : | Ops->V_Pass_Avrg_8(dst, tmp, 16, stride, rounding); | ||
368 : | break; | ||
369 : | case 8: | ||
370 : | Ops->V_Pass_8(dst, src, 16, stride, rounding); | ||
371 : | break; | ||
372 : | case 9: | ||
373 : | Ops->H_Pass_Avrg(tmp, src, 9, stride, rounding); | ||
374 : | Ops->V_Pass_8(dst, tmp, 16, stride, rounding); | ||
375 : | break; | ||
376 : | case 10: | ||
377 : | Ops->H_Pass(tmp, src, 9, stride, rounding); | ||
378 : | Ops->V_Pass_8(dst, tmp, 16, stride, rounding); | ||
379 : | break; | ||
380 : | case 11: | ||
381 : | Ops->H_Pass_Avrg_Up(tmp, src, 9, stride, rounding); | ||
382 : | Ops->V_Pass_8(dst, tmp, 16, stride, rounding); | ||
383 : | break; | ||
384 : | case 12: | ||
385 : | Ops->V_Pass_Avrg_Up_8(dst, src, 16, stride, rounding); | ||
386 : | break; | ||
387 : | case 13: | ||
388 : | Ops->H_Pass_Avrg(tmp, src, 9, stride, rounding); | ||
389 : | Ops->V_Pass_Avrg_Up_8(dst, tmp, 16, stride, rounding); | ||
390 : | break; | ||
391 : | case 14: | ||
392 : | Ops->H_Pass(tmp, src, 9, stride, rounding); | ||
393 : | Ops->V_Pass_Avrg_Up_8( dst, tmp, 16, stride, rounding); | ||
394 : | break; | ||
395 : | case 15: | ||
396 : | Ops->H_Pass_Avrg_Up(tmp, src, 9, stride, rounding); | ||
397 : | Ops->V_Pass_Avrg_Up_8(dst, tmp, 16, stride, rounding); | ||
398 : | break; | ||
399 : | } | ||
400 : | } | ||
401 : | |||
402 : | static void __inline | ||
403 : | edgomez | 1.3 | interpolate8x8_quarterpel(uint8_t * const cur, |
404 : | edgomez | 1.2 | uint8_t * const refn, |
405 : | uint8_t * const refh, | ||
406 : | uint8_t * const refv, | ||
407 : | uint8_t * const refhv, | ||
408 : | const uint32_t x, const uint32_t y, | ||
409 : | const int32_t dx, const int dy, | ||
410 : | const uint32_t stride, | ||
411 : | const uint32_t rounding) | ||
412 : | { | ||
413 : | const uint8_t *src; | ||
414 : | uint8_t *dst; | ||
415 : | uint8_t *tmp; | ||
416 : | int32_t quads; | ||
417 : | const XVID_QP_FUNCS *Ops; | ||
418 : | |||
419 : | int32_t x_int, y_int; | ||
420 : | |||
421 : | edgomez | 1.4 | const int32_t xRef = (int)x*4 + dx; |
422 : | const int32_t yRef = (int)y*4 + dy; | ||
423 : | edgomez | 1.2 | |
424 : | edgomez | 1.3 | Ops = xvid_QP_Funcs; |
425 : | edgomez | 1.2 | quads = (dx&3) | ((dy&3)<<2); |
426 : | |||
427 : | Skal | 1.7 | x_int = xRef >> 2; |
428 : | y_int = yRef >> 2; | ||
429 : | edgomez | 1.2 | |
430 : | dst = cur + y * stride + x; | ||
431 : | edgomez | 1.4 | src = refn + y_int * (int)stride + x_int; |
432 : | edgomez | 1.2 | |
433 : | tmp = refh; /* we need at least a 16 x stride scratch block */ | ||
434 : | |||
435 : | switch(quads) { | ||
436 : | case 0: | ||
437 : | transfer8x8_copy( dst, src, stride); | ||
438 : | break; | ||
439 : | case 1: | ||
440 : | Ops->H_Pass_Avrg_8(dst, src, 8, stride, rounding); | ||
441 : | break; | ||
442 : | case 2: | ||
443 : | Ops->H_Pass_8(dst, src, 8, stride, rounding); | ||
444 : | break; | ||
445 : | case 3: | ||
446 : | Ops->H_Pass_Avrg_Up_8(dst, src, 8, stride, rounding); | ||
447 : | break; | ||
448 : | case 4: | ||
449 : | Ops->V_Pass_Avrg_8(dst, src, 8, stride, rounding); | ||
450 : | break; | ||
451 : | case 5: | ||
452 : | Ops->H_Pass_Avrg_8(tmp, src, 9, stride, rounding); | ||
453 : | Ops->V_Pass_Avrg_8(dst, tmp, 8, stride, rounding); | ||
454 : | break; | ||
455 : | case 6: | ||
456 : | Ops->H_Pass_8(tmp, src, 9, stride, rounding); | ||
457 : | Ops->V_Pass_Avrg_8(dst, tmp, 8, stride, rounding); | ||
458 : | break; | ||
459 : | case 7: | ||
460 : | Ops->H_Pass_Avrg_Up_8(tmp, src, 9, stride, rounding); | ||
461 : | Ops->V_Pass_Avrg_8(dst, tmp, 8, stride, rounding); | ||
462 : | break; | ||
463 : | case 8: | ||
464 : | Ops->V_Pass_8(dst, src, 8, stride, rounding); | ||
465 : | break; | ||
466 : | case 9: | ||
467 : | Ops->H_Pass_Avrg_8(tmp, src, 9, stride, rounding); | ||
468 : | Ops->V_Pass_8(dst, tmp, 8, stride, rounding); | ||
469 : | break; | ||
470 : | case 10: | ||
471 : | Ops->H_Pass_8(tmp, src, 9, stride, rounding); | ||
472 : | Ops->V_Pass_8(dst, tmp, 8, stride, rounding); | ||
473 : | break; | ||
474 : | case 11: | ||
475 : | Ops->H_Pass_Avrg_Up_8(tmp, src, 9, stride, rounding); | ||
476 : | Ops->V_Pass_8(dst, tmp, 8, stride, rounding); | ||
477 : | break; | ||
478 : | case 12: | ||
479 : | Ops->V_Pass_Avrg_Up_8(dst, src, 8, stride, rounding); | ||
480 : | break; | ||
481 : | case 13: | ||
482 : | Ops->H_Pass_Avrg_8(tmp, src, 9, stride, rounding); | ||
483 : | Ops->V_Pass_Avrg_Up_8(dst, tmp, 8, stride, rounding); | ||
484 : | break; | ||
485 : | case 14: | ||
486 : | Ops->H_Pass_8(tmp, src, 9, stride, rounding); | ||
487 : | Ops->V_Pass_Avrg_Up_8( dst, tmp, 8, stride, rounding); | ||
488 : | break; | ||
489 : | case 15: | ||
490 : | Ops->H_Pass_Avrg_Up_8(tmp, src, 9, stride, rounding); | ||
491 : | Ops->V_Pass_Avrg_Up_8(dst, tmp, 8, stride, rounding); | ||
492 : | break; | ||
493 : | } | ||
494 : | } | ||
495 : | |||
496 : | edgomez | 1.3 | static void __inline |
497 : | interpolate8x8_add_quarterpel(uint8_t * const cur, | ||
498 : | uint8_t * const refn, | ||
499 : | uint8_t * const refh, | ||
500 : | uint8_t * const refv, | ||
501 : | uint8_t * const refhv, | ||
502 : | const uint32_t x, const uint32_t y, | ||
503 : | const int32_t dx, const int dy, | ||
504 : | const uint32_t stride, | ||
505 : | const uint32_t rounding) | ||
506 : | { | ||
507 : | const uint8_t *src; | ||
508 : | uint8_t *dst; | ||
509 : | uint8_t *tmp; | ||
510 : | int32_t quads; | ||
511 : | const XVID_QP_FUNCS *Ops; | ||
512 : | const XVID_QP_FUNCS *Ops_Copy; | ||
513 : | |||
514 : | int32_t x_int, y_int; | ||
515 : | |||
516 : | edgomez | 1.4 | const int32_t xRef = (int)x*4 + dx; |
517 : | const int32_t yRef = (int)y*4 + dy; | ||
518 : | edgomez | 1.3 | |
519 : | Ops = xvid_QP_Add_Funcs; | ||
520 : | Ops_Copy = xvid_QP_Funcs; | ||
521 : | quads = (dx&3) | ((dy&3)<<2); | ||
522 : | |||
523 : | Skal | 1.7 | x_int = xRef >> 2; |
524 : | y_int = yRef >> 2; | ||
525 : | edgomez | 1.3 | |
526 : | dst = cur + y * stride + x; | ||
527 : | edgomez | 1.4 | src = refn + y_int * (int)stride + x_int; |
528 : | edgomez | 1.3 | |
529 : | tmp = refh; /* we need at least a 16 x stride scratch block */ | ||
530 : | |||
531 : | switch(quads) { | ||
532 : | case 0: | ||
533 : | /* Misleading function name, there is no halfpel involved | ||
534 : | * just dst and src averaging with rounding=0 */ | ||
535 : | interpolate8x8_halfpel_add(dst, src, stride, rounding); | ||
536 : | break; | ||
537 : | case 1: | ||
538 : | Ops->H_Pass_Avrg_8(dst, src, 8, stride, rounding); | ||
539 : | break; | ||
540 : | case 2: | ||
541 : | Ops->H_Pass_8(dst, src, 8, stride, rounding); | ||
542 : | break; | ||
543 : | case 3: | ||
544 : | Ops->H_Pass_Avrg_Up_8(dst, src, 8, stride, rounding); | ||
545 : | break; | ||
546 : | case 4: | ||
547 : | Ops->V_Pass_Avrg_8(dst, src, 8, stride, rounding); | ||
548 : | break; | ||
549 : | case 5: | ||
550 : | Ops_Copy->H_Pass_Avrg_8(tmp, src, 9, stride, rounding); | ||
551 : | Ops->V_Pass_Avrg_8(dst, tmp, 8, stride, rounding); | ||
552 : | break; | ||
553 : | case 6: | ||
554 : | Ops_Copy->H_Pass_8(tmp, src, 9, stride, rounding); | ||
555 : | Ops->V_Pass_Avrg_8(dst, tmp, 8, stride, rounding); | ||
556 : | break; | ||
557 : | case 7: | ||
558 : | Ops_Copy->H_Pass_Avrg_Up_8(tmp, src, 9, stride, rounding); | ||
559 : | Ops->V_Pass_Avrg_8(dst, tmp, 8, stride, rounding); | ||
560 : | break; | ||
561 : | case 8: | ||
562 : | Ops->V_Pass_8(dst, src, 8, stride, rounding); | ||
563 : | break; | ||
564 : | case 9: | ||
565 : | Ops_Copy->H_Pass_Avrg_8(tmp, src, 9, stride, rounding); | ||
566 : | Ops->V_Pass_8(dst, tmp, 8, stride, rounding); | ||
567 : | break; | ||
568 : | case 10: | ||
569 : | Ops_Copy->H_Pass_8(tmp, src, 9, stride, rounding); | ||
570 : | Ops->V_Pass_8(dst, tmp, 8, stride, rounding); | ||
571 : | break; | ||
572 : | case 11: | ||
573 : | Ops_Copy->H_Pass_Avrg_Up_8(tmp, src, 9, stride, rounding); | ||
574 : | Ops->V_Pass_8(dst, tmp, 8, stride, rounding); | ||
575 : | break; | ||
576 : | case 12: | ||
577 : | Ops->V_Pass_Avrg_Up_8(dst, src, 8, stride, rounding); | ||
578 : | break; | ||
579 : | case 13: | ||
580 : | Ops_Copy->H_Pass_Avrg_8(tmp, src, 9, stride, rounding); | ||
581 : | Ops->V_Pass_Avrg_Up_8(dst, tmp, 8, stride, rounding); | ||
582 : | break; | ||
583 : | case 14: | ||
584 : | Ops_Copy->H_Pass_8(tmp, src, 9, stride, rounding); | ||
585 : | Ops->V_Pass_Avrg_Up_8( dst, tmp, 8, stride, rounding); | ||
586 : | break; | ||
587 : | case 15: | ||
588 : | Ops_Copy->H_Pass_Avrg_Up_8(tmp, src, 9, stride, rounding); | ||
589 : | Ops->V_Pass_Avrg_Up_8(dst, tmp, 8, stride, rounding); | ||
590 : | break; | ||
591 : | } | ||
592 : | } | ||
593 : | |||
594 : | edgomez | 1.2 | #endif /* _XVID_QPEL_H_ */ |
No admin address has been configured | ViewVC Help |
Powered by ViewVC 1.0.4 |