#include <limits.h>
#include "contributors.h"
#include "global.h"
#include "image.h"
#include "memalloc.h"
#include "mb_access.h"
#include "refbuf.h"
#include "macroblock.h"
#include "me_distortion.h"
#include "me_epzs.h"
#include "me_epzs_common.h"
#include "mv_search.h"
Go to the source code of this file.
Functions | |
static int | RoundLog2 (int iValue) |
static EPZSStructure * | allocEPZSpattern (int searchpoints) |
static void | freeEPZSpattern (EPZSStructure *p) |
static void | assignEPZSpattern (EPZSStructure *pattern, int type, int stopSearch, int nextLast, EPZSStructure *nextpattern) |
int | EPZSInit (ImageParameters *p_Img) |
void | EPZSDelete (ImageParameters *p_Img) |
static EPZSColocParams * | allocEPZScolocated (int size_x, int size_y, int mb_adaptive_frame_field_flag) |
static void | freeEPZScolocated (EPZSColocParams *p) |
static void | EPZSWindowPredictorInit (short search_range, EPZSStructure *predictor, short mode) |
int | EPZSStructInit (Slice *currSlice) |
void | EPZSStructDelete (Slice *currSlice) |
void | EPZSSliceInit (Slice *currSlice) |
static void | is_block_available (Macroblock *currMB, StorablePicture *ref_picture, MEBlock *mv_block, int block_available[4]) |
void | EPZSBlockTypePredictorsMB (Slice *currSlice, MEBlock *mv_block, SPoint *point, int *prednum) |
short | EPZSSpatialPredictors (EPZSParameters *p_EPZS, PixelPos *block, int list, int list_offset, short ref, char **refPic, short ***tmp_mv) |
void | EPZSTemporalPredictors (Macroblock *currMB, StorablePicture *ref_picture, EPZSParameters *p_EPZS, MEBlock *mv_block, int *prednum, int stopCriterion, int min_mcost) |
void | EPZSBlockTypePredictors (Slice *currSlice, MEBlock *mv_block, SPoint *point, int *prednum) |
void | EPZSWindowPredictors (MotionVector *mv, EPZSStructure *predictor, int *prednum, EPZSStructure *windowPred) |
void | EPZSSpatialMemPredictors (EPZSParameters *p_EPZS, MEBlock *mv_block, int list, int *prednum, int img_width) |
int | EPZSDetermineStopCriterion (EPZSParameters *p_EPZS, int *prevSad, MEBlock *mv_block, int lambda_dist) |
void | EPZSOutputStats (InputParameters *p_Inp, FILE *stat, short stats_file) |
Variables | |
static const short | BLOCK_PARENT [8] = { 1, 1, 1, 1, 2, 4, 4, 5 } |
static const int | MIN_THRES_BASE [8] = { 0, 64, 32, 32, 16, 8, 8, 4 } |
static const int | MED_THRES_BASE [8] = { 0, 256, 128, 128, 64, 32, 32, 16 } |
static const int | MAX_THRES_BASE [8] = { 0, 768, 384, 384, 192, 96, 96, 48 } |
static const char | EPZS_PATTERN [6][20] = { "Diamond", "Square", "Extended Diamond", "Large Diamond", "SBP Large Diamond", "PMVFAST" } |
static const char | EPZS_DUAL_PATTERN [7][20] |
static const char | EPZS_FIXED_PREDICTORS [3][20] = { "Disabled", "All P", "All P + B" } |
static const char | EPZS_OTHER_PREDICTORS [2][20] = { "Disabled", "Enabled" } |
static const short | pattern_data [5][12][4] |
Definition in file me_epzs_common.c.
static EPZSColocParams* allocEPZScolocated | ( | int | size_x, | |
int | size_y, | |||
int | mb_adaptive_frame_field_flag | |||
) | [static] |
Allocate co-located memory.
size_x | horizontal luma size | |
size_y | vertical luma size | |
mb_adaptive_frame_field_flag | flag that indicates macroblock adaptive frame/field coding |
Definition at line 235 of file me_epzs_common.c.
References get_mem3Dmv(), and no_mem_exit().
Referenced by EPZSStructInit().
static EPZSStructure* allocEPZSpattern | ( | int | searchpoints | ) | [static] |
Allocate EPZS pattern memory.
searchpoints | number of searchpoints to allocate |
Definition at line 102 of file me_epzs_common.c.
References no_mem_exit().
Referenced by EPZSInit(), and EPZSStructInit().
static void assignEPZSpattern | ( | EPZSStructure * | pattern, | |
int | type, | |||
int | stopSearch, | |||
int | nextLast, | |||
EPZSStructure * | nextpattern | |||
) | [static] |
Assign EPZS pattern.
Definition at line 146 of file me_epzs_common.c.
References pattern_data.
Referenced by EPZSInit().
void EPZSBlockTypePredictors | ( | Slice * | currSlice, | |
MEBlock * | mv_block, | |||
SPoint * | point, | |||
int * | prednum | |||
) |
EPZS Block Type Predictors.
Definition at line 1541 of file me_epzs_common.c.
References slice::all_mv, and BLOCK_PARENT.
Referenced by EPZSIntPelBlockMotionSearchSubMB(), and EPZSPelBlockMotionSearchSubMB().
void EPZSBlockTypePredictorsMB | ( | Slice * | currSlice, | |
MEBlock * | mv_block, | |||
SPoint * | point, | |||
int * | prednum | |||
) |
EPZS Block Type Predictors.
Definition at line 1156 of file me_epzs_common.c.
References slice::all_mv, and BLOCK_PARENT.
Referenced by EPZSIntPelBlockMotionSearch(), and EPZSPelBlockMotionSearch().
void EPZSDelete | ( | ImageParameters * | p_Img | ) |
Delete EPZS Alocated memory.
Definition at line 207 of file me_epzs_common.c.
References freeEPZSpattern().
Referenced by free_global_buffers().
int EPZSDetermineStopCriterion | ( | EPZSParameters * | p_EPZS, | |
int * | prevSad, | |||
MEBlock * | mv_block, | |||
int | lambda_dist | |||
) |
Determine stop criterion for EPZS.
Definition at line 1700 of file me_epzs_common.c.
Referenced by EPZSBiPredBlockMotionSearch(), EPZSIntBiPredBlockMotionSearch(), EPZSIntPelBlockMotionSearch(), EPZSIntPelBlockMotionSearchSubMB(), EPZSPelBlockMotionSearch(), and EPZSPelBlockMotionSearchSubMB().
int EPZSInit | ( | ImageParameters * | p_Img | ) |
EPZS Global Initialization.
Definition of pottential EPZS patterns. It is possible to also define other patterns, or even use resizing patterns (such as the PMVFAST scheme. These patterns are only shown here as reference, while the same also holds for this implementation (i.e. new conditions could be added on adapting predictors, or thresholds etc. Note that search could also be performed on subpel positions directly while pattern needs not be restricted on integer positions only.
Allocate memory and assign search patterns
Definition at line 169 of file me_epzs_common.c.
References allocEPZSpattern(), and assignEPZSpattern().
Referenced by init_global_buffers().
void EPZSOutputStats | ( | InputParameters * | p_Inp, | |
FILE * | stat, | |||
short | stats_file | |||
) |
Report function for EPZS Fast ME AMT/HYC.
Definition at line 1726 of file me_epzs_common.c.
Referenced by information_init(), and report_stats().
void EPZSSliceInit | ( | Slice * | currSlice | ) |
For ME purposes restricting the co-located partition is not necessary.
EPZS Slice Level Initialization
Assign frame buffers for field MBs Check whether we should use top or bottom field mvs. Depending on the assigned poc values.
Generate field MVs from Frame MVs
Use inference flag to remap mvs/references Frame with field co-located
Definition at line 528 of file me_epzs_common.c.
References pic_motion_params::field_frame, storable_picture::motion, pic_motion_params::mv, pic_motion_params::ref_id, and slice::slice_type.
Referenced by init_slice().
void EPZSSpatialMemPredictors | ( | EPZSParameters * | p_EPZS, | |
MEBlock * | mv_block, | |||
int | list, | |||
int * | prednum, | |||
int | img_width | |||
) |
Spatial Predictors AMT/HYC.
p_EPZS | EPZS Parameters | |
mv_block | Motion estimation structure | |
list | Current list | |
prednum | predictor position | |
img_width | image width |
Definition at line 1611 of file me_epzs_common.c.
Referenced by EPZSIntPelBlockMotionSearch(), EPZSIntPelBlockMotionSearchSubMB(), EPZSPelBlockMotionSearch(), and EPZSPelBlockMotionSearchSubMB().
short EPZSSpatialPredictors | ( | EPZSParameters * | p_EPZS, | |
PixelPos * | block, | |||
int | list, | |||
int | list_offset, | |||
short | ref, | |||
char ** | refPic, | |||
short *** | tmp_mv | |||
) |
Spatial Predictors AMT/HYC.
Definition at line 1208 of file me_epzs_common.c.
References img_par::mb_data, and img_par::MbaffFrameFlag.
Referenced by EPZSBiPredBlockMotionSearch(), EPZSIntBiPredBlockMotionSearch(), EPZSIntPelBlockMotionSearch(), EPZSIntPelBlockMotionSearchSubMB(), EPZSPelBlockMotionSearch(), and EPZSPelBlockMotionSearchSubMB().
void EPZSStructDelete | ( | Slice * | currSlice | ) |
Delete EPZS Alocated memory.
Definition at line 489 of file me_epzs_common.c.
References inp_par_enc::BiPredMotionEstimation, free_mem2Dshort(), free_mem3Dint(), free_mem4Dmv(), free_mem5Dmv(), freeEPZScolocated(), and freeEPZSpattern().
Referenced by terminate_slice().
int EPZSStructInit | ( | Slice * | currSlice | ) |
EPZS Global Initialization.
In this implementation we keep threshold limits fixed. However one could adapt these limits based on lagrangian optimization considerations (i.e. qp), while also allow adaptation of the limits themselves based on content or complexity.
Allocate and assign window based predictors. Other window types could also be used, while method could be made a bit more adaptive (i.e. patterns could be assigned based on neighborhood
Also assing search predictor memory
Finally assign memory for all other elements (distortion, EPZSMap, and temporal predictors)
Definition at line 367 of file me_epzs_common.c.
References allocEPZScolocated(), allocEPZSpattern(), inp_par_enc::BiPredMESearchRange, inp_par_enc::BiPredMotionEstimation, EPZSWindowPredictorInit(), get_mem2Dshort(), get_mem3Dint(), get_mem4Dmv(), get_mem5Dmv(), img_par::height, img_par::height_cr, img_par::max_num_references, img_par::MbaffFrameFlag, RoundLog2(), inp_par_enc::search_range, img_par::width, and img_par::width_cr.
Referenced by init_slice().
void EPZSTemporalPredictors | ( | Macroblock * | currMB, | |
StorablePicture * | ref_picture, | |||
EPZSParameters * | p_EPZS, | |||
MEBlock * | mv_block, | |||
int * | prednum, | |||
int | stopCriterion, | |||
int | min_mcost | |||
) |
Temporal Predictors AMT/HYC.
currMB | Currrent Macroblock | |
ref_picture | Current reference picture | |
p_EPZS | EPZS structure | |
mv_block | motion estimation information block | |
prednum | Pointer to first empty position in EPZS predictor list | |
stopCriterion | EPZS thresholding criterion for temporal predictor considerations | |
min_mcost | Current minimum distortion for block |
Definition at line 1460 of file me_epzs_common.c.
References add_predictor().
Referenced by EPZSIntPelBlockMotionSearch(), and EPZSPelBlockMotionSearch().
static void EPZSWindowPredictorInit | ( | short | search_range, | |
EPZSStructure * | predictor, | |||
short | mode | |||
) | [static] |
EPZS Search Window Predictor Initialization.
Definition at line 292 of file me_epzs_common.c.
References RoundLog2().
Referenced by EPZSStructInit().
void EPZSWindowPredictors | ( | MotionVector * | mv, | |
EPZSStructure * | predictor, | |||
int * | prednum, | |||
EPZSStructure * | windowPred | |||
) |
EPZS Window Based Predictors.
Definition at line 1590 of file me_epzs_common.c.
Referenced by EPZSIntPelBlockMotionSearch(), and EPZSPelBlockMotionSearch().
static void freeEPZScolocated | ( | EPZSColocParams * | p | ) | [static] |
Free co-located memory.
p | structure to be freed |
Definition at line 268 of file me_epzs_common.c.
References free_mem3Dmv().
Referenced by EPZSStructDelete().
static void freeEPZSpattern | ( | EPZSStructure * | p | ) | [static] |
Free EPZS pattern memory.
p | structure to be freed |
Definition at line 127 of file me_epzs_common.c.
Referenced by EPZSDelete(), and EPZSStructDelete().
static int RoundLog2 | ( | int | iValue | ) | [static] |
calculate RoundLog2(uiVal)
Definition at line 78 of file me_epzs_common.c.
Referenced by EPZSStructInit(), and EPZSWindowPredictorInit().
const short BLOCK_PARENT[8] = { 1, 1, 1, 1, 2, 4, 4, 5 } [static] |
{skip, 16x16, 16x8, 8x16, 8x8, 8x4, 4x8, 4x4}
Definition at line 30 of file me_epzs_common.c.
Referenced by EPZSBlockTypePredictors(), and EPZSBlockTypePredictorsMB().
const char EPZS_DUAL_PATTERN[7][20] [static] |
Initial value:
{ "Disabled", "Diamond", "Square", "Extended Diamond", "Large Diamond", "SBP Large Diamond", "PMVFAST" }
Definition at line 37 of file me_epzs_common.c.
const short pattern_data[5][12][4] [static] |
Initial value:
{ { { 0, 4, 3, 3 }, { 4, 0, 0, 3 }, { 0, -4, 1, 3 }, { -4, 0, 2, 3 } }, { { 0, 4, 7, 3 }, { 4, 4, 7, 5 }, { 4, 0, 1, 3 }, { 4, -4, 1, 5 }, { 0, -4, 3, 3 }, { -4, -4, 3, 5 }, { -4, 0, 5, 3 }, { -4, 4, 5, 5 } }, { { -4, 4, 10, 5 }, { 0, 8, 10, 8 }, { 0, 4, 10, 7 }, { 4, 4, 1, 5 }, { 8, 0, 1, 8 }, { 4, 0, 1, 7 }, { 4, -4, 4, 5 }, { 0, -8, 4, 8 }, { 0, -4, 4, 7 }, { -4, -4, 7, 5 }, { -8, 0, 7, 8 }, { -4, 0, 7, 7 } }, { { 0, 8, 6, 5 }, { 4, 4, 0, 3 }, { 8, 0, 0, 5 }, { 4, -4, 2, 3 }, { 0, -8, 2, 5 }, { -4, -4, 4, 3 }, { -8, 0, 4, 5 }, { -4, 4, 6, 3 } }, { { 0, 8, 6, 12 }, { 4, 4, 0, 12 }, { 8, 0, 0, 12 }, { 4, -4, 2, 12 }, { 0, -8, 2, 12 }, { -4, -4, 4, 12 }, { -8, 0, 4, 12 }, { -4, 4, 6, 12 }, { 0, 2, 6, 12 }, { 2, 0, 0, 12 }, { 0, -2, 2, 12 }, { -2, 0, 4, 12 } } }
Definition at line 44 of file me_epzs_common.c.
Referenced by assignEPZSpattern().