00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef _RDO_H_
00018 #define _RDO_H_
00019
00020 #include "global.h"
00021 #include "rdopt_coding_state.h"
00022
00023
00024 typedef struct
00025 {
00026 double rdcost;
00027 double dcost;
00028 double rate;
00029 int cbp;
00030 int cost;
00031 short c_imode;
00032 short i16offset;
00033 byte mode;
00034 } BestMode;
00035
00036 struct rdo_structure
00037 {
00038 RD_8x8DATA *tr4x4;
00039 RD_8x8DATA *tr8x8;
00040 imgpel ***rec8x8;
00041 imgpel ***rec4x4;
00042 imgpel **pred;
00043 imgpel ***rec_mb;
00044 int **lrec_rec;
00045 int ***lrec_rec_uv;
00046
00047 int ****cofAC;
00048 int ***cofDC;
00049 int **cofAC4x4;
00050 int ****cofAC4x4intern;
00051
00052 short *****all_mv8x8;
00053
00054 int *****cofAC4x4CbCrintern;
00055 int *****cofAC8x8ts;
00056 int *****coefAC8x8;
00057 int *****coefAC8x8intra;
00058 int **cofAC4x4CbCr[2];
00059
00060
00061 int cbp;
00062 char **l0_refframe;
00063 char **l1_refframe;
00064
00065 Info8x8 best8x8[4];
00066
00067 CSobj *cs_mb;
00068 CSobj *cs_b8;
00069 CSobj *cs_cm;
00070 CSobj *cs_tmp;
00071
00072 BestMode mode_best;
00073
00074
00075 double lambda_mf_factor;
00076 };
00077
00078
00079 extern int GetBestTransformP8x8 (Macroblock *currMB);
00080 extern byte field_flag_inference (Macroblock *currMB);
00081
00082 extern double rdcost_for_4x4_intra_blocks (Macroblock *currMB, int* nonzero, int b8, int b4, int ipmode, double lambda, int mostProbableMode, double min_rdcost);
00083 extern double rdcost_for_4x4_intra_blocks_444 (Macroblock *currMB, int* nonzero, int b8, int b4, int ipmode, double lambda, int mostProbableMode, double min_rdcost);
00084
00085 extern int valid_intra_mode(Slice *currSlice, int ipmode);
00086
00087 extern void init_md_best(BestMode *best);
00088
00089 extern void generate_pred_error_4x4(imgpel **cur_img, imgpel **prd_img, imgpel **cur_prd,
00090 int **mb_rres, int pic_opix_x, int block_x);
00091 extern void generate_pred_error_8x8(imgpel **cur_img, imgpel **prd_img, imgpel **cur_prd,
00092 int **mb_rres, int pic_opix_x, int block_x);
00093
00094
00095 extern void clear_rdopt (Slice *currSlice);
00096 extern void init_rdopt (Slice *currSlice);
00097
00098 extern void UpdatePixelMap(ImageParameters *p_Img, InputParameters *p_Inp);
00099
00100 extern void update_qp_cbp (Macroblock *currMB);
00101 extern void update_qp_cbp_tmp (Macroblock *currMB, int cbp);
00102
00103 extern void alloc_rd8x8data (RD_8x8DATA *rd_data);
00104 extern void free_rd8x8data (RD_8x8DATA *rd_data);
00105
00106 extern void restore_nz_coeff(Macroblock *currMB);
00107
00108 extern void end_encode_one_macroblock(Macroblock *currMB);
00109
00110 extern void encode_one_macroblock_low (Macroblock *currMB);
00111 extern void encode_one_macroblock_high (Macroblock *currMB);
00112 extern void encode_one_macroblock_highfast (Macroblock *currMB);
00113 extern void encode_one_macroblock_highloss (Macroblock *currMB);
00114
00115
00116
00117
00118
00119
00120
00121
00122 static inline void copy_4x4block(imgpel **oblock, imgpel **iblock, int o_xoffset, int i_xoffset)
00123 {
00124 int y;
00125 for (y = 0; y < BLOCK_SIZE; y++)
00126 {
00127 memcpy(&oblock[y][o_xoffset],&iblock[y][i_xoffset], BLOCK_SIZE * sizeof(imgpel));
00128 }
00129 }
00130
00131 #endif
00132