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 #include "typedefs.h"
00025
00026 #if defined _DEBUG
00027 # define TRACE 0
00028 #else
00029 # define TRACE 0
00030 #endif
00031
00032 #define JM "16 (FRExt)"
00033 #define VERSION "16.0"
00034 #define EXT_VERSION "(FRExt)"
00035
00036 #define GET_METIME 1
00037 #define DUMP_DPB 0
00038 #define IMGTYPE 1
00039 #define ENABLE_FIELD_CTX 1
00040 #define ENABLE_HIGH444_CTX 1
00041 #define DEBUG_BITDEPTH 0
00042 #define ALLOW_GRAYSCALE 1
00043 #define ZEROSNR 1
00044 #define PAD_AFTER 0
00045 #define USE_RND_COST 0
00046 #define JM_INT_DIVIDE 1
00047 #define JM_MEM_DISTORTION 0
00048 #define JCOST_CALC_SCALEUP 0
00049 #define INTRA_RDCOSTCALC_EARLY_TERMINATE 1
00050 #define INTRA_RDCOSTCALC_NNZ 1 //1: to recover block's nzn after rdcost calculation;
00051
00052 #define EPZSREF 1
00053
00054 #define MAX_RC_MODE 3
00055 #define RC_MAX_TEMPORAL_LEVELS 5
00056
00057
00058
00059
00060 enum {
00061 FREXT_CAVLC444 = 44,
00062 BASELINE = 66,
00063 MAIN = 77,
00064 EXTENDED = 88,
00065 FREXT_HP = 100,
00066 FREXT_Hi10P = 110,
00067 FREXT_Hi422 = 122,
00068 FREXT_Hi444 = 244
00069 } ProfileIDC;
00070
00071 #define SSE_MEMORY_ALIGNMENT 16
00072
00073
00074 #include "types.h"
00075
00076 #define FILE_NAME_SIZE 255
00077 #define INPUT_TEXT_SIZE 1024
00078
00079 #define CAVLC_LEVEL_LIMIT 2063
00080
00081 #if (ENABLE_HIGH444_CTX == 1)
00082 # define NUM_BLOCK_TYPES 22
00083 #else
00084 # define NUM_BLOCK_TYPES 10
00085 #endif
00086
00087 #define _LEAKYBUCKET_
00088
00089
00090
00091
00092
00093 #define _LUMA_COEFF_COST_ 4
00094 #define _CHROMA_COEFF_COST_ 4
00095 #define _LUMA_MB_COEFF_COST_ 5
00096 #define _LUMA_8x8_COEFF_COST_ 5
00097
00098 #define IMG_PAD_SIZE 20
00099 #define IMG_PAD_SIZE_TIMES4 80
00100
00101
00102 #define MAX_VALUE 999999
00103 #define INVALIDINDEX (-135792468)
00104
00105 #define DUMMY 14
00106 #define ET_SIZE 300
00107
00108
00109 #define LAMBDA_ACCURACY_BITS 16
00110 #define LAMBDA_FACTOR(lambda) ((int)((double)(1 << LAMBDA_ACCURACY_BITS) * lambda + 0.5))
00111 #if JCOST_CALC_SCALEUP
00112 #define WEIGHTED_COST(factor,bits) ((factor) * (bits))
00113 #else
00114 #define WEIGHTED_COST(factor,bits) (((factor) * (bits)) >> LAMBDA_ACCURACY_BITS)
00115 #endif
00116
00117 #define MAXSLICEPERPICTURE 100
00118 #define MAX_REFERENCE_PICTURES 32
00119
00120 #define BLOCK_SHIFT 2
00121 #define BLOCK_SIZE 4
00122 #define BLOCK_SIZE_8x8 8
00123 #define SMB_BLOCK_SIZE 8
00124 #define BLOCK_PIXELS 16
00125 #define MB_BLOCK_SIZE 16
00126 #define MB_PIXELS 256 // MB_BLOCK_SIZE * MB_BLOCK_SIZE
00127 #define MB_PIXELS_SHIFT 8 // log2(MB_BLOCK_SIZE * MB_BLOCK_SIZE)
00128 #define MB_BLOCK_SHIFT 4
00129 #define BLOCK_MULTIPLE 4 // (MB_BLOCK_SIZE/BLOCK_SIZE)
00130 #define MB_BLOCK_PARTITIONS 16 // (BLOCK_MULTIPLE * BLOCK_MULTIPLE)
00131 #define BLOCK_CONTEXT 64 // (4 * MB_BLOCK_PARTITIONS)
00132
00133 #define BLOCK_SIZE_SP 16 // BLOCK_SIZE << 2
00134 #define BLOCK_SIZE_8x8_SP 32 // BLOCK_SIZE8x8 << 2
00135
00136
00137 #define MAX_PREC_COEFF 25
00138
00139 #if (IMGTYPE == 0)
00140 typedef byte imgpel;
00141 typedef uint16 distpel;
00142
00143 #else
00144 typedef uint16 imgpel;
00145 typedef uint32 distpel;
00146
00147 #endif
00148
00149
00150 enum {
00151 PSKIP = 0,
00152 BSKIP_DIRECT = 0,
00153 P16x16 = 1,
00154 P16x8 = 2,
00155 P8x16 = 3,
00156 SMB8x8 = 4,
00157 SMB8x4 = 5,
00158 SMB4x8 = 6,
00159 SMB4x4 = 7,
00160 P8x8 = 8,
00161 I4MB = 9,
00162 I16MB = 10,
00163 IBLOCK = 11,
00164 SI4MB = 12,
00165 I8MB = 13,
00166 IPCM = 14,
00167 MAXMODE = 15
00168 } MBModeTypes;
00169
00170
00171 #define NO_INTRA_PMODE 9
00172
00173
00174 enum {
00175 DIR_TEMPORAL = 0,
00176 DIR_SPATIAL = 1
00177 } DirectModes;
00178
00179
00180 enum {
00181 LUMA = 0,
00182 LUMA_INTRA16x16DC = 1,
00183 LUMA_INTRA16x16AC = 2,
00184 CB = 3,
00185 CB_INTRA16x16DC = 4,
00186 CB_INTRA16x16AC = 5,
00187 CR = 8,
00188 CR_INTRA16x16DC = 9,
00189 CR_INTRA16x16AC = 10
00190 } CAVLCBlockTypes;
00191
00192
00193 enum {
00194 LUMA_16DC = 0,
00195 LUMA_16AC = 1,
00196 LUMA_8x8 = 2,
00197 LUMA_8x4 = 3,
00198 LUMA_4x8 = 4,
00199 LUMA_4x4 = 5,
00200 CHROMA_DC = 6,
00201 CHROMA_AC = 7,
00202 CHROMA_DC_2x4 = 8,
00203 CHROMA_DC_4x4 = 9,
00204 CB_16DC = 10,
00205 CB_16AC = 11,
00206 CB_8x8 = 12,
00207 CB_8x4 = 13,
00208 CB_4x8 = 14,
00209 CB_4x4 = 15,
00210 CR_16DC = 16,
00211 CR_16AC = 17,
00212 CR_8x8 = 18,
00213 CR_8x4 = 19,
00214 CR_4x8 = 20,
00215 CR_4x4 = 21
00216 } CABACBlockTypes;
00217
00218
00219 #define IS_INTRA(MB) ((MB)->mb_type==I4MB || (MB)->mb_type==I16MB || (MB)->mb_type==I8MB || (MB)->mb_type==IPCM)
00220
00221 #define LEVEL_NUM 6
00222 #define TOTRUN_NUM 15
00223 #define RUNBEFORE_NUM 7
00224 #define RUNBEFORE_NUM_M1 6
00225
00226
00227 #define MIN_QP 0
00228 #define MAX_QP 51
00229 #define SHIFT_QP 12
00230
00231
00232 enum {
00233 VERT_PRED = 0,
00234 HOR_PRED = 1,
00235 DC_PRED = 2,
00236 DIAG_DOWN_LEFT_PRED = 3,
00237 DIAG_DOWN_RIGHT_PRED = 4,
00238 VERT_RIGHT_PRED = 5,
00239 HOR_DOWN_PRED = 6,
00240 VERT_LEFT_PRED = 7,
00241 HOR_UP_PRED = 8
00242 } I4x4PredModes;
00243
00244
00245 enum {
00246 VERT_PRED_16 = 0,
00247 HOR_PRED_16 = 1,
00248 DC_PRED_16 = 2,
00249 PLANE_16 = 3
00250 } I16x16PredModes;
00251
00252
00253 enum {
00254 DC_PRED_8 = 0,
00255 HOR_PRED_8 = 1,
00256 VERT_PRED_8 = 2,
00257 PLANE_8 = 3
00258 } I8x8PredModes;
00259
00260 #define INIT_FRAME_RATE 30
00261 enum {
00262 EOS = 1,
00263 SOP = 2,
00264 SOS = 3
00265 };
00266
00267
00268 enum {
00269 MVPRED_MEDIAN = 0,
00270 MVPRED_L = 1,
00271 MVPRED_U = 2,
00272 MVPRED_UR = 3
00273 } MVPredTypes;
00274
00275 #define MAX_SYMBOLS_PER_MB 1200
00276 // CAVLC needs more symbols per MB
00277
00278
00279 #define MAX_PART_NR 3
00280
00281
00282
00283
00284 #define ZEROBYTES_SHORTSTARTCODE 2 //indicates the number of zero bytes in the short start-code prefix
00285
00286 #define Q_BITS 15
00287 #define DQ_BITS 6
00288
00289 #define Q_BITS_8 16
00290 #define DQ_BITS_8 6
00291
00292
00293 #define CALM_MF_FACTOR_THRESHOLD 512.0
00294
00295 #define MAX_PLANE 3
00296 #define IS_INDEPENDENT(IMG) ((IMG)->separate_colour_plane_flag)
00297 #define IS_FREXT_PROFILE(profile_idc) ( profile_idc>=FREXT_HP || profile_idc == FREXT_CAVLC444 )
00298
00299 #define MAXSLICEGROUPIDS 8
00300
00301
00302 #define NUM_MB_TYPE_CTX 11
00303 #define NUM_B8_TYPE_CTX 9
00304 #define NUM_MV_RES_CTX 10
00305 #define NUM_REF_NO_CTX 6
00306 #define NUM_DELTA_QP_CTX 4
00307 #define NUM_MB_AFF_CTX 4
00308
00309 #define NUM_TRANSFORM_SIZE_CTX 3
00310
00311 #define NUM_IPR_CTX 2
00312 #define NUM_CIPR_CTX 4
00313 #define NUM_CBP_CTX 4
00314 #define NUM_BCBP_CTX 4
00315 #define NUM_MAP_CTX 15
00316 #define NUM_LAST_CTX 15
00317 #define NUM_ONE_CTX 5
00318 #define NUM_ABS_CTX 5
00319
00320
00321 #endif
00322