00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef _MACROBLOCK_H_
00019 #define _MACROBLOCK_H_
00020
00021 #include "block.h"
00022 #include "macroblock_p444.h"
00023
00024
00025 static const short part_size[8][2] =
00026 {
00027 {4, 4},
00028 {4, 4},
00029 {4, 2},
00030 {2, 4},
00031 {2, 2},
00032 {2, 1},
00033 {1, 2},
00034 {1, 1}
00035 };
00036
00037 static const short block_size[8][2] =
00038 {
00039 {16, 16},
00040 {16, 16},
00041 {16, 8},
00042 {8, 16},
00043 {8, 8},
00044 {8, 4},
00045 {4, 8},
00046 {4, 4}
00047 };
00048
00049 extern void next_macroblock (Macroblock* currMB);
00050 extern void start_macroblock (Slice *currSlice, Macroblock** currMB, int mb_addr, Boolean mb_field);
00051 extern void reset_macroblock (Macroblock *currMB);
00052 extern void end_macroblock (Macroblock* currMB, Boolean *end_of_slice, Boolean *recode_macroblock);
00053 extern void write_macroblock (Macroblock* currMB, int eos_bit, Boolean prev_recode_mb);
00054
00055
00056 extern int luma_residual_coding_16x16 (Macroblock* currMB, int, int[2]);
00057 extern int luma_residual_coding_8x8 (Macroblock* currMB, int*, int64*, int, short, int[2], char *);
00058 extern void luma_residual_coding (Macroblock *currMB);
00059 extern void chroma_residual_coding (Macroblock *currMB);
00060 extern void intra_chroma_RD_decision (Macroblock *currMB, RD_PARAMS);
00061
00062 extern byte TransformDecision (Macroblock *currMB, int, int*);
00063
00064 extern int B8Mode2Value (Slice *currSlice, short b8mode, short b8pdir);
00065
00066 extern int writeMBLayerPSlice (Macroblock *currMB, int rdopt, int *coeff_rate);
00067 extern int writeMBLayerBSlice (Macroblock *currMB, int rdopt, int *coeff_rate);
00068 extern int writeMBLayerISlice (Macroblock *currMB, int rdopt, int *coeff_rate);
00069
00070 extern void write_terminating_bit (Slice* currSlice, short bit);
00071
00072 extern int writeMotionInfo2NAL (Macroblock* currMB);
00073 extern int write_pslice_motion_info_to_NAL (Macroblock* currMB);
00074 extern int write_bslice_motion_info_to_NAL (Macroblock* currMB);
00075 extern int write_pslice_motion_info_to_NAL (Macroblock* currMB);
00076 extern int writeReferenceFrame (Macroblock *currMB, int i, int j, int list_idx, int ref);
00077 extern int writeMotionVector8x8 (Macroblock *currMB, int i0, int j0, int i1, int j1, int refframe, int list_idx, int mv_mode, short bipred_me);
00078
00079 extern int writeCoeff4x4_CABAC (Macroblock *currMB, ColorPlane, int, int, int);
00080 extern int writeCoeff8x8_CABAC (Macroblock* currMB, ColorPlane, int, int);
00081 extern int writeCoeff8x8 (Macroblock* currMB, ColorPlane, int, int, int);
00082 extern int writeCoeff16x16_CABAC (Macroblock* currMB, ColorPlane);
00083 extern int writeCoeff16x16_CAVLC (Macroblock* currMB, ColorPlane);
00084
00085 extern int writeCoeff4x4_CAVLC_normal (Macroblock* currMB, int block_type, int b8, int b4, int param);
00086 extern int writeCoeff4x4_CAVLC_444 (Macroblock* currMB, int block_type, int b8, int b4, int param);
00087
00088 extern int distI16x16_sad (Macroblock *currMB, imgpel **img_org, imgpel **pred_img, double min_cost);
00089 extern int distI16x16_sse (Macroblock *currMB, imgpel **img_org, imgpel **pred_img, double min_cost);
00090 extern int distI16x16_satd (Macroblock *currMB, imgpel **img_org, imgpel **pred_img, double min_cost);
00091 extern double find_sad_16x16_JM (Macroblock *currMB);
00092
00093 extern int predict_nnz (Macroblock *currMB, int block_type, int i,int j);
00094 extern int predict_nnz_chroma(Macroblock *currMB, int i,int j);
00095
00096 extern void SetLagrangianMultipliersOn (ImageParameters *p_Img, InputParameters *p_Inp);
00097 extern void SetLagrangianMultipliersOff(ImageParameters *p_Img, InputParameters *p_Inp);
00098
00099 extern void set_modes_and_reframe (Macroblock* currMB, int b8, short* p_dir, int list_mode[2], char *list_ref_idx);
00100 extern void set_modes_and_reframe_b_slice (Macroblock* currMB, int b8, short* p_dir, int list_mode[2], char *list_ref_idx);
00101 extern void set_modes_and_reframe_p_slice (Macroblock* currMB, int b8, short* p_dir, int list_mode[2], char *list_ref_idx);
00102
00103
00104 #endif
00105