42 |
#define MVzero(A) ( ((A).x)==(0) && ((A).y)==(0) ) |
#define MVzero(A) ( ((A).x)==(0) && ((A).y)==(0) ) |
43 |
#define MVequal(A,B) ( ((A).x)==((B).x) && ((A).y)==((B).y) ) |
#define MVequal(A,B) ( ((A).x)==((B).x) && ((A).y)==((B).y) ) |
44 |
|
|
45 |
static const uint32_t roundtab[16] = |
/***************************************************************************** |
46 |
{ 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2 }; |
* Modified rounding tables -- defined in motion_est.c |
47 |
|
* Original tables see ISO spec tables 7-6 -> 7-9 |
48 |
|
****************************************************************************/ |
49 |
|
|
50 |
/* |
extern const uint32_t roundtab[16]; |
|
* modified rounding tables |
|
|
* original tables see ISO spec tables 7-6 -> 7-9 |
|
|
*/ |
|
51 |
|
|
52 |
/* K = 4 */ |
/* K = 4 */ |
53 |
static const uint32_t roundtab_76[16] = { 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1 }; |
extern const uint32_t roundtab_76[16]; |
54 |
/* K = 2 */ |
/* K = 2 */ |
55 |
static const uint32_t roundtab_78[8] = { 0, 0, 1, 1, 0, 0, 0, 1 }; |
extern const uint32_t roundtab_78[8]; |
56 |
/* K = 1 */ |
/* K = 1 */ |
57 |
static const uint32_t roundtab_79[4] = { 0, 1, 0, 0 }; |
extern const uint32_t roundtab_79[4]; |
58 |
|
|
59 |
|
|
60 |
/* |
/* |
74 |
|
|
75 |
const int32_t dx, |
const int32_t dx, |
76 |
const int32_t dy, |
const int32_t dy, |
77 |
const uint32_t stride) |
const int32_t stride) |
78 |
{ |
{ |
79 |
|
|
80 |
|
|
108 |
|
|
109 |
const VECTOR * mv, /* measured in half-pel! */ |
const VECTOR * mv, /* measured in half-pel! */ |
110 |
|
|
111 |
const uint32_t stride) |
const int32_t stride) |
112 |
{ |
{ |
113 |
|
|
114 |
switch ((((mv->x) & 1) << 1) + ((mv->y) & 1)) { |
switch ((((mv->x) & 1) << 1) + ((mv->y) & 1)) { |
140 |
const IMAGE * const f_refV, |
const IMAGE * const f_refV, |
141 |
const IMAGE * const f_refHV, |
const IMAGE * const f_refHV, |
142 |
// backward (future) reference |
// backward (future) reference |
143 |
const MACROBLOCK * const b_mbs, |
const FRAMEINFO * const b_reference, |
144 |
const IMAGE * const b_ref, |
const IMAGE * const b_ref, |
145 |
const IMAGE * const b_refH, |
const IMAGE * const b_refH, |
146 |
const IMAGE * const b_refV, |
const IMAGE * const b_refV, |
161 |
const IMAGE * const b_refhv, |
const IMAGE * const b_refhv, |
162 |
int16_t * dct_codes); |
int16_t * dct_codes); |
163 |
|
|
164 |
|
|
165 |
|
/* GMC stuff. Maybe better put it into a separate file */ |
166 |
|
|
167 |
|
void |
168 |
|
generate_GMCparameters( const int num_wp, // [input]: number of warppoints |
169 |
|
const int res, // [input]: resolution |
170 |
|
const WARPPOINTS *const warp, // [input]: warp points |
171 |
|
const int width, const int height, // [input]: without edges! |
172 |
|
GMC_DATA *const gmc); // [output] precalculated parameters |
173 |
|
|
174 |
|
void |
175 |
|
generate_GMCimage( const GMC_DATA *const gmc_data, // [input] precalculated data |
176 |
|
const IMAGE *const pRef, // [input] |
177 |
|
const int mb_width, |
178 |
|
const int mb_height, |
179 |
|
const int stride, |
180 |
|
const int stride2, |
181 |
|
const int fcode, // [input] some parameters... |
182 |
|
const int32_t quarterpel, // [input] for rounding avgMV |
183 |
|
const int reduced_resolution, // [input] ignored |
184 |
|
const int32_t rounding, // [input] for rounding image data |
185 |
|
MACROBLOCK *const pMBs, // [output] average motion vectors |
186 |
|
IMAGE *const pGMC); // [output] full warped image |
187 |
|
|
188 |
|
|
189 |
|
VECTOR generate_GMCimageMB( const GMC_DATA *const gmc_data, /* [input] all precalc data */ |
190 |
|
const IMAGE *const pRef, // [input] |
191 |
|
const int mi, const int mj, /* [input] MB position */ |
192 |
|
const int stride, /* [input] Lumi stride */ |
193 |
|
const int stride2, /* [input] chroma stride */ |
194 |
|
const int quarterpel, /* [input] for rounding of AvgMV */ |
195 |
|
const int rounding, |
196 |
|
IMAGE *const pGMC); /* [outut] generate image */ |
197 |
|
|
198 |
|
|
199 |
|
|
200 |
|
/* Hinted ME */ |
201 |
|
|
202 |
void |
void |
203 |
MotionEstimationHinted( MBParam * const pParam, |
MotionEstimationHinted( MBParam * const pParam, |
204 |
FRAMEINFO * const current, |
FRAMEINFO * const current, |
209 |
|
|
210 |
int |
int |
211 |
MEanalysis( const IMAGE * const pRef, |
MEanalysis( const IMAGE * const pRef, |
212 |
const IMAGE * const pCurrent, |
FRAMEINFO * const Current, |
213 |
MBParam * const pParam, |
MBParam * const pParam, |
214 |
MACROBLOCK * const pMBs, |
int maxIntra, |
215 |
const uint32_t iFcode); |
int intraCount, |
216 |
|
int bCount); |
217 |
|
|
218 |
int |
int |
219 |
FindFcode( const MBParam * const pParam, |
FindFcode( const MBParam * const pParam, |
220 |
const FRAMEINFO * const current); |
const FRAMEINFO * const current); |
221 |
|
|
|
/* used internally only */ |
|
222 |
|
|
223 |
static VECTOR |
int d_amv_penalty(int x, int y, const VECTOR pred, const uint32_t iFcode, const int quant); |
|
GlobalMotionEst(const MACROBLOCK * const pMBs, |
|
|
const MBParam * const pParam, const uint32_t iFcode); |
|
224 |
|
|
225 |
|
|
226 |
#endif /* _MOTION_H_ */ |
#endif /* _MOTION_H_ */ |