19 |
* along with this program ; if not, write to the Free Software |
* along with this program ; if not, write to the Free Software |
20 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 |
* |
* |
22 |
* $Id: qpel.c,v 1.4 2004-10-17 10:20:15 edgomez Exp $ |
* $Id$ |
23 |
* |
* |
24 |
****************************************************************************/ |
****************************************************************************/ |
25 |
|
|
26 |
#ifndef XVID_AUTO_INCLUDE |
#ifndef XVID_AUTO_INCLUDE |
27 |
|
|
28 |
|
#include <stdio.h> |
29 |
|
|
30 |
#include "../portab.h" |
#include "../portab.h" |
31 |
#include "qpel.h" |
#include "qpel.h" |
32 |
|
|
199 |
/* Global scope hooks |
/* Global scope hooks |
200 |
****************************************************************************/ |
****************************************************************************/ |
201 |
|
|
202 |
XVID_QP_FUNCS *xvid_QP_Funcs = 0; |
XVID_QP_FUNCS *xvid_QP_Funcs = NULL; |
203 |
XVID_QP_FUNCS *xvid_QP_Add_Funcs = 0; |
XVID_QP_FUNCS *xvid_QP_Add_Funcs = NULL; |
204 |
|
|
205 |
/* Reference plain C impl. declaration |
/* Reference plain C impl. declaration |
206 |
****************************************************************************/ |
****************************************************************************/ |
243 |
/* mmx impl. declaration (see. qpel_mmx.asm |
/* mmx impl. declaration (see. qpel_mmx.asm |
244 |
****************************************************************************/ |
****************************************************************************/ |
245 |
|
|
246 |
#ifdef ARCH_IS_IA32 |
#if defined (ARCH_IS_IA32) || defined(ARCH_IS_X86_64) |
247 |
extern XVID_QP_PASS_SIGNATURE(xvid_H_Pass_16_mmx); |
extern XVID_QP_PASS_SIGNATURE(xvid_H_Pass_16_mmx); |
248 |
extern XVID_QP_PASS_SIGNATURE(xvid_H_Pass_Avrg_16_mmx); |
extern XVID_QP_PASS_SIGNATURE(xvid_H_Pass_Avrg_16_mmx); |
249 |
extern XVID_QP_PASS_SIGNATURE(xvid_H_Pass_Avrg_Up_16_mmx); |
extern XVID_QP_PASS_SIGNATURE(xvid_H_Pass_Avrg_Up_16_mmx); |
345 |
/* tables for ASM |
/* tables for ASM |
346 |
****************************************************************************/ |
****************************************************************************/ |
347 |
|
|
348 |
#ifdef ARCH_IS_IA32 |
|
349 |
uint16_t xvid_Expand_mmx[256][4]; /* 8b -> 64b expansion table */ |
#if defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64) |
350 |
|
/* These symbols will be used outside this file, so tell the compiler |
351 |
|
* they're global. */ |
352 |
|
extern uint16_t xvid_Expand_mmx[256][4]; /* 8b -> 64b expansion table */ |
353 |
|
|
354 |
|
extern int16_t xvid_FIR_1_0_0_0[256][4]; |
355 |
|
extern int16_t xvid_FIR_3_1_0_0[256][4]; |
356 |
|
extern int16_t xvid_FIR_6_3_1_0[256][4]; |
357 |
|
extern int16_t xvid_FIR_14_3_2_1[256][4]; |
358 |
|
extern int16_t xvid_FIR_20_6_3_1[256][4]; |
359 |
|
extern int16_t xvid_FIR_20_20_6_3[256][4]; |
360 |
|
extern int16_t xvid_FIR_23_19_6_3[256][4]; |
361 |
|
extern int16_t xvid_FIR_7_20_20_6[256][4]; |
362 |
|
extern int16_t xvid_FIR_6_20_20_6[256][4]; |
363 |
|
extern int16_t xvid_FIR_6_20_20_7[256][4]; |
364 |
|
extern int16_t xvid_FIR_3_6_20_20[256][4]; |
365 |
|
extern int16_t xvid_FIR_3_6_19_23[256][4]; |
366 |
|
extern int16_t xvid_FIR_1_3_6_20[256][4]; |
367 |
|
extern int16_t xvid_FIR_1_2_3_14[256][4]; |
368 |
|
extern int16_t xvid_FIR_0_1_3_6[256][4]; |
369 |
|
extern int16_t xvid_FIR_0_0_1_3[256][4]; |
370 |
|
extern int16_t xvid_FIR_0_0_0_1[256][4]; |
371 |
#endif |
#endif |
372 |
|
|
373 |
/* Alternate way of filtering (cf. USE_TABLES flag in qpel_mmx.asm) |
/* Arrays definitions, according to the target platform */ |
374 |
* |
|
375 |
* 17 tables, 2K each => 34K |
#if !defined(ARCH_IS_X86_64) && !defined(ARCH_IS_IA32) |
376 |
* Mirroring can be acheived composing 11 basic tables |
/* Only ia32/ia64 will use these tables outside this file so mark them |
377 |
* (for instance: (23,19,-6,3)=(20,20,-6,3)+(3,-1,0,0) |
* static for all other archs */ |
378 |
* Using Symmetries (and bswap) could reduce further |
#define __SCOPE static |
379 |
* the memory to 7 tables (->14K). */ |
__SCOPE int16_t xvid_FIR_1_0_0_0[256][4]; |
380 |
|
__SCOPE int16_t xvid_FIR_3_1_0_0[256][4]; |
381 |
int16_t xvid_FIR_1_0_0_0[256][4]; |
__SCOPE int16_t xvid_FIR_6_3_1_0[256][4]; |
382 |
int16_t xvid_FIR_3_1_0_0[256][4]; |
__SCOPE int16_t xvid_FIR_14_3_2_1[256][4]; |
383 |
int16_t xvid_FIR_6_3_1_0[256][4]; |
__SCOPE int16_t xvid_FIR_20_6_3_1[256][4]; |
384 |
int16_t xvid_FIR_14_3_2_1[256][4]; |
__SCOPE int16_t xvid_FIR_20_20_6_3[256][4]; |
385 |
int16_t xvid_FIR_20_6_3_1[256][4]; |
__SCOPE int16_t xvid_FIR_23_19_6_3[256][4]; |
386 |
int16_t xvid_FIR_20_20_6_3[256][4]; |
__SCOPE int16_t xvid_FIR_7_20_20_6[256][4]; |
387 |
int16_t xvid_FIR_23_19_6_3[256][4]; |
__SCOPE int16_t xvid_FIR_6_20_20_6[256][4]; |
388 |
int16_t xvid_FIR_7_20_20_6[256][4]; |
__SCOPE int16_t xvid_FIR_6_20_20_7[256][4]; |
389 |
int16_t xvid_FIR_6_20_20_6[256][4]; |
__SCOPE int16_t xvid_FIR_3_6_20_20[256][4]; |
390 |
int16_t xvid_FIR_6_20_20_7[256][4]; |
__SCOPE int16_t xvid_FIR_3_6_19_23[256][4]; |
391 |
int16_t xvid_FIR_3_6_20_20[256][4]; |
__SCOPE int16_t xvid_FIR_1_3_6_20[256][4]; |
392 |
int16_t xvid_FIR_3_6_19_23[256][4]; |
__SCOPE int16_t xvid_FIR_1_2_3_14[256][4]; |
393 |
int16_t xvid_FIR_1_3_6_20[256][4]; |
__SCOPE int16_t xvid_FIR_0_1_3_6[256][4]; |
394 |
int16_t xvid_FIR_1_2_3_14[256][4]; |
__SCOPE int16_t xvid_FIR_0_0_1_3[256][4]; |
395 |
int16_t xvid_FIR_0_1_3_6[256][4]; |
__SCOPE int16_t xvid_FIR_0_0_0_1[256][4]; |
396 |
int16_t xvid_FIR_0_0_1_3[256][4]; |
#endif |
|
int16_t xvid_FIR_0_0_0_1[256][4]; |
|
397 |
|
|
398 |
static void Init_FIR_Table(int16_t Tab[][4], |
static void Init_FIR_Table(int16_t Tab[][4], |
399 |
int A, int B, int C, int D) |
int A, int B, int C, int D) |
408 |
} |
} |
409 |
|
|
410 |
|
|
411 |
void xvid_Init_QP() |
void xvid_Init_QP(void) |
412 |
{ |
{ |
413 |
#ifdef ARCH_IS_IA32 |
#if defined (ARCH_IS_IA32) || defined (ARCH_IS_X86_64) |
414 |
int i; |
int i; |
415 |
|
|
416 |
for(i=0; i<256; ++i) { |
for(i=0; i<256; ++i) { |