mv-search.c File Reference

Motion Vector Search, unified for B and P Pictures. More...

#include "contributors.h"
#include <math.h>
#include <limits.h>
#include <time.h>
#include <sys/timeb.h>
#include "global.h"
#include "image.h"
#include "mv-search.h"
#include "refbuf.h"
#include "memalloc.h"
#include "mb_access.h"
#include "macroblock.h"
#include "mc_prediction.h"
#include "conformance.h"
#include "me_distortion.h"
#include "me_epzs.h"
#include "me_fullfast.h"
#include "me_fullsearch.h"
#include "me_umhex.h"
#include "me_umhexsmp.h"
#include "rdoq.h"

Include dependency graph for mv-search.c:

Go to the source code of this file.

Functions

int BlockMotionSearch (Macroblock *currMB,short ref,int list,int mb_x,int mb_y,int blocktype,int search_range,int *lambda_factor)
int BiPredBlockMotionSearch (Macroblock *currMB,MotionVector *mv,MotionVector *pred_mv,short ref,int list,int mb_x,int mb_y,int blocktype,int search_range,int apply_bi_weights,int *lambda_factor)
int GetSkipCostMB (Macroblock *currMB)
void set_access_method (int *access_method, MotionVector *blk, int min_x, int min_y, int max_x, int max_y)
void init_ME_engine (int SearchMode)
void PrepareMEParams (int apply_weights, int ChromaMEEnable, int list, int ref)
void PrepareBiPredMEParams (int apply_weights, int ChromaMEEnable, int list, int list_offset, int ref)
void get_neighbors (Macroblock *currMB, PixelPos *block_a, PixelPos *block_b, PixelPos *block_c, PixelPos *block_d, int mb_x, int mb_y, int blockshape_x)
void GetMotionVectorPredictor (Macroblock *currMB, PixelPos *block_a, PixelPos *block_b, PixelPos *block_c, short pmv[2], char **refPic, short ***tmp_mv, short ref_frame, int mb_x, int mb_y, int blockshape_x, int blockshape_y)
void Init_Motion_Search_Module (void)
void Clear_Motion_Search_Module ()
static int mv_bits_cost (short ***all_mv, short ***p_mv, int by, int bx, int step_v0, int step_v, int step_h0, int step_h, int mvd_bits)
static int mv_bit_cost (Macroblock *currMB, short ***all_mv, int cur_list, int cur_ref, int by, int bx, int step_v0, int step_v, int step_h0, int step_h, int mvd_bits)
int BPredPartitionCost (Macroblock *currMB, int blocktype, int block8x8, short ref_l0, short ref_l1, int lambda_factor, int list)
int BIDPartitionCost (Macroblock *currMB, int blocktype, int block8x8, char cur_ref[2], int lambda_factor)
void FindSkipModeMotionVector (Macroblock *currMB)
int GetDirectCost8x8 (Macroblock *currMB, int block, int *cost8x8)
int GetDirectCostMB (Macroblock *currMB, int bslice)
void PartitionMotionSearch (Macroblock *currMB, int blocktype, int block8x8, int *lambda_factor)
void Get_Direct_Motion_Vectors (Macroblock *currMB)

Variables

int max_mvd
short * spiral_search_x
short * spiral_search_y
short * spiral_hpel_search_x
short * spiral_hpel_search_y
SearchWindow searchrange
int * mvbits
int * refbits
int * byte_abs
int **** motion_cost
int byte_abs_range
static int diff [16]
static int diff64 [64]
static imgpel orig_pic [768]
int(* IntPelME )(Macroblock *, imgpel *, short, int, char ***, short ****, int, int, int, MotionVector *, MotionVector *, int, int, int, int)
int(* BiPredME )(Macroblock *, imgpel *, short, int, char ***, short ****, int, int, int, MotionVector *, MotionVector *, MotionVector *, MotionVector *, int, int, int, int, int)
int(* SubPelBiPredME )(imgpel *orig_pic, short ref, int list, int pic_pix_x, int pic_pix_y, int blocktype, MotionVector *pred_mv1, MotionVector *pred_mv2, MotionVector *mv1, MotionVector *mv2, int search_pos2, int search_pos4, int min_mcost, int *lambda_factor, int apply_weights)
int(* SubPelME )(imgpel *orig_pic, short ref, int list, int list_offset, int pic_pix_x, int pic_pix_y, int blocktype, MotionVector *pred_mv, MotionVector *mv, int search_pos2, int search_pos4, int min_mcost, int *lambda_factor, int apply_weights)
ColocatedParams * Co_located
const short block_type_shift_factor [8]


Detailed Description

Motion Vector Search, unified for B and P Pictures.

Author:
Main contributors (see contributors.h for copyright, address and affiliation details)

Definition in file mv-search.c.


Function Documentation

int BIDPartitionCost ( Macroblock *  currMB,
int  blocktype,
int  block8x8,
char  cur_ref[2],
int  lambda_factor 
)

int BiPredBlockMotionSearch ( Macroblock *  currMB,
MotionVector *  mv,
MotionVector *  pred_mv,
short  ref,
int  list,
int  mb_x,
int  mb_y,
int  blocktype,
int  search_range,
int  apply_bi_weights,
int *  lambda_factor 
)

Bi-predictive motion search.

Parameters:
currMB  Current Macroblock
mv  current list motion vector
pred_mv  current list motion vector predictor
ref  reference idx
list  reference picture list
mb_x  x-coordinate inside macroblock
mb_y  y-coordinate inside macroblock
blocktype  block type (1-16x16 ... 7-4x4)
search_range  1-d search range for integer-position search
apply_bi_weights  apply bipred weights
lambda_factor  lagrangian parameter for determining motion cost

Definition at line 977 of file mv-search.c.

References bipred_flag, ImageParameters::bipred_mv, InputParameters::BiPredMERefinements, InputParameters::BiPredMESearchRange, InputParameters::BiPredMESubPel, InputParameters::blc_size, clip_mv_range(), InputParameters::DisableSubpelME, InputParameters::EPZSGrid, InputParameters::EPZSSubPelGrid, F_PEL, get_neighbors(), GetMotionVectorPredictor(), macroblock::list_offset, storable_picture::motion, pic_motion_params::mv, ImageParameters::opix_x, ImageParameters::opix_y, PrepareBiPredMEParams(), Q_PEL, pic_motion_params::ref_idx, InputParameters::SearchMode, and UMHEXSetMotionVectorPredictor().

Referenced by BlockMotionSearch().

Here is the call graph for this function:

int BlockMotionSearch ( Macroblock *  currMB,
short  ref,
int  list,
int  mb_x,
int  mb_y,
int  blocktype,
int  search_range,
int *  lambda_factor 
)

Block motion search.

< minimum motion cost after search

Parameters:
currMB  Current Macroblock
ref  reference idx
list  reference picture list
mb_x  x-coordinate inside macroblock
mb_y  y-coordinate inside macroblock
blocktype  block type (1-16x16 ... 7-4x4)
search_range  1-d search range for integer-position search
lambda_factor  lagrangian parameter for determining motion cost

Definition at line 772 of file mv-search.c.

References ImageParameters::all_mv, bipred_flag, BiPredBlockMotionSearch(), InputParameters::blc_size, InputParameters::ChromaMEEnable, clip_mv_range(), InputParameters::DisableSubpelME, EPZSDistortion, InputParameters::EPZSGrid, InputParameters::EPZSSubPelGrid, F_PEL, FindSkipModeMotionVector(), get_neighbors(), GetMotionVectorPredictor(), GetSkipCostMB(), is_bipred_enabled(), macroblock::list_offset, storable_picture::motion, pic_motion_params::mv, ImageParameters::opix_x, ImageParameters::opix_y, pCurImg, PrepareMEParams(), Q_PEL, InputParameters::rdopt, pic_motion_params::ref_idx, InputParameters::SearchMode, smpUMHEX_setup(), ImageParameters::structure, ImageParameters::type, UMHEX_blocktype, UMHEXSetMotionVectorPredictor(), and InputParameters::UseWeightedReferenceME.

Referenced by PartitionMotionSearch().

Here is the call graph for this function:

int BPredPartitionCost ( Macroblock *  currMB,
int  blocktype,
int  block8x8,
short  ref_l0,
short  ref_l1,
int  lambda_factor,
int  list 
)

void Clear_Motion_Search_Module ( void   ) 

Free memory used by motion search.

Definition at line 623 of file mv-search.c.

References ClearFastFullIntegerSearch(), free_mem4Dint(), InputParameters::IntraProfile, and InputParameters::SearchMode.

Referenced by free_encoder_memory().

Here is the call graph for this function:

void FindSkipModeMotionVector ( Macroblock *  currMB  ) 

void Get_Direct_Motion_Vectors ( Macroblock *  currMB  ) 

void get_neighbors ( Macroblock *  currMB,
PixelPos *  block_a,
PixelPos *  block_b,
PixelPos *  block_c,
PixelPos *  block_d,
int  mb_x,
int  mb_y,
int  blockshape_x 
)

int GetDirectCost8x8 ( Macroblock *  currMB,
int  block,
int *  cost8x8 
)

int GetDirectCostMB ( Macroblock *  currMB,
int  bslice 
)

Get cost for direct mode for an macroblock.

Definition at line 1396 of file mv-search.c.

References GetDirectCost8x8(), InputParameters::InterSearch, and InputParameters::Transform8x8Mode.

Referenced by encode_one_macroblock_low().

Here is the call graph for this function:

void GetMotionVectorPredictor ( Macroblock *  currMB,
PixelPos *  block_a,
PixelPos *  block_b,
PixelPos *  block_c,
short  pmv[2],
char **  refPic,
short ***  tmp_mv,
short  ref_frame,
int  mb_x,
int  mb_y,
int  blockshape_x,
int  blockshape_y 
)

int GetSkipCostMB ( Macroblock *  currMB  ) 

Get cost for skip mode for an macroblock.

Definition at line 1199 of file mv-search.c.

References distortion4x4(), distortion8x8(), LumaPrediction(), ImageParameters::mb_pred, ImageParameters::opix_x, ImageParameters::opix_y, pCurImg, InputParameters::rdopt, and InputParameters::Transform8x8Mode.

Referenced by BlockMotionSearch().

Here is the call graph for this function:

void init_ME_engine ( int  SearchMode  ) 

void Init_Motion_Search_Module ( void   ) 

void PartitionMotionSearch ( Macroblock *  currMB,
int  blocktype,
int  block8x8,
int *  lambda_factor 
)

void PrepareBiPredMEParams ( int  apply_weights,
int  ChromaMEEnable,
int  list,
int  list_offset,
int  ref 
)

Prepare Motion Estimation parameters for bipred list ME.

Definition at line 185 of file mv-search.c.

Referenced by BiPredBlockMotionSearch().

void PrepareMEParams ( int  apply_weights,
int  ChromaMEEnable,
int  list,
int  ref 
)

Prepare Motion Estimation parameters for single list ME.

Definition at line 162 of file mv-search.c.

Referenced by BlockMotionSearch().

void set_access_method ( int *  access_method,
MotionVector *  blk,
int  min_x,
int  min_y,
int  max_x,
int  max_y 
)

Set ME access method.

Definition at line 100 of file mv-search.c.

References FAST_ACCESS, and UMV_ACCESS.


Documentation generated with DoxyGen