26 |
* along with this program; if not, write to the Free Software |
* along with this program; if not, write to the Free Software |
27 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
28 |
* |
* |
29 |
* $Id: motion_est.h,v 1.1.2.10 2002-12-11 10:32:29 syskin Exp $ |
* $Id: motion_est.h,v 1.1.2.11 2002-12-13 11:56:31 syskin Exp $ |
30 |
* |
* |
31 |
***************************************************************************/ |
***************************************************************************/ |
32 |
|
|
165 |
int32_t * const max_dy, |
int32_t * const max_dy, |
166 |
const uint32_t x, |
const uint32_t x, |
167 |
const uint32_t y, |
const uint32_t y, |
168 |
const uint32_t block_sz, /* block dimension, 8 or 16 */ |
uint32_t block_sz, /* block dimension, 8 or 16 */ |
169 |
const uint32_t width, |
const uint32_t width, |
170 |
const uint32_t height, |
const uint32_t height, |
171 |
const uint32_t fcode) |
const uint32_t fcode, |
172 |
|
const int qpel, |
173 |
|
const int rrv) |
174 |
{ |
{ |
175 |
int k; |
int k, m = 2; |
176 |
const int search_range = 32 << (fcode - 1); |
const int search_range = 32 << (fcode - 1); |
177 |
const int high = search_range - 1; |
int high = search_range - 1; |
178 |
const int low = -search_range; |
int low = -search_range; |
179 |
|
|
180 |
k = 2 * (int)(width - x*block_sz); |
if (qpel) m = 4; |
181 |
*max_dx = MIN(high, k); |
else if (rrv) { |
182 |
k = 2 * (int)(height - y*block_sz); |
high = RRV_MV_SCALEUP(high); |
183 |
*max_dy = MIN(high, k); |
low = RRV_MV_SCALEUP(low); |
184 |
|
block_sz *= 2; |
|
k = -2 * (int)((x+1) * block_sz); |
|
|
*min_dx = MAX(low, k); |
|
|
k = -2 * (int)((y+1) * block_sz); |
|
|
*min_dy = MAX(low, k); |
|
185 |
} |
} |
186 |
|
|
187 |
static void __inline |
k = m * (int)(width - x*block_sz); |
|
get_range_rrv(int32_t * const min_dx, |
|
|
int32_t * const max_dx, |
|
|
int32_t * const min_dy, |
|
|
int32_t * const max_dy, |
|
|
const uint32_t x, |
|
|
const uint32_t y, |
|
|
const uint32_t block_sz, /* block dimension, 8 or 16 */ |
|
|
const uint32_t width, |
|
|
const uint32_t height, |
|
|
const uint32_t fcode) |
|
|
{ |
|
|
int k; |
|
|
const int search_range = 32 << (fcode - 1); |
|
|
const int high = RRV_MV_SCALEUP(search_range - 1); //halfzero -> halfpel, because we do our search in halfpel |
|
|
const int low = RRV_MV_SCALEUP(-search_range); |
|
|
|
|
|
k = 2 * (int)(width - x*block_sz); |
|
188 |
*max_dx = MIN(high, k); |
*max_dx = MIN(high, k); |
189 |
k = 2 * (int)(height - y*block_sz); |
k = m * (int)(height - y*block_sz); |
190 |
*max_dy = MIN(high, k); |
*max_dy = MIN(high, k); |
191 |
|
|
192 |
k = -2 * (int)((x+1) * block_sz); |
k = -m * (int)((x+1) * block_sz); |
193 |
*min_dx = MAX(low, k); |
*min_dx = MAX(low, k); |
194 |
k = -2 * (int)((y+1) * block_sz); |
k = -m * (int)((y+1) * block_sz); |
195 |
*min_dy = MAX(low, k); |
*min_dy = MAX(low, k); |
196 |
} |
} |
197 |
|
|
|
static void __inline |
|
|
get_range_qpel(int32_t * const min_dx, |
|
|
int32_t * const max_dx, |
|
|
int32_t * const min_dy, |
|
|
int32_t * const max_dy, |
|
|
const uint32_t x, |
|
|
const uint32_t y, |
|
|
const uint32_t block_sz, /* block dimension, 8 or 16 */ |
|
|
const uint32_t width, |
|
|
const uint32_t height, |
|
|
const uint32_t fcode) |
|
|
{ |
|
|
int k; |
|
|
const int search_range = 32 << (fcode - 1); |
|
|
const int high = search_range - 1; |
|
|
const int low = -search_range; |
|
|
|
|
|
k = 4 * (int)(width - x*block_sz); |
|
|
*max_dx = MIN(high, k); |
|
|
k = 4 * (int)(height - y*block_sz); |
|
|
*max_dy = MIN(high, k); |
|
|
|
|
|
k = -4 * (int)((x+1) * block_sz); |
|
|
*min_dx = MAX(low, k); |
|
|
k = -4 * (int)((y+1) * block_sz); |
|
|
*min_dy = MAX(low, k); |
|
|
} |
|
|
|
|
|
|
|
198 |
typedef void MainSearchFunc(int x, int y, const SearchData * const Data, int bDirection); |
typedef void MainSearchFunc(int x, int y, const SearchData * const Data, int bDirection); |
199 |
|
|
200 |
static MainSearchFunc DiamondSearch, AdvDiamondSearch, SquareSearch; |
static MainSearchFunc DiamondSearch, AdvDiamondSearch, SquareSearch; |
234 |
int inter4v, |
int inter4v, |
235 |
MACROBLOCK * const pMB); |
MACROBLOCK * const pMB); |
236 |
|
|
237 |
|
static VECTOR |
238 |
|
GlobalMotionEst(const MACROBLOCK * const pMBs, |
239 |
|
const MBParam * const pParam, const uint32_t iFcode); |
240 |
|
|
241 |
|
#define iDiamondSize 2 |
242 |
|
|
243 |
#endif /* _MOTION_EST_H_ */ |
#endif /* _MOTION_EST_H_ */ |