20 |
#define MODE_INTERPOLATE 1 |
#define MODE_INTERPOLATE 1 |
21 |
#define MODE_BACKWARD 2 |
#define MODE_BACKWARD 2 |
22 |
#define MODE_FORWARD 3 |
#define MODE_FORWARD 3 |
23 |
|
#define MODE_DIRECT_NONE_MV 4 |
24 |
|
|
25 |
|
|
26 |
typedef struct |
typedef struct |
43 |
{ |
{ |
44 |
// decoder/encoder |
// decoder/encoder |
45 |
VECTOR mvs[4]; |
VECTOR mvs[4]; |
|
uint32_t sad8[4]; // SAD values for inter4v-VECTORs |
|
|
uint32_t sad16; // SAD value for inter-VECTOR |
|
46 |
|
|
47 |
short int pred_values[6][MBPRED_SIZE]; |
short int pred_values[6][MBPRED_SIZE]; |
48 |
int acpred_directions[6]; |
int acpred_directions[6]; |
57 |
|
|
58 |
// encoder specific |
// encoder specific |
59 |
|
|
60 |
|
VECTOR mv16; |
61 |
VECTOR pmvs[4]; |
VECTOR pmvs[4]; |
62 |
|
|
63 |
|
int32_t sad8[4]; // SAD values for inter4v-VECTORs |
64 |
|
int32_t sad16; // SAD value for inter-VECTOR |
65 |
|
|
66 |
int dquant; |
int dquant; |
67 |
int cbp; |
int cbp; |
68 |
|
|
71 |
VECTOR b_mvs[4]; |
VECTOR b_mvs[4]; |
72 |
VECTOR b_pmvs[4]; |
VECTOR b_pmvs[4]; |
73 |
|
|
74 |
} MACROBLOCK; |
int mb_type; |
75 |
|
int dbquant; |
76 |
|
|
77 |
static __inline int8_t get_dc_scaler(int32_t quant, uint32_t lum) |
// stuff for block based ME (needed for Qpel ME) |
78 |
{ |
// backup of last integer ME vectors/sad |
|
int8_t dc_scaler; |
|
79 |
|
|
80 |
if(quant > 0 && quant < 5) { |
VECTOR i_mv16; |
81 |
dc_scaler = 8; |
VECTOR i_pmvs[4]; |
|
return dc_scaler; |
|
|
} |
|
82 |
|
|
83 |
if(quant < 25 && !lum) { |
int32_t i_sad8[4]; // SAD values for inter4v-VECTORs |
84 |
dc_scaler = (quant + 13) >> 1; |
int32_t i_sad16; // SAD value for inter-VECTOR |
|
return dc_scaler; |
|
|
} |
|
85 |
|
|
|
if(quant < 9) { |
|
|
dc_scaler = quant << 1; |
|
|
return dc_scaler; |
|
86 |
} |
} |
87 |
|
MACROBLOCK; |
88 |
|
|
89 |
if(quant < 25) { |
static __inline int8_t |
90 |
dc_scaler = quant + 8; |
get_dc_scaler(uint32_t quant, |
91 |
return dc_scaler; |
uint32_t lum) |
92 |
} |
{ |
93 |
|
if (quant < 5) |
94 |
|
return 8; |
95 |
|
|
96 |
|
if (quant < 25 && !lum) |
97 |
|
return (quant + 13) / 2; |
98 |
|
|
99 |
|
if (quant < 9) |
100 |
|
return 2 * quant; |
101 |
|
|
102 |
|
if (quant < 25) |
103 |
|
return quant + 8; |
104 |
|
|
105 |
if(lum) |
if(lum) |
106 |
dc_scaler = (quant << 1) - 16; |
return 2 * quant - 16; |
107 |
else |
else |
108 |
dc_scaler = quant - 6; |
return quant - 6; |
|
|
|
|
return dc_scaler; |
|
109 |
} |
} |
110 |
|
|
|
|
|
111 |
// useful macros |
// useful macros |
112 |
|
|
113 |
#define MIN(X, Y) ((X)<(Y)?(X):(Y)) |
#define MIN(X, Y) ((X)<(Y)?(X):(Y)) |