#include "contributors.h"
#include <limits.h>
#include <math.h>
#include "global.h"
#include "enc_statistics.h"
#include "block.h"
#include "elements.h"
#include "macroblock.h"
#include "memalloc.h"
#include "mc_prediction.h"
#include "fmo.h"
#include "vlc.h"
#include "image.h"
#include "mb_access.h"
#include "ratectl.h"
#include "cabac.h"
#include "biariencode.h"
#include "me_fullsearch.h"
#include "me_fullfast.h"
#include "symbol.h"
#include "conformance.h"
#include "md_common.h"
#include "mv_prediction.h"
#include "rdopt.h"
#include "transform.h"
Go to the source code of this file.
Defines | |
#define | TRACE_SE(trace, str) |
Functions | |
static int | slice_too_big (Slice *currSlice, int rlc_bits) |
static int | writeChromaIntraPredMode (Macroblock *currMB) |
static int | writeChromaCoeff (Macroblock *currMB) |
static int | writeCBPandDquant (Macroblock *currMB) |
void | set_MB_parameters (Slice *currSlice, Macroblock *currMB) |
void | next_macroblock (Macroblock *currMB) |
static void | set_chroma_qp (Macroblock *currMB) |
void | update_qp (Macroblock *currMB) |
void | reset_macroblock (Macroblock *currMB) |
void | start_macroblock (Slice *currSlice, Macroblock **currMB, int mb_addr, Boolean mb_field) |
void | end_macroblock (Macroblock *currMB, Boolean *end_of_slice, Boolean *recode_macroblock) |
int | luma_residual_coding_16x16 (Macroblock *currMB, int block8x8, int list_mode[2]) |
int | luma_residual_coding_8x8 (Macroblock *currMB, int *cbp, int64 *cbp_blk, int block8x8, short p_dir, int list_mode[2], char *ref_idx) |
void | set_modes_and_reframe (Macroblock *currMB, int b8, short *p_dir, int list_mode[2], char *list_ref_idx) |
void | set_modes_and_reframe_p_slice (Macroblock *currMB, int b8, short *p_dir, int list_mode[2], char *list_ref_idx) |
void | set_modes_and_reframe_b_slice (Macroblock *currMB, int b8, short *p_dir, int list_mode[2], char *list_ref_idx) |
void | luma_residual_coding (Macroblock *currMB) |
byte | TransformDecision (Macroblock *currMB, int block_check, int *cost) |
void | chroma_residual_coding (Macroblock *currMB) |
void | intra_chroma_RD_decision (Macroblock *currMB, RD_PARAMS enc_mb) |
int | ZeroRef (Macroblock *currMB) |
int | MBType2Value (Macroblock *currMB) |
static int | writeIntra4x4Modes (Macroblock *currMB) |
static int | writeIntra8x8Modes (Macroblock *currMB) |
static int | writeIntraModes (Macroblock *currMB) |
int | B8Mode2Value (Slice *currSlice, short b8mode, short b8pdir) |
static int | writeIPCMLuma (Macroblock *currMB, imgpel **imgY, Bitstream *currStream, SyntaxElement *se, int *bitCount) |
static int | writeIPCMChroma (Macroblock *currMB, imgpel **imgUV, Bitstream *currStream, SyntaxElement *se, int *bitCount) |
static int | writeIPCMByteAlign (Bitstream *currStream, SyntaxElement *se, int *bitCount) |
static int | writeIPCMData (Macroblock *currMB, DataPartition *dataPart) |
int | writeMBLayerBSlice (Macroblock *currMB, int rdopt, int *coeff_rate) |
int | writeMBLayerPSlice (Macroblock *currMB, int rdopt, int *coeff_rate) |
int | writeMBLayerISlice (Macroblock *currMB, int rdopt, int *coeff_rate) |
void | write_terminating_bit (Slice *currSlice, short bit) |
void | write_macroblock (Macroblock *currMB, int eos_bit, Boolean prev_recode_mb) |
int | writeReferenceFrame (Macroblock *currMB, int i, int j, int list_idx, int ref) |
int | writeMotionVector8x8 (Macroblock *currMB, int i0, int j0, int i1, int j1, int refframe, int list_idx, int mv_mode, short bipred_me) |
int | write_bslice_motion_info_to_NAL (Macroblock *currMB) |
int | write_pslice_motion_info_to_NAL (Macroblock *currMB) |
int | writeMotionInfo2NAL (Macroblock *currMB) |
int | writeCoeff4x4_CABAC (Macroblock *currMB, ColorPlane plane, int b8, int b4, int intra4x4mode) |
int | writeCoeff8x8_CABAC (Macroblock *currMB, ColorPlane plane, int b8, int intra_mode) |
int | writeCoeff8x8 (Macroblock *currMB, ColorPlane pl, int block8x8, int block_mode, int transform_size_flag) |
int | writeCoeff16x16_CAVLC (Macroblock *currMB, ColorPlane plane) |
int | writeCoeff16x16_CABAC (Macroblock *currMB, ColorPlane plane) |
int | predict_nnz (Macroblock *currMB, int block_type, int i, int j) |
int | predict_nnz_chroma (Macroblock *currMB, int i, int j) |
int | writeCoeff4x4_CAVLC_normal (Macroblock *currMB, int block_type, int b8, int b4, int param) |
int | writeCoeff4x4_CAVLC_444 (Macroblock *currMB, int block_type, int b8, int b4, int param) |
int | distI16x16_satd (Macroblock *currMB, imgpel **img_org, imgpel **pred_img, double min_cost) |
int | distI16x16_sad (Macroblock *currMB, imgpel **img_org, imgpel **pred_img, double min_cost) |
int | distI16x16_sse (Macroblock *currMB, imgpel **img_org, imgpel **pred_img, double min_cost) |
double | find_sad_16x16_JM (Macroblock *currMB) |
void | change_plane_JV (ImageParameters *p_Img, int nplane) |
void | make_frame_picture_JV (ImageParameters *p_Img, InputParameters *p_Inp) |
Variables | |
static const byte | QP_SCALE_CR [52] |
static const int | block8x8_idx [3][4][4] |
Definition in file macroblock.c.
int B8Mode2Value | ( | Slice * | currSlice, | |
short | b8mode, | |||
short | b8pdir | |||
) |
Converts 8x8 block type to coding value.
Definition at line 1757 of file macroblock.c.
References slice::slice_type.
Referenced by RDCost_for_8x8blocks(), submacroblock_mode_decision_low(), writeMBLayerBSlice(), and writeMBLayerPSlice().
void change_plane_JV | ( | ImageParameters * | p_Img, | |
int | nplane | |||
) |
Change color plane for 4:4:4 Independent Mode.
Definition at line 4868 of file macroblock.c.
References img_par::colour_plane_id, img_par::enc_frame_picture_JV, img_par::imgData, img_par::mb_data, img_par::mb_data_JV, and img_par::pCurImg.
Referenced by encode_one_slice(), and encode_one_slice_MBAFF().
void chroma_residual_coding | ( | Macroblock * | currMB | ) |
Chroma residual coding for an macroblock.
Definition at line 1376 of file macroblock.c.
References chroma_prediction_4x4(), copy_image_data(), dct_chroma_sp(), dct_chroma_sp2(), storable_picture::imgUV, slice::mb_ores, slice::mb_pred, slice::mb_rres, macroblock::mb_type, macroblock::opix_c_y, macroblock::p_slice, macroblock::pix_c_x, macroblock::pix_c_y, and slice::slice_type.
Referenced by encode_one_macroblock_low(), and RDCost_for_macroblocks().
void end_macroblock | ( | Macroblock * | currMB, | |
Boolean * | end_of_slice, | |||
Boolean * | recode_macroblock | |||
) |
terminates processing of the current macroblock depending on the chosen slice mode
Check end-of-slice group condition first
Now check maximum # of MBs in slice
Check if the last coded macroblock fits into the size of the slice But only if this is not the first macroblock of this slice
(first MB OR first MB in a slice) AND bigger that maximum size of slice
MB that did not fit in this slice anymore is not a Skip MB
currMB | Current Macroblock | |
end_of_slice | returns true for last macroblock of a slice, otherwise false | |
recode_macroblock | returns true if max. slice size is exceeded an macroblock must be recoded in next slice |
Definition at line 536 of file macroblock.c.
References assignSE2partition, Bitstream::bits_to_go, Bitstream::bits_to_go_skip, Bitstream::byte_buf, Bitstream::byte_buf_skip, Bitstream::byte_pos, Bitstream::byte_pos_skip, img_par::cod_counter, error(), errortext, ET_SIZE, FmoGetLastCodedMBOfSliceGroup(), FmoMB2SliceGroup(), syntaxelement::len, slice::max_part_nr, macroblock::mbAddrX, slice::num_mb, macroblock::p_Img, macroblock::p_slice, slice::partArr, inp_par_enc::slice_argument, inp_par_enc::slice_mode, macroblock::slice_nr, slice::slice_too_big, slice_too_big(), Bitstream::stored_bits_to_go, Bitstream::stored_byte_buf, Bitstream::stored_byte_pos, syntaxelement::type, syntaxelement::value1, syntaxelement::value2, and writeSE_UVLC().
Referenced by encode_one_slice(), and encode_one_slice_MBAFF().
double find_sad_16x16_JM | ( | Macroblock * | currMB | ) |
Find best 16x16 based intra mode.
< pixel position p(0,-1)
< pixel positions p(-1, -1..15)
Definition at line 4789 of file macroblock.c.
References slice::mpr_16x16, macroblock::p_Img, macroblock::p_slice, img_par::pCurImg, slice::slice_type, and inp_par_enc::UseConstrainedIntraPred.
Referenced by init_rdopt().
void intra_chroma_RD_decision | ( | Macroblock * | currMB, | |
RD_PARAMS | enc_mb | |||
) |
RD Decision for Intra prediction mode of the chrominance layers of one macroblock.
< pixel position p(0,-1)
< pixel positions p(-1, -1..15)
Definition at line 1468 of file macroblock.c.
References macroblock::c_ipred_mode, img_par::field_mode, slice::mpr_16x16, macroblock::p_Img, macroblock::p_slice, Q_PEL, and inp_par_enc::UseConstrainedIntraPred.
Referenced by SetChromaPredMode().
void luma_residual_coding | ( | Macroblock * | currMB | ) |
Residual Coding of a Luma macroblock (not for intra).
Definition at line 1209 of file macroblock.c.
References _LUMA_MB_COEFF_COST_, macroblock::cbp_blk, slice::cofAC, copy_image_data_16x16(), copyblock_sp(), storable_picture::imgY, luma_prediction(), luma_residual_coding_16x16(), luma_residual_coding_8x8(), slice::mb_ores, slice::mb_pred, macroblock::mb_type, macroblock::opix_y, macroblock::p_Img, macroblock::p_slice, img_par::pCurImg, macroblock::pix_x, macroblock::pix_y, macroblock::qp_scaled, and slice::slice_type.
Referenced by encode_one_macroblock_low(), and RDCost_for_macroblocks().
int luma_residual_coding_16x16 | ( | Macroblock * | currMB, | |
int | block8x8, | |||
int | list_mode[2] | |||
) |
Residual Coding of an 8x8 Luma block (not for intra).
currMB | Current Macroblock to be coded | |
block8x8 | block number of 8x8 block | |
list_mode | list prediction mode (1-7, 0=DIRECT) |
Definition at line 814 of file macroblock.c.
References _LUMA_COEFF_COST_, macroblock::cbp_blk, slice::cofAC, copy_image_data_8x8(), copyblock_sp(), storable_picture::imgY, slice::mb_pred, macroblock::p_Img, macroblock::p_slice, macroblock::pix_x, macroblock::pix_y, macroblock::qp_scaled, and slice::slice_type.
Referenced by luma_residual_coding().
int luma_residual_coding_8x8 | ( | Macroblock * | currMB, | |
int * | cbp, | |||
int64 * | cbp_blk, | |||
int | block8x8, | |||
short | p_dir, | |||
int | list_mode[2], | |||
char * | ref_idx | |||
) |
Residual Coding of an 8x8 Luma block (not for intra).
currMB | Current Macroblock to be coded | |
cbp | Output: cbp (updated according to processed 8x8 luminance block) | |
cbp_blk | Output: block cbp (updated according to processed 8x8 luminance block) | |
block8x8 | block number of 8x8 block | |
p_dir | prediction direction | |
list_mode | list0 prediction mode (1-7, 0=DIRECT) | |
ref_idx | reference pictures for each list |
Definition at line 933 of file macroblock.c.
References _LUMA_COEFF_COST_, slice::cofAC, copy_image_data_8x8(), copyblock_sp(), storable_picture::imgY, luma_prediction(), slice::mb_ores, slice::mb_pred, macroblock::opix_y, macroblock::p_slice, img_par::pCurImg, macroblock::pix_x, macroblock::pix_y, macroblock::qp_scaled, and slice::slice_type.
Referenced by luma_residual_coding(), RDCost_for_8x8blocks(), and submacroblock_mode_decision_low().
void make_frame_picture_JV | ( | ImageParameters * | p_Img, | |
InputParameters * | p_Inp | |||
) |
Make one frame picture from 4:4:4 plane.
Definition at line 4881 of file macroblock.c.
References copy_storable_param_JV(), img_par::enc_frame_picture_JV, free_storable_picture(), img_par::height, storable_picture::imgUV, storable_picture::imgY, and img_par::width.
Referenced by frame_picture().
int MBType2Value | ( | Macroblock * | currMB | ) |
Converts macroblock type to coding value.
Definition at line 1602 of file macroblock.c.
References macroblock::mb_type, macroblock::p_slice, slice::slice_type, and ZeroRef().
Referenced by min_rdcost_16x16(), writeMBLayerBSlice(), and writeMBLayerPSlice().
void next_macroblock | ( | Macroblock * | currMB | ) |
updates the coordinates and statistics parameter for the next macroblock
Definition at line 182 of file macroblock.c.
References macroblock::c_ipred_mode, macroblock::mb_type, macroblock::p_Img, macroblock::p_slice, macroblock::qp, inp_par_enc::slice_mode, and slice::slice_type.
Referenced by encode_one_slice(), and encode_one_slice_MBAFF().
int predict_nnz | ( | Macroblock * | currMB, | |
int | block_type, | |||
int | i, | |||
int | j | |||
) |
Get the Prediction from the Neighboring Blocks for Number of Nonzero Coefficients.
Luma Blocks
Definition at line 3740 of file macroblock.c.
References error(), get4x4Neighbour(), img_par::nz_coeff, macroblock::p_Img, and macroblock::p_slice.
Referenced by est_RunLevel_CAVLC(), writeCoeff4x4_CAVLC_444(), and writeCoeff4x4_CAVLC_normal().
int predict_nnz_chroma | ( | Macroblock * | currMB, | |
int | i, | |||
int | j | |||
) |
Get the Prediction from the Neighboring Blocks for Number of Nonzero Coefficients.
Chroma Blocks
Definition at line 3831 of file macroblock.c.
References get4x4Neighbour(), img_par::nz_coeff, macroblock::p_Img, macroblock::p_slice, and YUV444.
Referenced by est_RunLevel_CAVLC(), writeCoeff4x4_CAVLC_444(), and writeCoeff4x4_CAVLC_normal().
void reset_macroblock | ( | Macroblock * | currMB | ) |
resets info for the current macroblock
currMB | current macroblock |
Definition at line 288 of file macroblock.c.
References macroblock::block_x, macroblock::block_y, macroblock::c_ipred_mode, macroblock::cbp_blk, macroblock::intra_pred_modes8x8, macroblock::mb_type, macroblock::mbAddrX, storable_picture::motion, pic_motion_params::mv, macroblock::mvd, macroblock::p_Img, macroblock::p_slice, pic_motion_params::ref_idx, pic_motion_params::ref_pic_id, and inp_par_enc::UseConstrainedIntraPred.
Referenced by start_macroblock().
void set_MB_parameters | ( | Slice * | currSlice, | |
Macroblock * | currMB | |||
) |
updates the coordinates for the next macroblock to be processed
currSlice | current slice pointer | |
currMB | macroblock structure to be set |
Definition at line 102 of file macroblock.c.
References macroblock::block_x, macroblock::block_y, img_par::imgData, macroblock::mb_x, macroblock::mb_y, macroblock::mbAddrX, macroblock::opix_c_y, macroblock::opix_y, img_par::pCurImg, macroblock::pix_c_x, macroblock::pix_c_y, macroblock::pix_x, macroblock::pix_y, and YUV400.
Referenced by start_macroblock().
void set_modes_and_reframe | ( | Macroblock * | currMB, | |
int | b8, | |||
short * | p_dir, | |||
int | list_mode[2], | |||
char * | list_ref_idx | |||
) |
Set mode parameters and reference frames for an 8x8 block.
Definition at line 1077 of file macroblock.c.
References macroblock::block_x, macroblock::block_y, storable_picture::motion, macroblock::p_Img, macroblock::p_slice, pic_motion_params::ref_idx, and slice::slice_type.
void set_modes_and_reframe_b_slice | ( | Macroblock * | currMB, | |
int | b8, | |||
short * | p_dir, | |||
int | list_mode[2], | |||
char * | list_ref_idx | |||
) |
Set mode parameters and reference frames for an 8x8 block.
Definition at line 1161 of file macroblock.c.
References macroblock::block_x, macroblock::block_y, storable_picture::motion, macroblock::p_Img, and pic_motion_params::ref_idx.
void set_modes_and_reframe_p_slice | ( | Macroblock * | currMB, | |
int | b8, | |||
short * | p_dir, | |||
int | list_mode[2], | |||
char * | list_ref_idx | |||
) |
Set mode parameters and reference frames for an 8x8 block.
Definition at line 1136 of file macroblock.c.
References macroblock::block_x, macroblock::block_y, storable_picture::motion, macroblock::p_Img, and pic_motion_params::ref_idx.
int slice_too_big | ( | Slice * | currSlice, | |
int | rlc_bits | |||
) | [static] |
For Slice Mode 2: Checks if one partition of one slice exceeds the allowed size.
CAVLC
CABAC
Definition at line 763 of file macroblock.c.
References arienco_bits_written(), Bitstream::bits_to_go, Bitstream::byte_pos, slice::max_part_nr, slice::partArr, and inp_par_enc::slice_argument.
Referenced by end_macroblock().
void start_macroblock | ( | Slice * | currSlice, | |
Macroblock ** | currMB, | |||
int | mb_addr, | |||
Boolean | mb_field | |||
) |
initializes the current macroblock
currSlice | current slice | |
currMB | current macroblock | |
mb_addr | current macroblock address | |
mb_field | true for field macroblock coding |
< avoid decreasing the NumberofbasicUnit for the same MB twice
Definition at line 374 of file macroblock.c.
References Bitstream::bits_to_go, Bitstream::byte_buf, Bitstream::byte_pos, cbp_linfo_inter_normal(), cbp_linfo_inter_other(), cbp_linfo_intra_normal(), cbp_linfo_intra_other(), CheckAvailabilityOfNeighbors(), CheckAvailabilityOfNeighborsCABAC(), img_par::cod_counter, slice::DFAlphaC0Offset, slice::DFBetaOffset, slice::DFDisableIdc, FmoGetPreviousMBNr(), init_ME_engine(), inp_par_enc::IntraProfile, slice::max_part_nr, img_par::mb_data, pic_motion_params::mb_field, inp_par_enc::MbInterlace, storable_picture::motion, macroblock::p_slice, slice::partArr, img_par::qp, img_par::qpsp, rc_handle_mb(), inp_par_enc::RCEnable, reset_macroblock(), ResetFastFullIntegerSearch(), set_MB_parameters(), inp_par_enc::slice_mode, macroblock::slice_nr, slice::slice_type, Bitstream::stored_bits_to_go, Bitstream::stored_byte_buf, Bitstream::stored_byte_pos, and update_qp().
Referenced by encode_one_slice(), and encode_one_slice_MBAFF().
byte TransformDecision | ( | Macroblock * | currMB, | |
int | block_check, | |||
int * | cost | |||
) |
Makes the decision if 8x8 tranform will be used (for RD-off).
Definition at line 1293 of file macroblock.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 encode_one_macroblock_low().
void update_qp | ( | Macroblock * | currMB | ) |
updates chroma QP according to luma QP and bit depth
Definition at line 271 of file macroblock.c.
References macroblock::p_Img, macroblock::qp, and macroblock::qp_scaled.
Referenced by copy_rdopt_data(), start_macroblock(), and update_qp_cbp().
int write_bslice_motion_info_to_NAL | ( | Macroblock * | currMB | ) |
Writes motion info (b slice).
Definition at line 2814 of file macroblock.c.
References macroblock::block_x, macroblock::block_y, macroblock::mb_type, storable_picture::motion, macroblock::p_slice, pic_motion_params::ref_idx, writeMotionVector8x8(), and writeReferenceFrame().
void write_macroblock | ( | Macroblock * | currMB, | |
int | eos_bit, | |||
Boolean | prev_recode_mb | |||
) |
Passes the chosen syntax elements to the NAL.
Definition at line 2599 of file macroblock.c.
References img_par::intras, slice::max_part_nr, macroblock::mb_type, macroblock::mbAddrX, macroblock::p_Img, macroblock::p_slice, slice::partArr, rc_update_mb_stats(), inp_par_enc::RCEnable, reset_mb_nz_coeff(), slice::slice_type, and inp_par_enc::UseConstrainedIntraPred.
Referenced by encode_one_slice(), and encode_one_slice_MBAFF().
int write_pslice_motion_info_to_NAL | ( | Macroblock * | currMB | ) |
Writes motion info (p slice).
Definition at line 2902 of file macroblock.c.
References macroblock::block_x, macroblock::block_y, macroblock::mb_type, storable_picture::motion, macroblock::p_slice, pic_motion_params::ref_idx, writeMotionVector8x8(), writeReferenceFrame(), and ZeroRef().
int writeCBPandDquant | ( | Macroblock * | currMB | ) | [static] |
Writes CBP, DQUANT of an macroblock.
Definition at line 3393 of file macroblock.c.
References assignSE2partition, syntaxelement::len, macroblock::mb_type, macroblock::mb_x, macroblock::mb_y, macroblock::p_Img, macroblock::p_slice, slice::partArr, macroblock::qp, slice::slice_type, syntaxelement::type, syntaxelement::value1, and syntaxelement::value2.
Referenced by writeMBLayerBSlice(), and writeMBLayerPSlice().
static int writeChromaCoeff | ( | Macroblock * | currMB | ) | [static] |
Writes chrominance coefficients.
Definition at line 3044 of file macroblock.c.
References assignSE2partition, slice::cofAC, slice::cofDC, syntaxelement::context, syntaxelement::len, macroblock::p_slice, slice::partArr, subblk_offset_x, macroblock::subblock_x, macroblock::subblock_y, syntaxelement::type, syntaxelement::value1, syntaxelement::value2, and writeRunLevel_CABAC().
Referenced by writeMBLayerBSlice(), and writeMBLayerPSlice().
int writeChromaIntraPredMode | ( | Macroblock * | currMB | ) | [static] |
Write chroma intra prediction mode.
Definition at line 2567 of file macroblock.c.
References assignSE2partition, macroblock::c_ipred_mode, syntaxelement::len, macroblock::p_slice, slice::partArr, syntaxelement::type, syntaxelement::value1, and syntaxelement::value2.
Referenced by writeMBLayerBSlice(), and writeMBLayerPSlice().
int writeCoeff16x16_CABAC | ( | Macroblock * | currMB, | |
ColorPlane | plane | |||
) |
Write Luma Coeffcients, as well as Cb and Cr Coefficients in the case of 444 common mode, of an macroblock.
Definition at line 3573 of file macroblock.c.
References assignSE2partition, slice::cofAC, slice::cofDC, syntaxelement::context, syntaxelement::len, macroblock::mb_type, macroblock::mbAddrX, img_par::nz_coeff, macroblock::p_slice, slice::partArr, reset_mb_nz_coeff(), macroblock::subblock_x, macroblock::subblock_y, syntaxelement::type, syntaxelement::value1, syntaxelement::value2, writeCoeff8x8(), and writeRunLevel_CABAC().
int writeCoeff16x16_CAVLC | ( | Macroblock * | currMB, | |
ColorPlane | plane | |||
) |
Write Luma Coeffcients, as well as Cb and Cr Coefficients in the case of 444 common mode, of an macroblock.
Definition at line 3477 of file macroblock.c.
References macroblock::mb_type, macroblock::mbAddrX, img_par::nz_coeff, macroblock::p_Img, macroblock::p_slice, reset_mb_nz_coeff(), and writeCoeff8x8().
int writeCoeff4x4_CABAC | ( | Macroblock * | currMB, | |
ColorPlane | plane, | |||
int | b8, | |||
int | b4, | |||
int | intra4x4mode | |||
) |
Writes Coeffs of an 4x4 block.
Definition at line 3220 of file macroblock.c.
References assignSE2partition, slice::cofAC, syntaxelement::context, syntaxelement::len, macroblock::p_slice, slice::partArr, macroblock::subblock_x, macroblock::subblock_y, syntaxelement::type, syntaxelement::value1, syntaxelement::value2, and writeRunLevel_CABAC().
Referenced by rdcost_for_4x4_intra_blocks(), rdcost_for_4x4_intra_blocks_444(), and writeCoeff8x8().
int writeCoeff4x4_CAVLC_444 | ( | Macroblock * | currMB, | |
int | block_type, | |||
int | b8, | |||
int | b4, | |||
int | param | |||
) |
Writes coeff of an 4x4 block (CAVLC).
Definition at line 4243 of file macroblock.c.
References assignSE2partition, slice::cofAC, slice::cofDC, error(), syntaxelement::len, macroblock::mbAddrX, img_par::nz_coeff, macroblock::p_slice, slice::partArr, predict_nnz(), predict_nnz_chroma(), syntaxelement::type, syntaxelement::value1, syntaxelement::value2, writeSyntaxElement_Level_VLC1(), writeSyntaxElement_Level_VLCN(), writeSyntaxElement_NumCoeffTrailingOnes(), writeSyntaxElement_NumCoeffTrailingOnesChromaDC(), writeSyntaxElement_Run(), writeSyntaxElement_TotalZeros(), writeSyntaxElement_TotalZerosChromaDC(), and writeSyntaxElement_VLC().
int writeCoeff4x4_CAVLC_normal | ( | Macroblock * | currMB, | |
int | block_type, | |||
int | b8, | |||
int | b4, | |||
int | param | |||
) |
Writes coeff of an 4x4 block (CAVLC).
Definition at line 3896 of file macroblock.c.
References assignSE2partition, slice::cofAC, slice::cofDC, error(), syntaxelement::len, macroblock::mbAddrX, img_par::nz_coeff, macroblock::p_slice, slice::partArr, predict_nnz(), predict_nnz_chroma(), syntaxelement::type, syntaxelement::value1, syntaxelement::value2, writeSyntaxElement_Level_VLC1(), writeSyntaxElement_Level_VLCN(), writeSyntaxElement_NumCoeffTrailingOnes(), writeSyntaxElement_NumCoeffTrailingOnesChromaDC(), writeSyntaxElement_Run(), writeSyntaxElement_TotalZeros(), writeSyntaxElement_TotalZerosChromaDC(), and writeSyntaxElement_VLC().
int writeCoeff8x8 | ( | Macroblock * | currMB, | |
ColorPlane | pl, | |||
int | block8x8, | |||
int | block_mode, | |||
int | transform_size_flag | |||
) |
Writes Luma Coeff of an 8x8 block.
Definition at line 3353 of file macroblock.c.
References macroblock::p_slice, writeCoeff4x4_CABAC(), and writeCoeff8x8_CABAC().
Referenced by RDCost_for_8x8blocks(), writeCoeff16x16_CABAC(), and writeCoeff16x16_CAVLC().
int writeCoeff8x8_CABAC | ( | Macroblock * | currMB, | |
ColorPlane | plane, | |||
int | b8, | |||
int | intra_mode | |||
) |
Writes coefficients of an 8x8 block (CABAC).
Definition at line 3286 of file macroblock.c.
References assignSE2partition, slice::cofAC, syntaxelement::context, syntaxelement::len, macroblock::p_slice, slice::partArr, slice::slice_type, macroblock::subblock_x, macroblock::subblock_y, syntaxelement::type, syntaxelement::value1, syntaxelement::value2, and writeRunLevel_CABAC().
Referenced by rdcost_for_8x8_intra_blocks(), rdcost_for_8x8_intra_blocks_444(), and writeCoeff8x8().
static int writeIntra4x4Modes | ( | Macroblock * | currMB | ) | [static] |
Writes 4x4 intra prediction modes for a macroblock.
Definition at line 1649 of file macroblock.c.
References assignSE2partition, syntaxelement::context, syntaxelement::len, macroblock::p_slice, slice::partArr, syntaxelement::type, syntaxelement::value1, and syntaxelement::value2.
static int writeIntra8x8Modes | ( | Macroblock * | currMB | ) | [static] |
Writes 8x8 intra prediction modes for a macroblock.
Definition at line 1695 of file macroblock.c.
References assignSE2partition, syntaxelement::context, macroblock::intra_pred_modes8x8, syntaxelement::len, macroblock::p_slice, slice::partArr, syntaxelement::type, syntaxelement::value1, and syntaxelement::value2.
static int writeIPCMData | ( | Macroblock * | currMB, | |
DataPartition * | dataPart | |||
) | [static] |
Codes IPCM data.
Definition at line 1843 of file macroblock.c.
References arienco_bits_written(), arienco_done_encoding(), arienco_start_encoding(), Bitstream::byte_pos, storable_picture::imgUV, storable_picture::imgY, macroblock::p_Img, macroblock::p_slice, Bitstream::streamBuffer, and YUV400.
Referenced by writeMBLayerBSlice(), and writeMBLayerPSlice().
int writeMBLayerBSlice | ( | Macroblock * | currMB, | |
int | rdopt, | |||
int * | coeff_rate | |||
) |
Codes macroblock header.
currMB | current macroblock | |
rdopt | true for calls during RD-optimization | |
coeff_rate | bitrate of Luma and Chroma coeff |
Definition at line 1891 of file macroblock.c.
References assignSE2partition, B8Mode2Value(), macroblock::c_ipred_mode, CheckAvailabilityOfNeighborsCABAC(), img_par::cod_counter, field_flag_inference(), FmoGetNextMBNr(), syntaxelement::len, img_par::mb_data, macroblock::mb_type, macroblock::mb_x, macroblock::mb_y, macroblock::mbAddrX, MBType2Value(), macroblock::p_Img, macroblock::p_slice, slice::partArr, reset_mb_nz_coeff(), syntaxelement::type, syntaxelement::value1, syntaxelement::value2, writeCBPandDquant(), writeChromaCoeff(), writeChromaIntraPredMode(), writeIPCMData(), writeSE_Flag(), writeSE_UVLC(), YUV400, and YUV444.
int writeMBLayerPSlice | ( | Macroblock * | currMB, | |
int | rdopt, | |||
int * | coeff_rate | |||
) |
Codes macroblock header.
currMB | current macroblock | |
rdopt | true for calls during RD-optimization | |
coeff_rate | bitrate of Luma and Chroma coeff |
Definition at line 2162 of file macroblock.c.
References assignSE2partition, B8Mode2Value(), macroblock::c_ipred_mode, CheckAvailabilityOfNeighborsCABAC(), img_par::cod_counter, field_flag_inference(), FmoGetNextMBNr(), syntaxelement::len, img_par::mb_data, macroblock::mb_type, macroblock::mb_x, macroblock::mb_y, macroblock::mbAddrX, MBType2Value(), macroblock::p_Img, macroblock::p_slice, slice::partArr, reset_mb_nz_coeff(), syntaxelement::type, syntaxelement::value1, syntaxelement::value2, writeCBPandDquant(), writeChromaCoeff(), writeChromaIntraPredMode(), writeIPCMData(), writeSE_Flag(), writeSE_UVLC(), YUV400, and YUV444.
int writeMotionInfo2NAL | ( | Macroblock * | currMB | ) |
Writes motion info.
Definition at line 2957 of file macroblock.c.
References macroblock::block_x, macroblock::block_y, macroblock::mb_type, storable_picture::motion, macroblock::p_slice, pic_motion_params::ref_idx, slice::slice_type, writeMotionVector8x8(), writeReferenceFrame(), and ZeroRef().
int writeMotionVector8x8 | ( | Macroblock * | currMB, | |
int | i0, | |||
int | j0, | |||
int | i1, | |||
int | j1, | |||
int | refframe, | |||
int | list_idx, | |||
int | mv_mode, | |||
short | bipred_me | |||
) |
Writes motion vectors of an 8x8 block.
Definition at line 2721 of file macroblock.c.
References slice::all_mv, assignSE2partition, slice::bipred_mv, macroblock::block_x, macroblock::block_y, get_neighbors(), is_bipred_enabled(), syntaxelement::len, storable_picture::motion, pic_motion_params::mv, macroblock::mvd, macroblock::p_Img, macroblock::p_slice, slice::partArr, pic_motion_params::ref_idx, macroblock::subblock_x, macroblock::subblock_y, syntaxelement::type, syntaxelement::value1, and syntaxelement::value2.
Referenced by RDCost_for_8x8blocks(), write_bslice_motion_info_to_NAL(), write_pslice_motion_info_to_NAL(), and writeMotionInfo2NAL().
int writeReferenceFrame | ( | Macroblock * | currMB, | |
int | i, | |||
int | j, | |||
int | list_idx, | |||
int | ref | |||
) |
Codes the reference frame.
Definition at line 2684 of file macroblock.c.
References assignSE2partition, syntaxelement::len, macroblock::p_slice, slice::partArr, macroblock::subblock_x, macroblock::subblock_y, syntaxelement::type, syntaxelement::value1, and syntaxelement::value2.
Referenced by RDCost_for_8x8blocks(), write_bslice_motion_info_to_NAL(), write_pslice_motion_info_to_NAL(), and writeMotionInfo2NAL().
int ZeroRef | ( | Macroblock * | currMB | ) |
Check if all reference frames for a macroblock are zero.
Definition at line 1579 of file macroblock.c.
References macroblock::block_x, macroblock::block_y, storable_picture::motion, macroblock::p_Img, and pic_motion_params::ref_idx.
Referenced by MBType2Value(), write_pslice_motion_info_to_NAL(), and writeMotionInfo2NAL().
const int block8x8_idx[3][4][4] [static] |
Initial value:
{ { {0, 1, 0, 0}, {2, 3, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0} }, { {0, 1, 0, 0}, {0, 1, 0, 0}, {2, 3, 0, 0}, {2, 3, 0, 0} }, { {0, 0, 1, 1}, {0, 0, 1, 1}, {2, 2, 3, 3}, {2, 2, 3, 3} } }
Definition at line 63 of file macroblock.c.
const byte QP_SCALE_CR[52] [static] |
Initial value:
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27, 28,29,29,30,31,32,32,33,34,34,35,35,36,36,37,37, 37,38,38,38,39,39,39,39 }
Definition at line 57 of file macroblock.c.