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