| 1 | |
|---|
| 2 | /** \file TAppEncLayerCfg.h |
|---|
| 3 | \brief Handle encoder layer configuration parameters (header) |
|---|
| 4 | */ |
|---|
| 5 | #ifndef __TAPPENCLAYERCFG__ |
|---|
| 6 | #define __TAPPENCLAYERCFG__ |
|---|
| 7 | |
|---|
| 8 | #if SVC_EXTENSION |
|---|
| 9 | #include "TLibCommon/CommonDef.h" |
|---|
| 10 | #include "TLibEncoder/TEncCfg.h" |
|---|
| 11 | #include <sstream> |
|---|
| 12 | #include <iomanip> |
|---|
| 13 | |
|---|
| 14 | using namespace std; |
|---|
| 15 | class TAppEncCfg; |
|---|
| 16 | //! \ingroup TAppEncoder |
|---|
| 17 | //! \{ |
|---|
| 18 | |
|---|
| 19 | // ==================================================================================================================== |
|---|
| 20 | // Class definition |
|---|
| 21 | // ==================================================================================================================== |
|---|
| 22 | |
|---|
| 23 | /// encoder layer configuration class |
|---|
| 24 | class TAppEncLayerCfg |
|---|
| 25 | { |
|---|
| 26 | friend class TAppEncCfg; |
|---|
| 27 | friend class TAppEncTop; |
|---|
| 28 | protected: |
|---|
| 29 | // file I/O0 |
|---|
| 30 | string m_inputFileName; ///< source file name |
|---|
| 31 | string m_reconFileName; ///< output reconstruction file |
|---|
| 32 | Int m_layerId; ///< layer Id |
|---|
| 33 | Int m_iFrameRate; ///< source frame-rates (Hz) |
|---|
| 34 | Int m_iSourceWidth; ///< source width in pixel |
|---|
| 35 | Int m_iSourceHeight; ///< source height in pixel (when interlaced = field height) |
|---|
| 36 | Int m_iSourceHeightOrg; ///< original source height in pixel (when interlaced = frame height) |
|---|
| 37 | Int m_conformanceWindowMode; |
|---|
| 38 | Int m_confWinLeft; |
|---|
| 39 | Int m_confWinRight; |
|---|
| 40 | Int m_confWinTop; |
|---|
| 41 | Int m_confWinBottom; |
|---|
| 42 | Int m_aiPad[2]; ///< number of padded pixels for width and height |
|---|
| 43 | Int m_iIntraPeriod; ///< period of I-slice (random access period) |
|---|
| 44 | Int m_iGOPSize; ///< GOP size of hierarchical structure |
|---|
| 45 | Double m_fQP; ///< QP value of key-picture (floating point) |
|---|
| 46 | ChromaFormat m_chromaFormatIDC; |
|---|
| 47 | ChromaFormat m_InputChromaFormatIDC; |
|---|
| 48 | ChromaFormat m_chromaFormatConstraint; |
|---|
| 49 | UInt m_bitDepthConstraint; |
|---|
| 50 | Bool m_intraConstraintFlag; |
|---|
| 51 | Bool m_lowerBitRateConstraintFlag; |
|---|
| 52 | Bool m_onePictureOnlyConstraintFlag; |
|---|
| 53 | #if AUXILIARY_PICTURES |
|---|
| 54 | Int m_auxId; |
|---|
| 55 | #endif |
|---|
| 56 | #if VIEW_SCALABILITY |
|---|
| 57 | Int m_viewOrderIndex; |
|---|
| 58 | Int m_viewId; |
|---|
| 59 | #endif |
|---|
| 60 | |
|---|
| 61 | Int m_extraRPSs; ///< extra RPSs added to handle CRA |
|---|
| 62 | GOPEntry m_GOPList[MAX_GOP]; ///< the enhancement layer coding structure entries from the config file |
|---|
| 63 | Int m_inheritCodingStruct; ///< inherit coding structure from certain layer |
|---|
| 64 | Int m_maxTempLayer; ///< Max temporal layer |
|---|
| 65 | |
|---|
| 66 | Int *m_samplePredRefLayerIds; |
|---|
| 67 | Int m_numSamplePredRefLayers; |
|---|
| 68 | Int *m_motionPredRefLayerIds; |
|---|
| 69 | Int m_numMotionPredRefLayers; |
|---|
| 70 | Int *m_predLayerIds; |
|---|
| 71 | Int m_numActiveRefLayers; |
|---|
| 72 | |
|---|
| 73 | Int m_iMaxCuDQPDepth; ///< Max. depth for a minimum CuDQPSize (0:default) |
|---|
| 74 | |
|---|
| 75 | // coding unit (CU) definition |
|---|
| 76 | UInt m_uiMaxCUWidth; ///< max. CU width in pixel |
|---|
| 77 | UInt m_uiMaxCUHeight; ///< max. CU height in pixel |
|---|
| 78 | UInt m_uiMaxCUDepth; ///< max. CU depth (as specified by command line) |
|---|
| 79 | UInt m_uiMaxTotalCUDepth; ///< max. total CU depth - includes depth of transform-block structure |
|---|
| 80 | UInt m_uiLog2DiffMaxMinCodingBlockSize; ///< difference between largest and smallest CU depth |
|---|
| 81 | |
|---|
| 82 | // transfom unit (TU) definition |
|---|
| 83 | UInt m_uiQuadtreeTULog2MaxSize; |
|---|
| 84 | UInt m_uiQuadtreeTULog2MinSize; |
|---|
| 85 | |
|---|
| 86 | UInt m_uiQuadtreeTUMaxDepthInter; |
|---|
| 87 | UInt m_uiQuadtreeTUMaxDepthIntra; |
|---|
| 88 | |
|---|
| 89 | #if RC_SHVC_HARMONIZATION |
|---|
| 90 | Bool m_RCEnableRateControl; ///< enable rate control or not |
|---|
| 91 | Int m_RCTargetBitrate; ///< target bitrate when rate control is enabled |
|---|
| 92 | Bool m_RCKeepHierarchicalBit; ///< whether keeping hierarchical bit allocation structure or not |
|---|
| 93 | Bool m_RCLCULevelRC; ///< true: LCU level rate control; false: picture level rate control |
|---|
| 94 | Bool m_RCUseLCUSeparateModel; ///< use separate R-lambda model at LCU level |
|---|
| 95 | Int m_RCInitialQP; ///< inital QP for rate control |
|---|
| 96 | Bool m_RCForceIntraQP; ///< force all intra picture to use initial QP or not |
|---|
| 97 | #if U0132_TARGET_BITS_SATURATION |
|---|
| 98 | Bool m_RCCpbSaturationEnabled; ///< enable target bits saturation to avoid CPB overflow and underflow |
|---|
| 99 | UInt m_RCCpbSize; ///< CPB size |
|---|
| 100 | Double m_RCInitialCpbFullness; ///< initial CPB fullness |
|---|
| 101 | #endif |
|---|
| 102 | #endif |
|---|
| 103 | |
|---|
| 104 | Bool m_bUseSAO; |
|---|
| 105 | |
|---|
| 106 | #if PER_LAYER_LOSSLESS |
|---|
| 107 | Bool m_TransquantBypassEnableFlag; |
|---|
| 108 | Bool m_CUTransquantBypassFlagForce; |
|---|
| 109 | CostMode m_costMode; |
|---|
| 110 | #endif |
|---|
| 111 | |
|---|
| 112 | ScalingListMode m_useScalingListId; ///< using quantization matrix |
|---|
| 113 | std::string m_scalingListFileName; ///< quantization matrix file name |
|---|
| 114 | |
|---|
| 115 | Int m_maxTidIlRefPicsPlus1; |
|---|
| 116 | Bool m_entropyCodingSyncEnabledFlag; |
|---|
| 117 | |
|---|
| 118 | Int m_iQP; ///< QP value of key-picture (integer) |
|---|
| 119 | std::string m_dQPFileName; ///< QP offset for each slice (initialized from external file) |
|---|
| 120 | Int* m_aidQP; ///< array of slice QP values |
|---|
| 121 | TAppEncCfg* m_cAppEncCfg; ///< pointer to app encoder config |
|---|
| 122 | Int m_numRefLayerLocationOffsets; |
|---|
| 123 | Int m_refLocationOffsetLayerId [MAX_LAYERS]; |
|---|
| 124 | Int m_scaledRefLayerLeftOffset [MAX_LAYERS]; |
|---|
| 125 | Int m_scaledRefLayerTopOffset [MAX_LAYERS]; |
|---|
| 126 | Int m_scaledRefLayerRightOffset [MAX_LAYERS]; |
|---|
| 127 | Int m_scaledRefLayerBottomOffset[MAX_LAYERS]; |
|---|
| 128 | Bool m_scaledRefLayerOffsetPresentFlag[MAX_LAYERS]; |
|---|
| 129 | Bool m_refRegionOffsetPresentFlag [MAX_LAYERS]; |
|---|
| 130 | Int m_refRegionLeftOffset [MAX_LAYERS]; |
|---|
| 131 | Int m_refRegionTopOffset [MAX_LAYERS]; |
|---|
| 132 | Int m_refRegionRightOffset [MAX_LAYERS]; |
|---|
| 133 | Int m_refRegionBottomOffset[MAX_LAYERS]; |
|---|
| 134 | Int m_phaseHorLuma [MAX_LAYERS]; |
|---|
| 135 | Int m_phaseVerLuma [MAX_LAYERS]; |
|---|
| 136 | Int m_phaseHorChroma[MAX_LAYERS]; |
|---|
| 137 | Int m_phaseVerChroma[MAX_LAYERS]; |
|---|
| 138 | Bool m_resamplePhaseSetPresentFlag[MAX_LAYERS]; |
|---|
| 139 | |
|---|
| 140 | Int m_inputBitDepth[MAX_NUM_CHANNEL_TYPE]; ///< bit-depth of input file |
|---|
| 141 | Int m_outputBitDepth[MAX_NUM_CHANNEL_TYPE]; ///< bit-depth of output file |
|---|
| 142 | Int m_MSBExtendedBitDepth[MAX_NUM_CHANNEL_TYPE]; ///< bit-depth of input samples after MSB extension |
|---|
| 143 | Int m_internalBitDepth[MAX_NUM_CHANNEL_TYPE]; ///< bit-depth codec operates at (input/output files will be converted) |
|---|
| 144 | |
|---|
| 145 | Int m_repFormatIdx; |
|---|
| 146 | string m_colourRemapSEIFileRoot; |
|---|
| 147 | |
|---|
| 148 | Int m_layerSwitchOffBegin; |
|---|
| 149 | Int m_layerSwitchOffEnd; |
|---|
| 150 | |
|---|
| 151 | // profile/level |
|---|
| 152 | Int m_layerPTLIdx; |
|---|
| 153 | |
|---|
| 154 | public: |
|---|
| 155 | TAppEncLayerCfg(); |
|---|
| 156 | virtual ~TAppEncLayerCfg(); |
|---|
| 157 | |
|---|
| 158 | public: |
|---|
| 159 | Void setAppEncCfg(TAppEncCfg* p) { m_cAppEncCfg = p; } |
|---|
| 160 | |
|---|
| 161 | string& getInputFileName() { return m_inputFileName; } |
|---|
| 162 | string& getReconFileName() { return m_reconFileName; } |
|---|
| 163 | Double getFloatQP() const { return m_fQP; } |
|---|
| 164 | Int getConfWinLeft() const { return m_confWinLeft; } |
|---|
| 165 | Int getConfWinRight() const { return m_confWinRight; } |
|---|
| 166 | Int getConfWinTop() const { return m_confWinTop; } |
|---|
| 167 | Int getConfWinBottom() const { return m_confWinBottom; } |
|---|
| 168 | |
|---|
| 169 | Int getNumSamplePredRefLayers() const { return m_numSamplePredRefLayers; } |
|---|
| 170 | Int* getSamplePredRefLayerIds() const { return m_samplePredRefLayerIds; } |
|---|
| 171 | Int getSamplePredRefLayerId(Int i) const { return m_samplePredRefLayerIds[i]; } |
|---|
| 172 | Int getNumMotionPredRefLayers() const { return m_numMotionPredRefLayers; } |
|---|
| 173 | Int* getMotionPredRefLayerIds() const { return m_motionPredRefLayerIds; } |
|---|
| 174 | Int getMotionPredRefLayerId(Int i) const { return m_motionPredRefLayerIds[i]; } |
|---|
| 175 | |
|---|
| 176 | Int getNumActiveRefLayers() const { return m_numActiveRefLayers; } |
|---|
| 177 | Int* getPredLayerIds() const { return m_predLayerIds; } |
|---|
| 178 | Int getPredLayerIdx(Int i) const { return m_predLayerIds[i]; } |
|---|
| 179 | #if VIEW_SCALABILITY |
|---|
| 180 | Int getViewOrderIndex() { return m_viewOrderIndex; } |
|---|
| 181 | Int getViewId() { return m_viewId; } |
|---|
| 182 | #endif |
|---|
| 183 | |
|---|
| 184 | Int getRepFormatIdx() const { return m_repFormatIdx; } |
|---|
| 185 | Void setRepFormatIdx(Int x) { m_repFormatIdx = x; } |
|---|
| 186 | Void setSourceWidth(Int x) { m_iSourceWidth = x; } |
|---|
| 187 | Void setSourceHeight(Int x) { m_iSourceHeight = x; } |
|---|
| 188 | Int getMaxTidIlRefPicsPlus1() const { return m_maxTidIlRefPicsPlus1; } |
|---|
| 189 | #if LAYER_CTB |
|---|
| 190 | UInt getMaxCUWidth() const { return m_uiMaxCUWidth; } |
|---|
| 191 | UInt getMaxCUHeight() const { return m_uiMaxCUHeight; } |
|---|
| 192 | UInt getMaxCUDepth() const { return m_uiMaxCUDepth; } |
|---|
| 193 | #endif |
|---|
| 194 | }; // END CLASS DEFINITION TAppEncLayerCfg |
|---|
| 195 | |
|---|
| 196 | #endif //SVC_EXTENSION |
|---|
| 197 | |
|---|
| 198 | //! \} |
|---|
| 199 | |
|---|
| 200 | #endif // __TAPPENCLAYERCFG__ |
|---|