--- branches/dev-api-3/xvidcore/src/motion/motion_est.h 2002/12/13 11:54:17 711 +++ branches/dev-api-3/xvidcore/src/motion/motion_est.h 2002/12/13 11:56:31 712 @@ -26,7 +26,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $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 $ * ***************************************************************************/ @@ -165,84 +165,36 @@ int32_t * const max_dy, const uint32_t x, const uint32_t y, - const uint32_t block_sz, /* block dimension, 8 or 16 */ + uint32_t block_sz, /* block dimension, 8 or 16 */ const uint32_t width, const uint32_t height, - const uint32_t fcode) + const uint32_t fcode, + const int qpel, + const int rrv) { - int k; + int k, m = 2; const int search_range = 32 << (fcode - 1); - const int high = search_range - 1; - const int low = -search_range; - - k = 2 * (int)(width - x*block_sz); - *max_dx = MIN(high, k); - k = 2 * (int)(height - y*block_sz); - *max_dy = MIN(high, k); - - k = -2 * (int)((x+1) * block_sz); - *min_dx = MAX(low, k); - k = -2 * (int)((y+1) * block_sz); - *min_dy = MAX(low, k); -} - -static void __inline -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); - *max_dx = MIN(high, k); - k = 2 * (int)(height - y*block_sz); - *max_dy = MIN(high, k); + int high = search_range - 1; + int low = -search_range; - k = -2 * (int)((x+1) * block_sz); - *min_dx = MAX(low, k); - k = -2 * (int)((y+1) * block_sz); - *min_dy = MAX(low, k); -} + if (qpel) m = 4; + else if (rrv) { + high = RRV_MV_SCALEUP(high); + low = RRV_MV_SCALEUP(low); + block_sz *= 2; + } -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); + k = m * (int)(width - x*block_sz); *max_dx = MIN(high, k); - k = 4 * (int)(height - y*block_sz); + k = m * (int)(height - y*block_sz); *max_dy = MIN(high, k); - k = -4 * (int)((x+1) * block_sz); + k = -m * (int)((x+1) * block_sz); *min_dx = MAX(low, k); - k = -4 * (int)((y+1) * block_sz); + k = -m * (int)((y+1) * block_sz); *min_dy = MAX(low, k); } - typedef void MainSearchFunc(int x, int y, const SearchData * const Data, int bDirection); static MainSearchFunc DiamondSearch, AdvDiamondSearch, SquareSearch; @@ -282,4 +234,10 @@ int inter4v, MACROBLOCK * const pMB); +static VECTOR +GlobalMotionEst(const MACROBLOCK * const pMBs, + const MBParam * const pParam, const uint32_t iFcode); + +#define iDiamondSize 2 + #endif /* _MOTION_EST_H_ */