macroblock.h File Reference

Arrays for macroblock processing. More...

#include "block.h"
#include "macroblock_p444.h"

Include dependency graph for macroblock.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void next_macroblock (Macroblock *currMB)
void start_macroblock (Slice *currSlice, Macroblock **currMB, int mb_addr, Boolean mb_field)
void reset_macroblock (Macroblock *currMB)
void end_macroblock (Macroblock *currMB, Boolean *end_of_slice, Boolean *recode_macroblock)
void write_macroblock (Macroblock *currMB, int eos_bit, Boolean prev_recode_mb)
int luma_residual_coding_16x16 (Macroblock *currMB, int, int[2])
int luma_residual_coding_8x8 (Macroblock *currMB, int *, int64 *, int, short, int[2], char *)
void luma_residual_coding (Macroblock *currMB)
void chroma_residual_coding (Macroblock *currMB)
void intra_chroma_RD_decision (Macroblock *currMB, RD_PARAMS)
byte TransformDecision (Macroblock *currMB, int, int *)
int B8Mode2Value (Slice *currSlice, short b8mode, short b8pdir)
int writeMBLayerPSlice (Macroblock *currMB, int rdopt, int *coeff_rate)
int writeMBLayerBSlice (Macroblock *currMB, int rdopt, int *coeff_rate)
int writeMBLayerISlice (Macroblock *currMB, int rdopt, int *coeff_rate)
void write_terminating_bit (Slice *currSlice, short bit)
int writeMotionInfo2NAL (Macroblock *currMB)
int write_pslice_motion_info_to_NAL (Macroblock *currMB)
int write_bslice_motion_info_to_NAL (Macroblock *currMB)
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 writeCoeff4x4_CABAC (Macroblock *currMB, ColorPlane, int, int, int)
int writeCoeff8x8_CABAC (Macroblock *currMB, ColorPlane, int, int)
int writeCoeff8x8 (Macroblock *currMB, ColorPlane, int, int, int)
int writeCoeff16x16_CABAC (Macroblock *currMB, ColorPlane)
int writeCoeff16x16_CAVLC (Macroblock *currMB, ColorPlane)
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_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)
int distI16x16_satd (Macroblock *currMB, imgpel **img_org, imgpel **pred_img, double min_cost)
double find_sad_16x16_JM (Macroblock *currMB)
int predict_nnz (Macroblock *currMB, int block_type, int i, int j)
int predict_nnz_chroma (Macroblock *currMB, int i, int j)
void SetLagrangianMultipliersOn (ImageParameters *p_Img, InputParameters *p_Inp)
void SetLagrangianMultipliersOff (ImageParameters *p_Img, InputParameters *p_Inp)
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_b_slice (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)

Variables

static const short part_size [8][2]
static const short block_size [8][2]


Detailed Description

Arrays for macroblock processing.

macroblock.h

Author:
Inge Lille-Langoy <inge.lille-langoy@telenor.com>
Telenor Satellite Services
P.O.Box 6914 St.Olavs plass
N-0130 Oslo, Norway

Definition in file macroblock.h.


Function Documentation

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 chroma_residual_coding ( Macroblock currMB  ) 

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

Parameters:
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().

Here is the call graph for this function:

double find_sad_16x16_JM ( Macroblock currMB  ) 

Find best 16x16 based intra mode.

Input:
Image parameters, pointer to best 16x16 intra mode
Output:
best 16x16 based SAD

< 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   
)

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  ) 

int luma_residual_coding_16x16 ( Macroblock currMB,
int  block8x8,
int  list_mode[2] 
)

Residual Coding of an 8x8 Luma block (not for intra).

Returns:
coefficient cost
Parameters:
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().

Here is the call graph for this function:

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).

Returns:
coefficient cost
Parameters:
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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

void reset_macroblock ( Macroblock currMB  ) 

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.

void start_macroblock ( Slice currSlice,
Macroblock **  currMB,
int  mb_addr,
Boolean  mb_field 
)

byte TransformDecision ( Macroblock currMB,
int  ,
int *   
)

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

void write_macroblock ( Macroblock currMB,
int  eos_bit,
Boolean  prev_recode_mb 
)

int write_pslice_motion_info_to_NAL ( Macroblock currMB  ) 

int writeCoeff16x16_CABAC ( Macroblock currMB,
ColorPlane   
)

int writeCoeff16x16_CAVLC ( Macroblock currMB,
ColorPlane   
)

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().

Here is the call graph for this function:

int writeCoeff4x4_CABAC ( Macroblock currMB,
ColorPlane  ,
int  ,
int  ,
int   
)

int writeCoeff4x4_CAVLC_444 ( Macroblock currMB,
int  block_type,
int  b8,
int  b4,
int  param 
)

int writeCoeff4x4_CAVLC_normal ( Macroblock currMB,
int  block_type,
int  b8,
int  b4,
int  param 
)

int writeCoeff8x8 ( Macroblock currMB,
ColorPlane  ,
int  ,
int  ,
int   
)

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().

Here is the call graph for this function:

int writeCoeff8x8_CABAC ( Macroblock currMB,
ColorPlane  ,
int  ,
int   
)

int writeMBLayerBSlice ( Macroblock currMB,
int  rdopt,
int *  coeff_rate 
)

int writeMBLayerPSlice ( Macroblock currMB,
int  rdopt,
int *  coeff_rate 
)

int writeMotionInfo2NAL ( Macroblock currMB  ) 

int writeMotionVector8x8 ( Macroblock currMB,
int  i0,
int  j0,
int  i1,
int  j1,
int  refframe,
int  list_idx,
int  mv_mode,
short  bipred_me 
)

int writeReferenceFrame ( Macroblock currMB,
int  i,
int  j,
int  list_idx,
int  ref 
)


Variable Documentation

const short block_size[8][2] [static]

Initial value:

 
{
  {16, 16},
  {16, 16},
  {16, 8},
  {8, 16},
  {8, 8},
  {8, 4},
  {4, 8},
  {4, 4}
}

Definition at line 37 of file macroblock.h.

const short part_size[8][2] [static]

Initial value:

 
{
  {4, 4},
  {4, 4},
  {4, 2},
  {2, 4},
  {2, 2},
  {2, 1},
  {1, 2},
  {1, 1}
}

Definition at line 25 of file macroblock.h.


Documentation generated with DoxyGen