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