[5] | 1 | /* The copyright in this software is being made available under the BSD |
---|
| 2 | * License, included below. This software may be subject to other third party |
---|
| 3 | * and contributor rights, including patent rights, and no such rights are |
---|
| 4 | * granted under this license. |
---|
| 5 | * |
---|
| 6 | * Copyright (c) 2010-2011, ISO/IEC |
---|
| 7 | * All rights reserved. |
---|
| 8 | * |
---|
| 9 | * Redistribution and use in source and binary forms, with or without |
---|
| 10 | * modification, are permitted provided that the following conditions are met: |
---|
| 11 | * |
---|
| 12 | * * Redistributions of source code must retain the above copyright notice, |
---|
| 13 | * this list of conditions and the following disclaimer. |
---|
| 14 | * * Redistributions in binary form must reproduce the above copyright notice, |
---|
| 15 | * this list of conditions and the following disclaimer in the documentation |
---|
| 16 | * and/or other materials provided with the distribution. |
---|
| 17 | * * Neither the name of the ISO/IEC nor the names of its contributors may |
---|
| 18 | * be used to endorse or promote products derived from this software without |
---|
| 19 | * specific prior written permission. |
---|
| 20 | * |
---|
| 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
| 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
| 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
| 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS |
---|
| 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
| 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
| 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
| 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
| 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
| 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
---|
| 31 | * THE POSSIBILITY OF SUCH DAMAGE. |
---|
| 32 | */ |
---|
[2] | 33 | |
---|
| 34 | |
---|
[5] | 35 | |
---|
[2] | 36 | /** \file TAppEncCfg.h |
---|
| 37 | \brief Handle encoder configuration parameters (header) |
---|
| 38 | */ |
---|
| 39 | |
---|
| 40 | #ifndef __TAPPENCCFG__ |
---|
| 41 | #define __TAPPENCCFG__ |
---|
| 42 | |
---|
| 43 | #include "../../Lib/TLibCommon/CommonDef.h" |
---|
| 44 | #include "../../Lib/TLibCommon/TComMVDRefData.h" |
---|
| 45 | #include "../../App/TAppCommon/TAppComCamPara.h" |
---|
| 46 | #include "../../Lib/TLibRenderer/TRenTop.h" |
---|
| 47 | #include "../../Lib/TLibRenderer/TRenModel.h" |
---|
| 48 | #include "../../Lib/TLibRenderer/TRenModSetupStrParser.h" |
---|
| 49 | |
---|
| 50 | #include <string> |
---|
| 51 | #include <vector> |
---|
| 52 | |
---|
| 53 | // ==================================================================================================================== |
---|
| 54 | // Class definition |
---|
| 55 | // ==================================================================================================================== |
---|
| 56 | |
---|
| 57 | /// encoder configuration class |
---|
| 58 | class TAppEncCfg |
---|
| 59 | { |
---|
| 60 | protected: |
---|
| 61 | // file I/O |
---|
| 62 | char* m_pchBitstreamFile; ///< output bitstream file |
---|
| 63 | |
---|
| 64 | std::vector<char*> m_pchInputFileList; ///< source file names |
---|
| 65 | std::vector<char*> m_pchDepthInputFileList; ///< source depth file names |
---|
| 66 | std::vector<char*> m_pchReconFileList; ///< output reconstruction file names |
---|
| 67 | std::vector<char*> m_pchDepthReconFileList; ///< output depth reconstruction file names |
---|
| 68 | |
---|
| 69 | std::vector<char*> m_pchERRefFileList; ///< virtual external reference view files names |
---|
[5] | 70 | |
---|
[2] | 71 | // source specification |
---|
| 72 | Int m_iFrameRate; ///< source frame-rates (Hz) |
---|
| 73 | unsigned int m_FrameSkip; ///< number of skipped frames from the beginning |
---|
| 74 | Int m_iSourceWidth; ///< source width in pixel |
---|
| 75 | Int m_iSourceHeight; ///< source height in pixel |
---|
| 76 | Int m_iFrameToBeEncoded; ///< number of encoded frames |
---|
| 77 | Bool m_bUsePAD; ///< flag for using source padding |
---|
| 78 | Int m_aiPad[2]; ///< number of padded pixels for width and height |
---|
[5] | 79 | |
---|
[2] | 80 | Int m_iNumberOfViews; ///< number Views to Encode |
---|
| 81 | Bool m_bUsingDepthMaps ; |
---|
| 82 | |
---|
[41] | 83 | #if FLEX_CODING_ORDER |
---|
| 84 | char* m_pchMVCJointCodingOrder; ///< texture-depth coding order |
---|
| 85 | Bool m_b3DVFlexOrder; ///< flexible coding order flag |
---|
| 86 | #endif |
---|
[2] | 87 | |
---|
[41] | 88 | |
---|
[2] | 89 | // coding structure |
---|
| 90 | #if DCM_DECODING_REFRESH |
---|
| 91 | Int m_iDecodingRefreshType; ///< random access type |
---|
| 92 | #endif |
---|
| 93 | UInt m_uiCodedPictureStoreSize ; |
---|
| 94 | Int m_iGOPSize; ///< GOP size of hierarchical structure |
---|
| 95 | Int m_iRateGOPSize; ///< GOP size for QP variance |
---|
[5] | 96 | #if !HHI_NO_LowDelayCoding |
---|
[2] | 97 | Bool m_bUseLDC; ///< flag for using low-delay coding mode |
---|
| 98 | #endif |
---|
| 99 | #if DCM_COMB_LIST |
---|
| 100 | Bool m_bUseLComb; ///< flag for using combined reference list for uni-prediction in B-slices (JCTVC-D421) |
---|
| 101 | Bool m_bLCMod; ///< flag for specifying whether the combined reference list for uni-prediction in B-slices is uploaded explicitly |
---|
| 102 | #endif |
---|
| 103 | std::string m_cInputFormatString ; // GOP string |
---|
| 104 | // coding quality |
---|
[5] | 105 | |
---|
[2] | 106 | std::vector<Double> m_adQP; ///< QP value of key-picture (floating point) [0] video, [1] depth |
---|
| 107 | std::vector<Int> m_aiQP; ///< QP value of key-picture (integer) |
---|
[5] | 108 | |
---|
[2] | 109 | Int m_aiTLayerQPOffset[MAX_TLAYER]; ///< QP offset corresponding to temporal layer depth |
---|
| 110 | char* m_pchdQPFile; ///< QP offset for each slice (initialized from external file) |
---|
| 111 | Int* m_aidQP; ///< array of slice QP values |
---|
| 112 | Int m_iMaxDeltaQP; ///< max. |delta QP| |
---|
| 113 | UInt m_uiDeltaQpRD; ///< dQP range for multi-pass slice QP optimization |
---|
[5] | 114 | |
---|
[2] | 115 | // coding unit (CU) definition |
---|
| 116 | UInt m_uiMaxCUWidth; ///< max. CU width in pixel |
---|
| 117 | UInt m_uiMaxCUHeight; ///< max. CU height in pixel |
---|
| 118 | UInt m_uiMaxCUDepth; ///< max. CU depth |
---|
[5] | 119 | |
---|
[2] | 120 | // transfom unit (TU) definition |
---|
| 121 | UInt m_uiQuadtreeTULog2MaxSize; |
---|
| 122 | UInt m_uiQuadtreeTULog2MinSize; |
---|
[5] | 123 | |
---|
[2] | 124 | UInt m_uiQuadtreeTUMaxDepthInter; |
---|
| 125 | UInt m_uiQuadtreeTUMaxDepthIntra; |
---|
[5] | 126 | |
---|
[2] | 127 | // coding tools (bit-depth) |
---|
| 128 | UInt m_uiInputBitDepth; ///< bit-depth of input file |
---|
| 129 | UInt m_uiOutputBitDepth; ///< bit-depth of output file |
---|
| 130 | #ifdef ENABLE_IBDI |
---|
| 131 | UInt m_uiBitIncrement; ///< bit-depth increment |
---|
| 132 | #endif |
---|
| 133 | UInt m_uiInternalBitDepth; ///< Internal bit-depth (BitDepth+BitIncrement) |
---|
[5] | 134 | |
---|
[2] | 135 | #if MTK_SAO |
---|
[5] | 136 | vector<Bool> m_abUseSAO; |
---|
[2] | 137 | #endif |
---|
| 138 | |
---|
| 139 | // coding tools (loop filter) |
---|
| 140 | vector<Bool> m_abUseALF; ///< flag for using adaptive loop filter [0] - video, [1] - depth |
---|
| 141 | #ifdef MQT_ALF_NPASS |
---|
| 142 | Int m_iALFEncodePassReduction; ///< ALF encoding pass, 0 = original 16-pass, 1 = 1-pass, 2 = 2-pass |
---|
| 143 | #endif |
---|
[5] | 144 | |
---|
[2] | 145 | vector<Bool> m_abLoopFilterDisable; ///< flag for using deblocking filter filter [0] - video, [1] - depth |
---|
| 146 | Int m_iLoopFilterAlphaC0Offset; ///< alpha offset for deblocking filter |
---|
| 147 | Int m_iLoopFilterBetaOffset; ///< beta offset for deblocking filter |
---|
[5] | 148 | |
---|
[2] | 149 | // coding tools (entropy coder) |
---|
| 150 | Int m_iSymbolMode; ///< entropy coder mode, 0 = VLC, 1 = CABAC |
---|
[5] | 151 | |
---|
[2] | 152 | // coding tools (inter - merge motion partitions) |
---|
| 153 | Bool m_bUseMRG; ///< SOPH: flag for using motion partition Merge Mode |
---|
[5] | 154 | |
---|
| 155 | #if LM_CHROMA |
---|
[2] | 156 | Bool m_bUseLMChroma; ///< JL: Chroma intra prediction based on luma signal |
---|
| 157 | #endif |
---|
| 158 | |
---|
| 159 | #if HHI_RMP_SWITCH |
---|
| 160 | Bool m_bUseRMP; |
---|
| 161 | #endif |
---|
[5] | 162 | |
---|
[2] | 163 | // coding tools (encoder-only parameters) |
---|
| 164 | Bool m_bUseSBACRD; ///< flag for using RD optimization based on SBAC |
---|
| 165 | Bool m_bUseASR; ///< flag for using adaptive motion search range |
---|
| 166 | Bool m_bUseHADME; ///< flag for using HAD in sub-pel ME |
---|
| 167 | vector<Bool> m_abUseRDOQ; ///< flag for using RD optimized quantization [0]-video, [1]-depth |
---|
| 168 | Int m_iFastSearch; ///< ME mode, 0 = full, 1 = diamond, 2 = PMVFAST |
---|
| 169 | Int m_iSearchRange; ///< ME search range |
---|
| 170 | Int m_bipredSearchRange; ///< ME search range for bipred refinement |
---|
| 171 | Bool m_bUseFastEnc; ///< flag for using fast encoder setting |
---|
| 172 | |
---|
[5] | 173 | #if DEPTH_MAP_GENERATION |
---|
[2] | 174 | UInt m_uiPredDepthMapGeneration; ///< using of (virtual) depth maps for texture coding |
---|
[5] | 175 | #endif |
---|
| 176 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
[2] | 177 | UInt m_uiMultiviewMvPredMode; ///< usage of predictors for multi-view mv prediction |
---|
| 178 | UInt m_uiMultiviewMvRegMode; ///< regularization for multiview motion vectors |
---|
| 179 | Double m_dMultiviewMvRegLambdaScale; ///< lambda scale for multiview motion vectors regularization |
---|
[5] | 180 | #endif |
---|
| 181 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
[2] | 182 | UInt m_uiMultiviewResPredMode; ///< using multiview residual prediction |
---|
[5] | 183 | #endif |
---|
[2] | 184 | |
---|
[28] | 185 | #if POZNAN_DBMP |
---|
| 186 | UInt m_uiDBMP; ///< using Depth-Based Motion Prediction |
---|
| 187 | #endif |
---|
| 188 | |
---|
| 189 | #if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU |
---|
| 190 | UInt m_uiUseCUSkip; ///< using CU-Skip - Encode only disoccluded CUs in dependend view |
---|
| 191 | #endif |
---|
| 192 | |
---|
[5] | 193 | #if HHI_INTERVIEW_SKIP |
---|
[2] | 194 | UInt m_uiInterViewSkip; ///< usage of interview skip mode ( do not transmit residual) |
---|
[5] | 195 | #if HHI_INTERVIEW_SKIP_LAMBDA_SCALE |
---|
[2] | 196 | Double m_dInterViewSkipLambdaScale; ///< lambda scale for interview skip |
---|
| 197 | #endif |
---|
| 198 | #endif |
---|
[5] | 199 | |
---|
[2] | 200 | // camera parameter |
---|
| 201 | Char* m_pchCameraParameterFile; ///< camera parameter file |
---|
| 202 | Char* m_pchBaseViewCameraNumbers; |
---|
[5] | 203 | TAppComCamPara m_cCameraData; |
---|
| 204 | |
---|
[2] | 205 | Int m_iCodedCamParPrecision; ///< precision for coding of camera parameters |
---|
| 206 | |
---|
[5] | 207 | #if HHI_INTERVIEW_SKIP |
---|
[2] | 208 | TRenTop m_cUsedPelsRenderer; ///< renderer for used pels map |
---|
[5] | 209 | #endif |
---|
[2] | 210 | |
---|
[5] | 211 | #if HHI_VSO |
---|
| 212 | Char* m_pchVSOConfig; |
---|
| 213 | Bool m_bUseVSO; ///< flag for using View Synthesis Optimization |
---|
[2] | 214 | |
---|
[5] | 215 | //// Used for development by GT, might be removed later |
---|
[2] | 216 | Double m_dLambdaScaleVSO; ///< Scaling factor for Lambda in VSO mode |
---|
| 217 | Bool m_bForceLambdaScaleVSO; ///< Use Lambda Scale for depth even if VSO is turned off |
---|
[5] | 218 | #if HHI_VSO_DIST_INT |
---|
| 219 | Bool m_bAllowNegDist; ///< Allow negative distortion in VSO |
---|
| 220 | #endif |
---|
| 221 | UInt m_uiVSOMode; ///< Number of VSO Mode, 1 = , 2 = simple, org vs. ren, 3 = simple, ren vs. ren, 4 = full |
---|
[2] | 222 | Int m_iNumberOfExternalRefs; ///< number Virtual External Reference Views |
---|
| 223 | std::vector< std::vector<Int> > m_aaiBaseViewRefInd; ///< View numbers of Base View References |
---|
| 224 | std::vector< std::vector<Int> > m_aaiERViewRefInd; ///< View numbers of External ViewReferences |
---|
| 225 | std::vector< std::vector<Int> > m_aaiERViewRefLutInd; ///< Indices of LUTs used for External View References |
---|
[5] | 226 | #endif |
---|
[2] | 227 | |
---|
| 228 | Int m_iSliceMode; ///< 0: Disable all Recon slice limits, 1 : Maximum number of largest coding units per slice, 2: Maximum number of bytes in a slice |
---|
| 229 | Int m_iSliceArgument; ///< If m_iSliceMode==1, m_iSliceArgument=max. # of largest coding units. If m_iSliceMode==2, m_iSliceArgument=max. # of bytes. |
---|
| 230 | Int m_iEntropySliceMode; ///< 0: Disable all entropy slice limits, 1 : Maximum number of largest coding units per slice, 2: Constraint based entropy slice |
---|
| 231 | Int m_iEntropySliceArgument;///< If m_iEntropySliceMode==1, m_iEntropySliceArgument=max. # of largest coding units. If m_iEntropySliceMode==2, m_iEntropySliceArgument=max. # of bins. |
---|
| 232 | |
---|
| 233 | #if MTK_NONCROSS_INLOOP_FILTER |
---|
| 234 | Bool m_bLFCrossSliceBoundaryFlag; ///< 0: Cross-slice-boundary in-loop filtering 1: non-cross-slice-boundary in-loop filtering |
---|
| 235 | #endif |
---|
| 236 | #ifdef ROUNDING_CONTROL_BIPRED |
---|
| 237 | Bool m_useRoundingControlBipred; |
---|
| 238 | #endif |
---|
| 239 | #if CONSTRAINED_INTRA_PRED |
---|
| 240 | Bool m_bUseConstrainedIntraPred; ///< flag for using constrained intra prediction |
---|
| 241 | #endif |
---|
[5] | 242 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
| 243 | Bool m_bUseDMM; |
---|
[2] | 244 | #endif |
---|
[5] | 245 | #if HHI_MPI |
---|
[2] | 246 | Bool m_bUseMVI; ///< flag for using Motion Vector Inheritance for depth map coding |
---|
[5] | 247 | #endif |
---|
[2] | 248 | |
---|
| 249 | PicOrderCnt m_iQpChangeFrame; |
---|
| 250 | Int m_iQpChangeOffsetVideo; |
---|
| 251 | Int m_iQpChangeOffsetDepth; |
---|
| 252 | |
---|
| 253 | bool m_pictureDigestEnabled; ///< enable(1)/disable(0) md5 computation and SEI signalling |
---|
| 254 | |
---|
| 255 | //====== Weighted Prediction ======== |
---|
| 256 | #ifdef WEIGHT_PRED |
---|
| 257 | Bool m_bUseWeightPred; ///< Use of explicit Weighting Prediction for P_SLICE |
---|
| 258 | UInt m_uiBiPredIdc; ///< Use of Bi-Directional Weighting Prediction (B_SLICE): explicit(1) or implicit(2) |
---|
| 259 | #endif |
---|
| 260 | |
---|
[28] | 261 | #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH |
---|
| 262 | Bool m_bUseTexDqpAccordingToDepth; ///< flag for using texture QP param modyfication according to depth map's values |
---|
| 263 | #endif |
---|
[2] | 264 | // internal member functions |
---|
| 265 | Void xSetGlobal (); ///< set global variables |
---|
| 266 | Void xCheckParameter (); ///< check validity of configuration values |
---|
| 267 | Void xPrintParameter (); ///< print configuration values |
---|
| 268 | Void xPrintUsage (); ///< print usage |
---|
[5] | 269 | |
---|
[2] | 270 | Void xCleanUpVectors (); ///< clean up vector sizes |
---|
| 271 | Void xInitCameraPars (); ///< init camera parameters |
---|
| 272 | |
---|
| 273 | |
---|
| 274 | // set MVD Parameters and LUTs |
---|
| 275 | Void xSetShiftParameters(); |
---|
| 276 | Void xGetShiftParameter( UInt uiSourceView, UInt uiTargetView, bool bExternal, double& rdScale, double& rdOffset ); ///< Get one Shift Parameters |
---|
| 277 | |
---|
| 278 | // util |
---|
[5] | 279 | Void xAppendToFileNameEnd( Char* pchInputFileName, const Char* pchStringToAppend, Char* & rpchOutputFileName); |
---|
[2] | 280 | Bool xConfirmParameter(Bool bflag, const char* message); |
---|
| 281 | |
---|
| 282 | |
---|
| 283 | template <class T> Void xCleanUpVector( std::vector<T>& rcVec, const T& rcInvalid ); |
---|
| 284 | |
---|
[5] | 285 | #if HHI_VSO |
---|
[2] | 286 | // Ren Model String |
---|
[5] | 287 | TRenModSetupStrParser m_cRenModStrParser; |
---|
| 288 | #endif |
---|
[28] | 289 | |
---|
| 290 | #if POZNAN_TEXTURE_TU_DELTA_QP_PARAM_IN_CFG_FOR_ENC |
---|
| 291 | Double m_dTexDqpAccordingToDepthOffset; |
---|
| 292 | Double m_dTexDqpAccordingToDepthMul; |
---|
| 293 | Int m_iTexDqpAccordingToDepthTopBottomRow; |
---|
| 294 | #endif |
---|
| 295 | |
---|
| 296 | #if POZNAN_NONLINEAR_DEPTH |
---|
[41] | 297 | std::vector<Int> m_aiNonlinearDepthModel; |
---|
| 298 | TComNonlinearDepthModel m_cNonlinearDepthModel; |
---|
| 299 | Int m_iNonlinearDepthThreshold; |
---|
| 300 | Bool m_bUseNonlinearDepth; |
---|
[28] | 301 | #endif |
---|
| 302 | |
---|
[2] | 303 | public: |
---|
| 304 | |
---|
| 305 | TAppEncCfg(); |
---|
| 306 | virtual ~TAppEncCfg(); |
---|
[5] | 307 | |
---|
[2] | 308 | public: |
---|
| 309 | Void create (); ///< create option handling class |
---|
| 310 | Void destroy (); ///< destroy option handling class |
---|
| 311 | Bool parseCfg ( Int argc, Char* argv[] ); ///< parse configuration file to fill member variables |
---|
[5] | 312 | |
---|
[2] | 313 | };// END CLASS DEFINITION TAppEncCfg |
---|
| 314 | |
---|
| 315 | #endif // __TAPPENCCFG__ |
---|
| 316 | |
---|