#include "contributors.h"
#include <limits.h>
#include <math.h>
#include "global.h"
#include "enc_statistics.h"
#include "elements.h"
#include "macroblock.h"
#include "memalloc.h"
#include "mc_prediction.h"
#include "refbuf.h"
#include "fmo.h"
#include "vlc.h"
#include "image.h"
#include "mb_access.h"
#include "ratectl.h"
#include "cabac.h"
#include "biariencode.h"
#include "transform8x8.h"
#include "transform.h"
#include "me_fullsearch.h"
#include "me_fullfast.h"
#include "symbol.h"
#include "rdoq.h"
#include "mv-search.h"
#include "conformance.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 (Slice *currSlice, Macroblock *currMB) |
| static int | writeChromaCoeff (Slice *currSlice, Macroblock *currMB) |
| static int | writeCBPandDquant (Slice *currSlice, Macroblock *currMB) |
| static int | writeMotionInfo2NAL (Slice *currSlice, Macroblock *currMB) |
| int | allocate_mb_mem (void) |
| void | free_mb_mem (void) |
| void | set_MB_parameters (int mb_addr) |
| void | next_macroblock (ImageParameters *img, Macroblock *currMB) |
| void | set_chroma_qp (ImageParameters *img, Macroblock *currMB) |
| void | update_qp (ImageParameters *img, Macroblock *currMB) |
| void | reset_macroblock (ImageParameters *img, Macroblock *currMB, int prev_mb) |
| void | start_macroblock (ImageParameters *img, Slice *currSlice, Macroblock **currMB, int mb_addr, byte mb_field) |
| void | end_macroblock (ImageParameters *img, Slice *currSlice, Macroblock *currMB, Boolean *end_of_slice, Boolean *recode_macroblock) |
| int | LumaResidualCoding8x8 (Macroblock *currMB, int *cbp, int64 *cbp_blk, int block8x8, short p_dir, int l0_mode, int l1_mode, short l0_ref_idx, short l1_ref_idx, int is_cavlc) |
| void | SetModesAndRefframe (Macroblock *currMB, int b8, short *p_dir, int list_mode[2], short list_ref_idx[2]) |
| void | LumaResidualCoding (Macroblock *currMB, int is_cavlc) |
| int | TransformDecision (Macroblock *currMB, int block_check, int *cost) |
| void | ChromaResidualCoding (Macroblock *currMB, int is_cavlc) |
| void | IntraChromaRDDecision (Macroblock *currMB, RD_PARAMS enc_mb) |
| int | ZeroRef (Macroblock *currMB) |
| int | MBType2Value (Macroblock *currMB) |
| int | writeIntra4x4Modes (Slice *currSlice, Macroblock *currMB) |
| int | writeIntra8x8Modes (Slice *currSlice, Macroblock *currMB) |
| int | writeIntraModes (Slice *currSlice, Macroblock *currMB) |
| int | B8Mode2Value (short b8mode, short b8pdir) |
| static int | writeIPCMLuma (ImageParameters *img, imgpel **imgY, Bitstream *currStream, SyntaxElement *se, int *bitCount) |
| static int | writeIPCMChroma (ImageParameters *img, imgpel **imgUV, Bitstream *currStream, SyntaxElement *se, int *bitCount) |
| static int | writeIPCMByteAlign (Bitstream *currStream, SyntaxElement *se, int *bitCount) |
| int | writeMBLayer (Slice *currSlice, Macroblock *currMB, int rdopt, int *coeff_rate) |
| void | write_terminating_bit (Slice *currSlice, short bit) |
| void | write_macroblock (ImageParameters *img, Slice *currSlice, Macroblock *currMB, int eos_bit, Boolean prev_recode_mb) |
| int | writeReferenceFrame (Slice *currSlice, Macroblock *currMB, int mode, int i, int j, int fwd_flag, int ref) |
| int | writeMotionVector8x8 (Slice *currSlice, Macroblock *currMB, int i0, int j0, int i1, int j1, int refframe, int list_idx, int mv_mode, short bipred_me) |
| int | writeCoeff4x4_CABAC (Slice *currSlice, Macroblock *currMB, ColorPlane plane, int b8, int b4, int intra4x4mode) |
| int | writeCoeff8x8_CABAC (Slice *currSlice, Macroblock *currMB, ColorPlane plane, int b8, int intra_mode) |
| int | writeCoeff8x8 (Slice *currSlice, Macroblock *currMB, ColorPlane pl, int block8x8, int block_mode, int transform_size_flag) |
| int | writeCoeff16x16 (Slice *currSlice, Macroblock *currMB, ColorPlane plane, int cbp) |
| 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 (Slice *currSlice, Macroblock *currMB, int block_type, int b8, int b4, int param) |
| int | distortion_hadamard (imgpel **img_org, imgpel **pred_img) |
| int | distortion_sad (imgpel **img_org, imgpel **pred_img) |
| int | distortion_sse (imgpel **img_org, imgpel **pred_img) |
| double | find_sad_16x16_JM (Macroblock *currMB, int *intra_mode) |
| void | change_plane_JV (int nplane) |
| void | make_frame_picture_JV () |
Variables | |
| const byte | QP_SCALE_CR [52] |
| static const int | block8x8_idx [3][4][4] |
| static int ** | M7 = NULL |
| static int ** | M4 = NULL |
| static int **** | M0 = NULL |
| static int | diff [16] |
| static int | diff64 [64] |
| const unsigned char | subblk_offset_x [3][8][4] |
| const unsigned char | subblk_offset_y [3][8][4] |
| ColocatedParams * | Co_located |
| ColocatedParams * | Co_located_JV [MAX_PLANE] |
Definition in file macroblock.c.
| int B8Mode2Value | ( | short | b8mode, | |
| short | b8pdir | |||
| ) |
Converts 8x8 block type to coding value.
Definition at line 1678 of file macroblock.c.
References ImageParameters::type.
Referenced by RDCost_for_8x8blocks(), submacroblock_mode_decision_low(), and writeMBLayer().
| void change_plane_JV | ( | int | nplane | ) |
Change color plane for 4:4:4 Independent Mode.
Definition at line 3858 of file macroblock.c.
References ImageParameters::colour_plane_id, enc_frame_picture_JV, ImageParameters::mb_data, ImageParameters::mb_data_JV, and pCurImg.
Referenced by encode_one_slice(), and encode_one_slice_MBAFF().
| void ChromaResidualCoding | ( | Macroblock * | currMB, | |
| int | is_cavlc | |||
| ) |
Chroma residual coding for an macroblock.
Definition at line 1299 of file macroblock.c.
References macroblock::bipred_me, macroblock::cbp, ChromaPrediction4x4(), dct_chroma_sp(), dct_chroma_sp2(), storable_picture::imgUV, ImageParameters::mb_cr_size_x, ImageParameters::mb_cr_size_y, ImageParameters::mb_ores, ImageParameters::mb_pred, ImageParameters::mb_rres, macroblock::mb_type, ImageParameters::NoResidueDirect, ImageParameters::opix_c_x, ImageParameters::opix_c_y, ImageParameters::pix_c_x, ImageParameters::pix_c_y, SetModesAndRefframe(), ImageParameters::type, and ImageParameters::yuv_format.
Referenced by encode_one_macroblock_low(), and RDCost_for_macroblocks().

| void end_macroblock | ( | ImageParameters * | img, | |
| Slice * | currSlice, | |||
| 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
| currSlice | Current slice |
| 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 579 of file macroblock.c.
References assignSE2partition, macroblock::bitcounter, Bitstream::bits_to_go, Bitstream::bits_to_go_skip, datapartition::bitstream, Bitstream::byte_buf, Bitstream::byte_buf_skip, Bitstream::byte_pos, Bitstream::byte_pos_skip, ImageParameters::cod_counter, ImageParameters::current_slice_nr, datapartition::ee_cabac, datapartition::ee_recode, error(), errortext, ET_SIZE, FmoGetLastCodedMBOfSliceGroup(), FmoMB2SliceGroup(), syntaxelement::len, Slice::max_part_nr, macroblock::mb_nr, Slice::num_mb, Slice::partArr, InputParameters::partition_mode, ImageParameters::PicSizeInMbs, macroblock::PrevMB, InputParameters::slice_argument, InputParameters::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, Slice::symbol_mode, 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, | |
| int * | intra_mode | |||
| ) |
Find best 16x16 based intra mode.
< pixel position p(0,-1)
< pixel positions p(-1, -1..15)
Definition at line 3761 of file macroblock.c.
References pix_pos::available, InputParameters::Intra16x16ParDisable, InputParameters::Intra16x16PlaneDisable, ImageParameters::intra_block, InputParameters::IntraDisableInterOnly, pix_pos::mb_addr, ImageParameters::mb_size, InputParameters::ModeDecisionMetric, ImageParameters::mpr_16x16, ImageParameters::P444_joined, pCurImg, ImageParameters::type, and InputParameters::UseConstrainedIntraPred.
Referenced by init_rdopt().
| void IntraChromaRDDecision | ( | 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 1397 of file macroblock.c.
References pix_pos::available, macroblock::c_ipred_mode, distortion4x4(), ImageParameters::field_mode, ImageParameters::intra_block, pix_pos::mb_addr, ImageParameters::mb_cr_size_x, ImageParameters::mb_cr_size_y, ImageParameters::mb_size, ImageParameters::MbaffFrameFlag, ImageParameters::mpr_16x16, pix_pos::pos_x, pix_pos::pos_y, Q_PEL, and InputParameters::UseConstrainedIntraPred.
Referenced by encode_one_macroblock_high(), encode_one_macroblock_highfast(), and encode_one_macroblock_highloss().

| void LumaResidualCoding | ( | Macroblock * | currMB, | |
| int | is_cavlc | |||
| ) |
Residual Coding of a Luma macroblock (not for intra).
Definition at line 1149 of file macroblock.c.
References _LUMA_MB_COEFF_COST_, macroblock::cbp, macroblock::cbp_blk, ImageParameters::cofAC, copyblock_sp(), storable_picture::imgY, ImageParameters::lossless_qpprime_flag, LumaResidualCoding8x8(), ImageParameters::mb_pred, macroblock::mb_type, ImageParameters::P444_joined, storable_picture::p_img, ImageParameters::pix_x, ImageParameters::pix_y, macroblock::qp_scaled, SetModesAndRefframe(), and ImageParameters::type.
Referenced by encode_one_macroblock_low(), and RDCost_for_macroblocks().

| int LumaResidualCoding8x8 | ( | Macroblock * | currMB, | |
| int * | cbp, | |||
| int64 * | cbp_blk, | |||
| int | block8x8, | |||
| short | p_dir, | |||
| int | l0_mode, | |||
| int | l1_mode, | |||
| short | l0_ref_idx, | |||
| short | l1_ref_idx, | |||
| int | is_cavlc | |||
| ) |
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 |
| l0_mode | list0 prediction mode (1-7, 0=DIRECT) |
| l1_mode | list1 prediction mode (1-7, 0=DIRECT) |
| l0_ref_idx | reference picture for list0 prediction |
| l1_ref_idx | reference picture for list0 prediction |
| is_cavlc | entropy mode? |
Definition at line 855 of file macroblock.c.
References _LUMA_COEFF_COST_, macroblock::bipred_me, ChromaPrediction(), ImageParameters::cofAC, copyblock_sp(), storable_picture::imgUV, storable_picture::imgY, ImageParameters::lossless_qpprime_flag, macroblock::luma_transform_size_8x8_flag, LumaPrediction(), ImageParameters::mb_ores, ImageParameters::mb_pred, ImageParameters::NoResidueDirect, ImageParameters::opix_x, ImageParameters::opix_y, ImageParameters::P444_joined, pCurImg, ImageParameters::pix_x, ImageParameters::pix_y, macroblock::qp_scaled, select_plane(), and ImageParameters::type.
Referenced by LumaResidualCoding(), RDCost_for_8x8blocks(), and submacroblock_mode_decision_low().

| void make_frame_picture_JV | ( | void | ) |
Make one frame picture from 4:4:4 plane.
Definition at line 3872 of file macroblock.c.
References copy_storable_param_JV(), enc_frame_picture_JV, free_storable_picture(), ImageParameters::height, and ImageParameters::width.
Referenced by frame_picture().

| int MBType2Value | ( | Macroblock * | currMB | ) |
Converts macroblock type to coding value.
Definition at line 1525 of file macroblock.c.
References macroblock::b8pdir, ImageParameters::currentSlice, ImageParameters::i16offset, macroblock::mb_type, Slice::symbol_mode, ImageParameters::type, and ZeroRef().
Referenced by writeMBLayer().

| void next_macroblock | ( | ImageParameters * | img, | |
| Macroblock * | currMB | |||
| ) |
updates the coordinates and statistics parameter for the next macroblock
Definition at line 271 of file macroblock.c.
References macroblock::b8mode, macroblock::bitcounter, macroblock::c_ipred_mode, macroblock::cbp, macroblock::luma_transform_size_8x8_flag, ImageParameters::max_bitCount, macroblock::mb_type, macroblock::qp, InputParameters::slice_mode, storable_picture::stats, InputParameters::Transform8x8Mode, and ImageParameters::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 3081 of file macroblock.c.
References pix_pos::available, ImageParameters::currentPicture, error(), get4x4Neighbour(), ImageParameters::intra_block, pix_pos::mb_addr, ImageParameters::mb_size, ImageParameters::nz_coeff, InputParameters::partition_mode, pix_pos::x, and pix_pos::y.
Referenced by est_RunLevel_CAVLC(), and writeCoeff4x4_CAVLC().

| 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 3170 of file macroblock.c.
References pix_pos::available, ImageParameters::currentPicture, get4x4Neighbour(), ImageParameters::intra_block, pix_pos::mb_addr, ImageParameters::mb_size, ImageParameters::nz_coeff, InputParameters::partition_mode, pix_pos::x, pix_pos::y, YUV444, and ImageParameters::yuv_format.
Referenced by est_RunLevel_CAVLC(), and writeCoeff4x4_CAVLC().

| void reset_macroblock | ( | ImageParameters * | img, | |
| Macroblock * | currMB, | |||
| int | prev_mb | |||
| ) |
resets info for the current macroblock
| currMB | current macroblock | |
| prev_mb | previous macroblock address |
Definition at line 374 of file macroblock.c.
References macroblock::bipred_me, macroblock::bitcounter, ImageParameters::block_x, ImageParameters::block_y, macroblock::c_ipred_mode, macroblock::cbp, macroblock::cbp_bits, macroblock::cbp_bits_8x8, macroblock::cbp_blk, ImageParameters::current_mb_nr, ImageParameters::intra_block, macroblock::intra_pred_modes, macroblock::intra_pred_modes8x8, ImageParameters::mb_data, macroblock::mb_type, storable_picture::motion, pic_motion_params::mv, macroblock::mvd, pic_motion_params::ref_idx, pic_motion_params::ref_pic_id, macroblock::slice_nr, InputParameters::UseConstrainedIntraPred, and macroblock::write_mb.
Referenced by start_macroblock().
| void set_MB_parameters | ( | int | mb_addr | ) |
updates the coordinates for the next macroblock to be processed
| mb_addr | macroblock address in scan order |
Definition at line 196 of file macroblock.c.
References ImageParameters::block_x, ImageParameters::block_y, ImageParameters::current_mb_nr, macroblock::list_offset, ImageParameters::mb_cr_size_x, ImageParameters::mb_cr_size_y, ImageParameters::mb_data, macroblock::mb_field, ImageParameters::mb_x, ImageParameters::mb_y, ImageParameters::MbaffFrameFlag, ImageParameters::opix_c_x, ImageParameters::opix_c_y, ImageParameters::opix_x, ImageParameters::opix_y, pCurImg, ImageParameters::pix_c_x, ImageParameters::pix_c_y, ImageParameters::pix_x, ImageParameters::pix_y, YUV400, and ImageParameters::yuv_format.
Referenced by start_macroblock().
| void SetModesAndRefframe | ( | Macroblock * | currMB, | |
| int | b8, | |||
| short * | p_dir, | |||
| int | list_mode[2], | |||
| short | list_ref_idx[2] | |||
| ) |
Set mode parameters and reference frames for an 8x8 block.
Definition at line 1093 of file macroblock.c.
References macroblock::b8mode, macroblock::b8pdir, ImageParameters::block_x, ImageParameters::block_y, storable_picture::motion, pic_motion_params::ref_idx, and ImageParameters::type.
Referenced by ChromaResidualCoding(), LumaResidualCoding(), and TransformDecision().
| 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 805 of file macroblock.c.
References arienco_bits_written(), Bitstream::bits_to_go, datapartition::bitstream, Bitstream::byte_pos, datapartition::ee_cabac, Slice::max_part_nr, Slice::partArr, InputParameters::slice_argument, and Slice::symbol_mode.
Referenced by end_macroblock().

| void start_macroblock | ( | ImageParameters * | img, | |
| Slice * | currSlice, | |||
| Macroblock ** | currMB, | |||
| int | mb_addr, | |||
| byte | 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 449 of file macroblock.c.
References ImageParameters::bitdepth_luma_qp_scale, Bitstream::bits_to_go, datapartition::bitstream, Bitstream::byte_buf, Bitstream::byte_pos, CheckAvailabilityOfNeighbors(), CheckAvailabilityOfNeighborsCABAC(), ImageParameters::cod_counter, ImageParameters::current_slice_nr, ImageParameters::DFAlphaC0Offset, ImageParameters::DFBetaOffset, ImageParameters::DFDisableIdc, datapartition::ee_cabac, datapartition::ee_recode, ImageParameters::field_picture, FmoGetPreviousMBNr(), InputParameters::IntraProfile, Slice::max_part_nr, ImageParameters::mb_data, pic_motion_params::mb_field, macroblock::mb_nr, ImageParameters::MbaffFrameFlag, InputParameters::MbInterlace, storable_picture::motion, Slice::partArr, macroblock::prev_qp, ImageParameters::qp, Slice::qp, ImageParameters::qpsp, rc_handle_mb(), InputParameters::RCEnable, reset_macroblock(), ResetFastFullIntegerSearch(), InputParameters::SearchMode, set_MB_parameters(), InputParameters::slice_mode, macroblock::slice_nr, Bitstream::stored_bits_to_go, Bitstream::stored_byte_buf, Bitstream::stored_byte_pos, Slice::symbol_mode, and update_qp().
Referenced by encode_one_slice(), and encode_one_slice_MBAFF().

| int TransformDecision | ( | Macroblock * | currMB, | |
| int | block_check, | |||
| int * | cost | |||
| ) |
Makes the decision if 8x8 tranform will be used (for RD-off).
Definition at line 1229 of file macroblock.c.
References macroblock::bipred_me, distortion4x4(), distortion8x8(), LumaPrediction(), ImageParameters::mb_pred, ImageParameters::opix_x, ImageParameters::opix_y, pCurImg, SetModesAndRefframe(), and InputParameters::Transform8x8Mode.
Referenced by encode_one_macroblock_low().

| void update_qp | ( | ImageParameters * | img, | |
| Macroblock * | currMB | |||
| ) |
updates chroma QP according to luma QP and bit depth
Definition at line 355 of file macroblock.c.
References ImageParameters::bitdepth_luma_qp_scale, macroblock::qp, and macroblock::qp_scaled.
Referenced by copy_rdopt_data(), start_macroblock(), and update_qp_cbp().
| void write_macroblock | ( | ImageParameters * | img, | |
| Slice * | currSlice, | |||
| Macroblock * | currMB, | |||
| int | eos_bit, | |||
| Boolean | prev_recode_mb | |||
| ) |
Passes the chosen syntax elements to the NAL.
Definition at line 2153 of file macroblock.c.
References macroblock::bitcounter, datapartition::bitstream, macroblock::cbp, ImageParameters::current_mb_nr, ImageParameters::current_slice_nr, ImageParameters::frame_no, ImageParameters::intra_block, intras, Slice::max_part_nr, macroblock::mb_nr, macroblock::mb_type, ImageParameters::NumberofCodedMacroBlocks, p_trace, Slice::partArr, rc_update_mb_stats(), InputParameters::RCEnable, reset_mb_nz_coeff(), Slice::start_mb_nr, Slice::symbol_mode, ImageParameters::type, InputParameters::UseConstrainedIntraPred, macroblock::write_mb, and writeMBLayer().
Referenced by encode_one_slice(), and encode_one_slice_MBAFF().

| int writeCBPandDquant | ( | Slice * | currSlice, | |
| Macroblock * | currMB | |||
| ) | [static] |
Writes CBP, DQUANT of an macroblock.
Definition at line 2792 of file macroblock.c.
References assignSE2partition, macroblock::bitcounter, macroblock::cbp, macroblock::delta_qp, syntaxelement::len, macroblock::luma_transform_size_8x8_flag, macroblock::mb_type, ImageParameters::mb_x, ImageParameters::mb_y, macroblock::NoMbPartLessThan8x8Flag, Slice::partArr, InputParameters::partition_mode, InputParameters::Transform8x8Mode, syntaxelement::type, syntaxelement::value1, and syntaxelement::value2.
Referenced by writeMBLayer().
| static int writeChromaCoeff | ( | Slice * | currSlice, | |
| Macroblock * | currMB | |||
| ) | [static] |
Writes chrominance coefficients.
Definition at line 2452 of file macroblock.c.
References assignSE2partition, macroblock::bitcounter, macroblock::cbp, ImageParameters::cofAC, ImageParameters::cofDC, syntaxelement::context, ImageParameters::is_intra_block, ImageParameters::is_v_block, syntaxelement::len, ImageParameters::num_blk8x8_uv, ImageParameters::num_cdc_coeff, Slice::partArr, InputParameters::partition_mode, ImageParameters::subblock_x, ImageParameters::subblock_y, Slice::symbol_mode, syntaxelement::type, syntaxelement::value1, syntaxelement::value2, writeCoeff4x4_CAVLC(), writeRunLevel_CABAC(), and ImageParameters::yuv_format.
Referenced by writeMBLayer().

| int writeChromaIntraPredMode | ( | Slice * | currSlice, | |
| Macroblock * | currMB | |||
| ) | [static] |
Write chroma intra prediction mode.
Definition at line 2120 of file macroblock.c.
References assignSE2partition, macroblock::bitcounter, macroblock::c_ipred_mode, syntaxelement::len, Slice::partArr, InputParameters::partition_mode, syntaxelement::type, syntaxelement::value1, and syntaxelement::value2.
Referenced by writeMBLayer().
| int writeCoeff16x16 | ( | Slice * | currSlice, | |
| Macroblock * | currMB, | |||
| ColorPlane | plane, | |||
| int | cbp | |||
| ) |
Write Luma Coeffcients, as well as Cb and Cr Coefficients in the case of 444 common mode, of an macroblock.
Definition at line 2874 of file macroblock.c.
References assignSE2partition, macroblock::b8mode, macroblock::bitcounter, ImageParameters::cofAC, ImageParameters::cofDC, syntaxelement::context, ImageParameters::is_intra_block, syntaxelement::len, macroblock::luma_transform_size_8x8_flag, macroblock::mb_nr, macroblock::mb_type, ImageParameters::nz_coeff, ImageParameters::P444_joined, Slice::partArr, InputParameters::partition_mode, reset_mb_nz_coeff(), ImageParameters::subblock_x, ImageParameters::subblock_y, Slice::symbol_mode, syntaxelement::type, syntaxelement::value1, syntaxelement::value2, writeCoeff4x4_CAVLC(), writeCoeff8x8(), and writeRunLevel_CABAC().
Referenced by writeMBLayer().

| int writeCoeff4x4_CABAC | ( | Slice * | currSlice, | |
| Macroblock * | currMB, | |||
| ColorPlane | plane, | |||
| int | b8, | |||
| int | b4, | |||
| int | intra4x4mode | |||
| ) |
Writes Coeffs of an 4x4 block.
Definition at line 2623 of file macroblock.c.
References assignSE2partition, macroblock::bitcounter, ImageParameters::cofAC, syntaxelement::context, ImageParameters::is_intra_block, syntaxelement::len, Slice::partArr, InputParameters::partition_mode, ImageParameters::subblock_x, ImageParameters::subblock_y, syntaxelement::type, syntaxelement::value1, syntaxelement::value2, and writeRunLevel_CABAC().
Referenced by RDCost_for_4x4IntraBlocks(), and writeCoeff8x8().

| int writeCoeff4x4_CAVLC | ( | Slice * | currSlice, | |
| Macroblock * | currMB, | |||
| int | block_type, | |||
| int | b8, | |||
| int | b4, | |||
| int | param | |||
| ) |
Writes coeff of an 4x4 block (CAVLC).
Definition at line 3234 of file macroblock.c.
References assignSE2partition, macroblock::bitcounter, ImageParameters::cofAC, ImageParameters::cofDC, error(), syntaxelement::len, macroblock::mb_nr, ImageParameters::num_cdc_coeff, ImageParameters::nz_coeff, Slice::partArr, InputParameters::partition_mode, 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().
Referenced by RDCost_for_4x4IntraBlocks(), RDCost_for_8x8IntraBlocks(), writeChromaCoeff(), writeCoeff16x16(), and writeCoeff8x8().

| int writeCoeff8x8 | ( | Slice * | currSlice, | |
| Macroblock * | currMB, | |||
| ColorPlane | pl, | |||
| int | block8x8, | |||
| int | block_mode, | |||
| int | transform_size_flag | |||
| ) |
Writes Luma Coeff of an 8x8 block.
Definition at line 2753 of file macroblock.c.
References Slice::symbol_mode, writeCoeff4x4_CABAC(), writeCoeff4x4_CAVLC(), and writeCoeff8x8_CABAC().
Referenced by RDCost_for_8x8blocks(), and writeCoeff16x16().

| int writeCoeff8x8_CABAC | ( | Slice * | currSlice, | |
| Macroblock * | currMB, | |||
| ColorPlane | plane, | |||
| int | b8, | |||
| int | intra_mode | |||
| ) |
Writes coefficients of an 8x8 block (CABAC).
Definition at line 2687 of file macroblock.c.
References assignSE2partition, macroblock::bitcounter, ImageParameters::cofAC, syntaxelement::context, ImageParameters::is_intra_block, syntaxelement::len, Slice::partArr, InputParameters::partition_mode, ImageParameters::subblock_x, ImageParameters::subblock_y, ImageParameters::type, syntaxelement::type, syntaxelement::value1, syntaxelement::value2, and writeRunLevel_CABAC().
Referenced by RDCost_for_8x8IntraBlocks(), and writeCoeff8x8().

| int writeIntra4x4Modes | ( | Slice * | currSlice, | |
| Macroblock * | currMB | |||
| ) |
Writes 4x4 intra prediction modes for a macroblock.
Definition at line 1572 of file macroblock.c.
References assignSE2partition, macroblock::bitcounter, syntaxelement::context, macroblock::intra_pred_modes, macroblock::IntraChromaPredModeFlag, syntaxelement::len, Slice::partArr, InputParameters::partition_mode, syntaxelement::type, syntaxelement::value1, and syntaxelement::value2.
| int writeIntra8x8Modes | ( | Slice * | currSlice, | |
| Macroblock * | currMB | |||
| ) |
Writes 8x8 intra prediction modes for a macroblock.
Definition at line 1617 of file macroblock.c.
References assignSE2partition, macroblock::bitcounter, syntaxelement::context, macroblock::intra_pred_modes8x8, macroblock::IntraChromaPredModeFlag, syntaxelement::len, Slice::partArr, InputParameters::partition_mode, syntaxelement::type, syntaxelement::value1, and syntaxelement::value2.
| int writeMBLayer | ( | Slice * | currSlice, | |
| Macroblock * | currMB, | |||
| int | rdopt, | |||
| int * | coeff_rate | |||
| ) |
Codes macroblock header.
| currSlice | current slice | |
| currMB | current macroblock | |
| rdopt | true for calls during RD-optimization | |
| coeff_rate | bitrate of Luma and Chroma coeff |
Definition at line 1768 of file macroblock.c.
References arienco_bits_written(), arienco_done_encoding(), arienco_start_encoding(), assignSE2partition, macroblock::b8mode, B8Mode2Value(), macroblock::b8pdir, macroblock::bitcounter, datapartition::bitstream, Bitstream::byte_pos, macroblock::c_ipred_mode, macroblock::cbp, CheckAvailabilityOfNeighborsCABAC(), ImageParameters::cod_counter, ImageParameters::current_mb_nr, datapartition::ee_cabac, field_flag_inference(), FmoGetNextMBNr(), FmoGetPreviousMBNr(), storable_picture::imgUV, storable_picture::imgY, macroblock::IntraChromaPredModeFlag, syntaxelement::len, macroblock::luma_transform_size_8x8_flag, ImageParameters::mb_data, macroblock::mb_field, macroblock::mb_nr, macroblock::mb_type, ImageParameters::mb_x, ImageParameters::mb_y, ImageParameters::MbaffFrameFlag, MBType2Value(), macroblock::NoMbPartLessThan8x8Flag, Slice::partArr, InputParameters::partition_mode, macroblock::PrevMB, reset_mb_nz_coeff(), macroblock::skip_flag, Bitstream::streamBuffer, Slice::symbol_mode, InputParameters::Transform8x8Mode, syntaxelement::type, ImageParameters::type, syntaxelement::value1, syntaxelement::value2, writeCBPandDquant(), writeChromaCoeff(), writeChromaIntraPredMode(), writeCoeff16x16(), writeMB_skip_flagInfo_CABAC(), writeMotionInfo2NAL(), writeSE_Flag(), writeSE_UVLC(), YUV400, and YUV444.
Referenced by RDCost_for_macroblocks(), and write_macroblock().

| int writeMotionInfo2NAL | ( | Slice * | currSlice, | |
| Macroblock * | currMB | |||
| ) | [static] |
Writes motion info.
Definition at line 2365 of file macroblock.c.
References macroblock::b8mode, macroblock::b8pdir, macroblock::bipred_me, InputParameters::blc_size, ImageParameters::block_x, ImageParameters::block_y, macroblock::mb_type, storable_picture::motion, pic_motion_params::ref_idx, Slice::symbol_mode, ImageParameters::type, writeMotionVector8x8(), writeReferenceFrame(), and ZeroRef().
Referenced by writeMBLayer().

| int writeMotionVector8x8 | ( | Slice * | currSlice, | |
| 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 2276 of file macroblock.c.
References ImageParameters::all_mv, assignSE2partition, ImageParameters::bipred_mv, macroblock::bitcounter, ImageParameters::block_x, ImageParameters::block_y, get_neighbors(), GetMotionVectorPredictor(), is_bipred_enabled(), syntaxelement::len, storable_picture::motion, pic_motion_params::mv, macroblock::mvd, InputParameters::part_size, Slice::partArr, InputParameters::partition_mode, pic_motion_params::ref_idx, ImageParameters::subblock_x, ImageParameters::subblock_y, syntaxelement::type, syntaxelement::value1, syntaxelement::value2, and macroblock::write_mb.
Referenced by RDCost_for_8x8blocks(), and writeMotionInfo2NAL().

| int writeReferenceFrame | ( | Slice * | currSlice, | |
| Macroblock * | currMB, | |||
| int | mode, | |||
| int | i, | |||
| int | j, | |||
| int | fwd_flag, | |||
| int | ref | |||
| ) |
Codes the reference frame.
Definition at line 2238 of file macroblock.c.
References assignSE2partition, macroblock::bitcounter, macroblock::list_offset, Slice::partArr, InputParameters::partition_mode, ImageParameters::subblock_x, ImageParameters::subblock_y, syntaxelement::type, syntaxelement::value1, and syntaxelement::value2.
Referenced by RDCost_for_8x8blocks(), and writeMotionInfo2NAL().
| int ZeroRef | ( | Macroblock * | currMB | ) |
Check if all reference frames for a macroblock are zero.
Definition at line 1503 of file macroblock.c.
References ImageParameters::block_x, ImageParameters::block_y, storable_picture::motion, and pic_motion_params::ref_idx.
Referenced by MBType2Value(), 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 66 of file macroblock.c.
| ColocatedParams* Co_located_JV[MAX_PLANE] |
| const byte QP_SCALE_CR[52] |
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 58 of file macroblock.c.
| const unsigned char subblk_offset_x[3][8][4] |
look up tables for FRExt_chroma support
Definition at line 115 of file macroblock.c.
Referenced by dct_chroma(), and IntraChromaPrediction().