📄 motion.h
字号:
#ifndef _MOTION_H_
#define _MOTION_H_
#include "portab.h"
#include "ftmcp100.h"
#include "global.h"
/* hard coded motion search parameters for motion_est */
// very large value
#define MV_MAX_ERROR (4096 * 256)
// stop search if sdelta < THRESHOLD
#define MV16_THRESHOLD 192
#define MV8_THRESHOLD 56
#define NEIGH_MOVE_THRESH 0
// how much a block's MV must differ from his neighbour
// to be search for INTER4V. The more, the faster...
/* sad16(0,0) bias; mpeg4 spec suggests nb/2+1 */
/* nb = vop pixels * 2^(bpp-8) */
#define MV16_00_BIAS (128+1)
#define MV8_00_BIAS (0)
/* INTER bias for INTER/INTRA decision; mpeg4 spec suggests 2*nb */
#define MV16_INTER_BIAS 512
/* Parameters which control inter/inter4v decision */
#define IMV16X16 5
/* vector map (vlc delta size) smoother parameters */
#define NEIGH_TEND_16X16 2
#define NEIGH_TEND_8X8 2
// fast ((A)/2)*2
//#define EVEN(A) (((A)<0?(A)+1:(A)) & ~1)
//#define EVEN(A) ((A>>1) << 1)
#define EVEN(A) (A & 0xfffffffe)
#define MVzero(A) ( ((A).x)==(0) && ((A).y)==(0) )
#define MVequal(A,B) ( ((A).x)==((B).x) && ((A).y)==((B).y) )
#define Diamond_search_limit 10
#define L1 2 // Motion activity threshold
#define MAX3(x,y,z) MAX(MAX(x,y),z)
#define ThEES 512
#define ThEES_4 512/4
#define ThEES1 0
#ifdef DUMP_PMV_RESULT
extern FILE *pmv_result_file;
#endif
/* default methods of Search, will be changed to function variable */
/*
* Calculate the min/max range (in halfpixels)
* relative to the _MACROBLOCK_ position
*/
/*
* getref: calculate reference image pointer
* the decision to use interpolation h/v/hv or the normal image is
* based on dx & dy.
*/
/* This is somehow a copy of get_ref, but with MV instead of X,Y */
/* prototypes for MainSearch functions, i.e. Diamondsearch, FullSearch or whatever */
extern int32_t (*MotionEstimation)(MACROBLOCK *const pMB,
MACROBLOCK *const pMB_mc,
uint32_t x, uint32_t y,
MBParam * const pParam,
Encoder *pEnc,
int32_t counter);
extern int32_t (*MotionEstimation_blocklast)(MACROBLOCK *const pMB_mc,
MBParam * const pParam,
Encoder *pEnc);
extern int32_t (*MotionEstimation_block0)(MACROBLOCK *const pMB,
Encoder *pEnc);
int32_t MotionEstimation_4MV(MACROBLOCK *const pMB,
MACROBLOCK *const pMB_mc,
uint32_t x, uint32_t y,
MBParam * const pParam,
Encoder *pEnc,
int32_t counter);
int32_t MotionEstimation_blocklast_4MV(MACROBLOCK *const pMB_mc,
MBParam * const pParam,
Encoder *pEnc);
int32_t MotionEstimation_block0_4MV(MACROBLOCK *const pMB,
Encoder *pEnc);
int32_t MotionEstimation_1MV(MACROBLOCK *const pMB,
MACROBLOCK *const pMB_mc,
uint32_t x, uint32_t y,
MBParam * const pParam,
Encoder *pEnc,
int32_t counter);
int32_t MotionEstimation_blocklast_1MV(MACROBLOCK *const pMB_mc,
MBParam * const pParam,
Encoder *pEnc);
int32_t MotionEstimation_block0_1MV(MACROBLOCK *const pMB,
Encoder *pEnc);
#if defined(CORE_VERSION_1)
extern __inline void
get_pmvdata0_4MV(const MACROBLOCK * const mbs,
const int mb_width,
const int x,
const int counter,
VECTOR * const pmv,
MBParam * const pParam,FTMCP100_CODEC *pCodec);
#elif defined(CORE_VERSION_2)
extern __inline void
get_pmvdata0_4MV(const MACROBLOCK * const mbs,
const int mb_width,
const int x,
const int counter,
VECTOR * const pmv,
MBParam * const pParam);
#else
#error "please define the version of core"
#endif
extern __inline void
get_pmvdata1_4MV(const int x, int iWcount, int *a, int *b, int *c, int *d, MBParam * const pParam,FTMCP100_CODEC *pCodec);
#if defined(CORE_VERSION_1)
extern __inline void
get_pmvdata0_1MV(const MACROBLOCK * const mbs,
const int mb_width,
const int x,
const int counter,
VECTOR * const pmv,
MBParam * const pParam,FTMCP100_CODEC *pCodec);
#elif defined(CORE_VERSION_2)
extern __inline void
get_pmvdata0_1MV(const MACROBLOCK * const mbs,
const int mb_width,
const int x,
const int counter,
VECTOR * const pmv,
MBParam * const pParam);
#endif
extern __inline void
get_pmvdata1_1MV(const int x, int iWcount, int *a, int *b, int *Z,FTMCP100_CODEC *pCodec);
#endif /* _MOTION_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -