00001 /*! 00002 ************************************************************************ 00003 * \file params.h 00004 * 00005 * \brief 00006 * Input parameters related definitions 00007 * 00008 * \author 00009 * 00010 ************************************************************************ 00011 */ 00012 00013 #ifndef _PARAMS_H_ 00014 #define _PARAMS_H_ 00015 #include "types.h" 00016 #include "vui_params.h" 00017 #include "frame.h" 00018 #include "io_video.h" 00019 00020 //! all input parameters 00021 struct inp_par_enc 00022 { 00023 int ProfileIDC; //!< value of syntax element profile_idc 00024 int LevelIDC; //!< value of syntax element level_idc 00025 int IntraProfile; //!< Enable Intra profiles 00026 00027 int no_frm_base; //!< number of frames to be encoded 00028 int no_frames; //!< number of frames to be encoded 00029 int qp[2][NUM_SLICE_TYPES]; //!< QP values for all slice types (first and second group) 00030 int qpsp[2]; //!< QPSP quantization value 00031 int frame_skip; //!< number of frames to skip in input sequence (e.g 2 takes frame 0,3,6,9...) 00032 int jumpd; /*!< number of frames to skip in input sequence including intermediate pictures 00033 (e.g 2 takes frame 0,3,6,9...) */ 00034 int DisableSubpelME; //!< Disable sub-pixel motion estimation 00035 int search_range; /*!< search range - integer pel search and 16x16 blocks. The search window is 00036 generally around the predicted vector. Max vector is 2xmcrange. */ 00037 int num_ref_frames; //!< number of reference frames to be used 00038 int P_List0_refs; //!< number of reference picture in list 0 in P pictures 00039 int B_List0_refs; //!< number of reference picture in list 0 in B pictures 00040 int B_List1_refs; //!< number of reference picture in list 1 in B pictures 00041 int Log2MaxFNumMinus4; //!< value of syntax element log2_max_frame_num 00042 int Log2MaxPOCLsbMinus4; //!< value of syntax element log2_max_pic_order_cnt_lsb_minus4 00043 00044 // Input/output sequence format related variables 00045 FrameFormat source; //!< source related information 00046 FrameFormat output; //!< output related information 00047 int is_interleaved; 00048 int src_resize; //!< Control if input sequence will be resized (currently only cropping is supported) 00049 int src_BitDepthRescale; //!< Control if input sequence bitdepth should be adjusted 00050 int yuv_format; //!< YUV format (0=4:0:0, 1=4:2:0, 2=4:2:2, 3=4:4:4) 00051 int intra_upd; /*!< For error robustness. 0: no special action. 1: One GOB/frame is intra coded 00052 as regular 'update'. 2: One GOB every 2 frames is intra coded etc. 00053 In connection with this intra update, restrictions is put on motion vectors 00054 to prevent errors to propagate from the past */ 00055 00056 int slice_mode; //!< Indicate what algorithm to use for setting slices 00057 int slice_argument; //!< Argument to the specified slice algorithm 00058 int UseConstrainedIntraPred; //!< 0: Inter MB pixels are allowed for intra prediction 1: Not allowed 00059 int SetFirstAsLongTerm; //!< Support for temporal considerations for CB plus encoding 00060 int infile_header; //!< If input file has a header set this to the length of the header 00061 int MultiSourceData; 00062 VideoDataFile input_file2; //!< Input video file2 00063 VideoDataFile input_file3; //!< Input video file3 00064 00065 VideoDataFile input_file1; //!< Input video file1 00066 char outfile [FILE_NAME_SIZE]; //!< H.264 compressed output bitstream 00067 char ReconFile [FILE_NAME_SIZE]; //!< Reconstructed Pictures 00068 char TraceFile [FILE_NAME_SIZE]; //!< Trace Outputs 00069 char StatsFile [FILE_NAME_SIZE]; //!< Stats File 00070 char QmatrixFile [FILE_NAME_SIZE]; //!< Q matrix cfg file 00071 int ProcessInput; //!< Filter Input Sequence 00072 int EnableOpenGOP; //!< support for open gops. 00073 int EnableIDRGOP; //!< support for IDR closed gops with no shared B coded pictures. 00074 int grayscale; //!< encode in grayscale (Currently only works for 8 bit, YUV 420) 00075 00076 int idr_period; //!< IDR picture period 00077 int intra_period; //!< intra picture period 00078 int intra_delay; //!< IDR picture delay 00079 int adaptive_idr_period; 00080 int adaptive_intra_period; //!< reinitialize start of intra period 00081 00082 int start_frame; //!< Encode sequence starting from Frame start_frame 00083 00084 int GenerateMultiplePPS; 00085 int GenerateSEIMessage; 00086 char SEIMessageText[INPUT_TEXT_SIZE]; 00087 00088 int ResendSPS; 00089 int ResendPPS; 00090 00091 int SendAUD; //!< send Access Unit Delimiter NALU 00092 int skip_gl_stats; 00093 00094 // B pictures 00095 int NumberBFrames; //!< number of B frames that will be used 00096 int PReplaceBSlice; 00097 int qpBRSOffset[2]; //!< QP for reference B slice coded pictures 00098 int direct_spatial_mv_pred_flag; //!< Direct Mode type to be used (0: Temporal, 1: Spatial) 00099 int directInferenceFlag; //!< Direct Mode Inference Flag 00100 00101 int BiPredMotionEstimation; //!< Use of Bipredictive motion estimation 00102 int BiPredSearch[4]; //!< Bipredictive motion estimation for modes 16x16, 16x8, 8x16, and 8x8 00103 int BiPredMERefinements; //!< Max number of Iterations for Bi-predictive motion estimation 00104 int BiPredMESearchRange; //!< Search range of Bi-predictive motion estimation 00105 int BiPredMESubPel; //!< Use of subpixel refinement for Bi-predictive motion estimation 00106 00107 // SP/SI Pictures 00108 int sp_periodicity; //!< The periodicity of SP-pictures 00109 00110 int si_frame_indicator; //!< Flag indicating whether SI frames should be encoded rather than SP frames (0: not used, 1: used) 00111 int sp2_frame_indicator; //!< Flag indicating whether switching SP frames should be encoded rather than SP frames (0: not used, 1: used) 00112 int sp_output_indicator; //!< Flag indicating whether coefficients are output to allow future encoding of switchin SP frames (0: not used, 1: used) 00113 char sp_output_filename[FILE_NAME_SIZE]; //!<Filename where SP coefficients are output 00114 char sp2_input_filename1[FILE_NAME_SIZE]; //!<Filename of coefficients of the first bitstream when encoding SP frames to switch bitstreams 00115 char sp2_input_filename2[FILE_NAME_SIZE]; //!<Filenames of coefficients of the second bitstream when encoding SP frames to switch bitstreams 00116 00117 // Weighted Prediction 00118 int WeightedPrediction; //!< Weighted prediction for P frames (0: not used, 1: explicit) 00119 int WeightedBiprediction; //!< Weighted prediction for B frames (0: not used, 1: explicit, 2: implicit) 00120 int WPMethod; //!< WP method (0: DC, 1: LMS) 00121 int WPIterMC; //!< Iterative WP method 00122 int WPMCPrecision; 00123 int WPMCPrecFullRef; 00124 int WPMCPrecBSlice; 00125 int EnhancedBWeightSupport; 00126 int ChromaWeightSupport; //!< Weighted prediction support for chroma (0: disabled, 1: enabled) 00127 int UseWeightedReferenceME; //!< Use Weighted Reference for ME. 00128 int RDPictureDecision; //!< Perform RD optimal decision between various coded versions of same picture 00129 int RDPictureIntra; //!< Enabled RD pic decision for intra as well. 00130 int RDPSliceWeightOnly; //!< If enabled, does not check QP variations for P slices. 00131 int RDPSliceBTest; //!< Tests B slice replacement for P. 00132 int RDBSliceWeightOnly; //!< If enabled, does not check QP variations for B slices. 00133 int SkipIntraInInterSlices; //!< Skip intra type checking in inter slices if best_mode is skip/direct 00134 int BRefPictures; //!< B coded reference pictures replace P pictures (0: not used, 1: used) 00135 int HierarchicalCoding; 00136 int HierarchyLevelQPEnable; 00137 char ExplicitHierarchyFormat[INPUT_TEXT_SIZE]; //!< Explicit GOP format (HierarchicalCoding==3). 00138 // explicit sequence information parameters 00139 int ExplicitSeqCoding; 00140 char ExplicitSeqFile[FILE_NAME_SIZE]; 00141 int ReferenceReorder; //!< Reordering based on Poc distances 00142 int PocMemoryManagement; //!< Memory management based on Poc distances for hierarchical coding 00143 00144 int symbol_mode; //!< Specifies the mode the symbols are mapped on bits 00145 int of_mode; //!< Specifies the mode of the output file 00146 int partition_mode; //!< Specifies the mode of data partitioning 00147 00148 int InterSearch[2][8]; 00149 00150 int DisableIntra4x4; 00151 int DisableIntra16x16; 00152 int FastMDEnable; 00153 int FastIntraMD; 00154 int FastIntra4x4; 00155 int FastIntra16x16; 00156 int FastIntra8x8; 00157 int FastIntraChroma; 00158 00159 int DisableIntraInInter; 00160 int IntraDisableInterOnly; 00161 int Intra4x4ParDisable; 00162 int Intra4x4DiagDisable; 00163 int Intra4x4DirDisable; 00164 int Intra16x16ParDisable; 00165 int Intra16x16PlaneDisable; 00166 int ChromaIntraDisable; 00167 00168 int EnableIPCM; 00169 00170 double FrameRate; 00171 00172 int chroma_qp_index_offset; 00173 int full_search; 00174 int last_frame; 00175 00176 int qp2start; 00177 00178 int rdopt; 00179 int I16rdo; 00180 int subMBCodingState; 00181 int Distortion[TOTAL_DIST_TYPES]; 00182 double VisualResWavPSNR; 00183 int SSIMOverlapSize; 00184 int DistortionYUVtoRGB; 00185 int CtxAdptLagrangeMult; //!< context adaptive lagrangian multiplier 00186 int FastCrIntraDecision; 00187 int disthres; 00188 int nobskip; 00189 int ForceTrueRateRDO; 00190 00191 #ifdef _LEAKYBUCKET_ 00192 int NumberLeakyBuckets; 00193 char LeakyBucketRateFile[FILE_NAME_SIZE]; 00194 char LeakyBucketParamFile[FILE_NAME_SIZE]; 00195 #endif 00196 00197 int PicInterlace; //!< picture adaptive frame/field 00198 int MbInterlace; //!< macroblock adaptive frame/field 00199 int IntraBottom; //!< Force Intra Bottom at GOP periods. 00200 00201 // Error resilient RDO parameters 00202 int LossRateA; //!< assumed loss probablility of partition A (or full slice), in per cent, used for loss-aware R/D optimization 00203 int LossRateB; //!< assumed loss probablility of partition B, in per cent, used for loss-aware R/D 00204 int LossRateC; //!< assumed loss probablility of partition C, in per cent, used for loss-aware R/D 00205 int NoOfDecoders; 00206 int ErrorConcealment; //!< Error concealment method used for loss-aware RDO (0: Copy Concealment) 00207 int RestrictRef; 00208 int NumFramesInELSubSeq; 00209 00210 int RandomIntraMBRefresh; //!< Number of pseudo-random intra-MBs per picture 00211 00212 // Chroma interpolation and buffering 00213 int ChromaMCBuffer; 00214 int ChromaMEEnable; 00215 int ChromaMEWeight; 00216 int MEErrorMetric[3]; 00217 int ModeDecisionMetric; 00218 int SkipDeBlockNonRef; 00219 00220 // Deblocking Filter parameters 00221 int DFSendParameters; 00222 int DFDisableIdc[2][NUM_SLICE_TYPES]; 00223 int DFAlpha [2][NUM_SLICE_TYPES]; 00224 int DFBeta [2][NUM_SLICE_TYPES]; 00225 00226 int SparePictureOption; 00227 int SPDetectionThreshold; 00228 int SPPercentageThreshold; 00229 00230 // FMO 00231 char SliceGroupConfigFileName[FILE_NAME_SIZE]; //!< Filename for config info fot type 0, 2, 6 00232 int num_slice_groups_minus1; //!< "FmoNumSliceGroups" in encoder.cfg, same as FmoNumSliceGroups, which should be erased later 00233 int slice_group_map_type; 00234 00235 int *top_left; //!< top_left and bottom_right store values indicating foregrounds 00236 int *bottom_right; 00237 byte *slice_group_id; //!< slice_group_id is for slice group type being 6 00238 int *run_length_minus1; //!< run_length_minus1 is for slice group type being 0 00239 00240 int slice_group_change_direction_flag; 00241 int slice_group_change_rate_minus1; 00242 int slice_group_change_cycle; 00243 00244 int redundant_pic_flag; //! encoding of redundant pictures 00245 int pic_order_cnt_type; //! POC type 00246 00247 int context_init_method; 00248 int model_number; 00249 int Transform8x8Mode; 00250 int ReportFrameStats; 00251 int DisplayEncParams; 00252 int Verbose; 00253 00254 //! Rate Control parameters 00255 int RCEnable; 00256 int bit_rate; 00257 int SeinitialQP; 00258 unsigned int basicunit; 00259 int channel_type; 00260 int RCUpdateMode; 00261 double RCIoverPRatio; 00262 double RCBoverPRatio; 00263 double RCISliceBitRatio; 00264 double RCBSliceBitRatio[RC_MAX_TEMPORAL_LEVELS]; 00265 int RCMinQP[NUM_SLICE_TYPES]; 00266 int RCMaxQP[NUM_SLICE_TYPES]; 00267 int RCMaxQPChange; 00268 00269 // Motion Estimation related parameters 00270 int UseMVLimits; 00271 int SetMVXLimit; 00272 int SetMVYLimit; 00273 00274 // Search Algorithm 00275 SearchType SearchMode; 00276 00277 // UMHEX related parameters 00278 int UMHexDSR; 00279 int UMHexScale; 00280 00281 // EPZS related parameters 00282 int EPZSPattern; 00283 int EPZSDual; 00284 int EPZSFixed; 00285 int EPZSTemporal; 00286 int EPZSSpatialMem; 00287 int EPZSBlockType; 00288 int EPZSMinThresScale; 00289 int EPZSMaxThresScale; 00290 int EPZSMedThresScale; 00291 int EPZSSubPelGrid; 00292 int EPZSSubPelME; 00293 int EPZSSubPelMEBiPred; 00294 int EPZSSubPelThresScale; 00295 00296 // Lambda Params 00297 int UseExplicitLambdaParams; 00298 int UpdateLambdaChromaME; 00299 double LambdaWeight[6]; 00300 double FixedLambda[6]; 00301 00302 char QOffsetMatrixFile[FILE_NAME_SIZE]; //!< Quantization Offset matrix cfg file 00303 int OffsetMatrixPresentFlag; //!< Enable Explicit Quantization Offset Matrices 00304 00305 int AdaptiveRounding; //!< Adaptive Rounding parameter based on JVT-N011 00306 int AdaptRoundingFixed; //!< Global rounding for all qps 00307 int AdaptRndPeriod; //!< Set period for adaptive rounding of JVT-N011 in MBs 00308 int AdaptRndChroma; 00309 int AdaptRndWFactor [2][NUM_SLICE_TYPES]; //!< Weighting factors for luma component based on reference indicator and slice type 00310 int AdaptRndCrWFactor[2][NUM_SLICE_TYPES]; //!< Weighting factors for chroma components based on reference indicator and slice type 00311 00312 ////////////////////////////////////////////////////////////////////////// 00313 // Fidelity Range Extensions 00314 int ScalingMatrixPresentFlag; 00315 int ScalingListPresentFlag[12]; 00316 00317 int cb_qp_index_offset; 00318 int cr_qp_index_offset; 00319 // Lossless Coding 00320 int LosslessCoding; 00321 00322 // Fast Mode Decision 00323 int EarlySkipEnable; 00324 int SelectiveIntraEnable; 00325 int DisposableP; 00326 int DispPQPOffset; 00327 00328 //Redundant picture 00329 int NumRedundantHierarchy; //!< number of entries to allocate redundant pictures in a GOP 00330 int PrimaryGOPLength; //!< GOP length of primary pictures 00331 int NumRefPrimary; //!< number of reference frames for primary picture 00332 00333 // tone mapping SEI message 00334 int ToneMappingSEIPresentFlag; 00335 char ToneMappingFile[FILE_NAME_SIZE]; //!< ToneMapping SEI message cfg file 00336 00337 int separate_colour_plane_flag; 00338 double WeightY; 00339 double WeightCb; 00340 double WeightCr; 00341 int UseRDOQuant; 00342 int RDOQ_DC; 00343 int RDOQ_CR; 00344 int RDOQ_DC_CR; 00345 int RDOQ_QP_Num; 00346 int RDOQ_CP_Mode; 00347 int RDOQ_CP_MV; 00348 int RDOQ_Fast; 00349 00350 int EnableVUISupport; 00351 // VUI parameters 00352 VUIParameters VUI; 00353 // end of VUI parameters 00354 00355 }; 00356 00357 #endif 00358