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 "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_epzs_int.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

static int GetSkipCostMB (Macroblock *currMB)
static int BiPredBlockMotionSearch (Macroblock *currMB,MEBlock *mv_block,MotionVector *pred_mv,int mb_x,int mb_y,int *lambda_factor)
void get_search_range (MEBlock *mv_block, InputParameters *p_Inp, short ref, int blocktype)
static void set_me_parameters (char **ref_array, short ***mv_array, short *all_mv, short ref, int step_h, int step_v, int pic_block_x)
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 (Macroblock *currMB)
void PrepareMEParams (Slice *currSlice, MEBlock *mv_block, int ChromaMEEnable, int list, int ref)
void PrepareBiPredMEParams (Slice *currSlice, MEBlock *mv_block, int ChromaMEEnable, int list, int list_offset, int ref)
void get_neighbors (Macroblock *currMB, PixelPos *block, int mb_x, int mb_y, int blockshape_x)
void Init_Motion_Search_Module (ImageParameters *p_Img, InputParameters *p_Inp)
void Clear_Motion_Search_Module (ImageParameters *p_Img, InputParameters *p_Inp)
static int mv_bits_cost (ImageParameters *p_Img, 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, short 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)
void update_mv_block (Macroblock *currMB, MEBlock *mv_block, int h, int v)
void init_mv_block (Macroblock *currMB, MEBlock *mv_block, short blocktype, int list, char ref_idx, short mb_x, short mb_y)
void free_mv_block (InputParameters *p_Inp, MEBlock *mv_block)
void get_original_block (ImageParameters *p_Img, InputParameters *p_Inp, MEBlock *mv_block)
int BlockMotionSearch (Macroblock *currMB, MEBlock *mv_block, int mb_x, int mb_y, int *lambda_factor)
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)
void PartitionMotionSearch (Macroblock *currMB, int blocktype, int block8x8, int *lambda_factor)
void SubPartitionMotionSearch (Macroblock *currMB, int blocktype, int block8x8, int *lambda_factor)
void Get_Direct_MV_Temporal (Macroblock *currMB)
void Get_Direct_MV_Spatial_Normal (Macroblock *currMB)
void Get_Direct_MV_Spatial_MBAFF (Macroblock *currMB)

Variables

static const short bx0 [5][4] = {{0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,2,0,0}, {0,2,0,2}}
static const short by0 [5][4] = {{0,0,0,0}, {0,0,0,0}, {0,2,0,0}, {0,0,0,0}, {0,0,2,2}}


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 
)

Motion Cost for Bidirectional modes.

Definition at line 1138 of file mv_search.c.

References slice::all_mv, luma_prediction(), slice::mb_pred, macroblock::opix_y, macroblock::p_Img, macroblock::p_slice, img_par::pCurImg, and macroblock::pix_x.

Referenced by list_prediction_cost().

Here is the call graph for this function:

static int BiPredBlockMotionSearch ( Macroblock currMB,
MEBlock *  mv_block,
MotionVector pred_mv,
int  mb_x,
int  mb_y,
int *  lambda_factor 
) [static]

Bi-predictive motion search.

Parameters:
currMB Current Macroblock
mv_block motion vector information
pred_mv current list motion vector predictor
mb_x x-coordinate inside macroblock
mb_y y-coordinate inside macroblock
lambda_factor lagrangian parameter for determining motion cost

Definition at line 1009 of file mv_search.c.

References slice::bipred_mv, inp_par_enc::BiPredMERefinements, inp_par_enc::BiPredMESearchRange, inp_par_enc::BiPredMESubPel, clip_mv_range(), inp_par_enc::DisableSubpelME, F_PEL, storable_picture::motion, pic_motion_params::mv, macroblock::p_Img, macroblock::p_slice, PrepareBiPredMEParams(), Q_PEL, pic_motion_params::ref_idx, and UMHEXSetMotionVectorPredictor().

Referenced by BlockMotionSearch().

Here is the call graph for this function:

int BlockMotionSearch ( Macroblock currMB,
MEBlock *  mv_block,
int  mb_x,
int  mb_y,
int *  lambda_factor 
)

Block motion search.

< minimum motion cost after search

Parameters:
currMB Current Macroblock
mv_block Motion estimation information block
mb_x x-coordinate inside macroblock
mb_y y-coordinate inside macroblock
lambda_factor lagrangian parameter for determining motion cost

Definition at line 835 of file mv_search.c.

References slice::all_mv, BiPredBlockMotionSearch(), clip_mv_range(), inp_par_enc::DisableSubpelME, F_PEL, FindSkipModeMotionVector(), get_neighbors(), GetSkipCostMB(), is_bipred_enabled(), storable_picture::motion, pic_motion_params::mv, macroblock::p_Img, macroblock::p_slice, macroblock::pix_x, PrepareMEParams(), Q_PEL, pic_motion_params::ref_idx, slice::slice_type, smpUMHEX_setup(), img_par::start_me_refinement_hp, and UMHEXSetMotionVectorPredictor().

Referenced by PartitionMotionSearch(), and SubPartitionMotionSearch().

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 
)

Motion Cost for Bidirectional modes.

Definition at line 581 of file mv_search.c.

References slice::bipred_mv, luma_prediction_bi(), slice::mb_pred, macroblock::opix_y, macroblock::p_Img, macroblock::p_slice, img_par::pCurImg, and macroblock::pix_x.

Referenced by list_prediction_cost().

Here is the call graph for this function:

void Clear_Motion_Search_Module ( ImageParameters p_Img,
InputParameters p_Inp 
)

Free memory used by motion search.

Definition at line 503 of file mv_search.c.

References ClearFastFullIntegerSearch(), free_mem4Dint(), inp_par_enc::IntraProfile, and inp_par_enc::search_range.

Referenced by free_encoder_memory().

Here is the call graph for this function:

void FindSkipModeMotionVector ( Macroblock currMB  ) 

void free_mv_block ( InputParameters p_Inp,
MEBlock *  mv_block 
)

free motion vector block

Definition at line 777 of file mv_search.c.

References free_mem1Dpel().

Referenced by PartitionMotionSearch(), and SubPartitionMotionSearch().

Here is the call graph for this function:

void Get_Direct_MV_Spatial_MBAFF ( Macroblock currMB  ) 

void Get_Direct_MV_Spatial_Normal ( Macroblock currMB  ) 

void Get_Direct_MV_Temporal ( Macroblock currMB  ) 

Calculate Temporal Direct Mode Motion Vectors.

invalid index. Default to zero even though this case should not happen

Definition at line 1775 of file mv_search.c.

References slice::all_mv, macroblock::block_x, macroblock::block_y, slice::direct_pdir, slice::direct_ref_idx, macroblock::mbAddrX, motion_params::mv, macroblock::opix_y, out_of_bounds_mvs(), macroblock::p_Img, macroblock::p_slice, macroblock::pix_x, motion_params::ref_idx, motion_params::ref_pic_id, slice::wbp_weight, and YUV400.

Referenced by init_slice().

Here is the call graph for this function:

void get_neighbors ( Macroblock currMB,
PixelPos block,
int  mb_x,
int  mb_y,
int  blockshape_x 
)

Get current block spatial neighbors.

Definition at line 280 of file mv_search.c.

References get4x4Neighbour(), and macroblock::p_Img.

Referenced by BlockMotionSearch(), FindSkipModeMotionVector(), Get_Direct_MV_Spatial_MBAFF(), Get_Direct_MV_Spatial_Normal(), SetupFastFullPelSearch(), and writeMotionVector8x8().

Here is the call graph for this function:

void get_search_range ( MEBlock *  mv_block,
InputParameters p_Inp,
short  ref,
int  blocktype 
)

Set search range. This needs to be changed to provide 2D support.

Definition at line 68 of file mv_search.c.

Referenced by PartitionMotionSearch(), and SubPartitionMotionSearch().

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

Get cost for direct mode for an 8x8 block.

Definition at line 1389 of file mv_search.c.

References slice::direct_pdir, slice::direct_ref_idx, luma_prediction(), slice::mb_pred, macroblock::opix_y, macroblock::p_Img, macroblock::p_slice, img_par::pCurImg, and macroblock::pix_x.

Referenced by GetDirectCostMB(), and submacroblock_mode_decision_low().

Here is the call graph for this function:

int GetDirectCostMB ( Macroblock currMB  ) 

Get cost for direct mode for an macroblock.

Definition at line 1458 of file mv_search.c.

References GetDirectCost8x8(), macroblock::p_slice, and slice::slice_type.

Referenced by encode_one_macroblock_low().

Here is the call graph for this function:

static int GetSkipCostMB ( Macroblock currMB  )  [static]

Get cost for skip mode for an macroblock.

Definition at line 1245 of file mv_search.c.

References luma_prediction(), slice::mb_pred, macroblock::opix_y, macroblock::p_Img, macroblock::p_slice, img_par::pCurImg, and macroblock::pix_x.

Referenced by BlockMotionSearch().

Here is the call graph for this function:

void init_ME_engine ( Macroblock currMB  ) 

void Init_Motion_Search_Module ( ImageParameters p_Img,
InputParameters p_Inp 
)

void init_mv_block ( Macroblock currMB,
MEBlock *  mv_block,
short  blocktype,
int  list,
char  ref_idx,
short  mb_x,
short  mb_y 
)

Init motion vector block.

Definition at line 706 of file mv_search.c.

References F_PEL, get_mem1Dpel(), H_PEL, no_mem_exit(), macroblock::p_Img, macroblock::p_slice, Q_PEL, slice::slice_type, inp_par_enc::UseWeightedReferenceME, and slice::weighted_prediction.

Referenced by PartitionMotionSearch(), and SubPartitionMotionSearch().

Here is the call graph for this function:

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

void PrepareBiPredMEParams ( Slice currSlice,
MEBlock *  mv_block,
int  ChromaMEEnable,
int  list,
int  list_offset,
int  ref 
)

Prepare Motion Estimation parameters for bipred list ME.

Definition at line 218 of file mv_search.c.

References slice::wbp_weight, and slice::wp_offset.

Referenced by BiPredBlockMotionSearch().

void PrepareMEParams ( Slice currSlice,
MEBlock *  mv_block,
int  ChromaMEEnable,
int  list,
int  ref 
)

Prepare Motion Estimation parameters for single list ME.

Definition at line 195 of file mv_search.c.

References slice::wp_offset, and slice::wp_weight.

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 122 of file mv_search.c.

References FAST_ACCESS, and UMV_ACCESS.

static void set_me_parameters ( char **  ref_array,
short ***  mv_array,
short *  all_mv,
short  ref,
int  step_h,
int  step_v,
int  pic_block_x 
) [inline, static]

Set search range. This needs to be changed to provide 2D support.

Definition at line 96 of file mv_search.c.

Referenced by PartitionMotionSearch(), and SubPartitionMotionSearch().

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


Documentation generated with DoxyGen