[5] | 1 | /* The copyright in this software is being made available under the BSD |
---|
| 2 | * License, included below. This software may be subject to other third party |
---|
| 3 | * and contributor rights, including patent rights, and no such rights are |
---|
[56] | 4 | * granted under this license. |
---|
[5] | 5 | * |
---|
[56] | 6 | * Copyright (c) 2010-2012, ITU/ISO/IEC |
---|
[5] | 7 | * All rights reserved. |
---|
| 8 | * |
---|
| 9 | * Redistribution and use in source and binary forms, with or without |
---|
| 10 | * modification, are permitted provided that the following conditions are met: |
---|
| 11 | * |
---|
| 12 | * * Redistributions of source code must retain the above copyright notice, |
---|
| 13 | * this list of conditions and the following disclaimer. |
---|
| 14 | * * Redistributions in binary form must reproduce the above copyright notice, |
---|
| 15 | * this list of conditions and the following disclaimer in the documentation |
---|
| 16 | * and/or other materials provided with the distribution. |
---|
[56] | 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may |
---|
[5] | 18 | * be used to endorse or promote products derived from this software without |
---|
| 19 | * specific prior written permission. |
---|
| 20 | * |
---|
| 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
| 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
| 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
| 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS |
---|
| 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
| 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
| 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
| 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
| 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
| 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
---|
| 31 | * THE POSSIBILITY OF SUCH DAMAGE. |
---|
| 32 | */ |
---|
[2] | 33 | |
---|
| 34 | /** \file TAppEncTop.cpp |
---|
| 35 | \brief Encoder application class |
---|
| 36 | */ |
---|
| 37 | |
---|
| 38 | #include <list> |
---|
[56] | 39 | #include <fstream> |
---|
| 40 | #include <stdlib.h> |
---|
[2] | 41 | #include <stdio.h> |
---|
| 42 | #include <fcntl.h> |
---|
| 43 | #include <assert.h> |
---|
| 44 | |
---|
| 45 | #include "TAppEncTop.h" |
---|
[56] | 46 | #include "TLibEncoder/AnnexBwrite.h" |
---|
[2] | 47 | |
---|
[56] | 48 | using namespace std; |
---|
| 49 | |
---|
| 50 | //! \ingroup TAppEncoder |
---|
| 51 | //! \{ |
---|
| 52 | |
---|
[2] | 53 | // ==================================================================================================================== |
---|
| 54 | // Constructor / destructor / initialization / destroy |
---|
| 55 | // ==================================================================================================================== |
---|
| 56 | |
---|
| 57 | TAppEncTop::TAppEncTop() |
---|
| 58 | { |
---|
[56] | 59 | m_totalBytes = 0; |
---|
| 60 | m_essentialBytes = 0; |
---|
[2] | 61 | } |
---|
| 62 | |
---|
| 63 | TAppEncTop::~TAppEncTop() |
---|
| 64 | { |
---|
| 65 | } |
---|
| 66 | |
---|
| 67 | Void TAppEncTop::xInitLibCfg() |
---|
| 68 | { |
---|
[210] | 69 | #if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046 |
---|
| 70 | #if !QC_MVHEVC_B0046 |
---|
[77] | 71 | UInt layerId = 0; |
---|
[210] | 72 | #endif |
---|
[77] | 73 | // TODO: fix the assumption here that the temporal structures are all equal across all layers??? |
---|
| 74 | m_cVPS.setMaxTLayers( m_maxTempLayer[0] ); |
---|
[210] | 75 | #if QC_MVHEVC_B0046 |
---|
| 76 | m_cVPS.setMaxLayers( m_iNumberOfViews ); |
---|
| 77 | #else |
---|
[77] | 78 | m_cVPS.setMaxLayers( m_iNumberOfViews * (m_bUsingDepthMaps ? 2:1) ); |
---|
[210] | 79 | #endif |
---|
[77] | 80 | for(Int i = 0; i < MAX_TLAYER; i++) |
---|
| 81 | { |
---|
| 82 | m_cVPS.setNumReorderPics( m_numReorderPics[0][i], i ); |
---|
| 83 | m_cVPS.setMaxDecPicBuffering( m_maxDecPicBuffering[0][i], i ); |
---|
| 84 | } |
---|
| 85 | #endif |
---|
| 86 | |
---|
[2] | 87 | for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) |
---|
| 88 | { |
---|
[56] | 89 | m_frameRcvd.push_back(0); |
---|
| 90 | m_acTEncTopList.push_back(new TEncTop); |
---|
[2] | 91 | m_acTVideoIOYuvInputFileList.push_back(new TVideoIOYuv); |
---|
[56] | 92 | m_acTVideoIOYuvReconFileList.push_back(new TVideoIOYuv); |
---|
| 93 | m_picYuvRec.push_back(new TComList<TComPicYuv*>) ; |
---|
[2] | 94 | |
---|
| 95 | m_acTEncTopList[iViewIdx]->setFrameRate ( m_iFrameRate ); |
---|
| 96 | m_acTEncTopList[iViewIdx]->setFrameSkip ( m_FrameSkip ); |
---|
| 97 | m_acTEncTopList[iViewIdx]->setSourceWidth ( m_iSourceWidth ); |
---|
| 98 | m_acTEncTopList[iViewIdx]->setSourceHeight ( m_iSourceHeight ); |
---|
[56] | 99 | #if PIC_CROPPING |
---|
| 100 | m_acTEncTopList[iViewIdx]->setCroppingMode ( m_croppingMode ); |
---|
| 101 | m_acTEncTopList[iViewIdx]->setCropLeft ( m_cropLeft ); |
---|
| 102 | m_acTEncTopList[iViewIdx]->setCropRight ( m_cropRight ); |
---|
| 103 | m_acTEncTopList[iViewIdx]->setCropTop ( m_cropTop ); |
---|
| 104 | m_acTEncTopList[iViewIdx]->setCropBottom ( m_cropBottom ); |
---|
| 105 | #endif |
---|
[2] | 106 | m_acTEncTopList[iViewIdx]->setFrameToBeEncoded ( m_iFrameToBeEncoded ); |
---|
[56] | 107 | m_acTEncTopList[iViewIdx]->setViewId ( iViewIdx ); |
---|
| 108 | m_acTEncTopList[iViewIdx]->setIsDepth ( false ); |
---|
[210] | 109 | #if QC_MVHEVC_B0046 |
---|
| 110 | m_acTEncTopList[iViewIdx]->setLayerId ( iViewIdx ); |
---|
| 111 | m_cVPS.setViewId ( m_aiVId[ iViewIdx ], iViewIdx ); |
---|
| 112 | #else |
---|
[56] | 113 | m_acTEncTopList[iViewIdx]->setViewOrderIdx ( m_cCameraData.getViewOrderIndex()[ iViewIdx ] ); |
---|
[77] | 114 | #if VIDYO_VPS_INTEGRATION |
---|
| 115 | layerId = iViewIdx * (m_bUsingDepthMaps ? 2:1); |
---|
| 116 | m_acTEncTopList[iViewIdx]->setLayerId ( layerId ); |
---|
| 117 | m_cVPS.setDepthFlag ( false, layerId ); |
---|
| 118 | m_cVPS.setViewId ( iViewIdx, layerId ); |
---|
| 119 | m_cVPS.setViewOrderIdx ( m_cCameraData.getViewOrderIndex()[ iViewIdx ], layerId ); |
---|
| 120 | // TODO: set correct dependentFlag and dependentLayer |
---|
| 121 | m_cVPS.setDependentFlag ( iViewIdx ? true:false, layerId ); |
---|
| 122 | m_cVPS.setDependentLayer ( layerId - (m_bUsingDepthMaps ? 2:1), layerId ); |
---|
| 123 | #endif |
---|
| 124 | |
---|
[56] | 125 | m_acTEncTopList[iViewIdx]->setCamParPrecision ( m_cCameraData.getCamParsCodedPrecision () ); |
---|
| 126 | m_acTEncTopList[iViewIdx]->setCamParInSliceHeader ( m_cCameraData.getVaryingCameraParameters() ); |
---|
| 127 | m_acTEncTopList[iViewIdx]->setCodedScale ( m_cCameraData.getCodedScale () ); |
---|
| 128 | m_acTEncTopList[iViewIdx]->setCodedOffset ( m_cCameraData.getCodedOffset () ); |
---|
[210] | 129 | #endif |
---|
[2] | 130 | |
---|
| 131 | //====== Coding Structure ======== |
---|
[56] | 132 | m_acTEncTopList[iViewIdx]->setIntraPeriod ( m_iIntraPeriod ); |
---|
[2] | 133 | m_acTEncTopList[iViewIdx]->setDecodingRefreshType ( m_iDecodingRefreshType ); |
---|
[56] | 134 | m_acTEncTopList[iViewIdx]->setGOPSize ( m_iGOPSize ); |
---|
| 135 | m_acTEncTopList[iViewIdx]->setGopList ( m_GOPListsMvc[iViewIdx] ); |
---|
| 136 | m_acTEncTopList[iViewIdx]->setExtraRPSs ( m_extraRPSs[iViewIdx] ); |
---|
| 137 | #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER |
---|
| 138 | for(Int i = 0; i < MAX_TLAYER; i++) |
---|
| 139 | { |
---|
| 140 | m_acTEncTopList[iViewIdx]->setNumReorderPics ( m_numReorderPics[iViewIdx][i], i ); |
---|
| 141 | m_acTEncTopList[iViewIdx]->setMaxDecPicBuffering ( m_maxDecPicBuffering[iViewIdx][i], i ); |
---|
| 142 | } |
---|
| 143 | #else |
---|
| 144 | m_acTEncTopList[iViewIdx]->setNumReorderFrames ( m_numReorderFrames ); |
---|
| 145 | m_acTEncTopList[iViewIdx]->setMaxNumberOfReferencePictures ( m_maxNumberOfReferencePictures ); |
---|
[2] | 146 | #endif |
---|
[56] | 147 | for( UInt uiLoop = 0; uiLoop < MAX_TLAYER; ++uiLoop ) |
---|
| 148 | { |
---|
| 149 | m_acTEncTopList[iViewIdx]->setLambdaModifier( uiLoop, m_adLambdaModifier[ uiLoop ] ); |
---|
| 150 | } |
---|
[2] | 151 | m_acTEncTopList[iViewIdx]->setQP ( m_aiQP[0] ); |
---|
[56] | 152 | |
---|
[2] | 153 | m_acTEncTopList[iViewIdx]->setTemporalLayerQPOffset ( m_aiTLayerQPOffset ); |
---|
| 154 | m_acTEncTopList[iViewIdx]->setPad ( m_aiPad ); |
---|
[56] | 155 | |
---|
| 156 | #if H0566_TLA |
---|
| 157 | m_acTEncTopList[iViewIdx]->setMaxTempLayer ( m_maxTempLayer[iViewIdx] ); |
---|
| 158 | #else |
---|
| 159 | m_acTEncTopList[iViewIdx]->setTLayering ( m_bTLayering ); |
---|
| 160 | m_acTEncTopList[iViewIdx]->setTLayerSwitchingFlag ( m_abTLayerSwitchingFlag ); |
---|
| 161 | #endif |
---|
[2] | 162 | |
---|
[56] | 163 | m_acTEncTopList[iViewIdx]->setDisInter4x4 ( m_bDisInter4x4); |
---|
| 164 | |
---|
| 165 | m_acTEncTopList[iViewIdx]->setUseNSQT( m_enableNSQT ); |
---|
| 166 | m_acTEncTopList[iViewIdx]->setUseAMP( m_enableAMP ); |
---|
| 167 | |
---|
| 168 | //===== Slice ======== |
---|
| 169 | |
---|
| 170 | //====== Loop/Deblock Filter ======== |
---|
| 171 | m_acTEncTopList[iViewIdx]->setLoopFilterDisable ( m_abLoopFilterDisable[0] ); |
---|
| 172 | m_acTEncTopList[iViewIdx]->setLoopFilterOffsetInAPS ( m_loopFilterOffsetInAPS ); |
---|
| 173 | m_acTEncTopList[iViewIdx]->setLoopFilterBetaOffset ( m_loopFilterBetaOffsetDiv2 ); |
---|
| 174 | m_acTEncTopList[iViewIdx]->setLoopFilterTcOffset ( m_loopFilterTcOffsetDiv2 ); |
---|
| 175 | #if DBL_CONTROL |
---|
| 176 | m_acTEncTopList[iViewIdx]->setDeblockingFilterControlPresent( m_DeblockingFilterControlPresent); |
---|
| 177 | #endif |
---|
[2] | 178 | |
---|
[56] | 179 | //====== Motion search ======== |
---|
[2] | 180 | m_acTEncTopList[iViewIdx]->setFastSearch ( m_iFastSearch ); |
---|
| 181 | m_acTEncTopList[iViewIdx]->setSearchRange ( m_iSearchRange ); |
---|
| 182 | m_acTEncTopList[iViewIdx]->setBipredSearchRange ( m_bipredSearchRange ); |
---|
[210] | 183 | #if DV_V_RESTRICTION_B0037 |
---|
| 184 | m_acTEncTopList[iViewIdx]->setUseDisparitySearchRangeRestriction ( m_bUseDisparitySearchRangeRestriction ); |
---|
| 185 | m_acTEncTopList[iViewIdx]->setVerticalDisparitySearchRange( m_iVerticalDisparitySearchRange ); |
---|
| 186 | #endif |
---|
[56] | 187 | //====== Quality control ======== |
---|
[2] | 188 | m_acTEncTopList[iViewIdx]->setMaxDeltaQP ( m_iMaxDeltaQP ); |
---|
[56] | 189 | m_acTEncTopList[iViewIdx]->setMaxCuDQPDepth ( m_iMaxCuDQPDepth ); |
---|
[2] | 190 | |
---|
[56] | 191 | m_acTEncTopList[iViewIdx]->setChromaQpOffset ( m_iChromaQpOffset ); |
---|
| 192 | m_acTEncTopList[iViewIdx]->setChromaQpOffset2nd ( m_iChromaQpOffset2nd ); |
---|
| 193 | |
---|
| 194 | #if ADAPTIVE_QP_SELECTION |
---|
| 195 | m_acTEncTopList[iViewIdx]->setUseAdaptQpSelect ( m_bUseAdaptQpSelect ); |
---|
| 196 | #endif |
---|
| 197 | |
---|
| 198 | #if LOSSLESS_CODING |
---|
| 199 | Int lowestQP; |
---|
| 200 | #if H0736_AVC_STYLE_QP_RANGE |
---|
| 201 | lowestQP = - ( (Int)(6*(g_uiBitDepth + g_uiBitIncrement - 8)) ); |
---|
| 202 | #else |
---|
| 203 | lowestQP = 0; |
---|
| 204 | #endif |
---|
| 205 | if ((m_iMaxDeltaQP == 0 ) && (m_aiQP[0] == lowestQP) && (m_useLossless == true)) |
---|
| 206 | { |
---|
| 207 | m_bUseAdaptiveQP = false; |
---|
| 208 | } |
---|
| 209 | #endif |
---|
| 210 | |
---|
| 211 | m_acTEncTopList[iViewIdx]->setUseAdaptiveQP ( m_bUseAdaptiveQP ); |
---|
| 212 | m_acTEncTopList[iViewIdx]->setQPAdaptationRange ( m_iQPAdaptationRange ); |
---|
| 213 | |
---|
[5] | 214 | #if HHI_VSO |
---|
[2] | 215 | //====== VSO ========= |
---|
| 216 | m_acTEncTopList[iViewIdx]->setForceLambdaScaleVSO ( false ); |
---|
| 217 | m_acTEncTopList[iViewIdx]->setLambdaScaleVSO ( 1 ); |
---|
| 218 | m_acTEncTopList[iViewIdx]->setVSOMode ( 0 ); |
---|
[100] | 219 | m_acTEncTopList[iViewIdx]->setUseVSO ( false ); |
---|
| 220 | #if SAIT_VSO_EST_A0033 |
---|
| 221 | m_acTEncTopList[iViewIdx]->setUseEstimatedVSD ( false ); |
---|
[5] | 222 | #endif |
---|
[115] | 223 | #if LGE_WVSO_A0119 |
---|
[120] | 224 | m_acTEncTopList[iViewIdx]->setUseWVSO ( false ); |
---|
[100] | 225 | #endif |
---|
[115] | 226 | #endif |
---|
[2] | 227 | |
---|
[56] | 228 | #if DEPTH_MAP_GENERATION |
---|
| 229 | m_acTEncTopList[iViewIdx]->setPredDepthMapGeneration ( m_uiPredDepthMapGeneration ); |
---|
| 230 | m_acTEncTopList[iViewIdx]->setPdmPrecision ( (UInt)m_cCameraData.getPdmPrecision () ); |
---|
| 231 | m_acTEncTopList[iViewIdx]->setPdmScaleNomDelta ( m_cCameraData.getPdmScaleNomDelta () ); |
---|
| 232 | m_acTEncTopList[iViewIdx]->setPdmOffset ( m_cCameraData.getPdmOffset () ); |
---|
| 233 | #endif |
---|
| 234 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
| 235 | m_acTEncTopList[iViewIdx]->setMultiviewMvPredMode ( m_uiMultiviewMvPredMode ); |
---|
| 236 | m_acTEncTopList[iViewIdx]->setMultiviewMvRegMode ( iViewIdx ? m_uiMultiviewMvRegMode : 0 ); |
---|
| 237 | m_acTEncTopList[iViewIdx]->setMultiviewMvRegLambdaScale ( iViewIdx ? m_dMultiviewMvRegLambdaScale : 0.0 ); |
---|
| 238 | #endif |
---|
| 239 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
| 240 | m_acTEncTopList[iViewIdx]->setMultiviewResPredMode ( m_uiMultiviewResPredMode ); |
---|
| 241 | #endif |
---|
| 242 | |
---|
| 243 | //====== Tool list ======== |
---|
[2] | 244 | m_acTEncTopList[iViewIdx]->setUseSBACRD ( m_bUseSBACRD ); |
---|
| 245 | m_acTEncTopList[iViewIdx]->setDeltaQpRD ( m_uiDeltaQpRD ); |
---|
| 246 | m_acTEncTopList[iViewIdx]->setUseASR ( m_bUseASR ); |
---|
| 247 | m_acTEncTopList[iViewIdx]->setUseHADME ( m_bUseHADME ); |
---|
| 248 | m_acTEncTopList[iViewIdx]->setUseALF ( m_abUseALF[0] ); |
---|
| 249 | m_acTEncTopList[iViewIdx]->setALFEncodePassReduction ( m_iALFEncodePassReduction ); |
---|
[56] | 250 | #if LOSSLESS_CODING |
---|
| 251 | m_acTEncTopList[iViewIdx]->setUseLossless ( m_useLossless ); |
---|
[2] | 252 | #endif |
---|
[56] | 253 | m_acTEncTopList[iViewIdx]->setALFMaxNumberFilters ( m_iALFMaxNumberFilters ) ; |
---|
| 254 | |
---|
[2] | 255 | m_acTEncTopList[iViewIdx]->setUseLComb ( m_bUseLComb ); |
---|
| 256 | m_acTEncTopList[iViewIdx]->setLCMod ( m_bLCMod ); |
---|
| 257 | m_acTEncTopList[iViewIdx]->setdQPs ( m_aidQP ); |
---|
| 258 | m_acTEncTopList[iViewIdx]->setUseRDOQ ( m_abUseRDOQ[0] ); |
---|
[56] | 259 | #if !PIC_CROPPING |
---|
[2] | 260 | m_acTEncTopList[iViewIdx]->setUsePAD ( m_bUsePAD ); |
---|
[56] | 261 | #endif |
---|
[2] | 262 | m_acTEncTopList[iViewIdx]->setQuadtreeTULog2MaxSize ( m_uiQuadtreeTULog2MaxSize ); |
---|
| 263 | m_acTEncTopList[iViewIdx]->setQuadtreeTULog2MinSize ( m_uiQuadtreeTULog2MinSize ); |
---|
| 264 | m_acTEncTopList[iViewIdx]->setQuadtreeTUMaxDepthInter ( m_uiQuadtreeTUMaxDepthInter ); |
---|
| 265 | m_acTEncTopList[iViewIdx]->setQuadtreeTUMaxDepthIntra ( m_uiQuadtreeTUMaxDepthIntra ); |
---|
| 266 | m_acTEncTopList[iViewIdx]->setUseFastEnc ( m_bUseFastEnc ); |
---|
[56] | 267 | m_acTEncTopList[iViewIdx]->setUseEarlyCU ( m_bUseEarlyCU ); |
---|
| 268 | #if FAST_DECISION_FOR_MRG_RD_COST |
---|
| 269 | m_acTEncTopList[iViewIdx]->setUseFastDecisionForMerge ( m_useFastDecisionForMerge ); |
---|
[5] | 270 | #endif |
---|
[56] | 271 | m_acTEncTopList[iViewIdx]->setUseCbfFastMode ( m_bUseCbfFastMode ); |
---|
| 272 | #if HHI_INTERVIEW_SKIP |
---|
| 273 | m_acTEncTopList[iViewIdx]->setInterViewSkip ( iViewIdx>0 ? m_bInterViewSkip : false ); |
---|
| 274 | #if HHI_INTERVIEW_SKIP_LAMBDA_SCALE |
---|
| 275 | m_acTEncTopList[iViewIdx]->setInterViewSkipLambdaScale ( iViewIdx>0 ? (UInt)m_dInterViewSkipLambdaScale : 1 ); |
---|
[42] | 276 | #endif |
---|
[5] | 277 | #endif |
---|
[56] | 278 | m_acTEncTopList[iViewIdx]->setUseLMChroma ( m_bUseLMChroma ); |
---|
| 279 | m_acTEncTopList[iViewIdx]->setUseConstrainedIntraPred ( m_bUseConstrainedIntraPred ); |
---|
| 280 | m_acTEncTopList[iViewIdx]->setPCMLog2MinSize ( m_uiPCMLog2MinSize); |
---|
| 281 | m_acTEncTopList[iViewIdx]->setUsePCM ( m_usePCM ); |
---|
| 282 | m_acTEncTopList[iViewIdx]->setPCMLog2MaxSize ( m_pcmLog2MaxSize); |
---|
[2] | 283 | |
---|
[56] | 284 | //====== Weighted Prediction ======== |
---|
| 285 | m_acTEncTopList[iViewIdx]->setUseWP ( m_bUseWeightPred ); |
---|
| 286 | m_acTEncTopList[iViewIdx]->setWPBiPredIdc ( m_uiBiPredIdc ); |
---|
| 287 | //====== Slice ======== |
---|
| 288 | m_acTEncTopList[iViewIdx]->setSliceMode ( m_iSliceMode ); |
---|
| 289 | m_acTEncTopList[iViewIdx]->setSliceArgument ( m_iSliceArgument ); |
---|
[5] | 290 | |
---|
[56] | 291 | //====== Entropy Slice ======== |
---|
| 292 | m_acTEncTopList[iViewIdx]->setEntropySliceMode ( m_iEntropySliceMode ); |
---|
| 293 | m_acTEncTopList[iViewIdx]->setEntropySliceArgument ( m_iEntropySliceArgument ); |
---|
| 294 | int iNumPartInCU = 1<<(m_uiMaxCUDepth<<1); |
---|
| 295 | if(m_iEntropySliceMode==SHARP_FIXED_NUMBER_OF_LCU_IN_ENTROPY_SLICE) |
---|
| 296 | { |
---|
| 297 | m_acTEncTopList[iViewIdx]->setEntropySliceArgument ( m_iEntropySliceArgument * ( iNumPartInCU >> ( m_iSliceGranularity << 1 ) ) ); |
---|
| 298 | } |
---|
| 299 | if(m_iSliceMode==AD_HOC_SLICES_FIXED_NUMBER_OF_LCU_IN_SLICE) |
---|
| 300 | { |
---|
| 301 | m_acTEncTopList[iViewIdx]->setSliceArgument ( m_iSliceArgument * ( iNumPartInCU >> ( m_iSliceGranularity << 1 ) ) ); |
---|
| 302 | } |
---|
| 303 | #if FIXED_NUMBER_OF_TILES_SLICE_MODE |
---|
| 304 | if(m_iSliceMode==AD_HOC_SLICES_FIXED_NUMBER_OF_TILES_IN_SLICE) |
---|
| 305 | { |
---|
| 306 | m_acTEncTopList[iViewIdx]->setSliceArgument ( m_iSliceArgument ); |
---|
| 307 | } |
---|
[2] | 308 | #endif |
---|
[56] | 309 | m_acTEncTopList[iViewIdx]->setSliceGranularity ( m_iSliceGranularity ); |
---|
| 310 | if(m_iSliceMode == 0 ) |
---|
| 311 | { |
---|
| 312 | m_bLFCrossSliceBoundaryFlag = true; |
---|
| 313 | } |
---|
| 314 | m_acTEncTopList[iViewIdx]->setLFCrossSliceBoundaryFlag( m_bLFCrossSliceBoundaryFlag ); |
---|
| 315 | m_acTEncTopList[iViewIdx]->setUseSAO ( m_abUseSAO[0] ); |
---|
[189] | 316 | #if LGE_ILLUCOMP_B0045 |
---|
[253] | 317 | #if LGE_ILLUCOMP_DEPTH_C0046 |
---|
| 318 | m_acTEncTopList[iViewIdx]->setUseIC ( m_abUseIC[0] ); |
---|
| 319 | #else |
---|
[189] | 320 | m_acTEncTopList[iViewIdx]->setUseIC ( m_bUseIC ); |
---|
| 321 | #endif |
---|
[253] | 322 | #endif |
---|
[56] | 323 | #if SAO_UNIT_INTERLEAVING |
---|
| 324 | m_acTEncTopList[iViewIdx]->setMaxNumOffsetsPerPic (m_maxNumOffsetsPerPic); |
---|
| 325 | m_acTEncTopList[iViewIdx]->setSaoInterleavingFlag (m_saoInterleavingFlag); |
---|
[2] | 326 | #endif |
---|
[56] | 327 | m_acTEncTopList[iViewIdx]->setPCMInputBitDepthFlag ( m_bPCMInputBitDepthFlag); |
---|
| 328 | m_acTEncTopList[iViewIdx]->setPCMFilterDisableFlag ( m_bPCMFilterDisableFlag); |
---|
[2] | 329 | |
---|
[56] | 330 | m_acTEncTopList[iViewIdx]->setPictureDigestEnabled(m_pictureDigestEnabled); |
---|
[2] | 331 | |
---|
[56] | 332 | m_acTEncTopList[iViewIdx]->setColumnRowInfoPresent ( m_iColumnRowInfoPresent ); |
---|
| 333 | m_acTEncTopList[iViewIdx]->setUniformSpacingIdr ( m_iUniformSpacingIdr ); |
---|
| 334 | #if !REMOVE_TILE_DEPENDENCE |
---|
| 335 | m_acTEncTopList[iViewIdx]->setTileBoundaryIndependenceIdr( m_iTileBoundaryIndependenceIdr ); |
---|
[2] | 336 | #endif |
---|
[56] | 337 | m_acTEncTopList[iViewIdx]->setNumColumnsMinus1 ( m_iNumColumnsMinus1 ); |
---|
| 338 | m_acTEncTopList[iViewIdx]->setNumRowsMinus1 ( m_iNumRowsMinus1 ); |
---|
| 339 | if(m_iUniformSpacingIdr==0) |
---|
| 340 | { |
---|
| 341 | m_acTEncTopList[iViewIdx]->setColumnWidth ( m_pchColumnWidth ); |
---|
| 342 | m_acTEncTopList[iViewIdx]->setRowHeight ( m_pchRowHeight ); |
---|
| 343 | } |
---|
| 344 | m_acTEncTopList[iViewIdx]->xCheckGSParameters(); |
---|
| 345 | m_acTEncTopList[iViewIdx]->setTileLocationInSliceHeaderFlag ( m_iTileLocationInSliceHeaderFlag ); |
---|
| 346 | m_acTEncTopList[iViewIdx]->setTileMarkerFlag ( m_iTileMarkerFlag ); |
---|
| 347 | m_acTEncTopList[iViewIdx]->setMaxTileMarkerEntryPoints ( m_iMaxTileMarkerEntryPoints ); |
---|
| 348 | |
---|
| 349 | Int uiTilesCount = (m_iNumRowsMinus1+1) * (m_iNumColumnsMinus1+1); |
---|
| 350 | m_dMaxTileMarkerOffset = ((Double)uiTilesCount) / m_iMaxTileMarkerEntryPoints; |
---|
| 351 | m_acTEncTopList[iViewIdx]->setMaxTileMarkerOffset ( m_dMaxTileMarkerOffset ); |
---|
| 352 | m_acTEncTopList[iViewIdx]->setTileBehaviorControlPresentFlag( m_iTileBehaviorControlPresentFlag ); |
---|
| 353 | #if !REMOVE_TILE_DEPENDENCE |
---|
| 354 | if(m_iTileBoundaryIndependenceIdr == 0 || uiTilesCount == 1) |
---|
| 355 | #else |
---|
| 356 | if(uiTilesCount == 1) |
---|
[2] | 357 | #endif |
---|
[56] | 358 | { |
---|
| 359 | m_bLFCrossTileBoundaryFlag = true; |
---|
| 360 | } |
---|
| 361 | m_acTEncTopList[iViewIdx]->setLFCrossTileBoundaryFlag( m_bLFCrossTileBoundaryFlag ); |
---|
| 362 | m_acTEncTopList[iViewIdx]->setWaveFrontSynchro ( m_iWaveFrontSynchro ); |
---|
| 363 | m_acTEncTopList[iViewIdx]->setWaveFrontFlush ( m_iWaveFrontFlush ); |
---|
| 364 | m_acTEncTopList[iViewIdx]->setWaveFrontSubstreams ( m_iWaveFrontSubstreams ); |
---|
[189] | 365 | #if TMVP_DEPTH_SWITCH |
---|
| 366 | m_acTEncTopList[iViewIdx]->setEnableTMVP ( m_enableTMVP[0] ); |
---|
| 367 | #else |
---|
[56] | 368 | m_acTEncTopList[iViewIdx]->setEnableTMVP ( m_enableTMVP ); |
---|
[189] | 369 | #endif |
---|
[56] | 370 | m_acTEncTopList[iViewIdx]->setUseScalingListId ( m_useScalingListId ); |
---|
| 371 | m_acTEncTopList[iViewIdx]->setScalingListFile ( m_scalingListFile ); |
---|
| 372 | #if MULTIBITS_DATA_HIDING |
---|
| 373 | m_acTEncTopList[iViewIdx]->setSignHideFlag(m_signHideFlag); |
---|
| 374 | m_acTEncTopList[iViewIdx]->setTSIG(m_signHidingThreshold); |
---|
[2] | 375 | #endif |
---|
| 376 | |
---|
[56] | 377 | #if LCU_SYNTAX_ALF |
---|
| 378 | if(uiTilesCount > 1) |
---|
[2] | 379 | { |
---|
[56] | 380 | m_bALFParamInSlice = false; |
---|
| 381 | m_bALFPicBasedEncode = true; |
---|
[2] | 382 | } |
---|
[56] | 383 | m_acTEncTopList[iViewIdx]->setALFParamInSlice ( m_bALFParamInSlice); |
---|
| 384 | m_acTEncTopList[iViewIdx]->setALFPicBasedEncode ( m_bALFPicBasedEncode); |
---|
[2] | 385 | #endif |
---|
[56] | 386 | |
---|
| 387 | //====== Depth tools ======== |
---|
| 388 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
| 389 | m_acTEncTopList[iViewIdx]->setUseDMM ( false ); |
---|
[2] | 390 | #endif |
---|
[189] | 391 | #if OL_QTLIMIT_PREDCODING_B0068 |
---|
| 392 | m_acTEncTopList[iViewIdx]->setUseQTLPC ( false ); |
---|
[115] | 393 | #endif |
---|
[5] | 394 | #if HHI_MPI |
---|
[2] | 395 | m_acTEncTopList[iViewIdx]->setUseMVI( false ); |
---|
[5] | 396 | #endif |
---|
[189] | 397 | #if RWTH_SDC_DLT_B0036 |
---|
| 398 | m_acTEncTopList[iViewIdx]->setUseDLT ( false ); |
---|
| 399 | m_acTEncTopList[iViewIdx]->setUseSDC ( false ); |
---|
| 400 | #endif |
---|
[2] | 401 | } |
---|
| 402 | if( m_bUsingDepthMaps ) |
---|
| 403 | { |
---|
| 404 | for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) |
---|
| 405 | { |
---|
[210] | 406 | |
---|
| 407 | #if FLEX_CODING_ORDER_M23723 |
---|
| 408 | // Detect whether depth comes before than texture for this view |
---|
| 409 | Bool isDepthFirst = false; |
---|
| 410 | if ( m_b3DVFlexOrder ) |
---|
| 411 | { |
---|
| 412 | for ( Int ii=1; ii<12; ii+=2 ) |
---|
| 413 | { |
---|
| 414 | Int iViewIdxCfg = (Int)(m_pchMVCJointCodingOrder[ii]-'0'); |
---|
| 415 | if ( iViewIdxCfg == iViewIdx ) |
---|
| 416 | { |
---|
| 417 | if ( m_pchMVCJointCodingOrder[ii-1]=='D' ) // depth comes first for this view |
---|
| 418 | { |
---|
| 419 | isDepthFirst = true; |
---|
| 420 | } |
---|
| 421 | else |
---|
| 422 | { |
---|
| 423 | assert(m_pchMVCJointCodingOrder[ii-1]=='T'); |
---|
| 424 | } |
---|
| 425 | break; |
---|
| 426 | } |
---|
| 427 | } |
---|
| 428 | } |
---|
| 429 | #endif |
---|
| 430 | |
---|
[56] | 431 | m_depthFrameRcvd.push_back(0); |
---|
| 432 | m_acTEncDepthTopList.push_back(new TEncTop); |
---|
[2] | 433 | m_acTVideoIOYuvDepthInputFileList.push_back(new TVideoIOYuv); |
---|
[56] | 434 | m_acTVideoIOYuvDepthReconFileList.push_back(new TVideoIOYuv); |
---|
| 435 | m_picYuvDepthRec.push_back(new TComList<TComPicYuv*>) ; |
---|
[2] | 436 | |
---|
| 437 | m_acTEncDepthTopList[iViewIdx]->setFrameRate ( m_iFrameRate ); |
---|
| 438 | m_acTEncDepthTopList[iViewIdx]->setFrameSkip ( m_FrameSkip ); |
---|
| 439 | m_acTEncDepthTopList[iViewIdx]->setSourceWidth ( m_iSourceWidth ); |
---|
| 440 | m_acTEncDepthTopList[iViewIdx]->setSourceHeight ( m_iSourceHeight ); |
---|
[56] | 441 | #if PIC_CROPPING |
---|
| 442 | m_acTEncDepthTopList[iViewIdx]->setCroppingMode ( m_croppingMode ); |
---|
| 443 | m_acTEncDepthTopList[iViewIdx]->setCropLeft ( m_cropLeft ); |
---|
| 444 | m_acTEncDepthTopList[iViewIdx]->setCropRight ( m_cropRight ); |
---|
| 445 | m_acTEncDepthTopList[iViewIdx]->setCropTop ( m_cropTop ); |
---|
| 446 | m_acTEncDepthTopList[iViewIdx]->setCropBottom ( m_cropBottom ); |
---|
| 447 | #endif |
---|
[2] | 448 | m_acTEncDepthTopList[iViewIdx]->setFrameToBeEncoded ( m_iFrameToBeEncoded ); |
---|
[56] | 449 | m_acTEncDepthTopList[iViewIdx]->setViewId ( iViewIdx ); |
---|
| 450 | m_acTEncDepthTopList[iViewIdx]->setIsDepth ( true ); |
---|
[210] | 451 | #if QC_MVHEVC_B0046 |
---|
| 452 | m_acTEncDepthTopList[iViewIdx]->setLayerId ( iViewIdx ); |
---|
| 453 | #else |
---|
[56] | 454 | m_acTEncDepthTopList[iViewIdx]->setViewOrderIdx ( m_cCameraData.getViewOrderIndex()[ iViewIdx ] ); |
---|
[210] | 455 | #endif |
---|
[77] | 456 | #if VIDYO_VPS_INTEGRATION |
---|
| 457 | layerId = iViewIdx * 2 + 1; |
---|
| 458 | m_acTEncDepthTopList[iViewIdx]->setLayerId ( layerId ); |
---|
| 459 | m_cVPS.setDepthFlag ( true, layerId ); |
---|
| 460 | m_cVPS.setViewId ( iViewIdx, layerId ); |
---|
| 461 | m_cVPS.setViewOrderIdx ( m_cCameraData.getViewOrderIndex()[ iViewIdx ], layerId ); |
---|
| 462 | m_cVPS.setDependentFlag ( true, layerId ); |
---|
| 463 | m_cVPS.setDependentLayer ( layerId-1, layerId); |
---|
| 464 | #endif |
---|
[56] | 465 | m_acTEncDepthTopList[iViewIdx]->setCamParPrecision ( 0 ); |
---|
| 466 | m_acTEncDepthTopList[iViewIdx]->setCamParInSliceHeader ( false ); |
---|
| 467 | m_acTEncDepthTopList[iViewIdx]->setCodedScale ( 0 ); |
---|
| 468 | m_acTEncDepthTopList[iViewIdx]->setCodedOffset ( 0 ); |
---|
[2] | 469 | |
---|
| 470 | //====== Coding Structure ======== |
---|
[56] | 471 | m_acTEncDepthTopList[iViewIdx]->setIntraPeriod ( m_iIntraPeriod ); |
---|
[2] | 472 | m_acTEncDepthTopList[iViewIdx]->setDecodingRefreshType ( m_iDecodingRefreshType ); |
---|
[56] | 473 | m_acTEncDepthTopList[iViewIdx]->setGOPSize ( m_iGOPSize ); |
---|
| 474 | m_acTEncDepthTopList[iViewIdx]->setGopList ( m_GOPListsMvc[iViewIdx] ); |
---|
| 475 | m_acTEncDepthTopList[iViewIdx]->setExtraRPSs ( m_extraRPSs[iViewIdx] ); |
---|
| 476 | #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER |
---|
| 477 | for(Int i = 0; i < MAX_TLAYER; i++) |
---|
| 478 | { |
---|
| 479 | m_acTEncDepthTopList[iViewIdx]->setNumReorderPics ( m_numReorderPics[iViewIdx][i], i ); |
---|
| 480 | m_acTEncDepthTopList[iViewIdx]->setMaxDecPicBuffering ( m_maxDecPicBuffering[iViewIdx][i], i ); |
---|
| 481 | } |
---|
| 482 | #else |
---|
| 483 | m_acTEncDepthTopList[iViewIdx]->setNumReorderFrames ( m_numReorderFrames ); |
---|
| 484 | m_acTEncDepthTopList[iViewIdx]->setMaxNumberOfReferencePictures ( m_maxNumberOfReferencePictures ); |
---|
[2] | 485 | #endif |
---|
[56] | 486 | for( UInt uiLoop = 0; uiLoop < MAX_TLAYER; ++uiLoop ) |
---|
| 487 | { |
---|
| 488 | m_acTEncDepthTopList[iViewIdx]->setLambdaModifier( uiLoop, m_adLambdaModifier[ uiLoop ] ); |
---|
| 489 | } |
---|
[2] | 490 | m_acTEncDepthTopList[iViewIdx]->setQP ( m_aiQP[1] ); |
---|
| 491 | |
---|
| 492 | m_acTEncDepthTopList[iViewIdx]->setTemporalLayerQPOffset ( m_aiTLayerQPOffset ); |
---|
| 493 | m_acTEncDepthTopList[iViewIdx]->setPad ( m_aiPad ); |
---|
| 494 | |
---|
[56] | 495 | #if H0566_TLA |
---|
| 496 | m_acTEncDepthTopList[iViewIdx]->setMaxTempLayer ( m_maxTempLayer[iViewIdx] ); |
---|
| 497 | #else |
---|
| 498 | m_acTEncDepthTopList[iViewIdx]->setTLayering ( m_bTLayering ); |
---|
| 499 | m_acTEncDepthTopList[iViewIdx]->setTLayerSwitchingFlag ( m_abTLayerSwitchingFlag ); |
---|
| 500 | #endif |
---|
| 501 | |
---|
| 502 | m_acTEncDepthTopList[iViewIdx]->setDisInter4x4 ( m_bDisInter4x4); |
---|
| 503 | |
---|
| 504 | m_acTEncDepthTopList[iViewIdx]->setUseNSQT( m_enableNSQT ); |
---|
| 505 | m_acTEncDepthTopList[iViewIdx]->setUseAMP( m_enableAMP ); |
---|
| 506 | |
---|
[2] | 507 | //===== Slice ======== |
---|
| 508 | |
---|
| 509 | //====== Loop/Deblock Filter ======== |
---|
| 510 | m_acTEncDepthTopList[iViewIdx]->setLoopFilterDisable ( m_abLoopFilterDisable[1] ); |
---|
[56] | 511 | m_acTEncDepthTopList[iViewIdx]->setLoopFilterOffsetInAPS ( m_loopFilterOffsetInAPS ); |
---|
| 512 | m_acTEncDepthTopList[iViewIdx]->setLoopFilterBetaOffset ( m_loopFilterBetaOffsetDiv2 ); |
---|
| 513 | m_acTEncDepthTopList[iViewIdx]->setLoopFilterTcOffset ( m_loopFilterTcOffsetDiv2 ); |
---|
| 514 | #if DBL_CONTROL |
---|
| 515 | m_acTEncDepthTopList[iViewIdx]->setDeblockingFilterControlPresent( m_DeblockingFilterControlPresent); |
---|
| 516 | #endif |
---|
[2] | 517 | |
---|
| 518 | //====== Motion search ======== |
---|
| 519 | m_acTEncDepthTopList[iViewIdx]->setFastSearch ( m_iFastSearch ); |
---|
| 520 | m_acTEncDepthTopList[iViewIdx]->setSearchRange ( m_iSearchRange ); |
---|
| 521 | m_acTEncDepthTopList[iViewIdx]->setBipredSearchRange ( m_bipredSearchRange ); |
---|
[210] | 522 | #if DV_V_RESTRICTION_B0037 |
---|
| 523 | m_acTEncDepthTopList[iViewIdx]->setUseDisparitySearchRangeRestriction ( m_bUseDisparitySearchRangeRestriction ); |
---|
| 524 | m_acTEncDepthTopList[iViewIdx]->setVerticalDisparitySearchRange( m_iVerticalDisparitySearchRange ); |
---|
| 525 | #endif |
---|
[56] | 526 | //====== Quality control ======== |
---|
[2] | 527 | m_acTEncDepthTopList[iViewIdx]->setMaxDeltaQP ( m_iMaxDeltaQP ); |
---|
[56] | 528 | m_acTEncDepthTopList[iViewIdx]->setMaxCuDQPDepth ( m_iMaxCuDQPDepth ); |
---|
[2] | 529 | |
---|
[56] | 530 | m_acTEncDepthTopList[iViewIdx]->setChromaQpOffset ( m_iChromaQpOffset ); |
---|
| 531 | m_acTEncDepthTopList[iViewIdx]->setChromaQpOffset2nd ( m_iChromaQpOffset2nd ); |
---|
| 532 | |
---|
| 533 | #if ADAPTIVE_QP_SELECTION |
---|
| 534 | m_acTEncDepthTopList[iViewIdx]->setUseAdaptQpSelect ( m_bUseAdaptQpSelect ); |
---|
| 535 | #endif |
---|
| 536 | |
---|
| 537 | m_acTEncDepthTopList[iViewIdx]->setUseAdaptiveQP ( m_bUseAdaptiveQP ); |
---|
| 538 | m_acTEncDepthTopList[iViewIdx]->setQPAdaptationRange ( m_iQPAdaptationRange ); |
---|
| 539 | |
---|
[2] | 540 | //====== Tool list ======== |
---|
| 541 | m_acTEncDepthTopList[iViewIdx]->setUseSBACRD ( m_bUseSBACRD ); |
---|
| 542 | m_acTEncDepthTopList[iViewIdx]->setDeltaQpRD ( m_uiDeltaQpRD ); |
---|
| 543 | m_acTEncDepthTopList[iViewIdx]->setUseASR ( m_bUseASR ); |
---|
| 544 | m_acTEncDepthTopList[iViewIdx]->setUseHADME ( m_bUseHADME ); |
---|
| 545 | m_acTEncDepthTopList[iViewIdx]->setUseALF ( m_abUseALF[1] ); |
---|
| 546 | m_acTEncDepthTopList[iViewIdx]->setALFEncodePassReduction ( m_iALFEncodePassReduction ); |
---|
[56] | 547 | #if LOSSLESS_CODING |
---|
| 548 | m_acTEncDepthTopList[iViewIdx]->setUseLossless ( m_useLossless ); |
---|
[2] | 549 | #endif |
---|
[56] | 550 | m_acTEncDepthTopList[iViewIdx]->setALFMaxNumberFilters ( m_iALFMaxNumberFilters ) ; |
---|
| 551 | |
---|
[2] | 552 | m_acTEncDepthTopList[iViewIdx]->setUseLComb ( m_bUseLComb ); |
---|
[56] | 553 | m_acTEncDepthTopList[iViewIdx]->setLCMod ( m_bLCMod ); |
---|
| 554 | m_acTEncDepthTopList[iViewIdx]->setdQPs ( m_aidQPdepth ); |
---|
[2] | 555 | m_acTEncDepthTopList[iViewIdx]->setUseRDOQ ( m_abUseRDOQ[1] ); |
---|
[56] | 556 | #if !PIC_CROPPING |
---|
[2] | 557 | m_acTEncDepthTopList[iViewIdx]->setUsePAD ( m_bUsePAD ); |
---|
[56] | 558 | #endif |
---|
[2] | 559 | m_acTEncDepthTopList[iViewIdx]->setQuadtreeTULog2MaxSize ( m_uiQuadtreeTULog2MaxSize ); |
---|
| 560 | m_acTEncDepthTopList[iViewIdx]->setQuadtreeTULog2MinSize ( m_uiQuadtreeTULog2MinSize ); |
---|
| 561 | m_acTEncDepthTopList[iViewIdx]->setQuadtreeTUMaxDepthInter ( m_uiQuadtreeTUMaxDepthInter ); |
---|
| 562 | m_acTEncDepthTopList[iViewIdx]->setQuadtreeTUMaxDepthIntra ( m_uiQuadtreeTUMaxDepthIntra ); |
---|
| 563 | m_acTEncDepthTopList[iViewIdx]->setUseFastEnc ( m_bUseFastEnc ); |
---|
[56] | 564 | m_acTEncDepthTopList[iViewIdx]->setUseEarlyCU ( m_bUseEarlyCU ); |
---|
| 565 | #if FAST_DECISION_FOR_MRG_RD_COST |
---|
| 566 | m_acTEncDepthTopList[iViewIdx]->setUseFastDecisionForMerge ( m_useFastDecisionForMerge ); |
---|
| 567 | #endif |
---|
| 568 | m_acTEncDepthTopList[iViewIdx]->setUseCbfFastMode ( m_bUseCbfFastMode ); |
---|
| 569 | #if HHI_INTERVIEW_SKIP |
---|
| 570 | m_acTEncDepthTopList[iViewIdx]->setInterViewSkip ( 0 ); |
---|
| 571 | #if HHI_INTERVIEW_SKIP_LAMBDA_SCALE |
---|
| 572 | m_acTEncDepthTopList[iViewIdx]->setInterViewSkipLambdaScale ( 1 ); |
---|
| 573 | #endif |
---|
| 574 | #endif |
---|
| 575 | m_acTEncDepthTopList[iViewIdx]->setUseLMChroma ( m_bUseLMChroma ); |
---|
| 576 | m_acTEncDepthTopList[iViewIdx]->setUseConstrainedIntraPred ( m_bUseConstrainedIntraPred ); |
---|
| 577 | m_acTEncDepthTopList[iViewIdx]->setPCMLog2MinSize ( m_uiPCMLog2MinSize); |
---|
| 578 | m_acTEncDepthTopList[iViewIdx]->setUsePCM ( m_usePCM ); |
---|
| 579 | m_acTEncDepthTopList[iViewIdx]->setPCMLog2MaxSize ( m_pcmLog2MaxSize); |
---|
| 580 | //====== VSO ======== |
---|
[5] | 581 | #if HHI_VSO |
---|
[2] | 582 | m_acTEncDepthTopList[iViewIdx]->setUseVSO ( m_bUseVSO ); //GT: might be enabled/disabled later for VSO Mode 4 |
---|
| 583 | m_acTEncDepthTopList[iViewIdx]->setForceLambdaScaleVSO ( m_bForceLambdaScaleVSO ); |
---|
| 584 | m_acTEncDepthTopList[iViewIdx]->setLambdaScaleVSO ( m_dLambdaScaleVSO ); |
---|
[5] | 585 | #if HHI_VSO_DIST_INT |
---|
[2] | 586 | m_acTEncDepthTopList[iViewIdx]->setAllowNegDist ( m_bAllowNegDist ); |
---|
| 587 | #endif |
---|
| 588 | m_acTEncDepthTopList[iViewIdx]->setVSOMode ( m_uiVSOMode ); |
---|
[100] | 589 | |
---|
| 590 | #if SAIT_VSO_EST_A0033 |
---|
| 591 | m_acTEncDepthTopList[iViewIdx]->setUseEstimatedVSD ( m_bUseEstimatedVSD ); |
---|
[5] | 592 | #endif |
---|
[115] | 593 | #if LGE_WVSO_A0119 |
---|
[120] | 594 | m_acTEncDepthTopList[iViewIdx]->setUseWVSO ( m_bUseWVSO ); |
---|
[100] | 595 | #endif |
---|
[115] | 596 | #endif |
---|
[2] | 597 | |
---|
[5] | 598 | #if DEPTH_MAP_GENERATION |
---|
[2] | 599 | m_acTEncDepthTopList[iViewIdx]->setPredDepthMapGeneration ( 0 ); |
---|
[5] | 600 | #endif |
---|
| 601 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
[2] | 602 | m_acTEncDepthTopList[iViewIdx]->setMultiviewMvPredMode ( 0 ); |
---|
| 603 | m_acTEncDepthTopList[iViewIdx]->setMultiviewMvRegMode ( 0 ); |
---|
| 604 | m_acTEncDepthTopList[iViewIdx]->setMultiviewMvRegLambdaScale ( 0.0 ); |
---|
[5] | 605 | #endif |
---|
| 606 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
[2] | 607 | m_acTEncDepthTopList[iViewIdx]->setMultiviewResPredMode ( 0 ); |
---|
[5] | 608 | #endif |
---|
[2] | 609 | |
---|
[56] | 610 | //====== Weighted Prediction ======== |
---|
| 611 | m_acTEncDepthTopList[iViewIdx]->setUseWP ( m_bUseWeightPred ); |
---|
| 612 | m_acTEncDepthTopList[iViewIdx]->setWPBiPredIdc ( m_uiBiPredIdc ); |
---|
| 613 | //====== Slice ======== |
---|
| 614 | m_acTEncDepthTopList[iViewIdx]->setSliceMode ( m_iSliceMode ); |
---|
| 615 | m_acTEncDepthTopList[iViewIdx]->setSliceArgument ( m_iSliceArgument ); |
---|
| 616 | |
---|
| 617 | //====== Entropy Slice ======== |
---|
| 618 | m_acTEncDepthTopList[iViewIdx]->setEntropySliceMode ( m_iEntropySliceMode ); |
---|
| 619 | m_acTEncDepthTopList[iViewIdx]->setEntropySliceArgument ( m_iEntropySliceArgument ); |
---|
| 620 | int iNumPartInCU = 1<<(m_uiMaxCUDepth<<1); |
---|
| 621 | if(m_iEntropySliceMode==SHARP_FIXED_NUMBER_OF_LCU_IN_ENTROPY_SLICE) |
---|
| 622 | { |
---|
| 623 | m_acTEncDepthTopList[iViewIdx]->setEntropySliceArgument ( m_iEntropySliceArgument * ( iNumPartInCU >> ( m_iSliceGranularity << 1 ) ) ); |
---|
| 624 | } |
---|
| 625 | if(m_iSliceMode==AD_HOC_SLICES_FIXED_NUMBER_OF_LCU_IN_SLICE) |
---|
| 626 | { |
---|
| 627 | m_acTEncDepthTopList[iViewIdx]->setSliceArgument ( m_iSliceArgument * ( iNumPartInCU >> ( m_iSliceGranularity << 1 ) ) ); |
---|
| 628 | } |
---|
| 629 | #if FIXED_NUMBER_OF_TILES_SLICE_MODE |
---|
| 630 | if(m_iSliceMode==AD_HOC_SLICES_FIXED_NUMBER_OF_TILES_IN_SLICE) |
---|
| 631 | { |
---|
| 632 | m_acTEncDepthTopList[iViewIdx]->setSliceArgument ( m_iSliceArgument ); |
---|
| 633 | } |
---|
[2] | 634 | #endif |
---|
[56] | 635 | m_acTEncDepthTopList[iViewIdx]->setSliceGranularity ( m_iSliceGranularity ); |
---|
| 636 | if(m_iSliceMode == 0 ) |
---|
| 637 | { |
---|
| 638 | m_bLFCrossSliceBoundaryFlag = true; |
---|
| 639 | } |
---|
| 640 | m_acTEncDepthTopList[iViewIdx]->setLFCrossSliceBoundaryFlag( m_bLFCrossSliceBoundaryFlag ); |
---|
| 641 | m_acTEncDepthTopList[iViewIdx]->setUseSAO ( m_abUseSAO[1] ); |
---|
[189] | 642 | #if LGE_ILLUCOMP_B0045 |
---|
[253] | 643 | #if LGE_ILLUCOMP_DEPTH_C0046 |
---|
| 644 | m_acTEncDepthTopList[iViewIdx]->setUseIC ( m_abUseIC[1] ); |
---|
| 645 | #else |
---|
[189] | 646 | m_acTEncDepthTopList[iViewIdx]->setUseIC ( false ); |
---|
| 647 | #endif |
---|
[253] | 648 | #endif |
---|
[56] | 649 | #if SAO_UNIT_INTERLEAVING |
---|
| 650 | m_acTEncDepthTopList[iViewIdx]->setMaxNumOffsetsPerPic (m_maxNumOffsetsPerPic); |
---|
| 651 | m_acTEncDepthTopList[iViewIdx]->setSaoInterleavingFlag (m_saoInterleavingFlag); |
---|
[2] | 652 | #endif |
---|
[56] | 653 | m_acTEncDepthTopList[iViewIdx]->setPCMInputBitDepthFlag ( m_bPCMInputBitDepthFlag); |
---|
| 654 | m_acTEncDepthTopList[iViewIdx]->setPCMFilterDisableFlag ( m_bPCMFilterDisableFlag); |
---|
[2] | 655 | |
---|
[56] | 656 | m_acTEncDepthTopList[iViewIdx]->setPictureDigestEnabled(m_pictureDigestEnabled); |
---|
| 657 | |
---|
| 658 | m_acTEncDepthTopList[iViewIdx]->setColumnRowInfoPresent ( m_iColumnRowInfoPresent ); |
---|
| 659 | m_acTEncDepthTopList[iViewIdx]->setUniformSpacingIdr ( m_iUniformSpacingIdr ); |
---|
| 660 | #if !REMOVE_TILE_DEPENDENCE |
---|
| 661 | m_acTEncDepthTopList[iViewIdx]->setTileBoundaryIndependenceIdr( m_iTileBoundaryIndependenceIdr ); |
---|
[2] | 662 | #endif |
---|
[56] | 663 | m_acTEncDepthTopList[iViewIdx]->setNumColumnsMinus1 ( m_iNumColumnsMinus1 ); |
---|
| 664 | m_acTEncDepthTopList[iViewIdx]->setNumRowsMinus1 ( m_iNumRowsMinus1 ); |
---|
| 665 | if(m_iUniformSpacingIdr==0) |
---|
| 666 | { |
---|
| 667 | m_acTEncDepthTopList[iViewIdx]->setColumnWidth ( m_pchColumnWidth ); |
---|
| 668 | m_acTEncDepthTopList[iViewIdx]->setRowHeight ( m_pchRowHeight ); |
---|
| 669 | } |
---|
| 670 | m_acTEncDepthTopList[iViewIdx]->xCheckGSParameters(); |
---|
| 671 | m_acTEncDepthTopList[iViewIdx]->setTileLocationInSliceHeaderFlag ( m_iTileLocationInSliceHeaderFlag ); |
---|
| 672 | m_acTEncDepthTopList[iViewIdx]->setTileMarkerFlag ( m_iTileMarkerFlag ); |
---|
| 673 | m_acTEncDepthTopList[iViewIdx]->setMaxTileMarkerEntryPoints ( m_iMaxTileMarkerEntryPoints ); |
---|
[2] | 674 | |
---|
[56] | 675 | Int uiTilesCount = (m_iNumRowsMinus1+1) * (m_iNumColumnsMinus1+1); |
---|
| 676 | m_dMaxTileMarkerOffset = ((Double)uiTilesCount) / m_iMaxTileMarkerEntryPoints; |
---|
| 677 | m_acTEncDepthTopList[iViewIdx]->setMaxTileMarkerOffset ( m_dMaxTileMarkerOffset ); |
---|
| 678 | m_acTEncDepthTopList[iViewIdx]->setTileBehaviorControlPresentFlag( m_iTileBehaviorControlPresentFlag ); |
---|
| 679 | #if !REMOVE_TILE_DEPENDENCE |
---|
| 680 | if(m_iTileBoundaryIndependenceIdr == 0 || uiTilesCount == 1) |
---|
| 681 | #else |
---|
| 682 | if(uiTilesCount == 1) |
---|
[2] | 683 | #endif |
---|
[56] | 684 | { |
---|
| 685 | m_bLFCrossTileBoundaryFlag = true; |
---|
| 686 | } |
---|
| 687 | m_acTEncDepthTopList[iViewIdx]->setLFCrossTileBoundaryFlag( m_bLFCrossTileBoundaryFlag ); |
---|
| 688 | m_acTEncDepthTopList[iViewIdx]->setWaveFrontSynchro ( m_iWaveFrontSynchro ); |
---|
| 689 | m_acTEncDepthTopList[iViewIdx]->setWaveFrontFlush ( m_iWaveFrontFlush ); |
---|
| 690 | m_acTEncDepthTopList[iViewIdx]->setWaveFrontSubstreams ( m_iWaveFrontSubstreams ); |
---|
[189] | 691 | #if TMVP_DEPTH_SWITCH |
---|
| 692 | m_acTEncDepthTopList[iViewIdx]->setEnableTMVP ( m_enableTMVP[1] ); |
---|
| 693 | #else |
---|
[56] | 694 | m_acTEncDepthTopList[iViewIdx]->setEnableTMVP ( m_enableTMVP ); |
---|
[189] | 695 | #endif |
---|
[56] | 696 | m_acTEncDepthTopList[iViewIdx]->setUseScalingListId ( m_useScalingListId ); |
---|
| 697 | m_acTEncDepthTopList[iViewIdx]->setScalingListFile ( m_scalingListFile ); |
---|
| 698 | #if MULTIBITS_DATA_HIDING |
---|
| 699 | m_acTEncDepthTopList[iViewIdx]->setSignHideFlag(m_signHideFlag); |
---|
| 700 | m_acTEncDepthTopList[iViewIdx]->setTSIG(m_signHidingThreshold); |
---|
[2] | 701 | #endif |
---|
| 702 | |
---|
[56] | 703 | #if LCU_SYNTAX_ALF |
---|
| 704 | if(uiTilesCount > 1) |
---|
[2] | 705 | { |
---|
[56] | 706 | m_bALFParamInSlice = false; |
---|
| 707 | m_bALFPicBasedEncode = true; |
---|
[2] | 708 | } |
---|
[56] | 709 | m_acTEncDepthTopList[iViewIdx]->setALFParamInSlice ( m_bALFParamInSlice); |
---|
| 710 | m_acTEncDepthTopList[iViewIdx]->setALFPicBasedEncode ( m_bALFPicBasedEncode); |
---|
[2] | 711 | #endif |
---|
[56] | 712 | |
---|
| 713 | //====== Depth tools ======== |
---|
| 714 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
| 715 | m_acTEncDepthTopList[iViewIdx]->setUseDMM ( m_bUseDMM ); |
---|
[2] | 716 | #endif |
---|
[210] | 717 | #if FLEX_CODING_ORDER_M23723 && HHI_DMM_PRED_TEX |
---|
| 718 | m_acTEncDepthTopList[iViewIdx]->setUseDMM34( (m_b3DVFlexOrder && isDepthFirst) ? false : m_bUseDMM ); |
---|
| 719 | #endif |
---|
| 720 | |
---|
[189] | 721 | #if OL_QTLIMIT_PREDCODING_B0068 |
---|
| 722 | m_acTEncDepthTopList[iViewIdx]->setUseQTLPC (m_bUseQTLPC); |
---|
[115] | 723 | #endif |
---|
[5] | 724 | #if HHI_MPI |
---|
[210] | 725 | #if FLEX_CODING_ORDER_M23723 |
---|
| 726 | m_acTEncDepthTopList[iViewIdx]->setUseMVI( (m_b3DVFlexOrder && isDepthFirst) ? false : m_bUseMVI ); |
---|
| 727 | #else |
---|
[56] | 728 | m_acTEncDepthTopList[iViewIdx]->setUseMVI( m_bUseMVI ); |
---|
[5] | 729 | #endif |
---|
[210] | 730 | #endif |
---|
[189] | 731 | #if RWTH_SDC_DLT_B0036 |
---|
| 732 | m_acTEncDepthTopList[iViewIdx]->setUseDLT ( m_bUseDLT ); |
---|
| 733 | m_acTEncDepthTopList[iViewIdx]->setUseSDC ( m_bUseSDC ); |
---|
| 734 | #endif |
---|
[2] | 735 | } |
---|
| 736 | } |
---|
[56] | 737 | |
---|
[5] | 738 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
[2] | 739 | else if( m_uiMultiviewMvRegMode ) |
---|
| 740 | { |
---|
| 741 | for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) |
---|
| 742 | { |
---|
| 743 | m_acTVideoIOYuvDepthInputFileList.push_back( new TVideoIOYuv ); |
---|
| 744 | } |
---|
| 745 | } |
---|
[5] | 746 | #endif |
---|
[2] | 747 | |
---|
[5] | 748 | #if HHI_VSO |
---|
[2] | 749 | if ( m_bUseVSO ) |
---|
| 750 | { |
---|
| 751 | if ( m_uiVSOMode == 4 ) |
---|
[5] | 752 | { |
---|
[100] | 753 | #if LGE_VSO_EARLY_SKIP_A0093 |
---|
| 754 | m_cRendererModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, g_uiMaxCUHeight , LOG2_DISP_PREC_LUT, 0, m_bVSOEarlySkip ); |
---|
| 755 | #else |
---|
| 756 | m_cRendererModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, g_uiMaxCUHeight , LOG2_DISP_PREC_LUT, 0 ); |
---|
| 757 | #endif |
---|
[2] | 758 | |
---|
| 759 | for ( Int iViewNum = 0; iViewNum < m_iNumberOfViews; iViewNum++ ) |
---|
| 760 | { |
---|
| 761 | for (Int iContent = 0; iContent < 2; iContent++ ) |
---|
| 762 | { |
---|
[5] | 763 | Int iNumOfModels = m_cRenModStrParser.getNumOfModelsForView(iViewNum, iContent); |
---|
| 764 | Bool bUseVSO = (iNumOfModels != 0); |
---|
[2] | 765 | |
---|
[5] | 766 | TEncTop* pcEncTop = ( iContent == 0 ) ? m_acTEncTopList[iViewNum] : m_acTEncDepthTopList[iViewNum]; |
---|
| 767 | pcEncTop->setUseVSO( bUseVSO ); |
---|
| 768 | pcEncTop->getRdCost()->setRenModel( bUseVSO ? &m_cRendererModel : NULL ); |
---|
| 769 | |
---|
[2] | 770 | for (Int iCurModel = 0; iCurModel < iNumOfModels; iCurModel++ ) |
---|
| 771 | { |
---|
[5] | 772 | Int iModelNum; Int iLeftViewNum; Int iRightViewNum; Int iDump; Int iOrgRefNum; Int iBlendMode; |
---|
[2] | 773 | |
---|
[5] | 774 | m_cRenModStrParser.getSingleModelData ( iViewNum, iContent, iCurModel, iModelNum, iBlendMode, iLeftViewNum, iRightViewNum, iOrgRefNum, iDump ) ; |
---|
| 775 | m_cRendererModel .createSingleModel ( iViewNum, iContent, iModelNum, iLeftViewNum, iRightViewNum, (iOrgRefNum != -1), iBlendMode ); |
---|
[2] | 776 | } |
---|
| 777 | } |
---|
| 778 | } |
---|
| 779 | } |
---|
| 780 | else |
---|
| 781 | { |
---|
[56] | 782 | AOT(true); |
---|
[2] | 783 | } |
---|
[115] | 784 | #if LGE_WVSO_A0119 |
---|
| 785 | for ( Int iViewNum = 0; iViewNum < m_iNumberOfViews; iViewNum++ ) |
---|
| 786 | { |
---|
| 787 | for (Int iContent = 0; iContent < 2; iContent++ ) |
---|
| 788 | { |
---|
| 789 | TEncTop* pcEncTop = ( iContent == 0 ) ? m_acTEncTopList[iViewNum] : m_acTEncDepthTopList[iViewNum]; |
---|
[120] | 790 | pcEncTop->setUseWVSO ( m_bUseWVSO ); |
---|
[115] | 791 | pcEncTop->setVSOWeight( m_iVSOWeight ); |
---|
| 792 | pcEncTop->setVSDWeight( m_iVSDWeight ); |
---|
[120] | 793 | pcEncTop->setDWeight ( m_iDWeight ); |
---|
[115] | 794 | } |
---|
| 795 | } |
---|
| 796 | #endif |
---|
[5] | 797 | } |
---|
| 798 | #endif |
---|
[2] | 799 | |
---|
[5] | 800 | #if HHI_INTERVIEW_SKIP |
---|
| 801 | m_cUsedPelsRenderer.init(m_iSourceWidth, m_iSourceHeight, true, 0, LOG2_DISP_PREC_LUT, true, 0, 0, 0, 0, 0, 6, 4, 1, 0, 6 ); |
---|
| 802 | #endif |
---|
[56] | 803 | |
---|
[2] | 804 | } |
---|
| 805 | |
---|
| 806 | Void TAppEncTop::xCreateLib() |
---|
| 807 | { |
---|
| 808 | for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) |
---|
| 809 | { |
---|
| 810 | m_acTVideoIOYuvInputFileList[iViewIdx]->open( m_pchInputFileList[iViewIdx], false, m_uiInputBitDepth, m_uiInternalBitDepth ); // read mode |
---|
[56] | 811 | m_acTVideoIOYuvInputFileList[iViewIdx]->skipFrames(m_FrameSkip, m_iSourceWidth - m_aiPad[0], m_iSourceHeight - m_aiPad[1]); |
---|
[2] | 812 | |
---|
[56] | 813 | if (m_pchReconFileList[iViewIdx]) |
---|
| 814 | m_acTVideoIOYuvReconFileList[iViewIdx]->open(m_pchReconFileList[iViewIdx], true, m_uiOutputBitDepth, m_uiInternalBitDepth); // write mode |
---|
[2] | 815 | m_acTEncTopList[iViewIdx]->create(); |
---|
| 816 | if( m_bUsingDepthMaps ) |
---|
| 817 | { |
---|
| 818 | m_acTVideoIOYuvDepthInputFileList[iViewIdx]->open( m_pchDepthInputFileList[iViewIdx], false, m_uiInputBitDepth, m_uiInternalBitDepth ); // read mode |
---|
[56] | 819 | m_acTVideoIOYuvDepthInputFileList[iViewIdx]->skipFrames(m_FrameSkip, m_iSourceWidth - m_aiPad[0], m_iSourceHeight - m_aiPad[1]); |
---|
[2] | 820 | |
---|
[56] | 821 | if (m_pchDepthReconFileList[iViewIdx]) |
---|
| 822 | m_acTVideoIOYuvDepthReconFileList[iViewIdx]->open(m_pchDepthReconFileList[iViewIdx], true, m_uiOutputBitDepth, m_uiInternalBitDepth); // write mode |
---|
[2] | 823 | m_acTEncDepthTopList[iViewIdx]->create(); |
---|
| 824 | } |
---|
[5] | 825 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
[2] | 826 | else if( m_uiMultiviewMvRegMode ) |
---|
| 827 | { |
---|
| 828 | m_acTVideoIOYuvDepthInputFileList[iViewIdx]->open( m_pchDepthInputFileList[iViewIdx], false, m_uiInputBitDepth, m_uiInternalBitDepth ); // read mode |
---|
| 829 | m_acTVideoIOYuvDepthInputFileList[iViewIdx]->skipFrames(m_FrameSkip, m_iSourceWidth, m_iSourceHeight); |
---|
| 830 | } |
---|
[5] | 831 | #endif |
---|
[2] | 832 | } |
---|
| 833 | } |
---|
| 834 | |
---|
| 835 | Void TAppEncTop::xDestroyLib() |
---|
| 836 | { |
---|
[56] | 837 | // Video I/O |
---|
[2] | 838 | for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) |
---|
| 839 | { |
---|
| 840 | m_acTVideoIOYuvInputFileList[iViewIdx]->close(); |
---|
| 841 | m_acTVideoIOYuvReconFileList[iViewIdx]->close(); |
---|
[56] | 842 | delete m_acTVideoIOYuvInputFileList[iViewIdx] ; |
---|
| 843 | m_acTVideoIOYuvInputFileList[iViewIdx] = NULL; |
---|
| 844 | delete m_acTVideoIOYuvReconFileList[iViewIdx] ; |
---|
| 845 | m_acTVideoIOYuvReconFileList[iViewIdx] = NULL; |
---|
| 846 | m_acTEncTopList[iViewIdx]->deletePicBuffer(); |
---|
[2] | 847 | m_acTEncTopList[iViewIdx]->destroy(); |
---|
[56] | 848 | delete m_acTEncTopList[iViewIdx] ; |
---|
| 849 | m_acTEncTopList[iViewIdx] = NULL; |
---|
| 850 | delete m_picYuvRec[iViewIdx] ; |
---|
| 851 | m_picYuvRec[iViewIdx] = NULL; |
---|
[2] | 852 | |
---|
| 853 | if( iViewIdx < Int( m_acTVideoIOYuvDepthInputFileList.size() ) && m_acTVideoIOYuvDepthInputFileList[iViewIdx] ) |
---|
| 854 | { |
---|
| 855 | m_acTVideoIOYuvDepthInputFileList[iViewIdx]->close( ); |
---|
[56] | 856 | delete m_acTVideoIOYuvDepthInputFileList[iViewIdx]; |
---|
| 857 | m_acTVideoIOYuvDepthInputFileList[iViewIdx] = NULL; |
---|
[2] | 858 | } |
---|
| 859 | if( iViewIdx < Int( m_acTVideoIOYuvDepthReconFileList.size() ) && m_acTVideoIOYuvDepthReconFileList[iViewIdx] ) |
---|
| 860 | { |
---|
| 861 | m_acTVideoIOYuvDepthReconFileList[iViewIdx]->close () ; |
---|
| 862 | delete m_acTVideoIOYuvDepthReconFileList[iViewIdx]; |
---|
[56] | 863 | m_acTVideoIOYuvDepthReconFileList[iViewIdx] = NULL; |
---|
[2] | 864 | } |
---|
| 865 | if( iViewIdx < Int( m_acTEncDepthTopList.size() ) && m_acTEncDepthTopList[iViewIdx] ) |
---|
| 866 | { |
---|
[56] | 867 | m_acTEncDepthTopList[iViewIdx]->deletePicBuffer(); |
---|
[2] | 868 | m_acTEncDepthTopList[iViewIdx]->destroy(); |
---|
| 869 | delete m_acTEncDepthTopList[iViewIdx]; |
---|
[56] | 870 | m_acTEncDepthTopList[iViewIdx] = NULL; |
---|
[2] | 871 | } |
---|
[56] | 872 | if( iViewIdx < Int( m_picYuvDepthRec.size() ) && m_picYuvDepthRec[iViewIdx] ) |
---|
[2] | 873 | { |
---|
[56] | 874 | delete m_picYuvDepthRec[iViewIdx] ; |
---|
| 875 | m_picYuvDepthRec[iViewIdx] = NULL; |
---|
[2] | 876 | } |
---|
| 877 | } |
---|
| 878 | } |
---|
| 879 | |
---|
| 880 | Void TAppEncTop::xInitLib() |
---|
| 881 | { |
---|
| 882 | for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) |
---|
| 883 | { |
---|
| 884 | m_acTEncTopList[iViewIdx]->init( this ); |
---|
[210] | 885 | #if QC_MVHEVC_B0046 |
---|
| 886 | //set setNumDirectRefLayer |
---|
| 887 | Int iNumDirectRef = m_acTEncTopList[iViewIdx]->getSPS()->getNumberOfUsableInterViewRefs(); |
---|
| 888 | m_acTEncTopList[iViewIdx]->getEncTop()->getVPS()->setNumDirectRefLayer(iNumDirectRef, iViewIdx); |
---|
| 889 | for(Int iNumIvRef = 0; iNumIvRef < iNumDirectRef; iNumIvRef ++) |
---|
| 890 | { |
---|
| 891 | Int iLayerId = m_acTEncTopList[iViewIdx]->getSPS()->getUsableInterViewRef(iNumIvRef); |
---|
| 892 | m_acTEncTopList[iViewIdx]->getEncTop()->getVPS()->setDirectRefLayerId( iLayerId + iViewIdx, iViewIdx, iNumIvRef); |
---|
[2] | 893 | } |
---|
[210] | 894 | #endif |
---|
| 895 | } |
---|
[2] | 896 | for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) |
---|
| 897 | { |
---|
| 898 | m_acTEncTopList[iViewIdx]->setTEncTopList( &m_acTEncTopList ); |
---|
| 899 | } |
---|
| 900 | if ( m_bUsingDepthMaps ) |
---|
| 901 | { |
---|
| 902 | for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) |
---|
| 903 | { |
---|
| 904 | m_acTEncDepthTopList[iViewIdx]->init( this ); |
---|
| 905 | } |
---|
| 906 | for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) |
---|
| 907 | { |
---|
| 908 | m_acTEncDepthTopList[iViewIdx]->setTEncTopList( &m_acTEncDepthTopList ); |
---|
| 909 | } |
---|
| 910 | } |
---|
| 911 | } |
---|
| 912 | |
---|
| 913 | // ==================================================================================================================== |
---|
| 914 | // Public member functions |
---|
| 915 | // ==================================================================================================================== |
---|
| 916 | |
---|
| 917 | /** |
---|
| 918 | - create internal class |
---|
| 919 | - initialize internal variable |
---|
| 920 | - until the end of input YUV file, call encoding function in TEncTop class |
---|
| 921 | - delete allocated buffers |
---|
| 922 | - destroy internal class |
---|
| 923 | . |
---|
| 924 | */ |
---|
| 925 | Void TAppEncTop::encode() |
---|
| 926 | { |
---|
[56] | 927 | fstream bitstreamFile(m_pchBitstreamFile, fstream::binary | fstream::out); |
---|
| 928 | if (!bitstreamFile) |
---|
| 929 | { |
---|
| 930 | fprintf(stderr, "\nfailed to open bitstream file `%s' for writing\n", m_pchBitstreamFile); |
---|
| 931 | exit(EXIT_FAILURE); |
---|
| 932 | } |
---|
| 933 | |
---|
| 934 | TComPicYuv* pcPicYuvOrg = new TComPicYuv; |
---|
[2] | 935 | TComPicYuv* pcDepthPicYuvOrg = new TComPicYuv; |
---|
[210] | 936 | #if !QC_MVHEVC_B0046 |
---|
[2] | 937 | TComPicYuv* pcPdmDepthOrg = new TComPicYuv; |
---|
[210] | 938 | #endif |
---|
[56] | 939 | TComPicYuv* pcPicYuvRec = NULL; |
---|
| 940 | TComPicYuv* pcDepthPicYuvRec = NULL; |
---|
| 941 | |
---|
[2] | 942 | // initialize internal class & member variables |
---|
| 943 | xInitLibCfg(); |
---|
| 944 | xCreateLib(); |
---|
| 945 | xInitLib(); |
---|
[56] | 946 | |
---|
[2] | 947 | // main encoder loop |
---|
[56] | 948 | Bool allEos = false; |
---|
| 949 | std::vector<Bool> eos ; |
---|
| 950 | std::vector<Bool> depthEos ; |
---|
| 951 | Int maxGopSize = 0; |
---|
| 952 | Int gopSize = 1; |
---|
| 953 | |
---|
| 954 | list<AccessUnit> outputAccessUnits; ///< list of access units to write out. is populated by the encoding process |
---|
| 955 | maxGopSize = (std::max)(maxGopSize, m_acTEncTopList[0]->getGOPSize()); |
---|
[2] | 956 | |
---|
| 957 | for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++ ) |
---|
| 958 | { |
---|
[56] | 959 | eos.push_back( false ); |
---|
| 960 | depthEos.push_back( false ); |
---|
[189] | 961 | |
---|
| 962 | #if RWTH_SDC_DLT_B0036 |
---|
| 963 | if( m_bUsingDepthMaps && m_bUseDLT ) |
---|
| 964 | xAnalyzeInputBaseDepth(iViewIdx, m_iIntraPeriod); |
---|
| 965 | #endif |
---|
[2] | 966 | } |
---|
[56] | 967 | |
---|
[2] | 968 | // allocate original YUV buffer |
---|
| 969 | pcPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); |
---|
[56] | 970 | pcDepthPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); |
---|
| 971 | |
---|
[5] | 972 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
[2] | 973 | if( m_uiMultiviewMvRegMode ) |
---|
| 974 | { |
---|
| 975 | pcPdmDepthOrg->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); |
---|
| 976 | } |
---|
[5] | 977 | #endif |
---|
[2] | 978 | |
---|
[56] | 979 | while ( !allEos ) |
---|
[2] | 980 | { |
---|
[56] | 981 | for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++ ) |
---|
[2] | 982 | { |
---|
[56] | 983 | Int frmCnt = 0; |
---|
| 984 | while ( !eos[iViewIdx] && !(frmCnt == gopSize)) |
---|
[2] | 985 | { |
---|
| 986 | // get buffers |
---|
[56] | 987 | xGetBuffer(pcPicYuvRec, iViewIdx, false); |
---|
| 988 | |
---|
[2] | 989 | // read input YUV file |
---|
[56] | 990 | m_acTVideoIOYuvInputFileList[iViewIdx]->read( pcPicYuvOrg, m_aiPad ); |
---|
| 991 | |
---|
[5] | 992 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
[2] | 993 | if( m_uiMultiviewMvRegMode && iViewIdx ) |
---|
| 994 | { |
---|
| 995 | m_acTVideoIOYuvDepthInputFileList[iViewIdx]->read( pcPdmDepthOrg, m_aiPad, m_bUsingDepthMaps ); |
---|
| 996 | } |
---|
[5] | 997 | #endif |
---|
[2] | 998 | |
---|
[5] | 999 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
[56] | 1000 | m_acTEncTopList[iViewIdx]->initNewPic( pcPicYuvOrg, ( m_uiMultiviewMvRegMode && iViewIdx ? pcPdmDepthOrg : 0 ) ); |
---|
[5] | 1001 | #else |
---|
[56] | 1002 | m_acTEncTopList[iViewIdx]->initNewPic( pcPicYuvOrg ); |
---|
[5] | 1003 | #endif |
---|
[2] | 1004 | |
---|
[56] | 1005 | // increase number of received frames |
---|
| 1006 | m_frameRcvd[iViewIdx]++; |
---|
| 1007 | frmCnt++; |
---|
| 1008 | // check end of file |
---|
| 1009 | eos[iViewIdx] = ( m_acTVideoIOYuvInputFileList[iViewIdx]->isEof() == 1 ? true : false ); |
---|
| 1010 | eos[iViewIdx] = ( m_frameRcvd[iViewIdx] == m_iFrameToBeEncoded ? true : eos[iViewIdx] ); |
---|
| 1011 | allEos = allEos|eos[iViewIdx] ; |
---|
| 1012 | } |
---|
[2] | 1013 | if( m_bUsingDepthMaps ) |
---|
| 1014 | { |
---|
[56] | 1015 | Int frmCntDepth = 0; |
---|
| 1016 | while ( !depthEos[iViewIdx] && !(frmCntDepth == gopSize)) |
---|
[2] | 1017 | { |
---|
| 1018 | // get buffers |
---|
[56] | 1019 | xGetBuffer(pcDepthPicYuvRec, iViewIdx, true); |
---|
| 1020 | |
---|
[2] | 1021 | // read input YUV file |
---|
[56] | 1022 | m_acTVideoIOYuvDepthInputFileList[iViewIdx]->read( pcDepthPicYuvOrg, m_aiPad ); |
---|
[2] | 1023 | |
---|
[56] | 1024 | m_acTEncDepthTopList[iViewIdx]->initNewPic( pcDepthPicYuvOrg ); |
---|
[2] | 1025 | |
---|
[56] | 1026 | // increase number of received frames |
---|
| 1027 | m_depthFrameRcvd[iViewIdx]++; |
---|
| 1028 | frmCntDepth++; |
---|
| 1029 | // check end of file |
---|
| 1030 | depthEos[iViewIdx] = ( m_acTVideoIOYuvDepthInputFileList[iViewIdx]->isEof() == 1 ? true : false ); |
---|
| 1031 | depthEos[iViewIdx] = ( m_depthFrameRcvd[iViewIdx] == m_iFrameToBeEncoded ? true : depthEos[iViewIdx] ); |
---|
| 1032 | allEos = allEos|depthEos[iViewIdx] ; |
---|
[42] | 1033 | } |
---|
| 1034 | } |
---|
| 1035 | } |
---|
[56] | 1036 | for ( Int gopId=0; gopId < gopSize; gopId++ ) |
---|
[42] | 1037 | { |
---|
[56] | 1038 | Int iNumEncoded = 0; |
---|
[210] | 1039 | #if !QC_MVHEVC_B0046 |
---|
[56] | 1040 | UInt iNextPoc = m_acTEncTopList[0] -> getFrameId( gopId ); |
---|
| 1041 | if ( iNextPoc < m_iFrameToBeEncoded ) |
---|
[2] | 1042 | { |
---|
[56] | 1043 | m_cCameraData.update( iNextPoc ); |
---|
[2] | 1044 | } |
---|
[210] | 1045 | #endif |
---|
| 1046 | |
---|
| 1047 | #if FLEX_CODING_ORDER_M23723 |
---|
| 1048 | if (m_b3DVFlexOrder) |
---|
| 1049 | { |
---|
| 1050 | Int iNumDepthEncoded = 0; |
---|
| 1051 | iNumEncoded = 0; |
---|
| 1052 | Int i=0; |
---|
| 1053 | Int iViewIdx=0; |
---|
| 1054 | Int iNumberofDepthViews = m_bUsingDepthMaps?m_iNumberOfViews:0; |
---|
| 1055 | for (Int j=0; j < (m_iNumberOfViews+ iNumberofDepthViews); j++ ) |
---|
| 1056 | { |
---|
| 1057 | if (m_pchMVCJointCodingOrder[i]=='T') |
---|
| 1058 | { |
---|
| 1059 | |
---|
| 1060 | i++; |
---|
| 1061 | assert(isdigit(m_pchMVCJointCodingOrder[i])); |
---|
| 1062 | iViewIdx = (Int)(m_pchMVCJointCodingOrder[i]-'0'); |
---|
| 1063 | |
---|
| 1064 | m_acTEncTopList[iViewIdx]->encode( eos[iViewIdx], pcPicYuvOrg, *m_picYuvRec[iViewIdx], outputAccessUnits, iNumEncoded, gopId ); |
---|
| 1065 | xWriteOutput(bitstreamFile, iNumEncoded, outputAccessUnits, iViewIdx, false); |
---|
| 1066 | outputAccessUnits.clear(); |
---|
| 1067 | i++; |
---|
| 1068 | } |
---|
| 1069 | else if ( m_pchMVCJointCodingOrder[i] == 'D') |
---|
| 1070 | { |
---|
| 1071 | |
---|
| 1072 | i++; |
---|
| 1073 | if( m_bUsingDepthMaps ) |
---|
| 1074 | { |
---|
| 1075 | assert(isdigit(m_pchMVCJointCodingOrder[i])); |
---|
| 1076 | iViewIdx = (Int)(m_pchMVCJointCodingOrder[i]-'0'); |
---|
| 1077 | #if SAIT_VSO_EST_A0033 |
---|
| 1078 | if( m_bUseVSO && iNextPoc < m_iFrameToBeEncoded ) |
---|
| 1079 | { |
---|
| 1080 | m_cCameraData.xSetDispCoeff( iNextPoc, iViewIdx ); |
---|
| 1081 | m_acTEncDepthTopList[iViewIdx]->setDispCoeff( m_cCameraData.getDispCoeff() ); |
---|
| 1082 | } |
---|
| 1083 | #endif |
---|
| 1084 | m_acTEncDepthTopList[iViewIdx]->encode( depthEos[iViewIdx], pcDepthPicYuvOrg, *m_picYuvDepthRec[iViewIdx], outputAccessUnits, iNumDepthEncoded, gopId ); |
---|
| 1085 | xWriteOutput(bitstreamFile, iNumDepthEncoded, outputAccessUnits, iViewIdx, true); |
---|
| 1086 | outputAccessUnits.clear(); |
---|
| 1087 | i++; |
---|
| 1088 | } |
---|
| 1089 | } |
---|
| 1090 | } |
---|
| 1091 | } |
---|
| 1092 | else |
---|
| 1093 | { |
---|
| 1094 | |
---|
| 1095 | #endif |
---|
[56] | 1096 | for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++ ) |
---|
[2] | 1097 | { |
---|
[102] | 1098 | #if SAIT_VSO_EST_A0033 |
---|
| 1099 | if( m_bUseVSO && iNextPoc < m_iFrameToBeEncoded ) |
---|
| 1100 | { |
---|
| 1101 | m_cCameraData.xSetDispCoeff( iNextPoc, iViewIdx ); |
---|
| 1102 | m_acTEncDepthTopList[iViewIdx]->setDispCoeff( m_cCameraData.getDispCoeff() ); |
---|
| 1103 | } |
---|
| 1104 | #endif |
---|
[56] | 1105 | iNumEncoded = 0; |
---|
| 1106 | // call encoding function for one frame |
---|
| 1107 | m_acTEncTopList[iViewIdx]->encode( eos[iViewIdx], pcPicYuvOrg, *m_picYuvRec[iViewIdx], outputAccessUnits, iNumEncoded, gopId ); |
---|
| 1108 | xWriteOutput(bitstreamFile, iNumEncoded, outputAccessUnits, iViewIdx, false); |
---|
| 1109 | outputAccessUnits.clear(); |
---|
| 1110 | if( m_bUsingDepthMaps ) |
---|
[2] | 1111 | { |
---|
[56] | 1112 | Int iNumDepthEncoded = 0; |
---|
| 1113 | // call encoding function for one depth frame |
---|
| 1114 | m_acTEncDepthTopList[iViewIdx]->encode( depthEos[iViewIdx], pcDepthPicYuvOrg, *m_picYuvDepthRec[iViewIdx], outputAccessUnits, iNumDepthEncoded, gopId ); |
---|
| 1115 | xWriteOutput(bitstreamFile, iNumDepthEncoded, outputAccessUnits, iViewIdx, true); |
---|
| 1116 | outputAccessUnits.clear(); |
---|
[2] | 1117 | } |
---|
| 1118 | } |
---|
[210] | 1119 | |
---|
| 1120 | #if FLEX_CODING_ORDER_M23723 |
---|
| 1121 | } |
---|
| 1122 | #endif |
---|
| 1123 | |
---|
[56] | 1124 | #if HHI_INTERVIEW_SKIP || HHI_INTER_VIEW_MOTION_PRED || HHI_INTER_VIEW_RESIDUAL_PRED |
---|
[2] | 1125 | for( Int iViewIdx = 0; iViewIdx < m_iNumberOfViews; iViewIdx++ ) |
---|
| 1126 | { |
---|
| 1127 | if( iViewIdx < (Int)m_acTEncTopList.size() && m_acTEncTopList[iViewIdx] ) |
---|
| 1128 | { |
---|
[56] | 1129 | m_acTEncTopList[iViewIdx]->deleteExtraPicBuffers( m_acTEncTopList[iViewIdx]->getGOPEncoder()->getPocLastCoded() ); |
---|
[2] | 1130 | } |
---|
| 1131 | if( iViewIdx < (Int)m_acTEncDepthTopList.size() && m_acTEncDepthTopList[iViewIdx] ) |
---|
| 1132 | { |
---|
[56] | 1133 | m_acTEncDepthTopList[iViewIdx]->deleteExtraPicBuffers( m_acTEncTopList[iViewIdx]->getGOPEncoder()->getPocLastCoded() ); |
---|
[2] | 1134 | } |
---|
| 1135 | } |
---|
[56] | 1136 | #endif |
---|
| 1137 | for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++ ) |
---|
[2] | 1138 | { |
---|
[56] | 1139 | m_acTEncTopList[iViewIdx]->compressMotion( m_acTEncTopList[iViewIdx]->getGOPEncoder()->getPocLastCoded() ); |
---|
| 1140 | if( m_bUsingDepthMaps ) |
---|
[2] | 1141 | { |
---|
[56] | 1142 | m_acTEncDepthTopList[iViewIdx]->compressMotion( m_acTEncDepthTopList[iViewIdx]->getGOPEncoder()->getPocLastCoded() ); |
---|
[2] | 1143 | } |
---|
| 1144 | } |
---|
| 1145 | } |
---|
[56] | 1146 | gopSize = maxGopSize; |
---|
[2] | 1147 | } |
---|
[56] | 1148 | // delete original YUV buffer |
---|
| 1149 | pcPicYuvOrg->destroy(); |
---|
| 1150 | delete pcPicYuvOrg; |
---|
| 1151 | pcPicYuvOrg = NULL; |
---|
| 1152 | pcDepthPicYuvOrg->destroy(); |
---|
| 1153 | delete pcDepthPicYuvOrg; |
---|
| 1154 | pcDepthPicYuvOrg = NULL; |
---|
| 1155 | |
---|
[210] | 1156 | #if !QC_MVHEVC_B0046 |
---|
| 1157 | #if FIX_DEL_NULLPTR |
---|
| 1158 | if ( pcPdmDepthOrg != NULL && m_uiMultiviewMvRegMode ) |
---|
| 1159 | #else |
---|
[121] | 1160 | if ( pcPdmDepthOrg != NULL ) |
---|
[210] | 1161 | #endif |
---|
[121] | 1162 | { |
---|
| 1163 | pcPdmDepthOrg->destroy(); |
---|
| 1164 | delete pcPdmDepthOrg; |
---|
| 1165 | pcPdmDepthOrg = NULL; |
---|
| 1166 | }; |
---|
[210] | 1167 | #endif |
---|
[121] | 1168 | |
---|
[2] | 1169 | for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++ ) |
---|
| 1170 | { |
---|
| 1171 | m_acTEncTopList[iViewIdx]->printOutSummary(m_acTEncTopList[iViewIdx]->getNumAllPicCoded()); |
---|
| 1172 | if ( m_bUsingDepthMaps ) |
---|
| 1173 | { |
---|
| 1174 | m_acTEncDepthTopList[iViewIdx]->printOutSummary(m_acTEncDepthTopList[iViewIdx]->getNumAllPicCoded()); |
---|
| 1175 | } |
---|
| 1176 | } |
---|
| 1177 | |
---|
[56] | 1178 | // delete buffers & classes |
---|
| 1179 | xDeleteBuffer(); |
---|
| 1180 | xDestroyLib(); |
---|
[2] | 1181 | |
---|
[56] | 1182 | return; |
---|
| 1183 | } |
---|
[2] | 1184 | |
---|
[56] | 1185 | TEncTop* TAppEncTop::getTEncTop( Int viewId, Bool isDepth ) |
---|
| 1186 | { |
---|
| 1187 | if ( isDepth ) |
---|
[2] | 1188 | { |
---|
[56] | 1189 | return m_acTEncDepthTopList[viewId]; |
---|
| 1190 | } |
---|
| 1191 | else |
---|
| 1192 | { |
---|
| 1193 | return m_acTEncTopList[viewId]; |
---|
| 1194 | } |
---|
| 1195 | } |
---|
[2] | 1196 | |
---|
| 1197 | |
---|
| 1198 | // ==================================================================================================================== |
---|
| 1199 | // Protected member functions |
---|
| 1200 | // ==================================================================================================================== |
---|
| 1201 | |
---|
| 1202 | /** |
---|
| 1203 | - application has picture buffer list with size of GOP |
---|
| 1204 | - picture buffer list acts as ring buffer |
---|
| 1205 | - end of the list has the latest picture |
---|
| 1206 | . |
---|
| 1207 | */ |
---|
[56] | 1208 | Void TAppEncTop::xGetBuffer( TComPicYuv*& rpcPicYuvRec, Int iViewIdx, Bool isDepth) |
---|
[2] | 1209 | { |
---|
[56] | 1210 | assert( m_iGOPSize > 0 ); |
---|
| 1211 | |
---|
| 1212 | if( !isDepth ) |
---|
| 1213 | { |
---|
| 1214 | if ( m_picYuvRec[iViewIdx]->size() == (UInt)m_iGOPSize ) |
---|
[2] | 1215 | { |
---|
[56] | 1216 | rpcPicYuvRec = m_picYuvRec[iViewIdx]->popFront(); |
---|
[2] | 1217 | } |
---|
[56] | 1218 | else |
---|
[2] | 1219 | { |
---|
[56] | 1220 | rpcPicYuvRec = new TComPicYuv; |
---|
| 1221 | rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); |
---|
[2] | 1222 | } |
---|
[56] | 1223 | m_picYuvRec[iViewIdx]->pushBack( rpcPicYuvRec ); |
---|
| 1224 | } |
---|
| 1225 | else |
---|
| 1226 | { |
---|
| 1227 | if ( m_picYuvDepthRec[iViewIdx]->size() == (UInt)m_iGOPSize ) |
---|
| 1228 | { |
---|
| 1229 | rpcPicYuvRec = m_picYuvDepthRec[iViewIdx]->popFront(); |
---|
| 1230 | } |
---|
[2] | 1231 | else |
---|
| 1232 | { |
---|
[56] | 1233 | rpcPicYuvRec = new TComPicYuv; |
---|
[2] | 1234 | rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); |
---|
| 1235 | } |
---|
[56] | 1236 | m_picYuvDepthRec[iViewIdx]->pushBack( rpcPicYuvRec ); |
---|
| 1237 | } |
---|
[2] | 1238 | } |
---|
| 1239 | |
---|
| 1240 | Void TAppEncTop::xDeleteBuffer( ) |
---|
| 1241 | { |
---|
[56] | 1242 | for(Int iViewIdx=0; iViewIdx<m_picYuvRec.size(); iViewIdx++) |
---|
[2] | 1243 | { |
---|
[56] | 1244 | if(m_picYuvRec[iViewIdx]) |
---|
[2] | 1245 | { |
---|
[56] | 1246 | TComList<TComPicYuv*>::iterator iterPicYuvRec = m_picYuvRec[iViewIdx]->begin(); |
---|
| 1247 | Int iSize = Int( m_picYuvRec[iViewIdx]->size() ); |
---|
[2] | 1248 | for ( Int i = 0; i < iSize; i++ ) |
---|
| 1249 | { |
---|
[56] | 1250 | TComPicYuv* pcPicYuvRec = *(iterPicYuvRec++); |
---|
| 1251 | if(pcPicYuvRec) |
---|
| 1252 | { |
---|
[2] | 1253 | pcPicYuvRec->destroy(); |
---|
[56] | 1254 | delete pcPicYuvRec; |
---|
| 1255 | pcPicYuvRec = NULL; |
---|
| 1256 | } |
---|
[2] | 1257 | } |
---|
[56] | 1258 | } |
---|
[2] | 1259 | } |
---|
[56] | 1260 | for(Int iViewIdx=0; iViewIdx<m_picYuvDepthRec.size(); iViewIdx++) |
---|
[2] | 1261 | { |
---|
[56] | 1262 | if(m_picYuvDepthRec[iViewIdx]) |
---|
[2] | 1263 | { |
---|
[56] | 1264 | TComList<TComPicYuv*>::iterator iterPicYuvRec = m_picYuvDepthRec[iViewIdx]->begin(); |
---|
| 1265 | Int iSize = Int( m_picYuvDepthRec[iViewIdx]->size() ); |
---|
| 1266 | for ( Int i = 0; i < iSize; i++ ) |
---|
[2] | 1267 | { |
---|
[56] | 1268 | TComPicYuv* pcPicYuvRec = *(iterPicYuvRec++); |
---|
| 1269 | if(pcPicYuvRec) |
---|
| 1270 | { |
---|
| 1271 | pcPicYuvRec->destroy(); |
---|
| 1272 | delete pcPicYuvRec; |
---|
| 1273 | pcPicYuvRec = NULL; |
---|
| 1274 | } |
---|
| 1275 | } |
---|
[2] | 1276 | } |
---|
| 1277 | } |
---|
| 1278 | } |
---|
| 1279 | |
---|
| 1280 | /** \param iNumEncoded number of encoded frames |
---|
| 1281 | */ |
---|
[56] | 1282 | Void TAppEncTop::xWriteOutput(std::ostream& bitstreamFile, Int iNumEncoded, std::list<AccessUnit>& accessUnits, Int iViewIdx, Bool isDepth ) |
---|
[2] | 1283 | { |
---|
[56] | 1284 | Int i; |
---|
| 1285 | |
---|
| 1286 | if( iNumEncoded > 0 ) |
---|
[2] | 1287 | { |
---|
[56] | 1288 | TComList<TComPicYuv*>::iterator iterPicYuvRec = !isDepth ? m_picYuvRec[iViewIdx]->end() : m_picYuvDepthRec[iViewIdx]->end(); |
---|
| 1289 | |
---|
| 1290 | for ( i = 0; i < iNumEncoded; i++ ) |
---|
| 1291 | { |
---|
| 1292 | --iterPicYuvRec; |
---|
| 1293 | } |
---|
| 1294 | |
---|
| 1295 | for ( i = 0; i < iNumEncoded; i++ ) |
---|
| 1296 | { |
---|
| 1297 | TComPicYuv* pcPicYuvRec = *(iterPicYuvRec++); |
---|
| 1298 | if( !isDepth ) |
---|
| 1299 | { |
---|
| 1300 | if (m_pchReconFileList[iViewIdx]) |
---|
| 1301 | { |
---|
| 1302 | #if PIC_CROPPING |
---|
| 1303 | m_acTVideoIOYuvReconFileList[iViewIdx]->write( pcPicYuvRec, m_cropLeft, m_cropRight, m_cropTop, m_cropBottom ); |
---|
| 1304 | #else |
---|
| 1305 | m_acTVideoIOYuvReconFileList[iViewIdx]->write( pcPicYuvRec, m_aiPad ); |
---|
| 1306 | #endif |
---|
| 1307 | } |
---|
| 1308 | } |
---|
| 1309 | else |
---|
| 1310 | { |
---|
| 1311 | if (m_pchDepthReconFileList[iViewIdx]) |
---|
| 1312 | { |
---|
| 1313 | #if PIC_CROPPING |
---|
| 1314 | m_acTVideoIOYuvDepthReconFileList[iViewIdx]->write( pcPicYuvRec, m_cropLeft, m_cropRight, m_cropTop, m_cropBottom ); |
---|
| 1315 | #else |
---|
| 1316 | m_acTVideoIOYuvDepthReconFileList[iViewIdx]->write( pcPicYuvRec, m_aiPad ); |
---|
| 1317 | #endif |
---|
| 1318 | } |
---|
| 1319 | } |
---|
| 1320 | } |
---|
[2] | 1321 | } |
---|
[56] | 1322 | if( ! accessUnits.empty() ) |
---|
[2] | 1323 | { |
---|
[56] | 1324 | list<AccessUnit>::iterator aUIter; |
---|
| 1325 | for( aUIter = accessUnits.begin(); aUIter != accessUnits.end(); aUIter++ ) |
---|
[2] | 1326 | { |
---|
[56] | 1327 | const vector<unsigned>& stats = writeAnnexB(bitstreamFile, *aUIter); |
---|
| 1328 | rateStatsAccum(*aUIter, stats); |
---|
[2] | 1329 | } |
---|
| 1330 | } |
---|
[56] | 1331 | } |
---|
[2] | 1332 | |
---|
| 1333 | |
---|
| 1334 | TComPicYuv* TAppEncTop::xGetPicYuvFromView( Int iViewIdx, Int iPoc, Bool bDepth, Bool bRecon ) |
---|
| 1335 | { |
---|
[5] | 1336 | TComPic* pcPic = xGetPicFromView( iViewIdx, iPoc, bDepth); |
---|
| 1337 | TComPicYuv* pcPicYuv = NULL; |
---|
[2] | 1338 | |
---|
| 1339 | if (pcPic != NULL) |
---|
| 1340 | { |
---|
| 1341 | if( bRecon ) |
---|
| 1342 | { |
---|
| 1343 | if ( pcPic->getReconMark() ) |
---|
| 1344 | { |
---|
[5] | 1345 | pcPicYuv = pcPic->getPicYuvRec(); |
---|
[2] | 1346 | } |
---|
| 1347 | } |
---|
| 1348 | else |
---|
| 1349 | { |
---|
[5] | 1350 | pcPicYuv = pcPic->getPicYuvOrg(); |
---|
| 1351 | } |
---|
[2] | 1352 | }; |
---|
| 1353 | |
---|
[5] | 1354 | return pcPicYuv; |
---|
| 1355 | }; |
---|
[2] | 1356 | |
---|
[56] | 1357 | /** |
---|
| 1358 | * |
---|
| 1359 | */ |
---|
| 1360 | void TAppEncTop::rateStatsAccum(const AccessUnit& au, const std::vector<unsigned>& annexBsizes) |
---|
[2] | 1361 | { |
---|
[56] | 1362 | AccessUnit::const_iterator it_au = au.begin(); |
---|
| 1363 | vector<unsigned>::const_iterator it_stats = annexBsizes.begin(); |
---|
[2] | 1364 | |
---|
[56] | 1365 | for (; it_au != au.end(); it_au++, it_stats++) |
---|
[2] | 1366 | { |
---|
[56] | 1367 | switch ((*it_au)->m_nalUnitType) |
---|
[2] | 1368 | { |
---|
[56] | 1369 | case NAL_UNIT_CODED_SLICE: |
---|
| 1370 | #if H0566_TLA |
---|
[210] | 1371 | #if !QC_REM_IDV_B0046 |
---|
[56] | 1372 | case NAL_UNIT_CODED_SLICE_IDV: |
---|
[210] | 1373 | #endif |
---|
[56] | 1374 | case NAL_UNIT_CODED_SLICE_TLA: |
---|
| 1375 | case NAL_UNIT_CODED_SLICE_CRA: |
---|
| 1376 | #else |
---|
| 1377 | case NAL_UNIT_CODED_SLICE_DATAPART_A: |
---|
| 1378 | case NAL_UNIT_CODED_SLICE_DATAPART_B: |
---|
| 1379 | case NAL_UNIT_CODED_SLICE_CDR: |
---|
| 1380 | #endif |
---|
| 1381 | case NAL_UNIT_CODED_SLICE_IDR: |
---|
| 1382 | case NAL_UNIT_SPS: |
---|
| 1383 | case NAL_UNIT_PPS: |
---|
[77] | 1384 | #if VIDYO_VPS_INTEGRATION |
---|
| 1385 | case NAL_UNIT_VPS: |
---|
| 1386 | #endif |
---|
[56] | 1387 | m_essentialBytes += *it_stats; |
---|
| 1388 | break; |
---|
| 1389 | default: |
---|
| 1390 | break; |
---|
[2] | 1391 | } |
---|
| 1392 | |
---|
[56] | 1393 | m_totalBytes += *it_stats; |
---|
[2] | 1394 | } |
---|
| 1395 | } |
---|
| 1396 | |
---|
[5] | 1397 | #if HHI_INTERVIEW_SKIP |
---|
[2] | 1398 | Void TAppEncTop::getUsedPelsMap( Int iViewIdx, Int iPoc, TComPicYuv* pcPicYuvUsedSplsMap ) |
---|
| 1399 | { |
---|
[5] | 1400 | AOT( iViewIdx <= 0); |
---|
| 1401 | AOT( iViewIdx >= m_iNumberOfViews ); |
---|
| 1402 | AOF( m_cCameraData.getCurFrameId() == iPoc ); |
---|
| 1403 | Int iViewSIdx = m_cCameraData.getBaseId2SortedId()[iViewIdx]; |
---|
| 1404 | Int iFirstViewSIdx = m_cCameraData.getBaseId2SortedId()[0]; |
---|
[2] | 1405 | |
---|
| 1406 | AOT( iViewSIdx == iFirstViewSIdx ); |
---|
| 1407 | |
---|
[5] | 1408 | Bool bFirstIsLeft = (iFirstViewSIdx < iViewSIdx); |
---|
[2] | 1409 | |
---|
[56] | 1410 | m_cUsedPelsRenderer.setShiftLUTs( |
---|
[2] | 1411 | m_cCameraData.getBaseViewShiftLUTD()[0][iViewIdx], |
---|
| 1412 | m_cCameraData.getBaseViewShiftLUTI()[0][iViewIdx], |
---|
| 1413 | m_cCameraData.getBaseViewShiftLUTI()[0][iViewIdx], |
---|
| 1414 | m_cCameraData.getBaseViewShiftLUTD()[0][iViewIdx], |
---|
| 1415 | m_cCameraData.getBaseViewShiftLUTI()[0][iViewIdx], |
---|
| 1416 | m_cCameraData.getBaseViewShiftLUTI()[0][iViewIdx], |
---|
| 1417 | -1 |
---|
[5] | 1418 | ); |
---|
[2] | 1419 | |
---|
| 1420 | TComPicYuv* pcPicYuvDepth = xGetPicYuvFromView(0, iPoc, true, true ); |
---|
[5] | 1421 | AOF( pcPicYuvDepth); |
---|
[2] | 1422 | |
---|
[5] | 1423 | m_cUsedPelsRenderer.getUsedSamplesMap( pcPicYuvDepth, pcPicYuvUsedSplsMap, bFirstIsLeft ); |
---|
[2] | 1424 | } |
---|
[5] | 1425 | #endif |
---|
| 1426 | #if HHI_VSO |
---|
[100] | 1427 | Void TAppEncTop::setupRenModel( Int iPoc, Int iEncViewIdx, Int iEncContent, Int iHorOffset ) |
---|
| 1428 | { |
---|
[124] | 1429 | m_cRendererModel.setupPart( iHorOffset, Min( g_uiMaxCUHeight, m_iSourceHeight - iHorOffset ) ); |
---|
[5] | 1430 | Int iEncViewSIdx = m_cCameraData.getBaseId2SortedId()[ iEncViewIdx ]; |
---|
[2] | 1431 | |
---|
| 1432 | // setup base views |
---|
[5] | 1433 | Int iNumOfBV = m_cRenModStrParser.getNumOfBaseViewsForView( iEncViewSIdx, iEncContent ); |
---|
[2] | 1434 | |
---|
| 1435 | for (Int iCurView = 0; iCurView < iNumOfBV; iCurView++ ) |
---|
[5] | 1436 | { |
---|
| 1437 | Int iBaseViewSIdx; |
---|
| 1438 | Int iVideoDistMode; |
---|
| 1439 | Int iDepthDistMode; |
---|
[2] | 1440 | |
---|
[5] | 1441 | m_cRenModStrParser.getBaseViewData( iEncViewSIdx, iEncContent, iCurView, iBaseViewSIdx, iVideoDistMode, iDepthDistMode ); |
---|
[2] | 1442 | |
---|
[5] | 1443 | AOT( iVideoDistMode < 0 || iVideoDistMode > 2 ); |
---|
[2] | 1444 | |
---|
[5] | 1445 | Int iBaseViewIdx = m_cCameraData.getBaseSortedId2Id()[ iBaseViewSIdx ]; |
---|
[2] | 1446 | |
---|
[5] | 1447 | TComPicYuv* pcPicYuvVideoRec = xGetPicYuvFromView( iBaseViewIdx, iPoc, false, true ); |
---|
| 1448 | TComPicYuv* pcPicYuvDepthRec = xGetPicYuvFromView( iBaseViewIdx, iPoc, true , true ); |
---|
| 1449 | TComPicYuv* pcPicYuvVideoOrg = xGetPicYuvFromView( iBaseViewIdx, iPoc, false, false ); |
---|
| 1450 | TComPicYuv* pcPicYuvDepthOrg = xGetPicYuvFromView( iBaseViewIdx, iPoc, true , false ); |
---|
[2] | 1451 | |
---|
[5] | 1452 | TComPicYuv* pcPicYuvVideoRef = ( iVideoDistMode == 2 ) ? pcPicYuvVideoOrg : NULL; |
---|
| 1453 | TComPicYuv* pcPicYuvDepthRef = ( iDepthDistMode == 2 ) ? pcPicYuvDepthOrg : NULL; |
---|
[2] | 1454 | |
---|
[5] | 1455 | TComPicYuv* pcPicYuvVideoTest = ( iVideoDistMode == 0 ) ? pcPicYuvVideoOrg : pcPicYuvVideoRec; |
---|
| 1456 | TComPicYuv* pcPicYuvDepthTest = ( iDepthDistMode == 0 ) ? pcPicYuvDepthOrg : pcPicYuvDepthRec; |
---|
| 1457 | |
---|
| 1458 | AOT( (iVideoDistMode == 2) != (pcPicYuvVideoRef != NULL) ); |
---|
| 1459 | AOT( (iDepthDistMode == 2) != (pcPicYuvDepthRef != NULL) ); |
---|
| 1460 | AOT( pcPicYuvDepthTest == NULL ); |
---|
| 1461 | AOT( pcPicYuvVideoTest == NULL ); |
---|
| 1462 | |
---|
| 1463 | m_cRendererModel.setBaseView( iBaseViewSIdx, pcPicYuvVideoTest, pcPicYuvDepthTest, pcPicYuvVideoRef, pcPicYuvDepthRef ); |
---|
[2] | 1464 | } |
---|
| 1465 | |
---|
[5] | 1466 | m_cRendererModel.setErrorMode( iEncViewSIdx, iEncContent, 0 ); |
---|
[2] | 1467 | // setup virtual views |
---|
[5] | 1468 | Int iNumOfSV = m_cRenModStrParser.getNumOfModelsForView( iEncViewSIdx, iEncContent ); |
---|
[2] | 1469 | for (Int iCurView = 0; iCurView < iNumOfSV; iCurView++ ) |
---|
[5] | 1470 | { |
---|
| 1471 | Int iOrgRefBaseViewSIdx; |
---|
| 1472 | Int iLeftBaseViewSIdx; |
---|
| 1473 | Int iRightBaseViewSIdx; |
---|
| 1474 | Int iSynthViewRelNum; |
---|
| 1475 | Int iModelNum; |
---|
| 1476 | Int iBlendMode; |
---|
| 1477 | m_cRenModStrParser.getSingleModelData(iEncViewSIdx, iEncContent, iCurView, iModelNum, iBlendMode,iLeftBaseViewSIdx, iRightBaseViewSIdx, iOrgRefBaseViewSIdx, iSynthViewRelNum ); |
---|
[2] | 1478 | |
---|
[5] | 1479 | Int iLeftBaseViewIdx = -1; |
---|
| 1480 | Int iRightBaseViewIdx = -1; |
---|
[2] | 1481 | |
---|
[5] | 1482 | TComPicYuv* pcPicYuvOrgRef = NULL; |
---|
| 1483 | Int** ppiShiftLUTLeft = NULL; |
---|
| 1484 | Int** ppiShiftLUTRight = NULL; |
---|
| 1485 | Int** ppiBaseShiftLUTLeft = NULL; |
---|
| 1486 | Int** ppiBaseShiftLUTRight = NULL; |
---|
[2] | 1487 | |
---|
| 1488 | |
---|
[5] | 1489 | Int iDistToLeft = -1; |
---|
[2] | 1490 | |
---|
[5] | 1491 | Int iSynthViewIdx = m_cCameraData.synthRelNum2Idx( iSynthViewRelNum ); |
---|
[2] | 1492 | |
---|
| 1493 | if ( iLeftBaseViewSIdx != -1 ) |
---|
| 1494 | { |
---|
[5] | 1495 | iLeftBaseViewIdx = m_cCameraData.getBaseSortedId2Id() [ iLeftBaseViewSIdx ]; |
---|
[2] | 1496 | ppiShiftLUTLeft = m_cCameraData.getSynthViewShiftLUTI()[ iLeftBaseViewIdx ][ iSynthViewIdx ]; |
---|
| 1497 | } |
---|
| 1498 | |
---|
| 1499 | if ( iRightBaseViewSIdx != -1 ) |
---|
| 1500 | { |
---|
[5] | 1501 | iRightBaseViewIdx = m_cCameraData.getBaseSortedId2Id() [iRightBaseViewSIdx ]; |
---|
[2] | 1502 | ppiShiftLUTRight = m_cCameraData.getSynthViewShiftLUTI()[ iRightBaseViewIdx ][ iSynthViewIdx ]; |
---|
| 1503 | } |
---|
| 1504 | |
---|
| 1505 | if ( iRightBaseViewSIdx != -1 && iLeftBaseViewSIdx != -1 ) |
---|
[5] | 1506 | { |
---|
| 1507 | iDistToLeft = m_cCameraData.getRelDistLeft( iSynthViewIdx , iLeftBaseViewIdx, iRightBaseViewIdx); |
---|
[2] | 1508 | ppiBaseShiftLUTLeft = m_cCameraData.getBaseViewShiftLUTI() [ iLeftBaseViewIdx ][ iRightBaseViewIdx ]; |
---|
| 1509 | ppiBaseShiftLUTRight = m_cCameraData.getBaseViewShiftLUTI() [ iRightBaseViewIdx ][ iLeftBaseViewIdx ]; |
---|
| 1510 | |
---|
| 1511 | } |
---|
| 1512 | |
---|
| 1513 | if ( iOrgRefBaseViewSIdx != -1 ) |
---|
| 1514 | { |
---|
[5] | 1515 | pcPicYuvOrgRef = xGetPicYuvFromView( m_cCameraData.getBaseSortedId2Id()[ iOrgRefBaseViewSIdx ] , iPoc, false, false ); |
---|
| 1516 | AOF ( pcPicYuvOrgRef ); |
---|
| 1517 | } |
---|
[2] | 1518 | |
---|
[5] | 1519 | m_cRendererModel.setSingleModel( iModelNum, ppiShiftLUTLeft, ppiBaseShiftLUTLeft, ppiShiftLUTRight, ppiBaseShiftLUTRight, iDistToLeft, pcPicYuvOrgRef ); |
---|
[2] | 1520 | } |
---|
| 1521 | } |
---|
[5] | 1522 | #endif |
---|
[2] | 1523 | |
---|
[56] | 1524 | |
---|
| 1525 | |
---|
| 1526 | /* |
---|
| 1527 | void TAppEncTop::printRateSummary() |
---|
| 1528 | { |
---|
| 1529 | double time = (double) m_iFrameRcvd / m_iFrameRate; |
---|
| 1530 | printf("Bytes written to file: %u (%.3f kbps)\n", m_totalBytes, 0.008 * m_totalBytes / time); |
---|
| 1531 | #if VERBOSE_RATE |
---|
| 1532 | printf("Bytes for SPS/PPS/Slice (Incl. Annex B): %u (%.3f kbps)\n", m_essentialBytes, 0.008 * m_essentialBytes / time); |
---|
| 1533 | #endif |
---|
| 1534 | } |
---|
| 1535 | */ |
---|
| 1536 | |
---|
| 1537 | std::vector<TComPic*> TAppEncTop::getInterViewRefPics( Int viewId, Int poc, Bool isDepth, TComSPS* sps ) |
---|
| 1538 | { |
---|
| 1539 | std::vector<TComPic*> apcRefPics( sps->getNumberOfUsableInterViewRefs(), (TComPic*)NULL ); |
---|
| 1540 | for( Int k = 0; k < sps->getNumberOfUsableInterViewRefs(); k++ ) |
---|
| 1541 | { |
---|
| 1542 | TComPic* pcRefPic = xGetPicFromView( sps->getUsableInterViewRef( k ) + viewId, poc, isDepth ); |
---|
| 1543 | assert( pcRefPic != NULL ); |
---|
| 1544 | apcRefPics[k] = pcRefPic; |
---|
| 1545 | } |
---|
| 1546 | return apcRefPics; |
---|
| 1547 | } |
---|
| 1548 | |
---|
| 1549 | TComPic* TAppEncTop::xGetPicFromView( Int viewIdx, Int poc, Bool isDepth ) |
---|
| 1550 | { |
---|
| 1551 | assert( ( viewIdx >= 0 ) && ( viewIdx < m_iNumberOfViews ) ); |
---|
| 1552 | |
---|
| 1553 | TComList<TComPic*>* apcListPic = (isDepth ? m_acTEncDepthTopList[viewIdx] : m_acTEncTopList[viewIdx])->getListPic() ; |
---|
| 1554 | |
---|
| 1555 | TComPic* pcPic = NULL; |
---|
| 1556 | for(TComList<TComPic*>::iterator it=apcListPic->begin(); it!=apcListPic->end(); it++) |
---|
| 1557 | { |
---|
| 1558 | if( (*it)->getPOC() == poc ) |
---|
| 1559 | { |
---|
| 1560 | pcPic = *it ; |
---|
| 1561 | break ; |
---|
| 1562 | } |
---|
| 1563 | } |
---|
| 1564 | |
---|
| 1565 | return pcPic; |
---|
| 1566 | }; |
---|
[189] | 1567 | |
---|
| 1568 | #if RWTH_SDC_DLT_B0036 |
---|
| 1569 | Void TAppEncTop::xAnalyzeInputBaseDepth(Int iViewIdx, UInt uiNumFrames) |
---|
| 1570 | { |
---|
| 1571 | TComPicYuv* pcDepthPicYuvOrg = new TComPicYuv; |
---|
| 1572 | // allocate original YUV buffer |
---|
| 1573 | pcDepthPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); |
---|
| 1574 | |
---|
| 1575 | TVideoIOYuv* depthVideoFile = new TVideoIOYuv; |
---|
| 1576 | |
---|
| 1577 | UInt uiMaxDepthValue = g_uiIBDI_MAX; |
---|
| 1578 | |
---|
| 1579 | Bool abValidDepths[256]; |
---|
| 1580 | |
---|
| 1581 | depthVideoFile->open( m_pchDepthInputFileList[iViewIdx], false, m_uiInputBitDepth, m_uiInternalBitDepth ); // read mode |
---|
| 1582 | |
---|
| 1583 | // initialize boolean array |
---|
| 1584 | for(Int p=0; p<=uiMaxDepthValue; p++) |
---|
| 1585 | abValidDepths[p] = false; |
---|
| 1586 | |
---|
| 1587 | Int iHeight = pcDepthPicYuvOrg->getHeight(); |
---|
| 1588 | Int iWidth = pcDepthPicYuvOrg->getWidth(); |
---|
| 1589 | Int iStride = pcDepthPicYuvOrg->getStride(); |
---|
| 1590 | |
---|
| 1591 | Pel* pInDM = pcDepthPicYuvOrg->getLumaAddr(); |
---|
| 1592 | |
---|
| 1593 | for(Int uiFrame=0; uiFrame < uiNumFrames; uiFrame++ ) |
---|
| 1594 | { |
---|
| 1595 | depthVideoFile->read( pcDepthPicYuvOrg, m_aiPad, false ); |
---|
| 1596 | |
---|
| 1597 | // check all pixel values |
---|
| 1598 | for (Int i=0; i<iHeight; i++) |
---|
| 1599 | { |
---|
| 1600 | Int rowOffset = i*iStride; |
---|
| 1601 | |
---|
| 1602 | for (Int j=0; j<iWidth; j++) |
---|
| 1603 | { |
---|
| 1604 | Pel depthValue = pInDM[rowOffset+j]; |
---|
| 1605 | abValidDepths[depthValue] = true; |
---|
| 1606 | } |
---|
| 1607 | } |
---|
| 1608 | } |
---|
| 1609 | |
---|
| 1610 | depthVideoFile->close(); |
---|
| 1611 | |
---|
| 1612 | pcDepthPicYuvOrg->destroy(); |
---|
| 1613 | delete pcDepthPicYuvOrg; |
---|
| 1614 | |
---|
| 1615 | // convert boolean array to idx2Depth LUT |
---|
| 1616 | UInt* auiIdx2DepthValue = (UInt*) calloc(uiMaxDepthValue, sizeof(UInt)); |
---|
| 1617 | UInt uiNumDepthValues = 0; |
---|
| 1618 | for(UInt p=0; p<=uiMaxDepthValue; p++) |
---|
| 1619 | { |
---|
| 1620 | if( abValidDepths[p] == true) |
---|
| 1621 | { |
---|
| 1622 | auiIdx2DepthValue[uiNumDepthValues++] = p; |
---|
| 1623 | } |
---|
| 1624 | } |
---|
| 1625 | |
---|
| 1626 | if( uiNumFrames == 0 || ceil(Log2(uiNumDepthValues)) == ceil(Log2(g_uiIBDI_MAX)) ) |
---|
| 1627 | { |
---|
| 1628 | // don't use DLT |
---|
| 1629 | m_acTEncDepthTopList[iViewIdx]->setUseDLT(false); |
---|
| 1630 | m_acTEncDepthTopList[iViewIdx]->getSPS()->setUseDLT(false); |
---|
| 1631 | } |
---|
| 1632 | |
---|
| 1633 | // assign LUT |
---|
| 1634 | if( m_acTEncDepthTopList[iViewIdx]->getUseDLT() ) |
---|
| 1635 | m_acTEncDepthTopList[iViewIdx]->getSPS()->setDepthLUTs(auiIdx2DepthValue, uiNumDepthValues); |
---|
| 1636 | else |
---|
| 1637 | m_acTEncDepthTopList[iViewIdx]->getSPS()->setDepthLUTs(); |
---|
| 1638 | |
---|
| 1639 | // free temporary memory |
---|
| 1640 | free(auiIdx2DepthValue); |
---|
| 1641 | } |
---|
| 1642 | #endif |
---|
[56] | 1643 | |
---|
| 1644 | //! \} |
---|