#include "contributors.h"
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <math.h>
#include "block.h"
#include "global.h"
#include "macroblock.h"
#include "mc_prediction.h"
#include "refbuf.h"
#include "image.h"
#include "mb_access.h"
#include "me_distortion.h"
Go to the source code of this file.
Functions | |
static void | MCWeightedBiPrediction (imgpel **mb_pred, imgpel *l0pred, imgpel *l1pred, int block_size_y, int block_x, int block_size_x, int max_imgpel_value, short wbp0, short wbp1, short offset, short wp_round, short weight_denom) |
static void | MCWeightedPrediction (imgpel **mb_pred, imgpel *lpred, int block_size_y, int block_x, int block_size_x, int max_imgpel_value, short wp, short offset, short wp_round, short weight_denom) |
static void | MCBiPrediction (imgpel **mb_pred, imgpel *l0pred, imgpel *l1pred, int block_size_y, int block_x, int block_size_x) |
static void | MCPrediction (imgpel **mb_pred, imgpel *lpred, int block_size_y, int block_x, int block_size_x) |
static void | OneComponentLumaPrediction (ImageParameters *p_Img, imgpel *mpred, int pic_pix_x, int pic_pix_y, int block_size_x, int block_size_y, StorablePicture *list) |
void | luma_prediction (Macroblock *currMB, int block_x, int block_y, int block_size_x, int block_size_y, int p_dir, int list_mode[2], char *ref_idx, short bipred_me) |
void | luma_prediction_bi (Macroblock *currMB, int block_x, int block_y, int block_size_x, int block_size_y, int l0_mode, int l1_mode, short l0_ref_idx, short l1_ref_idx, int list) |
void | OneComponentChromaPrediction4x4_regenerate (Macroblock *currMB, imgpel *mpred, int block_c_x, int block_c_y, short ***mv, StorablePicture *list, int uv) |
void | OneComponentChromaPrediction4x4_retrieve (Macroblock *currMB, imgpel *mpred, int block_c_x, int block_c_y, short ***mv, StorablePicture *list, int uv) |
static void | OneComponentChromaPrediction (ImageParameters *p_Img, imgpel *mpred, int pic_pix_x, int pic_pix_y, int block_size_x, int block_size_y, StorablePicture *list, int uv) |
static void | IntraChromaPrediction4x4 (Macroblock *currMB, int uv, int block_x, int block_y) |
void | chroma_prediction (Macroblock *currMB, int uv, int block_x, int block_y, int block_size_x, int block_size_y, int p_dir, int l0_mode, int l1_mode, short l0_ref_idx, short l1_ref_idx, short bipred_me) |
void | chroma_prediction_4x4 (Macroblock *currMB, int uv, int block_x, int block_y, int p_dir, int l0_mode, int l1_mode, short l0_ref_idx, short l1_ref_idx, short bipred_me) |
void | intra_chroma_prediction (Macroblock *currMB, int *mb_up, int *mb_left, int *mb_up_left) |
void | compute_residue (imgpel **curImg, imgpel **mpr, int **mb_rres, int mb_x, int opix_x, int width, int height) |
void | sample_reconstruct (imgpel **curImg, imgpel **mpr, int **mb_rres, int mb_x, int opix_x, int width, int height, int max_imgpel_value, int dq_bits) |
Definition in file mc_prediction.c.
void chroma_prediction | ( | Macroblock * | currMB, | |
int | uv, | |||
int | block_x, | |||
int | block_y, | |||
int | block_size_x, | |||
int | block_size_y, | |||
int | p_dir, | |||
int | l0_mode, | |||
int | l1_mode, | |||
short | l0_ref_idx, | |||
short | l1_ref_idx, | |||
short | bipred_me | |||
) |
Predict one chroma block.
Definition at line 487 of file mc_prediction.c.
References slice::all_mv, slice::bipred_mv, IMG_PAD_SIZE_TIMES4, IntraChromaPrediction4x4(), is_bipred_enabled(), img_par::max_pel_value_comp, slice::mb_pred, MCBiPrediction(), MCPrediction(), MCWeightedBiPrediction(), MCWeightedPrediction(), OneComponentChromaPrediction(), macroblock::opix_c_y, macroblock::p_Img, macroblock::p_slice, macroblock::pix_c_x, slice::wbp_weight, slice::weighted_prediction, slice::wp_offset, and slice::wp_weight.
Referenced by luma_residual_coding_p444_16x16(), and luma_residual_coding_p444_8x8().
void chroma_prediction_4x4 | ( | Macroblock * | currMB, | |
int | uv, | |||
int | block_x, | |||
int | block_y, | |||
int | p_dir, | |||
int | l0_mode, | |||
int | l1_mode, | |||
short | l0_ref_idx, | |||
short | l1_ref_idx, | |||
short | bipred_me | |||
) |
Predict one chroma 4x4 block.
Definition at line 598 of file mc_prediction.c.
References slice::all_mv, slice::bipred_mv, IntraChromaPrediction4x4(), is_bipred_enabled(), img_par::max_pel_value_comp, slice::mb_pred, MCBiPrediction(), MCPrediction(), MCWeightedBiPrediction(), MCWeightedPrediction(), macroblock::p_Img, macroblock::p_slice, slice::wbp_weight, slice::weighted_prediction, slice::wp_offset, and slice::wp_weight.
Referenced by chroma_residual_coding().
void intra_chroma_prediction | ( | Macroblock * | currMB, | |
int * | mb_up, | |||
int * | mb_left, | |||
int * | mb_up_left | |||
) |
Intra prediction of the chrminance layers of one macroblock.
< pixel position p(0,-1)
< pixel positions p(-1, -1..15)
Definition at line 698 of file mc_prediction.c.
References macroblock::c_ipred_mode, img_par::dc_pred_value_comp, img_par::field_mode, storable_picture::imgUV, img_par::max_pel_value_comp, img_par::MbaffFrameFlag, slice::mpr_16x16, macroblock::p_slice, slice::slice_type, subblk_offset_x, and inp_par_enc::UseConstrainedIntraPred.
Referenced by encode_one_macroblock_low(), and SetChromaPredMode().
static void IntraChromaPrediction4x4 | ( | Macroblock * | currMB, | |
int | uv, | |||
int | block_x, | |||
int | block_y | |||
) | [inline, static] |
Predict an intra chroma 4x4 block.
currMB | Current Macroblock | |
uv | color component | |
block_x | relative horizontal block coordinate of 4x4 block | |
block_y | relative vertical block coordinate of 4x4 block |
Definition at line 466 of file mc_prediction.c.
References macroblock::c_ipred_mode, slice::mb_pred, slice::mpr_16x16, and macroblock::p_slice.
Referenced by chroma_prediction(), and chroma_prediction_4x4().
void luma_prediction | ( | Macroblock * | currMB, | |
int | block_x, | |||
int | block_y, | |||
int | block_size_x, | |||
int | block_size_y, | |||
int | p_dir, | |||
int | list_mode[2], | |||
char * | ref_idx, | |||
short | bipred_me | |||
) |
Predict one Luma block.
currMB | Current Macroblock | |
block_x | relative horizontal block coordinate of block | |
block_y | relative vertical block coordinate of block | |
block_size_x | relative horizontal block coordinate of block | |
block_size_y | relative vertical block coordinate of block | |
p_dir | prediction direction (0=list0, 1=list1, 2=bipred) | |
list_mode | list prediction mode (1-7, 0=DIRECT) | |
ref_idx | reference pictures | |
bipred_me | use bi prediction mv (0=no bipred, 1 = use set 1, 2 = use set 2) |
Definition at line 144 of file mc_prediction.c.
References slice::all_mv, slice::bipred_mv, IMG_PAD_SIZE_TIMES4, is_bipred_enabled(), img_par::max_imgpel_value, slice::mb_pred, MCBiPrediction(), MCPrediction(), MCWeightedBiPrediction(), MCWeightedPrediction(), OneComponentLumaPrediction(), macroblock::opix_y, macroblock::p_Img, macroblock::p_slice, macroblock::pix_x, slice::wbp_weight, slice::weighted_prediction, slice::wp_offset, and slice::wp_weight.
Referenced by BIDPartitionCost(), GetDirectCost8x8(), GetSkipCostMB(), luma_residual_coding(), luma_residual_coding_8x8(), luma_residual_coding_p444_16x16(), luma_residual_coding_p444_8x8(), and TransformDecision().
void luma_prediction_bi | ( | Macroblock * | currMB, | |
int | block_x, | |||
int | block_y, | |||
int | block_size_x, | |||
int | block_size_y, | |||
int | l0_mode, | |||
int | l1_mode, | |||
short | l0_ref_idx, | |||
short | l1_ref_idx, | |||
int | list | |||
) |
Predict one Luma block.
currMB | Current Macroblock | |
block_x | relative horizontal block coordinate of 4x4 block | |
block_y | relative vertical block coordinate of 4x4 block | |
block_size_x | horizontal block size | |
block_size_y | vertical block size | |
l0_mode | list0 prediction mode (1-7, 0=DIRECT if l1_mode=0) | |
l1_mode | list1 prediction mode (1-7, 0=DIRECT if l0_mode=0) | |
l0_ref_idx | reference frame for list0 prediction (-1: Intra4x4 pred. with l0_mode) | |
l1_ref_idx | reference frame for list1 prediction | |
list | current list for prediction. |
Definition at line 245 of file mc_prediction.c.
References slice::bipred_mv, IMG_PAD_SIZE_TIMES4, img_par::max_imgpel_value, slice::mb_pred, MCBiPrediction(), MCWeightedBiPrediction(), OneComponentLumaPrediction(), macroblock::opix_y, macroblock::p_Img, macroblock::p_slice, macroblock::pix_x, slice::wbp_weight, slice::weighted_prediction, and slice::wp_offset.
Referenced by BPredPartitionCost().
static void MCBiPrediction | ( | imgpel ** | mb_pred, | |
imgpel * | l0pred, | |||
imgpel * | l1pred, | |||
int | block_size_y, | |||
int | block_x, | |||
int | block_size_x | |||
) | [inline, static] |
BiPrediction.
Definition at line 82 of file mc_prediction.c.
Referenced by chroma_prediction(), chroma_prediction_4x4(), luma_prediction(), and luma_prediction_bi().
static void MCPrediction | ( | imgpel ** | mb_pred, | |
imgpel * | lpred, | |||
int | block_size_y, | |||
int | block_x, | |||
int | block_size_x | |||
) | [inline, static] |
BiPrediction.
Definition at line 101 of file mc_prediction.c.
Referenced by chroma_prediction(), chroma_prediction_4x4(), and luma_prediction().
static void MCWeightedBiPrediction | ( | imgpel ** | mb_pred, | |
imgpel * | l0pred, | |||
imgpel * | l1pred, | |||
int | block_size_y, | |||
int | block_x, | |||
int | block_size_x, | |||
int | max_imgpel_value, | |||
short | wbp0, | |||
short | wbp1, | |||
short | offset, | |||
short | wp_round, | |||
short | weight_denom | |||
) | [inline, static] |
Weighted BiPrediction.
Definition at line 38 of file mc_prediction.c.
Referenced by chroma_prediction(), chroma_prediction_4x4(), luma_prediction(), and luma_prediction_bi().
static void MCWeightedPrediction | ( | imgpel ** | mb_pred, | |
imgpel * | lpred, | |||
int | block_size_y, | |||
int | block_x, | |||
int | block_size_x, | |||
int | max_imgpel_value, | |||
short | wp, | |||
short | offset, | |||
short | wp_round, | |||
short | weight_denom | |||
) | [inline, static] |
Weighted Prediction.
Definition at line 60 of file mc_prediction.c.
Referenced by chroma_prediction(), chroma_prediction_4x4(), and luma_prediction().
static void OneComponentChromaPrediction | ( | ImageParameters * | p_Img, | |
imgpel * | mpred, | |||
int | pic_pix_x, | |||
int | pic_pix_y, | |||
int | block_size_x, | |||
int | block_size_y, | |||
StorablePicture * | list, | |||
int | uv | |||
) | [inline, static] |
Retrieve one component of a chroma block from the buffer.
p_Img | image encoding parameters for current picture | |
mpred | array to store prediction values | |
pic_pix_x | motion shifted horizontal coordinate of block | |
pic_pix_y | motion shifted vertical block | |
block_size_x | horizontal block size | |
block_size_y | vertical block size | |
list | reference picture list | |
uv | chroma component |
Definition at line 439 of file mc_prediction.c.
References UMVLine4Xcr().
Referenced by chroma_prediction().
void OneComponentChromaPrediction4x4_regenerate | ( | Macroblock * | currMB, | |
imgpel * | mpred, | |||
int | block_c_x, | |||
int | block_c_y, | |||
short *** | mv, | |||
StorablePicture * | list, | |||
int | uv | |||
) |
Predict (on-the-fly) one component of a chroma 4x4 block.
currMB | Current Macroblock | |
mpred | array to store prediction values | |
block_c_x | horizontal pixel coordinate of 4x4 block | |
block_c_y | vertical pixel coordinate of 4x4 block | |
mv | motion vector array | |
list | image components (color planes) | |
uv | chroma component |
Definition at line 303 of file mc_prediction.c.
References img_par::height_cr, storable_picture::imgUV, img_par::mb_data, macroblock::mbAddrX, macroblock::opix_c_y, macroblock::p_Img, macroblock::pix_c_x, and img_par::width_cr.
Referenced by init_encoder().
void OneComponentChromaPrediction4x4_retrieve | ( | Macroblock * | currMB, | |
imgpel * | mpred, | |||
int | block_c_x, | |||
int | block_c_y, | |||
short *** | mv, | |||
StorablePicture * | list, | |||
int | uv | |||
) |
Retrieve one component of a chroma 4x4 block from the buffer.
currMB | Current Macroblock | |
mpred | array to store prediction values | |
block_c_x | horizontal pixel coordinate of 4x4 block | |
block_c_y | vertical pixel coordinate of 4x4 block | |
mv | motion vector array | |
list | image components (color planes) | |
uv | chroma component |
Definition at line 372 of file mc_prediction.c.
References IMG_PAD_SIZE_TIMES4, macroblock::opix_c_y, macroblock::p_Img, macroblock::pix_c_x, and UMVLine8X_chroma().
Referenced by init_encoder().
static void OneComponentLumaPrediction | ( | ImageParameters * | p_Img, | |
imgpel * | mpred, | |||
int | pic_pix_x, | |||
int | pic_pix_y, | |||
int | block_size_x, | |||
int | block_size_y, | |||
StorablePicture * | list | |||
) | [inline, static] |
Predict Luma block.
p_Img | image encoding parameters for current picture | |
mpred | array of prediction values (row by row) | |
pic_pix_x | motion shifted horizontal coordinate of block | |
pic_pix_y | motion shifted vertical coordinate of block | |
block_size_x | horizontal block size | |
block_size_y | vertical block size | |
list | reference picture list |
Definition at line 117 of file mc_prediction.c.
References UMVLine4X().
Referenced by luma_prediction(), and luma_prediction_bi().