00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _DEFINES_H_
00022 #define _DEFINES_H_
00023
00024 #if defined _DEBUG
00025 # define TRACE 0
00026 #else
00027 # define TRACE 0
00028 #endif
00029
00030 #define JM "15 (FRExt)"
00031 #define VERSION "15.1"
00032 #define EXT_VERSION "(FRExt)"
00033
00034 #define GET_METIME 1
00035 #define DUMP_DPB 0
00036 #define IMGTYPE 1
00037 #define ENABLE_FIELD_CTX 1
00038 #define ENABLE_HIGH444_CTX 1
00039 #define DEBUG_BITDEPTH 0
00040 #define ALLOW_GRAYSCALE 0
00041 #define ZEROSNR 1
00042
00043 #define MAX_RC_MODE 3
00044 #define RC_MAX_TEMPORAL_LEVELS 5
00045
00046
00047
00048
00049 #define BASELINE 66
00050 #define MAIN 77
00051 #define EXTENDED 88
00052 #define FREXT_HP 100
00053 #define FREXT_Hi10P 110
00054 #define FREXT_Hi422 122
00055 #define FREXT_Hi444 244
00056 #define FREXT_CAVLC444 44
00057
00058
00059 #define FILE_NAME_SIZE 255
00060 #define INPUT_TEXT_SIZE 1024
00061
00062 #define CAVLC_LEVEL_LIMIT 2063
00063
00064 #if (ENABLE_HIGH444_CTX == 1)
00065 # define NUM_BLOCK_TYPES 22
00066 #else
00067 # define NUM_BLOCK_TYPES 10
00068 #endif
00069
00070 #define _LEAKYBUCKET_
00071
00072
00073
00074
00075
00076 #define _LUMA_COEFF_COST_ 4
00077 #define _CHROMA_COEFF_COST_ 4
00078 #define _LUMA_MB_COEFF_COST_ 5
00079 #define _LUMA_8x8_COEFF_COST_ 5
00080
00081 #define IMG_PAD_SIZE 20
00082 #define IMG_PAD_SIZE_TIMES4 80
00083
00084
00085 #define MAX_VALUE 999999
00086 #define INVALIDINDEX (-135792468)
00087
00088 #define DUMMY 14
00089
00090
00091 #define LAMBDA_ACCURACY_BITS 16
00092 #define LAMBDA_FACTOR(lambda) ((int)((double)(1 << LAMBDA_ACCURACY_BITS) * lambda + 0.5))
00093 #define WEIGHTED_COST(factor,bits) (((factor) * (bits)) >> LAMBDA_ACCURACY_BITS)
00094
00095 #define MV_COST(f,s,cx,cy,px,py) (WEIGHTED_COST(f,mvbits[((cx) << (s)) - px] + mvbits[((cy) << (s)) - py]))
00096 #define MV_COST_SMP(f,cx,cy,px,py) (WEIGHTED_COST(f,mvbits[cx - px] + mvbits[cy - py]))
00097 #define REF_COST(f,ref,list_offset) (WEIGHTED_COST(f,((listXsize[list_offset]<=1)? 0:refbits[(ref)])))
00098
00099
00100 #define MAX_REFERENCE_PICTURES 32
00101
00102 #define BLOCK_SHIFT 2
00103 #define BLOCK_SIZE 4
00104 #define BLOCK_SIZE_8x8 8
00105 #define SMB_BLOCK_SIZE 8
00106 #define BLOCK_PIXELS 16
00107 #define MB_BLOCK_SIZE 16
00108 #define MB_PIXELS 256 // MB_BLOCK_SIZE * MB_BLOCK_SIZE
00109 #define MB_PIXELS_SHIFT 8 // log2(MB_BLOCK_SIZE * MB_BLOCK_SIZE)
00110 #define MB_BLOCK_SHIFT 4
00111 #define BLOCK_MULTIPLE 4 // (MB_BLOCK_SIZE/BLOCK_SIZE)
00112 #define MB_BLOCK_PARTITIONS 16 // (BLOCK_MULTIPLE * BLOCK_MULTIPLE)
00113 #define BLOCK_CONTEXT 64 // (4 * MB_BLOCK_PARTITIONS)
00114
00115
00116 #define BLOCK_SIZE_SP 16 // BLOCK_SIZE << 2
00117 #define BLOCK_SIZE_8x8_SP 32 // BLOCK_SIZE8x8 << 2
00118
00119
00120 typedef unsigned char byte;
00121 typedef unsigned char uint8;
00122 typedef unsigned short uint16;
00123 typedef unsigned int uint32;
00124
00125 #if (IMGTYPE == 0)
00126 typedef byte imgpel;
00127 typedef unsigned short distpel;
00128 #else
00129 typedef unsigned short imgpel;
00130 typedef int distpel;
00131 #endif
00132
00133
00134 enum {
00135 PSKIP = 0,
00136 BSKIP_DIRECT = 0,
00137 P16x16 = 1,
00138 P16x8 = 2,
00139 P8x16 = 3,
00140 SMB8x8 = 4,
00141 SMB8x4 = 5,
00142 SMB4x8 = 6,
00143 SMB4x4 = 7,
00144 P8x8 = 8,
00145 I4MB = 9,
00146 I16MB = 10,
00147 IBLOCK = 11,
00148 SI4MB = 12,
00149 I8MB = 13,
00150 IPCM = 14,
00151 MAXMODE = 15
00152 } MBModeTypes;
00153
00154
00155 #define NO_INTRA_PMODE 9
00156
00157
00158 enum {
00159 DIR_TEMPORAL = 0,
00160 DIR_SPATIAL = 1
00161 } DirectModes;
00162
00163
00164 enum {
00165 LUMA = 0,
00166 LUMA_INTRA16x16DC = 1,
00167 LUMA_INTRA16x16AC = 2,
00168 CB = 3,
00169 CB_INTRA16x16DC = 4,
00170 CB_INTRA16x16AC = 5,
00171 CR = 8,
00172 CR_INTRA16x16DC = 9,
00173 CR_INTRA16x16AC = 10
00174 } CAVLCBlockTypes;
00175
00176
00177 enum {
00178 LUMA_16DC = 0,
00179 LUMA_16AC = 1,
00180 LUMA_8x8 = 2,
00181 LUMA_8x4 = 3,
00182 LUMA_4x8 = 4,
00183 LUMA_4x4 = 5,
00184 CHROMA_DC = 6,
00185 CHROMA_AC = 7,
00186 CHROMA_DC_2x4 = 8,
00187 CHROMA_DC_4x4 = 9,
00188 CB_16DC = 10,
00189 CB_16AC = 11,
00190 CB_8x8 = 12,
00191 CB_8x4 = 13,
00192 CB_4x8 = 14,
00193 CB_4x4 = 15,
00194 CR_16DC = 16,
00195 CR_16AC = 17,
00196 CR_8x8 = 18,
00197 CR_8x4 = 19,
00198 CR_4x8 = 20,
00199 CR_4x4 = 21
00200 } CABACBlockTypes;
00201
00202
00203 #define IS_INTRA(MB) ((MB)->mb_type==I4MB || (MB)->mb_type==I16MB || (MB)->mb_type==I8MB || (MB)->mb_type==IPCM)
00204
00205 #define IS_INTER(MB) ((MB)->mb_type!=I4MB && (MB)->mb_type!=I16MB && (MB)->mb_type!=I8MB)
00206 #define IS_INTERMV(MB) ((MB)->mb_type!=I4MB && (MB)->mb_type!=I16MB && (MB)->mb_type!=I8MB && (MB)->mb_type!=0)
00207 #define IS_DIRECT(MB) ((MB)->mb_type==0 && (img->type==B_SLICE))
00208
00209 #define LEVEL_NUM 6
00210 #define TOTRUN_NUM 15
00211 #define RUNBEFORE_NUM 7
00212 #define RUNBEFORE_NUM_M1 6
00213
00214
00215 #define MIN_QP 0
00216 #define MAX_QP 51
00217 #define SHIFT_QP 12
00218
00219
00220 enum {
00221 VERT_PRED = 0,
00222 HOR_PRED = 1,
00223 DC_PRED = 2,
00224 DIAG_DOWN_LEFT_PRED = 3,
00225 DIAG_DOWN_RIGHT_PRED = 4,
00226 VERT_RIGHT_PRED = 5,
00227 HOR_DOWN_PRED = 6,
00228 VERT_LEFT_PRED = 7,
00229 HOR_UP_PRED = 8
00230 } I4x4PredModes;
00231
00232
00233 enum {
00234 VERT_PRED_16 = 0,
00235 HOR_PRED_16 = 1,
00236 DC_PRED_16 = 2,
00237 PLANE_16 = 3
00238 } I16x16PredModes;
00239
00240
00241 enum {
00242 DC_PRED_8 = 0,
00243 HOR_PRED_8 = 1,
00244 VERT_PRED_8 = 2,
00245 PLANE_8 = 3
00246 } I8x8PredModes;
00247
00248 #define INIT_FRAME_RATE 30
00249 enum {
00250 EOS = 1,
00251 SOP = 2,
00252 SOS = 3
00253 };
00254
00255
00256 enum {
00257 MVPRED_MEDIAN = 0,
00258 MVPRED_L = 1,
00259 MVPRED_U = 2,
00260 MVPRED_UR = 3
00261 } MVPredTypes;
00262
00263 #define MAX_SYMBOLS_PER_MB 1200
00264 // CAVLC needs more symbols per MB
00265
00266
00267 #define MAX_PART_NR 3
00268
00269
00270
00271
00272 #define ZEROBYTES_SHORTSTARTCODE 2 //indicates the number of zero bytes in the short start-code prefix
00273
00274 #define Q_BITS 15
00275 #define DQ_BITS 6
00276
00277 #define Q_BITS_8 16
00278 #define DQ_BITS_8 6
00279
00280
00281 #define CALM_MF_FACTOR_THRESHOLD 512.0
00282
00283 #define MAX_PLANE 3
00284 #define IS_INDEPENDENT(IMG) ((IMG)->separate_colour_plane_flag)
00285 #define IS_FREXT_PROFILE(profile_idc) ( profile_idc>=FREXT_HP || profile_idc == FREXT_CAVLC444 )
00286
00287 #endif
00288