26 |
#include "../portab.h" |
#include "../portab.h" |
27 |
#include "../global.h" |
#include "../global.h" |
28 |
|
|
29 |
/* This is borrowed from decoder.c */ |
/* ************************************************************* |
30 |
static __inline int |
* will initialize internal pointers |
|
gmc_sanitize(int value, int quarterpel, int fcode) |
|
|
{ |
|
|
int length = 1 << (fcode+4); |
|
|
|
|
|
#if 0 |
|
|
if (quarterpel) value *= 2; |
|
|
#endif |
|
|
|
|
|
if (value < -length) |
|
|
return -length; |
|
|
else if (value >= length) |
|
|
return length-1; |
|
|
else return value; |
|
|
} |
|
|
|
|
|
|
|
|
/* And this is borrowed from bitstream.c until we find a common solution */ |
|
|
static uint32_t __inline |
|
|
log2bin(uint32_t value) |
|
|
{ |
|
|
/* Changed by Chenm001 */ |
|
|
#if !defined(_MSC_VER) |
|
|
int n = 0; |
|
|
|
|
|
while (value) { |
|
|
value >>= 1; |
|
|
n++; |
|
|
} |
|
|
return n; |
|
|
#else |
|
|
__asm { |
|
|
bsr eax, value |
|
|
inc eax |
|
|
} |
|
|
#endif |
|
|
} |
|
|
/* 16*sizeof(int) -> 1 or 2 cachelines */ |
|
|
/* table lookup might be faster! (still to be benchmarked) */ |
|
|
|
|
|
/* |
|
|
static int log2bin_table[16] = |
|
|
{ 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4}; |
|
|
*/ |
|
|
/* 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 */ |
|
|
|
|
|
#define RDIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b)) |
|
|
#define RSHIFT(a,b) ( (a)>0 ? ((a) + (1<<((b)-1)))>>(b) : ((a) + (1<<((b)-1))-1)>>(b)) |
|
|
|
|
|
#define MLT(i) (((16-(i))<<16) + (i)) |
|
|
static const uint32_t MTab[16] = { |
|
|
MLT( 0), MLT( 1), MLT( 2), MLT( 3), MLT( 4), MLT( 5), MLT( 6), MLT( 7), |
|
|
MLT( 8), MLT( 9), MLT(10), MLT(11), MLT(12), MLT(13), MLT(14), MLT(15) |
|
|
}; |
|
|
#undef MLT |
|
|
|
|
|
|
|
|
/* ************************************************************ |
|
|
* Pts = 2 or 3 |
|
|
* |
|
|
* Warning! *src is the global frame pointer (that is: adress |
|
|
* of pixel 0,0), not the macroblock one. |
|
|
* Conversely, *dst is the macroblock top-left adress. |
|
|
*/ |
|
|
|
|
|
void Predict_16x16_C(const NEW_GMC_DATA * const This, |
|
|
uint8_t *dst, const uint8_t *src, |
|
|
int dststride, int srcstride, int x, int y, int rounding); |
|
|
|
|
|
void Predict_8x8_C(const NEW_GMC_DATA * const This, |
|
|
uint8_t *uDst, const uint8_t *uSrc, |
|
|
uint8_t *vDst, const uint8_t *vSrc, |
|
|
int dststride, int srcstride, int x, int y, int rounding); |
|
|
|
|
|
void get_average_mv_C(const NEW_GMC_DATA * const Dsp, VECTOR * const mv, |
|
|
int x, int y, int qpel); |
|
|
|
|
|
/* ************************************************************ |
|
|
* simplified version for 1 warp point |
|
31 |
*/ |
*/ |
32 |
|
|
33 |
void Predict_1pt_16x16_C(const NEW_GMC_DATA * const This, |
void init_GMC(const unsigned int cpu_flags); |
|
uint8_t *Dst, const uint8_t *Src, |
|
|
int dststride, int srcstride, int x, int y, int rounding); |
|
|
|
|
|
void Predict_1pt_8x8_C(const NEW_GMC_DATA * const This, |
|
|
uint8_t *uDst, const uint8_t *uSrc, |
|
|
uint8_t *vDst, const uint8_t *vSrc, |
|
|
int dststride, int srcstride, int x, int y, int rounding); |
|
|
|
|
|
void get_average_mv_1pt_C(const NEW_GMC_DATA * const Dsp, VECTOR * const mv, |
|
|
int x, int y, int qpel); |
|
34 |
|
|
35 |
/* ************************************************************* |
/* ************************************************************* |
36 |
* Warning! It's Accuracy being passed, not 'resolution'! |
* Warning! It's Accuracy being passed, not 'resolution'! |
58 |
MACROBLOCK *const pMBs, /* [output] average motion vectors */ |
MACROBLOCK *const pMBs, /* [output] average motion vectors */ |
59 |
IMAGE *const pGMC); /* [output] full warped image */ |
IMAGE *const pGMC); /* [output] full warped image */ |
60 |
|
|
61 |
|
/* ************************************************************* |
62 |
|
* utils |
63 |
|
*/ |
64 |
|
|
65 |
|
/* This is borrowed from decoder.c */ |
66 |
|
static __inline int |
67 |
|
gmc_sanitize(int value, int quarterpel, int fcode) |
68 |
|
{ |
69 |
|
int length = 1 << (fcode+4); |
70 |
|
|
71 |
|
#if 0 |
72 |
|
if (quarterpel) value *= 2; |
73 |
|
#endif |
74 |
|
|
75 |
|
if (value < -length) |
76 |
|
return -length; |
77 |
|
else if (value >= length) |
78 |
|
return length-1; |
79 |
|
else return value; |
80 |
|
} |
81 |
|
|
82 |
|
/* *************************************************************/ |