| 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 | */ |
|---|
| 33 | |
|---|
| 34 | |
|---|
| 35 | |
|---|
| 36 | /** \file TAppEncCfg.cpp |
|---|
| 37 | \brief Handle encoder configuration parameters |
|---|
| 38 | */ |
|---|
| 39 | |
|---|
| 40 | #include <stdlib.h> |
|---|
| 41 | #include <math.h> |
|---|
| 42 | #include <cassert> |
|---|
| 43 | #include <cstring> |
|---|
| 44 | #include <string> |
|---|
| 45 | #include "TAppEncCfg.h" |
|---|
| 46 | #include "../../App/TAppCommon/program_options_lite.h" |
|---|
| 47 | |
|---|
| 48 | |
|---|
| 49 | using namespace std; |
|---|
| 50 | namespace po = df::program_options_lite; |
|---|
| 51 | |
|---|
| 52 | /* configuration helper funcs */ |
|---|
| 53 | void doOldStyleCmdlineOn(po::Options& opts, const std::string& arg); |
|---|
| 54 | void doOldStyleCmdlineOff(po::Options& opts, const std::string& arg); |
|---|
| 55 | |
|---|
| 56 | // ==================================================================================================================== |
|---|
| 57 | // Local constants |
|---|
| 58 | // ==================================================================================================================== |
|---|
| 59 | |
|---|
| 60 | /// max value of source padding size |
|---|
| 61 | /** \todo replace it by command line option |
|---|
| 62 | */ |
|---|
| 63 | #define MAX_PAD_SIZE 16 |
|---|
| 64 | #define MAX_INPUT_VIEW_NUM 10 |
|---|
| 65 | #define MAX_ERREF_VIEW_NUM 15 |
|---|
| 66 | |
|---|
| 67 | // ==================================================================================================================== |
|---|
| 68 | // Constructor / destructor / initialization / destroy |
|---|
| 69 | // ==================================================================================================================== |
|---|
| 70 | |
|---|
| 71 | TAppEncCfg::TAppEncCfg() |
|---|
| 72 | { |
|---|
| 73 | m_aidQP = NULL; |
|---|
| 74 | #if HHI_VSO |
|---|
| 75 | m_aaiERViewRefLutInd.resize( MAX_INPUT_VIEW_NUM ); |
|---|
| 76 | #endif |
|---|
| 77 | } |
|---|
| 78 | |
|---|
| 79 | TAppEncCfg::~TAppEncCfg() |
|---|
| 80 | { |
|---|
| 81 | if ( m_aidQP ) |
|---|
| 82 | { |
|---|
| 83 | delete[] m_aidQP; m_aidQP = NULL; |
|---|
| 84 | } |
|---|
| 85 | for(Int i = 0; i< m_pchInputFileList.size(); i++ ) |
|---|
| 86 | { |
|---|
| 87 | if ( m_pchInputFileList[i] != NULL ) |
|---|
| 88 | free (m_pchInputFileList[i]); |
|---|
| 89 | } |
|---|
| 90 | |
|---|
| 91 | for(Int i = 0; i< m_pchDepthInputFileList.size(); i++ ) |
|---|
| 92 | { |
|---|
| 93 | if ( m_pchDepthInputFileList[i] != NULL ) |
|---|
| 94 | free (m_pchDepthInputFileList[i]); |
|---|
| 95 | } |
|---|
| 96 | |
|---|
| 97 | for(Int i = 0; i< m_pchReconFileList.size(); i++ ) |
|---|
| 98 | { |
|---|
| 99 | if ( m_pchReconFileList[i] != NULL ) |
|---|
| 100 | free (m_pchReconFileList[i]); |
|---|
| 101 | } |
|---|
| 102 | |
|---|
| 103 | for(Int i = 0; i< m_pchERRefFileList.size(); i++ ) |
|---|
| 104 | { |
|---|
| 105 | if ( m_pchERRefFileList[i] != NULL ) |
|---|
| 106 | free (m_pchERRefFileList[i]); |
|---|
| 107 | } |
|---|
| 108 | |
|---|
| 109 | if (m_pchBitstreamFile != NULL) |
|---|
| 110 | free (m_pchBitstreamFile) ; |
|---|
| 111 | |
|---|
| 112 | #if FLEX_CODING_ORDER |
|---|
| 113 | if (m_pchMVCJointCodingOrder != NULL) |
|---|
| 114 | { |
|---|
| 115 | free(m_pchMVCJointCodingOrder) ; |
|---|
| 116 | } |
|---|
| 117 | #endif |
|---|
| 118 | for(Int i = 0; i< m_pchDepthReconFileList.size(); i++ ) |
|---|
| 119 | { |
|---|
| 120 | if ( m_pchDepthReconFileList[i] != NULL ) |
|---|
| 121 | free (m_pchDepthReconFileList[i]); |
|---|
| 122 | } |
|---|
| 123 | |
|---|
| 124 | if (m_pchCameraParameterFile != NULL) |
|---|
| 125 | free (m_pchCameraParameterFile); |
|---|
| 126 | |
|---|
| 127 | if (m_pchBaseViewCameraNumbers != NULL) |
|---|
| 128 | free (m_pchBaseViewCameraNumbers); |
|---|
| 129 | |
|---|
| 130 | #if HHI_VSO |
|---|
| 131 | if ( m_pchVSOConfig != NULL) |
|---|
| 132 | free ( m_pchVSOConfig ); |
|---|
| 133 | #endif |
|---|
| 134 | |
|---|
| 135 | } |
|---|
| 136 | |
|---|
| 137 | Void TAppEncCfg::create() |
|---|
| 138 | { |
|---|
| 139 | } |
|---|
| 140 | |
|---|
| 141 | Void TAppEncCfg::destroy() |
|---|
| 142 | { |
|---|
| 143 | } |
|---|
| 144 | |
|---|
| 145 | // ==================================================================================================================== |
|---|
| 146 | // Public member functions |
|---|
| 147 | // ==================================================================================================================== |
|---|
| 148 | |
|---|
| 149 | /** \param argc number of arguments |
|---|
| 150 | \param argv array of arguments |
|---|
| 151 | \retval true when success |
|---|
| 152 | */ |
|---|
| 153 | Bool TAppEncCfg::parseCfg( Int argc, Char* argv[] ) |
|---|
| 154 | { |
|---|
| 155 | bool do_help = false; |
|---|
| 156 | |
|---|
| 157 | string cfg_InputFile; |
|---|
| 158 | string cfg_BitstreamFile; |
|---|
| 159 | string cfg_ReconFile; |
|---|
| 160 | string cfg_dQPFile; |
|---|
| 161 | |
|---|
| 162 | #if FLEX_CODING_ORDER |
|---|
| 163 | string cfg_JointCodingOrdering; |
|---|
| 164 | #endif |
|---|
| 165 | |
|---|
| 166 | po::Options opts; |
|---|
| 167 | opts.addOptions() |
|---|
| 168 | ("help", do_help, false, "this help text") |
|---|
| 169 | ("c", po::parseConfigFile, "configuration file name") |
|---|
| 170 | |
|---|
| 171 | /* File, I/O and source parameters */ |
|---|
| 172 | ("InputFile_%d,i_%d", m_pchInputFileList, (char *) 0 , MAX_INPUT_VIEW_NUM , "original Yuv input file name %d") |
|---|
| 173 | ("DepthInputFile_%d,di_%d", m_pchDepthInputFileList, (char *) 0 , MAX_INPUT_VIEW_NUM , "original Yuv depth input file name %d") |
|---|
| 174 | ("ReconFile_%d,o_%d", m_pchReconFileList, (char *) 0 , MAX_INPUT_VIEW_NUM , "reconstructed Yuv output file name %d") |
|---|
| 175 | ("DepthReconFile_%d,do_%d", m_pchDepthReconFileList, (char *) 0 , MAX_INPUT_VIEW_NUM , "reconstructed Yuv depth output file name %d") |
|---|
| 176 | ("BitstreamFile,b", cfg_BitstreamFile, string(""), "bitstream output file name") |
|---|
| 177 | |
|---|
| 178 | ("CodeDepthMaps", m_bUsingDepthMaps, false, "Encode depth maps" ) |
|---|
| 179 | ("CodedCamParsPrecision", m_iCodedCamParPrecision, STD_CAM_PARAMETERS_PRECISION, "precision for coding of camera parameters (in units of 2^(-x) luma samples)" ) |
|---|
| 180 | |
|---|
| 181 | #ifdef WEIGHT_PRED |
|---|
| 182 | ("weighted_pred_flag,-wpP", m_bUseWeightPred, false, "weighted prediction flag (P-Slices)") |
|---|
| 183 | ("weighted_bipred_idc,-wpBidc", m_uiBiPredIdc, 0u, "weighted bipred idc (B-Slices)") |
|---|
| 184 | #endif |
|---|
| 185 | ("SourceWidth,-wdt", m_iSourceWidth, 0, "Source picture width") |
|---|
| 186 | ("SourceHeight,-hgt", m_iSourceHeight, 0, "Source picture height") |
|---|
| 187 | ("InputBitDepth", m_uiInputBitDepth, 8u, "bit-depth of input file") |
|---|
| 188 | ("BitDepth", m_uiInputBitDepth, 8u, "deprecated alias of InputBitDepth") |
|---|
| 189 | ("OutputBitDepth", m_uiOutputBitDepth, 0u, "bit-depth of output file") |
|---|
| 190 | #if ENABLE_IBDI |
|---|
| 191 | ("BitIncrement", m_uiBitIncrement, 0xffffffffu, "bit-depth increasement") |
|---|
| 192 | #endif |
|---|
| 193 | ("InternalBitDepth", m_uiInternalBitDepth, 0u, "Internal bit-depth (BitDepth+BitIncrement)") |
|---|
| 194 | ("HorizontalPadding,-pdx",m_aiPad[0], 0, "horizontal source padding size") |
|---|
| 195 | ("VerticalPadding,-pdy", m_aiPad[1], 0, "vertical source padding size") |
|---|
| 196 | ("PAD", m_bUsePAD, false, "automatic source padding of multiple of 16" ) |
|---|
| 197 | ("FrameRate,-fr", m_iFrameRate, 0, "Frame rate") |
|---|
| 198 | ("FrameSkip,-fs", m_FrameSkip, 0u, "Number of frames to skip at start of input YUV") |
|---|
| 199 | ("FramesToBeEncoded,f", m_iFrameToBeEncoded, 0, "number of frames to be encoded (default=all)") |
|---|
| 200 | ("FrameToBeEncoded", m_iFrameToBeEncoded, 0, "depricated alias of FramesToBeEncoded") |
|---|
| 201 | |
|---|
| 202 | ("NumberOfViews", m_iNumberOfViews, 0, "Number of views") |
|---|
| 203 | |
|---|
| 204 | #if FLEX_CODING_ORDER |
|---|
| 205 | ("3DVFlexOrder", m_b3DVFlexOrder, false, "flexible coding order flag" ) |
|---|
| 206 | ("3DVCodingOrder", cfg_JointCodingOrdering, string(""), "The coding order for joint texture-depth coding") |
|---|
| 207 | |
|---|
| 208 | #endif |
|---|
| 209 | /* Unit definition parameters */ |
|---|
| 210 | ("MaxCUWidth", m_uiMaxCUWidth, 64u) |
|---|
| 211 | ("MaxCUHeight", m_uiMaxCUHeight, 64u) |
|---|
| 212 | /* todo: remove defaults from MaxCUSize */ |
|---|
| 213 | ("MaxCUSize,s", m_uiMaxCUWidth, 64u, "max CU size") |
|---|
| 214 | ("MaxCUSize,s", m_uiMaxCUHeight, 64u, "max CU size") |
|---|
| 215 | ("MaxPartitionDepth,h", m_uiMaxCUDepth, 4u, "CU depth") |
|---|
| 216 | |
|---|
| 217 | ("QuadtreeTULog2MaxSize", m_uiQuadtreeTULog2MaxSize, 6u) |
|---|
| 218 | ("QuadtreeTULog2MinSize", m_uiQuadtreeTULog2MinSize, 2u) |
|---|
| 219 | |
|---|
| 220 | ("QuadtreeTUMaxDepthIntra", m_uiQuadtreeTUMaxDepthIntra, 1u) |
|---|
| 221 | ("QuadtreeTUMaxDepthInter", m_uiQuadtreeTUMaxDepthInter, 2u) |
|---|
| 222 | |
|---|
| 223 | /* Coding structure paramters */ |
|---|
| 224 | ("CodedPictureStoreSize,cpss", m_uiCodedPictureStoreSize, 16u, "Size of coded picture Buffer") |
|---|
| 225 | #if DCM_DECODING_REFRESH |
|---|
| 226 | ("DecodingRefreshType,-dr",m_iDecodingRefreshType, 0, "intra refresh, (0:none 1:CDR 2:IDR)") |
|---|
| 227 | #endif |
|---|
| 228 | ("GOPSize,g", m_iGOPSize, 1, "GOP size of temporal structure") |
|---|
| 229 | ("RateGOPSize,-rg",m_iRateGOPSize, -1, "GOP size of hierarchical QP assignment (-1: implies inherit GOPSize value)") |
|---|
| 230 | #if !HHI_NO_LowDelayCoding |
|---|
| 231 | ("LowDelayCoding", m_bUseLDC, false, "low-delay mode") |
|---|
| 232 | #endif |
|---|
| 233 | #if DCM_COMB_LIST |
|---|
| 234 | ("ListCombination, -lc", m_bUseLComb, true, "combined reference list for uni-prediction in B-slices") |
|---|
| 235 | ("LCModification", m_bLCMod, false, "enables signalling of combined reference list derivation") |
|---|
| 236 | #endif |
|---|
| 237 | |
|---|
| 238 | ("GOPFormatString,gfs", m_cInputFormatString, string(""), "Group of pictures") |
|---|
| 239 | |
|---|
| 240 | /* motion options */ |
|---|
| 241 | ("FastSearch", m_iFastSearch, 1, "0:Full search 1:Diamond 2:PMVFAST") |
|---|
| 242 | ("SearchRange,-sr",m_iSearchRange, 96, "motion search range") |
|---|
| 243 | ("BipredSearchRange", m_bipredSearchRange, 4, "motion search range for bipred refinement") |
|---|
| 244 | ("HadamardME", m_bUseHADME, true, "hadamard ME for fractional-pel") |
|---|
| 245 | ("ASR", m_bUseASR, false, "adaptive motion search range") |
|---|
| 246 | |
|---|
| 247 | /* Quantization parameters */ |
|---|
| 248 | ("QP,q", m_adQP, std::vector<double>(1,32), "Qp value, if value is float, QP is switched once during encoding, if two values are given the second is used for depth") |
|---|
| 249 | ("DeltaQpRD,-dqr",m_uiDeltaQpRD, 0u, "max dQp offset for slice") |
|---|
| 250 | ("MaxDeltaQP,d", m_iMaxDeltaQP, 0, "max dQp offset for block") |
|---|
| 251 | ("dQPFile,m", m_pchdQPFile , (char*) 0, "dQP file name") |
|---|
| 252 | ("RDOQ", m_abUseRDOQ, std::vector<Bool>(1,true), "Enable RDOQ") |
|---|
| 253 | ("TemporalLayerQPOffset_L0,-tq0", m_aiTLayerQPOffset[0], 0, "QP offset of temporal layer 0") |
|---|
| 254 | ("TemporalLayerQPOffset_L1,-tq1", m_aiTLayerQPOffset[1], 0, "QP offset of temporal layer 1") |
|---|
| 255 | ("TemporalLayerQPOffset_L2,-tq2", m_aiTLayerQPOffset[2], 0, "QP offset of temporal layer 2") |
|---|
| 256 | ("TemporalLayerQPOffset_L3,-tq3", m_aiTLayerQPOffset[3], 0, "QP offset of temporal layer 3") |
|---|
| 257 | ("TemporalLayerQPOffset_L4,-tq4", m_aiTLayerQPOffset[4], 0, "QP offset of temporal layer 3") |
|---|
| 258 | ("TemporalLayerQPOffset_L5,-tq5", m_aiTLayerQPOffset[5], 0, "QP offset of temporal layer 3") |
|---|
| 259 | ("TemporalLayerQPOffset_L6,-tq6", m_aiTLayerQPOffset[6], 0, "QP offset of temporal layer 3") |
|---|
| 260 | ("TemporalLayerQPOffset_L7,-tq7", m_aiTLayerQPOffset[7], 0, "QP offset of temporal layer 3") |
|---|
| 261 | ("TemporalLayerQPOffset_L8,-tq8", m_aiTLayerQPOffset[8], 0, "QP offset of temporal layer 3") |
|---|
| 262 | ("TemporalLayerQPOffset_L9,-tq9", m_aiTLayerQPOffset[9], 0, "QP offset of temporal layer 3") |
|---|
| 263 | |
|---|
| 264 | /* Entropy coding parameters */ |
|---|
| 265 | ("SymbolMode,-sym", m_iSymbolMode, 1, "symbol mode (0=VLC, 1=SBAC)") |
|---|
| 266 | ("SBACRD", m_bUseSBACRD, true, "SBAC based RD estimation") |
|---|
| 267 | |
|---|
| 268 | /* Deblocking filter parameters */ |
|---|
| 269 | ("LoopFilterDisable", m_abLoopFilterDisable, std::vector<Bool>(1,false), "Disables LoopFilter") |
|---|
| 270 | ("LoopFilterAlphaC0Offset", m_iLoopFilterAlphaC0Offset, 0) |
|---|
| 271 | ("LoopFilterBetaOffset", m_iLoopFilterBetaOffset, 0 ) |
|---|
| 272 | |
|---|
| 273 | /* Camera Paremetes */ |
|---|
| 274 | ("CameraParameterFile,cpf", m_pchCameraParameterFile, (Char *) 0, "Camera Parameter File Name") |
|---|
| 275 | ("BaseViewCameraNumbers" , m_pchBaseViewCameraNumbers, (Char *) 0, "Numbers of base views") |
|---|
| 276 | |
|---|
| 277 | |
|---|
| 278 | /* View Synthesis Optimization */ |
|---|
| 279 | |
|---|
| 280 | #if HHI_VSO |
|---|
| 281 | ("VSOConfig", m_pchVSOConfig , (Char *) 0 , "VSO configuration") |
|---|
| 282 | ("VSO", m_bUseVSO , false , "Use VSO" ) |
|---|
| 283 | // GT: For development, will be removed later |
|---|
| 284 | ("VSOMode", m_uiVSOMode , (UInt) 4 , "VSO Mode") |
|---|
| 285 | #if HHI_VSO_LS_TABLE |
|---|
| 286 | ("LambdaScaleVSO", m_dLambdaScaleVSO , (Double) 1 , "Lambda Scaling for VSO") |
|---|
| 287 | #else |
|---|
| 288 | ("LambdaScaleVSO", m_dLambdaScaleVSO , (Double) 0.5 , "Lambda Scaling for VSO") |
|---|
| 289 | #endif |
|---|
| 290 | ("ForceLambdaScaleVSO", m_bForceLambdaScaleVSO , false , "Force using Lambda Scale VSO also in non-VSO-Mode") |
|---|
| 291 | #if HHI_VSO_DIST_INT |
|---|
| 292 | ("AllowNegDist", m_bAllowNegDist , true , "Allow negative Distortion in VSO") |
|---|
| 293 | #endif |
|---|
| 294 | |
|---|
| 295 | ("NumberOfExternalRefs", m_iNumberOfExternalRefs , 0 , "Number of virtual external reference views") |
|---|
| 296 | ("ERRefFile_%d,er_%d", m_pchERRefFileList , (char *) 0 , MAX_ERREF_VIEW_NUM , "virtual external reference view file name %d") |
|---|
| 297 | ("VSERViewReferences_%d,evr_%d" , m_aaiERViewRefInd , vector<Int>() , MAX_INPUT_VIEW_NUM, "Numbers of external virtual reference views to be used for this view") |
|---|
| 298 | ("VSBaseViewReferences_%d,bvr_%d", m_aaiBaseViewRefInd , vector<Int>() , MAX_INPUT_VIEW_NUM, "Numbers of external virtual reference views to be used for this view") |
|---|
| 299 | #endif |
|---|
| 300 | |
|---|
| 301 | /* Coding tools */ |
|---|
| 302 | ("MRG", m_bUseMRG, true, "merging of motion partitions") |
|---|
| 303 | |
|---|
| 304 | #if LM_CHROMA |
|---|
| 305 | ("LMChroma", m_bUseLMChroma, true, "intra chroma prediction based on recontructed luma") |
|---|
| 306 | #endif |
|---|
| 307 | |
|---|
| 308 | ("ALF", m_abUseALF, std::vector<Bool>(1,true), "Enables ALF") |
|---|
| 309 | #if MTK_SAO |
|---|
| 310 | ("SAO", m_abUseSAO, std::vector<Bool>(1, true), "SAO") |
|---|
| 311 | #endif |
|---|
| 312 | |
|---|
| 313 | #if MQT_ALF_NPASS |
|---|
| 314 | ("ALFEncodePassReduction", m_iALFEncodePassReduction, 0, "0:Original 16-pass, 1: 1-pass, 2: 2-pass encoding") |
|---|
| 315 | #endif |
|---|
| 316 | #if HHI_RMP_SWITCH |
|---|
| 317 | ("RMP", m_bUseRMP ,true, "Rectangular motion partition" ) |
|---|
| 318 | #endif |
|---|
| 319 | #ifdef ROUNDING_CONTROL_BIPRED |
|---|
| 320 | ("RoundingControlBipred", m_useRoundingControlBipred, false, "Rounding control for bi-prediction") |
|---|
| 321 | #endif |
|---|
| 322 | ("SliceMode", m_iSliceMode, 0, "0: Disable all Recon slice limits, 1: Enforce max # of LCUs, 2: Enforce max # of bytes") |
|---|
| 323 | ("SliceArgument", m_iSliceArgument, 0, "if SliceMode==1 SliceArgument represents max # of LCUs. if SliceMode==2 SliceArgument represents max # of bytes.") |
|---|
| 324 | ("EntropySliceMode", m_iEntropySliceMode, 0, "0: Disable all entropy slice limits, 1: Enforce max # of LCUs, 2: Enforce constraint based entropy slices") |
|---|
| 325 | ("EntropySliceArgument", m_iEntropySliceArgument,0, "if EntropySliceMode==1 SliceArgument represents max # of LCUs. if EntropySliceMode==2 EntropySliceArgument represents max # of bins.") |
|---|
| 326 | #if MTK_NONCROSS_INLOOP_FILTER |
|---|
| 327 | ("LFCrossSliceBoundaryFlag", m_bLFCrossSliceBoundaryFlag, true) |
|---|
| 328 | #endif |
|---|
| 329 | #if CONSTRAINED_INTRA_PRED |
|---|
| 330 | ("ConstrainedIntraPred", m_bUseConstrainedIntraPred, false, "Constrained Intra Prediction") |
|---|
| 331 | #endif |
|---|
| 332 | /* Misc. */ |
|---|
| 333 | ("SEIpictureDigest", m_pictureDigestEnabled, false, "Control generation of picture_digest SEI messages\n" |
|---|
| 334 | "\t1: use MD5\n" |
|---|
| 335 | "\t0: disable") |
|---|
| 336 | ("FEN", m_bUseFastEnc, false, "fast encoder setting") |
|---|
| 337 | |
|---|
| 338 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
|---|
| 339 | ("DMM", m_bUseDMM, false, "add depth modes intra") |
|---|
| 340 | #endif |
|---|
| 341 | #if HHI_MPI |
|---|
| 342 | ("MVI", m_bUseMVI, false, "use motion vector inheritance for depth map coding") |
|---|
| 343 | #endif |
|---|
| 344 | |
|---|
| 345 | /* Multiview tools */ |
|---|
| 346 | #if DEPTH_MAP_GENERATION |
|---|
| 347 | ("PredDepthMapGen", m_uiPredDepthMapGeneration, (UInt)0, "generation of prediction depth maps for motion data prediction" ) |
|---|
| 348 | #endif |
|---|
| 349 | #if HHI_INTER_VIEW_MOTION_PRED |
|---|
| 350 | ("MultiviewMvPred", m_uiMultiviewMvPredMode, (UInt)0, "usage of predicted depth maps" ) |
|---|
| 351 | ("MultiviewMvRegMode", m_uiMultiviewMvRegMode, (UInt)0, "regularization mode for multiview motion vectors" ) |
|---|
| 352 | ("MultiviewMvRegLambdaScale", m_dMultiviewMvRegLambdaScale, (Double)0, "lambda scale for multiview motion vector regularization" ) |
|---|
| 353 | #endif |
|---|
| 354 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
|---|
| 355 | ("MultiviewResPred", m_uiMultiviewResPredMode, (UInt)0, "usage of inter-view residual prediction" ) |
|---|
| 356 | #endif |
|---|
| 357 | |
|---|
| 358 | ("QpChangeFrame", m_iQpChangeFrame, PicOrderCnt(0), "start frame for QP change") |
|---|
| 359 | ("QpChangeOffsetVideo", m_iQpChangeOffsetVideo, 0, "QP change offset for video") |
|---|
| 360 | ("QpChangeOffsetDepth", m_iQpChangeOffsetDepth, 0, "QP change offset for depth") |
|---|
| 361 | #if HHI_INTERVIEW_SKIP |
|---|
| 362 | ("InterViewSkip", m_uiInterViewSkip, (UInt)0, "usage of interview skip" ) |
|---|
| 363 | #if HHI_INTERVIEW_SKIP_LAMBDA_SCALE |
|---|
| 364 | ("InterViewSkipLambdaScale", m_dInterViewSkipLambdaScale, (Double)8, "lambda scale for interview skip" ) |
|---|
| 365 | #endif |
|---|
| 366 | #endif |
|---|
| 367 | |
|---|
| 368 | /* Compatability with old style -1 FOO or -0 FOO options. */ |
|---|
| 369 | ("1", doOldStyleCmdlineOn, "turn option <name> on") |
|---|
| 370 | ("0", doOldStyleCmdlineOff, "turn option <name> off") |
|---|
| 371 | ; |
|---|
| 372 | |
|---|
| 373 | po::setDefaults(opts); |
|---|
| 374 | const list<const char*>& argv_unhandled = po::scanArgv(opts, argc, (const char**) argv); |
|---|
| 375 | |
|---|
| 376 | for (list<const char*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++) |
|---|
| 377 | { |
|---|
| 378 | fprintf(stderr, "Unhandled argument ignored: `%s'\n", *it); |
|---|
| 379 | } |
|---|
| 380 | |
|---|
| 381 | if (argc == 1 || do_help) |
|---|
| 382 | { |
|---|
| 383 | /* argc == 1: no options have been specified */ |
|---|
| 384 | po::doHelp(cout, opts); |
|---|
| 385 | xPrintUsage(); |
|---|
| 386 | return false; |
|---|
| 387 | } |
|---|
| 388 | |
|---|
| 389 | /* |
|---|
| 390 | * Set any derived parameters |
|---|
| 391 | */ |
|---|
| 392 | /* convert std::string to c string for compatability */ |
|---|
| 393 | m_pchBitstreamFile = cfg_BitstreamFile.empty() ? NULL : strdup(cfg_BitstreamFile.c_str()); |
|---|
| 394 | m_pchdQPFile = cfg_dQPFile.empty() ? NULL : strdup(cfg_dQPFile.c_str()); |
|---|
| 395 | |
|---|
| 396 | #if FLEX_CODING_ORDER && HHI_VSO |
|---|
| 397 | m_pchMVCJointCodingOrder = cfg_JointCodingOrdering.empty()?NULL:strdup(cfg_JointCodingOrdering.c_str()); |
|---|
| 398 | // If flexible order is enabled and if depth comes before the texture for a view, disable VSO |
|---|
| 399 | Bool depthComesFirst = false; |
|---|
| 400 | if ( m_b3DVFlexOrder ) |
|---|
| 401 | { |
|---|
| 402 | for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) |
|---|
| 403 | { |
|---|
| 404 | for ( Int ii=1; ii<12; ii+=2 ) |
|---|
| 405 | { |
|---|
| 406 | Int iViewIdxCfg = (Int)(m_pchMVCJointCodingOrder[ii]-'0'); |
|---|
| 407 | if ( iViewIdxCfg == iViewIdx ) |
|---|
| 408 | { |
|---|
| 409 | if ( m_pchMVCJointCodingOrder[ii-1]=='D' ) // depth comes first for this view |
|---|
| 410 | { |
|---|
| 411 | depthComesFirst = true; |
|---|
| 412 | break; |
|---|
| 413 | } |
|---|
| 414 | else |
|---|
| 415 | { |
|---|
| 416 | assert(m_pchMVCJointCodingOrder[ii-1]=='T'); |
|---|
| 417 | } |
|---|
| 418 | } |
|---|
| 419 | } |
|---|
| 420 | } |
|---|
| 421 | } |
|---|
| 422 | if (depthComesFirst) |
|---|
| 423 | { |
|---|
| 424 | m_bUseVSO = false; |
|---|
| 425 | } |
|---|
| 426 | #endif |
|---|
| 427 | |
|---|
| 428 | |
|---|
| 429 | // GT FIX |
|---|
| 430 | if ( m_bUsingDepthMaps ) |
|---|
| 431 | { |
|---|
| 432 | for(Int i = 0; i < m_pchDepthReconFileList.size() ; i++) |
|---|
| 433 | { |
|---|
| 434 | if ((m_pchDepthInputFileList[i] != NULL) && (m_pchReconFileList[i] != NULL) && (i < m_iNumberOfViews) ) |
|---|
| 435 | { |
|---|
| 436 | if (m_pchDepthReconFileList[i] == NULL ) |
|---|
| 437 | { |
|---|
| 438 | xAppendToFileNameEnd( m_pchReconFileList[i], "_depth", m_pchDepthReconFileList[i] ); |
|---|
| 439 | } |
|---|
| 440 | } |
|---|
| 441 | else |
|---|
| 442 | { |
|---|
| 443 | m_pchDepthReconFileList[i] = NULL; |
|---|
| 444 | } |
|---|
| 445 | }; |
|---|
| 446 | } |
|---|
| 447 | // GT FIX END |
|---|
| 448 | |
|---|
| 449 | if (m_iRateGOPSize == -1) |
|---|
| 450 | { |
|---|
| 451 | /* if rateGOPSize has not been specified, the default value is GOPSize */ |
|---|
| 452 | m_iRateGOPSize = m_iGOPSize; |
|---|
| 453 | } |
|---|
| 454 | |
|---|
| 455 | // compute source padding size |
|---|
| 456 | if ( m_bUsePAD ) |
|---|
| 457 | { |
|---|
| 458 | if ( m_iSourceWidth%MAX_PAD_SIZE ) |
|---|
| 459 | { |
|---|
| 460 | m_aiPad[0] = (m_iSourceWidth/MAX_PAD_SIZE+1)*MAX_PAD_SIZE - m_iSourceWidth; |
|---|
| 461 | } |
|---|
| 462 | |
|---|
| 463 | if ( m_iSourceHeight%MAX_PAD_SIZE ) |
|---|
| 464 | { |
|---|
| 465 | m_aiPad[1] = (m_iSourceHeight/MAX_PAD_SIZE+1)*MAX_PAD_SIZE - m_iSourceHeight; |
|---|
| 466 | } |
|---|
| 467 | } |
|---|
| 468 | m_iSourceWidth += m_aiPad[0]; |
|---|
| 469 | m_iSourceHeight += m_aiPad[1]; |
|---|
| 470 | |
|---|
| 471 | //GT QP Depth |
|---|
| 472 | if ( m_adQP.size() < 2 ) |
|---|
| 473 | { |
|---|
| 474 | m_adQP.push_back( m_adQP[0] ); |
|---|
| 475 | }; |
|---|
| 476 | for (UInt uiK = 0; uiK < m_adQP.size(); uiK++) |
|---|
| 477 | { |
|---|
| 478 | m_aiQP.push_back( (Int)( m_adQP[uiK] ) ); |
|---|
| 479 | } |
|---|
| 480 | //GT QP Depth end |
|---|
| 481 | |
|---|
| 482 | #if HHI_VSO |
|---|
| 483 | m_bUseVSO = m_bUseVSO && m_bUsingDepthMaps && (m_uiVSOMode != 0); |
|---|
| 484 | #endif |
|---|
| 485 | |
|---|
| 486 | xCleanUpVectors(); |
|---|
| 487 | |
|---|
| 488 | #if HHI_VSO |
|---|
| 489 | if ( m_abUseALF .size() < 2) |
|---|
| 490 | m_abUseALF .push_back( m_bUseVSO ? false : m_abUseALF[0] ); |
|---|
| 491 | |
|---|
| 492 | if ( m_abUseRDOQ.size() < 2) |
|---|
| 493 | m_abUseRDOQ.push_back( m_bUseVSO ? true : m_abUseRDOQ[0] ); |
|---|
| 494 | |
|---|
| 495 | if ( m_abLoopFilterDisable.size() < 2) |
|---|
| 496 | m_abLoopFilterDisable.push_back( m_bUseVSO ? true : m_abLoopFilterDisable[0] ); |
|---|
| 497 | |
|---|
| 498 | if (m_abUseSAO.size() < 2) |
|---|
| 499 | m_abUseSAO.push_back ( m_bUseVSO ? false : m_abUseSAO[0] ); |
|---|
| 500 | #else |
|---|
| 501 | if ( m_abUseALF .size() < 2) |
|---|
| 502 | m_abUseALF .push_back( m_abUseALF[0] ); |
|---|
| 503 | |
|---|
| 504 | if ( m_abUseRDOQ.size() < 2) |
|---|
| 505 | m_abUseRDOQ.push_back( m_abUseRDOQ[0] ); |
|---|
| 506 | |
|---|
| 507 | if ( m_abLoopFilterDisable.size() < 2) |
|---|
| 508 | m_abLoopFilterDisable.push_back( m_abLoopFilterDisable[0] ); |
|---|
| 509 | |
|---|
| 510 | if (m_abUseSAO.size() < 2) |
|---|
| 511 | m_abUseSAO.push_back ( m_abUseSAO[0] ); |
|---|
| 512 | #endif |
|---|
| 513 | |
|---|
| 514 | #if HHI_VSO |
|---|
| 515 | if ( m_bUseVSO ) |
|---|
| 516 | { |
|---|
| 517 | if ( m_iNumberOfExternalRefs != 0 ) |
|---|
| 518 | { |
|---|
| 519 | xCleanUpVector( m_aaiERViewRefInd, vector<Int>() ); |
|---|
| 520 | xCleanUpVector( m_aaiBaseViewRefInd, vector<Int>() ); |
|---|
| 521 | } |
|---|
| 522 | else |
|---|
| 523 | { |
|---|
| 524 | m_aaiERViewRefInd .clear(); |
|---|
| 525 | m_aaiERViewRefInd .resize( m_iNumberOfViews ); |
|---|
| 526 | m_aaiERViewRefLutInd.clear(); |
|---|
| 527 | m_aaiERViewRefLutInd.resize( m_iNumberOfViews ); |
|---|
| 528 | m_aaiBaseViewRefInd .clear(); |
|---|
| 529 | m_aaiBaseViewRefInd .resize( m_iNumberOfViews ); |
|---|
| 530 | } |
|---|
| 531 | } |
|---|
| 532 | |
|---|
| 533 | #if HHI_VSO_LS_TABLE |
|---|
| 534 | // Q&D |
|---|
| 535 | Double adLambdaScaleTable[] = |
|---|
| 536 | { 0.031250, 0.031639, 0.032029, 0.032418, 0.032808, 0.033197, 0.033586, 0.033976, 0.034365, 0.034755, |
|---|
| 537 | 0.035144, 0.035533, 0.035923, 0.036312, 0.036702, 0.037091, 0.037480, 0.037870, 0.038259, 0.038648, |
|---|
| 538 | 0.039038, 0.039427, 0.039817, 0.040206, 0.040595, 0.040985, 0.041374, 0.041764, 0.042153, 0.042542, |
|---|
| 539 | 0.042932, 0.043321, 0.043711, 0.044100, 0.044194, 0.053033, 0.061872, 0.070711, 0.079550, 0.088388, |
|---|
| 540 | 0.117851, 0.147314, 0.176777, 0.235702, 0.294628, 0.353553, 0.471405, 0.589256, 0.707107, 0.707100, |
|---|
| 541 | 0.753550, 0.800000 |
|---|
| 542 | }; |
|---|
| 543 | AOT( (m_aiQP[1] < 0) || (m_aiQP[1] > 51)); |
|---|
| 544 | m_dLambdaScaleVSO *= adLambdaScaleTable[m_aiQP[1]]; |
|---|
| 545 | #endif |
|---|
| 546 | #endif |
|---|
| 547 | |
|---|
| 548 | // set global variables |
|---|
| 549 | xSetGlobal(); |
|---|
| 550 | |
|---|
| 551 | // read and check camera parameters |
|---|
| 552 | #if HHI_VSO |
|---|
| 553 | if ( m_bUseVSO && m_uiVSOMode == 4) |
|---|
| 554 | { |
|---|
| 555 | m_cRenModStrParser.setString( m_iNumberOfViews, m_pchVSOConfig ); |
|---|
| 556 | m_cCameraData .init ( (UInt)m_iNumberOfViews, |
|---|
| 557 | m_uiInputBitDepth, |
|---|
| 558 | (UInt)m_iCodedCamParPrecision, |
|---|
| 559 | m_FrameSkip, |
|---|
| 560 | (UInt)m_iFrameToBeEncoded, |
|---|
| 561 | m_pchCameraParameterFile, |
|---|
| 562 | m_pchBaseViewCameraNumbers, |
|---|
| 563 | NULL, |
|---|
| 564 | m_cRenModStrParser.getSynthViews(), |
|---|
| 565 | LOG2_DISP_PREC_LUT ); |
|---|
| 566 | } |
|---|
| 567 | else if ( m_bUseVSO && m_uiVSOMode != 4 ) |
|---|
| 568 | { |
|---|
| 569 | m_cCameraData .init ( (UInt)m_iNumberOfViews, |
|---|
| 570 | m_uiInputBitDepth, |
|---|
| 571 | (UInt)m_iCodedCamParPrecision, |
|---|
| 572 | m_FrameSkip, |
|---|
| 573 | (UInt)m_iFrameToBeEncoded, |
|---|
| 574 | m_pchCameraParameterFile, |
|---|
| 575 | m_pchBaseViewCameraNumbers, |
|---|
| 576 | m_pchVSOConfig, |
|---|
| 577 | NULL, |
|---|
| 578 | LOG2_DISP_PREC_LUT ); |
|---|
| 579 | } |
|---|
| 580 | else |
|---|
| 581 | { |
|---|
| 582 | m_cCameraData .init ( (UInt)m_iNumberOfViews, |
|---|
| 583 | m_uiInputBitDepth, |
|---|
| 584 | (UInt)m_iCodedCamParPrecision, |
|---|
| 585 | m_FrameSkip, |
|---|
| 586 | (UInt)m_iFrameToBeEncoded, |
|---|
| 587 | m_pchCameraParameterFile, |
|---|
| 588 | m_pchBaseViewCameraNumbers, |
|---|
| 589 | NULL, |
|---|
| 590 | NULL, |
|---|
| 591 | LOG2_DISP_PREC_LUT ); |
|---|
| 592 | } |
|---|
| 593 | #else |
|---|
| 594 | m_cCameraData .init ( (UInt)m_iNumberOfViews, |
|---|
| 595 | m_uiInputBitDepth, |
|---|
| 596 | (UInt)m_iCodedCamParPrecision, |
|---|
| 597 | m_FrameSkip, |
|---|
| 598 | (UInt)m_iFrameToBeEncoded, |
|---|
| 599 | m_pchCameraParameterFile, |
|---|
| 600 | m_pchBaseViewCameraNumbers, |
|---|
| 601 | NULL, |
|---|
| 602 | NULL, |
|---|
| 603 | LOG2_DISP_PREC_LUT ); |
|---|
| 604 | #endif |
|---|
| 605 | |
|---|
| 606 | |
|---|
| 607 | // check validity of input parameters |
|---|
| 608 | xCheckParameter(); |
|---|
| 609 | m_cCameraData.check( false, true ); |
|---|
| 610 | |
|---|
| 611 | // print-out parameters |
|---|
| 612 | xPrintParameter(); |
|---|
| 613 | |
|---|
| 614 | return true; |
|---|
| 615 | } |
|---|
| 616 | |
|---|
| 617 | // ==================================================================================================================== |
|---|
| 618 | // Private member functions |
|---|
| 619 | // ==================================================================================================================== |
|---|
| 620 | |
|---|
| 621 | Bool confirmPara(Bool bflag, const char* message); |
|---|
| 622 | |
|---|
| 623 | Void TAppEncCfg::xCheckParameter() |
|---|
| 624 | { |
|---|
| 625 | bool check_failed = false; /* abort if there is a fatal configuration problem */ |
|---|
| 626 | #define xConfirmPara(a,b) check_failed |= confirmPara(a,b) |
|---|
| 627 | // check range of parameters |
|---|
| 628 | #if ENABLE_IBDI |
|---|
| 629 | xConfirmPara( m_uiInternalBitDepth > 0 && (int)m_uiBitIncrement != -1, "InternalBitDepth and BitIncrement may not be specified simultaneously"); |
|---|
| 630 | #else |
|---|
| 631 | xConfirmPara( m_uiInputBitDepth < 8, "InputBitDepth must be at least 8" ); |
|---|
| 632 | #endif |
|---|
| 633 | xConfirmPara( m_iFrameRate <= 0, "Frame rate must be more than 1" ); |
|---|
| 634 | xConfirmPara( m_iFrameToBeEncoded <= 0, "Total Number Of Frames encoded must be more than 1" ); |
|---|
| 635 | xConfirmPara( m_iGOPSize < 1 , "GOP Size must be more than 1" ); |
|---|
| 636 | #if DCM_DECODING_REFRESH |
|---|
| 637 | xConfirmPara( m_iDecodingRefreshType < 0 || m_iDecodingRefreshType > 2, "Decoding Refresh Type must be equal to 0, 1 or 2" ); |
|---|
| 638 | #endif |
|---|
| 639 | //GT QP Depth |
|---|
| 640 | xConfirmPara( m_aiQP[0] < 0 || m_aiQP[0] > 51, "QP exceeds supported range (0 to 51)" ); |
|---|
| 641 | if ( m_aiQP.size() >= 2 ) |
|---|
| 642 | { |
|---|
| 643 | xConfirmPara( m_aiQP[1] < 0 || m_aiQP[1] > 51, "QP Depth exceeds supported range (0 to 51)" ); |
|---|
| 644 | } |
|---|
| 645 | //GT QP Depth End |
|---|
| 646 | #if MQT_ALF_NPASS |
|---|
| 647 | xConfirmPara( m_iALFEncodePassReduction < 0 || m_iALFEncodePassReduction > 2, "ALFEncodePassReduction must be equal to 0, 1 or 2"); |
|---|
| 648 | #endif |
|---|
| 649 | xConfirmPara( m_iLoopFilterAlphaC0Offset < -26 || m_iLoopFilterAlphaC0Offset > 26, "Loop Filter Alpha Offset exceeds supported range (-26 to 26)" ); |
|---|
| 650 | xConfirmPara( m_iLoopFilterBetaOffset < -26 || m_iLoopFilterBetaOffset > 26, "Loop Filter Beta Offset exceeds supported range (-26 to 26)"); |
|---|
| 651 | xConfirmPara( m_iFastSearch < 0 || m_iFastSearch > 2, "Fast Search Mode is not supported value (0:Full search 1:Diamond 2:PMVFAST)" ); |
|---|
| 652 | xConfirmPara( m_iSearchRange < 0 , "Search Range must be more than 0" ); |
|---|
| 653 | xConfirmPara( m_bipredSearchRange < 0 , "Search Range must be more than 0" ); |
|---|
| 654 | xConfirmPara( m_iMaxDeltaQP > 7, "Absolute Delta QP exceeds supported range (0 to 7)" ); |
|---|
| 655 | xConfirmPara( (m_uiMaxCUWidth >> m_uiMaxCUDepth) < 4, "Minimum partition width size should be larger than or equal to 8"); |
|---|
| 656 | xConfirmPara( (m_uiMaxCUHeight >> m_uiMaxCUDepth) < 4, "Minimum partition height size should be larger than or equal to 8"); |
|---|
| 657 | xConfirmPara( m_uiMaxCUWidth < 16, "Maximum partition width size should be larger than or equal to 16"); |
|---|
| 658 | xConfirmPara( m_uiMaxCUHeight < 16, "Maximum partition height size should be larger than or equal to 16"); |
|---|
| 659 | xConfirmPara( (m_iSourceWidth % (m_uiMaxCUWidth >> (m_uiMaxCUDepth-1)))!=0, "Frame width should be multiple of minimum CU size"); |
|---|
| 660 | xConfirmPara( (m_iSourceHeight % (m_uiMaxCUHeight >> (m_uiMaxCUDepth-1)))!=0, "Frame height should be multiple of minimum CU size"); |
|---|
| 661 | |
|---|
| 662 | xConfirmPara( m_uiQuadtreeTULog2MinSize < 2, "QuadtreeTULog2MinSize must be 2 or greater."); |
|---|
| 663 | xConfirmPara( m_uiQuadtreeTULog2MinSize > 5, "QuadtreeTULog2MinSize must be 5 or smaller."); |
|---|
| 664 | xConfirmPara( m_uiQuadtreeTULog2MaxSize < 2, "QuadtreeTULog2MaxSize must be 2 or greater."); |
|---|
| 665 | xConfirmPara( m_uiQuadtreeTULog2MaxSize > 5, "QuadtreeTULog2MaxSize must be 5 or smaller."); |
|---|
| 666 | xConfirmPara( m_uiQuadtreeTULog2MaxSize < m_uiQuadtreeTULog2MinSize, "QuadtreeTULog2MaxSize must be greater than or equal to m_uiQuadtreeTULog2MinSize."); |
|---|
| 667 | xConfirmPara( (1<<m_uiQuadtreeTULog2MinSize)>(m_uiMaxCUWidth >>(m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than minimum CU size" ); // HS |
|---|
| 668 | xConfirmPara( (1<<m_uiQuadtreeTULog2MinSize)>(m_uiMaxCUHeight>>(m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than minimum CU size" ); // HS |
|---|
| 669 | xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) > ( m_uiMaxCUWidth >> m_uiMaxCUDepth ), "Minimum CU width must be greater than minimum transform size." ); |
|---|
| 670 | xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) > ( m_uiMaxCUHeight >> m_uiMaxCUDepth ), "Minimum CU height must be greater than minimum transform size." ); |
|---|
| 671 | xConfirmPara( m_uiQuadtreeTUMaxDepthInter < 1, "QuadtreeTUMaxDepthInter must be greater than or equal to 1" ); |
|---|
| 672 | xConfirmPara( m_uiQuadtreeTUMaxDepthInter > m_uiQuadtreeTULog2MaxSize - m_uiQuadtreeTULog2MinSize + 1, "QuadtreeTUMaxDepthInter must be less than or equal to the difference between QuadtreeTULog2MaxSize and QuadtreeTULog2MinSize plus 1" ); |
|---|
| 673 | xConfirmPara( m_uiQuadtreeTUMaxDepthIntra < 1, "QuadtreeTUMaxDepthIntra must be greater than or equal to 1" ); |
|---|
| 674 | xConfirmPara( m_uiQuadtreeTUMaxDepthIntra > m_uiQuadtreeTULog2MaxSize - m_uiQuadtreeTULog2MinSize + 1, "QuadtreeTUMaxDepthIntra must be less than or equal to the difference between QuadtreeTULog2MaxSize and QuadtreeTULog2MinSize plus 1" ); |
|---|
| 675 | |
|---|
| 676 | xConfirmPara( m_iSliceMode < 0 || m_iSliceMode > 2, "SliceMode exceeds supported range (0 to 2)" ); |
|---|
| 677 | if (m_iSliceMode!=0) |
|---|
| 678 | { |
|---|
| 679 | xConfirmPara( m_iSliceArgument < 1 , "SliceArgument should be larger than or equal to 1" ); |
|---|
| 680 | } |
|---|
| 681 | xConfirmPara( m_iEntropySliceMode < 0 || m_iEntropySliceMode > 2, "EntropySliceMode exceeds supported range (0 to 2)" ); |
|---|
| 682 | if (m_iEntropySliceMode!=0) |
|---|
| 683 | { |
|---|
| 684 | xConfirmPara( m_iEntropySliceArgument < 1 , "EntropySliceArgument should be larger than or equal to 1" ); |
|---|
| 685 | } |
|---|
| 686 | |
|---|
| 687 | xConfirmPara( m_iSymbolMode < 0 || m_iSymbolMode > 1, "SymbolMode must be equal to 0 or 1" ); |
|---|
| 688 | |
|---|
| 689 | // Check MultiView stuff |
|---|
| 690 | xConfirmPara ( m_iNumberOfViews > MAX_INPUT_VIEW_NUM , "NumberOfViews must be less than or equal to MAX_INPUT_VIEW_NUM"); |
|---|
| 691 | xConfirmPara ( Int( m_pchInputFileList.size() ) < m_iNumberOfViews, "Number of InputFiles must be greater than or equal to NumberOfViews" ); |
|---|
| 692 | xConfirmPara ( Int( m_pchReconFileList.size() ) < m_iNumberOfViews, "Number of ReconFiles must be greater than or equal to NumberOfViews" ); |
|---|
| 693 | |
|---|
| 694 | xConfirmPara ( m_iCodedCamParPrecision < 0 || m_iCodedCamParPrecision > 5, "CodedCamParsPrecision must be in range of 0..5" ); |
|---|
| 695 | #if DEPTH_MAP_GENERATION |
|---|
| 696 | xConfirmPara ( m_uiPredDepthMapGeneration > 2, "PredDepthMapGen must be less than or equal to 2" ); |
|---|
| 697 | xConfirmPara ( m_uiPredDepthMapGeneration >= 2 && !m_bUsingDepthMaps, "PredDepthMapGen >= 2 requires CodeDepthMaps = 1" ); |
|---|
| 698 | #endif |
|---|
| 699 | #if HHI_INTER_VIEW_MOTION_PRED |
|---|
| 700 | xConfirmPara ( m_uiMultiviewMvPredMode > 7, "MultiviewMvPred must be less than or equal to 7" ); |
|---|
| 701 | xConfirmPara ( m_uiMultiviewMvPredMode > 0 && m_uiPredDepthMapGeneration == 0 , "MultiviewMvPred > 0 requires PredDepthMapGen > 0" ); |
|---|
| 702 | xConfirmPara ( m_uiMultiviewMvRegMode > 1, "MultiviewMvRegMode must be less than or equal to 1" ); |
|---|
| 703 | xConfirmPara ( m_dMultiviewMvRegLambdaScale < 0.0, "MultiviewMvRegLambdaScale must not be negative" ); |
|---|
| 704 | if( m_uiMultiviewMvRegMode ) |
|---|
| 705 | { |
|---|
| 706 | xConfirmPara ( Int( m_pchDepthInputFileList.size() ) < m_iNumberOfViews, "MultiviewMvRegMode > 0 requires the presence of input depth maps" ); |
|---|
| 707 | } |
|---|
| 708 | #endif |
|---|
| 709 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
|---|
| 710 | xConfirmPara ( m_uiMultiviewResPredMode > 1, "MultiviewResPred must be less than or equal to 1" ); |
|---|
| 711 | xConfirmPara ( m_uiMultiviewResPredMode > 0 && m_uiPredDepthMapGeneration == 0 , "MultiviewResPred > 0 requires PredDepthMapGen > 0" ); |
|---|
| 712 | #endif |
|---|
| 713 | |
|---|
| 714 | #if HHI_INTERVIEW_SKIP |
|---|
| 715 | xConfirmPara ( m_uiInterViewSkip > 1, "RenderingSkipMode > 1 not supported" ); |
|---|
| 716 | xConfirmPara ( m_uiInterViewSkip > 0 && !m_bUsingDepthMaps, "RenderingSkipMode > 0 requires CodeDepthMaps = 1" ); |
|---|
| 717 | #endif |
|---|
| 718 | if( m_bUsingDepthMaps ) |
|---|
| 719 | { |
|---|
| 720 | xConfirmPara ( Int( m_pchDepthInputFileList.size() ) < m_iNumberOfViews, "Number of DepthInputFiles must be greater than or equal to NumberOfViews" ); |
|---|
| 721 | xConfirmPara ( Int( m_pchDepthReconFileList.size() ) < m_iNumberOfViews, "Number of DepthReconFiles must be greater than or equal to NumberOfViews" ); |
|---|
| 722 | |
|---|
| 723 | #if HHI_VSO |
|---|
| 724 | if( m_bUseVSO ) |
|---|
| 725 | { |
|---|
| 726 | xConfirmPara( m_pchCameraParameterFile == 0 , "CameraParameterFile must be given"); |
|---|
| 727 | xConfirmPara( m_pchVSOConfig == 0 , "VSO Setup string must be given"); |
|---|
| 728 | xConfirmPara( m_pchBaseViewCameraNumbers == 0 , "BaseViewCameraNumbers must be given" ); |
|---|
| 729 | xConfirmPara( m_iNumberOfViews != m_cCameraData.getBaseViewNumbers().size(), "Number of Views in BaseViewCameraNumbers must be equal to NumberOfViews" ); |
|---|
| 730 | xConfirmPara( m_uiVSOMode < 0 || m_uiVSOMode > 4 , "VSO Mode must be greater than or equal to 0 and less than 5"); |
|---|
| 731 | xConfirmPara( m_iNumberOfExternalRefs > MAX_ERREF_VIEW_NUM, "NumberOfExternalRefs must be less than of equal to TAppMVEncCfg::MAX_ERREF_VIEW_NUM" ); |
|---|
| 732 | xConfirmPara( Int( m_pchERRefFileList .size() ) < m_iNumberOfExternalRefs, "Number of ERRefFileFiles must be greater than or equal to NumberOfExternalRefs" ); |
|---|
| 733 | } |
|---|
| 734 | #endif |
|---|
| 735 | } |
|---|
| 736 | |
|---|
| 737 | #if DCM_COMB_LIST |
|---|
| 738 | #if !HHI_NO_LowDelayCoding |
|---|
| 739 | xConfirmPara( m_bUseLComb==false && m_bUseLDC==false, "LComb can only be 0 if LowDelayCoding is 1" ); |
|---|
| 740 | #else |
|---|
| 741 | xConfirmPara( m_bUseLComb==false, "LComb can only be 0 if LowDelayCoding is 1" ); |
|---|
| 742 | #endif |
|---|
| 743 | #endif |
|---|
| 744 | |
|---|
| 745 | // max CU width and height should be power of 2 |
|---|
| 746 | UInt ui = m_uiMaxCUWidth; |
|---|
| 747 | while(ui) |
|---|
| 748 | { |
|---|
| 749 | ui >>= 1; |
|---|
| 750 | if( (ui & 1) == 1) |
|---|
| 751 | xConfirmPara( ui != 1 , "Width should be 2^n"); |
|---|
| 752 | } |
|---|
| 753 | ui = m_uiMaxCUHeight; |
|---|
| 754 | while(ui) |
|---|
| 755 | { |
|---|
| 756 | ui >>= 1; |
|---|
| 757 | if( (ui & 1) == 1) |
|---|
| 758 | xConfirmPara( ui != 1 , "Height should be 2^n"); |
|---|
| 759 | } |
|---|
| 760 | |
|---|
| 761 | // SBACRD is supported only for SBAC |
|---|
| 762 | if ( m_iSymbolMode == 0 ) |
|---|
| 763 | { |
|---|
| 764 | m_bUseSBACRD = false; |
|---|
| 765 | } |
|---|
| 766 | |
|---|
| 767 | #undef xConfirmPara |
|---|
| 768 | if (check_failed) |
|---|
| 769 | { |
|---|
| 770 | exit(EXIT_FAILURE); |
|---|
| 771 | } |
|---|
| 772 | } |
|---|
| 773 | |
|---|
| 774 | template <class T> |
|---|
| 775 | Void |
|---|
| 776 | TAppEncCfg::xCleanUpVector( std::vector<T>& rcVec, const T& rcInvalid ) |
|---|
| 777 | { |
|---|
| 778 | Int iFirstInv = (Int)rcVec.size(); |
|---|
| 779 | for( Int iIdx = 0; iIdx < (Int)rcVec.size(); iIdx++ ) |
|---|
| 780 | { |
|---|
| 781 | if( rcVec[ iIdx ] == rcInvalid ) |
|---|
| 782 | { |
|---|
| 783 | iFirstInv = iIdx; |
|---|
| 784 | break; |
|---|
| 785 | } |
|---|
| 786 | } |
|---|
| 787 | while( (Int)rcVec.size() > iFirstInv ) |
|---|
| 788 | { |
|---|
| 789 | rcVec.pop_back(); |
|---|
| 790 | } |
|---|
| 791 | } |
|---|
| 792 | |
|---|
| 793 | Void |
|---|
| 794 | TAppEncCfg::xCleanUpVectors() |
|---|
| 795 | { |
|---|
| 796 | xCleanUpVector( m_pchInputFileList, (char*)0 ); |
|---|
| 797 | xCleanUpVector( m_pchDepthInputFileList, (char*)0 ); |
|---|
| 798 | xCleanUpVector( m_pchReconFileList, (char*)0 ); |
|---|
| 799 | xCleanUpVector( m_pchDepthReconFileList, (char*)0 ); |
|---|
| 800 | |
|---|
| 801 | #if HHI_VSO |
|---|
| 802 | if ( m_bUseVSO) |
|---|
| 803 | { |
|---|
| 804 | xCleanUpVector( m_pchERRefFileList, (char*)0 ); |
|---|
| 805 | } |
|---|
| 806 | #endif |
|---|
| 807 | } |
|---|
| 808 | |
|---|
| 809 | /** \todo use of global variables should be removed later |
|---|
| 810 | */ |
|---|
| 811 | Void TAppEncCfg::xSetGlobal() |
|---|
| 812 | { |
|---|
| 813 | // set max CU width & height |
|---|
| 814 | g_uiMaxCUWidth = m_uiMaxCUWidth; |
|---|
| 815 | g_uiMaxCUHeight = m_uiMaxCUHeight; |
|---|
| 816 | |
|---|
| 817 | // compute actual CU depth with respect to config depth and max transform size |
|---|
| 818 | g_uiAddCUDepth = 0; |
|---|
| 819 | while( (m_uiMaxCUWidth>>m_uiMaxCUDepth) > ( 1 << ( m_uiQuadtreeTULog2MinSize + g_uiAddCUDepth ) ) ) g_uiAddCUDepth++; |
|---|
| 820 | |
|---|
| 821 | m_uiMaxCUDepth += g_uiAddCUDepth; |
|---|
| 822 | g_uiAddCUDepth++; |
|---|
| 823 | g_uiMaxCUDepth = m_uiMaxCUDepth; |
|---|
| 824 | |
|---|
| 825 | // set internal bit-depth and constants |
|---|
| 826 | #if ENABLE_IBDI |
|---|
| 827 | if ((int)m_uiBitIncrement != -1) |
|---|
| 828 | { |
|---|
| 829 | g_uiBitDepth = m_uiInputBitDepth; |
|---|
| 830 | g_uiBitIncrement = m_uiBitIncrement; |
|---|
| 831 | m_uiInternalBitDepth = g_uiBitDepth + g_uiBitIncrement; |
|---|
| 832 | } |
|---|
| 833 | else |
|---|
| 834 | { |
|---|
| 835 | g_uiBitDepth = min(8u, m_uiInputBitDepth); |
|---|
| 836 | if (m_uiInternalBitDepth == 0) { |
|---|
| 837 | /* default increement = 2 */ |
|---|
| 838 | m_uiInternalBitDepth = 2 + g_uiBitDepth; |
|---|
| 839 | } |
|---|
| 840 | g_uiBitIncrement = m_uiInternalBitDepth - g_uiBitDepth; |
|---|
| 841 | } |
|---|
| 842 | #else |
|---|
| 843 | #if FULL_NBIT |
|---|
| 844 | g_uiBitDepth = m_uiInternalBitDepth; |
|---|
| 845 | g_uiBitIncrement = 0; |
|---|
| 846 | #else |
|---|
| 847 | g_uiBitDepth = 8; |
|---|
| 848 | g_uiBitIncrement = m_uiInternalBitDepth - g_uiBitDepth; |
|---|
| 849 | #endif |
|---|
| 850 | #endif |
|---|
| 851 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
|---|
| 852 | g_dDeltaDCsQuantOffset = Double(g_uiBitIncrement) - 2.0; |
|---|
| 853 | #endif |
|---|
| 854 | |
|---|
| 855 | g_uiBASE_MAX = ((1<<(g_uiBitDepth))-1); |
|---|
| 856 | |
|---|
| 857 | #if IBDI_NOCLIP_RANGE |
|---|
| 858 | g_uiIBDI_MAX = g_uiBASE_MAX << g_uiBitIncrement; |
|---|
| 859 | #else |
|---|
| 860 | g_uiIBDI_MAX = ((1<<(g_uiBitDepth+g_uiBitIncrement))-1); |
|---|
| 861 | #endif |
|---|
| 862 | |
|---|
| 863 | if (m_uiOutputBitDepth == 0) |
|---|
| 864 | { |
|---|
| 865 | m_uiOutputBitDepth = m_uiInternalBitDepth; |
|---|
| 866 | } |
|---|
| 867 | } |
|---|
| 868 | |
|---|
| 869 | Void TAppEncCfg::xPrintParameter() |
|---|
| 870 | { |
|---|
| 871 | printf("\n"); |
|---|
| 872 | for( Int iCounter = 0; iCounter<m_iNumberOfViews; iCounter++) |
|---|
| 873 | { |
|---|
| 874 | printf("Input File %i : %s\n", iCounter, m_pchInputFileList[iCounter]); |
|---|
| 875 | } |
|---|
| 876 | for( Int iCounter = 0; iCounter < (Int)m_pchDepthInputFileList.size(); iCounter++) |
|---|
| 877 | { |
|---|
| 878 | printf("DepthInput File %i : %s\n", iCounter, m_pchDepthInputFileList[iCounter]); |
|---|
| 879 | } |
|---|
| 880 | printf("Bitstream File : %s\n", m_pchBitstreamFile ); |
|---|
| 881 | for( Int iCounter = 0; iCounter<m_iNumberOfViews; iCounter++) |
|---|
| 882 | { |
|---|
| 883 | printf("Reconstruction File %i : %s\n", iCounter, m_pchReconFileList[iCounter]); |
|---|
| 884 | } |
|---|
| 885 | |
|---|
| 886 | for( Int iCounter = 0; iCounter<(Int)m_pchDepthReconFileList.size(); iCounter++) |
|---|
| 887 | { |
|---|
| 888 | printf("Reconstruction Depth File %i : %s\n", iCounter, m_pchDepthReconFileList[iCounter]); |
|---|
| 889 | } |
|---|
| 890 | printf("Real Format : %dx%d %dHz\n", m_iSourceWidth - m_aiPad[0], m_iSourceHeight-m_aiPad[1], m_iFrameRate ); |
|---|
| 891 | printf("Internal Format : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate ); |
|---|
| 892 | printf("Frame index : %u - %d (%d frames)\n", m_FrameSkip, m_FrameSkip+m_iFrameToBeEncoded-1, m_iFrameToBeEncoded ); |
|---|
| 893 | printf("CU size / depth : %d / %d\n", m_uiMaxCUWidth, m_uiMaxCUDepth ); |
|---|
| 894 | printf("RQT trans. size (min / max) : %d / %d\n", 1 << m_uiQuadtreeTULog2MinSize, 1 << m_uiQuadtreeTULog2MaxSize ); |
|---|
| 895 | printf("Max RQT depth inter : %d\n", m_uiQuadtreeTUMaxDepthInter); |
|---|
| 896 | printf("Max RQT depth intra : %d\n", m_uiQuadtreeTUMaxDepthIntra); |
|---|
| 897 | printf("Motion search range : %d\n", m_iSearchRange ); |
|---|
| 898 | #if DCM_DECODING_REFRESH |
|---|
| 899 | printf("Decoding refresh type : %d\n", m_iDecodingRefreshType ); |
|---|
| 900 | #endif |
|---|
| 901 | printf("QP : %5.2f\n", m_adQP[0] ); |
|---|
| 902 | printf("QP Depth : %5.2f\n", m_adQP[ m_adQP.size() < 2 ? 0 : 1] ); |
|---|
| 903 | printf("Coded Picture Store Size : %d\n", m_uiCodedPictureStoreSize); |
|---|
| 904 | printf("GOP size : %d\n", m_iGOPSize ); |
|---|
| 905 | printf("Rate GOP size : %d\n", m_iRateGOPSize ); |
|---|
| 906 | printf("Internal bit depth : %d\n", m_uiInternalBitDepth ); |
|---|
| 907 | |
|---|
| 908 | if ( m_iSymbolMode == 0 ) |
|---|
| 909 | { |
|---|
| 910 | printf("Entropy coder : VLC\n"); |
|---|
| 911 | } |
|---|
| 912 | else if( m_iSymbolMode == 1 ) |
|---|
| 913 | { |
|---|
| 914 | printf("Entropy coder : CABAC\n"); |
|---|
| 915 | } |
|---|
| 916 | else if( m_iSymbolMode == 2 ) |
|---|
| 917 | { |
|---|
| 918 | printf("Entropy coder : PIPE\n"); |
|---|
| 919 | } |
|---|
| 920 | else |
|---|
| 921 | { |
|---|
| 922 | assert(0); |
|---|
| 923 | } |
|---|
| 924 | |
|---|
| 925 | printf("GOP Format String : %s\n", m_cInputFormatString.c_str() ); |
|---|
| 926 | printf("Loop Filter Disabled : %d %d\n", m_abLoopFilterDisable[0] ? 1 : 0, m_abLoopFilterDisable[1] ? 1 : 0 ); |
|---|
| 927 | printf("Coded Camera Param. Precision: %d\n", m_iCodedCamParPrecision); |
|---|
| 928 | |
|---|
| 929 | #if HHI_VSO |
|---|
| 930 | printf("Force use of Lambda Scale : %d\n", m_bForceLambdaScaleVSO ); |
|---|
| 931 | |
|---|
| 932 | if ( m_bUseVSO ) |
|---|
| 933 | { |
|---|
| 934 | printf("VSO Lambda Scale : %5.2f\n", m_dLambdaScaleVSO ); |
|---|
| 935 | printf("VSO Mode : %d\n", m_uiVSOMode ); |
|---|
| 936 | printf("VSO Config : %s\n", m_pchVSOConfig ); |
|---|
| 937 | #if HHI_VSO_DIST_INT |
|---|
| 938 | printf("VSO Negative Distortion : %d\n", m_bAllowNegDist ? 1 : 0); |
|---|
| 939 | #endif |
|---|
| 940 | } |
|---|
| 941 | #endif |
|---|
| 942 | |
|---|
| 943 | |
|---|
| 944 | printf("\n"); |
|---|
| 945 | |
|---|
| 946 | printf("TOOL CFG GENERAL: "); |
|---|
| 947 | printf("IBD:%d ", !!g_uiBitIncrement); |
|---|
| 948 | printf("HAD:%d ", m_bUseHADME ); |
|---|
| 949 | printf("SRD:%d ", m_bUseSBACRD ); |
|---|
| 950 | printf("SQP:%d ", m_uiDeltaQpRD ); |
|---|
| 951 | printf("ASR:%d ", m_bUseASR ); |
|---|
| 952 | printf("PAD:%d ", m_bUsePAD ); |
|---|
| 953 | printf("LDC:%d ", m_bUseLDC ); |
|---|
| 954 | #if DCM_COMB_LIST |
|---|
| 955 | printf("LComb:%d ", m_bUseLComb ); |
|---|
| 956 | printf("LCMod:%d ", m_bLCMod ); |
|---|
| 957 | #endif |
|---|
| 958 | printf("FEN:%d ", m_bUseFastEnc ); |
|---|
| 959 | printf("RQT:%d ", 1 ); |
|---|
| 960 | printf("MRG:%d ", m_bUseMRG ); // SOPH: Merge Mode |
|---|
| 961 | #if LM_CHROMA |
|---|
| 962 | printf("LMC:%d ", m_bUseLMChroma ); |
|---|
| 963 | #endif |
|---|
| 964 | #if HHI_RMP_SWITCH |
|---|
| 965 | printf("RMP:%d ", m_bUseRMP); |
|---|
| 966 | #endif |
|---|
| 967 | printf("Slice:%d ",m_iSliceMode); |
|---|
| 968 | if (m_iSliceMode!=0) |
|---|
| 969 | { |
|---|
| 970 | printf("(%d) ", m_iSliceArgument); |
|---|
| 971 | } |
|---|
| 972 | printf("EntropySlice:%d ",m_iEntropySliceMode); |
|---|
| 973 | if (m_iEntropySliceMode!=0) |
|---|
| 974 | { |
|---|
| 975 | printf("(%d) ", m_iEntropySliceArgument); |
|---|
| 976 | } |
|---|
| 977 | #if CONSTRAINED_INTRA_PRED |
|---|
| 978 | printf("CIP:%d ", m_bUseConstrainedIntraPred); |
|---|
| 979 | #endif |
|---|
| 980 | #if MTK_SAO |
|---|
| 981 | #endif |
|---|
| 982 | printf("\n"); |
|---|
| 983 | printf("TOOL CFG VIDEO : "); |
|---|
| 984 | printf("ALF:%d ", (m_abUseALF [0] ? 1 : 0) ); |
|---|
| 985 | printf("SAO:%d ", (m_abUseSAO [0] ? 1 : 0)); |
|---|
| 986 | printf("RDQ:%d ", (m_abUseRDOQ[0] ? 1 : 0) ); |
|---|
| 987 | printf("\n"); |
|---|
| 988 | |
|---|
| 989 | printf("TOOL CFG DEPTH : "); |
|---|
| 990 | printf("ALF:%d ", (m_abUseALF [1] ? 1 : 0)); |
|---|
| 991 | printf("SAO:%d ", (m_abUseSAO [1] ? 1 : 0)); |
|---|
| 992 | printf("RDQ:%d ", (m_abUseRDOQ[1] ? 1 : 0)); |
|---|
| 993 | #if HHI_VSO |
|---|
| 994 | printf("VSO:%d ", m_bUseVSO ); |
|---|
| 995 | #endif |
|---|
| 996 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
|---|
| 997 | printf("DMM:%d ", m_bUseDMM ); |
|---|
| 998 | #endif |
|---|
| 999 | #if HHI_MPI |
|---|
| 1000 | printf("MVI:%d ", m_bUseMVI ? 1 : 0 ); |
|---|
| 1001 | #endif |
|---|
| 1002 | printf("\n"); |
|---|
| 1003 | |
|---|
| 1004 | fflush(stdout); |
|---|
| 1005 | } |
|---|
| 1006 | |
|---|
| 1007 | Void TAppEncCfg::xPrintUsage() |
|---|
| 1008 | { |
|---|
| 1009 | printf( " <name> = ALF - adaptive loop filter\n"); |
|---|
| 1010 | printf( " IBD - bit-depth increasement\n"); |
|---|
| 1011 | printf( " GPB - generalized B instead of P in low-delay mode\n"); |
|---|
| 1012 | printf( " HAD - hadamard ME for fractional-pel\n"); |
|---|
| 1013 | printf( " SRD - SBAC based RD estimation\n"); |
|---|
| 1014 | printf( " RDQ - RDOQ\n"); |
|---|
| 1015 | printf( " LDC - low-delay mode\n"); |
|---|
| 1016 | printf( " NRF - non-reference frame marking in last layer\n"); |
|---|
| 1017 | printf( " BQP - hier-P style QP assignment in low-delay mode\n"); |
|---|
| 1018 | printf( " PAD - automatic source padding of multiple of 16\n"); |
|---|
| 1019 | printf( " ASR - adaptive motion search range\n"); |
|---|
| 1020 | printf( " FEN - fast encoder setting\n"); |
|---|
| 1021 | printf( " MRG - merging of motion partitions\n"); // SOPH: Merge Mode |
|---|
| 1022 | |
|---|
| 1023 | #if LM_CHROMA |
|---|
| 1024 | printf( " LMC - intra chroma prediction based on luma\n"); |
|---|
| 1025 | #endif |
|---|
| 1026 | |
|---|
| 1027 | printf( "\n" ); |
|---|
| 1028 | printf( " Example 1) TAppEncoder.exe -c test.cfg -q 32 -g 8 -f 9 -s 64 -h 4\n"); |
|---|
| 1029 | printf(" -> QP 32, hierarchical-B GOP 8, 9 frames, 64x64-8x8 CU (~4x4 PU)\n\n"); |
|---|
| 1030 | printf( " Example 2) TAppEncoder.exe -c test.cfg -q 32 -g 4 -f 9 -s 64 -h 4 -1 LDC\n"); |
|---|
| 1031 | printf(" -> QP 32, hierarchical-P GOP 4, 9 frames, 64x64-8x8 CU (~4x4 PU)\n\n"); |
|---|
| 1032 | } |
|---|
| 1033 | |
|---|
| 1034 | Bool confirmPara(Bool bflag, const char* message) |
|---|
| 1035 | { |
|---|
| 1036 | if (!bflag) |
|---|
| 1037 | return false; |
|---|
| 1038 | |
|---|
| 1039 | printf("Error: %s\n",message); |
|---|
| 1040 | return true; |
|---|
| 1041 | } |
|---|
| 1042 | |
|---|
| 1043 | /* helper function */ |
|---|
| 1044 | /* for handling "-1/-0 FOO" */ |
|---|
| 1045 | void translateOldStyleCmdline(const char* value, po::Options& opts, const std::string& arg) |
|---|
| 1046 | { |
|---|
| 1047 | const char* argv[] = {arg.c_str(), value}; |
|---|
| 1048 | /* replace some short names with their long name varients */ |
|---|
| 1049 | if (arg == "LDC") |
|---|
| 1050 | { |
|---|
| 1051 | argv[0] = "LowDelayCoding"; |
|---|
| 1052 | } |
|---|
| 1053 | else if (arg == "RDQ") |
|---|
| 1054 | { |
|---|
| 1055 | argv[0] = "RDOQ"; |
|---|
| 1056 | } |
|---|
| 1057 | else if (arg == "HAD") |
|---|
| 1058 | { |
|---|
| 1059 | argv[0] = "HadamardME"; |
|---|
| 1060 | } |
|---|
| 1061 | else if (arg == "SRD") |
|---|
| 1062 | { |
|---|
| 1063 | argv[0] = "SBACRD"; |
|---|
| 1064 | } |
|---|
| 1065 | else if (arg == "IBD") |
|---|
| 1066 | { |
|---|
| 1067 | argv[0] = "BitIncrement"; |
|---|
| 1068 | } |
|---|
| 1069 | /* issue a warning for change in FEN behaviour */ |
|---|
| 1070 | if (arg == "FEN") |
|---|
| 1071 | { |
|---|
| 1072 | /* xxx todo */ |
|---|
| 1073 | } |
|---|
| 1074 | po::storePair(opts, argv[0], argv[1]); |
|---|
| 1075 | } |
|---|
| 1076 | |
|---|
| 1077 | void doOldStyleCmdlineOn(po::Options& opts, const std::string& arg) |
|---|
| 1078 | { |
|---|
| 1079 | if (arg == "IBD") |
|---|
| 1080 | { |
|---|
| 1081 | translateOldStyleCmdline("4", opts, arg); |
|---|
| 1082 | return; |
|---|
| 1083 | } |
|---|
| 1084 | translateOldStyleCmdline("1", opts, arg); |
|---|
| 1085 | } |
|---|
| 1086 | |
|---|
| 1087 | void doOldStyleCmdlineOff(po::Options& opts, const std::string& arg) |
|---|
| 1088 | { |
|---|
| 1089 | translateOldStyleCmdline("0", opts, arg); |
|---|
| 1090 | } |
|---|
| 1091 | |
|---|
| 1092 | Void TAppEncCfg::xAppendToFileNameEnd( Char* pchInputFileName, const Char* pchStringToAppend, Char*& rpchOutputFileName) |
|---|
| 1093 | { |
|---|
| 1094 | size_t iInLength = strlen(pchInputFileName); |
|---|
| 1095 | size_t iAppendLength = strlen(pchStringToAppend); |
|---|
| 1096 | |
|---|
| 1097 | rpchOutputFileName = (Char*) malloc(iInLength+iAppendLength+1); |
|---|
| 1098 | Char* pCDot = strrchr(pchInputFileName,'.'); |
|---|
| 1099 | pCDot = pCDot ? pCDot : pchInputFileName + iInLength; |
|---|
| 1100 | size_t iCharsToDot = pCDot - pchInputFileName ; |
|---|
| 1101 | size_t iCharsToEnd = iInLength - iCharsToDot; |
|---|
| 1102 | strncpy(rpchOutputFileName , pchInputFileName , iCharsToDot ); |
|---|
| 1103 | strncpy(rpchOutputFileName+ iCharsToDot , pchStringToAppend , iAppendLength); |
|---|
| 1104 | strncpy(rpchOutputFileName+ iCharsToDot+iAppendLength , pchInputFileName+iCharsToDot, iCharsToEnd ); |
|---|
| 1105 | rpchOutputFileName[iInLength+iAppendLength] = '\0'; |
|---|
| 1106 | } |
|---|