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