www.pudn.com > wm2.5.zip > motion_esti.h


 
/* 
*********************************************************************** 
* COPYRIGHT AND WARRANTY INFORMATION 
* 
* Copyright 2004, Advanced Audio Video Coding Standard, Part II 
* 
* DISCLAIMER OF WARRANTY 
* 
* These software programs are available to the users without any 
* license fee or royalty on an "as is" basis. The AVS disclaims 
* any and all warranties, whether express, implied, or statutory, 
* including any implied warranties of merchantability or of fitness 
* for a particular purpose. In no event shall the contributors or  
* the AVS be liable for any incidental, punitive, or consequential 
* damages of any kind whatsoever arising from the use of this program. 
* 
* This disclaimer of warranty extends to the user of this program 
* and user's customers, employees, agents, transferees, successors, 
* and assigns. 
* 
* The AVS does not represent or warrant that the program furnished 
* hereunder are free of infringement of any third-party patents. 
* Commercial implementations of AVS, including shareware, may be 
* subject to royalty fees to patent holders. Information regarding 
* the AVS patent policy is available from the AVS Web site at 
* http://www.avs.org.cn 
* 
* THIS IS NOT A GRANT OF PATENT RIGHTS - SEE THE AVS PATENT POLICY. 
************************************************************************ 
*/ 
 
#ifndef _MOTION_ESTI_H_ 
#define _MOTION_ESTI_H_ 
 
#define SEARCH_ONE_PIXEL  if(absm(cand_x) <= SEARCHRANGE && absm(cand_y)<= SEARCHRANGE) \ 
	{ \ 
		if(!pgMbData->Diamond_status[cand_y+SEARCHRANGE][cand_x+SEARCHRANGE])	\ 
		{ \ 
			mcost = MV_COST (lambda_factor,										\ 
								((cand_x << 2) - sResidual_MV[0]),	\ 
								((cand_y << 2) - sResidual_MV[1])); \ 
			mcost = CalIntegerPixSAD(ref,blkindex,subblkindex,blksize_x,blksize_y,cand_x,cand_y,mcost,min_mcost, ypos, xpos); \ 
			pgMbData->Diamond_status[cand_y+SEARCHRANGE][cand_x+SEARCHRANGE] = 1; \ 
			if (mcost < min_mcost) \ 
			{ \ 
				best_x = cand_x; \ 
				best_y = cand_y; \ 
				min_mcost = mcost; \ 
			} \ 
		} \ 
	} 
 
#define SEARCH_ONE_PIXEL1(value_iAbort)	if(absm(cand_x) <= SEARCHRANGE && absm(cand_y)<= SEARCHRANGE) \ 
	{ \ 
		if(!pgMbData->Diamond_status[cand_y+SEARCHRANGE][cand_x+SEARCHRANGE])	\ 
		{ \ 
			mcost = MV_COST (lambda_factor,										\ 
								((cand_x << 2) - sResidual_MV[0]),	\ 
								((cand_y << 2) - sResidual_MV[1])); \ 
			mcost = CalIntegerPixSAD(ref,blkindex,subblkindex,blksize_x,blksize_y,cand_x,cand_y,mcost,min_mcost, ypos, xpos); \ 
			pgMbData->Diamond_status[cand_y+SEARCHRANGE][cand_x+SEARCHRANGE] = 1; \ 
			if (mcost < min_mcost) \ 
			{ \ 
				best_x = cand_x; \ 
				best_y = cand_y; \ 
				min_mcost = mcost; \ 
				iAbort = value_iAbort; \ 
			} \ 
		} \ 
	} 
 
int														//  ==> minimum motion cost after search 
FME_Integer_Pel_Block_Motion_Search( 
									int ref, 
									int offx, 
									int off_y, 
									int blkindex,		// <--  block index(0~3)       
									int blktype,		// <--  block type (1-16x16 ... 4-8x8) 
									int subblkindex, 
									int subblktype, 
									int min_mcost,		// <--  minimum motion cost (cost for center or huge value) 
									int lambda_factor,   // <--  factor for determining lagragian motion cost 
									int ypos, 
									int xpos 
									); 
 
int												    //  ==> minimum motion cost after search 
FME_Sub_Pel_Block_Motion_Search(  
								int ref, 
								int xoff, 
								int yoff,								 
								int blkindex,		// <--  block index(0~3)       
								int subblkindex, 
								int subblktype,		// <--  block type (1-16x16 ... 4-8x8) 
								int min_mcost,		// <--  minimum motion cost (cost for center or huge value) 
								int lambda_factor,   // <--  factor for determining lagragian motion cost 
								int ypos, 
							    int xpos 
							   ); 
 
int											   //  ==> minimum motion cost after search 
Sub_Pel_Block_Motion_Search ( 
                             int ref,            //zhangnan 
							 int offx, 
							 int off_y, 
							 int blkindex,    
							 int blktype,      // <--  block type (1-16x16 ... 4-8x8) 
               int subblkindex,   
               int subblktype,  
							 int min_mcost,    // <--  minimum motion cost (cost for center or huge value) 
							 int lambda_factor, // <--  factor for determining lagragian motion cost 
               int ypos, 
               int xpos 
							); 
 
int											   //  ==> minimum motion cost after search 
Full_Integer_Pel_Block_Motion_Search ( 
                                     int ref,            //zhangnan 
									 int offx, 
									 int off_y, 
									 int blkindex,    
									 int blktype,      // <--  block type (1-16x16 ... 4-8x8) 
                   int subblkindex,  //qwang 2004-3-22 
                   int subblktype,   //qwang 2004-3-22 
									 int min_mcost,    // <--  minimum motion cost (cost for center or huge value) 
									 int lambda_factor, // <--  factor for determining lagragian motion cost 
                   int ypos, 
                   int xpos 
									); 
 
#endif //_MOTION_ESTI_H_