Changeset 56 in 3DVCSoftware for trunk/source/App/TAppEncoder
- Timestamp:
- 11 May 2012, 21:20:17 (13 years ago)
- Location:
- trunk/source/App/TAppEncoder
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/App/TAppEncoder/TAppEncCfg.cpp
r42 r56 2 2 * License, included below. This software may be subject to other third party 3 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-201 1,ISO/IEC6 * Copyright (c) 2010-2012, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 15 15 * this list of conditions and the following disclaimer in the documentation 16 16 * and/or other materials provided with the distribution. 17 * * Neither the name of the I SO/IEC nor the names of its contributors may17 * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 18 * be used to endorse or promote products derived from this software without 19 19 * specific prior written permission. … … 32 32 */ 33 33 34 35 36 34 /** \file TAppEncCfg.cpp 37 35 \brief Handle encoder configuration parameters … … 39 37 40 38 #include <stdlib.h> 41 #include <math.h>42 39 #include <cassert> 43 40 #include <cstring> 44 41 #include <string> 42 #include "TLibCommon/TComRom.h" 45 43 #include "TAppEncCfg.h" 46 #include "../../App/TAppCommon/program_options_lite.h" 47 44 #include "TAppCommon/program_options_lite.h" 45 46 #ifdef WIN32 47 #define strdup _strdup 48 #endif 48 49 49 50 using namespace std; 50 51 namespace po = df::program_options_lite; 52 53 //! \ingroup TAppEncoder 54 //! \{ 51 55 52 56 /* configuration helper funcs */ … … 62 66 */ 63 67 #define MAX_PAD_SIZE 16 64 #define MAX_INPUT_VIEW_NUM 1065 #define MAX_ERREF_VIEW_NUM 1566 68 67 69 // ==================================================================================================================== … … 72 74 { 73 75 m_aidQP = NULL; 74 #if HHI_VSO75 m_aaiERViewRefLutInd.resize( MAX_INPUT_VIEW_NUM );76 #endif77 76 } 78 77 … … 88 87 free (m_pchInputFileList[i]); 89 88 } 90 91 89 for(Int i = 0; i< m_pchDepthInputFileList.size(); i++ ) 92 90 { … … 94 92 free (m_pchDepthInputFileList[i]); 95 93 } 96 97 94 for(Int i = 0; i< m_pchReconFileList.size(); i++ ) 98 95 { … … 100 97 free (m_pchReconFileList[i]); 101 98 } 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 99 for(Int i = 0; i< m_pchDepthReconFileList.size(); i++ ) 100 { 101 if ( m_pchDepthReconFileList[i] != NULL ) 102 free (m_pchDepthReconFileList[i]); 103 } 109 104 if (m_pchBitstreamFile != NULL) 110 105 free (m_pchBitstreamFile) ; 111 112 #if FLEX_CODING_ORDER113 if (m_pchMVCJointCodingOrder != NULL)114 {115 free(m_pchMVCJointCodingOrder) ;116 }117 #endif118 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 106 #if HHI_VSO 131 107 if ( m_pchVSOConfig != NULL) … … 141 117 Void TAppEncCfg::destroy() 142 118 { 119 } 120 121 std::istringstream &operator>>( std::istringstream &in, GOPEntryMvc &entry ) //input 122 { 123 in>>entry.m_sliceType; 124 in>>entry.m_POC; 125 in>>entry.m_QPOffset; 126 in>>entry.m_QPFactor; 127 in>>entry.m_temporalId; 128 in>>entry.m_numRefPicsActive; 129 in>>entry.m_refPic; 130 in>>entry.m_numRefPics; 131 for ( Int i = 0; i < entry.m_numRefPics; i++ ) 132 { 133 in>>entry.m_referencePics[i]; 134 } 135 in>>entry.m_interRPSPrediction; 136 if (entry.m_interRPSPrediction) 137 { 138 in>>entry.m_deltaRIdxMinus1; 139 in>>entry.m_deltaRPS; 140 in>>entry.m_numRefIdc; 141 for ( Int i = 0; i < entry.m_numRefIdc; i++ ) 142 { 143 in>>entry.m_refIdc[i]; 144 } 145 } 146 in>>entry.m_numInterViewRefPics; 147 for( Int i = 0; i < entry.m_numInterViewRefPics; i++ ) 148 { 149 in>>entry.m_interViewRefs[i]; 150 } 151 for( Int i = 0; i < entry.m_numInterViewRefPics; i++ ) 152 { 153 in>>entry.m_interViewRefPosL0[i]; 154 } 155 for( Int i = 0; i < entry.m_numInterViewRefPics; i++ ) 156 { 157 in>>entry.m_interViewRefPosL1[i]; 158 } 159 return in; 143 160 } 144 161 … … 154 171 { 155 172 bool do_help = false; 156 157 string cfg_InputFile; 173 158 174 string cfg_BitstreamFile; 159 string cfg_ReconFile;160 175 string cfg_dQPFile; 161 162 #if FLEX_CODING_ORDER 163 string cfg_JointCodingOrdering; 164 #endif 165 176 string cfg_ColumnWidth; 177 string cfg_RowHeight; 178 string cfg_ScalingListFile; 166 179 po::Options opts; 167 180 opts.addOptions() 168 181 ("help", do_help, false, "this help text") 169 182 ("c", po::parseConfigFile, "configuration file name") 170 183 171 184 /* 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")185 ("InputFile_%d,i_%d", m_pchInputFileList, (char *) 0 , MAX_VIEW_NUM , "original Yuv input file name %d") 186 ("DepthInputFile_%d,di_%d", m_pchDepthInputFileList, (char *) 0 , MAX_VIEW_NUM , "original Yuv depth input file name %d") 187 ("ReconFile_%d,o_%d", m_pchReconFileList, (char *) 0 , MAX_VIEW_NUM , "reconstructed Yuv output file name %d") 188 ("DepthReconFile_%d,do_%d", m_pchDepthReconFileList, (char *) 0 , MAX_VIEW_NUM , "reconstructed Yuv depth output file name %d") 176 189 ("BitstreamFile,b", cfg_BitstreamFile, string(""), "bitstream output file name") 177 178 190 ("CodeDepthMaps", m_bUsingDepthMaps, false, "Encode depth maps" ) 179 191 ("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 192 ("LambdaModifier0,-LM0", m_adLambdaModifier[ 0 ], ( double )1.0, "Lambda modifier for temporal layer 0") 193 ("LambdaModifier1,-LM1", m_adLambdaModifier[ 1 ], ( double )1.0, "Lambda modifier for temporal layer 1") 194 ("LambdaModifier2,-LM2", m_adLambdaModifier[ 2 ], ( double )1.0, "Lambda modifier for temporal layer 2") 195 ("LambdaModifier3,-LM3", m_adLambdaModifier[ 3 ], ( double )1.0, "Lambda modifier for temporal layer 3") 185 196 ("SourceWidth,-wdt", m_iSourceWidth, 0, "Source picture width") 186 197 ("SourceHeight,-hgt", m_iSourceHeight, 0, "Source picture height") 198 #if PIC_CROPPING 199 ("CroppingMode", m_croppingMode, 0, "Cropping mode (0: no cropping, 1:automatic padding, 2: padding, 3:cropping") 200 ("CropLeft", m_cropLeft, 0, "Left cropping/padding for cropping mode 3") 201 ("CropRight", m_cropRight, 0, "Right cropping/padding for cropping mode 3") 202 ("CropTop", m_cropTop, 0, "Top cropping/padding for cropping mode 3") 203 ("CropBottom", m_cropBottom, 0, "Bottom cropping/padding for cropping mode 3") 204 ("HorizontalPadding,-pdx",m_aiPad[0], 0, "horizontal source padding for cropping mode 2") 205 ("VerticalPadding,-pdy", m_aiPad[1], 0, "vertical source padding for cropping mode 2") 206 #endif 187 207 ("InputBitDepth", m_uiInputBitDepth, 8u, "bit-depth of input file") 188 208 ("BitDepth", m_uiInputBitDepth, 8u, "deprecated alias of InputBitDepth") 189 209 ("OutputBitDepth", m_uiOutputBitDepth, 0u, "bit-depth of output file") 190 #if ENABLE_IBDI191 ("BitIncrement", m_uiBitIncrement, 0xffffffffu, "bit-depth increasement")192 #endif193 210 ("InternalBitDepth", m_uiInternalBitDepth, 0u, "Internal bit-depth (BitDepth+BitIncrement)") 211 #if !PIC_CROPPING 194 212 ("HorizontalPadding,-pdx",m_aiPad[0], 0, "horizontal source padding size") 195 213 ("VerticalPadding,-pdy", m_aiPad[1], 0, "vertical source padding size") 196 214 ("PAD", m_bUsePAD, false, "automatic source padding of multiple of 16" ) 215 #endif 197 216 ("FrameRate,-fr", m_iFrameRate, 0, "Frame rate") 198 217 ("FrameSkip,-fs", m_FrameSkip, 0u, "Number of frames to skip at start of input YUV") 199 218 ("FramesToBeEncoded,f", m_iFrameToBeEncoded, 0, "number of frames to be encoded (default=all)") 200 219 ("FrameToBeEncoded", m_iFrameToBeEncoded, 0, "depricated alias of FramesToBeEncoded") 201 220 202 221 ("NumberOfViews", m_iNumberOfViews, 0, "Number of views") 203 204 #if FLEX_CODING_ORDER205 ("FCO", m_b3DVFlexOrder, false, "flexible coding order flag" )206 ("CodingOrder", cfg_JointCodingOrdering, string(""), "The coding order for joint texture-depth coding")207 #endif208 209 222 /* Unit definition parameters */ 210 223 ("MaxCUWidth", m_uiMaxCUWidth, 64u) … … 214 227 ("MaxCUSize,s", m_uiMaxCUHeight, 64u, "max CU size") 215 228 ("MaxPartitionDepth,h", m_uiMaxCUDepth, 4u, "CU depth") 216 229 217 230 ("QuadtreeTULog2MaxSize", m_uiQuadtreeTULog2MaxSize, 6u) 218 231 ("QuadtreeTULog2MinSize", m_uiQuadtreeTULog2MinSize, 2u) 219 232 220 233 ("QuadtreeTUMaxDepthIntra", m_uiQuadtreeTUMaxDepthIntra, 1u) 221 234 ("QuadtreeTUMaxDepthInter", m_uiQuadtreeTUMaxDepthInter, 2u) 222 235 223 236 /* 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 237 ("IntraPeriod,-ip",m_iIntraPeriod, -1, "intra period in frames, (-1: only first frame)") 238 ("DecodingRefreshType,-dr",m_iDecodingRefreshType, 0, "intra refresh, (0:none 1:CRA 2:IDR)") 228 239 ("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") 240 #if !H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER 241 ("MaxNumberOfReorderPictures", m_numReorderFrames, -1, "Max. number of reorder pictures: -1: encoder determines value, >=0: set explicitly") 242 ("MaxNumberOfReferencePictures", m_maxNumberOfReferencePictures, 6, "Max. number of reference pictures") 243 #endif 244 ("ListCombination,-lc", m_bUseLComb, true, "combined reference list flag for uni-prediction in B-slices") 235 245 ("LCModification", m_bLCMod, false, "enables signalling of combined reference list derivation") 236 #endif 237 238 ("GOPFormatString,gfs", m_cInputFormatString, string(""), "Group of pictures") 239 246 ("DisableInter4x4", m_bDisInter4x4, true, "Disable Inter 4x4") 247 ("NSQT", m_enableNSQT, true, "Enable non-square transforms") 248 ("AMP", m_enableAMP, true, "Enable asymmetric motion partitions") 240 249 /* motion options */ 241 250 ("FastSearch", m_iFastSearch, 1, "0:Full search 1:Diamond 2:PMVFAST") … … 244 253 ("HadamardME", m_bUseHADME, true, "hadamard ME for fractional-pel") 245 254 ("ASR", m_bUseASR, false, "adaptive motion search range") 246 255 247 256 /* Quantization parameters */ 248 257 ("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 258 ("DeltaQpRD,-dqr",m_uiDeltaQpRD, 0u, "max dQp offset for slice") 250 259 ("MaxDeltaQP,d", m_iMaxDeltaQP, 0, "max dQp offset for block") 251 ("dQPFile,m", m_pchdQPFile , (char*) 0, "dQP file name") 260 ("MaxCuDQPDepth,-dqd", m_iMaxCuDQPDepth, 0, "max depth for a minimum CuDQP") 261 262 ("ChromaQpOffset, -cqo", m_iChromaQpOffset, 0, "ChromaQpOffset") 263 ("ChromaQpOffset2nd,-cqo2", m_iChromaQpOffset2nd, 0, "ChromaQpOffset2nd") 264 265 #if ADAPTIVE_QP_SELECTION 266 ("AdaptiveQpSelection,-aqps", m_bUseAdaptQpSelect, false, "AdaptiveQpSelection") 267 #endif 268 269 ("AdaptiveQP,-aq", m_bUseAdaptiveQP, false, "QP adaptation based on a psycho-visual model") 270 ("MaxQPAdaptationRange,-aqr", m_iQPAdaptationRange, 6, "QP adaptation range") 271 ("dQPFile,m", cfg_dQPFile, string(""), "dQP file name") 252 272 ("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") 273 ("TemporalLayerQPOffset_L0,-tq0", m_aiTLayerQPOffset[0], MAX_QP + 1, "QP offset of temporal layer 0") 274 ("TemporalLayerQPOffset_L1,-tq1", m_aiTLayerQPOffset[1], MAX_QP + 1, "QP offset of temporal layer 1") 275 ("TemporalLayerQPOffset_L2,-tq2", m_aiTLayerQPOffset[2], MAX_QP + 1, "QP offset of temporal layer 2") 276 ("TemporalLayerQPOffset_L3,-tq3", m_aiTLayerQPOffset[3], MAX_QP + 1, "QP offset of temporal layer 3") 277 278 #if !H0566_TLA 279 ("TLayeringBasedOnCodingStruct,-tl", m_bTLayering, false, "Temporal ID is set based on the hierarchical coding structure") 280 281 ("TLayerSwitchingFlag_L0,-ts0", m_abTLayerSwitchingFlag[0], false, "Switching flag for temporal layer 0") 282 ("TLayerSwitchingFlag_L1,-ts1", m_abTLayerSwitchingFlag[1], false, "Switching flag for temporal layer 1") 283 ("TLayerSwitchingFlag_L2,-ts2", m_abTLayerSwitchingFlag[2], false, "Switching flag for temporal layer 2") 284 ("TLayerSwitchingFlag_L3,-ts3", m_abTLayerSwitchingFlag[3], false, "Switching flag for temporal layer 3") 285 #endif 263 286 264 287 /* Entropy coding parameters */ 265 ("SymbolMode,-sym", m_iSymbolMode, 1, "symbol mode (0=VLC, 1=SBAC)")266 288 ("SBACRD", m_bUseSBACRD, true, "SBAC based RD estimation") 267 289 268 290 /* Deblocking filter parameters */ 269 291 ("LoopFilterDisable", m_abLoopFilterDisable, std::vector<Bool>(1,false), "Disables LoopFilter") 270 ("LoopFilterAlphaC0Offset", m_iLoopFilterAlphaC0Offset, 0) 271 ("LoopFilterBetaOffset", m_iLoopFilterBetaOffset, 0 ) 292 293 ("LoopFilterOffsetInAPS", m_loopFilterOffsetInAPS, false) 294 ("LoopFilterBetaOffset_div2", m_loopFilterBetaOffsetDiv2, 0 ) 295 ("LoopFilterTcOffset_div2", m_loopFilterTcOffsetDiv2, 0 ) 296 #if DBL_CONTROL 297 ("DeblockingFilterControlPresent", m_DeblockingFilterControlPresent, false) 298 #endif 272 299 273 300 /* Camera Paremetes */ … … 275 302 ("BaseViewCameraNumbers" , m_pchBaseViewCameraNumbers, (Char *) 0, "Numbers of base views") 276 303 277 278 /* View Synthesis Optimization */ 304 /* View Synthesis Optimization */ 279 305 280 306 #if HHI_VSO … … 293 319 #endif 294 320 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") 321 #endif 322 323 #if DEPTH_MAP_GENERATION 324 ("PredDepthMapGen", m_uiPredDepthMapGeneration, (UInt)0, "generation of prediction depth maps for motion data prediction" ) 325 #endif 326 #if HHI_INTER_VIEW_MOTION_PRED 327 ("MultiviewMvPred", m_uiMultiviewMvPredMode, (UInt)0, "usage of predicted depth maps" ) 328 ("MultiviewMvRegMode", m_uiMultiviewMvRegMode, (UInt)0, "regularization mode for multiview motion vectors" ) 329 ("MultiviewMvRegLambdaScale", m_dMultiviewMvRegLambdaScale, (Double)0, "lambda scale for multiview motion vector regularization" ) 330 #endif 331 #if HHI_INTER_VIEW_RESIDUAL_PRED 332 ("MultiviewResPred", m_uiMultiviewResPredMode, (UInt)0, "usage of inter-view residual prediction" ) 299 333 #endif 300 334 301 335 /* Coding tools */ 302 ("MRG", m_bUseMRG, true, "merging of motion partitions")303 304 #if LM_CHROMA305 336 ("LMChroma", m_bUseLMChroma, true, "intra chroma prediction based on recontructed luma") 306 #endif307 337 308 338 ("ALF", m_abUseALF, std::vector<Bool>(1,true), "Enables ALF") 309 #if MTK_SAO310 339 ("SAO", m_abUseSAO, std::vector<Bool>(1, true), "SAO") 311 #endif 312 313 #if MQT_ALF_NPASS 340 #if SAO_UNIT_INTERLEAVING 341 ("MaxNumOffsetsPerPic", m_maxNumOffsetsPerPic, 2048, "2048: default") 342 ("SAOInterleaving", m_saoInterleavingFlag, false, "0: SAO Picture Mode, 1: SAO Interleaving ") 343 #endif 344 314 345 ("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 346 347 ("ALFMaxNumFilter,-ALFMNF", m_iALFMaxNumberFilters, 16, "16: No Constrained, 1-15: Constrained max number of filter") 348 #if LCU_SYNTAX_ALF 349 ("ALFParamInSlice", m_bALFParamInSlice, false, "ALF parameters in 0: APS, 1: slice header") 350 ("ALFPicBasedEncode", m_bALFPicBasedEncode, true, "ALF picture-based encoding 0: false, 1: true") 351 #endif 352 322 353 ("SliceMode", m_iSliceMode, 0, "0: Disable all Recon slice limits, 1: Enforce max # of LCUs, 2: Enforce max # of bytes") 323 354 ("SliceArgument", m_iSliceArgument, 0, "if SliceMode==1 SliceArgument represents max # of LCUs. if SliceMode==2 SliceArgument represents max # of bytes.") 324 355 ("EntropySliceMode", m_iEntropySliceMode, 0, "0: Disable all entropy slice limits, 1: Enforce max # of LCUs, 2: Enforce constraint based entropy slices") 325 356 ("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 357 ("SliceGranularity", m_iSliceGranularity, 0, "0: Slices always end at LCU borders. 1-3: slices may end at a depth of 1-3 below LCU level.") 327 358 ("LFCrossSliceBoundaryFlag", m_bLFCrossSliceBoundaryFlag, true) 328 #endif 329 #if CONSTRAINED_INTRA_PRED 330 ("ConstrainedIntraPred", m_bUseConstrainedIntraPred, false, "Constrained Intra Prediction") 331 #endif 359 360 ("ConstrainedIntraPred", m_bUseConstrainedIntraPred, false, "Constrained Intra Prediction") 361 ("PCMEnabledFlag", m_usePCM , false) 362 ("PCMLog2MaxSize", m_pcmLog2MaxSize, 5u) 363 ("PCMLog2MinSize", m_uiPCMLog2MinSize, 3u) 364 365 ("PCMInputBitDepthFlag", m_bPCMInputBitDepthFlag, true) 366 ("PCMFilterDisableFlag", m_bPCMFilterDisableFlag, false) 367 #if LOSSLESS_CODING 368 ("LosslessCuEnabled", m_useLossless, false) 369 #endif 370 ("weighted_pred_flag,-wpP", m_bUseWeightPred, false, "weighted prediction flag (P-Slices)") 371 ("weighted_bipred_idc,-wpBidc", m_uiBiPredIdc, 0u, "weighted bipred idc (B-Slices)") 372 ("TileInfoPresentFlag", m_iColumnRowInfoPresent, 1, "0: tiles parameters are NOT present in the PPS. 1: tiles parameters are present in the PPS") 373 ("UniformSpacingIdc", m_iUniformSpacingIdr, 0, "Indicates if the column and row boundaries are distributed uniformly") 374 #if !REMOVE_TILE_DEPENDENCE 375 ("TileBoundaryIndependenceIdc", m_iTileBoundaryIndependenceIdr, 1, "Indicates if the column and row boundaries break the prediction") 376 #endif 377 ("NumTileColumnsMinus1", m_iNumColumnsMinus1, 0, "Number of columns in a picture minus 1") 378 ("ColumnWidthArray", cfg_ColumnWidth, string(""), "Array containing ColumnWidth values in units of LCU") 379 ("NumTileRowsMinus1", m_iNumRowsMinus1, 0, "Number of rows in a picture minus 1") 380 ("RowHeightArray", cfg_RowHeight, string(""), "Array containing RowHeight values in units of LCU") 381 ("TileLocationInSliceHeaderFlag", m_iTileLocationInSliceHeaderFlag, 0, "0: Disable transmission of tile location in slice header. 1: Transmit tile locations in slice header.") 382 ("TileMarkerFlag", m_iTileMarkerFlag, 0, "0: Disable transmission of lightweight tile marker. 1: Transmit light weight tile marker.") 383 ("MaxTileMarkerEntryPoints", m_iMaxTileMarkerEntryPoints, 4, "Maximum number of uniformly-spaced tile entry points (using light weigh tile markers). Default=4. If number of tiles < MaxTileMarkerEntryPoints then all tiles have entry points.") 384 ("TileControlPresentFlag", m_iTileBehaviorControlPresentFlag, 1, "0: tiles behavior control parameters are NOT present in the PPS. 1: tiles behavior control parameters are present in the PPS") 385 ("LFCrossTileBoundaryFlag", m_bLFCrossTileBoundaryFlag, true, "1: cross-tile-boundary loop filtering. 0:non-cross-tile-boundary loop filtering") 386 ("WaveFrontSynchro", m_iWaveFrontSynchro, 0, "0: no synchro; 1 synchro with TR; 2 TRR etc") 387 ("WaveFrontFlush", m_iWaveFrontFlush, 0, "Flush and terminate CABAC coding for each LCU line") 388 ("WaveFrontSubstreams", m_iWaveFrontSubstreams, 1, "# coded substreams wanted; per tile if TileBoundaryIndependenceIdc is 1, otherwise per frame") 389 ("ScalingList", m_useScalingListId, 0, "0: no scaling list, 1: default scaling lists, 2: scaling lists specified in ScalingListFile") 390 ("ScalingListFile", cfg_ScalingListFile, string(""), "Scaling list file name") 391 #if MULTIBITS_DATA_HIDING 392 ("SignHideFlag,-SBH", m_signHideFlag, 1) 393 ("SignHideThreshold,-TSIG", m_signHidingThreshold, 4) 394 #endif 395 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 396 ("DMM", m_bUseDMM, false, "depth model modes flag") 397 #endif 398 332 399 /* Misc. */ 333 ("SEIpictureDigest", m_pictureDigestEnabled, false, "Control generation of picture_digest SEI messages\n"400 ("SEIpictureDigest", m_pictureDigestEnabled, true, "Control generation of picture_digest SEI messages\n" 334 401 "\t1: use MD5\n" 335 402 "\t0: disable") 403 404 ("TMVP", m_enableTMVP, true, "Enable TMVP" ) 405 336 406 ("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") 407 ("ECU", m_bUseEarlyCU, false, "Early CU setting") 408 #if FAST_DECISION_FOR_MRG_RD_COST 409 ("FDM", m_useFastDecisionForMerge, true, "Fast decision for Merge RD Cost") 410 #endif 411 ("CFM", m_bUseCbfFastMode, false, "Cbf fast mode setting") 361 412 #if HHI_INTERVIEW_SKIP 362 ("InterViewSkip", m_ uiInterViewSkip, (UInt)0, "usage of interview skip" )413 ("InterViewSkip", m_bInterViewSkip, false, "usage of interview skip" ) 363 414 #if HHI_INTERVIEW_SKIP_LAMBDA_SCALE 364 415 ("InterViewSkipLambdaScale", m_dInterViewSkipLambdaScale, (Double)8, "lambda scale for interview skip" ) 365 416 #endif 366 417 #endif 367 368 418 /* Compatability with old style -1 FOO or -0 FOO options. */ 369 419 ("1", doOldStyleCmdlineOn, "turn option <name> on") 370 420 ("0", doOldStyleCmdlineOff, "turn option <name> off") 421 #if HHI_MPI 422 ("MVI", m_bUseMVI, false, "use motion vector inheritance for depth map coding") 423 #endif 371 424 ; 425 426 // parse coding structure 427 for( Int k = 0; k < MAX_VIEW_NUM; k++ ) 428 { 429 if( k == 0 ) 430 { 431 for( Int i = 1; i < MAX_GOP + 1; i++ ) 432 { 433 std::ostringstream cOSS; 434 cOSS<<"Frame"<<i; 435 opts.addOptions()( cOSS.str(), m_GOPListsMvc[k][i-1], GOPEntryMvc() ); 436 } 437 } 438 else 439 { 440 std::ostringstream cOSS1; 441 cOSS1<<"FrameI"<<"_v"<<k; 442 opts.addOptions()(cOSS1.str(), m_GOPListsMvc[k][MAX_GOP], GOPEntryMvc()); 443 444 for( Int i = 1; i < MAX_GOP + 1; i++ ) 445 { 446 std::ostringstream cOSS2; 447 cOSS2<<"Frame"<<i<<"_v"<<k; 448 opts.addOptions()(cOSS2.str(), m_GOPListsMvc[k][i-1], GOPEntryMvc()); 449 } 450 } 451 } 372 452 373 453 po::setDefaults(opts); … … 378 458 fprintf(stderr, "Unhandled argument ignored: `%s'\n", *it); 379 459 } 380 460 381 461 if (argc == 1 || do_help) 382 462 { … … 386 466 return false; 387 467 } 388 468 389 469 /* 390 470 * Set any derived parameters … … 393 473 m_pchBitstreamFile = cfg_BitstreamFile.empty() ? NULL : strdup(cfg_BitstreamFile.c_str()); 394 474 m_pchdQPFile = cfg_dQPFile.empty() ? NULL : strdup(cfg_dQPFile.c_str()); 395 396 397 #if FLEX_CODING_ORDER 398 m_pchMVCJointCodingOrder = cfg_JointCodingOrdering.empty()?NULL:strdup(cfg_JointCodingOrdering.c_str()); 399 // If flexible order is enabled and if depth comes before the texture for a view, disable VSO 400 401 #if HHI_VSO && DISABLE_FCO_FOR_VSO 402 Bool depthComesFirst = false; 403 if ( m_b3DVFlexOrder ) 404 { 405 for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) 406 { 407 for ( Int ii=1; ii<12; ii+=2 ) 408 { 409 Int iViewIdxCfg = (Int)(m_pchMVCJointCodingOrder[ii]-'0'); 410 if ( iViewIdxCfg == iViewIdx ) 411 { 412 if ( m_pchMVCJointCodingOrder[ii-1]=='D' ) // depth comes first for this view 413 { 414 depthComesFirst = true; 415 break; 416 } 417 else 418 { 419 assert(m_pchMVCJointCodingOrder[ii-1]=='T'); 420 } 421 } 422 } 423 } 424 } 425 if (depthComesFirst) 426 { 427 m_bUseVSO = false; 428 } 429 #endif 430 #endif 431 432 // GT FIX 475 476 m_pchColumnWidth = cfg_ColumnWidth.empty() ? NULL: strdup(cfg_ColumnWidth.c_str()); 477 m_pchRowHeight = cfg_RowHeight.empty() ? NULL : strdup(cfg_RowHeight.c_str()); 478 m_scalingListFile = cfg_ScalingListFile.empty() ? NULL : strdup(cfg_ScalingListFile.c_str()); 479 433 480 if ( m_bUsingDepthMaps ) 434 481 { … … 448 495 }; 449 496 } 450 // GT FIX END451 452 if (m_iRateGOPSize == -1)453 {454 /* if rateGOPSize has not been specified, the default value is GOPSize */455 m_iRateGOPSize = m_iGOPSize;456 }457 458 // compute source padding size459 if ( m_bUsePAD )460 {461 if ( m_iSourceWidth%MAX_PAD_SIZE )462 {463 m_aiPad[0] = (m_iSourceWidth/MAX_PAD_SIZE+1)*MAX_PAD_SIZE - m_iSourceWidth;464 }465 466 if ( m_iSourceHeight%MAX_PAD_SIZE )467 {468 m_aiPad[1] = (m_iSourceHeight/MAX_PAD_SIZE+1)*MAX_PAD_SIZE - m_iSourceHeight;469 }470 }471 m_iSourceWidth += m_aiPad[0];472 m_iSourceHeight += m_aiPad[1];473 474 //GT QP Depth475 497 if ( m_adQP.size() < 2 ) 476 498 { … … 481 503 m_aiQP.push_back( (Int)( m_adQP[uiK] ) ); 482 504 } 483 //GT QP Depth end 505 506 #if PIC_CROPPING 507 switch (m_croppingMode) 508 { 509 case 0: 510 { 511 // no cropping or padding 512 m_cropLeft = m_cropRight = m_cropTop = m_cropBottom = 0; 513 m_aiPad[1] = m_aiPad[0] = 0; 514 break; 515 } 516 case 1: 517 { 518 // automatic padding to minimum CU size 519 Int minCuSize = m_uiMaxCUHeight >> (m_uiMaxCUDepth - 1); 520 if (m_iSourceWidth % minCuSize) 521 { 522 m_aiPad[0] = m_cropRight = ((m_iSourceWidth / minCuSize) + 1) * minCuSize - m_iSourceWidth; 523 m_iSourceWidth += m_cropRight; 524 } 525 if (m_iSourceHeight % minCuSize) 526 { 527 m_aiPad[1] = m_cropBottom = ((m_iSourceHeight / minCuSize) + 1) * minCuSize - m_iSourceHeight; 528 m_iSourceHeight += m_cropBottom; 529 } 530 break; 531 } 532 case 2: 533 { 534 //padding 535 m_iSourceWidth += m_aiPad[0]; 536 m_iSourceHeight += m_aiPad[1]; 537 m_cropRight = m_aiPad[0]; 538 m_cropBottom = m_aiPad[1]; 539 break; 540 } 541 case 3: 542 { 543 // cropping 544 if ((m_cropLeft == 0) && (m_cropRight == 0) && (m_cropTop == 0) && (m_cropBottom == 0)) 545 { 546 fprintf(stderr, "Warning: Cropping enabled, but all cropping parameters set to zero\n"); 547 } 548 if ((m_aiPad[1] != 0) || (m_aiPad[0]!=0)) 549 { 550 fprintf(stderr, "Warning: Cropping enabled, padding parameters will be ignored\n"); 551 } 552 m_aiPad[1] = m_aiPad[0] = 0; 553 break; 554 } 555 } 556 #else 557 558 // compute source padding size 559 if ( m_bUsePAD ) 560 { 561 if ( m_iSourceWidth%MAX_PAD_SIZE ) 562 { 563 m_aiPad[0] = (m_iSourceWidth/MAX_PAD_SIZE+1)*MAX_PAD_SIZE - m_iSourceWidth; 564 } 565 566 if ( m_iSourceHeight%MAX_PAD_SIZE ) 567 { 568 m_aiPad[1] = (m_iSourceHeight/MAX_PAD_SIZE+1)*MAX_PAD_SIZE - m_iSourceHeight; 569 } 570 } 571 m_iSourceWidth += m_aiPad[0]; 572 m_iSourceHeight += m_aiPad[1]; 573 #endif 574 575 // allocate slice-based dQP values 576 m_aidQP = new Int[ m_iFrameToBeEncoded + m_iGOPSize + 1 ]; 577 m_aidQPdepth = new Int[ m_iFrameToBeEncoded + m_iGOPSize + 1 ]; 578 ::memset( m_aidQP, 0, sizeof(Int)*( m_iFrameToBeEncoded + m_iGOPSize + 1 ) ); 579 ::memset( m_aidQPdepth, 0, sizeof(Int)*( m_iFrameToBeEncoded + m_iGOPSize + 1 ) ); 580 581 // handling of floating-point QP values 582 // if QP is not integer, sequence is split into two sections having QP and QP+1 583 m_aiQP[0] = (Int)( m_adQP[0] ); 584 if ( m_aiQP[0] < m_adQP[0] ) 585 { 586 Int iSwitchPOC = (Int)( m_iFrameToBeEncoded - (m_adQP[0] - m_aiQP[0])*m_iFrameToBeEncoded + 0.5 ); 587 588 iSwitchPOC = (Int)( (Double)iSwitchPOC / m_iGOPSize + 0.5 )*m_iGOPSize; 589 for ( Int i=iSwitchPOC; i<m_iFrameToBeEncoded + m_iGOPSize + 1; i++ ) 590 { 591 m_aidQP[i] = 1; 592 } 593 } 594 595 m_aiQP[1] = (Int)( m_adQP[1] ); 596 if ( m_aiQP[1] < m_adQP[1] ) 597 { 598 Int iSwitchPOC = (Int)( m_iFrameToBeEncoded - (m_adQP[1] - m_aiQP[1])*m_iFrameToBeEncoded + 0.5 ); 599 600 iSwitchPOC = (Int)( (Double)iSwitchPOC / m_iGOPSize + 0.5 )*m_iGOPSize; 601 for ( Int i=iSwitchPOC; i<m_iFrameToBeEncoded + m_iGOPSize + 1; i++ ) 602 { 603 m_aidQPdepth[i] = 1; 604 } 605 } 606 607 // reading external dQP description from file 608 if ( m_pchdQPFile ) 609 { 610 FILE* fpt=fopen( m_pchdQPFile, "r" ); 611 if ( fpt ) 612 { 613 Int iValue; 614 Int iPOC = 0; 615 while ( iPOC < m_iFrameToBeEncoded ) 616 { 617 if ( fscanf(fpt, "%d", &iValue ) == EOF ) break; 618 m_aidQP[ iPOC ] = iValue; 619 iPOC++; 620 } 621 fclose(fpt); 622 } 623 } 484 624 485 625 #if HHI_VSO … … 516 656 517 657 #if HHI_VSO 518 if ( m_bUseVSO )519 {520 if ( m_iNumberOfExternalRefs != 0 )521 {522 xCleanUpVector( m_aaiERViewRefInd, vector<Int>() );523 xCleanUpVector( m_aaiBaseViewRefInd, vector<Int>() );524 }525 else526 {527 m_aaiERViewRefInd .clear();528 m_aaiERViewRefInd .resize( m_iNumberOfViews );529 m_aaiERViewRefLutInd.clear();530 m_aaiERViewRefLutInd.resize( m_iNumberOfViews );531 m_aaiBaseViewRefInd .clear();532 m_aaiBaseViewRefInd .resize( m_iNumberOfViews );533 }534 }535 658 536 659 #if HHI_VSO_LS_TABLE … … 549 672 #endif 550 673 551 674 // set global variables 552 675 xSetGlobal(); 553 676 … … 611 734 xCheckParameter(); 612 735 m_cCameraData.check( false, true ); 613 736 614 737 // print-out parameters 615 738 xPrintParameter(); 616 739 617 740 return true; 618 741 } … … 629 752 #define xConfirmPara(a,b) check_failed |= confirmPara(a,b) 630 753 // check range of parameters 631 #if ENABLE_IBDI 632 xConfirmPara( m_uiInternalBitDepth > 0 && (int)m_uiBitIncrement != -1, "InternalBitDepth and BitIncrement may not be specified simultaneously"); 754 xConfirmPara( m_uiInputBitDepth < 8, "InputBitDepth must be at least 8" ); 755 xConfirmPara( m_iFrameRate <= 0, "Frame rate must be more than 1" ); 756 xConfirmPara( m_iFrameToBeEncoded <= 0, "Total Number Of Frames encoded must be more than 0" ); 757 xConfirmPara( m_iGOPSize < 1 , "GOP Size must be greater or equal to 1" ); 758 xConfirmPara( m_iGOPSize > 1 && m_iGOPSize % 2, "GOP Size must be a multiple of 2, if GOP Size is greater than 1" ); 759 xConfirmPara( (m_iIntraPeriod > 0 && m_iIntraPeriod < m_iGOPSize) || m_iIntraPeriod == 0, "Intra period must be more than GOP size, or -1 , not 0" ); 760 xConfirmPara( m_iDecodingRefreshType < 0 || m_iDecodingRefreshType > 2, "Decoding Refresh Type must be equal to 0, 1 or 2" ); 761 #if H0736_AVC_STYLE_QP_RANGE 762 xConfirmPara( m_aiQP[0] < -6 * ((Int)m_uiInternalBitDepth - 8) || m_aiQP[0] > 51, "QP exceeds supported range (-QpBDOffsety to 51)" ); 763 if ( m_aiQP.size() >= 2 ) 764 { 765 xConfirmPara( m_aiQP[1] < -6 * ((Int)m_uiInternalBitDepth - 8) || m_aiQP[1] > 51, "QP depth exceeds supported range (-QpBDOffsety to 51)" ); 766 } 633 767 #else 634 xConfirmPara( m_uiInputBitDepth < 8, "InputBitDepth must be at least 8" );635 #endif636 xConfirmPara( m_iFrameRate <= 0, "Frame rate must be more than 1" );637 xConfirmPara( m_iFrameToBeEncoded <= 0, "Total Number Of Frames encoded must be more than 1" );638 xConfirmPara( m_iGOPSize < 1 , "GOP Size must be more than 1" );639 #if DCM_DECODING_REFRESH640 xConfirmPara( m_iDecodingRefreshType < 0 || m_iDecodingRefreshType > 2, "Decoding Refresh Type must be equal to 0, 1 or 2" );641 #endif642 //GT QP Depth643 768 xConfirmPara( m_aiQP[0] < 0 || m_aiQP[0] > 51, "QP exceeds supported range (0 to 51)" ); 644 769 if ( m_aiQP.size() >= 2 ) … … 646 771 xConfirmPara( m_aiQP[1] < 0 || m_aiQP[1] > 51, "QP Depth exceeds supported range (0 to 51)" ); 647 772 } 648 //GT QP Depth End 649 #if MQT_ALF_NPASS 773 #endif 650 774 xConfirmPara( m_iALFEncodePassReduction < 0 || m_iALFEncodePassReduction > 2, "ALFEncodePassReduction must be equal to 0, 1 or 2"); 651 #endif 652 xConfirmPara( m_iLoopFilterAlphaC0Offset < -26 || m_iLoopFilterAlphaC0Offset > 26, "Loop Filter Alpha Offset exceeds supported range (-26 to 26)" ); 653 xConfirmPara( m_iLoopFilterBetaOffset < -26 || m_iLoopFilterBetaOffset > 26, "Loop Filter Beta Offset exceeds supported range (-26 to 26)"); 775 #if LCU_SYNTAX_ALF 776 xConfirmPara( m_iALFMaxNumberFilters < 1, "ALFMaxNumFilter should be larger than 1"); 777 #else 778 xConfirmPara( m_iALFMaxNumberFilters < 1 || m_iALFMaxNumberFilters > 16, "ALFMaxNumFilter exceeds supported range (1 to 16)"); 779 #endif 780 xConfirmPara( m_loopFilterBetaOffsetDiv2 < -13 || m_loopFilterBetaOffsetDiv2 > 13, "Loop Filter Beta Offset div. 2 exceeds supported range (-13 to 13)"); 781 xConfirmPara( m_loopFilterTcOffsetDiv2 < -13 || m_loopFilterTcOffsetDiv2 > 13, "Loop Filter Tc Offset div. 2 exceeds supported range (-13 to 13)"); 654 782 xConfirmPara( m_iFastSearch < 0 || m_iFastSearch > 2, "Fast Search Mode is not supported value (0:Full search 1:Diamond 2:PMVFAST)" ); 655 783 xConfirmPara( m_iSearchRange < 0 , "Search Range must be more than 0" ); 656 784 xConfirmPara( m_bipredSearchRange < 0 , "Search Range must be more than 0" ); 657 785 xConfirmPara( m_iMaxDeltaQP > 7, "Absolute Delta QP exceeds supported range (0 to 7)" ); 786 xConfirmPara( m_iMaxCuDQPDepth > m_uiMaxCUDepth - 1, "Absolute depth for a minimum CuDQP exceeds maximum coding unit depth" ); 787 788 xConfirmPara( m_iChromaQpOffset < -12, "Min. Chroma Qp Offset is -12" ); 789 xConfirmPara( m_iChromaQpOffset > 12, "Max. Chroma Qp Offset is 12" ); 790 xConfirmPara( m_iChromaQpOffset2nd < -12, "Min. Chroma Qp Offset 2nd is -12" ); 791 xConfirmPara( m_iChromaQpOffset2nd > 12, "Max. Chroma Qp Offset 2nd is 12" ); 792 793 xConfirmPara( m_iQPAdaptationRange <= 0, "QP Adaptation Range must be more than 0" ); 794 if (m_iDecodingRefreshType == 2) 795 { 796 xConfirmPara( m_iIntraPeriod > 0 && m_iIntraPeriod <= m_iGOPSize , "Intra period must be larger than GOP size for periodic IDR pictures"); 797 } 658 798 xConfirmPara( (m_uiMaxCUWidth >> m_uiMaxCUDepth) < 4, "Minimum partition width size should be larger than or equal to 8"); 659 799 xConfirmPara( (m_uiMaxCUHeight >> m_uiMaxCUDepth) < 4, "Minimum partition height size should be larger than or equal to 8"); 660 800 xConfirmPara( m_uiMaxCUWidth < 16, "Maximum partition width size should be larger than or equal to 16"); 661 801 xConfirmPara( m_uiMaxCUHeight < 16, "Maximum partition height size should be larger than or equal to 16"); 802 #if PIC_CROPPING 803 xConfirmPara( (m_iSourceWidth % (m_uiMaxCUWidth >> (m_uiMaxCUDepth-1)))!=0, "Resulting coded frame width must be a multiple of the minimum CU size"); 804 xConfirmPara( (m_iSourceHeight % (m_uiMaxCUHeight >> (m_uiMaxCUDepth-1)))!=0, "Resulting coded frame height must be a multiple of the minimum CU size"); 805 #else 662 806 xConfirmPara( (m_iSourceWidth % (m_uiMaxCUWidth >> (m_uiMaxCUDepth-1)))!=0, "Frame width should be multiple of minimum CU size"); 663 807 xConfirmPara( (m_iSourceHeight % (m_uiMaxCUHeight >> (m_uiMaxCUDepth-1)))!=0, "Frame height should be multiple of minimum CU size"); 664 808 #endif 809 665 810 xConfirmPara( m_uiQuadtreeTULog2MinSize < 2, "QuadtreeTULog2MinSize must be 2 or greater."); 666 811 xConfirmPara( m_uiQuadtreeTULog2MinSize > 5, "QuadtreeTULog2MinSize must be 5 or smaller."); … … 677 822 xConfirmPara( m_uiQuadtreeTUMaxDepthIntra > m_uiQuadtreeTULog2MaxSize - m_uiQuadtreeTULog2MinSize + 1, "QuadtreeTUMaxDepthIntra must be less than or equal to the difference between QuadtreeTULog2MaxSize and QuadtreeTULog2MinSize plus 1" ); 678 823 679 xConfirmPara( m_iSliceMode < 0 || m_iSliceMode > 2, "SliceMode exceeds supported range (0 to 2)" ); 680 if (m_iSliceMode!=0) 681 { 682 xConfirmPara( m_iSliceArgument < 1 , "SliceArgument should be larger than or equal to 1" ); 683 } 684 xConfirmPara( m_iEntropySliceMode < 0 || m_iEntropySliceMode > 2, "EntropySliceMode exceeds supported range (0 to 2)" ); 685 if (m_iEntropySliceMode!=0) 686 { 687 xConfirmPara( m_iEntropySliceArgument < 1 , "EntropySliceArgument should be larger than or equal to 1" ); 688 } 689 690 xConfirmPara( m_iSymbolMode < 0 || m_iSymbolMode > 1, "SymbolMode must be equal to 0 or 1" ); 691 692 // Check MultiView stuff 693 xConfirmPara ( m_iNumberOfViews > MAX_INPUT_VIEW_NUM , "NumberOfViews must be less than or equal to MAX_INPUT_VIEW_NUM"); 824 xConfirmPara( m_iNumberOfViews > MAX_VIEW_NUM , "NumberOfViews must be less than or equal to MAX_VIEW_NUM"); 694 825 xConfirmPara ( Int( m_pchInputFileList.size() ) < m_iNumberOfViews, "Number of InputFiles must be greater than or equal to NumberOfViews" ); 695 826 xConfirmPara ( Int( m_pchReconFileList.size() ) < m_iNumberOfViews, "Number of ReconFiles must be greater than or equal to NumberOfViews" ); 696 697 827 xConfirmPara ( m_iCodedCamParPrecision < 0 || m_iCodedCamParPrecision > 5, "CodedCamParsPrecision must be in range of 0..5" ); 828 #if HHI_INTERVIEW_SKIP 829 xConfirmPara ( m_bInterViewSkip && !m_bUsingDepthMaps, "RenderingSkipMode requires CodeDepthMaps = 1" ); 830 #endif 698 831 #if DEPTH_MAP_GENERATION 699 832 xConfirmPara ( m_uiPredDepthMapGeneration > 2, "PredDepthMapGen must be less than or equal to 2" ); … … 714 847 xConfirmPara ( m_uiMultiviewResPredMode > 0 && m_uiPredDepthMapGeneration == 0 , "MultiviewResPred > 0 requires PredDepthMapGen > 0" ); 715 848 #endif 716 717 #if HHI_INTERVIEW_SKIP718 xConfirmPara ( m_uiInterViewSkip > 1, "RenderingSkipMode > 1 not supported" );719 xConfirmPara ( m_uiInterViewSkip > 0 && !m_bUsingDepthMaps, "RenderingSkipMode > 0 requires CodeDepthMaps = 1" );720 #endif721 849 if( m_bUsingDepthMaps ) 722 850 { … … 732 860 xConfirmPara( m_iNumberOfViews != m_cCameraData.getBaseViewNumbers().size(), "Number of Views in BaseViewCameraNumbers must be equal to NumberOfViews" ); 733 861 xConfirmPara( m_uiVSOMode < 0 || m_uiVSOMode > 4 , "VSO Mode must be greater than or equal to 0 and less than 5"); 734 xConfirmPara( m_iNumberOfExternalRefs > MAX_ERREF_VIEW_NUM, "NumberOfExternalRefs must be less than of equal to TAppMVEncCfg::MAX_ERREF_VIEW_NUM" ); 735 xConfirmPara( Int( m_pchERRefFileList .size() ) < m_iNumberOfExternalRefs, "Number of ERRefFileFiles must be greater than or equal to NumberOfExternalRefs" ); 736 } 737 #endif 738 } 739 740 #if DCM_COMB_LIST 741 #if !HHI_NO_LowDelayCoding 742 xConfirmPara( m_bUseLComb==false && m_bUseLDC==false, "LComb can only be 0 if LowDelayCoding is 1" ); 743 #else 744 xConfirmPara( m_bUseLComb==false, "LComb can only be 0 if LowDelayCoding is 1" ); 745 #endif 862 } 863 #endif 864 } 865 #if ADAPTIVE_QP_SELECTION 866 #if H0736_AVC_STYLE_QP_RANGE 867 xConfirmPara( m_bUseAdaptQpSelect == true && m_aiQP[0] < 0, "AdaptiveQpSelection must be disabled when QP < 0."); 868 xConfirmPara( m_bUseAdaptQpSelect == true && m_aiQP[1] < 0, "AdaptiveQpSelection must be disabled when QP < 0."); 869 xConfirmPara( m_bUseAdaptQpSelect == true && (m_iChromaQpOffset !=0 || m_iChromaQpOffset2nd != 0 ), "AdaptiveQpSelection must be disabled when ChromaQpOffset is not equal to 0."); 870 #endif 871 #endif 872 873 if( m_usePCM) 874 { 875 xConfirmPara( m_uiPCMLog2MinSize < 3, "PCMLog2MinSize must be 3 or greater."); 876 xConfirmPara( m_uiPCMLog2MinSize > 5, "PCMLog2MinSize must be 5 or smaller."); 877 xConfirmPara( m_pcmLog2MaxSize > 5, "PCMLog2MaxSize must be 5 or smaller."); 878 xConfirmPara( m_pcmLog2MaxSize < m_uiPCMLog2MinSize, "PCMLog2MaxSize must be equal to or greater than m_uiPCMLog2MinSize."); 879 } 880 881 #if FIXED_NUMBER_OF_TILES_SLICE_MODE 882 xConfirmPara( m_iSliceMode < 0 || m_iSliceMode > 3, "SliceMode exceeds supported range (0 to 3)" ); 883 #endif 884 if (m_iSliceMode!=0) 885 { 886 xConfirmPara( m_iSliceArgument < 1 , "SliceArgument should be larger than or equal to 1" ); 887 } 888 #if FIXED_NUMBER_OF_TILES_SLICE_MODE 889 if (m_iSliceMode==3) 890 { 891 xConfirmPara( m_iSliceGranularity > 0 , "When SliceMode == 3 is chosen, the SliceGranularity must be 0" ); 892 } 893 #endif 894 xConfirmPara( m_iEntropySliceMode < 0 || m_iEntropySliceMode > 2, "EntropySliceMode exceeds supported range (0 to 2)" ); 895 if (m_iEntropySliceMode!=0) 896 { 897 xConfirmPara( m_iEntropySliceArgument < 1 , "EntropySliceArgument should be larger than or equal to 1" ); 898 } 899 xConfirmPara( m_iSliceGranularity >= m_uiMaxCUDepth, "SliceGranularity must be smaller than maximum cu depth"); 900 xConfirmPara( m_iSliceGranularity <0 || m_iSliceGranularity > 3, "SliceGranularity exceeds supported range (0 to 3)" ); 901 xConfirmPara( m_iSliceGranularity > m_iMaxCuDQPDepth, "SliceGranularity must be smaller smaller than or equal to maximum dqp depth" ); 902 903 #if NO_COMBINED_PARALLEL 904 bool tileFlag = (m_iNumColumnsMinus1 > 0 || m_iNumRowsMinus1 > 0 ); 905 xConfirmPara( tileFlag && m_iEntropySliceMode, "Tile and Entropy Slice can not be applied together"); 906 xConfirmPara( tileFlag && m_iWaveFrontSynchro, "Tile and Wavefront can not be applied together"); 907 xConfirmPara( m_iWaveFrontSynchro && m_iEntropySliceMode, "Wavefront and Entropy Slice can not be applied together"); 746 908 #endif 747 909 … … 761 923 xConfirmPara( ui != 1 , "Height should be 2^n"); 762 924 } 763 764 // SBACRD is supported only for SBAC 765 if ( m_iSymbolMode == 0 ) 766 { 767 m_bUseSBACRD = false; 768 } 925 926 xConfirmPara( m_iWaveFrontSynchro < 0, "WaveFrontSynchro cannot be negative" ); 927 xConfirmPara( m_iWaveFrontFlush < 0, "WaveFrontFlush cannot be negative" ); 928 xConfirmPara( m_iWaveFrontSubstreams <= 0, "WaveFrontSubstreams must be positive" ); 929 xConfirmPara( m_iWaveFrontSubstreams > 1 && !m_iWaveFrontSynchro, "Must have WaveFrontSynchro > 0 in order to have WaveFrontSubstreams > 1" ); 769 930 770 931 #undef xConfirmPara 771 932 if (check_failed) 933 { 934 exit(EXIT_FAILURE); 935 } 936 937 xCheckCodingStructureMvc(); 938 } 939 940 Void TAppEncCfg::xCheckCodingStructureMvc() 941 { 942 bool check_failed = false; /* abort if there is a fatal configuration problem */ 943 #define xConfirmPara(a,b) check_failed |= confirmPara(a,b) 944 945 // validate that POC of same frame is identical across multiple views 946 Bool bErrorMvePoc = false; 947 if( m_iNumberOfViews > 1 ) 948 { 949 for( Int k = 1; k < m_iNumberOfViews; k++ ) 950 { 951 for( Int i = 0; i < MAX_GOP; i++ ) 952 { 953 if( m_GOPListsMvc[k][i].m_POC != m_GOPListsMvc[0][i].m_POC ) 954 { 955 printf( "\nError: Frame%d_v%d POC %d is not identical to Frame%d POC\n", i, k, m_GOPListsMvc[k][i].m_POC, i ); 956 bErrorMvePoc = true; 957 } 958 } 959 } 960 } 961 xConfirmPara( bErrorMvePoc, "Invalid inter-view POC structure given" ); 962 963 // validate that baseview has no inter-view refs 964 Bool bErrorIvpBase = false; 965 for( Int i = 0; i < MAX_GOP; i++ ) 966 { 967 if( m_GOPListsMvc[0][i].m_numInterViewRefPics != 0 ) 968 { 969 printf( "\nError: Frame%d inter_view refs not available in view 0\n", i ); 970 bErrorIvpBase = true; 971 } 972 } 973 xConfirmPara( bErrorIvpBase, "Inter-view refs not possible in base view" ); 974 975 // validate inter-view refs 976 Bool bErrorIvpEnhV = false; 977 if( m_iNumberOfViews > 1 ) 978 { 979 for( Int k = 1; k < m_iNumberOfViews; k++ ) 980 { 981 for( Int i = 0; i < MAX_GOP+1; i++ ) 982 { 983 for( Int j = 0; j < m_GOPListsMvc[k][i].m_numInterViewRefPics; j++ ) 984 { 985 Int iAbsViewId = m_GOPListsMvc[k][i].m_interViewRefs[j] + k; 986 if( iAbsViewId < 0 || iAbsViewId >= k ) 987 { 988 printf( "\nError: inter-view ref pic %d is not available for Frame%d_v%d\n", m_GOPListsMvc[k][i].m_interViewRefs[j], i, k ); 989 bErrorIvpEnhV = true; 990 } 991 if( m_GOPListsMvc[k][i].m_interViewRefPosL0[j] < 0 || m_GOPListsMvc[k][i].m_interViewRefPosL0[j] > m_GOPListsMvc[k][i].m_numRefPicsActive ) 992 { 993 printf( "\nError: inter-view ref pos %d on L0 is not available for Frame%d_v%d\n", m_GOPListsMvc[k][i].m_interViewRefPosL0[j], i, k ); 994 bErrorIvpEnhV = true; 995 } 996 if( m_GOPListsMvc[k][i].m_interViewRefPosL1[j] < 0 || m_GOPListsMvc[k][i].m_interViewRefPosL1[j] > m_GOPListsMvc[k][i].m_numRefPicsActive ) 997 { 998 printf( "\nError: inter-view ref pos %d on L1 is not available for Frame%d_v%d\n", m_GOPListsMvc[k][i].m_interViewRefPosL1[j], i, k ); 999 bErrorIvpEnhV = true; 1000 } 1001 } 1002 if( i == MAX_GOP ) // inter-view refs at I pic position in base view 1003 { 1004 if( m_GOPListsMvc[k][MAX_GOP].m_sliceType != 'B' && m_GOPListsMvc[k][MAX_GOP].m_sliceType != 'P' && m_GOPListsMvc[k][MAX_GOP].m_sliceType != 'I' ) 1005 { 1006 printf( "\nError: slice type of FrameI_v%d must be equal to B or P or I\n", k ); 1007 bErrorIvpEnhV = true; 1008 } 1009 1010 if( m_GOPListsMvc[k][MAX_GOP].m_POC != 0 ) 1011 { 1012 printf( "\nError: POC %d not possible for FrameI_v%d, must be 0\n", m_GOPListsMvc[k][MAX_GOP].m_POC, k ); 1013 bErrorIvpEnhV = true; 1014 } 1015 1016 if( m_GOPListsMvc[k][MAX_GOP].m_temporalId != 0 ) 1017 { 1018 printf( "\nWarning: Temporal id of FrameI_v%d must be 0 (cp. I-frame in base view)\n", k ); 1019 m_GOPListsMvc[k][MAX_GOP].m_temporalId = 0; 1020 } 1021 1022 if( !(m_GOPListsMvc[k][MAX_GOP].m_refPic) ) 1023 { 1024 printf( "\nWarning: FrameI_v%d must be ref pic (cp. I-frame in base view)\n", k ); 1025 m_GOPListsMvc[k][MAX_GOP].m_refPic = true; 1026 } 1027 1028 if( m_GOPListsMvc[k][MAX_GOP].m_numRefPics != 0 ) 1029 { 1030 printf( "\nWarning: temporal references not possible for FrameI_v%d\n", k ); 1031 for( Int j = 0; j < m_GOPListsMvc[k][MAX_GOP].m_numRefPics; j++ ) 1032 { 1033 m_GOPListsMvc[k][MAX_GOP].m_referencePics[j] = 0; 1034 } 1035 m_GOPListsMvc[k][MAX_GOP].m_numRefPics = 0; 1036 } 1037 1038 if( m_GOPListsMvc[k][MAX_GOP].m_interRPSPrediction ) 1039 { 1040 printf( "\nError: inter RPS prediction not possible for FrameI_v%d, must be 0\n", k ); 1041 bErrorIvpEnhV = true; 1042 } 1043 1044 if( m_GOPListsMvc[k][MAX_GOP].m_sliceType == 'I' && m_GOPListsMvc[k][MAX_GOP].m_numInterViewRefPics != 0 ) 1045 { 1046 printf( "\nError: inter-view prediction not possible for FrameI_v%d with slice type I, #IV_ref_pics must be 0\n", k ); 1047 bErrorIvpEnhV = true; 1048 } 1049 1050 if( m_GOPListsMvc[k][MAX_GOP].m_numRefPicsActive > m_GOPListsMvc[k][MAX_GOP].m_numInterViewRefPics ) 1051 { 1052 m_GOPListsMvc[k][MAX_GOP].m_numRefPicsActive = m_GOPListsMvc[k][MAX_GOP].m_numInterViewRefPics; 1053 } 1054 1055 if( m_GOPListsMvc[k][MAX_GOP].m_sliceType == 'P' ) 1056 { 1057 if( m_GOPListsMvc[k][MAX_GOP].m_numInterViewRefPics < 1 ) 1058 { 1059 printf( "\nError: #IV_ref_pics must be at least one for FrameI_v%d with slice type P\n", k ); 1060 bErrorIvpEnhV = true; 1061 } 1062 else 1063 { 1064 for( Int j = 0; j < m_GOPListsMvc[k][MAX_GOP].m_numInterViewRefPics; j++ ) 1065 { 1066 if( m_GOPListsMvc[k][MAX_GOP].m_interViewRefPosL1[j] != 0 ) 1067 { 1068 printf( "\nError: inter-view ref pos %d on L1 not possible for FrameI_v%d with slice type P\n", m_GOPListsMvc[k][MAX_GOP].m_interViewRefPosL1[j], k ); 1069 bErrorIvpEnhV = true; 1070 } 1071 } 1072 } 1073 } 1074 1075 if( m_GOPListsMvc[k][MAX_GOP].m_sliceType == 'B' && m_GOPListsMvc[k][MAX_GOP].m_numInterViewRefPics < 1 ) 1076 { 1077 printf( "\nError: #IV_ref_pics must be at least one for FrameI_v%d with slice type B\n", k ); 1078 bErrorIvpEnhV = true; 1079 } 1080 } 1081 } 1082 } 1083 } 1084 xConfirmPara( bErrorIvpEnhV, "Invalid inter-view coding structure for enhancement views given" ); 1085 1086 // validate temporal coding structure 1087 if( !bErrorMvePoc && !bErrorIvpBase && !bErrorIvpEnhV ) 1088 { 1089 for( Int viewId = 0; viewId < m_iNumberOfViews; viewId++ ) 1090 { 1091 Bool verifiedGOP = false; 1092 Bool errorGOP = false; 1093 Int checkGOP = 1; 1094 Int numRefs = 1; 1095 Int refList[MAX_NUM_REF_PICS+1]; 1096 refList[0] = 0; 1097 Bool isOK[MAX_GOP]; 1098 for( Int i = 0; i < MAX_GOP; i++ ) { isOK[i] = false; } 1099 Int numOK = 0; 1100 #if !H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER 1101 Int numReorderFramesRequired=0; 1102 m_maxNumberOfReferencePictures=0; 1103 Int lastDisp = -1; 1104 #endif 1105 m_extraRPSs[viewId] = 0; 1106 //start looping through frames in coding order until we can verify that the GOP structure is correct. 1107 while( !verifiedGOP && !errorGOP ) 1108 { 1109 Int curGOP = (checkGOP-1)%m_iGOPSize; 1110 Int curPOC = ((checkGOP-1)/m_iGOPSize)*m_iGOPSize + m_GOPListsMvc[viewId][curGOP].m_POC; 1111 if( m_GOPListsMvc[viewId][curGOP].m_POC < 0 ) 1112 { 1113 printf( "\nError: found fewer Reference Picture Sets than GOPSize for view %d\n", viewId ); 1114 errorGOP = true; 1115 } 1116 else 1117 { 1118 //check that all reference pictures are available, or have a POC < 0 meaning they might be available in the next GOP. 1119 Bool beforeI = false; 1120 for( Int i = 0; i < m_GOPListsMvc[viewId][curGOP].m_numRefPics; i++ ) 1121 { 1122 Int absPOC = curPOC + m_GOPListsMvc[viewId][curGOP].m_referencePics[i]; 1123 if( absPOC < 0 ) 1124 { 1125 beforeI = true; 1126 } 1127 else 1128 { 1129 Bool found = false; 1130 for( Int j = 0; j < numRefs; j++ ) 1131 { 1132 if( refList[j] == absPOC ) 1133 { 1134 found = true; 1135 for( Int k = 0; k < m_iGOPSize; k++ ) 1136 { 1137 if( absPOC%m_iGOPSize == m_GOPListsMvc[viewId][k].m_POC%m_iGOPSize ) 1138 { 1139 m_GOPListsMvc[viewId][curGOP].m_usedByCurrPic[i] = (m_GOPListsMvc[viewId][k].m_temporalId <= m_GOPListsMvc[viewId][curGOP].m_temporalId); 1140 } 1141 } 1142 } 1143 } 1144 if( !found ) 1145 { 1146 printf("\nError: ref pic %d is not available for GOP frame %d of view %d\n", m_GOPListsMvc[viewId][curGOP].m_referencePics[i], curGOP+1, viewId ); 1147 errorGOP = true; 1148 } 1149 } 1150 } 1151 if( !beforeI && !errorGOP ) 1152 { 1153 //all ref frames were present 1154 if( !isOK[curGOP] ) 1155 { 1156 numOK++; 1157 isOK[curGOP] = true; 1158 if( numOK == m_iGOPSize ) 1159 { 1160 verifiedGOP = true; 1161 } 1162 } 1163 } 1164 else 1165 { 1166 //create a new GOPEntry for this frame containing all the reference pictures that were available (POC > 0) 1167 m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]] = m_GOPListsMvc[viewId][curGOP]; 1168 Int newRefs = 0; 1169 for( Int i = 0; i < m_GOPListsMvc[viewId][curGOP].m_numRefPics; i++ ) 1170 { 1171 Int absPOC = curPOC + m_GOPListsMvc[viewId][curGOP].m_referencePics[i]; 1172 if( absPOC >= 0 ) 1173 { 1174 m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_referencePics[newRefs] = m_GOPListsMvc[viewId][curGOP].m_referencePics[i]; 1175 m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_usedByCurrPic[newRefs] = m_GOPListsMvc[viewId][curGOP].m_usedByCurrPic[i]; 1176 newRefs++; 1177 } 1178 } 1179 Int numPrefRefs = m_GOPListsMvc[viewId][curGOP].m_numRefPicsActive; 1180 1181 for( Int offset = -1; offset > -checkGOP; offset-- ) 1182 { 1183 //step backwards in coding order and include any extra available pictures we might find useful to replace the ones with POC < 0. 1184 Int offGOP = (checkGOP - 1 + offset)%m_iGOPSize; 1185 Int offPOC = ((checkGOP - 1 + offset)/m_iGOPSize) * m_iGOPSize + m_GOPListsMvc[viewId][offGOP].m_POC; 1186 if( offPOC >= 0 && m_GOPListsMvc[viewId][offGOP].m_refPic && m_GOPListsMvc[viewId][offGOP].m_temporalId <= m_GOPListsMvc[viewId][curGOP].m_temporalId ) 1187 { 1188 Bool newRef = false; 1189 for( Int i = 0; i < numRefs; i++ ) 1190 { 1191 if( refList[i] == offPOC ) 1192 { 1193 newRef = true; 1194 } 1195 } 1196 for( Int i = 0; i < newRefs; i++ ) 1197 { 1198 if( m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_referencePics[i] == (offPOC - curPOC) ) 1199 { 1200 newRef = false; 1201 } 1202 } 1203 if( newRef ) 1204 { 1205 Int insertPoint = newRefs; 1206 //this picture can be added, find appropriate place in list and insert it. 1207 for( Int j = 0; j < newRefs; j++ ) 1208 { 1209 if( m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_referencePics[j] < (offPOC - curPOC) || 1210 m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_referencePics[j] > 0 ) 1211 { 1212 insertPoint = j; 1213 break; 1214 } 1215 } 1216 Int prev = offPOC - curPOC; 1217 Int prevUsed = (m_GOPListsMvc[viewId][offGOP].m_temporalId <= m_GOPListsMvc[viewId][curGOP].m_temporalId); 1218 for( Int j = insertPoint; j < newRefs+1; j++ ) 1219 { 1220 Int newPrev = m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_referencePics[j]; 1221 Int newUsed = m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_usedByCurrPic[j]; 1222 m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_referencePics[j] = prev; 1223 m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_usedByCurrPic[j] = prevUsed; 1224 prevUsed = newUsed; 1225 prev = newPrev; 1226 } 1227 newRefs++; 1228 } 1229 } 1230 if( newRefs >= numPrefRefs ) 1231 { 1232 break; 1233 } 1234 } 1235 m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_numRefPics = newRefs; 1236 m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_POC = curPOC; 1237 if( m_extraRPSs[viewId] == 0 ) 1238 { 1239 m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_interRPSPrediction = 0; 1240 m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_numRefIdc = 0; 1241 } 1242 else 1243 { 1244 Int rIdx = m_iGOPSize + m_extraRPSs[viewId] - 1; 1245 Int refPOC = m_GOPListsMvc[viewId][rIdx].m_POC; 1246 Int refPics = m_GOPListsMvc[viewId][rIdx].m_numRefPics; 1247 Int newIdc = 0; 1248 for( Int i = 0; i <= refPics; i++ ) 1249 { 1250 Int deltaPOC = ((i != refPics)? m_GOPListsMvc[viewId][rIdx].m_referencePics[i] : 0); // check if the reference abs POC is >= 0 1251 Int absPOCref = refPOC + deltaPOC; 1252 Int refIdc = 0; 1253 for( Int j = 0; j < m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_numRefPics; j++ ) 1254 { 1255 if( (absPOCref - curPOC) == m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_referencePics[j] ) 1256 { 1257 if( m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_usedByCurrPic[j] ) 1258 { 1259 refIdc = 1; 1260 } 1261 else 1262 { 1263 refIdc = 2; 1264 } 1265 } 1266 } 1267 m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_refIdc[newIdc] = refIdc; 1268 newIdc++; 1269 } 1270 m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_interRPSPrediction = 1; 1271 m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_numRefIdc = newIdc; 1272 m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_deltaRPS = refPOC - m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_POC; 1273 m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_deltaRIdxMinus1 = 0; 1274 } 1275 curGOP = m_iGOPSize + m_extraRPSs[viewId]; 1276 m_extraRPSs[viewId]++; 1277 } 1278 numRefs = 0; 1279 for( Int i = 0; i < m_GOPListsMvc[viewId][curGOP].m_numRefPics; i++ ) 1280 { 1281 Int absPOC = curPOC + m_GOPListsMvc[viewId][curGOP].m_referencePics[i]; 1282 if( absPOC >= 0 ) 1283 { 1284 refList[numRefs] = absPOC; 1285 numRefs++; 1286 } 1287 } 1288 #if !H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER 1289 if(m_maxNumberOfReferencePictures<numRefs) 1290 { 1291 m_maxNumberOfReferencePictures=numRefs; 1292 } 1293 #endif 1294 refList[numRefs] = curPOC; 1295 numRefs++; 1296 #if !H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER 1297 Int nonDisplayed=0; 1298 for(Int i=0; i<numRefs; i++) 1299 { 1300 if(refList[i]==lastDisp+1) 1301 { 1302 lastDisp=refList[i]; 1303 i=0; 1304 } 1305 } 1306 for(Int i=0; i<numRefs; i++) 1307 { 1308 if(refList[i]>lastDisp) 1309 { 1310 nonDisplayed++; 1311 } 1312 } 1313 if(nonDisplayed>numReorderFramesRequired) 1314 { 1315 numReorderFramesRequired=nonDisplayed; 1316 } 1317 #endif 1318 } 1319 checkGOP++; 1320 } 1321 #if !H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER 1322 if (m_numReorderFrames == -1) 1323 { 1324 m_numReorderFrames = numReorderFramesRequired; 1325 } 1326 #endif 1327 xConfirmPara( errorGOP, "Invalid GOP structure given" ); 1328 #if H0566_TLA 1329 m_maxTempLayer[viewId] = 1; 1330 #endif 1331 for( Int i = 0; i < m_iGOPSize; i++ ) 1332 { 1333 #if H0566_TLA 1334 if( m_GOPListsMvc[viewId][i].m_temporalId >= m_maxTempLayer[viewId] ) 1335 { 1336 m_maxTempLayer[viewId] = m_GOPListsMvc[viewId][i].m_temporalId + 1; 1337 } 1338 #endif 1339 xConfirmPara( m_GOPListsMvc[viewId][i].m_sliceType != 'B' && m_GOPListsMvc[viewId][i].m_sliceType != 'P', "Slice type must be equal to B or P" ); 1340 } 1341 1342 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER 1343 for( Int i = 0; i < MAX_TLAYER; i++ ) 1344 { 1345 m_numReorderPics[viewId][i] = 0; 1346 m_maxDecPicBuffering[viewId][i] = 0; 1347 } 1348 for( Int i = 0; i < m_iGOPSize; i++ ) 1349 { 1350 if( m_GOPListsMvc[viewId][i].m_numRefPics > m_maxDecPicBuffering[viewId][m_GOPListsMvc[viewId][i].m_temporalId] ) 1351 { 1352 m_maxDecPicBuffering[viewId][m_GOPListsMvc[viewId][i].m_temporalId] = m_GOPListsMvc[viewId][i].m_numRefPics; 1353 } 1354 Int highestDecodingNumberWithLowerPOC = 0; 1355 for( Int j = 0; j < m_iGOPSize; j++ ) 1356 { 1357 if( m_GOPListsMvc[viewId][j].m_POC <= m_GOPListsMvc[viewId][i].m_POC ) 1358 { 1359 highestDecodingNumberWithLowerPOC = j; 1360 } 1361 } 1362 Int numReorder = 0; 1363 for( Int j = 0; j < highestDecodingNumberWithLowerPOC; j++ ) 1364 { 1365 if( m_GOPListsMvc[viewId][j].m_temporalId <= m_GOPListsMvc[viewId][i].m_temporalId && 1366 m_GOPListsMvc[viewId][j].m_POC > m_GOPListsMvc[viewId][i].m_POC ) 1367 { 1368 numReorder++; 1369 } 1370 } 1371 if( numReorder > m_numReorderPics[viewId][m_GOPListsMvc[viewId][i].m_temporalId] ) 1372 { 1373 m_numReorderPics[viewId][m_GOPListsMvc[viewId][i].m_temporalId] = numReorder; 1374 } 1375 } 1376 for( Int i = 0; i < MAX_TLAYER-1; i++ ) 1377 { 1378 // a lower layer can not have higher value of m_numReorderPics than a higher layer 1379 if( m_numReorderPics[viewId][i+1] < m_numReorderPics[viewId][i] ) 1380 { 1381 m_numReorderPics[viewId][i+1] = m_numReorderPics[viewId][i]; 1382 } 1383 // the value of num_reorder_pics[ i ] shall be in the range of 0 to max_dec_pic_buffering[ i ], inclusive 1384 if( m_numReorderPics[viewId][i] > m_maxDecPicBuffering[viewId][i] ) 1385 { 1386 m_maxDecPicBuffering[viewId][i] = m_numReorderPics[viewId][i]; 1387 } 1388 // a lower layer can not have higher value of m_uiMaxDecPicBuffering than a higher layer 1389 if( m_maxDecPicBuffering[viewId][i+1] < m_maxDecPicBuffering[viewId][i] ) 1390 { 1391 m_maxDecPicBuffering[viewId][i+1] = m_maxDecPicBuffering[viewId][i]; 1392 } 1393 } 1394 // the value of num_reorder_pics[ i ] shall be in the range of 0 to max_dec_pic_buffering[ i ], inclusive 1395 if( m_numReorderPics[viewId][MAX_TLAYER-1] > m_maxDecPicBuffering[viewId][MAX_TLAYER-1] ) 1396 { 1397 m_maxDecPicBuffering[viewId][MAX_TLAYER-1] = m_numReorderPics[viewId][MAX_TLAYER-1]; 1398 } 1399 #endif 1400 1401 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER 1402 xConfirmPara( m_bUseLComb == false && m_numReorderPics[viewId][MAX_TLAYER-1] != 0, "ListCombination can only be 0 in low delay coding (more precisely when L0 and L1 are identical)" ); // Note however this is not the full necessary condition as ref_pic_list_combination_flag can only be 0 if L0 == L1. 1403 #else 1404 xConfirmPara( m_bUseLComb==false && m_numReorderFrames!=0, "ListCombination can only be 0 in low delay coding (more precisely when L0 and L1 are identical)" ); // Note however this is not the full necessary condition as ref_pic_list_combination_flag can only be 0 if L0 == L1. 1405 xConfirmPara( m_numReorderFrames < numReorderFramesRequired, "For the used GOP the encoder requires more pictures for reordering than specified in MaxNumberOfReorderPictures" ); 1406 #endif 1407 } 1408 } 1409 #undef xConfirmPara 1410 if( check_failed ) 772 1411 { 773 1412 exit(EXIT_FAILURE); … … 801 1440 xCleanUpVector( m_pchReconFileList, (char*)0 ); 802 1441 xCleanUpVector( m_pchDepthReconFileList, (char*)0 ); 803 804 #if HHI_VSO805 if ( m_bUseVSO)806 {807 xCleanUpVector( m_pchERRefFileList, (char*)0 );808 }809 #endif810 1442 } 811 1443 … … 817 1449 g_uiMaxCUWidth = m_uiMaxCUWidth; 818 1450 g_uiMaxCUHeight = m_uiMaxCUHeight; 819 1451 820 1452 // compute actual CU depth with respect to config depth and max transform size 821 1453 g_uiAddCUDepth = 0; 822 1454 while( (m_uiMaxCUWidth>>m_uiMaxCUDepth) > ( 1 << ( m_uiQuadtreeTULog2MinSize + g_uiAddCUDepth ) ) ) g_uiAddCUDepth++; 823 1455 824 1456 m_uiMaxCUDepth += g_uiAddCUDepth; 825 1457 g_uiAddCUDepth++; 826 1458 g_uiMaxCUDepth = m_uiMaxCUDepth; 827 1459 828 1460 // set internal bit-depth and constants 829 #if ENABLE_IBDI830 if ((int)m_uiBitIncrement != -1)831 {832 g_uiBitDepth = m_uiInputBitDepth;833 g_uiBitIncrement = m_uiBitIncrement;834 m_uiInternalBitDepth = g_uiBitDepth + g_uiBitIncrement;835 }836 else837 {838 g_uiBitDepth = min(8u, m_uiInputBitDepth);839 if (m_uiInternalBitDepth == 0) {840 /* default increement = 2 */841 m_uiInternalBitDepth = 2 + g_uiBitDepth;842 }843 g_uiBitIncrement = m_uiInternalBitDepth - g_uiBitDepth;844 }845 #else846 1461 #if FULL_NBIT 847 1462 g_uiBitDepth = m_uiInternalBitDepth; … … 851 1466 g_uiBitIncrement = m_uiInternalBitDepth - g_uiBitDepth; 852 1467 #endif 853 #endif 1468 854 1469 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 855 g_ dDeltaDCsQuantOffset = Double(g_uiBitIncrement) - 2.0;1470 g_iDeltaDCsQuantOffset = g_uiBitIncrement - 2; 856 1471 #endif 857 1472 858 1473 g_uiBASE_MAX = ((1<<(g_uiBitDepth))-1); 859 1474 860 1475 #if IBDI_NOCLIP_RANGE 861 1476 g_uiIBDI_MAX = g_uiBASE_MAX << g_uiBitIncrement; … … 863 1478 g_uiIBDI_MAX = ((1<<(g_uiBitDepth+g_uiBitIncrement))-1); 864 1479 #endif 865 1480 866 1481 if (m_uiOutputBitDepth == 0) 867 1482 { 868 1483 m_uiOutputBitDepth = m_uiInternalBitDepth; 869 1484 } 1485 1486 g_uiPCMBitDepthLuma = m_uiPCMBitDepthLuma = ((m_bPCMInputBitDepthFlag)? m_uiInputBitDepth : m_uiInternalBitDepth); 1487 g_uiPCMBitDepthChroma = ((m_bPCMInputBitDepthFlag)? m_uiInputBitDepth : m_uiInternalBitDepth); 870 1488 } 871 1489 … … 873 1491 { 874 1492 printf("\n"); 875 for( Int iCounter = 0; iCounter<m_iNumberOfViews; iCounter++) 876 { 877 printf("Input File %i : %s\n", iCounter, m_pchInputFileList[iCounter]); 878 } 879 for( Int iCounter = 0; iCounter < (Int)m_pchDepthInputFileList.size(); iCounter++) 880 { 881 printf("DepthInput File %i : %s\n", iCounter, m_pchDepthInputFileList[iCounter]); 882 } 883 printf("Bitstream File : %s\n", m_pchBitstreamFile ); 884 for( Int iCounter = 0; iCounter<m_iNumberOfViews; iCounter++) 885 { 886 printf("Reconstruction File %i : %s\n", iCounter, m_pchReconFileList[iCounter]); 887 } 888 889 for( Int iCounter = 0; iCounter<(Int)m_pchDepthReconFileList.size(); iCounter++) 890 { 891 printf("Reconstruction Depth File %i : %s\n", iCounter, m_pchDepthReconFileList[iCounter]); 892 } 1493 for( Int iCounter = 0; iCounter< m_iNumberOfViews; iCounter++) 1494 { 1495 printf("Texture Input File %i : %s\n", iCounter, m_pchInputFileList[iCounter]); 1496 } 1497 if( m_bUsingDepthMaps ) 1498 { 1499 for( Int iCounter = 0; iCounter < m_iNumberOfViews; iCounter++) 1500 { 1501 printf("Depth Input File %i : %s\n", iCounter, m_pchDepthInputFileList[iCounter]); 1502 } 1503 } 1504 printf("Bitstream File : %s\n", m_pchBitstreamFile ); 1505 for( Int iCounter = 0; iCounter< m_iNumberOfViews; iCounter++) 1506 { 1507 printf("Texture Reconstruction File %i : %s\n", iCounter, m_pchReconFileList[iCounter]); 1508 } 1509 if( m_bUsingDepthMaps ) 1510 { 1511 for( Int iCounter = 0; iCounter< m_iNumberOfViews; iCounter++) 1512 { 1513 printf("Depth Reconstruction File %i : %s\n", iCounter, m_pchDepthReconFileList[iCounter]); 1514 } 1515 } 1516 #if PIC_CROPPING 1517 printf("Real Format : %dx%d %dHz\n", m_iSourceWidth - m_cropLeft - m_cropRight, m_iSourceHeight - m_cropTop - m_cropBottom, m_iFrameRate ); 1518 #else 893 1519 printf("Real Format : %dx%d %dHz\n", m_iSourceWidth - m_aiPad[0], m_iSourceHeight-m_aiPad[1], m_iFrameRate ); 1520 #endif 894 1521 printf("Internal Format : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate ); 895 1522 printf("Frame index : %u - %d (%d frames)\n", m_FrameSkip, m_FrameSkip+m_iFrameToBeEncoded-1, m_iFrameToBeEncoded ); … … 898 1525 printf("Max RQT depth inter : %d\n", m_uiQuadtreeTUMaxDepthInter); 899 1526 printf("Max RQT depth intra : %d\n", m_uiQuadtreeTUMaxDepthIntra); 1527 printf("Min PCM size : %d\n", 1 << m_uiPCMLog2MinSize); 900 1528 printf("Motion search range : %d\n", m_iSearchRange ); 901 #if DCM_DECODING_REFRESH 1529 printf("Intra period : %d\n", m_iIntraPeriod ); 902 1530 printf("Decoding refresh type : %d\n", m_iDecodingRefreshType ); 903 #endif 904 printf("QP : %5.2f\n", m_adQP[0] ); 905 printf("QP Depth : %5.2f\n", m_adQP[ m_adQP.size() < 2 ? 0 : 1] ); 906 printf("Coded Picture Store Size : %d\n", m_uiCodedPictureStoreSize); 1531 printf("QP Texture : %5.2f\n", m_adQP[0] ); 1532 if( m_bUsingDepthMaps ) 1533 { 1534 printf("QP Depth : %5.2f\n", m_adQP[ m_adQP.size() < 2 ? 0 : 1] ); 1535 } 1536 printf("Max dQP signaling depth : %d\n", m_iMaxCuDQPDepth); 1537 1538 printf("Chroma Qp Offset : %d\n", m_iChromaQpOffset ); 1539 printf("Chroma Qp Offset 2nd : %d\n", m_iChromaQpOffset2nd); 1540 1541 printf("QP adaptation : %d (range=%d)\n", m_bUseAdaptiveQP, (m_bUseAdaptiveQP ? m_iQPAdaptationRange : 0) ); 907 1542 printf("GOP size : %d\n", m_iGOPSize ); 908 printf("Rate GOP size : %d\n", m_iRateGOPSize );909 1543 printf("Internal bit depth : %d\n", m_uiInternalBitDepth ); 910 911 if ( m_iSymbolMode == 0 ) 912 { 913 printf("Entropy coder : VLC\n"); 914 } 915 else if( m_iSymbolMode == 1 ) 916 { 917 printf("Entropy coder : CABAC\n"); 918 } 919 else if( m_iSymbolMode == 2 ) 920 { 921 printf("Entropy coder : PIPE\n"); 922 } 923 else 924 { 925 assert(0); 926 } 927 928 printf("GOP Format String : %s\n", m_cInputFormatString.c_str() ); 929 printf("Loop Filter Disabled : %d %d\n", m_abLoopFilterDisable[0] ? 1 : 0, m_abLoopFilterDisable[1] ? 1 : 0 ); 1544 printf("PCM sample bit depth : %d\n", m_uiPCMBitDepthLuma ); 1545 if((m_uiMaxCUWidth >> m_uiMaxCUDepth) == 4) 1546 { 1547 printf("DisableInter4x4 : %d\n", m_bDisInter4x4); 1548 } 1549 1550 printf("Loop Filter Disabled : %d %d\n", m_abLoopFilterDisable[0] ? 1 : 0, m_abLoopFilterDisable[1] ? 1 : 0 ); 930 1551 printf("Coded Camera Param. Precision: %d\n", m_iCodedCamParPrecision); 931 1552 … … 943 1564 } 944 1565 #endif 945 1566 #if HHI_INTERVIEW_SKIP 1567 printf("InterView Skip: : %d\n", m_bInterViewSkip ? 1:0 ); 1568 printf("InterView Skip Lambda Scale : %f\n", m_dInterViewSkipLambdaScale ); 1569 #endif 946 1570 947 1571 printf("\n"); 948 949 printf("TOOL CFG GENERAL: "); 1572 1573 printf("TOOL CFG General: "); 1574 #if LCU_SYNTAX_ALF 1575 printf("ALFMNF:%d ", m_iALFMaxNumberFilters); 1576 printf("ALFInSlice:%d ", m_bALFParamInSlice); 1577 printf("ALFPicEnc:%d ", m_bALFPicBasedEncode); 1578 #endif 950 1579 printf("IBD:%d ", !!g_uiBitIncrement); 951 1580 printf("HAD:%d ", m_bUseHADME ); … … 953 1582 printf("SQP:%d ", m_uiDeltaQpRD ); 954 1583 printf("ASR:%d ", m_bUseASR ); 1584 #if !PIC_CROPPING 955 1585 printf("PAD:%d ", m_bUsePAD ); 956 printf("LDC:%d ", m_bUseLDC ); 957 #if DCM_COMB_LIST 1586 #endif 958 1587 printf("LComb:%d ", m_bUseLComb ); 959 1588 printf("LCMod:%d ", m_bLCMod ); 960 #endif961 1589 printf("FEN:%d ", m_bUseFastEnc ); 1590 printf("ECU:%d ", m_bUseEarlyCU ); 1591 #if FAST_DECISION_FOR_MRG_RD_COST 1592 printf("FDM:%d ", m_useFastDecisionForMerge ); 1593 #endif 1594 printf("CFM:%d ", m_bUseCbfFastMode ); 962 1595 printf("RQT:%d ", 1 ); 963 printf("MRG:%d ", m_bUseMRG ); // SOPH: Merge Mode 964 #if LM_CHROMA 965 printf("LMC:%d ", m_bUseLMChroma ); 966 #endif 967 #if HHI_RMP_SWITCH 968 printf("RMP:%d ", m_bUseRMP); 969 #endif 970 printf("Slice:%d ",m_iSliceMode); 1596 printf("LMC:%d ", m_bUseLMChroma ); 1597 printf("Slice: G=%d M=%d ", m_iSliceGranularity, m_iSliceMode); 971 1598 if (m_iSliceMode!=0) 972 1599 { 973 printf(" (%d)", m_iSliceArgument);974 } 975 printf("EntropySlice: %d ",m_iEntropySliceMode);1600 printf("A=%d ", m_iSliceArgument); 1601 } 1602 printf("EntropySlice: M=%d ",m_iEntropySliceMode); 976 1603 if (m_iEntropySliceMode!=0) 977 1604 { 978 printf("(%d) ", m_iEntropySliceArgument); 979 } 980 #if CONSTRAINED_INTRA_PRED 1605 printf("A=%d ", m_iEntropySliceArgument); 1606 } 981 1607 printf("CIP:%d ", m_bUseConstrainedIntraPred); 982 #endif 983 #if MTK_SAO 1608 #if BURST_IPCM 1609 printf("PCM:%d ", (m_usePCM && (1<<m_uiPCMLog2MinSize) <= m_uiMaxCUWidth)? 1 : 0); 1610 #else 1611 printf("PCM:%d ", ((1<<m_uiPCMLog2MinSize) <= m_uiMaxCUWidth)? 1 : 0); 1612 #endif 1613 #if SAO_UNIT_INTERLEAVING 1614 printf("SAOInterleaving:%d ", (m_saoInterleavingFlag)?(1):(0)); 1615 #endif 1616 #if LOSSLESS_CODING 1617 printf("LosslessCuEnabled:%d ", (m_useLossless)? 1:0 ); 1618 #endif 1619 printf("WPP:%d ", (Int)m_bUseWeightPred); 1620 printf("WPB:%d ", m_uiBiPredIdc); 1621 #if !REMOVE_TILE_DEPENDENCE 1622 printf("TileBoundaryIndependence:%d ", m_iTileBoundaryIndependenceIdr ); 1623 #endif 1624 printf("TileLocationInSliceHdr:%d ", m_iTileLocationInSliceHeaderFlag); 1625 printf("TileMarker:%d", m_iTileMarkerFlag); 1626 if (m_iTileMarkerFlag) 1627 { 1628 printf("[%d] ", m_iMaxTileMarkerEntryPoints); 1629 } 1630 else 1631 { 1632 printf(" "); 1633 } 1634 printf(" WaveFrontSynchro:%d WaveFrontFlush:%d WaveFrontSubstreams:%d", 1635 m_iWaveFrontSynchro, m_iWaveFrontFlush, m_iWaveFrontSubstreams); 1636 printf(" ScalingList:%d ", m_useScalingListId ); 1637 1638 printf("TMVP:%d ", m_enableTMVP ); 1639 1640 #if ADAPTIVE_QP_SELECTION 1641 printf("AQpS:%d", m_bUseAdaptQpSelect ); 1642 #endif 1643 1644 #if MULTIBITS_DATA_HIDING 1645 printf(" SignBitHidingFlag:%d SignBitHidingThreshold:%d", m_signHideFlag, m_signHidingThreshold); 984 1646 #endif 985 1647 printf("\n"); … … 1003 1665 printf("MVI:%d ", m_bUseMVI ? 1 : 0 ); 1004 1666 #endif 1005 printf("\n ");1006 1667 printf("\n\n"); 1668 1007 1669 fflush(stdout); 1008 1670 } … … 1021 1683 printf( " PAD - automatic source padding of multiple of 16\n"); 1022 1684 printf( " ASR - adaptive motion search range\n"); 1023 printf( " FEN - fast encoder setting\n"); 1024 printf( " MRG - merging of motion partitions\n"); // SOPH: Merge Mode 1025 1026 #if LM_CHROMA 1685 printf( " FEN - fast encoder setting\n"); 1686 printf( " ECU - Early CU setting\n"); 1687 printf( " CFM - Cbf fast mode setting\n"); 1027 1688 printf( " LMC - intra chroma prediction based on luma\n"); 1028 #endif1029 1030 1689 printf( "\n" ); 1031 1690 printf( " Example 1) TAppEncoder.exe -c test.cfg -q 32 -g 8 -f 9 -s 64 -h 4\n"); … … 1039 1698 if (!bflag) 1040 1699 return false; 1041 1700 1042 1701 printf("Error: %s\n",message); 1043 1702 return true; … … 1108 1767 rpchOutputFileName[iInLength+iAppendLength] = '\0'; 1109 1768 } 1769 1770 //! \} -
trunk/source/App/TAppEncoder/TAppEncCfg.h
r42 r56 2 2 * License, included below. This software may be subject to other third party 3 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-201 1,ISO/IEC6 * Copyright (c) 2010-2012, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 15 15 * this list of conditions and the following disclaimer in the documentation 16 16 * and/or other materials provided with the distribution. 17 * * Neither the name of the I SO/IEC nor the names of its contributors may17 * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 18 * be used to endorse or promote products derived from this software without 19 19 * specific prior written permission. … … 32 32 */ 33 33 34 35 36 34 /** \file TAppEncCfg.h 37 35 \brief Handle encoder configuration parameters (header) … … 41 39 #define __TAPPENCCFG__ 42 40 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> 41 #include "TLibCommon/CommonDef.h" 42 43 #include "TLibEncoder/TEncCfg.h" 44 #include "TAppCommon/TAppComCamPara.h" 45 #include "TLibRenderer/TRenTop.h" 46 #include "TLibRenderer/TRenModel.h" 47 #include "TLibRenderer/TRenModSetupStrParser.h" 48 49 #include <sstream> 51 50 #include <vector> 51 52 //! \ingroup TAppEncoder 53 //! \{ 52 54 53 55 // ==================================================================================================================== … … 60 62 protected: 61 63 // file I/O 62 char* m_pchBitstreamFile; ///< output bitstream file63 64 64 std::vector<char*> m_pchInputFileList; ///< source file names 65 65 std::vector<char*> m_pchDepthInputFileList; ///< source depth file names 66 66 std::vector<char*> m_pchReconFileList; ///< output reconstruction file names 67 67 std::vector<char*> m_pchDepthReconFileList; ///< output depth reconstruction file names 68 69 std::vector<char*> m_pchERRefFileList; ///< virtual external reference view files names 70 68 char* m_pchBitstreamFile; ///< output bitstream file 69 Double m_adLambdaModifier[ MAX_TLAYER ]; ///< Lambda modifier array for each temporal layer 71 70 // source specification 72 71 Int m_iFrameRate; ///< source frame-rates (Hz) … … 74 73 Int m_iSourceWidth; ///< source width in pixel 75 74 Int m_iSourceHeight; ///< source height in pixel 75 #if PIC_CROPPING 76 Int m_croppingMode; 77 Int m_cropLeft; 78 Int m_cropRight; 79 Int m_cropTop; 80 Int m_cropBottom; 81 #endif 76 82 Int m_iFrameToBeEncoded; ///< number of encoded frames 83 #if !PIC_CROPPING 77 84 Bool m_bUsePAD; ///< flag for using source padding 85 #endif 78 86 Int m_aiPad[2]; ///< number of padded pixels for width and height 79 80 Int m_iNumberOfViews; ///< number Views to Encode 81 Bool m_bUsingDepthMaps ; 82 83 #if FLEX_CODING_ORDER 84 char* m_pchMVCJointCodingOrder; ///< texture-depth coding order 85 Bool m_b3DVFlexOrder; ///< flexible coding order flag 86 #endif 87 88 87 88 Int m_iNumberOfViews; ///< number Views to Encode 89 Bool m_bUsingDepthMaps; 89 90 // coding structure 90 #if DCM_DECODING_REFRESH 91 Int m_iIntraPeriod; ///< period of I-slice (random access period) 91 92 Int m_iDecodingRefreshType; ///< random access type 92 #endif93 UInt m_uiCodedPictureStoreSize ;94 93 Int m_iGOPSize; ///< GOP size of hierarchical structure 95 Int m_iRateGOPSize; ///< GOP size for QP variance 96 #if !HHI_NO_LowDelayCoding 97 Bool m_bUseLDC; ///< flag for using low-delay coding mode 98 #endif 99 #if DCM_COMB_LIST 94 Int m_extraRPSs[MAX_VIEW_NUM]; 95 GOPEntryMvc m_GOPListsMvc[MAX_VIEW_NUM][MAX_GOP+1]; 96 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER 97 Int m_numReorderPics[MAX_VIEW_NUM][MAX_TLAYER]; ///< total number of reorder pictures 98 Int m_maxDecPicBuffering[MAX_VIEW_NUM][MAX_TLAYER]; ///< total number of reference pictures needed for decoding 99 #else 100 Int m_numReorderFrames; ///< total number of reorder pictures 101 Int m_maxNumberOfReferencePictures; ///< total number of reference pictures needed for decoding 102 #endif 100 103 Bool m_bUseLComb; ///< flag for using combined reference list for uni-prediction in B-slices (JCTVC-D421) 101 104 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 105 Bool m_bDisInter4x4; 106 Bool m_enableNSQT; ///< flag for enabling NSQT 107 Bool m_enableAMP; 104 108 // coding quality 105 106 109 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) 108 110 std::vector<Int> m_aiQP; ///< QP value of key-picture (integer) [0] video, [1] depth 109 111 Int m_aiTLayerQPOffset[MAX_TLAYER]; ///< QP offset corresponding to temporal layer depth 110 112 char* m_pchdQPFile; ///< QP offset for each slice (initialized from external file) 111 113 Int* m_aidQP; ///< array of slice QP values 114 Int* m_aidQPdepth; ///< array of depth slice QP values 112 115 Int m_iMaxDeltaQP; ///< max. |delta QP| 113 116 UInt m_uiDeltaQpRD; ///< dQP range for multi-pass slice QP optimization 117 Int m_iMaxCuDQPDepth; ///< Max. depth for a minimum CuDQPSize (0:default) 118 119 Int m_iChromaQpOffset; ///< ChromaQpOffset (0:default) 120 Int m_iChromaQpOffset2nd; ///< ChromaQpOffset2nd (0:default) 121 122 #if ADAPTIVE_QP_SELECTION 123 Bool m_bUseAdaptQpSelect; 124 #endif 125 126 Bool m_bUseAdaptiveQP; ///< Flag for enabling QP adaptation based on a psycho-visual model 127 Int m_iQPAdaptationRange; ///< dQP range by QP adaptation 128 129 #if H0566_TLA 130 Int m_maxTempLayer[MAX_VIEW_NUM]; ///< Max temporal layer 131 #else 132 Bool m_bTLayering; ///< indicates whether temporal IDs are set based on the hierarchical coding structure 133 Bool m_abTLayerSwitchingFlag[MAX_TLAYER]; ///< temporal layer switching flags corresponding to each temporal layer 134 #endif 114 135 115 136 // coding unit (CU) definition … … 117 138 UInt m_uiMaxCUHeight; ///< max. CU height in pixel 118 139 UInt m_uiMaxCUDepth; ///< max. CU depth 119 140 120 141 // transfom unit (TU) definition 121 142 UInt m_uiQuadtreeTULog2MaxSize; 122 143 UInt m_uiQuadtreeTULog2MinSize; 123 144 124 145 UInt m_uiQuadtreeTUMaxDepthInter; 125 146 UInt m_uiQuadtreeTUMaxDepthIntra; 126 147 127 148 // coding tools (bit-depth) 128 149 UInt m_uiInputBitDepth; ///< bit-depth of input file 129 150 UInt m_uiOutputBitDepth; ///< bit-depth of output file 130 #ifdef ENABLE_IBDI131 UInt m_uiBitIncrement; ///< bit-depth increment132 #endif133 151 UInt m_uiInternalBitDepth; ///< Internal bit-depth (BitDepth+BitIncrement) 134 152 135 #if MTK_SAO 153 // coding tools (PCM bit-depth) 154 Bool m_bPCMInputBitDepthFlag; ///< 0: PCM bit-depth is internal bit-depth. 1: PCM bit-depth is input bit-depth. 155 UInt m_uiPCMBitDepthLuma; ///< PCM bit-depth for luma 156 157 // coding tool (lossless) 158 #if LOSSLESS_CODING 159 Bool m_useLossless; ///< flag for using lossless coding 160 #endif 136 161 vector<Bool> m_abUseSAO; 137 #endif 138 162 #if SAO_UNIT_INTERLEAVING 163 Int m_maxNumOffsetsPerPic; ///< SAO maximun number of offset per picture 164 Bool m_saoInterleavingFlag; ///< SAO interleaving flag 165 #endif 139 166 // coding tools (loop filter) 140 167 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 168 Int m_iALFEncodePassReduction; //!< ALF encoding pass, 0 = original 16-pass, 1 = 1-pass, 2 = 2-pass 169 170 Int m_iALFMaxNumberFilters; ///< ALF Max Number Filters in one picture 171 #if LCU_SYNTAX_ALF 172 Bool m_bALFParamInSlice; 173 Bool m_bALFPicBasedEncode; 143 174 #endif 144 175 145 176 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 148 149 // coding tools (entropy coder) 150 Int m_iSymbolMode; ///< entropy coder mode, 0 = VLC, 1 = CABAC 151 152 // coding tools (inter - merge motion partitions) 153 Bool m_bUseMRG; ///< SOPH: flag for using motion partition Merge Mode 154 155 #if LM_CHROMA 177 Bool m_loopFilterOffsetInAPS; ///< offset for deblocking filter in 0 = slice header, 1 = APS 178 Int m_loopFilterBetaOffsetDiv2; ///< beta offset for deblocking filter 179 Int m_loopFilterTcOffsetDiv2; ///< tc offset for deblocking filter 180 #if DBL_CONTROL 181 Bool m_DeblockingFilterControlPresent; ///< deblocking filter control present flag in PPS 182 #endif 183 156 184 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 185 186 // coding tools (PCM) 187 Bool m_usePCM; ///< flag for using IPCM 188 UInt m_pcmLog2MaxSize; ///< log2 of maximum PCM block size 189 UInt m_uiPCMLog2MinSize; ///< log2 of minimum PCM block size 190 Bool m_bPCMFilterDisableFlag; ///< PCM filter disable flag 162 191 163 192 // coding tools (encoder-only parameters) … … 165 194 Bool m_bUseASR; ///< flag for using adaptive motion search range 166 195 Bool m_bUseHADME; ///< flag for using HAD in sub-pel ME 167 196 vector<Bool> m_abUseRDOQ; ///< flag for using RD optimized quantization [0]-video, [1]-depth 168 197 Int m_iFastSearch; ///< ME mode, 0 = full, 1 = diamond, 2 = PMVFAST 169 198 Int m_iSearchRange; ///< ME search range 170 199 Int m_bipredSearchRange; ///< ME search range for bipred refinement 171 200 Bool m_bUseFastEnc; ///< flag for using fast encoder setting 201 #if HHI_INTERVIEW_SKIP 202 Bool m_bInterViewSkip; ///< usage of interview skip mode ( do not transmit residual) 203 #if HHI_INTERVIEW_SKIP_LAMBDA_SCALE 204 Double m_dInterViewSkipLambdaScale; ///< lambda scale for interview skip 205 #endif 206 #endif 207 Bool m_bUseEarlyCU; ///< flag for using Early CU setting 172 208 173 209 #if DEPTH_MAP_GENERATION … … 183 219 #endif 184 220 185 #if HHI_INTERVIEW_SKIP 186 UInt m_uiInterViewSkip; ///< usage of interview skip mode ( do not transmit residual) 187 #if HHI_INTERVIEW_SKIP_LAMBDA_SCALE 188 Double m_dInterViewSkipLambdaScale; ///< lambda scale for interview skip 189 #endif 190 #endif 221 #if FAST_DECISION_FOR_MRG_RD_COST 222 Bool m_useFastDecisionForMerge; ///< flag for using Fast Decision Merge RD-Cost 223 #endif 224 Bool m_bUseCbfFastMode; ///< flag for using Cbf Fast PU Mode Decision 225 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 226 Int m_iSliceArgument; ///< If m_iSliceMode==1, m_iSliceArgument=max. # of largest coding units. If m_iSliceMode==2, m_iSliceArgument=max. # of bytes. 227 Int m_iEntropySliceMode; ///< 0: Disable all entropy slice limits, 1 : Maximum number of largest coding units per slice, 2: Constraint based entropy slice 228 Int m_iEntropySliceArgument;///< If m_iEntropySliceMode==1, m_iEntropySliceArgument=max. # of largest coding units. If m_iEntropySliceMode==2, m_iEntropySliceArgument=max. # of bins. 229 230 Int m_iSliceGranularity;///< 0: Slices always end at LCU borders. 1-3: slices may end at a depth of 1-3 below LCU level. 231 Bool m_bLFCrossSliceBoundaryFlag; ///< 0: Cross-slice-boundary in-loop filtering 1: non-cross-slice-boundary in-loop filtering 232 Int m_iTileBehaviorControlPresentFlag; //!< 1: tile behavior control parameters are in PPS 0: tile behavior control parameters are not in PPS 233 Bool m_bLFCrossTileBoundaryFlag; //!< 1: Cross-tile-boundary in-loop filtering 0: non-cross-tile-boundary in-loop filtering 234 Int m_iColumnRowInfoPresent; 235 Int m_iUniformSpacingIdr; 236 #if !REMOVE_TILE_DEPENDENCE 237 Int m_iTileBoundaryIndependenceIdr; 238 #endif 239 Int m_iNumColumnsMinus1; 240 char* m_pchColumnWidth; 241 Int m_iNumRowsMinus1; 242 char* m_pchRowHeight; 243 Int m_iTileLocationInSliceHeaderFlag; //< enable(1)/disable(0) transmitssion of tile location in slice header 244 Int m_iTileMarkerFlag; //< enable(1)/disable(0) transmitssion of light weight tile marker 245 Int m_iMaxTileMarkerEntryPoints; //< maximum number of tile markers allowed in a slice (controls degree of parallelism) 246 Double m_dMaxTileMarkerOffset; //< Calculated offset. Light weight tile markers will be transmitted for TileIdx= Offset, 2*Offset, 3*Offset ... 247 248 Int m_iWaveFrontSynchro; //< 0: no WPP. >= 1: WPP is enabled, the "Top right" from which inheritance occurs is this LCU offset in the line above the current. 249 Int m_iWaveFrontFlush; //< enable(1)/disable(0) the CABAC flush at the end of each line of LCUs. 250 Int m_iWaveFrontSubstreams; //< If iWaveFrontSynchro, this is the number of substreams per frame (dependent tiles) or per tile (independent tiles). 251 252 Bool m_bUseConstrainedIntraPred; ///< flag for using constrained intra prediction 253 254 bool m_pictureDigestEnabled; ///< enable(1)/disable(0) md5 computation and SEI signalling 255 256 // weighted prediction 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 260 Bool m_enableTMVP; 261 #if MULTIBITS_DATA_HIDING 262 Int m_signHideFlag; 263 Int m_signHidingThreshold; 264 #endif 265 #if HHI_MPI 266 Bool m_bUseMVI; ///< flag for using Motion Vector Inheritance for depth map coding 267 #endif 268 269 Int m_useScalingListId; ///< using quantization matrix 270 char* m_scalingListFile; ///< quantization matrix file name 191 271 192 272 // camera parameter … … 196 276 197 277 Int m_iCodedCamParPrecision; ///< precision for coding of camera parameters 198 199 #if HHI_INTERVIEW_SKIP200 TRenTop m_cUsedPelsRenderer; ///< renderer for used pels map201 #endif202 278 203 279 #if HHI_VSO … … 211 287 Bool m_bAllowNegDist; ///< Allow negative distortion in VSO 212 288 #endif 213 UInt m_uiVSOMode; ///< Number of VSO Mode, 1 = , 2 = simple, org vs. ren, 3 = simple, ren vs. ren, 4 = full 214 Int m_iNumberOfExternalRefs; ///< number Virtual External Reference Views 215 std::vector< std::vector<Int> > m_aaiBaseViewRefInd; ///< View numbers of Base View References 216 std::vector< std::vector<Int> > m_aaiERViewRefInd; ///< View numbers of External ViewReferences 217 std::vector< std::vector<Int> > m_aaiERViewRefLutInd; ///< Indices of LUTs used for External View References 218 #endif 219 220 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 221 Int m_iSliceArgument; ///< If m_iSliceMode==1, m_iSliceArgument=max. # of largest coding units. If m_iSliceMode==2, m_iSliceArgument=max. # of bytes. 222 Int m_iEntropySliceMode; ///< 0: Disable all entropy slice limits, 1 : Maximum number of largest coding units per slice, 2: Constraint based entropy slice 223 Int m_iEntropySliceArgument;///< If m_iEntropySliceMode==1, m_iEntropySliceArgument=max. # of largest coding units. If m_iEntropySliceMode==2, m_iEntropySliceArgument=max. # of bins. 224 225 #if MTK_NONCROSS_INLOOP_FILTER 226 Bool m_bLFCrossSliceBoundaryFlag; ///< 0: Cross-slice-boundary in-loop filtering 1: non-cross-slice-boundary in-loop filtering 227 #endif 228 #ifdef ROUNDING_CONTROL_BIPRED 229 Bool m_useRoundingControlBipred; 230 #endif 231 #if CONSTRAINED_INTRA_PRED 232 Bool m_bUseConstrainedIntraPred; ///< flag for using constrained intra prediction 233 #endif 289 UInt m_uiVSOMode; ///< Number of VSO Mode, 1 = , 2 = simple, org vs. ren, 3 = simple, ren vs. ren, 4 = full 290 #endif 291 292 // coding tools (depth intra modes) 234 293 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 235 Bool m_bUseDMM; 236 #endif 237 #if HHI_MPI 238 Bool m_bUseMVI; ///< flag for using Motion Vector Inheritance for depth map coding 239 #endif 240 241 PicOrderCnt m_iQpChangeFrame; 242 Int m_iQpChangeOffsetVideo; 243 Int m_iQpChangeOffsetDepth; 244 245 bool m_pictureDigestEnabled; ///< enable(1)/disable(0) md5 computation and SEI signalling 246 247 //====== Weighted Prediction ======== 248 #ifdef WEIGHT_PRED 249 Bool m_bUseWeightPred; ///< Use of explicit Weighting Prediction for P_SLICE 250 UInt m_uiBiPredIdc; ///< Use of Bi-Directional Weighting Prediction (B_SLICE): explicit(1) or implicit(2) 294 Bool m_bUseDMM; ///< flag for using DMM 251 295 #endif 252 296 … … 256 300 Void xPrintParameter (); ///< print configuration values 257 301 Void xPrintUsage (); ///< print usage 258 302 259 303 Void xCleanUpVectors (); ///< clean up vector sizes 260 304 Void xInitCameraPars (); ///< init camera parameters … … 265 309 Void xGetShiftParameter( UInt uiSourceView, UInt uiTargetView, bool bExternal, double& rdScale, double& rdOffset ); ///< Get one Shift Parameters 266 310 267 // util268 311 Void xAppendToFileNameEnd( Char* pchInputFileName, const Char* pchStringToAppend, Char* & rpchOutputFileName); 269 Bool xConfirmParameter(Bool bflag, const char* message); 270 312 313 Void xCheckCodingStructureMvc(); ///< validate and configure inter-view coding structure 271 314 272 315 template <class T> Void xCleanUpVector( std::vector<T>& rcVec, const T& rcInvalid ); 273 274 316 #if HHI_VSO 275 317 // Ren Model String … … 277 319 #endif 278 320 public: 279 280 321 TAppEncCfg(); 281 322 virtual ~TAppEncCfg(); 282 323 283 324 public: 284 325 Void create (); ///< create option handling class 285 326 Void destroy (); ///< destroy option handling class 286 327 Bool parseCfg ( Int argc, Char* argv[] ); ///< parse configuration file to fill member variables 287 328 288 329 };// END CLASS DEFINITION TAppEncCfg 289 330 331 //! \} 332 290 333 #endif // __TAPPENCCFG__ 291 334 -
trunk/source/App/TAppEncoder/TAppEncTop.cpp
r42 r56 2 2 * License, included below. This software may be subject to other third party 3 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-201 1,ISO/IEC6 * Copyright (c) 2010-2012, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 15 15 * this list of conditions and the following disclaimer in the documentation 16 16 * and/or other materials provided with the distribution. 17 * * Neither the name of the I SO/IEC nor the names of its contributors may17 * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 18 * be used to endorse or promote products derived from this software without 19 19 * specific prior written permission. … … 32 32 */ 33 33 34 35 36 34 /** \file TAppEncTop.cpp 37 35 \brief Encoder application class … … 39 37 40 38 #include <list> 39 #include <fstream> 40 #include <stdlib.h> 41 41 #include <stdio.h> 42 42 #include <fcntl.h> … … 44 44 45 45 #include "TAppEncTop.h" 46 #include "TLibEncoder/AnnexBwrite.h" 47 48 using namespace std; 49 50 //! \ingroup TAppEncoder 51 //! \{ 46 52 47 53 // ==================================================================================================================== … … 51 57 TAppEncTop::TAppEncTop() 52 58 { 53 #if HHI_VSO 54 m_iLastFramePutInERViewBuffer = -1; 55 #endif 59 m_totalBytes = 0; 60 m_essentialBytes = 0; 56 61 } 57 62 … … 60 65 } 61 66 62 63 67 Void TAppEncTop::xInitLibCfg() 64 68 { 65 69 for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) 66 70 { 67 m_iFrameRcvdVector.push_back(0) ; 68 m_acTEncTopList.push_back(new TEncTop); 69 71 m_frameRcvd.push_back(0); 72 m_acTEncTopList.push_back(new TEncTop); 70 73 m_acTVideoIOYuvInputFileList.push_back(new TVideoIOYuv); 71 72 74 m_acTVideoIOYuvReconFileList.push_back(new TVideoIOYuv); 73 m_cListPicYuvRecList.push_back(new TComList<TComPicYuv*>) ; 74 m_aiNextPocToDump.push_back( 0 ); 75 m_cListPicYuvRecMap.push_back( std::map<PicOrderCnt,TComPicYuv*>() ); 75 m_picYuvRec.push_back(new TComList<TComPicYuv*>) ; 76 76 77 m_acTEncTopList[iViewIdx]->setFrameRate ( m_iFrameRate ); 77 78 m_acTEncTopList[iViewIdx]->setFrameSkip ( m_FrameSkip ); 78 79 m_acTEncTopList[iViewIdx]->setSourceWidth ( m_iSourceWidth ); 79 80 m_acTEncTopList[iViewIdx]->setSourceHeight ( m_iSourceHeight ); 81 #if PIC_CROPPING 82 m_acTEncTopList[iViewIdx]->setCroppingMode ( m_croppingMode ); 83 m_acTEncTopList[iViewIdx]->setCropLeft ( m_cropLeft ); 84 m_acTEncTopList[iViewIdx]->setCropRight ( m_cropRight ); 85 m_acTEncTopList[iViewIdx]->setCropTop ( m_cropTop ); 86 m_acTEncTopList[iViewIdx]->setCropBottom ( m_cropBottom ); 87 #endif 80 88 m_acTEncTopList[iViewIdx]->setFrameToBeEncoded ( m_iFrameToBeEncoded ); 89 m_acTEncTopList[iViewIdx]->setViewId ( iViewIdx ); 90 m_acTEncTopList[iViewIdx]->setIsDepth ( false ); 91 m_acTEncTopList[iViewIdx]->setViewOrderIdx ( m_cCameraData.getViewOrderIndex()[ iViewIdx ] ); 92 m_acTEncTopList[iViewIdx]->setCamParPrecision ( m_cCameraData.getCamParsCodedPrecision () ); 93 m_acTEncTopList[iViewIdx]->setCamParInSliceHeader ( m_cCameraData.getVaryingCameraParameters() ); 94 m_acTEncTopList[iViewIdx]->setCodedScale ( m_cCameraData.getCodedScale () ); 95 m_acTEncTopList[iViewIdx]->setCodedOffset ( m_cCameraData.getCodedOffset () ); 81 96 82 97 //====== Coding Structure ======== 83 #if DCM_DECODING_REFRESH 98 m_acTEncTopList[iViewIdx]->setIntraPeriod ( m_iIntraPeriod ); 84 99 m_acTEncTopList[iViewIdx]->setDecodingRefreshType ( m_iDecodingRefreshType ); 85 #endif86 m_acTEncTopList[iViewIdx]->setCPSSize ( m_uiCodedPictureStoreSize );87 100 m_acTEncTopList[iViewIdx]->setGOPSize ( m_iGOPSize ); 88 m_acTEncTopList[iViewIdx]->setRateGOPSize ( m_iRateGOPSize ); 89 90 m_acTEncTopList[iViewIdx]->setSeqStructure ( m_cInputFormatString ); 91 101 m_acTEncTopList[iViewIdx]->setGopList ( m_GOPListsMvc[iViewIdx] ); 102 m_acTEncTopList[iViewIdx]->setExtraRPSs ( m_extraRPSs[iViewIdx] ); 103 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER 104 for(Int i = 0; i < MAX_TLAYER; i++) 105 { 106 m_acTEncTopList[iViewIdx]->setNumReorderPics ( m_numReorderPics[iViewIdx][i], i ); 107 m_acTEncTopList[iViewIdx]->setMaxDecPicBuffering ( m_maxDecPicBuffering[iViewIdx][i], i ); 108 } 109 #else 110 m_acTEncTopList[iViewIdx]->setNumReorderFrames ( m_numReorderFrames ); 111 m_acTEncTopList[iViewIdx]->setMaxNumberOfReferencePictures ( m_maxNumberOfReferencePictures ); 112 #endif 113 for( UInt uiLoop = 0; uiLoop < MAX_TLAYER; ++uiLoop ) 114 { 115 m_acTEncTopList[iViewIdx]->setLambdaModifier( uiLoop, m_adLambdaModifier[ uiLoop ] ); 116 } 92 117 m_acTEncTopList[iViewIdx]->setQP ( m_aiQP[0] ); 93 118 94 119 m_acTEncTopList[iViewIdx]->setTemporalLayerQPOffset ( m_aiTLayerQPOffset ); 95 120 m_acTEncTopList[iViewIdx]->setPad ( m_aiPad ); 96 97 //===== Slice ======== 98 99 //====== Entropy Coding ======== 100 m_acTEncTopList[iViewIdx]->setSymbolMode ( m_iSymbolMode ); 101 102 //====== Loop/Deblock Filter ======== 103 m_acTEncTopList[iViewIdx]->setLoopFilterDisable ( m_abLoopFilterDisable[0] ); 104 m_acTEncTopList[iViewIdx]->setLoopFilterAlphaC0Offset ( m_iLoopFilterAlphaC0Offset ); 105 m_acTEncTopList[iViewIdx]->setLoopFilterBetaOffset ( m_iLoopFilterBetaOffset ); 106 107 //====== Motion search ======== 121 122 #if H0566_TLA 123 m_acTEncTopList[iViewIdx]->setMaxTempLayer ( m_maxTempLayer[iViewIdx] ); 124 #else 125 m_acTEncTopList[iViewIdx]->setTLayering ( m_bTLayering ); 126 m_acTEncTopList[iViewIdx]->setTLayerSwitchingFlag ( m_abTLayerSwitchingFlag ); 127 #endif 128 129 m_acTEncTopList[iViewIdx]->setDisInter4x4 ( m_bDisInter4x4); 130 131 m_acTEncTopList[iViewIdx]->setUseNSQT( m_enableNSQT ); 132 m_acTEncTopList[iViewIdx]->setUseAMP( m_enableAMP ); 133 134 //===== Slice ======== 135 136 //====== Loop/Deblock Filter ======== 137 m_acTEncTopList[iViewIdx]->setLoopFilterDisable ( m_abLoopFilterDisable[0] ); 138 m_acTEncTopList[iViewIdx]->setLoopFilterOffsetInAPS ( m_loopFilterOffsetInAPS ); 139 m_acTEncTopList[iViewIdx]->setLoopFilterBetaOffset ( m_loopFilterBetaOffsetDiv2 ); 140 m_acTEncTopList[iViewIdx]->setLoopFilterTcOffset ( m_loopFilterTcOffsetDiv2 ); 141 #if DBL_CONTROL 142 m_acTEncTopList[iViewIdx]->setDeblockingFilterControlPresent( m_DeblockingFilterControlPresent); 143 #endif 144 145 //====== Motion search ======== 108 146 m_acTEncTopList[iViewIdx]->setFastSearch ( m_iFastSearch ); 109 147 m_acTEncTopList[iViewIdx]->setSearchRange ( m_iSearchRange ); 110 148 m_acTEncTopList[iViewIdx]->setBipredSearchRange ( m_bipredSearchRange ); 149 150 //====== Quality control ======== 111 151 m_acTEncTopList[iViewIdx]->setMaxDeltaQP ( m_iMaxDeltaQP ); 112 152 m_acTEncTopList[iViewIdx]->setMaxCuDQPDepth ( m_iMaxCuDQPDepth ); 153 154 m_acTEncTopList[iViewIdx]->setChromaQpOffset ( m_iChromaQpOffset ); 155 m_acTEncTopList[iViewIdx]->setChromaQpOffset2nd ( m_iChromaQpOffset2nd ); 156 157 #if ADAPTIVE_QP_SELECTION 158 m_acTEncTopList[iViewIdx]->setUseAdaptQpSelect ( m_bUseAdaptQpSelect ); 159 #endif 160 161 #if LOSSLESS_CODING 162 Int lowestQP; 163 #if H0736_AVC_STYLE_QP_RANGE 164 lowestQP = - ( (Int)(6*(g_uiBitDepth + g_uiBitIncrement - 8)) ); 165 #else 166 lowestQP = 0; 167 #endif 168 if ((m_iMaxDeltaQP == 0 ) && (m_aiQP[0] == lowestQP) && (m_useLossless == true)) 169 { 170 m_bUseAdaptiveQP = false; 171 } 172 #endif 173 174 m_acTEncTopList[iViewIdx]->setUseAdaptiveQP ( m_bUseAdaptiveQP ); 175 m_acTEncTopList[iViewIdx]->setQPAdaptationRange ( m_iQPAdaptationRange ); 176 113 177 #if HHI_VSO 114 178 //====== VSO ========= … … 116 180 m_acTEncTopList[iViewIdx]->setLambdaScaleVSO ( 1 ); 117 181 m_acTEncTopList[iViewIdx]->setVSOMode ( 0 ); 118 #endif 119 120 //====== Tool list ======== 182 m_acTEncTopList[iViewIdx]->setUseVSO ( false ); //GT: might be enabled later for VSO Mode 4 183 #endif 184 185 #if DEPTH_MAP_GENERATION 186 m_acTEncTopList[iViewIdx]->setPredDepthMapGeneration ( m_uiPredDepthMapGeneration ); 187 m_acTEncTopList[iViewIdx]->setPdmPrecision ( (UInt)m_cCameraData.getPdmPrecision () ); 188 m_acTEncTopList[iViewIdx]->setPdmScaleNomDelta ( m_cCameraData.getPdmScaleNomDelta () ); 189 m_acTEncTopList[iViewIdx]->setPdmOffset ( m_cCameraData.getPdmOffset () ); 190 #endif 191 #if HHI_INTER_VIEW_MOTION_PRED 192 m_acTEncTopList[iViewIdx]->setMultiviewMvPredMode ( m_uiMultiviewMvPredMode ); 193 m_acTEncTopList[iViewIdx]->setMultiviewMvRegMode ( iViewIdx ? m_uiMultiviewMvRegMode : 0 ); 194 m_acTEncTopList[iViewIdx]->setMultiviewMvRegLambdaScale ( iViewIdx ? m_dMultiviewMvRegLambdaScale : 0.0 ); 195 #endif 196 #if HHI_INTER_VIEW_RESIDUAL_PRED 197 m_acTEncTopList[iViewIdx]->setMultiviewResPredMode ( m_uiMultiviewResPredMode ); 198 #endif 199 200 //====== Tool list ======== 121 201 m_acTEncTopList[iViewIdx]->setUseSBACRD ( m_bUseSBACRD ); 122 202 m_acTEncTopList[iViewIdx]->setDeltaQpRD ( m_uiDeltaQpRD ); … … 124 204 m_acTEncTopList[iViewIdx]->setUseHADME ( m_bUseHADME ); 125 205 m_acTEncTopList[iViewIdx]->setUseALF ( m_abUseALF[0] ); 126 #if MQT_ALF_NPASS127 206 m_acTEncTopList[iViewIdx]->setALFEncodePassReduction ( m_iALFEncodePassReduction ); 128 #endif 129 #if DCM_COMB_LIST 207 #if LOSSLESS_CODING 208 m_acTEncTopList[iViewIdx]->setUseLossless ( m_useLossless ); 209 #endif 210 m_acTEncTopList[iViewIdx]->setALFMaxNumberFilters ( m_iALFMaxNumberFilters ) ; 211 130 212 m_acTEncTopList[iViewIdx]->setUseLComb ( m_bUseLComb ); 131 213 m_acTEncTopList[iViewIdx]->setLCMod ( m_bLCMod ); 132 #endif133 214 m_acTEncTopList[iViewIdx]->setdQPs ( m_aidQP ); 134 215 m_acTEncTopList[iViewIdx]->setUseRDOQ ( m_abUseRDOQ[0] ); 135 m_acTEncTopList[iViewIdx]->setUseLDC ( m_bUseLDC ); 216 #if !PIC_CROPPING 136 217 m_acTEncTopList[iViewIdx]->setUsePAD ( m_bUsePAD ); 218 #endif 137 219 m_acTEncTopList[iViewIdx]->setQuadtreeTULog2MaxSize ( m_uiQuadtreeTULog2MaxSize ); 138 220 m_acTEncTopList[iViewIdx]->setQuadtreeTULog2MinSize ( m_uiQuadtreeTULog2MinSize ); … … 140 222 m_acTEncTopList[iViewIdx]->setQuadtreeTUMaxDepthIntra ( m_uiQuadtreeTUMaxDepthIntra ); 141 223 m_acTEncTopList[iViewIdx]->setUseFastEnc ( m_bUseFastEnc ); 142 143 #if HHI_VSO 144 m_acTEncTopList[iViewIdx]->setUseVSO ( false ); //GT: might be enabled later for VSO Mode 4 145 #endif 146 147 #if BITSTREAM_EXTRACTION 148 m_acTEncTopList[iViewIdx]->setLayerId ( ( (UInt)iViewIdx ) << 1 ); 149 #endif 150 m_acTEncTopList[iViewIdx]->setViewId ( (UInt)iViewIdx ); 151 m_acTEncTopList[iViewIdx]->setViewOrderIdx ( m_cCameraData.getViewOrderIndex()[ iViewIdx ] ); 152 m_acTEncTopList[iViewIdx]->setIsDepth ( false ); 153 m_acTEncTopList[iViewIdx]->setCamParPrecision ( m_cCameraData.getCamParsCodedPrecision () ); 154 m_acTEncTopList[iViewIdx]->setCamParInSliceHeader ( m_cCameraData.getVaryingCameraParameters() ); 155 m_acTEncTopList[iViewIdx]->setCodedScale ( m_cCameraData.getCodedScale () ); 156 m_acTEncTopList[iViewIdx]->setCodedOffset ( m_cCameraData.getCodedOffset () ); 157 #if DEPTH_MAP_GENERATION 158 m_acTEncTopList[iViewIdx]->setPredDepthMapGeneration ( m_uiPredDepthMapGeneration ); 159 m_acTEncTopList[iViewIdx]->setPdmPrecision ( (UInt)m_cCameraData.getPdmPrecision () ); 160 m_acTEncTopList[iViewIdx]->setPdmScaleNomDelta ( m_cCameraData.getPdmScaleNomDelta () ); 161 m_acTEncTopList[iViewIdx]->setPdmOffset ( m_cCameraData.getPdmOffset () ); 162 #endif 163 #if HHI_INTER_VIEW_MOTION_PRED 164 m_acTEncTopList[iViewIdx]->setMultiviewMvPredMode ( m_uiMultiviewMvPredMode ); 165 m_acTEncTopList[iViewIdx]->setMultiviewMvRegMode ( iViewIdx ? m_uiMultiviewMvRegMode : 0 ); 166 m_acTEncTopList[iViewIdx]->setMultiviewMvRegLambdaScale ( iViewIdx ? m_dMultiviewMvRegLambdaScale : 0.0 ); 167 #endif 168 #if HHI_INTER_VIEW_RESIDUAL_PRED 169 m_acTEncTopList[iViewIdx]->setMultiviewResPredMode ( m_uiMultiviewResPredMode ); 170 #endif 171 172 224 m_acTEncTopList[iViewIdx]->setUseEarlyCU ( m_bUseEarlyCU ); 225 #if FAST_DECISION_FOR_MRG_RD_COST 226 m_acTEncTopList[iViewIdx]->setUseFastDecisionForMerge ( m_useFastDecisionForMerge ); 227 #endif 228 m_acTEncTopList[iViewIdx]->setUseCbfFastMode ( m_bUseCbfFastMode ); 173 229 #if HHI_INTERVIEW_SKIP 174 m_acTEncTopList[iViewIdx]->setInterViewSkip ( iViewIdx ? m_uiInterViewSkip : 0);230 m_acTEncTopList[iViewIdx]->setInterViewSkip ( iViewIdx>0 ? m_bInterViewSkip : false ); 175 231 #if HHI_INTERVIEW_SKIP_LAMBDA_SCALE 176 m_acTEncTopList[iViewIdx]->setInterViewSkipLambdaScale ( iViewIdx ? (Int)m_dInterViewSkipLambdaScale : 1 ); 177 #endif 178 #endif 179 m_acTEncTopList[iViewIdx]->setUseMRG ( m_bUseMRG ); // SOPH: 180 181 #if LM_CHROMA 232 m_acTEncTopList[iViewIdx]->setInterViewSkipLambdaScale ( iViewIdx>0 ? (UInt)m_dInterViewSkipLambdaScale : 1 ); 233 #endif 234 #endif 182 235 m_acTEncTopList[iViewIdx]->setUseLMChroma ( m_bUseLMChroma ); 183 #endif 184 185 #if HHI_RMP_SWITCH 186 m_acTEncTopList[iViewIdx]->setUseRMP ( m_bUseRMP ); 187 #endif 188 #ifdef ROUNDING_CONTROL_BIPRED 189 m_acTEncTopList[iViewIdx]->setUseRoundingControlBipred(m_useRoundingControlBipred); 190 #endif 236 m_acTEncTopList[iViewIdx]->setUseConstrainedIntraPred ( m_bUseConstrainedIntraPred ); 237 m_acTEncTopList[iViewIdx]->setPCMLog2MinSize ( m_uiPCMLog2MinSize); 238 m_acTEncTopList[iViewIdx]->setUsePCM ( m_usePCM ); 239 m_acTEncTopList[iViewIdx]->setPCMLog2MaxSize ( m_pcmLog2MaxSize); 240 241 //====== Weighted Prediction ======== 242 m_acTEncTopList[iViewIdx]->setUseWP ( m_bUseWeightPred ); 243 m_acTEncTopList[iViewIdx]->setWPBiPredIdc ( m_uiBiPredIdc ); 244 //====== Slice ======== 245 m_acTEncTopList[iViewIdx]->setSliceMode ( m_iSliceMode ); 246 m_acTEncTopList[iViewIdx]->setSliceArgument ( m_iSliceArgument ); 247 248 //====== Entropy Slice ======== 249 m_acTEncTopList[iViewIdx]->setEntropySliceMode ( m_iEntropySliceMode ); 250 m_acTEncTopList[iViewIdx]->setEntropySliceArgument ( m_iEntropySliceArgument ); 251 int iNumPartInCU = 1<<(m_uiMaxCUDepth<<1); 252 if(m_iEntropySliceMode==SHARP_FIXED_NUMBER_OF_LCU_IN_ENTROPY_SLICE) 253 { 254 m_acTEncTopList[iViewIdx]->setEntropySliceArgument ( m_iEntropySliceArgument * ( iNumPartInCU >> ( m_iSliceGranularity << 1 ) ) ); 255 } 256 if(m_iSliceMode==AD_HOC_SLICES_FIXED_NUMBER_OF_LCU_IN_SLICE) 257 { 258 m_acTEncTopList[iViewIdx]->setSliceArgument ( m_iSliceArgument * ( iNumPartInCU >> ( m_iSliceGranularity << 1 ) ) ); 259 } 260 #if FIXED_NUMBER_OF_TILES_SLICE_MODE 261 if(m_iSliceMode==AD_HOC_SLICES_FIXED_NUMBER_OF_TILES_IN_SLICE) 262 { 263 m_acTEncTopList[iViewIdx]->setSliceArgument ( m_iSliceArgument ); 264 } 265 #endif 266 m_acTEncTopList[iViewIdx]->setSliceGranularity ( m_iSliceGranularity ); 267 if(m_iSliceMode == 0 ) 268 { 269 m_bLFCrossSliceBoundaryFlag = true; 270 } 271 m_acTEncTopList[iViewIdx]->setLFCrossSliceBoundaryFlag( m_bLFCrossSliceBoundaryFlag ); 272 m_acTEncTopList[iViewIdx]->setUseSAO ( m_abUseSAO[0] ); 273 #if SAO_UNIT_INTERLEAVING 274 m_acTEncTopList[iViewIdx]->setMaxNumOffsetsPerPic (m_maxNumOffsetsPerPic); 275 m_acTEncTopList[iViewIdx]->setSaoInterleavingFlag (m_saoInterleavingFlag); 276 #endif 277 m_acTEncTopList[iViewIdx]->setPCMInputBitDepthFlag ( m_bPCMInputBitDepthFlag); 278 m_acTEncTopList[iViewIdx]->setPCMFilterDisableFlag ( m_bPCMFilterDisableFlag); 279 280 m_acTEncTopList[iViewIdx]->setPictureDigestEnabled(m_pictureDigestEnabled); 281 282 m_acTEncTopList[iViewIdx]->setColumnRowInfoPresent ( m_iColumnRowInfoPresent ); 283 m_acTEncTopList[iViewIdx]->setUniformSpacingIdr ( m_iUniformSpacingIdr ); 284 #if !REMOVE_TILE_DEPENDENCE 285 m_acTEncTopList[iViewIdx]->setTileBoundaryIndependenceIdr( m_iTileBoundaryIndependenceIdr ); 286 #endif 287 m_acTEncTopList[iViewIdx]->setNumColumnsMinus1 ( m_iNumColumnsMinus1 ); 288 m_acTEncTopList[iViewIdx]->setNumRowsMinus1 ( m_iNumRowsMinus1 ); 289 if(m_iUniformSpacingIdr==0) 290 { 291 m_acTEncTopList[iViewIdx]->setColumnWidth ( m_pchColumnWidth ); 292 m_acTEncTopList[iViewIdx]->setRowHeight ( m_pchRowHeight ); 293 } 294 m_acTEncTopList[iViewIdx]->xCheckGSParameters(); 295 m_acTEncTopList[iViewIdx]->setTileLocationInSliceHeaderFlag ( m_iTileLocationInSliceHeaderFlag ); 296 m_acTEncTopList[iViewIdx]->setTileMarkerFlag ( m_iTileMarkerFlag ); 297 m_acTEncTopList[iViewIdx]->setMaxTileMarkerEntryPoints ( m_iMaxTileMarkerEntryPoints ); 298 299 Int uiTilesCount = (m_iNumRowsMinus1+1) * (m_iNumColumnsMinus1+1); 300 m_dMaxTileMarkerOffset = ((Double)uiTilesCount) / m_iMaxTileMarkerEntryPoints; 301 m_acTEncTopList[iViewIdx]->setMaxTileMarkerOffset ( m_dMaxTileMarkerOffset ); 302 m_acTEncTopList[iViewIdx]->setTileBehaviorControlPresentFlag( m_iTileBehaviorControlPresentFlag ); 303 #if !REMOVE_TILE_DEPENDENCE 304 if(m_iTileBoundaryIndependenceIdr == 0 || uiTilesCount == 1) 305 #else 306 if(uiTilesCount == 1) 307 #endif 308 { 309 m_bLFCrossTileBoundaryFlag = true; 310 } 311 m_acTEncTopList[iViewIdx]->setLFCrossTileBoundaryFlag( m_bLFCrossTileBoundaryFlag ); 312 m_acTEncTopList[iViewIdx]->setWaveFrontSynchro ( m_iWaveFrontSynchro ); 313 m_acTEncTopList[iViewIdx]->setWaveFrontFlush ( m_iWaveFrontFlush ); 314 m_acTEncTopList[iViewIdx]->setWaveFrontSubstreams ( m_iWaveFrontSubstreams ); 315 m_acTEncTopList[iViewIdx]->setEnableTMVP ( m_enableTMVP ); 316 m_acTEncTopList[iViewIdx]->setUseScalingListId ( m_useScalingListId ); 317 m_acTEncTopList[iViewIdx]->setScalingListFile ( m_scalingListFile ); 318 #if MULTIBITS_DATA_HIDING 319 m_acTEncTopList[iViewIdx]->setSignHideFlag(m_signHideFlag); 320 m_acTEncTopList[iViewIdx]->setTSIG(m_signHidingThreshold); 321 #endif 322 323 #if LCU_SYNTAX_ALF 324 if(uiTilesCount > 1) 325 { 326 m_bALFParamInSlice = false; 327 m_bALFPicBasedEncode = true; 328 } 329 m_acTEncTopList[iViewIdx]->setALFParamInSlice ( m_bALFParamInSlice); 330 m_acTEncTopList[iViewIdx]->setALFPicBasedEncode ( m_bALFPicBasedEncode); 331 #endif 332 333 //====== Depth tools ======== 191 334 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 192 m_acTEncTopList[iViewIdx]->setUseDMM( false ); 193 #endif 194 #if CONSTRAINED_INTRA_PRED 195 m_acTEncTopList[iViewIdx]->setUseConstrainedIntraPred ( m_bUseConstrainedIntraPred ); 196 #endif 197 #ifdef WEIGHT_PRED 198 //====== Weighted Prediction ======== 199 m_acTEncTopList[iViewIdx]->setUseWP ( m_bUseWeightPred ); 200 m_acTEncTopList[iViewIdx]->setWPBiPredIdc ( m_uiBiPredIdc ); 201 #endif 202 //====== Slice ======== 203 m_acTEncTopList[iViewIdx]->setSliceMode ( m_iSliceMode ); 204 m_acTEncTopList[iViewIdx]->setSliceArgument ( m_iSliceArgument ); 205 206 //====== Entropy Slice ======== 207 m_acTEncTopList[iViewIdx]->setEntropySliceMode ( m_iEntropySliceMode ); 208 m_acTEncTopList[iViewIdx]->setEntropySliceArgument ( m_iEntropySliceArgument ); 209 #if MTK_NONCROSS_INLOOP_FILTER 210 if(m_iSliceMode == 0 ) 211 { 212 m_bLFCrossSliceBoundaryFlag = true; 213 } 214 m_acTEncTopList[iViewIdx]->setLFCrossSliceBoundaryFlag( m_bLFCrossSliceBoundaryFlag ); 215 #endif 216 #if MTK_SAO 217 m_acTEncTopList[iViewIdx]->setUseSAO ( m_abUseSAO[0] ); 335 m_acTEncTopList[iViewIdx]->setUseDMM ( false ); 218 336 #endif 219 337 #if HHI_MPI 220 338 m_acTEncTopList[iViewIdx]->setUseMVI( false ); 221 339 #endif 222 223 m_acTEncTopList[iViewIdx]->setPictureDigestEnabled(m_pictureDigestEnabled);224 m_acTEncTopList[iViewIdx]->setQpChangeFrame( m_iQpChangeFrame );225 m_acTEncTopList[iViewIdx]->setQpChangeOffsetVideo( m_iQpChangeOffsetVideo );226 m_acTEncTopList[iViewIdx]->setQpChangeOffsetDepth( m_iQpChangeOffsetDepth );227 340 } 228 341 if( m_bUsingDepthMaps ) 229 342 { 230 231 #if HHI_VSO232 for (Int iViewIdx=0; iViewIdx<m_iNumberOfExternalRefs; iViewIdx++)233 {234 m_acTVideoIOYuvERFileList.push_back(new TVideoIOYuv);235 }236 #endif237 238 343 for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) 239 344 { 240 #if FLEX_CODING_ORDER 241 // Detect whether depth comes before than texture for this view 242 Bool isDepthFirst = false; 243 if ( m_b3DVFlexOrder ) 244 { 245 for ( Int ii=1; ii<12; ii+=2 ) 246 { 247 Int iViewIdxCfg = (Int)(m_pchMVCJointCodingOrder[ii]-'0'); 248 if ( iViewIdxCfg == iViewIdx ) 249 { 250 if ( m_pchMVCJointCodingOrder[ii-1]=='D' ) // depth comes first for this view 251 { 252 isDepthFirst = true; 253 } 254 else 255 { 256 assert(m_pchMVCJointCodingOrder[ii-1]=='T'); 257 } 258 break; 259 } 260 } 261 } 262 #endif 263 m_iDepthFrameRcvdVector.push_back(0) ; 264 m_acTEncDepthTopList.push_back(new TEncTop); 265 345 m_depthFrameRcvd.push_back(0); 346 m_acTEncDepthTopList.push_back(new TEncTop); 266 347 m_acTVideoIOYuvDepthInputFileList.push_back(new TVideoIOYuv); 267 268 348 m_acTVideoIOYuvDepthReconFileList.push_back(new TVideoIOYuv); 269 m_cListPicYuvDepthRecList.push_back(new TComList<TComPicYuv*>) ; 270 m_aiNextDepthPocToDump.push_back( 0 ); 271 m_cListPicYuvDepthRecMap.push_back( std::map<PicOrderCnt,TComPicYuv*>() ); 349 m_picYuvDepthRec.push_back(new TComList<TComPicYuv*>) ; 350 272 351 m_acTEncDepthTopList[iViewIdx]->setFrameRate ( m_iFrameRate ); 273 352 m_acTEncDepthTopList[iViewIdx]->setFrameSkip ( m_FrameSkip ); 274 353 m_acTEncDepthTopList[iViewIdx]->setSourceWidth ( m_iSourceWidth ); 275 354 m_acTEncDepthTopList[iViewIdx]->setSourceHeight ( m_iSourceHeight ); 355 #if PIC_CROPPING 356 m_acTEncDepthTopList[iViewIdx]->setCroppingMode ( m_croppingMode ); 357 m_acTEncDepthTopList[iViewIdx]->setCropLeft ( m_cropLeft ); 358 m_acTEncDepthTopList[iViewIdx]->setCropRight ( m_cropRight ); 359 m_acTEncDepthTopList[iViewIdx]->setCropTop ( m_cropTop ); 360 m_acTEncDepthTopList[iViewIdx]->setCropBottom ( m_cropBottom ); 361 #endif 276 362 m_acTEncDepthTopList[iViewIdx]->setFrameToBeEncoded ( m_iFrameToBeEncoded ); 363 m_acTEncDepthTopList[iViewIdx]->setViewId ( iViewIdx ); 364 m_acTEncDepthTopList[iViewIdx]->setIsDepth ( true ); 365 m_acTEncDepthTopList[iViewIdx]->setViewOrderIdx ( m_cCameraData.getViewOrderIndex()[ iViewIdx ] ); 366 m_acTEncDepthTopList[iViewIdx]->setCamParPrecision ( 0 ); 367 m_acTEncDepthTopList[iViewIdx]->setCamParInSliceHeader ( false ); 368 m_acTEncDepthTopList[iViewIdx]->setCodedScale ( 0 ); 369 m_acTEncDepthTopList[iViewIdx]->setCodedOffset ( 0 ); 277 370 278 371 //====== Coding Structure ======== 279 #if DCM_DECODING_REFRESH 372 m_acTEncDepthTopList[iViewIdx]->setIntraPeriod ( m_iIntraPeriod ); 280 373 m_acTEncDepthTopList[iViewIdx]->setDecodingRefreshType ( m_iDecodingRefreshType ); 281 #endif282 m_acTEncDepthTopList[iViewIdx]->setCPSSize ( m_uiCodedPictureStoreSize );283 374 m_acTEncDepthTopList[iViewIdx]->setGOPSize ( m_iGOPSize ); 284 m_acTEncDepthTopList[iViewIdx]->setRateGOPSize ( m_iRateGOPSize ); 285 286 m_acTEncDepthTopList[iViewIdx]->setSeqStructure ( m_cInputFormatString ); 287 375 m_acTEncDepthTopList[iViewIdx]->setGopList ( m_GOPListsMvc[iViewIdx] ); 376 m_acTEncDepthTopList[iViewIdx]->setExtraRPSs ( m_extraRPSs[iViewIdx] ); 377 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER 378 for(Int i = 0; i < MAX_TLAYER; i++) 379 { 380 m_acTEncDepthTopList[iViewIdx]->setNumReorderPics ( m_numReorderPics[iViewIdx][i], i ); 381 m_acTEncDepthTopList[iViewIdx]->setMaxDecPicBuffering ( m_maxDecPicBuffering[iViewIdx][i], i ); 382 } 383 #else 384 m_acTEncDepthTopList[iViewIdx]->setNumReorderFrames ( m_numReorderFrames ); 385 m_acTEncDepthTopList[iViewIdx]->setMaxNumberOfReferencePictures ( m_maxNumberOfReferencePictures ); 386 #endif 387 for( UInt uiLoop = 0; uiLoop < MAX_TLAYER; ++uiLoop ) 388 { 389 m_acTEncDepthTopList[iViewIdx]->setLambdaModifier( uiLoop, m_adLambdaModifier[ uiLoop ] ); 390 } 288 391 m_acTEncDepthTopList[iViewIdx]->setQP ( m_aiQP[1] ); 289 392 … … 291 394 m_acTEncDepthTopList[iViewIdx]->setPad ( m_aiPad ); 292 395 396 #if H0566_TLA 397 m_acTEncDepthTopList[iViewIdx]->setMaxTempLayer ( m_maxTempLayer[iViewIdx] ); 398 #else 399 m_acTEncDepthTopList[iViewIdx]->setTLayering ( m_bTLayering ); 400 m_acTEncDepthTopList[iViewIdx]->setTLayerSwitchingFlag ( m_abTLayerSwitchingFlag ); 401 #endif 402 403 m_acTEncDepthTopList[iViewIdx]->setDisInter4x4 ( m_bDisInter4x4); 404 405 m_acTEncDepthTopList[iViewIdx]->setUseNSQT( m_enableNSQT ); 406 m_acTEncDepthTopList[iViewIdx]->setUseAMP( m_enableAMP ); 407 293 408 //===== Slice ======== 294 295 //====== Entropy Coding ========296 m_acTEncDepthTopList[iViewIdx]->setSymbolMode ( m_iSymbolMode );297 409 298 410 //====== Loop/Deblock Filter ======== 299 411 m_acTEncDepthTopList[iViewIdx]->setLoopFilterDisable ( m_abLoopFilterDisable[1] ); 300 m_acTEncDepthTopList[iViewIdx]->setLoopFilterAlphaC0Offset ( m_iLoopFilterAlphaC0Offset ); 301 m_acTEncDepthTopList[iViewIdx]->setLoopFilterBetaOffset ( m_iLoopFilterBetaOffset ); 412 m_acTEncDepthTopList[iViewIdx]->setLoopFilterOffsetInAPS ( m_loopFilterOffsetInAPS ); 413 m_acTEncDepthTopList[iViewIdx]->setLoopFilterBetaOffset ( m_loopFilterBetaOffsetDiv2 ); 414 m_acTEncDepthTopList[iViewIdx]->setLoopFilterTcOffset ( m_loopFilterTcOffsetDiv2 ); 415 #if DBL_CONTROL 416 m_acTEncDepthTopList[iViewIdx]->setDeblockingFilterControlPresent( m_DeblockingFilterControlPresent); 417 #endif 302 418 303 419 //====== Motion search ======== … … 305 421 m_acTEncDepthTopList[iViewIdx]->setSearchRange ( m_iSearchRange ); 306 422 m_acTEncDepthTopList[iViewIdx]->setBipredSearchRange ( m_bipredSearchRange ); 423 424 //====== Quality control ======== 307 425 m_acTEncDepthTopList[iViewIdx]->setMaxDeltaQP ( m_iMaxDeltaQP ); 426 m_acTEncDepthTopList[iViewIdx]->setMaxCuDQPDepth ( m_iMaxCuDQPDepth ); 427 428 m_acTEncDepthTopList[iViewIdx]->setChromaQpOffset ( m_iChromaQpOffset ); 429 m_acTEncDepthTopList[iViewIdx]->setChromaQpOffset2nd ( m_iChromaQpOffset2nd ); 430 431 #if ADAPTIVE_QP_SELECTION 432 m_acTEncDepthTopList[iViewIdx]->setUseAdaptQpSelect ( m_bUseAdaptQpSelect ); 433 #endif 434 435 m_acTEncDepthTopList[iViewIdx]->setUseAdaptiveQP ( m_bUseAdaptiveQP ); 436 m_acTEncDepthTopList[iViewIdx]->setQPAdaptationRange ( m_iQPAdaptationRange ); 308 437 309 438 //====== Tool list ======== … … 313 442 m_acTEncDepthTopList[iViewIdx]->setUseHADME ( m_bUseHADME ); 314 443 m_acTEncDepthTopList[iViewIdx]->setUseALF ( m_abUseALF[1] ); 315 #if MQT_ALF_NPASS316 444 m_acTEncDepthTopList[iViewIdx]->setALFEncodePassReduction ( m_iALFEncodePassReduction ); 317 #endif 318 #if DCM_COMB_LIST 445 #if LOSSLESS_CODING 446 m_acTEncDepthTopList[iViewIdx]->setUseLossless ( m_useLossless ); 447 #endif 448 m_acTEncDepthTopList[iViewIdx]->setALFMaxNumberFilters ( m_iALFMaxNumberFilters ) ; 449 319 450 m_acTEncDepthTopList[iViewIdx]->setUseLComb ( m_bUseLComb ); 320 m_acTEncDepthTopList[iViewIdx]->setLCMod ( m_bLCMod ); 321 #endif 322 m_acTEncDepthTopList[iViewIdx]->setdQPs ( m_aidQP ); 451 m_acTEncDepthTopList[iViewIdx]->setLCMod ( m_bLCMod ); 452 m_acTEncDepthTopList[iViewIdx]->setdQPs ( m_aidQPdepth ); 323 453 m_acTEncDepthTopList[iViewIdx]->setUseRDOQ ( m_abUseRDOQ[1] ); 324 m_acTEncDepthTopList[iViewIdx]->setUseLDC ( m_bUseLDC ); 454 #if !PIC_CROPPING 325 455 m_acTEncDepthTopList[iViewIdx]->setUsePAD ( m_bUsePAD ); 456 #endif 326 457 m_acTEncDepthTopList[iViewIdx]->setQuadtreeTULog2MaxSize ( m_uiQuadtreeTULog2MaxSize ); 327 458 m_acTEncDepthTopList[iViewIdx]->setQuadtreeTULog2MinSize ( m_uiQuadtreeTULog2MinSize ); … … 329 460 m_acTEncDepthTopList[iViewIdx]->setQuadtreeTUMaxDepthIntra ( m_uiQuadtreeTUMaxDepthIntra ); 330 461 m_acTEncDepthTopList[iViewIdx]->setUseFastEnc ( m_bUseFastEnc ); 331 462 m_acTEncDepthTopList[iViewIdx]->setUseEarlyCU ( m_bUseEarlyCU ); 463 #if FAST_DECISION_FOR_MRG_RD_COST 464 m_acTEncDepthTopList[iViewIdx]->setUseFastDecisionForMerge ( m_useFastDecisionForMerge ); 465 #endif 466 m_acTEncDepthTopList[iViewIdx]->setUseCbfFastMode ( m_bUseCbfFastMode ); 467 #if HHI_INTERVIEW_SKIP 468 m_acTEncDepthTopList[iViewIdx]->setInterViewSkip ( 0 ); 469 #if HHI_INTERVIEW_SKIP_LAMBDA_SCALE 470 m_acTEncDepthTopList[iViewIdx]->setInterViewSkipLambdaScale ( 1 ); 471 #endif 472 #endif 473 m_acTEncDepthTopList[iViewIdx]->setUseLMChroma ( m_bUseLMChroma ); 474 m_acTEncDepthTopList[iViewIdx]->setUseConstrainedIntraPred ( m_bUseConstrainedIntraPred ); 475 m_acTEncDepthTopList[iViewIdx]->setPCMLog2MinSize ( m_uiPCMLog2MinSize); 476 m_acTEncDepthTopList[iViewIdx]->setUsePCM ( m_usePCM ); 477 m_acTEncDepthTopList[iViewIdx]->setPCMLog2MaxSize ( m_pcmLog2MaxSize); 478 //====== VSO ======== 332 479 #if HHI_VSO 333 480 m_acTEncDepthTopList[iViewIdx]->setUseVSO ( m_bUseVSO ); //GT: might be enabled/disabled later for VSO Mode 4 … … 340 487 #endif 341 488 342 #if BITSTREAM_EXTRACTION343 m_acTEncDepthTopList[iViewIdx]->setLayerId ( ( ( (UInt)iViewIdx ) << 1 ) + 1 );344 #endif345 m_acTEncDepthTopList[iViewIdx]->setViewId ( (UInt)iViewIdx );346 m_acTEncDepthTopList[iViewIdx]->setViewOrderIdx ( m_cCameraData.getViewOrderIndex()[ iViewIdx ] );347 m_acTEncDepthTopList[iViewIdx]->setIsDepth ( true );348 m_acTEncDepthTopList[iViewIdx]->setCamParPrecision ( 0 );349 m_acTEncDepthTopList[iViewIdx]->setCamParInSliceHeader ( false );350 m_acTEncDepthTopList[iViewIdx]->setCodedScale ( 0 );351 m_acTEncDepthTopList[iViewIdx]->setCodedOffset ( 0 );352 489 #if DEPTH_MAP_GENERATION 353 490 m_acTEncDepthTopList[iViewIdx]->setPredDepthMapGeneration ( 0 ); … … 362 499 #endif 363 500 364 #if HHI_INTERVIEW_SKIP 365 m_acTEncDepthTopList[iViewIdx]->setInterViewSkip ( 0 ); 366 #if HHI_INTERVIEW_SKIP_LAMBDA_SCALE 367 m_acTEncDepthTopList[iViewIdx]->setInterViewSkipLambdaScale ( 1 ); 368 #endif 369 #endif 370 m_acTEncDepthTopList[iViewIdx]->setUseMRG ( m_bUseMRG ); // SOPH: 371 372 #if LM_CHROMA 373 m_acTEncDepthTopList[iViewIdx]->setUseLMChroma ( m_bUseLMChroma ); 374 #endif 375 376 #if HHI_RMP_SWITCH 377 m_acTEncDepthTopList[iViewIdx]->setUseRMP ( m_bUseRMP ); 378 #endif 379 #ifdef ROUNDING_CONTROL_BIPRED 380 m_acTEncDepthTopList[iViewIdx]->setUseRoundingControlBipred(m_useRoundingControlBipred); 381 #endif 501 //====== Weighted Prediction ======== 502 m_acTEncDepthTopList[iViewIdx]->setUseWP ( m_bUseWeightPred ); 503 m_acTEncDepthTopList[iViewIdx]->setWPBiPredIdc ( m_uiBiPredIdc ); 504 //====== Slice ======== 505 m_acTEncDepthTopList[iViewIdx]->setSliceMode ( m_iSliceMode ); 506 m_acTEncDepthTopList[iViewIdx]->setSliceArgument ( m_iSliceArgument ); 507 508 //====== Entropy Slice ======== 509 m_acTEncDepthTopList[iViewIdx]->setEntropySliceMode ( m_iEntropySliceMode ); 510 m_acTEncDepthTopList[iViewIdx]->setEntropySliceArgument ( m_iEntropySliceArgument ); 511 int iNumPartInCU = 1<<(m_uiMaxCUDepth<<1); 512 if(m_iEntropySliceMode==SHARP_FIXED_NUMBER_OF_LCU_IN_ENTROPY_SLICE) 513 { 514 m_acTEncDepthTopList[iViewIdx]->setEntropySliceArgument ( m_iEntropySliceArgument * ( iNumPartInCU >> ( m_iSliceGranularity << 1 ) ) ); 515 } 516 if(m_iSliceMode==AD_HOC_SLICES_FIXED_NUMBER_OF_LCU_IN_SLICE) 517 { 518 m_acTEncDepthTopList[iViewIdx]->setSliceArgument ( m_iSliceArgument * ( iNumPartInCU >> ( m_iSliceGranularity << 1 ) ) ); 519 } 520 #if FIXED_NUMBER_OF_TILES_SLICE_MODE 521 if(m_iSliceMode==AD_HOC_SLICES_FIXED_NUMBER_OF_TILES_IN_SLICE) 522 { 523 m_acTEncDepthTopList[iViewIdx]->setSliceArgument ( m_iSliceArgument ); 524 } 525 #endif 526 m_acTEncDepthTopList[iViewIdx]->setSliceGranularity ( m_iSliceGranularity ); 527 if(m_iSliceMode == 0 ) 528 { 529 m_bLFCrossSliceBoundaryFlag = true; 530 } 531 m_acTEncDepthTopList[iViewIdx]->setLFCrossSliceBoundaryFlag( m_bLFCrossSliceBoundaryFlag ); 532 m_acTEncDepthTopList[iViewIdx]->setUseSAO ( m_abUseSAO[1] ); 533 #if SAO_UNIT_INTERLEAVING 534 m_acTEncDepthTopList[iViewIdx]->setMaxNumOffsetsPerPic (m_maxNumOffsetsPerPic); 535 m_acTEncDepthTopList[iViewIdx]->setSaoInterleavingFlag (m_saoInterleavingFlag); 536 #endif 537 m_acTEncDepthTopList[iViewIdx]->setPCMInputBitDepthFlag ( m_bPCMInputBitDepthFlag); 538 m_acTEncDepthTopList[iViewIdx]->setPCMFilterDisableFlag ( m_bPCMFilterDisableFlag); 539 540 m_acTEncDepthTopList[iViewIdx]->setPictureDigestEnabled(m_pictureDigestEnabled); 541 542 m_acTEncDepthTopList[iViewIdx]->setColumnRowInfoPresent ( m_iColumnRowInfoPresent ); 543 m_acTEncDepthTopList[iViewIdx]->setUniformSpacingIdr ( m_iUniformSpacingIdr ); 544 #if !REMOVE_TILE_DEPENDENCE 545 m_acTEncDepthTopList[iViewIdx]->setTileBoundaryIndependenceIdr( m_iTileBoundaryIndependenceIdr ); 546 #endif 547 m_acTEncDepthTopList[iViewIdx]->setNumColumnsMinus1 ( m_iNumColumnsMinus1 ); 548 m_acTEncDepthTopList[iViewIdx]->setNumRowsMinus1 ( m_iNumRowsMinus1 ); 549 if(m_iUniformSpacingIdr==0) 550 { 551 m_acTEncDepthTopList[iViewIdx]->setColumnWidth ( m_pchColumnWidth ); 552 m_acTEncDepthTopList[iViewIdx]->setRowHeight ( m_pchRowHeight ); 553 } 554 m_acTEncDepthTopList[iViewIdx]->xCheckGSParameters(); 555 m_acTEncDepthTopList[iViewIdx]->setTileLocationInSliceHeaderFlag ( m_iTileLocationInSliceHeaderFlag ); 556 m_acTEncDepthTopList[iViewIdx]->setTileMarkerFlag ( m_iTileMarkerFlag ); 557 m_acTEncDepthTopList[iViewIdx]->setMaxTileMarkerEntryPoints ( m_iMaxTileMarkerEntryPoints ); 558 559 Int uiTilesCount = (m_iNumRowsMinus1+1) * (m_iNumColumnsMinus1+1); 560 m_dMaxTileMarkerOffset = ((Double)uiTilesCount) / m_iMaxTileMarkerEntryPoints; 561 m_acTEncDepthTopList[iViewIdx]->setMaxTileMarkerOffset ( m_dMaxTileMarkerOffset ); 562 m_acTEncDepthTopList[iViewIdx]->setTileBehaviorControlPresentFlag( m_iTileBehaviorControlPresentFlag ); 563 #if !REMOVE_TILE_DEPENDENCE 564 if(m_iTileBoundaryIndependenceIdr == 0 || uiTilesCount == 1) 565 #else 566 if(uiTilesCount == 1) 567 #endif 568 { 569 m_bLFCrossTileBoundaryFlag = true; 570 } 571 m_acTEncDepthTopList[iViewIdx]->setLFCrossTileBoundaryFlag( m_bLFCrossTileBoundaryFlag ); 572 m_acTEncDepthTopList[iViewIdx]->setWaveFrontSynchro ( m_iWaveFrontSynchro ); 573 m_acTEncDepthTopList[iViewIdx]->setWaveFrontFlush ( m_iWaveFrontFlush ); 574 m_acTEncDepthTopList[iViewIdx]->setWaveFrontSubstreams ( m_iWaveFrontSubstreams ); 575 m_acTEncDepthTopList[iViewIdx]->setEnableTMVP ( m_enableTMVP ); 576 m_acTEncDepthTopList[iViewIdx]->setUseScalingListId ( m_useScalingListId ); 577 m_acTEncDepthTopList[iViewIdx]->setScalingListFile ( m_scalingListFile ); 578 #if MULTIBITS_DATA_HIDING 579 m_acTEncDepthTopList[iViewIdx]->setSignHideFlag(m_signHideFlag); 580 m_acTEncDepthTopList[iViewIdx]->setTSIG(m_signHidingThreshold); 581 #endif 582 583 #if LCU_SYNTAX_ALF 584 if(uiTilesCount > 1) 585 { 586 m_bALFParamInSlice = false; 587 m_bALFPicBasedEncode = true; 588 } 589 m_acTEncDepthTopList[iViewIdx]->setALFParamInSlice ( m_bALFParamInSlice); 590 m_acTEncDepthTopList[iViewIdx]->setALFPicBasedEncode ( m_bALFPicBasedEncode); 591 #endif 592 593 //====== Depth tools ======== 382 594 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 383 m_acTEncDepthTopList[iViewIdx]->setUseDMM( m_bUseDMM ); 384 #endif 385 #if FLEX_CODING_ORDER && HHI_DMM_PRED_TEX 386 m_acTEncDepthTopList[iViewIdx]->setUseDMM34( (m_b3DVFlexOrder && isDepthFirst) ? false : m_bUseDMM ); 387 #endif 388 #if CONSTRAINED_INTRA_PRED 389 m_acTEncDepthTopList[iViewIdx]->setUseConstrainedIntraPred ( m_bUseConstrainedIntraPred ); 390 #endif 391 #ifdef WEIGHT_PRED 392 //====== Weighted Prediction ======== 393 m_acTEncDepthTopList[iViewIdx]->setUseWP ( m_bUseWeightPred ); 394 m_acTEncDepthTopList[iViewIdx]->setWPBiPredIdc ( m_uiBiPredIdc ); 395 #endif 396 //====== Slice ======== 397 m_acTEncDepthTopList[iViewIdx]->setSliceMode ( m_iSliceMode ); 398 m_acTEncDepthTopList[iViewIdx]->setSliceArgument ( m_iSliceArgument ); 399 400 //====== Entropy Slice ======== 401 m_acTEncDepthTopList[iViewIdx]->setEntropySliceMode ( m_iEntropySliceMode ); 402 m_acTEncDepthTopList[iViewIdx]->setEntropySliceArgument ( m_iEntropySliceArgument ); 403 #if MTK_NONCROSS_INLOOP_FILTER 404 if(m_iSliceMode == 0 ) 405 { 406 m_bLFCrossSliceBoundaryFlag = true; 407 } 408 m_acTEncDepthTopList[iViewIdx]->setLFCrossSliceBoundaryFlag( m_bLFCrossSliceBoundaryFlag ); 409 #endif 410 #if MTK_SAO 411 m_acTEncDepthTopList[iViewIdx]->setUseSAO ( m_abUseSAO[1] ); 595 m_acTEncDepthTopList[iViewIdx]->setUseDMM ( m_bUseDMM ); 412 596 #endif 413 597 #if HHI_MPI 414 #if FLEX_CODING_ORDER 415 m_acTEncDepthTopList[iViewIdx]->setUseMVI( (m_b3DVFlexOrder && isDepthFirst) ? false : m_bUseMVI ); 416 #else 417 m_acTEncDepthTopList[iViewIdx]->setUseMVI( m_bUseMVI ); 418 #endif 419 #endif 420 421 m_acTEncDepthTopList[iViewIdx]->setPictureDigestEnabled(m_pictureDigestEnabled); 422 423 m_acTEncDepthTopList[iViewIdx]->setQpChangeFrame( m_iQpChangeFrame ); 424 m_acTEncDepthTopList[iViewIdx]->setQpChangeOffsetVideo( m_iQpChangeOffsetVideo ); 425 m_acTEncDepthTopList[iViewIdx]->setQpChangeOffsetDepth( m_iQpChangeOffsetDepth ); 426 } 427 } 598 m_acTEncDepthTopList[iViewIdx]->setUseMVI( m_bUseMVI ); 599 #endif 600 } 601 } 602 428 603 #if HHI_INTER_VIEW_MOTION_PRED 429 604 else if( m_uiMultiviewMvRegMode ) … … 466 641 else 467 642 { 468 m_cRendererTop.init(m_iSourceWidth, m_iSourceHeight,true,0,0,true, 0,0,0,0,0,0,0,1,0,0 ); //GT: simplest configuration643 AOT(true); 469 644 } 470 645 } … … 474 649 m_cUsedPelsRenderer.init(m_iSourceWidth, m_iSourceHeight, true, 0, LOG2_DISP_PREC_LUT, true, 0, 0, 0, 0, 0, 6, 4, 1, 0, 6 ); 475 650 #endif 651 476 652 } 477 653 478 654 Void TAppEncTop::xCreateLib() 479 655 { 480 // Video I/O481 m_cTVideoIOBitsFile.openBits( m_pchBitstreamFile, true ); // write mode482 483 656 for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) 484 657 { 485 658 m_acTVideoIOYuvInputFileList[iViewIdx]->open( m_pchInputFileList[iViewIdx], false, m_uiInputBitDepth, m_uiInternalBitDepth ); // read mode 486 m_acTVideoIOYuvInputFileList[iViewIdx]->skipFrames(m_FrameSkip, m_iSourceWidth , m_iSourceHeight);487 m_acTVideoIOYuvReconFileList[iViewIdx]->open( m_pchReconFileList[iViewIdx], true, m_uiOutputBitDepth, m_uiInternalBitDepth); // write mode 488 489 // Neo Decoder659 m_acTVideoIOYuvInputFileList[iViewIdx]->skipFrames(m_FrameSkip, m_iSourceWidth - m_aiPad[0], m_iSourceHeight - m_aiPad[1]); 660 661 if (m_pchReconFileList[iViewIdx]) 662 m_acTVideoIOYuvReconFileList[iViewIdx]->open(m_pchReconFileList[iViewIdx], true, m_uiOutputBitDepth, m_uiInternalBitDepth); // write mode 490 663 m_acTEncTopList[iViewIdx]->create(); 491 492 664 if( m_bUsingDepthMaps ) 665 { 666 m_acTVideoIOYuvDepthInputFileList[iViewIdx]->open( m_pchDepthInputFileList[iViewIdx], false, m_uiInputBitDepth, m_uiInternalBitDepth ); // read mode 667 m_acTVideoIOYuvDepthInputFileList[iViewIdx]->skipFrames(m_FrameSkip, m_iSourceWidth - m_aiPad[0], m_iSourceHeight - m_aiPad[1]); 668 669 if (m_pchDepthReconFileList[iViewIdx]) 670 m_acTVideoIOYuvDepthReconFileList[iViewIdx]->open(m_pchDepthReconFileList[iViewIdx], true, m_uiOutputBitDepth, m_uiInternalBitDepth); // write mode 671 m_acTEncDepthTopList[iViewIdx]->create(); 672 } 673 #if HHI_INTER_VIEW_MOTION_PRED 674 else if( m_uiMultiviewMvRegMode ) 493 675 { 494 676 m_acTVideoIOYuvDepthInputFileList[iViewIdx]->open( m_pchDepthInputFileList[iViewIdx], false, m_uiInputBitDepth, m_uiInternalBitDepth ); // read mode 495 677 m_acTVideoIOYuvDepthInputFileList[iViewIdx]->skipFrames(m_FrameSkip, m_iSourceWidth, m_iSourceHeight); 496 497 m_acTVideoIOYuvDepthReconFileList[iViewIdx]->open( m_pchDepthReconFileList[iViewIdx], true, m_uiOutputBitDepth, m_uiInternalBitDepth); // write mode 498 499 // Neo Decoder 500 m_acTEncDepthTopList[iViewIdx]->create(); 501 } 502 #if HHI_INTER_VIEW_MOTION_PRED 503 else if( m_uiMultiviewMvRegMode ) 504 { 505 m_acTVideoIOYuvDepthInputFileList[iViewIdx]->open( m_pchDepthInputFileList[iViewIdx], false, m_uiInputBitDepth, m_uiInternalBitDepth ); // read mode 506 m_acTVideoIOYuvDepthInputFileList[iViewIdx]->skipFrames(m_FrameSkip, m_iSourceWidth, m_iSourceHeight); 507 } 508 #endif 509 } 510 511 #if HHI_VSO 512 for(Int iViewIdx=0; iViewIdx < m_iNumberOfExternalRefs; iViewIdx++) 513 { 514 m_acTVideoIOYuvERFileList[iViewIdx]->open( m_pchERRefFileList[iViewIdx], false, m_uiInputBitDepth, m_uiInternalBitDepth ); // read mode 515 } 516 #endif 678 } 679 #endif 680 } 517 681 } 518 682 519 683 Void TAppEncTop::xDestroyLib() 520 684 { 521 522 m_cTVideoIOBitsFile.closeBits(); 523 524 #if HHI_VSO 525 for ( Int iViewIdx = 0; iViewIdx < m_iNumberOfExternalRefs; iViewIdx++ ) 526 { 527 m_acTVideoIOYuvERFileList[iViewIdx]->close(); 528 delete m_acTVideoIOYuvERFileList[iViewIdx]; 529 m_acTVideoIOYuvERFileList[iViewIdx] = 0; 530 }; 531 #endif 532 685 // Video I/O 533 686 for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) 534 687 { 535 688 m_acTVideoIOYuvInputFileList[iViewIdx]->close(); 536 689 m_acTVideoIOYuvReconFileList[iViewIdx]->close(); 537 538 delete m_acTVideoIOYuvInputFileList[iViewIdx] ; m_acTVideoIOYuvInputFileList[iViewIdx] = NULL; 539 delete m_acTVideoIOYuvReconFileList[iViewIdx] ; m_acTVideoIOYuvReconFileList[iViewIdx] = NULL; 540 541 delete m_cListPicYuvRecList[iViewIdx] ; m_cListPicYuvRecList[iViewIdx] = NULL; 542 690 delete m_acTVideoIOYuvInputFileList[iViewIdx] ; 691 m_acTVideoIOYuvInputFileList[iViewIdx] = NULL; 692 delete m_acTVideoIOYuvReconFileList[iViewIdx] ; 693 m_acTVideoIOYuvReconFileList[iViewIdx] = NULL; 694 m_acTEncTopList[iViewIdx]->deletePicBuffer(); 543 695 m_acTEncTopList[iViewIdx]->destroy(); 544 delete m_acTEncTopList[iViewIdx] ; m_acTEncTopList[iViewIdx] = NULL; 696 delete m_acTEncTopList[iViewIdx] ; 697 m_acTEncTopList[iViewIdx] = NULL; 698 delete m_picYuvRec[iViewIdx] ; 699 m_picYuvRec[iViewIdx] = NULL; 545 700 546 701 if( iViewIdx < Int( m_acTVideoIOYuvDepthInputFileList.size() ) && m_acTVideoIOYuvDepthInputFileList[iViewIdx] ) 547 702 { 548 703 m_acTVideoIOYuvDepthInputFileList[iViewIdx]->close( ); 549 delete m_acTVideoIOYuvDepthInputFileList[iViewIdx] ; 704 delete m_acTVideoIOYuvDepthInputFileList[iViewIdx]; 705 m_acTVideoIOYuvDepthInputFileList[iViewIdx] = NULL; 550 706 } 551 707 if( iViewIdx < Int( m_acTVideoIOYuvDepthReconFileList.size() ) && m_acTVideoIOYuvDepthReconFileList[iViewIdx] ) … … 553 709 m_acTVideoIOYuvDepthReconFileList[iViewIdx]->close () ; 554 710 delete m_acTVideoIOYuvDepthReconFileList[iViewIdx]; 711 m_acTVideoIOYuvDepthReconFileList[iViewIdx] = NULL; 555 712 } 556 713 if( iViewIdx < Int( m_acTEncDepthTopList.size() ) && m_acTEncDepthTopList[iViewIdx] ) 557 714 { 715 m_acTEncDepthTopList[iViewIdx]->deletePicBuffer(); 558 716 m_acTEncDepthTopList[iViewIdx]->destroy(); 559 717 delete m_acTEncDepthTopList[iViewIdx]; 560 } 561 if( iViewIdx < Int( m_cListPicYuvDepthRecList.size() ) && m_cListPicYuvDepthRecList[iViewIdx] ) 562 { 563 delete m_cListPicYuvDepthRecList[iViewIdx ]; 718 m_acTEncDepthTopList[iViewIdx] = NULL; 719 } 720 if( iViewIdx < Int( m_picYuvDepthRec.size() ) && m_picYuvDepthRec[iViewIdx] ) 721 { 722 delete m_picYuvDepthRec[iViewIdx] ; 723 m_picYuvDepthRec[iViewIdx] = NULL; 564 724 } 565 725 } … … 601 761 . 602 762 */ 603 //GT PRE LOAD ENC BUFFER604 763 Void TAppEncTop::encode() 605 764 { 606 TComPicYuv* pcPicYuvOrg = new TComPicYuv; 765 fstream bitstreamFile(m_pchBitstreamFile, fstream::binary | fstream::out); 766 if (!bitstreamFile) 767 { 768 fprintf(stderr, "\nfailed to open bitstream file `%s' for writing\n", m_pchBitstreamFile); 769 exit(EXIT_FAILURE); 770 } 771 772 TComPicYuv* pcPicYuvOrg = new TComPicYuv; 607 773 TComPicYuv* pcDepthPicYuvOrg = new TComPicYuv; 608 774 TComPicYuv* pcPdmDepthOrg = new TComPicYuv; 609 TComPicYuv* pcPicYuvRec 610 //TComPicYuv* pcDepthPicYuvRec = NULL;611 775 TComPicYuv* pcPicYuvRec = NULL; 776 TComPicYuv* pcDepthPicYuvRec = NULL; 777 612 778 // initialize internal class & member variables 613 779 xInitLibCfg(); 614 780 xCreateLib(); 615 781 xInitLib(); 616 782 617 783 // main encoder loop 618 619 //GT: setup and init Bools for Eos and Continue Reading 620 Bool bAllEos = false; 621 Bool bAllContinueReadingPics = false; 622 std::vector<Bool> bEos ; 623 std::vector<Bool> bContinueReadingPics ; 624 625 Bool bAllDepthEos = false; 626 Bool bAllContinueReadingDepthPics = false; 627 std::vector<Bool> bDepthEos ; 628 std::vector<Bool> bContinueReadingDepthPics ; 784 Bool allEos = false; 785 std::vector<Bool> eos ; 786 std::vector<Bool> depthEos ; 787 Int maxGopSize = 0; 788 Int gopSize = 1; 789 790 list<AccessUnit> outputAccessUnits; ///< list of access units to write out. is populated by the encoding process 791 maxGopSize = (std::max)(maxGopSize, m_acTEncTopList[0]->getGOPSize()); 792 629 793 for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++ ) 630 794 { 631 bEos.push_back( false ) ; 632 bContinueReadingPics.push_back( true ); 633 if( m_bUsingDepthMaps) 634 { 635 bDepthEos.push_back( false ) ; 636 bContinueReadingDepthPics.push_back( true ) ; 637 } 638 } 795 eos.push_back( false ); 796 depthEos.push_back( false ); 797 } 798 639 799 // allocate original YUV buffer 640 800 pcPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); 641 if( m_bUsingDepthMaps) 642 { 643 pcDepthPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); 644 } 801 pcDepthPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); 802 645 803 #if HHI_INTER_VIEW_MOTION_PRED 646 804 if( m_uiMultiviewMvRegMode ) … … 650 808 #endif 651 809 652 TComBitstream* pcBitstream = new TComBitstream; 653 pcBitstream->create( (m_iSourceWidth * m_iSourceHeight * 3) >> 1 ) ; //GT: is size reasonable ?? 654 655 while ( !(bAllEos&& bAllContinueReadingPics) ) 656 { 657 bAllContinueReadingPics = false; 658 bAllContinueReadingDepthPics = false; 659 660 //GT: Read all Buffers 661 for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++ ) //GT; store frames first 662 { 663 if (!bEos[iViewIdx] && bContinueReadingPics[iViewIdx] ) //GT: read frames to buffer 810 while ( !allEos ) 811 { 812 for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++ ) 813 { 814 Int frmCnt = 0; 815 while ( !eos[iViewIdx] && !(frmCnt == gopSize)) 664 816 { 665 817 // get buffers 666 xGetBuffer( pcPicYuvRec, iViewIdx, m_cListPicYuvRecList ); // ringbuffer of size gopsize -> m_cListPicYuvRec, m_cListBitstream 818 xGetBuffer(pcPicYuvRec, iViewIdx, false); 819 667 820 // read input YUV file 668 m_acTVideoIOYuvInputFileList[iViewIdx]->read( pcPicYuvOrg, m_aiPad ) ; 669 bEos[iViewIdx] = ( m_acTVideoIOYuvInputFileList[iViewIdx]->isEof() == 1 ? true : false ); //GT: End of File 670 bEos[iViewIdx] = ( m_iFrameRcvdVector[iViewIdx] == (m_iFrameToBeEncoded - 1) ? true : bEos[iViewIdx] ); //GT: FramesToBeEncoded Reached 671 bAllEos = bAllEos|bEos[iViewIdx] ; 672 821 m_acTVideoIOYuvInputFileList[iViewIdx]->read( pcPicYuvOrg, m_aiPad ); 822 673 823 #if HHI_INTER_VIEW_MOTION_PRED 674 824 if( m_uiMultiviewMvRegMode && iViewIdx ) … … 678 828 #endif 679 829 830 #if HHI_INTER_VIEW_MOTION_PRED 831 m_acTEncTopList[iViewIdx]->initNewPic( pcPicYuvOrg, ( m_uiMultiviewMvRegMode && iViewIdx ? pcPdmDepthOrg : 0 ) ); 832 #else 833 m_acTEncTopList[iViewIdx]->initNewPic( pcPicYuvOrg ); 834 #endif 835 680 836 // increase number of received frames 681 m_iFrameRcvdVector[iViewIdx]++ ; 682 } 683 684 #if HHI_INTER_VIEW_MOTION_PRED 685 m_acTEncTopList[iViewIdx]->receivePic( bEos[iViewIdx], pcPicYuvOrg, m_cListPicYuvRecList[iViewIdx]->back(), ( m_uiMultiviewMvRegMode && iViewIdx ? pcPdmDepthOrg : 0 ) ); 686 #else 687 m_acTEncTopList[iViewIdx]->receivePic( bEos[iViewIdx], pcPicYuvOrg, m_cListPicYuvRecList[iViewIdx]->back(), 0 ); 688 #endif 689 837 m_frameRcvd[iViewIdx]++; 838 frmCnt++; 839 // check end of file 840 eos[iViewIdx] = ( m_acTVideoIOYuvInputFileList[iViewIdx]->isEof() == 1 ? true : false ); 841 eos[iViewIdx] = ( m_frameRcvd[iViewIdx] == m_iFrameToBeEncoded ? true : eos[iViewIdx] ); 842 allEos = allEos|eos[iViewIdx] ; 843 } 690 844 if( m_bUsingDepthMaps ) 691 845 { 692 if (!bDepthEos[iViewIdx] && bContinueReadingDepthPics[iViewIdx] ) 846 Int frmCntDepth = 0; 847 while ( !depthEos[iViewIdx] && !(frmCntDepth == gopSize)) 693 848 { 694 849 // get buffers 695 xGetBuffer( pcPicYuvRec, iViewIdx, m_cListPicYuvDepthRecList ); // ringbuffer of size gopsize -> m_cListPicYuvRec, m_cListBitstream 850 xGetBuffer(pcDepthPicYuvRec, iViewIdx, true); 851 696 852 // read input YUV file 697 m_acTVideoIOYuvDepthInputFileList[iViewIdx]->read( pcDepthPicYuvOrg, m_aiPad );698 bDepthEos[iViewIdx] = ( m_acTVideoIOYuvDepthInputFileList[iViewIdx]->isEof() == 1 ? true : false ); 699 bDepthEos[iViewIdx] = ( m_iDepthFrameRcvdVector[iViewIdx] == (m_iFrameToBeEncoded - 1) ? true : bDepthEos[iViewIdx]);700 bAllDepthEos = bAllDepthEos|bDepthEos[iViewIdx] ; 853 m_acTVideoIOYuvDepthInputFileList[iViewIdx]->read( pcDepthPicYuvOrg, m_aiPad ); 854 855 m_acTEncDepthTopList[iViewIdx]->initNewPic( pcDepthPicYuvOrg ); 856 701 857 // increase number of received frames 702 m_iDepthFrameRcvdVector[iViewIdx]++ ; 858 m_depthFrameRcvd[iViewIdx]++; 859 frmCntDepth++; 860 // check end of file 861 depthEos[iViewIdx] = ( m_acTVideoIOYuvDepthInputFileList[iViewIdx]->isEof() == 1 ? true : false ); 862 depthEos[iViewIdx] = ( m_depthFrameRcvd[iViewIdx] == m_iFrameToBeEncoded ? true : depthEos[iViewIdx] ); 863 allEos = allEos|depthEos[iViewIdx] ; 703 864 } 704 m_acTEncDepthTopList[iViewIdx]->receivePic( bDepthEos[iViewIdx], pcDepthPicYuvOrg, m_cListPicYuvDepthRecList[iViewIdx]->back() ); 705 } 706 } 707 708 //===== store current POC ===== 709 Bool bCurrPocCoded = m_acTEncTopList[ 0 ]->currentPocWillBeCoded(); 710 Int iCurrPoc = m_acTEncTopList[ 0 ]->getNextFrameId(); 711 712 //===== update camera parameters ===== 713 if( bCurrPocCoded ) 714 { 715 m_cCameraData.update( (UInt)iCurrPoc ); 716 } 717 718 #if HHI_VSO 719 if ( m_bUseVSO && ( m_uiVSOMode != 4) ) 720 { 721 //GT: Read external reference pics or render references 722 xStoreVSORefPicsInBuffer(); //GT; 723 } 724 #endif 725 726 #if FLEX_CODING_ORDER 727 if (m_b3DVFlexOrder) 728 { 729 Int i=0; 730 Int iViewIdx = 0; 731 bool bThisViewContinueReadingPics = false; 732 bool bThisViewContinueReadingDepthPics = false; 733 Int iNumberofDepthViews = m_bUsingDepthMaps?m_iNumberOfViews:0; 734 for(Int j=0; j < (m_iNumberOfViews+ iNumberofDepthViews); j++ ) // Start encoding 735 { 736 if (m_pchMVCJointCodingOrder[i]=='T') 865 } 866 } 867 for ( Int gopId=0; gopId < gopSize; gopId++ ) 868 { 869 Int iNumEncoded = 0; 870 UInt iNextPoc = m_acTEncTopList[0] -> getFrameId( gopId ); 871 if ( iNextPoc < m_iFrameToBeEncoded ) 872 { 873 m_cCameraData.update( iNextPoc ); 874 } 875 for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++ ) 876 { 877 iNumEncoded = 0; 878 // call encoding function for one frame 879 m_acTEncTopList[iViewIdx]->encode( eos[iViewIdx], pcPicYuvOrg, *m_picYuvRec[iViewIdx], outputAccessUnits, iNumEncoded, gopId ); 880 xWriteOutput(bitstreamFile, iNumEncoded, outputAccessUnits, iViewIdx, false); 881 outputAccessUnits.clear(); 882 if( m_bUsingDepthMaps ) 737 883 { 738 i++; 739 assert(isdigit(m_pchMVCJointCodingOrder[i])); 740 iViewIdx = (Int)(m_pchMVCJointCodingOrder[i]-'0'); 741 bThisViewContinueReadingPics = bContinueReadingPics[iViewIdx]; 742 m_acTEncTopList[iViewIdx]->encode( bEos[iViewIdx], m_cListPicYuvRecMap[iViewIdx], pcBitstream, bThisViewContinueReadingPics ); 743 bContinueReadingPics[iViewIdx]=bThisViewContinueReadingPics; 744 bAllContinueReadingPics = bAllContinueReadingPics||bContinueReadingPics[iViewIdx]; 745 746 if(pcBitstream->getNumberOfWrittenBits()!=0) 747 { 748 m_cTVideoIOBitsFile.writeBits( pcBitstream ); 749 } 750 pcBitstream->resetBits(); //GT: also done later in .... 751 pcBitstream->rewindStreamPacket( ); 752 // write bistream to file if necessary 753 xWriteOutput( iViewIdx ); //GT: Write Reconfiles (when gop is complete?) 754 i++; 884 Int iNumDepthEncoded = 0; 885 // call encoding function for one depth frame 886 m_acTEncDepthTopList[iViewIdx]->encode( depthEos[iViewIdx], pcDepthPicYuvOrg, *m_picYuvDepthRec[iViewIdx], outputAccessUnits, iNumDepthEncoded, gopId ); 887 xWriteOutput(bitstreamFile, iNumDepthEncoded, outputAccessUnits, iViewIdx, true); 888 outputAccessUnits.clear(); 755 889 } 756 else if ( m_pchMVCJointCodingOrder[i] == 'D') 757 { 758 i++; 759 if( m_bUsingDepthMaps ) 760 { 761 assert(isdigit(m_pchMVCJointCodingOrder[i])); 762 iViewIdx = (Int)(m_pchMVCJointCodingOrder[i]-'0'); 763 bThisViewContinueReadingDepthPics = bContinueReadingDepthPics[iViewIdx]; 764 m_acTEncDepthTopList[iViewIdx]->encode( bDepthEos[iViewIdx], m_cListPicYuvDepthRecMap[iViewIdx], pcBitstream, bThisViewContinueReadingDepthPics ); 765 bContinueReadingDepthPics[iViewIdx]=bThisViewContinueReadingDepthPics; 766 767 bAllContinueReadingDepthPics = bAllContinueReadingDepthPics||bContinueReadingDepthPics[iViewIdx]; 768 if(pcBitstream->getNumberOfWrittenBits()!=0) 769 { 770 m_cTVideoIOBitsFile.writeBits( pcBitstream ); 771 } 772 pcBitstream->resetBits(); 773 pcBitstream->rewindStreamPacket( ); 774 // write bistream to file if necessary 775 xWriteOutput( iViewIdx, true ); 776 i++; 777 } 778 } 779 } 780 } 781 else 782 { 783 #endif 784 //GT: Encode 785 for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++ ) // Start encoding 786 { 787 bool bThisViewContinueReadingPics = bContinueReadingPics[iViewIdx]; 788 m_acTEncTopList[iViewIdx]->encode( bEos[iViewIdx], m_cListPicYuvRecMap[iViewIdx], pcBitstream, bThisViewContinueReadingPics ); 789 bContinueReadingPics[iViewIdx]=bThisViewContinueReadingPics; 790 bAllContinueReadingPics = bAllContinueReadingPics||bContinueReadingPics[iViewIdx]; 791 792 if(pcBitstream->getNumberOfWrittenBits()!=0) 793 { 794 m_cTVideoIOBitsFile.writeBits( pcBitstream ); 795 } 796 pcBitstream->resetBits(); //GT: also done later in .... 797 pcBitstream->rewindStreamPacket( ); 798 // write bistream to file if necessary 799 xWriteOutput( iViewIdx ); //GT: Write Reconfiles (when gop is complete?) 800 801 if( m_bUsingDepthMaps ) 802 { 803 bool bThisViewContinueReadingDepthPics = bContinueReadingDepthPics[iViewIdx]; 804 m_acTEncDepthTopList[iViewIdx]->encode( bDepthEos[iViewIdx], m_cListPicYuvDepthRecMap[iViewIdx], pcBitstream, bThisViewContinueReadingDepthPics ); 805 bContinueReadingDepthPics[iViewIdx]=bThisViewContinueReadingDepthPics; 806 807 bAllContinueReadingDepthPics = bAllContinueReadingDepthPics||bContinueReadingDepthPics[iViewIdx]; 808 if(pcBitstream->getNumberOfWrittenBits()!=0) 809 { 810 m_cTVideoIOBitsFile.writeBits( pcBitstream ); 811 } 812 pcBitstream->resetBits(); 813 pcBitstream->rewindStreamPacket( ); 814 // write bistream to file if necessary 815 xWriteOutput( iViewIdx, true ); 816 } 817 } 818 #if FLEX_CODING_ORDER 819 } 820 #endif 821 // delete extra picture buffers 822 if( bCurrPocCoded ) 823 { 890 } 891 #if HHI_INTERVIEW_SKIP || HHI_INTER_VIEW_MOTION_PRED || HHI_INTER_VIEW_RESIDUAL_PRED 824 892 for( Int iViewIdx = 0; iViewIdx < m_iNumberOfViews; iViewIdx++ ) 825 893 { 826 894 if( iViewIdx < (Int)m_acTEncTopList.size() && m_acTEncTopList[iViewIdx] ) 827 895 { 828 m_acTEncTopList[iViewIdx]->deleteExtraPicBuffers( iCurrPoc);896 m_acTEncTopList[iViewIdx]->deleteExtraPicBuffers( m_acTEncTopList[iViewIdx]->getGOPEncoder()->getPocLastCoded() ); 829 897 } 830 898 if( iViewIdx < (Int)m_acTEncDepthTopList.size() && m_acTEncDepthTopList[iViewIdx] ) 831 899 { 832 m_acTEncDepthTopList[iViewIdx]->deleteExtraPicBuffers( iCurrPoc);900 m_acTEncDepthTopList[iViewIdx]->deleteExtraPicBuffers( m_acTEncTopList[iViewIdx]->getGOPEncoder()->getPocLastCoded() ); 833 901 } 834 902 } 835 } 836 837 #if AMVP_BUFFERCOMPRESS 838 // compress motion for entire access 839 if( bCurrPocCoded ) 840 { 841 for( Int iViewIdx = 0; iViewIdx < m_iNumberOfViews; iViewIdx++ ) 842 { 843 if( iViewIdx < (Int)m_acTEncTopList.size() && m_acTEncTopList[iViewIdx] ) 903 #endif 904 for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++ ) 905 { 906 m_acTEncTopList[iViewIdx]->compressMotion( m_acTEncTopList[iViewIdx]->getGOPEncoder()->getPocLastCoded() ); 907 if( m_bUsingDepthMaps ) 844 908 { 845 m_acTEnc TopList[iViewIdx]->compressMotion( iCurrPoc);909 m_acTEncDepthTopList[iViewIdx]->compressMotion( m_acTEncDepthTopList[iViewIdx]->getGOPEncoder()->getPocLastCoded() ); 846 910 } 847 if( iViewIdx < (Int)m_acTEncDepthTopList.size() && m_acTEncDepthTopList[iViewIdx] ) 848 { 849 m_acTEncDepthTopList[iViewIdx]->compressMotion( iCurrPoc ); 850 } 851 } 852 } 853 #endif 854 } 855 856 // write output 857 for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++ ) 858 { 859 m_acTEncTopList[iViewIdx]->printOutSummary(m_acTEncTopList[iViewIdx]->getNumAllPicCoded()); 860 if ( m_bUsingDepthMaps ) 861 { 862 m_acTEncDepthTopList[iViewIdx]->printOutSummary(m_acTEncDepthTopList[iViewIdx]->getNumAllPicCoded()); 863 } 864 } 865 911 } 912 } 913 gopSize = maxGopSize; 914 } 866 915 // delete original YUV buffer 867 916 pcPicYuvOrg->destroy(); 868 917 delete pcPicYuvOrg; 869 918 pcPicYuvOrg = NULL; 870 871 // valgrind 872 if( m_bUsingDepthMaps) 873 { 874 pcDepthPicYuvOrg->destroy(); 875 } 876 delete pcDepthPicYuvOrg ; 877 pcDepthPicYuvOrg = NULL ; 878 879 pcBitstream->destroy(); 880 delete pcBitstream; 881 pcBitstream = NULL ; 882 883 884 // delete used buffers in encoder class 885 for(Int iViewIdx =0; iViewIdx < m_iNumberOfViews; iViewIdx++) 886 { 887 m_acTEncTopList[iViewIdx]->deletePicBuffer() ; 888 } 889 890 if( m_bUsingDepthMaps) 891 { 892 for(Int iViewIdx =0; iViewIdx < m_iNumberOfViews; iViewIdx++) 893 { 894 m_acTEncDepthTopList[iViewIdx]->deletePicBuffer() ; 895 } 896 } 897 898 if ( pcPdmDepthOrg ) 899 { 900 pcPdmDepthOrg->destroy(); 901 delete pcPdmDepthOrg; 902 pcPdmDepthOrg = NULL; 919 pcDepthPicYuvOrg->destroy(); 920 delete pcDepthPicYuvOrg; 921 pcDepthPicYuvOrg = NULL; 922 923 for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++ ) 924 { 925 m_acTEncTopList[iViewIdx]->printOutSummary(m_acTEncTopList[iViewIdx]->getNumAllPicCoded()); 926 if ( m_bUsingDepthMaps ) 927 { 928 m_acTEncDepthTopList[iViewIdx]->printOutSummary(m_acTEncDepthTopList[iViewIdx]->getNumAllPicCoded()); 929 } 903 930 } 904 931 … … 906 933 xDeleteBuffer(); 907 934 xDestroyLib(); 908 } 935 936 return; 937 } 938 939 TEncTop* TAppEncTop::getTEncTop( Int viewId, Bool isDepth ) 940 { 941 if ( isDepth ) 942 { 943 return m_acTEncDepthTopList[viewId]; 944 } 945 else 946 { 947 return m_acTEncTopList[viewId]; 948 } 949 } 950 909 951 910 952 // ==================================================================================================================== … … 918 960 . 919 961 */ 920 Void TAppEncTop::xGetBuffer( TComPicYuv*& rpcPicYuvRec, Int iViewIdx, std::vector< TComList<TComPicYuv*>*>& racBuffer ) 921 { 922 if ( m_uiCodedPictureStoreSize == 0 ) 923 { 924 if (racBuffer[iViewIdx]->size() == 0) 925 { 926 rpcPicYuvRec = new TComPicYuv; 927 rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); 928 929 racBuffer[iViewIdx]->pushBack( rpcPicYuvRec ); 930 } 931 rpcPicYuvRec = racBuffer[iViewIdx]->popFront(); //GT why? only one in list ?? A: only to get rpcPicYuvRec 932 racBuffer[iViewIdx]->pushBack( rpcPicYuvRec ); 933 return; 934 } 935 936 // org. buffer 937 if ( racBuffer[iViewIdx]->size() == (UInt)m_uiCodedPictureStoreSize ) 938 { 939 rpcPicYuvRec = racBuffer[iViewIdx]->popFront(); 962 Void TAppEncTop::xGetBuffer( TComPicYuv*& rpcPicYuvRec, Int iViewIdx, Bool isDepth) 963 { 964 assert( m_iGOPSize > 0 ); 965 966 if( !isDepth ) 967 { 968 if ( m_picYuvRec[iViewIdx]->size() == (UInt)m_iGOPSize ) 969 { 970 rpcPicYuvRec = m_picYuvRec[iViewIdx]->popFront(); 940 971 } 941 972 else 942 973 { 943 rpcPicYuvRec = new TComPicYuv; 974 rpcPicYuvRec = new TComPicYuv; 944 975 rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); 945 976 } 946 racBuffer[iViewIdx]->pushBack( rpcPicYuvRec ); 977 m_picYuvRec[iViewIdx]->pushBack( rpcPicYuvRec ); 978 } 979 else 980 { 981 if ( m_picYuvDepthRec[iViewIdx]->size() == (UInt)m_iGOPSize ) 982 { 983 rpcPicYuvRec = m_picYuvDepthRec[iViewIdx]->popFront(); 984 } 985 else 986 { 987 rpcPicYuvRec = new TComPicYuv; 988 rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); 989 } 990 m_picYuvDepthRec[iViewIdx]->pushBack( rpcPicYuvRec ); 991 } 947 992 } 948 993 949 994 Void TAppEncTop::xDeleteBuffer( ) 950 995 { 951 TComList<TComBitstream*>::iterator iterBitstream = m_cListBitstream.begin(); 952 953 Int iSize = Int( m_cListBitstream.size() ); 954 955 for ( Int i = 0; i < iSize; i++ ) 956 { 957 TComBitstream* pcBitstream = *(iterBitstream++); 958 959 pcBitstream->destroy(); 960 961 delete pcBitstream; pcBitstream = NULL; 962 } 963 964 for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) 965 { 966 TComList<TComPicYuv*>::iterator iterPicYuvRec = m_cListPicYuvRecList[iViewIdx]->begin(); 967 968 iSize = Int( m_cListPicYuvRecList[iViewIdx]->size() ); 969 970 for ( Int i = 0; i < iSize; i++ ) 971 { 996 for(Int iViewIdx=0; iViewIdx<m_picYuvRec.size(); iViewIdx++) 997 { 998 if(m_picYuvRec[iViewIdx]) 999 { 1000 TComList<TComPicYuv*>::iterator iterPicYuvRec = m_picYuvRec[iViewIdx]->begin(); 1001 Int iSize = Int( m_picYuvRec[iViewIdx]->size() ); 1002 for ( Int i = 0; i < iSize; i++ ) 1003 { 972 1004 TComPicYuv* pcPicYuvRec = *(iterPicYuvRec++); 973 pcPicYuvRec->destroy(); 974 delete pcPicYuvRec; pcPicYuvRec = NULL; 975 } 976 } 977 if( m_bUsingDepthMaps) 978 { 979 for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) 980 { 981 TComList<TComPicYuv*>::iterator iterPicYuvRec = m_cListPicYuvDepthRecList[iViewIdx]->begin(); 982 983 iSize = Int( m_cListPicYuvDepthRecList[iViewIdx]->size() ); 984 1005 if(pcPicYuvRec) 1006 { 1007 pcPicYuvRec->destroy(); 1008 delete pcPicYuvRec; 1009 pcPicYuvRec = NULL; 1010 } 1011 } 1012 } 1013 } 1014 for(Int iViewIdx=0; iViewIdx<m_picYuvDepthRec.size(); iViewIdx++) 1015 { 1016 if(m_picYuvDepthRec[iViewIdx]) 1017 { 1018 TComList<TComPicYuv*>::iterator iterPicYuvRec = m_picYuvDepthRec[iViewIdx]->begin(); 1019 Int iSize = Int( m_picYuvDepthRec[iViewIdx]->size() ); 985 1020 for ( Int i = 0; i < iSize; i++ ) 986 1021 { 987 TComPicYuv* pcPicYuvRec = *(iterPicYuvRec++); 1022 TComPicYuv* pcPicYuvRec = *(iterPicYuvRec++); 1023 if(pcPicYuvRec) 1024 { 988 1025 pcPicYuvRec->destroy(); 989 delete pcPicYuvRec; pcPicYuvRec = NULL; 990 } 991 } 992 } 993 994 // Delete ERFiles 995 996 #if HHI_VSO 997 std::map< Int,vector<TComPicYuv*> >::iterator iterMapPicExtRefView = m_cMapPicExtRefView.begin(); 998 while ( iterMapPicExtRefView != m_cMapPicExtRefView.end() ) 999 { 1000 for ( UInt uiViewNumber = 0; uiViewNumber < iterMapPicExtRefView->second.size(); uiViewNumber++ ) 1001 { 1002 if ( iterMapPicExtRefView->second[uiViewNumber] ) 1003 { 1004 iterMapPicExtRefView->second[uiViewNumber]->destroy(); 1005 delete iterMapPicExtRefView->second[uiViewNumber]; 1006 } 1007 } 1008 iterMapPicExtRefView++; 1009 } 1010 #endif 1026 delete pcPicYuvRec; 1027 pcPicYuvRec = NULL; 1028 } 1029 } 1030 } 1031 } 1011 1032 } 1012 1033 1013 1034 /** \param iNumEncoded number of encoded frames 1014 1035 */ 1015 Void TAppEncTop::xWriteOutput( Int iViewIdx, Bool isDepth )1016 { 1017 std::map<PicOrderCnt, TComPicYuv*> &rcMap = ( isDepth ? m_cListPicYuvDepthRecMap : m_cListPicYuvRecMap )[iViewIdx];1018 PicOrderCnt &riNextPocToDump = ( isDepth ? m_aiNextDepthPocToDump : m_aiNextPocToDump )[iViewIdx];1019 TVideoIOYuv* &rpcTVideoIOYuvReconFile = ( isDepth ? m_acTVideoIOYuvDepthReconFileList : m_acTVideoIOYuvReconFileList )[iViewIdx];1020 std::map<PicOrderCnt, TComPicYuv*>::iterator i;1021 1022 while( ! rcMap.empty() && ( i = rcMap.begin() )->first == riNextPocToDump )1023 {1024 riNextPocToDump++;1025 rpcTVideoIOYuvReconFile->write( i->second, m_aiPad );1026 rcMap.erase( i );1027 }1028 } 1029 1030 // GT FIX 1031 std::vector<TComPic*> TAppEncTop::getSpatialRefPics( Int iViewIdx, Int iPoc, Bool bIsDepthCoder)1032 {1033 std::vector<TComPic*> apcRefPics( iViewIdx, (TComPic*)NULL );1034 for( int iRefViewIdx = 0; iRefViewIdx < iViewIdx; iRefViewIdx++ )1035 { 1036 // GT FIX 1037 TComPic* pcRefPic = xGetPicFromView(iRefViewIdx, iPoc, bIsDepthCoder); 1038 1039 assert( pcRefPic != NULL ); 1040 apcRefPics[iRefViewIdx] = pcRefPic;1041 }1042 return apcRefPics;1043 } 1044 1045 1046 TComPic* TAppEncTop::xGetPicFromView( Int iViewIdx, Int iPoc, bool bDepth ) 1047 { 1048 assert( ( iViewIdx >= 0) && ( iViewIdx < m_iNumberOfViews ) ); 1049 1050 TComPic* pcPic = 0; 1051 TComList<TComPic*>* apcListPic;1052 1053 apcListPic = (bDepth ? m_acTEncDepthTopList[iViewIdx] : m_acTEncTopList[iViewIdx])->getListPic() ;1054 1055 for(TComList<TComPic*>::iterator it=apcListPic->begin(); it!=apcListPic->end(); it++)1056 { 1057 if( (*it)->getPOC() == iPoc )1058 {1059 pcPic = *it ;1060 break;1061 }1062 }1063 1064 return pcPic; 1065 }; 1036 Void TAppEncTop::xWriteOutput(std::ostream& bitstreamFile, Int iNumEncoded, std::list<AccessUnit>& accessUnits, Int iViewIdx, Bool isDepth ) 1037 { 1038 Int i; 1039 1040 if( iNumEncoded > 0 ) 1041 { 1042 TComList<TComPicYuv*>::iterator iterPicYuvRec = !isDepth ? m_picYuvRec[iViewIdx]->end() : m_picYuvDepthRec[iViewIdx]->end(); 1043 1044 for ( i = 0; i < iNumEncoded; i++ ) 1045 { 1046 --iterPicYuvRec; 1047 } 1048 1049 for ( i = 0; i < iNumEncoded; i++ ) 1050 { 1051 TComPicYuv* pcPicYuvRec = *(iterPicYuvRec++); 1052 if( !isDepth ) 1053 { 1054 if (m_pchReconFileList[iViewIdx]) 1055 { 1056 #if PIC_CROPPING 1057 m_acTVideoIOYuvReconFileList[iViewIdx]->write( pcPicYuvRec, m_cropLeft, m_cropRight, m_cropTop, m_cropBottom ); 1058 #else 1059 m_acTVideoIOYuvReconFileList[iViewIdx]->write( pcPicYuvRec, m_aiPad ); 1060 #endif 1061 } 1062 } 1063 else 1064 { 1065 if (m_pchDepthReconFileList[iViewIdx]) 1066 { 1067 #if PIC_CROPPING 1068 m_acTVideoIOYuvDepthReconFileList[iViewIdx]->write( pcPicYuvRec, m_cropLeft, m_cropRight, m_cropTop, m_cropBottom ); 1069 #else 1070 m_acTVideoIOYuvDepthReconFileList[iViewIdx]->write( pcPicYuvRec, m_aiPad ); 1071 #endif 1072 } 1073 } 1074 } 1075 } 1076 if( ! accessUnits.empty() ) 1077 { 1078 list<AccessUnit>::iterator aUIter; 1079 for( aUIter = accessUnits.begin(); aUIter != accessUnits.end(); aUIter++ ) 1080 { 1081 const vector<unsigned>& stats = writeAnnexB(bitstreamFile, *aUIter); 1082 rateStatsAccum(*aUIter, stats); 1083 } 1084 } 1085 } 1086 1066 1087 1067 1088 TComPicYuv* TAppEncTop::xGetPicYuvFromView( Int iViewIdx, Int iPoc, Bool bDepth, Bool bRecon ) … … 1088 1109 }; 1089 1110 1090 #if HHI_VSO 1091 Void TAppEncTop::xSetBasePicYuv( Int iViewIdx, Int iPoc, TComMVDRefData* pcRefInfo, InterViewReference eView, bool bDepth ) 1092 { 1093 1094 if ( ( iViewIdx < 0) || ( iViewIdx >= m_iNumberOfViews ) ) 1095 return; 1096 1097 if ( !m_bUsingDepthMaps && bDepth ) 1098 return; 1099 1100 TComPic* pcPic = xGetPicFromView( iViewIdx, iPoc, bDepth); 1101 1102 if (pcPic == 0) 1103 return; 1104 1105 pcRefInfo->setPicYuvBaseView(eView, bDepth, pcPic->getPicYuvOrg(), pcPic->getReconMark() ? pcPic->getPicYuvRec() : NULL ); 1106 1107 }; 1108 1109 Void TAppEncTop::setMVDPic( Int iViewIdx, Int iPoc, TComMVDRefData* pcMVDRefData ) 1110 { 1111 AOF( iViewIdx >= 0); 1112 AOF( iViewIdx < m_iNumberOfViews ); 1113 1114 xSetBasePicYuv(iViewIdx - 1, iPoc, pcMVDRefData, PREVVIEW, false); 1115 xSetBasePicYuv(iViewIdx , iPoc, pcMVDRefData, CURRVIEW, false ); 1116 xSetBasePicYuv(iViewIdx + 1, iPoc, pcMVDRefData, NEXTVIEW, false ); 1117 1118 if ( m_bUsingDepthMaps ) 1119 { 1120 xSetBasePicYuv(iViewIdx - 1, iPoc, pcMVDRefData, PREVVIEW, true ); 1121 xSetBasePicYuv(iViewIdx , iPoc, pcMVDRefData, CURRVIEW, true ); 1122 xSetBasePicYuv(iViewIdx + 1, iPoc, pcMVDRefData, NEXTVIEW, true ); 1123 } 1124 1125 1126 xSetBaseLUT (iViewIdx, iViewIdx-1 , pcMVDRefData, PREVVIEW ); 1127 xSetBaseLUT (iViewIdx, iViewIdx+1 , pcMVDRefData, NEXTVIEW ); 1128 1129 1130 if ( m_bUseVSO && m_uiVSOMode != 4) 1131 { 1132 xSetERPicYuvs (iViewIdx, iPoc, pcMVDRefData); 1133 pcMVDRefData->setShiftLUTsERView(m_cCameraData.getSynthViewShiftLUTD()[iViewIdx], m_cCameraData.getSynthViewShiftLUTI()[iViewIdx] ); 1134 pcMVDRefData->setRefViewInd (m_aaiBaseViewRefInd[iViewIdx], m_aaiERViewRefInd[iViewIdx], m_aaiERViewRefLutInd[iViewIdx]); 1135 } 1136 }; 1137 1138 1139 Void TAppEncTop::xSetBaseLUT( Int iViewIdxSource, Int iViewIdxTarget, TComMVDRefData* pcRefInfo, InterViewReference eView ) 1140 { 1141 if ( ( iViewIdxSource < 0) || ( iViewIdxSource >= m_iNumberOfViews )||( iViewIdxTarget < 0) || ( iViewIdxTarget >= m_iNumberOfViews ) ) 1142 return; 1143 assert( abs( iViewIdxTarget - iViewIdxSource ) <= 1 ); //GT; Not supported yet 1144 pcRefInfo->setShiftLUTsBaseView(eView, m_cCameraData.getBaseViewShiftLUTD()[iViewIdxSource][iViewIdxTarget],m_cCameraData.getBaseViewShiftLUTI()[iViewIdxSource][iViewIdxTarget] ); 1145 }; 1146 1147 Void TAppEncTop::xSetERPicYuvs( Int iViewIdx, Int iPoc, TComMVDRefData* pcReferenceInfo ) 1148 { 1149 std::vector<TComPicYuv*> apcExtRefViews; 1150 1151 std::map< Int, vector<TComPicYuv*> >::iterator cMapIt; 1152 cMapIt = m_cMapPicExtRefView.find(iPoc); 1153 1154 assert( cMapIt != m_cMapPicExtRefView.end() ); 1155 1156 pcReferenceInfo->setPicYuvERViews( cMapIt->second ); 1157 } 1158 1159 Void TAppEncTop::xStoreVSORefPicsInBuffer() 1160 { 1161 // X-Check if all Encoders have received the same number of pics 1162 Int iNumRcvd = m_iFrameRcvdVector[0]; 1163 for ( UInt uiViewNumber = 0; uiViewNumber < m_iNumberOfViews; uiViewNumber ++ ) 1164 { 1165 assert( ( m_iFrameRcvdVector[uiViewNumber] == iNumRcvd ) && ( m_iDepthFrameRcvdVector[uiViewNumber] == iNumRcvd ) ); //GT; if assert here, the encoder instances are not synchronized any more, re-think this function and the ERView Buffer!! 1166 }; 1167 1168 Int iCurPoc = iNumRcvd - 1; 1169 1170 if ( iCurPoc <= m_iLastFramePutInERViewBuffer ) 1171 { 1172 return; 1173 } 1174 1175 std::vector<TComPicYuv*> apcExtRefViewVec; 1176 1177 Int iNumberOfReferenceViews = 0; 1178 if (m_iNumberOfExternalRefs != 0) 1179 { 1180 m_aaiERViewRefLutInd = m_aaiERViewRefInd; 1181 // Insert Rendered Views form File 1182 1183 iNumberOfReferenceViews = m_iNumberOfExternalRefs; 1184 1185 for ( UInt uiViewNumber = 0; uiViewNumber < iNumberOfReferenceViews; uiViewNumber++ ) 1186 { 1187 TComPicYuv* pcPicYuvERView = new TComPicYuv; 1188 pcPicYuvERView->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); 1189 1190 m_acTVideoIOYuvERFileList[uiViewNumber]->read( pcPicYuvERView, m_aiPad ) ; 1191 1192 apcExtRefViewVec.push_back( pcPicYuvERView ); 1193 } 1194 } 1195 else 1196 { //Render Views 1197 1198 for ( UInt uiViewNumber = 0; uiViewNumber < m_iNumberOfViews; uiViewNumber++ ) 1199 { 1200 m_aaiERViewRefInd [uiViewNumber].clear(); 1201 m_aaiERViewRefLutInd[uiViewNumber].clear(); 1202 } 1203 1204 iNumberOfReferenceViews = 0; 1205 for ( UInt iSynthViewIdx = 0; iSynthViewIdx < m_cCameraData.getSynthViewNumbers().size(); iSynthViewIdx++ ) 1206 { 1207 // Get Left and right view 1208 Int iLeftViewIdx = -1; 1209 Int iRightViewIdx = -1; 1210 Bool bIsBaseView; 1211 1212 Int iRelDistToLeft; 1213 m_cCameraData.getLeftRightBaseView( iSynthViewIdx, iLeftViewIdx, iRightViewIdx, iRelDistToLeft, bIsBaseView ); 1214 1215 if ((iLeftViewIdx == -1) || (iRightViewIdx == -1)) 1216 { 1217 std::cerr << "Left or right View not given." << endl; 1218 exit(EXIT_FAILURE); 1219 } 1220 1221 m_cRendererTop.setShiftLUTs( 1222 m_cCameraData.getSynthViewShiftLUTD()[iLeftViewIdx] [iSynthViewIdx], 1223 m_cCameraData.getSynthViewShiftLUTI()[iLeftViewIdx] [iSynthViewIdx], 1224 m_cCameraData.getBaseViewShiftLUTI ()[iLeftViewIdx] [iRightViewIdx], 1225 m_cCameraData.getSynthViewShiftLUTD()[iRightViewIdx][iSynthViewIdx], 1226 m_cCameraData.getSynthViewShiftLUTI()[iRightViewIdx][iSynthViewIdx], 1227 m_cCameraData.getBaseViewShiftLUTI ()[iRightViewIdx][iLeftViewIdx], 1228 iRelDistToLeft 1229 ); 1230 if ( bIsBaseView ) continue; 1231 1232 // Render from left 1233 TComPicYuv* pcPicYuvERView = new TComPicYuv; 1234 pcPicYuvERView->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); 1235 m_cRendererTop.extrapolateView( xGetPicFromView( iLeftViewIdx, iCurPoc, false )->getPicYuvOrg(), xGetPicFromView( iLeftViewIdx, iCurPoc, true )->getPicYuvOrg(), pcPicYuvERView, true ); 1236 1237 apcExtRefViewVec.push_back( pcPicYuvERView ); 1238 1239 m_aaiERViewRefInd [ iLeftViewIdx].push_back( iNumberOfReferenceViews ); 1240 m_aaiERViewRefLutInd[ iLeftViewIdx].push_back( iSynthViewIdx ); 1241 iNumberOfReferenceViews++; 1242 1243 //Render from right 1244 pcPicYuvERView = new TComPicYuv; 1245 pcPicYuvERView->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); 1246 1247 m_cRendererTop.extrapolateView( xGetPicFromView( iRightViewIdx, iCurPoc, false )->getPicYuvOrg(), xGetPicFromView( iRightViewIdx, iCurPoc, true )->getPicYuvOrg(), pcPicYuvERView, false ); 1248 apcExtRefViewVec.push_back( pcPicYuvERView ); 1249 1250 m_aaiERViewRefInd [ iRightViewIdx].push_back( iNumberOfReferenceViews ); 1251 m_aaiERViewRefLutInd[ iRightViewIdx].push_back( iSynthViewIdx ); 1252 iNumberOfReferenceViews++; 1253 } 1254 } 1255 1256 m_iLastFramePutInERViewBuffer++; 1257 m_cMapPicExtRefView.insert( std::make_pair( m_iLastFramePutInERViewBuffer, apcExtRefViewVec ) ); 1258 1259 if ( m_cMapPicExtRefView.size() > (UInt)m_iGOPSize + 1 ) 1260 { 1261 for ( UInt uiViewNumber = 0; uiViewNumber < (UInt) m_cMapPicExtRefView.begin()->second.size(); uiViewNumber++ ) 1262 { 1263 if ( m_cMapPicExtRefView.begin()->second[uiViewNumber] ) 1264 { 1265 m_cMapPicExtRefView.begin()->second[uiViewNumber]->destroy(); 1266 delete m_cMapPicExtRefView.begin()->second[uiViewNumber]; 1267 } 1268 } 1269 m_cMapPicExtRefView.erase ( m_cMapPicExtRefView.begin() ); 1270 } 1271 } 1272 #endif 1111 /** 1112 * 1113 */ 1114 void TAppEncTop::rateStatsAccum(const AccessUnit& au, const std::vector<unsigned>& annexBsizes) 1115 { 1116 AccessUnit::const_iterator it_au = au.begin(); 1117 vector<unsigned>::const_iterator it_stats = annexBsizes.begin(); 1118 1119 for (; it_au != au.end(); it_au++, it_stats++) 1120 { 1121 switch ((*it_au)->m_nalUnitType) 1122 { 1123 case NAL_UNIT_CODED_SLICE: 1124 #if H0566_TLA 1125 case NAL_UNIT_CODED_SLICE_IDV: 1126 case NAL_UNIT_CODED_SLICE_TLA: 1127 case NAL_UNIT_CODED_SLICE_CRA: 1128 #else 1129 case NAL_UNIT_CODED_SLICE_DATAPART_A: 1130 case NAL_UNIT_CODED_SLICE_DATAPART_B: 1131 case NAL_UNIT_CODED_SLICE_CDR: 1132 #endif 1133 case NAL_UNIT_CODED_SLICE_IDR: 1134 case NAL_UNIT_SPS: 1135 case NAL_UNIT_PPS: 1136 m_essentialBytes += *it_stats; 1137 break; 1138 default: 1139 break; 1140 } 1141 1142 m_totalBytes += *it_stats; 1143 } 1144 } 1273 1145 1274 1146 #if HHI_INTERVIEW_SKIP … … 1277 1149 AOT( iViewIdx <= 0); 1278 1150 AOT( iViewIdx >= m_iNumberOfViews ); 1279 AOF( m_uiInterViewSkip != 0 );1280 1151 AOF( m_cCameraData.getCurFrameId() == iPoc ); 1281 1282 1152 Int iViewSIdx = m_cCameraData.getBaseId2SortedId()[iViewIdx]; 1283 1153 Int iFirstViewSIdx = m_cCameraData.getBaseId2SortedId()[0]; … … 1287 1157 Bool bFirstIsLeft = (iFirstViewSIdx < iViewSIdx); 1288 1158 1289 1159 m_cUsedPelsRenderer.setShiftLUTs( 1290 1160 m_cCameraData.getBaseViewShiftLUTD()[0][iViewIdx], 1291 1161 m_cCameraData.getBaseViewShiftLUTI()[0][iViewIdx], … … 1297 1167 ); 1298 1168 1299 1300 1169 TComPicYuv* pcPicYuvDepth = xGetPicYuvFromView(0, iPoc, true, true ); 1301 1170 AOF( pcPicYuvDepth); 1302 1171 1303 1172 m_cUsedPelsRenderer.getUsedSamplesMap( pcPicYuvDepth, pcPicYuvUsedSplsMap, bFirstIsLeft ); 1304 1305 } 1306 #endif 1307 1173 } 1174 #endif 1308 1175 #if HHI_VSO 1309 1176 Void TAppEncTop::setupRenModel( Int iPoc, Int iEncViewIdx, Int iEncContent ) … … 1403 1270 #endif 1404 1271 1272 1273 1274 /* 1275 void TAppEncTop::printRateSummary() 1276 { 1277 double time = (double) m_iFrameRcvd / m_iFrameRate; 1278 printf("Bytes written to file: %u (%.3f kbps)\n", m_totalBytes, 0.008 * m_totalBytes / time); 1279 #if VERBOSE_RATE 1280 printf("Bytes for SPS/PPS/Slice (Incl. Annex B): %u (%.3f kbps)\n", m_essentialBytes, 0.008 * m_essentialBytes / time); 1281 #endif 1282 } 1283 */ 1284 1285 std::vector<TComPic*> TAppEncTop::getInterViewRefPics( Int viewId, Int poc, Bool isDepth, TComSPS* sps ) 1286 { 1287 std::vector<TComPic*> apcRefPics( sps->getNumberOfUsableInterViewRefs(), (TComPic*)NULL ); 1288 for( Int k = 0; k < sps->getNumberOfUsableInterViewRefs(); k++ ) 1289 { 1290 TComPic* pcRefPic = xGetPicFromView( sps->getUsableInterViewRef( k ) + viewId, poc, isDepth ); 1291 assert( pcRefPic != NULL ); 1292 apcRefPics[k] = pcRefPic; 1293 } 1294 return apcRefPics; 1295 } 1296 1297 TComPic* TAppEncTop::xGetPicFromView( Int viewIdx, Int poc, Bool isDepth ) 1298 { 1299 assert( ( viewIdx >= 0 ) && ( viewIdx < m_iNumberOfViews ) ); 1300 1301 TComList<TComPic*>* apcListPic = (isDepth ? m_acTEncDepthTopList[viewIdx] : m_acTEncTopList[viewIdx])->getListPic() ; 1302 1303 TComPic* pcPic = NULL; 1304 for(TComList<TComPic*>::iterator it=apcListPic->begin(); it!=apcListPic->end(); it++) 1305 { 1306 if( (*it)->getPOC() == poc ) 1307 { 1308 pcPic = *it ; 1309 break ; 1310 } 1311 } 1312 1313 return pcPic; 1314 }; 1315 1316 //! \} -
trunk/source/App/TAppEncoder/TAppEncTop.h
r5 r56 2 2 * License, included below. This software may be subject to other third party 3 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-201 1,ISO/IEC6 * Copyright (c) 2010-2012, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 15 15 * this list of conditions and the following disclaimer in the documentation 16 16 * and/or other materials provided with the distribution. 17 * * Neither the name of the I SO/IEC nor the names of its contributors may17 * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 18 * be used to endorse or promote products derived from this software without 19 19 * specific prior written permission. … … 32 32 */ 33 33 34 35 36 34 /** \file TAppEncTop.h 37 35 \brief Encoder application class (header) … … 41 39 #define __TAPPENCTOP__ 42 40 43 #include "../../Lib/TLibEncoder/TEncTop.h" 44 #include "../../Lib/TLibVideoIO/TVideoIOYuv.h" 45 #include "../../Lib/TLibVideoIO/TVideoIOBits.h" 46 #include "../../Lib/TLibCommon/TComBitStream.h" 47 #include "../../Lib/TLibCommon/TComDepthMapGenerator.h" 41 #include <list> 42 #include <ostream> 43 44 #include "TLibEncoder/TEncTop.h" 45 #include "TLibVideoIO/TVideoIOYuv.h" 46 #include "TLibCommon/AccessUnit.h" 48 47 #include "TAppEncCfg.h" 49 //GT VSO 48 #include "TLibCommon/TComDepthMapGenerator.h" 49 #if HHI_VSO || HHI_INTERVIEW_SKIP 50 50 #include "../../Lib/TLibRenderer/TRenTop.h" 51 //GT VSO end 51 #endif 52 53 //! \ingroup TAppEncoder 54 //! \{ 52 55 53 56 // ==================================================================================================================== … … 60 63 private: 61 64 // class interface 65 std::vector<TEncTop*> m_acTEncTopList ; 66 std::vector<TEncTop*> m_acTEncDepthTopList ; 67 std::vector<TVideoIOYuv*> m_acTVideoIOYuvInputFileList; ///< input YUV file 68 std::vector<TVideoIOYuv*> m_acTVideoIOYuvDepthInputFileList; 69 std::vector<TVideoIOYuv*> m_acTVideoIOYuvReconFileList; ///< output reconstruction file 70 std::vector<TVideoIOYuv*> m_acTVideoIOYuvDepthReconFileList; 62 71 63 std::vector<TEncTop*> m_acTEncTopList ; 64 std::vector<TEncTop*> m_acTEncDepthTopList ; 65 std::vector<TVideoIOYuv*> m_acTVideoIOYuvInputFileList; 66 std::vector<TVideoIOYuv*> m_acTVideoIOYuvDepthInputFileList; 67 std::vector<TVideoIOYuv*> m_acTVideoIOYuvReconFileList; 68 std::vector<TVideoIOYuv*> m_acTVideoIOYuvDepthReconFileList; 72 std::vector< TComList<TComPicYuv*>* > m_picYuvRec; ///< list of reconstruction YUV files 73 std::vector< TComList<TComPicYuv*>* > m_picYuvDepthRec; 69 74 70 TVideoIOBitsStartCode m_cTVideoIOBitsFile; ///< output bitstream file 71 72 std::vector< TComList<TComPicYuv*>* > m_cListPicYuvRecList; ///< list of reconstruction YUV files 73 std::vector< TComList<TComPicYuv*>* > m_cListPicYuvDepthRecList; ///< list of reconstruction YUV files 74 std::vector<PicOrderCnt> m_aiNextPocToDump; 75 std::vector<PicOrderCnt> m_aiNextDepthPocToDump; 76 std::vector< std::map<PicOrderCnt, TComPicYuv*> > m_cListPicYuvRecMap; 77 std::vector< std::map<PicOrderCnt, TComPicYuv*> > m_cListPicYuvDepthRecMap; 75 std::vector<Int> m_frameRcvd; ///< number of received frames 76 std::vector<Int> m_depthFrameRcvd; 78 77 79 TComList<TComBitstream*> m_cListBitstream; ///< list of bitstreams 80 81 std::vector<Int> m_iFrameRcvdVector; ///< number of received frames 82 std::vector<Int> m_iDepthFrameRcvdVector; ///< number of received frames 78 unsigned m_essentialBytes; 79 unsigned m_totalBytes; 83 80 84 81 #if DEPTH_MAP_GENERATION … … 86 83 TComAUPicAccess m_cAUPicAccess; 87 84 #endif 88 85 89 86 #if HHI_VSO 90 87 TRenTop m_cRendererTop; … … 92 89 #endif 93 90 91 #if HHI_INTERVIEW_SKIP 92 TRenTop m_cUsedPelsRenderer; ///< renderer for used pels map 93 #endif 94 94 protected: 95 95 // initialization … … 100 100 101 101 /// obtain required buffers 102 Void xGetBuffer ( TComPicYuv*& rpcPicYuvRec, //GT: unused? 103 TComBitstream*& rpcBitStream ); 102 Void xGetBuffer(TComPicYuv*& rpcPicYuvRec, Int iViewIdx, Bool isDepth); 104 103 105 Void xGetBuffer ( TComPicYuv*& rpcPicYuvRec, Int iViewIdx, std::vector< TComList<TComPicYuv*>*>& racBuffer );106 107 104 /// delete allocated buffers 108 105 Void xDeleteBuffer (); 109 106 110 107 // file I/O 111 Void xWriteOutput ( Int iViewIdx, Bool isDepth = false );///< write bitstream to file112 113 114 // util115 TComPic* xGetPicFromView ( Int iViewIdx, Int iPoc, Bool bDepth );108 Void xWriteOutput(std::ostream& bitstreamFile, Int iNumEncoded, std::list<AccessUnit>& accessUnits, Int iViewIdx, Bool isDepth); ///< write bitstream to file 109 void rateStatsAccum(const AccessUnit& au, const std::vector<unsigned>& stats); 110 // void printRateSummary(); 111 112 TComPic* xGetPicFromView( Int viewId, Int iPoc, Bool isDepth ); 116 113 TComPicYuv* xGetPicYuvFromView( Int iViewIdx, Int iPoc, Bool bDepth, Bool bRecon ); 117 118 119 // Ref Data120 #if HHI_VSO121 Void xSetBaseLUT ( Int iViewIdxSource, Int iViewIdxTarget, TComMVDRefData* pcRefInfo, InterViewReference eView );122 Void xSetBasePicYuv( Int iViewIdx, Int iPoc, TComMVDRefData* pcRefInfo, InterViewReference eView, bool bDepth ); ///< store pics from buffers in pcRefInfo123 #endif124 114 125 115 public: … … 128 118 129 119 Void encode (); ///< main encoding function 120 TEncTop* getTEncTop( Int viewId, Bool isDepth ); 121 122 std::vector<TComPic*> getInterViewRefPics( Int viewId, Int poc, Bool isDepth, TComSPS* sps ); 123 TComPic* getPicFromView ( Int viewId, Int poc, Bool isDepth ) { return xGetPicFromView( viewId, poc, isDepth ); } 124 TComPicYuv* getPicYuvFromView ( Int iViewIdx, Int iPoc, bool bDepth, Bool bRecon ) { return xGetPicYuvFromView( iViewIdx, iPoc, bDepth, bRecon ); } 125 126 #if HHI_INTERVIEW_SKIP 127 Void getUsedPelsMap ( Int iViewIdx, Int iPoc, TComPicYuv* pcPicYuvUsedPelsMap ); 128 #endif 130 129 #if HHI_VSO 131 130 Void setupRenModel ( Int iPoc, Int iEncViewIdx, Int iEncContent ); 132 Void setMVDPic ( Int iViewIdx, Int iPoc, TComMVDRefData* pcReferenceInfo ); // set MultiView References133 131 #endif 134 Void getUsedPelsMap ( Int iViewIdx, Int iPoc, TComPicYuv* pcPicYuvUsedPelsMap ); 135 std::vector<TComPic*> getSpatialRefPics( Int iViewIdx, Int iPoc, Bool bIsDepthCoder ); // only for mvc functionality yet 136 TComPic* getPicFromView ( Int iViewIdx, Int iPoc, Bool bDepth ) { return xGetPicFromView( iViewIdx, iPoc, bDepth ); } 137 138 #if HHI_VSO 139 TRenModel* getRenModel () { return &m_cRendererModel ; }; 140 #endif 141 132 142 133 #if DEPTH_MAP_GENERATION 143 134 TComSPSAccess* getSPSAccess () { return &m_cSPSAccess; } … … 146 137 147 138 #if HHI_VSO 139 TRenModel* getRenModel () { return &m_cRendererModel ; }; 140 #endif 141 142 #if HHI_VSO 148 143 private: 149 std::vector<TVideoIOYuv*> m_acTVideoIOYuvERFileList;150 std::map< Int, std::vector< TComPicYuv*> > m_cMapPicExtRefView; /// Buffer for external Reference files151 152 Int m_iLastFramePutInERViewBuffer; ///< Poc of last frame put to ERView Buffer153 Void xSetERPicYuvs( Int iViewIdx, Int iPoc, TComMVDRefData* pcReferenceInfo ); ///< store pic from buffer in pcReferenceInfo154 144 Void xStoreVSORefPicsInBuffer(); ///< read in External Ref pic from file and store in buffer 155 145 #endif 156 146 157 147 };// END CLASS DEFINITION TAppEncTop 148 149 //! \} 158 150 159 151 #endif // __TAPPENCTOP__ -
trunk/source/App/TAppEncoder/encmain.cpp
r8 r56 2 2 * License, included below. This software may be subject to other third party 3 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-201 1,ISO/IEC6 * Copyright (c) 2010-2012, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 15 15 * this list of conditions and the following disclaimer in the documentation 16 16 * and/or other materials provided with the distribution. 17 * * Neither the name of the I SO/IEC nor the names of its contributors may17 * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 18 * be used to endorse or promote products derived from this software without 19 19 * specific prior written permission. … … 32 32 */ 33 33 34 35 36 34 /** \file encmain.cpp 37 35 \brief Encoder application main … … 40 38 #include <time.h> 41 39 #include "TAppEncTop.h" 40 41 //! \ingroup TAppEncoder 42 //! \{ 42 43 43 44 // ==================================================================================================================== … … 51 52 // print information 52 53 fprintf( stdout, "\n" ); 53 fprintf( stdout, " HM %s based Multiview Video plus Depth Coder: Encoder Version [%s]", HM_VERSION, NV_VERSION );54 fprintf( stdout, "3D-HTM Software: Encoder Version [%s] based on HM Version [%s]", NV_VERSION, HM_VERSION ); 54 55 fprintf( stdout, NVM_ONOS ); 55 56 fprintf( stdout, NVM_COMPILEDBY ); … … 84 85 } 85 86 86 87 //! \}
Note: See TracChangeset for help on using the changeset viewer.