me_umhex.c File Reference

Fast integer pel motion estimation and fractional pel motion estimation algorithms are described in this file. 1. UMHEX_get_mem() and UMHEX_free_mem() are functions for allocation and release of memories about motion estimation 2. UMHEX_BlockMotionSearch() is the function for fast integer pel motion estimation and fractional pel motion estimation 3. UMHEX_DefineThreshold() defined thresholds for early termination. More...

#include <limits.h>
#include "global.h"
#include "memalloc.h"
#include "me_umhex.h"
#include "refbuf.h"
#include "mb_access.h"
#include "image.h"
#include "enc_statistics.h"
#include "me_distortion.h"
#include "mv-search.h"

Include dependency graph for me_umhex.c:

Go to the source code of this file.

Defines

#define Q_BITS   15
#define MIN_IMG_WIDTH   176

Functions

void UMHEX_DefineThreshold ()
void UMHEX_DefineThresholdMB ()
int UMHEX_get_mem ()
void UMHEX_free_mem ()
int UMHEXIntegerPelBlockMotionSearch (Macroblock *currMB, imgpel *orig_pic, short ref, int list, char ***refPic, short ****tmp_mv, int pic_pix_x, int pic_pix_y, int blocktype, MotionVector *pred_mv, MotionVector *mv, int search_range, int min_mcost, int lambda_factor, int apply_weights)
int UMHEXSubPelBlockMotionSearch (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)
int UMHEXSubPelBlockME (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, int apply_weights)
void UMHEX_decide_intrabk_SAD ()
void UMHEX_skip_intrabk_SAD (int best_mode, int ref_max)
void UMHEX_setup (short ref, int list, int block_y, int block_x, int blocktype, short ******all_mv)
int UMHEXBipredIntegerPelBlockMotionSearch (Macroblock *currMB, imgpel *cur_pic, short ref, int list, char ***refPic, short ****tmp_mv, int pic_pix_x, int pic_pix_y, int blocktype, MotionVector *pred_mv1, MotionVector *pred_mv2, MotionVector *mv1, MotionVector *mv2, int search_range, int min_mcost, int iteration_no, int lambda_factor, int apply_weights)
void UMHEXSetMotionVectorPredictor (Macroblock *currMB, short pmv[2], char **refPic, short ***tmp_mv, short ref_frame, int list, int mb_x, int mb_y, int blockshape_x, int blockshape_y, int *search_range)

Variables

int * byte_abs
short * spiral_search_x
short * spiral_search_y
static const int Diamond_x [4] = {-1, 0, 1, 0}
static const int Diamond_y [4] = {0, 1, 0, -1}
static const int Hexagon_x [6] = {2, 1, -1, -2, -1, 1}
static const int Hexagon_y [6] = {0, -2, -2, 0, 2, 2}
static const int Big_Hexagon_x [16] = {0,-2, -4,-4,-4, -4, -4, -2, 0, 2, 4, 4, 4, 4, 4, 2}
static const int Big_Hexagon_y [16] = {4, 3, 2, 1, 0, -1, -2, -3, -4, -3, -2, -1, 0, 1, 2, 3}
static int pred_MV_ref_flag
static int dist_method
static StorablePicture * ref_pic_ptr
static const int Multi_Ref_Thd [8] = {0, 300, 120, 120, 60, 30, 30, 15}
static const int Big_Hexagon_Thd [8] = {0, 3000, 1500, 1500, 800, 400, 400, 200}
static const int Median_Pred_Thd [8] = {0, 750, 350, 350, 170, 80, 80, 40}
static const int Threshold_DSR [8] = {0, 2200, 1000, 1000, 500, 250, 250, 120}
static int BlockType_LUT [4][4]
static int Median_Pred_Thd_MB [8]
static int Big_Hexagon_Thd_MB [8]
static int Multi_Ref_Thd_MB [8]
const int quant_coef [6][4][4]


Detailed Description

Fast integer pel motion estimation and fractional pel motion estimation algorithms are described in this file. 1. UMHEX_get_mem() and UMHEX_free_mem() are functions for allocation and release of memories about motion estimation 2. UMHEX_BlockMotionSearch() is the function for fast integer pel motion estimation and fractional pel motion estimation 3. UMHEX_DefineThreshold() defined thresholds for early termination.

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

Definition in file me_umhex.c.


Function Documentation

void UMHEX_decide_intrabk_SAD ( void   ) 

Functions for SAD prediction of intra block cases. 1. void UMHEX_decide_intrabk_SAD() judges the block coding type(intra/inter) of neibouring blocks 2. void UMHEX_skip_intrabk_SAD() set the SAD to zero if neigouring block coding type is intra.

Date:
2003.4

Definition at line 748 of file me_umhex.c.

References ImageParameters::pix_x, ImageParameters::pix_y, and ImageParameters::type.

Referenced by encode_one_macroblock_high(), encode_one_macroblock_highfast(), encode_one_macroblock_highloss(), and encode_one_macroblock_low().

void UMHEX_DefineThresholdMB ( void   ) 

Set MB thresholds for fast motion estimation Those thresholds may be adjusted to trade off rate-distortion performance and UMHEX speed.

Definition at line 110 of file me_umhex.c.

References f, InputParameters::qp, Threshold_DSR_MB, InputParameters::UMHexScale, and ImageParameters::width.

void UMHEX_free_mem ( void   ) 

Free space for fast motion estimation.

Definition at line 182 of file me_umhex.c.

References InputParameters::BiPredMotionEstimation, fastme_best_cost, fastme_l0_cost, fastme_l0_cost_bipred, fastme_l1_cost, fastme_l1_cost_bipred, fastme_ref_cost, free_mem2D(), free_mem2Dint(), free_mem3Dint(), free_mem4Dint(), McostState, and SearchState.

Referenced by free_global_buffers().

Here is the call graph for this function:

int UMHEX_get_mem ( void   ) 

int UMHEXBipredIntegerPelBlockMotionSearch ( Macroblock *  currMB,
imgpel *  cur_pic,
short  ref,
int  list,
char ***  refPic,
short ****  tmp_mv,
int  pic_pix_x,
int  pic_pix_y,
int  blocktype,
MotionVector *  pred_mv1,
MotionVector *  pred_mv2,
MotionVector *  mv1,
MotionVector *  mv2,
int  search_range,
int  min_mcost,
int  iteration_no,
int  lambda_factor,
int  apply_weights 
)

UMHEXBipredIntegerPelBlockMotionSearch: fast pixel block motion search for bipred mode this algrithm is called UMHexagonS(see JVT-D016),which includes four steps with different kinds of search patterns.

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

Definition at line 919 of file me_umhex.c.

References ImageParameters::bipred_mv, InputParameters::blc_size, computeBiPredSAD1(), computeBiPredSAD2(), fastme_l0_cost_bipred, fastme_l1_cost_bipred, ImageParameters::field_picture, IMG_PAD_SIZE_TIMES4, storable_picture::imgUV_sub, macroblock::list_offset, McostState, InputParameters::NumberBFrames, ImageParameters::opix_x, ImageParameters::opix_y, storable_picture::p_curr_img_sub, ImageParameters::pix_x, ImageParameters::pix_y, pred_SAD, InputParameters::search_range, storable_picture::size_x, storable_picture::size_x_cr_pad, storable_picture::size_x_pad, storable_picture::size_y, storable_picture::size_y_cr_pad, and storable_picture::size_y_pad.

Referenced by init_ME_engine().

Here is the call graph for this function:

int UMHEXIntegerPelBlockMotionSearch ( Macroblock *  currMB,
imgpel *  orig_pic,
short  ref,
int  list,
char ***  refPic,
short ****  tmp_mv,
int  pic_pix_x,
int  pic_pix_y,
int  blocktype,
MotionVector *  pred_mv,
MotionVector *  mv,
int  search_range,
int  min_mcost,
int  lambda_factor,
int  apply_weights 
)

UMHEXIntegerPelBlockMotionSearch: fast pixel block motion search this algorithm is called UMHexagonS(see JVT-D016),which includes four steps with different kinds of search patterns.

Input:
imgpel* orig_pic, // <-- original picture int ref, // <-- reference frame (0... or -1 (backward)) int pic_pix_x, // <-- absolute x-coordinate of regarded AxB block int pic_pix_y, // <-- absolute y-coordinate of regarded AxB block int blocktype, // <-- block type (1-16x16 ... 7-4x4) int pred_mv[2], // <-- motion vector predictor (x|y) in sub-pel units MotionVector *mv, // --> motion vector (x|y) - in pel units int search_range, // <-- 1-d search range in pel units int min_mcost, // <-- minimum motion cost (cost for center or huge value) int lambda_factor // <-- lagrangian parameter for determining motion cost
Two macro definitions defined in this program: 1. EARLY_TERMINATION: early termination algrithm, refer to JVT-D016.doc 2. SEARCH_ONE_PIXEL: search one pixel in search range
Author:
Main contributors: (see contributors.h for copyright, address and affiliation details)
Date:
: 2006.1

< motion vector shift for getting sub-pel units

< vertical block size

< horizontal block size

< predicted position x (in sub-pel units)

< predicted position y (in sub-pel units)

< center position x (in pel units)

< center position y (in pel units)

Definition at line 229 of file me_umhex.c.

References ImageParameters::all_mv, InputParameters::blc_size, F_PEL, fastme_best_cost, fastme_l0_cost, fastme_l1_cost, fastme_ref_cost, IMG_PAD_SIZE_TIMES4, storable_picture::imgUV_sub, macroblock::list_offset, McostState, ImageParameters::opix_x, ImageParameters::opix_y, storable_picture::p_curr_img_sub, ImageParameters::pix_x, ImageParameters::pix_y, pred_MV_uplayer, pred_SAD, InputParameters::search_range, storable_picture::size_x, storable_picture::size_x_cr_pad, storable_picture::size_x_pad, storable_picture::size_y, storable_picture::size_y_cr_pad, storable_picture::size_y_pad, and ImageParameters::structure.

Referenced by init_ME_engine().

void UMHEXSetMotionVectorPredictor ( Macroblock *  currMB,
short  pmv[2],
char **  refPic,
short ***  tmp_mv,
short  ref_frame,
int  list,
int  mb_x,
int  mb_y,
int  blockshape_x,
int  blockshape_y,
int *  search_range 
)


Documentation generated with DoxyGen