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 }; |
47 |
|
|
48 |
|
/* |
49 |
|
* modified rounding tables |
50 |
|
* original tables see ISO spec tables 7-6 -> 7-9 |
51 |
|
*/ |
52 |
|
|
53 |
|
/* K = 4 */ |
54 |
|
static const uint32_t roundtab_76[16] = { 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1 }; |
55 |
|
/* K = 2 */ |
56 |
|
static const uint32_t roundtab_78[8] = { 0, 0, 1, 1, 0, 0, 0, 1 }; |
57 |
|
/* K = 1 */ |
58 |
|
static const uint32_t roundtab_79[4] = { 0, 1, 0, 0 }; |
59 |
|
|
60 |
|
|
61 |
/* |
/* |
62 |
* getref: calculate reference image pointer |
* getref: calculate reference image pointer |
63 |
* the decision to use interpolation h/v/hv or the normal image is |
* the decision to use interpolation h/v/hv or the normal image is |
64 |
* based on dx & dy. |
* based on dx & dy. |
65 |
*/ |
*/ |
66 |
|
|
|
static const uint32_t roundtab[16] = |
|
|
{ 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2 }; |
|
|
|
|
|
|
|
67 |
static __inline const uint8_t * |
static __inline const uint8_t * |
68 |
get_ref(const uint8_t * const refn, |
get_ref(const uint8_t * const refn, |
69 |
const uint8_t * const refh, |
const uint8_t * const refh, |
75 |
|
|
76 |
const int32_t dx, |
const int32_t dx, |
77 |
const int32_t dy, |
const int32_t dy, |
78 |
const uint32_t stride) |
const int32_t stride) |
79 |
{ |
{ |
80 |
|
|
81 |
|
|
109 |
|
|
110 |
const VECTOR * mv, /* measured in half-pel! */ |
const VECTOR * mv, /* measured in half-pel! */ |
111 |
|
|
112 |
const uint32_t stride) |
const int32_t stride) |
113 |
{ |
{ |
114 |
|
|
115 |
switch ((((mv->x) & 1) << 1) + ((mv->y) & 1)) { |
switch ((((mv->x) & 1) << 1) + ((mv->y) & 1)) { |
141 |
const IMAGE * const f_refV, |
const IMAGE * const f_refV, |
142 |
const IMAGE * const f_refHV, |
const IMAGE * const f_refHV, |
143 |
// backward (future) reference |
// backward (future) reference |
144 |
const MACROBLOCK * const b_mbs, |
const FRAMEINFO * const b_reference, |
145 |
const IMAGE * const b_ref, |
const IMAGE * const b_ref, |
146 |
const IMAGE * const b_refH, |
const IMAGE * const b_refH, |
147 |
const IMAGE * const b_refV, |
const IMAGE * const b_refV, |
162 |
const IMAGE * const b_refhv, |
const IMAGE * const b_refhv, |
163 |
int16_t * dct_codes); |
int16_t * dct_codes); |
164 |
|
|
165 |
|
|
166 |
|
/* GMC stuff. Maybe better put it into a separate file */ |
167 |
|
|
168 |
|
void |
169 |
|
generate_GMCparameters( const int num_wp, // [input]: number of warppoints |
170 |
|
const int res, // [input]: resolution |
171 |
|
const WARPPOINTS *const warp, // [input]: warp points |
172 |
|
const int width, const int height, // [input]: without edges! |
173 |
|
GMC_DATA *const gmc); // [output] precalculated parameters |
174 |
|
|
175 |
|
void |
176 |
|
generate_GMCimage( const GMC_DATA *const gmc_data, // [input] precalculated data |
177 |
|
const IMAGE *const pRef, // [input] |
178 |
|
const int mb_width, |
179 |
|
const int mb_height, |
180 |
|
const int stride, |
181 |
|
const int stride2, |
182 |
|
const int fcode, // [input] some parameters... |
183 |
|
const int32_t quarterpel, // [input] for rounding avgMV |
184 |
|
const int reduced_resolution, // [input] ignored |
185 |
|
const int32_t rounding, // [input] for rounding image data |
186 |
|
MACROBLOCK *const pMBs, // [output] average motion vectors |
187 |
|
IMAGE *const pGMC); // [output] full warped image |
188 |
|
|
189 |
|
|
190 |
|
VECTOR generate_GMCimageMB( const GMC_DATA *const gmc_data, /* [input] all precalc data */ |
191 |
|
const IMAGE *const pRef, // [input] |
192 |
|
const int mi, const int mj, /* [input] MB position */ |
193 |
|
const int stride, /* [input] Lumi stride */ |
194 |
|
const int stride2, /* [input] chroma stride */ |
195 |
|
const int quarterpel, /* [input] for rounding of AvgMV */ |
196 |
|
const int rounding, |
197 |
|
IMAGE *const pGMC); /* [outut] generate image */ |
198 |
|
|
199 |
|
|
200 |
|
|
201 |
|
/* Hinted ME */ |
202 |
|
|
203 |
void |
void |
204 |
MotionEstimationHinted( MBParam * const pParam, |
MotionEstimationHinted( MBParam * const pParam, |
205 |
FRAMEINFO * const current, |
FRAMEINFO * const current, |
210 |
|
|
211 |
int |
int |
212 |
MEanalysis( const IMAGE * const pRef, |
MEanalysis( const IMAGE * const pRef, |
213 |
const IMAGE * const pCurrent, |
FRAMEINFO * const Current, |
214 |
MBParam * const pParam, |
MBParam * const pParam, |
215 |
MACROBLOCK * const pMBs, |
int maxIntra, |
216 |
const uint32_t iFcode); |
int intraCount, |
217 |
|
int bCount); |
218 |
|
|
219 |
int |
int |
220 |
FindFcode( const MBParam * const pParam, |
FindFcode( const MBParam * const pParam, |
221 |
const FRAMEINFO * const current); |
const FRAMEINFO * const current); |
222 |
|
|
223 |
|
|
224 |
|
int d_amv_penalty(int x, int y, const VECTOR pred, const uint32_t iFcode, const int quant); |
225 |
|
|
226 |
|
|
227 |
#endif /* _MOTION_H_ */ |
#endif /* _MOTION_H_ */ |