[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 | { |
---|
| 69 | for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) |
---|
| 70 | { |
---|
[56] | 71 | m_frameRcvd.push_back(0); |
---|
| 72 | m_acTEncTopList.push_back(new TEncTop); |
---|
[2] | 73 | m_acTVideoIOYuvInputFileList.push_back(new TVideoIOYuv); |
---|
[56] | 74 | m_acTVideoIOYuvReconFileList.push_back(new TVideoIOYuv); |
---|
| 75 | m_picYuvRec.push_back(new TComList<TComPicYuv*>) ; |
---|
[2] | 76 | |
---|
| 77 | m_acTEncTopList[iViewIdx]->setFrameRate ( m_iFrameRate ); |
---|
| 78 | m_acTEncTopList[iViewIdx]->setFrameSkip ( m_FrameSkip ); |
---|
| 79 | m_acTEncTopList[iViewIdx]->setSourceWidth ( m_iSourceWidth ); |
---|
| 80 | m_acTEncTopList[iViewIdx]->setSourceHeight ( m_iSourceHeight ); |
---|
[56] | 81 | #if PIC_CROPPING |
---|
| 82 | m_acTEncTopList[iViewIdx]->setCroppingMode ( m_croppingMode ); |
---|
| 83 | m_acTEncTopList[iViewIdx]->setCropLeft ( m_cropLeft ); |
---|
| 84 | m_acTEncTopList[iViewIdx]->setCropRight ( m_cropRight ); |
---|
| 85 | m_acTEncTopList[iViewIdx]->setCropTop ( m_cropTop ); |
---|
| 86 | m_acTEncTopList[iViewIdx]->setCropBottom ( m_cropBottom ); |
---|
| 87 | #endif |
---|
[2] | 88 | m_acTEncTopList[iViewIdx]->setFrameToBeEncoded ( m_iFrameToBeEncoded ); |
---|
[56] | 89 | m_acTEncTopList[iViewIdx]->setViewId ( iViewIdx ); |
---|
| 90 | m_acTEncTopList[iViewIdx]->setIsDepth ( false ); |
---|
| 91 | m_acTEncTopList[iViewIdx]->setViewOrderIdx ( m_cCameraData.getViewOrderIndex()[ iViewIdx ] ); |
---|
| 92 | m_acTEncTopList[iViewIdx]->setCamParPrecision ( m_cCameraData.getCamParsCodedPrecision () ); |
---|
| 93 | m_acTEncTopList[iViewIdx]->setCamParInSliceHeader ( m_cCameraData.getVaryingCameraParameters() ); |
---|
| 94 | m_acTEncTopList[iViewIdx]->setCodedScale ( m_cCameraData.getCodedScale () ); |
---|
| 95 | m_acTEncTopList[iViewIdx]->setCodedOffset ( m_cCameraData.getCodedOffset () ); |
---|
[2] | 96 | |
---|
| 97 | //====== Coding Structure ======== |
---|
[56] | 98 | m_acTEncTopList[iViewIdx]->setIntraPeriod ( m_iIntraPeriod ); |
---|
[2] | 99 | m_acTEncTopList[iViewIdx]->setDecodingRefreshType ( m_iDecodingRefreshType ); |
---|
[56] | 100 | m_acTEncTopList[iViewIdx]->setGOPSize ( m_iGOPSize ); |
---|
| 101 | m_acTEncTopList[iViewIdx]->setGopList ( m_GOPListsMvc[iViewIdx] ); |
---|
| 102 | m_acTEncTopList[iViewIdx]->setExtraRPSs ( m_extraRPSs[iViewIdx] ); |
---|
| 103 | #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER |
---|
| 104 | for(Int i = 0; i < MAX_TLAYER; i++) |
---|
| 105 | { |
---|
| 106 | m_acTEncTopList[iViewIdx]->setNumReorderPics ( m_numReorderPics[iViewIdx][i], i ); |
---|
| 107 | m_acTEncTopList[iViewIdx]->setMaxDecPicBuffering ( m_maxDecPicBuffering[iViewIdx][i], i ); |
---|
| 108 | } |
---|
| 109 | #else |
---|
| 110 | m_acTEncTopList[iViewIdx]->setNumReorderFrames ( m_numReorderFrames ); |
---|
| 111 | m_acTEncTopList[iViewIdx]->setMaxNumberOfReferencePictures ( m_maxNumberOfReferencePictures ); |
---|
[2] | 112 | #endif |
---|
[56] | 113 | for( UInt uiLoop = 0; uiLoop < MAX_TLAYER; ++uiLoop ) |
---|
| 114 | { |
---|
| 115 | m_acTEncTopList[iViewIdx]->setLambdaModifier( uiLoop, m_adLambdaModifier[ uiLoop ] ); |
---|
| 116 | } |
---|
[2] | 117 | m_acTEncTopList[iViewIdx]->setQP ( m_aiQP[0] ); |
---|
[56] | 118 | |
---|
[2] | 119 | m_acTEncTopList[iViewIdx]->setTemporalLayerQPOffset ( m_aiTLayerQPOffset ); |
---|
| 120 | m_acTEncTopList[iViewIdx]->setPad ( m_aiPad ); |
---|
[56] | 121 | |
---|
| 122 | #if H0566_TLA |
---|
| 123 | m_acTEncTopList[iViewIdx]->setMaxTempLayer ( m_maxTempLayer[iViewIdx] ); |
---|
| 124 | #else |
---|
| 125 | m_acTEncTopList[iViewIdx]->setTLayering ( m_bTLayering ); |
---|
| 126 | m_acTEncTopList[iViewIdx]->setTLayerSwitchingFlag ( m_abTLayerSwitchingFlag ); |
---|
| 127 | #endif |
---|
[2] | 128 | |
---|
[56] | 129 | m_acTEncTopList[iViewIdx]->setDisInter4x4 ( m_bDisInter4x4); |
---|
| 130 | |
---|
| 131 | m_acTEncTopList[iViewIdx]->setUseNSQT( m_enableNSQT ); |
---|
| 132 | m_acTEncTopList[iViewIdx]->setUseAMP( m_enableAMP ); |
---|
| 133 | |
---|
| 134 | //===== Slice ======== |
---|
| 135 | |
---|
| 136 | //====== Loop/Deblock Filter ======== |
---|
| 137 | m_acTEncTopList[iViewIdx]->setLoopFilterDisable ( m_abLoopFilterDisable[0] ); |
---|
| 138 | m_acTEncTopList[iViewIdx]->setLoopFilterOffsetInAPS ( m_loopFilterOffsetInAPS ); |
---|
| 139 | m_acTEncTopList[iViewIdx]->setLoopFilterBetaOffset ( m_loopFilterBetaOffsetDiv2 ); |
---|
| 140 | m_acTEncTopList[iViewIdx]->setLoopFilterTcOffset ( m_loopFilterTcOffsetDiv2 ); |
---|
| 141 | #if DBL_CONTROL |
---|
| 142 | m_acTEncTopList[iViewIdx]->setDeblockingFilterControlPresent( m_DeblockingFilterControlPresent); |
---|
| 143 | #endif |
---|
[2] | 144 | |
---|
[56] | 145 | //====== Motion search ======== |
---|
[2] | 146 | m_acTEncTopList[iViewIdx]->setFastSearch ( m_iFastSearch ); |
---|
| 147 | m_acTEncTopList[iViewIdx]->setSearchRange ( m_iSearchRange ); |
---|
| 148 | m_acTEncTopList[iViewIdx]->setBipredSearchRange ( m_bipredSearchRange ); |
---|
[56] | 149 | |
---|
| 150 | //====== Quality control ======== |
---|
[2] | 151 | m_acTEncTopList[iViewIdx]->setMaxDeltaQP ( m_iMaxDeltaQP ); |
---|
[56] | 152 | m_acTEncTopList[iViewIdx]->setMaxCuDQPDepth ( m_iMaxCuDQPDepth ); |
---|
[2] | 153 | |
---|
[56] | 154 | m_acTEncTopList[iViewIdx]->setChromaQpOffset ( m_iChromaQpOffset ); |
---|
| 155 | m_acTEncTopList[iViewIdx]->setChromaQpOffset2nd ( m_iChromaQpOffset2nd ); |
---|
| 156 | |
---|
| 157 | #if ADAPTIVE_QP_SELECTION |
---|
| 158 | m_acTEncTopList[iViewIdx]->setUseAdaptQpSelect ( m_bUseAdaptQpSelect ); |
---|
| 159 | #endif |
---|
| 160 | |
---|
| 161 | #if LOSSLESS_CODING |
---|
| 162 | Int lowestQP; |
---|
| 163 | #if H0736_AVC_STYLE_QP_RANGE |
---|
| 164 | lowestQP = - ( (Int)(6*(g_uiBitDepth + g_uiBitIncrement - 8)) ); |
---|
| 165 | #else |
---|
| 166 | lowestQP = 0; |
---|
| 167 | #endif |
---|
| 168 | if ((m_iMaxDeltaQP == 0 ) && (m_aiQP[0] == lowestQP) && (m_useLossless == true)) |
---|
| 169 | { |
---|
| 170 | m_bUseAdaptiveQP = false; |
---|
| 171 | } |
---|
| 172 | #endif |
---|
| 173 | |
---|
| 174 | m_acTEncTopList[iViewIdx]->setUseAdaptiveQP ( m_bUseAdaptiveQP ); |
---|
| 175 | m_acTEncTopList[iViewIdx]->setQPAdaptationRange ( m_iQPAdaptationRange ); |
---|
| 176 | |
---|
[5] | 177 | #if HHI_VSO |
---|
[2] | 178 | //====== VSO ========= |
---|
| 179 | m_acTEncTopList[iViewIdx]->setForceLambdaScaleVSO ( false ); |
---|
| 180 | m_acTEncTopList[iViewIdx]->setLambdaScaleVSO ( 1 ); |
---|
| 181 | m_acTEncTopList[iViewIdx]->setVSOMode ( 0 ); |
---|
[56] | 182 | m_acTEncTopList[iViewIdx]->setUseVSO ( false ); //GT: might be enabled later for VSO Mode 4 |
---|
[5] | 183 | #endif |
---|
[2] | 184 | |
---|
[56] | 185 | #if DEPTH_MAP_GENERATION |
---|
| 186 | m_acTEncTopList[iViewIdx]->setPredDepthMapGeneration ( m_uiPredDepthMapGeneration ); |
---|
| 187 | m_acTEncTopList[iViewIdx]->setPdmPrecision ( (UInt)m_cCameraData.getPdmPrecision () ); |
---|
| 188 | m_acTEncTopList[iViewIdx]->setPdmScaleNomDelta ( m_cCameraData.getPdmScaleNomDelta () ); |
---|
| 189 | m_acTEncTopList[iViewIdx]->setPdmOffset ( m_cCameraData.getPdmOffset () ); |
---|
| 190 | #endif |
---|
| 191 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
| 192 | m_acTEncTopList[iViewIdx]->setMultiviewMvPredMode ( m_uiMultiviewMvPredMode ); |
---|
| 193 | m_acTEncTopList[iViewIdx]->setMultiviewMvRegMode ( iViewIdx ? m_uiMultiviewMvRegMode : 0 ); |
---|
| 194 | m_acTEncTopList[iViewIdx]->setMultiviewMvRegLambdaScale ( iViewIdx ? m_dMultiviewMvRegLambdaScale : 0.0 ); |
---|
| 195 | #endif |
---|
| 196 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
| 197 | m_acTEncTopList[iViewIdx]->setMultiviewResPredMode ( m_uiMultiviewResPredMode ); |
---|
| 198 | #endif |
---|
| 199 | |
---|
| 200 | //====== Tool list ======== |
---|
[2] | 201 | m_acTEncTopList[iViewIdx]->setUseSBACRD ( m_bUseSBACRD ); |
---|
| 202 | m_acTEncTopList[iViewIdx]->setDeltaQpRD ( m_uiDeltaQpRD ); |
---|
| 203 | m_acTEncTopList[iViewIdx]->setUseASR ( m_bUseASR ); |
---|
| 204 | m_acTEncTopList[iViewIdx]->setUseHADME ( m_bUseHADME ); |
---|
| 205 | m_acTEncTopList[iViewIdx]->setUseALF ( m_abUseALF[0] ); |
---|
| 206 | m_acTEncTopList[iViewIdx]->setALFEncodePassReduction ( m_iALFEncodePassReduction ); |
---|
[56] | 207 | #if LOSSLESS_CODING |
---|
| 208 | m_acTEncTopList[iViewIdx]->setUseLossless ( m_useLossless ); |
---|
[2] | 209 | #endif |
---|
[56] | 210 | m_acTEncTopList[iViewIdx]->setALFMaxNumberFilters ( m_iALFMaxNumberFilters ) ; |
---|
| 211 | |
---|
[2] | 212 | m_acTEncTopList[iViewIdx]->setUseLComb ( m_bUseLComb ); |
---|
| 213 | m_acTEncTopList[iViewIdx]->setLCMod ( m_bLCMod ); |
---|
| 214 | m_acTEncTopList[iViewIdx]->setdQPs ( m_aidQP ); |
---|
| 215 | m_acTEncTopList[iViewIdx]->setUseRDOQ ( m_abUseRDOQ[0] ); |
---|
[56] | 216 | #if !PIC_CROPPING |
---|
[2] | 217 | m_acTEncTopList[iViewIdx]->setUsePAD ( m_bUsePAD ); |
---|
[56] | 218 | #endif |
---|
[2] | 219 | m_acTEncTopList[iViewIdx]->setQuadtreeTULog2MaxSize ( m_uiQuadtreeTULog2MaxSize ); |
---|
| 220 | m_acTEncTopList[iViewIdx]->setQuadtreeTULog2MinSize ( m_uiQuadtreeTULog2MinSize ); |
---|
| 221 | m_acTEncTopList[iViewIdx]->setQuadtreeTUMaxDepthInter ( m_uiQuadtreeTUMaxDepthInter ); |
---|
| 222 | m_acTEncTopList[iViewIdx]->setQuadtreeTUMaxDepthIntra ( m_uiQuadtreeTUMaxDepthIntra ); |
---|
| 223 | m_acTEncTopList[iViewIdx]->setUseFastEnc ( m_bUseFastEnc ); |
---|
[56] | 224 | m_acTEncTopList[iViewIdx]->setUseEarlyCU ( m_bUseEarlyCU ); |
---|
| 225 | #if FAST_DECISION_FOR_MRG_RD_COST |
---|
| 226 | m_acTEncTopList[iViewIdx]->setUseFastDecisionForMerge ( m_useFastDecisionForMerge ); |
---|
[5] | 227 | #endif |
---|
[56] | 228 | m_acTEncTopList[iViewIdx]->setUseCbfFastMode ( m_bUseCbfFastMode ); |
---|
| 229 | #if HHI_INTERVIEW_SKIP |
---|
| 230 | m_acTEncTopList[iViewIdx]->setInterViewSkip ( iViewIdx>0 ? m_bInterViewSkip : false ); |
---|
| 231 | #if HHI_INTERVIEW_SKIP_LAMBDA_SCALE |
---|
| 232 | m_acTEncTopList[iViewIdx]->setInterViewSkipLambdaScale ( iViewIdx>0 ? (UInt)m_dInterViewSkipLambdaScale : 1 ); |
---|
[42] | 233 | #endif |
---|
[5] | 234 | #endif |
---|
[56] | 235 | m_acTEncTopList[iViewIdx]->setUseLMChroma ( m_bUseLMChroma ); |
---|
| 236 | m_acTEncTopList[iViewIdx]->setUseConstrainedIntraPred ( m_bUseConstrainedIntraPred ); |
---|
| 237 | m_acTEncTopList[iViewIdx]->setPCMLog2MinSize ( m_uiPCMLog2MinSize); |
---|
| 238 | m_acTEncTopList[iViewIdx]->setUsePCM ( m_usePCM ); |
---|
| 239 | m_acTEncTopList[iViewIdx]->setPCMLog2MaxSize ( m_pcmLog2MaxSize); |
---|
[2] | 240 | |
---|
[56] | 241 | //====== Weighted Prediction ======== |
---|
| 242 | m_acTEncTopList[iViewIdx]->setUseWP ( m_bUseWeightPred ); |
---|
| 243 | m_acTEncTopList[iViewIdx]->setWPBiPredIdc ( m_uiBiPredIdc ); |
---|
| 244 | //====== Slice ======== |
---|
| 245 | m_acTEncTopList[iViewIdx]->setSliceMode ( m_iSliceMode ); |
---|
| 246 | m_acTEncTopList[iViewIdx]->setSliceArgument ( m_iSliceArgument ); |
---|
[5] | 247 | |
---|
[56] | 248 | //====== Entropy Slice ======== |
---|
| 249 | m_acTEncTopList[iViewIdx]->setEntropySliceMode ( m_iEntropySliceMode ); |
---|
| 250 | m_acTEncTopList[iViewIdx]->setEntropySliceArgument ( m_iEntropySliceArgument ); |
---|
| 251 | int iNumPartInCU = 1<<(m_uiMaxCUDepth<<1); |
---|
| 252 | if(m_iEntropySliceMode==SHARP_FIXED_NUMBER_OF_LCU_IN_ENTROPY_SLICE) |
---|
| 253 | { |
---|
| 254 | m_acTEncTopList[iViewIdx]->setEntropySliceArgument ( m_iEntropySliceArgument * ( iNumPartInCU >> ( m_iSliceGranularity << 1 ) ) ); |
---|
| 255 | } |
---|
| 256 | if(m_iSliceMode==AD_HOC_SLICES_FIXED_NUMBER_OF_LCU_IN_SLICE) |
---|
| 257 | { |
---|
| 258 | m_acTEncTopList[iViewIdx]->setSliceArgument ( m_iSliceArgument * ( iNumPartInCU >> ( m_iSliceGranularity << 1 ) ) ); |
---|
| 259 | } |
---|
| 260 | #if FIXED_NUMBER_OF_TILES_SLICE_MODE |
---|
| 261 | if(m_iSliceMode==AD_HOC_SLICES_FIXED_NUMBER_OF_TILES_IN_SLICE) |
---|
| 262 | { |
---|
| 263 | m_acTEncTopList[iViewIdx]->setSliceArgument ( m_iSliceArgument ); |
---|
| 264 | } |
---|
[2] | 265 | #endif |
---|
[56] | 266 | m_acTEncTopList[iViewIdx]->setSliceGranularity ( m_iSliceGranularity ); |
---|
| 267 | if(m_iSliceMode == 0 ) |
---|
| 268 | { |
---|
| 269 | m_bLFCrossSliceBoundaryFlag = true; |
---|
| 270 | } |
---|
| 271 | m_acTEncTopList[iViewIdx]->setLFCrossSliceBoundaryFlag( m_bLFCrossSliceBoundaryFlag ); |
---|
| 272 | m_acTEncTopList[iViewIdx]->setUseSAO ( m_abUseSAO[0] ); |
---|
| 273 | #if SAO_UNIT_INTERLEAVING |
---|
| 274 | m_acTEncTopList[iViewIdx]->setMaxNumOffsetsPerPic (m_maxNumOffsetsPerPic); |
---|
| 275 | m_acTEncTopList[iViewIdx]->setSaoInterleavingFlag (m_saoInterleavingFlag); |
---|
[2] | 276 | #endif |
---|
[56] | 277 | m_acTEncTopList[iViewIdx]->setPCMInputBitDepthFlag ( m_bPCMInputBitDepthFlag); |
---|
| 278 | m_acTEncTopList[iViewIdx]->setPCMFilterDisableFlag ( m_bPCMFilterDisableFlag); |
---|
[2] | 279 | |
---|
[56] | 280 | m_acTEncTopList[iViewIdx]->setPictureDigestEnabled(m_pictureDigestEnabled); |
---|
[2] | 281 | |
---|
[56] | 282 | m_acTEncTopList[iViewIdx]->setColumnRowInfoPresent ( m_iColumnRowInfoPresent ); |
---|
| 283 | m_acTEncTopList[iViewIdx]->setUniformSpacingIdr ( m_iUniformSpacingIdr ); |
---|
| 284 | #if !REMOVE_TILE_DEPENDENCE |
---|
| 285 | m_acTEncTopList[iViewIdx]->setTileBoundaryIndependenceIdr( m_iTileBoundaryIndependenceIdr ); |
---|
[2] | 286 | #endif |
---|
[56] | 287 | m_acTEncTopList[iViewIdx]->setNumColumnsMinus1 ( m_iNumColumnsMinus1 ); |
---|
| 288 | m_acTEncTopList[iViewIdx]->setNumRowsMinus1 ( m_iNumRowsMinus1 ); |
---|
| 289 | if(m_iUniformSpacingIdr==0) |
---|
| 290 | { |
---|
| 291 | m_acTEncTopList[iViewIdx]->setColumnWidth ( m_pchColumnWidth ); |
---|
| 292 | m_acTEncTopList[iViewIdx]->setRowHeight ( m_pchRowHeight ); |
---|
| 293 | } |
---|
| 294 | m_acTEncTopList[iViewIdx]->xCheckGSParameters(); |
---|
| 295 | m_acTEncTopList[iViewIdx]->setTileLocationInSliceHeaderFlag ( m_iTileLocationInSliceHeaderFlag ); |
---|
| 296 | m_acTEncTopList[iViewIdx]->setTileMarkerFlag ( m_iTileMarkerFlag ); |
---|
| 297 | m_acTEncTopList[iViewIdx]->setMaxTileMarkerEntryPoints ( m_iMaxTileMarkerEntryPoints ); |
---|
| 298 | |
---|
| 299 | Int uiTilesCount = (m_iNumRowsMinus1+1) * (m_iNumColumnsMinus1+1); |
---|
| 300 | m_dMaxTileMarkerOffset = ((Double)uiTilesCount) / m_iMaxTileMarkerEntryPoints; |
---|
| 301 | m_acTEncTopList[iViewIdx]->setMaxTileMarkerOffset ( m_dMaxTileMarkerOffset ); |
---|
| 302 | m_acTEncTopList[iViewIdx]->setTileBehaviorControlPresentFlag( m_iTileBehaviorControlPresentFlag ); |
---|
| 303 | #if !REMOVE_TILE_DEPENDENCE |
---|
| 304 | if(m_iTileBoundaryIndependenceIdr == 0 || uiTilesCount == 1) |
---|
| 305 | #else |
---|
| 306 | if(uiTilesCount == 1) |
---|
[2] | 307 | #endif |
---|
[56] | 308 | { |
---|
| 309 | m_bLFCrossTileBoundaryFlag = true; |
---|
| 310 | } |
---|
| 311 | m_acTEncTopList[iViewIdx]->setLFCrossTileBoundaryFlag( m_bLFCrossTileBoundaryFlag ); |
---|
| 312 | m_acTEncTopList[iViewIdx]->setWaveFrontSynchro ( m_iWaveFrontSynchro ); |
---|
| 313 | m_acTEncTopList[iViewIdx]->setWaveFrontFlush ( m_iWaveFrontFlush ); |
---|
| 314 | m_acTEncTopList[iViewIdx]->setWaveFrontSubstreams ( m_iWaveFrontSubstreams ); |
---|
| 315 | m_acTEncTopList[iViewIdx]->setEnableTMVP ( m_enableTMVP ); |
---|
| 316 | m_acTEncTopList[iViewIdx]->setUseScalingListId ( m_useScalingListId ); |
---|
| 317 | m_acTEncTopList[iViewIdx]->setScalingListFile ( m_scalingListFile ); |
---|
| 318 | #if MULTIBITS_DATA_HIDING |
---|
| 319 | m_acTEncTopList[iViewIdx]->setSignHideFlag(m_signHideFlag); |
---|
| 320 | m_acTEncTopList[iViewIdx]->setTSIG(m_signHidingThreshold); |
---|
[2] | 321 | #endif |
---|
| 322 | |
---|
[56] | 323 | #if LCU_SYNTAX_ALF |
---|
| 324 | if(uiTilesCount > 1) |
---|
[2] | 325 | { |
---|
[56] | 326 | m_bALFParamInSlice = false; |
---|
| 327 | m_bALFPicBasedEncode = true; |
---|
[2] | 328 | } |
---|
[56] | 329 | m_acTEncTopList[iViewIdx]->setALFParamInSlice ( m_bALFParamInSlice); |
---|
| 330 | m_acTEncTopList[iViewIdx]->setALFPicBasedEncode ( m_bALFPicBasedEncode); |
---|
[2] | 331 | #endif |
---|
[56] | 332 | |
---|
| 333 | //====== Depth tools ======== |
---|
| 334 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
| 335 | m_acTEncTopList[iViewIdx]->setUseDMM ( false ); |
---|
[2] | 336 | #endif |
---|
[5] | 337 | #if HHI_MPI |
---|
[2] | 338 | m_acTEncTopList[iViewIdx]->setUseMVI( false ); |
---|
[5] | 339 | #endif |
---|
[2] | 340 | } |
---|
| 341 | if( m_bUsingDepthMaps ) |
---|
| 342 | { |
---|
| 343 | for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) |
---|
| 344 | { |
---|
[56] | 345 | m_depthFrameRcvd.push_back(0); |
---|
| 346 | m_acTEncDepthTopList.push_back(new TEncTop); |
---|
[2] | 347 | m_acTVideoIOYuvDepthInputFileList.push_back(new TVideoIOYuv); |
---|
[56] | 348 | m_acTVideoIOYuvDepthReconFileList.push_back(new TVideoIOYuv); |
---|
| 349 | m_picYuvDepthRec.push_back(new TComList<TComPicYuv*>) ; |
---|
[2] | 350 | |
---|
| 351 | m_acTEncDepthTopList[iViewIdx]->setFrameRate ( m_iFrameRate ); |
---|
| 352 | m_acTEncDepthTopList[iViewIdx]->setFrameSkip ( m_FrameSkip ); |
---|
| 353 | m_acTEncDepthTopList[iViewIdx]->setSourceWidth ( m_iSourceWidth ); |
---|
| 354 | m_acTEncDepthTopList[iViewIdx]->setSourceHeight ( m_iSourceHeight ); |
---|
[56] | 355 | #if PIC_CROPPING |
---|
| 356 | m_acTEncDepthTopList[iViewIdx]->setCroppingMode ( m_croppingMode ); |
---|
| 357 | m_acTEncDepthTopList[iViewIdx]->setCropLeft ( m_cropLeft ); |
---|
| 358 | m_acTEncDepthTopList[iViewIdx]->setCropRight ( m_cropRight ); |
---|
| 359 | m_acTEncDepthTopList[iViewIdx]->setCropTop ( m_cropTop ); |
---|
| 360 | m_acTEncDepthTopList[iViewIdx]->setCropBottom ( m_cropBottom ); |
---|
| 361 | #endif |
---|
[2] | 362 | m_acTEncDepthTopList[iViewIdx]->setFrameToBeEncoded ( m_iFrameToBeEncoded ); |
---|
[56] | 363 | m_acTEncDepthTopList[iViewIdx]->setViewId ( iViewIdx ); |
---|
| 364 | m_acTEncDepthTopList[iViewIdx]->setIsDepth ( true ); |
---|
| 365 | m_acTEncDepthTopList[iViewIdx]->setViewOrderIdx ( m_cCameraData.getViewOrderIndex()[ iViewIdx ] ); |
---|
| 366 | m_acTEncDepthTopList[iViewIdx]->setCamParPrecision ( 0 ); |
---|
| 367 | m_acTEncDepthTopList[iViewIdx]->setCamParInSliceHeader ( false ); |
---|
| 368 | m_acTEncDepthTopList[iViewIdx]->setCodedScale ( 0 ); |
---|
| 369 | m_acTEncDepthTopList[iViewIdx]->setCodedOffset ( 0 ); |
---|
[2] | 370 | |
---|
| 371 | //====== Coding Structure ======== |
---|
[56] | 372 | m_acTEncDepthTopList[iViewIdx]->setIntraPeriod ( m_iIntraPeriod ); |
---|
[2] | 373 | m_acTEncDepthTopList[iViewIdx]->setDecodingRefreshType ( m_iDecodingRefreshType ); |
---|
[56] | 374 | m_acTEncDepthTopList[iViewIdx]->setGOPSize ( m_iGOPSize ); |
---|
| 375 | m_acTEncDepthTopList[iViewIdx]->setGopList ( m_GOPListsMvc[iViewIdx] ); |
---|
| 376 | m_acTEncDepthTopList[iViewIdx]->setExtraRPSs ( m_extraRPSs[iViewIdx] ); |
---|
| 377 | #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER |
---|
| 378 | for(Int i = 0; i < MAX_TLAYER; i++) |
---|
| 379 | { |
---|
| 380 | m_acTEncDepthTopList[iViewIdx]->setNumReorderPics ( m_numReorderPics[iViewIdx][i], i ); |
---|
| 381 | m_acTEncDepthTopList[iViewIdx]->setMaxDecPicBuffering ( m_maxDecPicBuffering[iViewIdx][i], i ); |
---|
| 382 | } |
---|
| 383 | #else |
---|
| 384 | m_acTEncDepthTopList[iViewIdx]->setNumReorderFrames ( m_numReorderFrames ); |
---|
| 385 | m_acTEncDepthTopList[iViewIdx]->setMaxNumberOfReferencePictures ( m_maxNumberOfReferencePictures ); |
---|
[2] | 386 | #endif |
---|
[56] | 387 | for( UInt uiLoop = 0; uiLoop < MAX_TLAYER; ++uiLoop ) |
---|
| 388 | { |
---|
| 389 | m_acTEncDepthTopList[iViewIdx]->setLambdaModifier( uiLoop, m_adLambdaModifier[ uiLoop ] ); |
---|
| 390 | } |
---|
[2] | 391 | m_acTEncDepthTopList[iViewIdx]->setQP ( m_aiQP[1] ); |
---|
| 392 | |
---|
| 393 | m_acTEncDepthTopList[iViewIdx]->setTemporalLayerQPOffset ( m_aiTLayerQPOffset ); |
---|
| 394 | m_acTEncDepthTopList[iViewIdx]->setPad ( m_aiPad ); |
---|
| 395 | |
---|
[56] | 396 | #if H0566_TLA |
---|
| 397 | m_acTEncDepthTopList[iViewIdx]->setMaxTempLayer ( m_maxTempLayer[iViewIdx] ); |
---|
| 398 | #else |
---|
| 399 | m_acTEncDepthTopList[iViewIdx]->setTLayering ( m_bTLayering ); |
---|
| 400 | m_acTEncDepthTopList[iViewIdx]->setTLayerSwitchingFlag ( m_abTLayerSwitchingFlag ); |
---|
| 401 | #endif |
---|
| 402 | |
---|
| 403 | m_acTEncDepthTopList[iViewIdx]->setDisInter4x4 ( m_bDisInter4x4); |
---|
| 404 | |
---|
| 405 | m_acTEncDepthTopList[iViewIdx]->setUseNSQT( m_enableNSQT ); |
---|
| 406 | m_acTEncDepthTopList[iViewIdx]->setUseAMP( m_enableAMP ); |
---|
| 407 | |
---|
[2] | 408 | //===== Slice ======== |
---|
| 409 | |
---|
| 410 | //====== Loop/Deblock Filter ======== |
---|
| 411 | m_acTEncDepthTopList[iViewIdx]->setLoopFilterDisable ( m_abLoopFilterDisable[1] ); |
---|
[56] | 412 | m_acTEncDepthTopList[iViewIdx]->setLoopFilterOffsetInAPS ( m_loopFilterOffsetInAPS ); |
---|
| 413 | m_acTEncDepthTopList[iViewIdx]->setLoopFilterBetaOffset ( m_loopFilterBetaOffsetDiv2 ); |
---|
| 414 | m_acTEncDepthTopList[iViewIdx]->setLoopFilterTcOffset ( m_loopFilterTcOffsetDiv2 ); |
---|
| 415 | #if DBL_CONTROL |
---|
| 416 | m_acTEncDepthTopList[iViewIdx]->setDeblockingFilterControlPresent( m_DeblockingFilterControlPresent); |
---|
| 417 | #endif |
---|
[2] | 418 | |
---|
| 419 | //====== Motion search ======== |
---|
| 420 | m_acTEncDepthTopList[iViewIdx]->setFastSearch ( m_iFastSearch ); |
---|
| 421 | m_acTEncDepthTopList[iViewIdx]->setSearchRange ( m_iSearchRange ); |
---|
| 422 | m_acTEncDepthTopList[iViewIdx]->setBipredSearchRange ( m_bipredSearchRange ); |
---|
[56] | 423 | |
---|
| 424 | //====== Quality control ======== |
---|
[2] | 425 | m_acTEncDepthTopList[iViewIdx]->setMaxDeltaQP ( m_iMaxDeltaQP ); |
---|
[56] | 426 | m_acTEncDepthTopList[iViewIdx]->setMaxCuDQPDepth ( m_iMaxCuDQPDepth ); |
---|
[2] | 427 | |
---|
[56] | 428 | m_acTEncDepthTopList[iViewIdx]->setChromaQpOffset ( m_iChromaQpOffset ); |
---|
| 429 | m_acTEncDepthTopList[iViewIdx]->setChromaQpOffset2nd ( m_iChromaQpOffset2nd ); |
---|
| 430 | |
---|
| 431 | #if ADAPTIVE_QP_SELECTION |
---|
| 432 | m_acTEncDepthTopList[iViewIdx]->setUseAdaptQpSelect ( m_bUseAdaptQpSelect ); |
---|
| 433 | #endif |
---|
| 434 | |
---|
| 435 | m_acTEncDepthTopList[iViewIdx]->setUseAdaptiveQP ( m_bUseAdaptiveQP ); |
---|
| 436 | m_acTEncDepthTopList[iViewIdx]->setQPAdaptationRange ( m_iQPAdaptationRange ); |
---|
| 437 | |
---|
[2] | 438 | //====== Tool list ======== |
---|
| 439 | m_acTEncDepthTopList[iViewIdx]->setUseSBACRD ( m_bUseSBACRD ); |
---|
| 440 | m_acTEncDepthTopList[iViewIdx]->setDeltaQpRD ( m_uiDeltaQpRD ); |
---|
| 441 | m_acTEncDepthTopList[iViewIdx]->setUseASR ( m_bUseASR ); |
---|
| 442 | m_acTEncDepthTopList[iViewIdx]->setUseHADME ( m_bUseHADME ); |
---|
| 443 | m_acTEncDepthTopList[iViewIdx]->setUseALF ( m_abUseALF[1] ); |
---|
| 444 | m_acTEncDepthTopList[iViewIdx]->setALFEncodePassReduction ( m_iALFEncodePassReduction ); |
---|
[56] | 445 | #if LOSSLESS_CODING |
---|
| 446 | m_acTEncDepthTopList[iViewIdx]->setUseLossless ( m_useLossless ); |
---|
[2] | 447 | #endif |
---|
[56] | 448 | m_acTEncDepthTopList[iViewIdx]->setALFMaxNumberFilters ( m_iALFMaxNumberFilters ) ; |
---|
| 449 | |
---|
[2] | 450 | m_acTEncDepthTopList[iViewIdx]->setUseLComb ( m_bUseLComb ); |
---|
[56] | 451 | m_acTEncDepthTopList[iViewIdx]->setLCMod ( m_bLCMod ); |
---|
| 452 | m_acTEncDepthTopList[iViewIdx]->setdQPs ( m_aidQPdepth ); |
---|
[2] | 453 | m_acTEncDepthTopList[iViewIdx]->setUseRDOQ ( m_abUseRDOQ[1] ); |
---|
[56] | 454 | #if !PIC_CROPPING |
---|
[2] | 455 | m_acTEncDepthTopList[iViewIdx]->setUsePAD ( m_bUsePAD ); |
---|
[56] | 456 | #endif |
---|
[2] | 457 | m_acTEncDepthTopList[iViewIdx]->setQuadtreeTULog2MaxSize ( m_uiQuadtreeTULog2MaxSize ); |
---|
| 458 | m_acTEncDepthTopList[iViewIdx]->setQuadtreeTULog2MinSize ( m_uiQuadtreeTULog2MinSize ); |
---|
| 459 | m_acTEncDepthTopList[iViewIdx]->setQuadtreeTUMaxDepthInter ( m_uiQuadtreeTUMaxDepthInter ); |
---|
| 460 | m_acTEncDepthTopList[iViewIdx]->setQuadtreeTUMaxDepthIntra ( m_uiQuadtreeTUMaxDepthIntra ); |
---|
| 461 | m_acTEncDepthTopList[iViewIdx]->setUseFastEnc ( m_bUseFastEnc ); |
---|
[56] | 462 | m_acTEncDepthTopList[iViewIdx]->setUseEarlyCU ( m_bUseEarlyCU ); |
---|
| 463 | #if FAST_DECISION_FOR_MRG_RD_COST |
---|
| 464 | m_acTEncDepthTopList[iViewIdx]->setUseFastDecisionForMerge ( m_useFastDecisionForMerge ); |
---|
| 465 | #endif |
---|
| 466 | m_acTEncDepthTopList[iViewIdx]->setUseCbfFastMode ( m_bUseCbfFastMode ); |
---|
| 467 | #if HHI_INTERVIEW_SKIP |
---|
| 468 | m_acTEncDepthTopList[iViewIdx]->setInterViewSkip ( 0 ); |
---|
| 469 | #if HHI_INTERVIEW_SKIP_LAMBDA_SCALE |
---|
| 470 | m_acTEncDepthTopList[iViewIdx]->setInterViewSkipLambdaScale ( 1 ); |
---|
| 471 | #endif |
---|
| 472 | #endif |
---|
| 473 | m_acTEncDepthTopList[iViewIdx]->setUseLMChroma ( m_bUseLMChroma ); |
---|
| 474 | m_acTEncDepthTopList[iViewIdx]->setUseConstrainedIntraPred ( m_bUseConstrainedIntraPred ); |
---|
| 475 | m_acTEncDepthTopList[iViewIdx]->setPCMLog2MinSize ( m_uiPCMLog2MinSize); |
---|
| 476 | m_acTEncDepthTopList[iViewIdx]->setUsePCM ( m_usePCM ); |
---|
| 477 | m_acTEncDepthTopList[iViewIdx]->setPCMLog2MaxSize ( m_pcmLog2MaxSize); |
---|
| 478 | //====== VSO ======== |
---|
[5] | 479 | #if HHI_VSO |
---|
[2] | 480 | m_acTEncDepthTopList[iViewIdx]->setUseVSO ( m_bUseVSO ); //GT: might be enabled/disabled later for VSO Mode 4 |
---|
| 481 | m_acTEncDepthTopList[iViewIdx]->setForceLambdaScaleVSO ( m_bForceLambdaScaleVSO ); |
---|
| 482 | m_acTEncDepthTopList[iViewIdx]->setLambdaScaleVSO ( m_dLambdaScaleVSO ); |
---|
[5] | 483 | #if HHI_VSO_DIST_INT |
---|
[2] | 484 | m_acTEncDepthTopList[iViewIdx]->setAllowNegDist ( m_bAllowNegDist ); |
---|
| 485 | #endif |
---|
| 486 | m_acTEncDepthTopList[iViewIdx]->setVSOMode ( m_uiVSOMode ); |
---|
[5] | 487 | #endif |
---|
[2] | 488 | |
---|
[5] | 489 | #if DEPTH_MAP_GENERATION |
---|
[2] | 490 | m_acTEncDepthTopList[iViewIdx]->setPredDepthMapGeneration ( 0 ); |
---|
[5] | 491 | #endif |
---|
| 492 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
[2] | 493 | m_acTEncDepthTopList[iViewIdx]->setMultiviewMvPredMode ( 0 ); |
---|
| 494 | m_acTEncDepthTopList[iViewIdx]->setMultiviewMvRegMode ( 0 ); |
---|
| 495 | m_acTEncDepthTopList[iViewIdx]->setMultiviewMvRegLambdaScale ( 0.0 ); |
---|
[5] | 496 | #endif |
---|
| 497 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
[2] | 498 | m_acTEncDepthTopList[iViewIdx]->setMultiviewResPredMode ( 0 ); |
---|
[5] | 499 | #endif |
---|
[2] | 500 | |
---|
[56] | 501 | //====== Weighted Prediction ======== |
---|
| 502 | m_acTEncDepthTopList[iViewIdx]->setUseWP ( m_bUseWeightPred ); |
---|
| 503 | m_acTEncDepthTopList[iViewIdx]->setWPBiPredIdc ( m_uiBiPredIdc ); |
---|
| 504 | //====== Slice ======== |
---|
| 505 | m_acTEncDepthTopList[iViewIdx]->setSliceMode ( m_iSliceMode ); |
---|
| 506 | m_acTEncDepthTopList[iViewIdx]->setSliceArgument ( m_iSliceArgument ); |
---|
| 507 | |
---|
| 508 | //====== Entropy Slice ======== |
---|
| 509 | m_acTEncDepthTopList[iViewIdx]->setEntropySliceMode ( m_iEntropySliceMode ); |
---|
| 510 | m_acTEncDepthTopList[iViewIdx]->setEntropySliceArgument ( m_iEntropySliceArgument ); |
---|
| 511 | int iNumPartInCU = 1<<(m_uiMaxCUDepth<<1); |
---|
| 512 | if(m_iEntropySliceMode==SHARP_FIXED_NUMBER_OF_LCU_IN_ENTROPY_SLICE) |
---|
| 513 | { |
---|
| 514 | m_acTEncDepthTopList[iViewIdx]->setEntropySliceArgument ( m_iEntropySliceArgument * ( iNumPartInCU >> ( m_iSliceGranularity << 1 ) ) ); |
---|
| 515 | } |
---|
| 516 | if(m_iSliceMode==AD_HOC_SLICES_FIXED_NUMBER_OF_LCU_IN_SLICE) |
---|
| 517 | { |
---|
| 518 | m_acTEncDepthTopList[iViewIdx]->setSliceArgument ( m_iSliceArgument * ( iNumPartInCU >> ( m_iSliceGranularity << 1 ) ) ); |
---|
| 519 | } |
---|
| 520 | #if FIXED_NUMBER_OF_TILES_SLICE_MODE |
---|
| 521 | if(m_iSliceMode==AD_HOC_SLICES_FIXED_NUMBER_OF_TILES_IN_SLICE) |
---|
| 522 | { |
---|
| 523 | m_acTEncDepthTopList[iViewIdx]->setSliceArgument ( m_iSliceArgument ); |
---|
| 524 | } |
---|
[2] | 525 | #endif |
---|
[56] | 526 | m_acTEncDepthTopList[iViewIdx]->setSliceGranularity ( m_iSliceGranularity ); |
---|
| 527 | if(m_iSliceMode == 0 ) |
---|
| 528 | { |
---|
| 529 | m_bLFCrossSliceBoundaryFlag = true; |
---|
| 530 | } |
---|
| 531 | m_acTEncDepthTopList[iViewIdx]->setLFCrossSliceBoundaryFlag( m_bLFCrossSliceBoundaryFlag ); |
---|
| 532 | m_acTEncDepthTopList[iViewIdx]->setUseSAO ( m_abUseSAO[1] ); |
---|
| 533 | #if SAO_UNIT_INTERLEAVING |
---|
| 534 | m_acTEncDepthTopList[iViewIdx]->setMaxNumOffsetsPerPic (m_maxNumOffsetsPerPic); |
---|
| 535 | m_acTEncDepthTopList[iViewIdx]->setSaoInterleavingFlag (m_saoInterleavingFlag); |
---|
[2] | 536 | #endif |
---|
[56] | 537 | m_acTEncDepthTopList[iViewIdx]->setPCMInputBitDepthFlag ( m_bPCMInputBitDepthFlag); |
---|
| 538 | m_acTEncDepthTopList[iViewIdx]->setPCMFilterDisableFlag ( m_bPCMFilterDisableFlag); |
---|
[2] | 539 | |
---|
[56] | 540 | m_acTEncDepthTopList[iViewIdx]->setPictureDigestEnabled(m_pictureDigestEnabled); |
---|
| 541 | |
---|
| 542 | m_acTEncDepthTopList[iViewIdx]->setColumnRowInfoPresent ( m_iColumnRowInfoPresent ); |
---|
| 543 | m_acTEncDepthTopList[iViewIdx]->setUniformSpacingIdr ( m_iUniformSpacingIdr ); |
---|
| 544 | #if !REMOVE_TILE_DEPENDENCE |
---|
| 545 | m_acTEncDepthTopList[iViewIdx]->setTileBoundaryIndependenceIdr( m_iTileBoundaryIndependenceIdr ); |
---|
[2] | 546 | #endif |
---|
[56] | 547 | m_acTEncDepthTopList[iViewIdx]->setNumColumnsMinus1 ( m_iNumColumnsMinus1 ); |
---|
| 548 | m_acTEncDepthTopList[iViewIdx]->setNumRowsMinus1 ( m_iNumRowsMinus1 ); |
---|
| 549 | if(m_iUniformSpacingIdr==0) |
---|
| 550 | { |
---|
| 551 | m_acTEncDepthTopList[iViewIdx]->setColumnWidth ( m_pchColumnWidth ); |
---|
| 552 | m_acTEncDepthTopList[iViewIdx]->setRowHeight ( m_pchRowHeight ); |
---|
| 553 | } |
---|
| 554 | m_acTEncDepthTopList[iViewIdx]->xCheckGSParameters(); |
---|
| 555 | m_acTEncDepthTopList[iViewIdx]->setTileLocationInSliceHeaderFlag ( m_iTileLocationInSliceHeaderFlag ); |
---|
| 556 | m_acTEncDepthTopList[iViewIdx]->setTileMarkerFlag ( m_iTileMarkerFlag ); |
---|
| 557 | m_acTEncDepthTopList[iViewIdx]->setMaxTileMarkerEntryPoints ( m_iMaxTileMarkerEntryPoints ); |
---|
[2] | 558 | |
---|
[56] | 559 | Int uiTilesCount = (m_iNumRowsMinus1+1) * (m_iNumColumnsMinus1+1); |
---|
| 560 | m_dMaxTileMarkerOffset = ((Double)uiTilesCount) / m_iMaxTileMarkerEntryPoints; |
---|
| 561 | m_acTEncDepthTopList[iViewIdx]->setMaxTileMarkerOffset ( m_dMaxTileMarkerOffset ); |
---|
| 562 | m_acTEncDepthTopList[iViewIdx]->setTileBehaviorControlPresentFlag( m_iTileBehaviorControlPresentFlag ); |
---|
| 563 | #if !REMOVE_TILE_DEPENDENCE |
---|
| 564 | if(m_iTileBoundaryIndependenceIdr == 0 || uiTilesCount == 1) |
---|
| 565 | #else |
---|
| 566 | if(uiTilesCount == 1) |
---|
[2] | 567 | #endif |
---|
[56] | 568 | { |
---|
| 569 | m_bLFCrossTileBoundaryFlag = true; |
---|
| 570 | } |
---|
| 571 | m_acTEncDepthTopList[iViewIdx]->setLFCrossTileBoundaryFlag( m_bLFCrossTileBoundaryFlag ); |
---|
| 572 | m_acTEncDepthTopList[iViewIdx]->setWaveFrontSynchro ( m_iWaveFrontSynchro ); |
---|
| 573 | m_acTEncDepthTopList[iViewIdx]->setWaveFrontFlush ( m_iWaveFrontFlush ); |
---|
| 574 | m_acTEncDepthTopList[iViewIdx]->setWaveFrontSubstreams ( m_iWaveFrontSubstreams ); |
---|
| 575 | m_acTEncDepthTopList[iViewIdx]->setEnableTMVP ( m_enableTMVP ); |
---|
| 576 | m_acTEncDepthTopList[iViewIdx]->setUseScalingListId ( m_useScalingListId ); |
---|
| 577 | m_acTEncDepthTopList[iViewIdx]->setScalingListFile ( m_scalingListFile ); |
---|
| 578 | #if MULTIBITS_DATA_HIDING |
---|
| 579 | m_acTEncDepthTopList[iViewIdx]->setSignHideFlag(m_signHideFlag); |
---|
| 580 | m_acTEncDepthTopList[iViewIdx]->setTSIG(m_signHidingThreshold); |
---|
[2] | 581 | #endif |
---|
| 582 | |
---|
[56] | 583 | #if LCU_SYNTAX_ALF |
---|
| 584 | if(uiTilesCount > 1) |
---|
[2] | 585 | { |
---|
[56] | 586 | m_bALFParamInSlice = false; |
---|
| 587 | m_bALFPicBasedEncode = true; |
---|
[2] | 588 | } |
---|
[56] | 589 | m_acTEncDepthTopList[iViewIdx]->setALFParamInSlice ( m_bALFParamInSlice); |
---|
| 590 | m_acTEncDepthTopList[iViewIdx]->setALFPicBasedEncode ( m_bALFPicBasedEncode); |
---|
[2] | 591 | #endif |
---|
[56] | 592 | |
---|
| 593 | //====== Depth tools ======== |
---|
| 594 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
| 595 | m_acTEncDepthTopList[iViewIdx]->setUseDMM ( m_bUseDMM ); |
---|
[2] | 596 | #endif |
---|
[5] | 597 | #if HHI_MPI |
---|
[56] | 598 | m_acTEncDepthTopList[iViewIdx]->setUseMVI( m_bUseMVI ); |
---|
[5] | 599 | #endif |
---|
[2] | 600 | } |
---|
| 601 | } |
---|
[56] | 602 | |
---|
[5] | 603 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
[2] | 604 | else if( m_uiMultiviewMvRegMode ) |
---|
| 605 | { |
---|
| 606 | for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) |
---|
| 607 | { |
---|
| 608 | m_acTVideoIOYuvDepthInputFileList.push_back( new TVideoIOYuv ); |
---|
| 609 | } |
---|
| 610 | } |
---|
[5] | 611 | #endif |
---|
[2] | 612 | |
---|
[5] | 613 | #if HHI_VSO |
---|
[2] | 614 | if ( m_bUseVSO ) |
---|
| 615 | { |
---|
| 616 | if ( m_uiVSOMode == 4 ) |
---|
[5] | 617 | { |
---|
[2] | 618 | m_cRendererModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, m_iSourceHeight, LOG2_DISP_PREC_LUT, 0 ); |
---|
| 619 | |
---|
| 620 | for ( Int iViewNum = 0; iViewNum < m_iNumberOfViews; iViewNum++ ) |
---|
| 621 | { |
---|
| 622 | for (Int iContent = 0; iContent < 2; iContent++ ) |
---|
| 623 | { |
---|
[5] | 624 | Int iNumOfModels = m_cRenModStrParser.getNumOfModelsForView(iViewNum, iContent); |
---|
| 625 | Bool bUseVSO = (iNumOfModels != 0); |
---|
[2] | 626 | |
---|
[5] | 627 | TEncTop* pcEncTop = ( iContent == 0 ) ? m_acTEncTopList[iViewNum] : m_acTEncDepthTopList[iViewNum]; |
---|
| 628 | pcEncTop->setUseVSO( bUseVSO ); |
---|
| 629 | pcEncTop->getRdCost()->setRenModel( bUseVSO ? &m_cRendererModel : NULL ); |
---|
| 630 | |
---|
[2] | 631 | for (Int iCurModel = 0; iCurModel < iNumOfModels; iCurModel++ ) |
---|
| 632 | { |
---|
[5] | 633 | Int iModelNum; Int iLeftViewNum; Int iRightViewNum; Int iDump; Int iOrgRefNum; Int iBlendMode; |
---|
[2] | 634 | |
---|
[5] | 635 | m_cRenModStrParser.getSingleModelData ( iViewNum, iContent, iCurModel, iModelNum, iBlendMode, iLeftViewNum, iRightViewNum, iOrgRefNum, iDump ) ; |
---|
| 636 | m_cRendererModel .createSingleModel ( iViewNum, iContent, iModelNum, iLeftViewNum, iRightViewNum, (iOrgRefNum != -1), iBlendMode ); |
---|
[2] | 637 | } |
---|
| 638 | } |
---|
| 639 | } |
---|
| 640 | } |
---|
| 641 | else |
---|
| 642 | { |
---|
[56] | 643 | AOT(true); |
---|
[2] | 644 | } |
---|
[5] | 645 | } |
---|
| 646 | #endif |
---|
[2] | 647 | |
---|
[5] | 648 | #if HHI_INTERVIEW_SKIP |
---|
| 649 | m_cUsedPelsRenderer.init(m_iSourceWidth, m_iSourceHeight, true, 0, LOG2_DISP_PREC_LUT, true, 0, 0, 0, 0, 0, 6, 4, 1, 0, 6 ); |
---|
| 650 | #endif |
---|
[56] | 651 | |
---|
[2] | 652 | } |
---|
| 653 | |
---|
| 654 | Void TAppEncTop::xCreateLib() |
---|
| 655 | { |
---|
| 656 | for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) |
---|
| 657 | { |
---|
| 658 | m_acTVideoIOYuvInputFileList[iViewIdx]->open( m_pchInputFileList[iViewIdx], false, m_uiInputBitDepth, m_uiInternalBitDepth ); // read mode |
---|
[56] | 659 | m_acTVideoIOYuvInputFileList[iViewIdx]->skipFrames(m_FrameSkip, m_iSourceWidth - m_aiPad[0], m_iSourceHeight - m_aiPad[1]); |
---|
[2] | 660 | |
---|
[56] | 661 | if (m_pchReconFileList[iViewIdx]) |
---|
| 662 | m_acTVideoIOYuvReconFileList[iViewIdx]->open(m_pchReconFileList[iViewIdx], true, m_uiOutputBitDepth, m_uiInternalBitDepth); // write mode |
---|
[2] | 663 | m_acTEncTopList[iViewIdx]->create(); |
---|
| 664 | if( m_bUsingDepthMaps ) |
---|
| 665 | { |
---|
| 666 | m_acTVideoIOYuvDepthInputFileList[iViewIdx]->open( m_pchDepthInputFileList[iViewIdx], false, m_uiInputBitDepth, m_uiInternalBitDepth ); // read mode |
---|
[56] | 667 | m_acTVideoIOYuvDepthInputFileList[iViewIdx]->skipFrames(m_FrameSkip, m_iSourceWidth - m_aiPad[0], m_iSourceHeight - m_aiPad[1]); |
---|
[2] | 668 | |
---|
[56] | 669 | if (m_pchDepthReconFileList[iViewIdx]) |
---|
| 670 | m_acTVideoIOYuvDepthReconFileList[iViewIdx]->open(m_pchDepthReconFileList[iViewIdx], true, m_uiOutputBitDepth, m_uiInternalBitDepth); // write mode |
---|
[2] | 671 | m_acTEncDepthTopList[iViewIdx]->create(); |
---|
| 672 | } |
---|
[5] | 673 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
[2] | 674 | else if( m_uiMultiviewMvRegMode ) |
---|
| 675 | { |
---|
| 676 | m_acTVideoIOYuvDepthInputFileList[iViewIdx]->open( m_pchDepthInputFileList[iViewIdx], false, m_uiInputBitDepth, m_uiInternalBitDepth ); // read mode |
---|
| 677 | m_acTVideoIOYuvDepthInputFileList[iViewIdx]->skipFrames(m_FrameSkip, m_iSourceWidth, m_iSourceHeight); |
---|
| 678 | } |
---|
[5] | 679 | #endif |
---|
[2] | 680 | } |
---|
| 681 | } |
---|
| 682 | |
---|
| 683 | Void TAppEncTop::xDestroyLib() |
---|
| 684 | { |
---|
[56] | 685 | // Video I/O |
---|
[2] | 686 | for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) |
---|
| 687 | { |
---|
| 688 | m_acTVideoIOYuvInputFileList[iViewIdx]->close(); |
---|
| 689 | m_acTVideoIOYuvReconFileList[iViewIdx]->close(); |
---|
[56] | 690 | delete m_acTVideoIOYuvInputFileList[iViewIdx] ; |
---|
| 691 | m_acTVideoIOYuvInputFileList[iViewIdx] = NULL; |
---|
| 692 | delete m_acTVideoIOYuvReconFileList[iViewIdx] ; |
---|
| 693 | m_acTVideoIOYuvReconFileList[iViewIdx] = NULL; |
---|
| 694 | m_acTEncTopList[iViewIdx]->deletePicBuffer(); |
---|
[2] | 695 | m_acTEncTopList[iViewIdx]->destroy(); |
---|
[56] | 696 | delete m_acTEncTopList[iViewIdx] ; |
---|
| 697 | m_acTEncTopList[iViewIdx] = NULL; |
---|
| 698 | delete m_picYuvRec[iViewIdx] ; |
---|
| 699 | m_picYuvRec[iViewIdx] = NULL; |
---|
[2] | 700 | |
---|
| 701 | if( iViewIdx < Int( m_acTVideoIOYuvDepthInputFileList.size() ) && m_acTVideoIOYuvDepthInputFileList[iViewIdx] ) |
---|
| 702 | { |
---|
| 703 | m_acTVideoIOYuvDepthInputFileList[iViewIdx]->close( ); |
---|
[56] | 704 | delete m_acTVideoIOYuvDepthInputFileList[iViewIdx]; |
---|
| 705 | m_acTVideoIOYuvDepthInputFileList[iViewIdx] = NULL; |
---|
[2] | 706 | } |
---|
| 707 | if( iViewIdx < Int( m_acTVideoIOYuvDepthReconFileList.size() ) && m_acTVideoIOYuvDepthReconFileList[iViewIdx] ) |
---|
| 708 | { |
---|
| 709 | m_acTVideoIOYuvDepthReconFileList[iViewIdx]->close () ; |
---|
| 710 | delete m_acTVideoIOYuvDepthReconFileList[iViewIdx]; |
---|
[56] | 711 | m_acTVideoIOYuvDepthReconFileList[iViewIdx] = NULL; |
---|
[2] | 712 | } |
---|
| 713 | if( iViewIdx < Int( m_acTEncDepthTopList.size() ) && m_acTEncDepthTopList[iViewIdx] ) |
---|
| 714 | { |
---|
[56] | 715 | m_acTEncDepthTopList[iViewIdx]->deletePicBuffer(); |
---|
[2] | 716 | m_acTEncDepthTopList[iViewIdx]->destroy(); |
---|
| 717 | delete m_acTEncDepthTopList[iViewIdx]; |
---|
[56] | 718 | m_acTEncDepthTopList[iViewIdx] = NULL; |
---|
[2] | 719 | } |
---|
[56] | 720 | if( iViewIdx < Int( m_picYuvDepthRec.size() ) && m_picYuvDepthRec[iViewIdx] ) |
---|
[2] | 721 | { |
---|
[56] | 722 | delete m_picYuvDepthRec[iViewIdx] ; |
---|
| 723 | m_picYuvDepthRec[iViewIdx] = NULL; |
---|
[2] | 724 | } |
---|
| 725 | } |
---|
| 726 | } |
---|
| 727 | |
---|
| 728 | Void TAppEncTop::xInitLib() |
---|
| 729 | { |
---|
| 730 | for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) |
---|
| 731 | { |
---|
| 732 | m_acTEncTopList[iViewIdx]->init( this ); |
---|
| 733 | } |
---|
| 734 | for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) |
---|
| 735 | { |
---|
| 736 | m_acTEncTopList[iViewIdx]->setTEncTopList( &m_acTEncTopList ); |
---|
| 737 | } |
---|
| 738 | if ( m_bUsingDepthMaps ) |
---|
| 739 | { |
---|
| 740 | for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) |
---|
| 741 | { |
---|
| 742 | m_acTEncDepthTopList[iViewIdx]->init( this ); |
---|
| 743 | } |
---|
| 744 | for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) |
---|
| 745 | { |
---|
| 746 | m_acTEncDepthTopList[iViewIdx]->setTEncTopList( &m_acTEncDepthTopList ); |
---|
| 747 | } |
---|
| 748 | } |
---|
| 749 | } |
---|
| 750 | |
---|
| 751 | // ==================================================================================================================== |
---|
| 752 | // Public member functions |
---|
| 753 | // ==================================================================================================================== |
---|
| 754 | |
---|
| 755 | /** |
---|
| 756 | - create internal class |
---|
| 757 | - initialize internal variable |
---|
| 758 | - until the end of input YUV file, call encoding function in TEncTop class |
---|
| 759 | - delete allocated buffers |
---|
| 760 | - destroy internal class |
---|
| 761 | . |
---|
| 762 | */ |
---|
| 763 | Void TAppEncTop::encode() |
---|
| 764 | { |
---|
[56] | 765 | fstream bitstreamFile(m_pchBitstreamFile, fstream::binary | fstream::out); |
---|
| 766 | if (!bitstreamFile) |
---|
| 767 | { |
---|
| 768 | fprintf(stderr, "\nfailed to open bitstream file `%s' for writing\n", m_pchBitstreamFile); |
---|
| 769 | exit(EXIT_FAILURE); |
---|
| 770 | } |
---|
| 771 | |
---|
| 772 | TComPicYuv* pcPicYuvOrg = new TComPicYuv; |
---|
[2] | 773 | TComPicYuv* pcDepthPicYuvOrg = new TComPicYuv; |
---|
| 774 | TComPicYuv* pcPdmDepthOrg = new TComPicYuv; |
---|
[56] | 775 | TComPicYuv* pcPicYuvRec = NULL; |
---|
| 776 | TComPicYuv* pcDepthPicYuvRec = NULL; |
---|
| 777 | |
---|
[2] | 778 | // initialize internal class & member variables |
---|
| 779 | xInitLibCfg(); |
---|
| 780 | xCreateLib(); |
---|
| 781 | xInitLib(); |
---|
[56] | 782 | |
---|
[2] | 783 | // main encoder loop |
---|
[56] | 784 | Bool allEos = false; |
---|
| 785 | std::vector<Bool> eos ; |
---|
| 786 | std::vector<Bool> depthEos ; |
---|
| 787 | Int maxGopSize = 0; |
---|
| 788 | Int gopSize = 1; |
---|
| 789 | |
---|
| 790 | list<AccessUnit> outputAccessUnits; ///< list of access units to write out. is populated by the encoding process |
---|
| 791 | maxGopSize = (std::max)(maxGopSize, m_acTEncTopList[0]->getGOPSize()); |
---|
[2] | 792 | |
---|
| 793 | for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++ ) |
---|
| 794 | { |
---|
[56] | 795 | eos.push_back( false ); |
---|
| 796 | depthEos.push_back( false ); |
---|
[2] | 797 | } |
---|
[56] | 798 | |
---|
[2] | 799 | // allocate original YUV buffer |
---|
| 800 | pcPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); |
---|
[56] | 801 | pcDepthPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); |
---|
| 802 | |
---|
[5] | 803 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
[2] | 804 | if( m_uiMultiviewMvRegMode ) |
---|
| 805 | { |
---|
| 806 | pcPdmDepthOrg->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); |
---|
| 807 | } |
---|
[5] | 808 | #endif |
---|
[2] | 809 | |
---|
[56] | 810 | while ( !allEos ) |
---|
[2] | 811 | { |
---|
[56] | 812 | for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++ ) |
---|
[2] | 813 | { |
---|
[56] | 814 | Int frmCnt = 0; |
---|
| 815 | while ( !eos[iViewIdx] && !(frmCnt == gopSize)) |
---|
[2] | 816 | { |
---|
| 817 | // get buffers |
---|
[56] | 818 | xGetBuffer(pcPicYuvRec, iViewIdx, false); |
---|
| 819 | |
---|
[2] | 820 | // read input YUV file |
---|
[56] | 821 | m_acTVideoIOYuvInputFileList[iViewIdx]->read( pcPicYuvOrg, m_aiPad ); |
---|
| 822 | |
---|
[5] | 823 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
[2] | 824 | if( m_uiMultiviewMvRegMode && iViewIdx ) |
---|
| 825 | { |
---|
| 826 | m_acTVideoIOYuvDepthInputFileList[iViewIdx]->read( pcPdmDepthOrg, m_aiPad, m_bUsingDepthMaps ); |
---|
| 827 | } |
---|
[5] | 828 | #endif |
---|
[2] | 829 | |
---|
[5] | 830 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
[56] | 831 | m_acTEncTopList[iViewIdx]->initNewPic( pcPicYuvOrg, ( m_uiMultiviewMvRegMode && iViewIdx ? pcPdmDepthOrg : 0 ) ); |
---|
[5] | 832 | #else |
---|
[56] | 833 | m_acTEncTopList[iViewIdx]->initNewPic( pcPicYuvOrg ); |
---|
[5] | 834 | #endif |
---|
[2] | 835 | |
---|
[56] | 836 | // increase number of received frames |
---|
| 837 | m_frameRcvd[iViewIdx]++; |
---|
| 838 | frmCnt++; |
---|
| 839 | // check end of file |
---|
| 840 | eos[iViewIdx] = ( m_acTVideoIOYuvInputFileList[iViewIdx]->isEof() == 1 ? true : false ); |
---|
| 841 | eos[iViewIdx] = ( m_frameRcvd[iViewIdx] == m_iFrameToBeEncoded ? true : eos[iViewIdx] ); |
---|
| 842 | allEos = allEos|eos[iViewIdx] ; |
---|
| 843 | } |
---|
[2] | 844 | if( m_bUsingDepthMaps ) |
---|
| 845 | { |
---|
[56] | 846 | Int frmCntDepth = 0; |
---|
| 847 | while ( !depthEos[iViewIdx] && !(frmCntDepth == gopSize)) |
---|
[2] | 848 | { |
---|
| 849 | // get buffers |
---|
[56] | 850 | xGetBuffer(pcDepthPicYuvRec, iViewIdx, true); |
---|
| 851 | |
---|
[2] | 852 | // read input YUV file |
---|
[56] | 853 | m_acTVideoIOYuvDepthInputFileList[iViewIdx]->read( pcDepthPicYuvOrg, m_aiPad ); |
---|
[2] | 854 | |
---|
[56] | 855 | m_acTEncDepthTopList[iViewIdx]->initNewPic( pcDepthPicYuvOrg ); |
---|
[2] | 856 | |
---|
[56] | 857 | // increase number of received frames |
---|
| 858 | m_depthFrameRcvd[iViewIdx]++; |
---|
| 859 | frmCntDepth++; |
---|
| 860 | // check end of file |
---|
| 861 | depthEos[iViewIdx] = ( m_acTVideoIOYuvDepthInputFileList[iViewIdx]->isEof() == 1 ? true : false ); |
---|
| 862 | depthEos[iViewIdx] = ( m_depthFrameRcvd[iViewIdx] == m_iFrameToBeEncoded ? true : depthEos[iViewIdx] ); |
---|
| 863 | allEos = allEos|depthEos[iViewIdx] ; |
---|
[42] | 864 | } |
---|
| 865 | } |
---|
| 866 | } |
---|
[56] | 867 | for ( Int gopId=0; gopId < gopSize; gopId++ ) |
---|
[42] | 868 | { |
---|
[56] | 869 | Int iNumEncoded = 0; |
---|
| 870 | UInt iNextPoc = m_acTEncTopList[0] -> getFrameId( gopId ); |
---|
| 871 | if ( iNextPoc < m_iFrameToBeEncoded ) |
---|
[2] | 872 | { |
---|
[56] | 873 | m_cCameraData.update( iNextPoc ); |
---|
[2] | 874 | } |
---|
[56] | 875 | for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++ ) |
---|
[2] | 876 | { |
---|
[56] | 877 | iNumEncoded = 0; |
---|
| 878 | // call encoding function for one frame |
---|
| 879 | m_acTEncTopList[iViewIdx]->encode( eos[iViewIdx], pcPicYuvOrg, *m_picYuvRec[iViewIdx], outputAccessUnits, iNumEncoded, gopId ); |
---|
| 880 | xWriteOutput(bitstreamFile, iNumEncoded, outputAccessUnits, iViewIdx, false); |
---|
| 881 | outputAccessUnits.clear(); |
---|
| 882 | if( m_bUsingDepthMaps ) |
---|
[2] | 883 | { |
---|
[56] | 884 | Int iNumDepthEncoded = 0; |
---|
| 885 | // call encoding function for one depth frame |
---|
| 886 | m_acTEncDepthTopList[iViewIdx]->encode( depthEos[iViewIdx], pcDepthPicYuvOrg, *m_picYuvDepthRec[iViewIdx], outputAccessUnits, iNumDepthEncoded, gopId ); |
---|
| 887 | xWriteOutput(bitstreamFile, iNumDepthEncoded, outputAccessUnits, iViewIdx, true); |
---|
| 888 | outputAccessUnits.clear(); |
---|
[2] | 889 | } |
---|
| 890 | } |
---|
[56] | 891 | #if HHI_INTERVIEW_SKIP || HHI_INTER_VIEW_MOTION_PRED || HHI_INTER_VIEW_RESIDUAL_PRED |
---|
[2] | 892 | for( Int iViewIdx = 0; iViewIdx < m_iNumberOfViews; iViewIdx++ ) |
---|
| 893 | { |
---|
| 894 | if( iViewIdx < (Int)m_acTEncTopList.size() && m_acTEncTopList[iViewIdx] ) |
---|
| 895 | { |
---|
[56] | 896 | m_acTEncTopList[iViewIdx]->deleteExtraPicBuffers( m_acTEncTopList[iViewIdx]->getGOPEncoder()->getPocLastCoded() ); |
---|
[2] | 897 | } |
---|
| 898 | if( iViewIdx < (Int)m_acTEncDepthTopList.size() && m_acTEncDepthTopList[iViewIdx] ) |
---|
| 899 | { |
---|
[56] | 900 | m_acTEncDepthTopList[iViewIdx]->deleteExtraPicBuffers( m_acTEncTopList[iViewIdx]->getGOPEncoder()->getPocLastCoded() ); |
---|
[2] | 901 | } |
---|
| 902 | } |
---|
[56] | 903 | #endif |
---|
| 904 | for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++ ) |
---|
[2] | 905 | { |
---|
[56] | 906 | m_acTEncTopList[iViewIdx]->compressMotion( m_acTEncTopList[iViewIdx]->getGOPEncoder()->getPocLastCoded() ); |
---|
| 907 | if( m_bUsingDepthMaps ) |
---|
[2] | 908 | { |
---|
[56] | 909 | m_acTEncDepthTopList[iViewIdx]->compressMotion( m_acTEncDepthTopList[iViewIdx]->getGOPEncoder()->getPocLastCoded() ); |
---|
[2] | 910 | } |
---|
| 911 | } |
---|
| 912 | } |
---|
[56] | 913 | gopSize = maxGopSize; |
---|
[2] | 914 | } |
---|
[56] | 915 | // delete original YUV buffer |
---|
| 916 | pcPicYuvOrg->destroy(); |
---|
| 917 | delete pcPicYuvOrg; |
---|
| 918 | pcPicYuvOrg = NULL; |
---|
| 919 | pcDepthPicYuvOrg->destroy(); |
---|
| 920 | delete pcDepthPicYuvOrg; |
---|
| 921 | pcDepthPicYuvOrg = NULL; |
---|
| 922 | |
---|
[2] | 923 | for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++ ) |
---|
| 924 | { |
---|
| 925 | m_acTEncTopList[iViewIdx]->printOutSummary(m_acTEncTopList[iViewIdx]->getNumAllPicCoded()); |
---|
| 926 | if ( m_bUsingDepthMaps ) |
---|
| 927 | { |
---|
| 928 | m_acTEncDepthTopList[iViewIdx]->printOutSummary(m_acTEncDepthTopList[iViewIdx]->getNumAllPicCoded()); |
---|
| 929 | } |
---|
| 930 | } |
---|
| 931 | |
---|
[56] | 932 | // delete buffers & classes |
---|
| 933 | xDeleteBuffer(); |
---|
| 934 | xDestroyLib(); |
---|
[2] | 935 | |
---|
[56] | 936 | return; |
---|
| 937 | } |
---|
[2] | 938 | |
---|
[56] | 939 | TEncTop* TAppEncTop::getTEncTop( Int viewId, Bool isDepth ) |
---|
| 940 | { |
---|
| 941 | if ( isDepth ) |
---|
[2] | 942 | { |
---|
[56] | 943 | return m_acTEncDepthTopList[viewId]; |
---|
| 944 | } |
---|
| 945 | else |
---|
| 946 | { |
---|
| 947 | return m_acTEncTopList[viewId]; |
---|
| 948 | } |
---|
| 949 | } |
---|
[2] | 950 | |
---|
| 951 | |
---|
| 952 | // ==================================================================================================================== |
---|
| 953 | // Protected member functions |
---|
| 954 | // ==================================================================================================================== |
---|
| 955 | |
---|
| 956 | /** |
---|
| 957 | - application has picture buffer list with size of GOP |
---|
| 958 | - picture buffer list acts as ring buffer |
---|
| 959 | - end of the list has the latest picture |
---|
| 960 | . |
---|
| 961 | */ |
---|
[56] | 962 | Void TAppEncTop::xGetBuffer( TComPicYuv*& rpcPicYuvRec, Int iViewIdx, Bool isDepth) |
---|
[2] | 963 | { |
---|
[56] | 964 | assert( m_iGOPSize > 0 ); |
---|
| 965 | |
---|
| 966 | if( !isDepth ) |
---|
| 967 | { |
---|
| 968 | if ( m_picYuvRec[iViewIdx]->size() == (UInt)m_iGOPSize ) |
---|
[2] | 969 | { |
---|
[56] | 970 | rpcPicYuvRec = m_picYuvRec[iViewIdx]->popFront(); |
---|
[2] | 971 | } |
---|
[56] | 972 | else |
---|
[2] | 973 | { |
---|
[56] | 974 | rpcPicYuvRec = new TComPicYuv; |
---|
| 975 | rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); |
---|
[2] | 976 | } |
---|
[56] | 977 | m_picYuvRec[iViewIdx]->pushBack( rpcPicYuvRec ); |
---|
| 978 | } |
---|
| 979 | else |
---|
| 980 | { |
---|
| 981 | if ( m_picYuvDepthRec[iViewIdx]->size() == (UInt)m_iGOPSize ) |
---|
| 982 | { |
---|
| 983 | rpcPicYuvRec = m_picYuvDepthRec[iViewIdx]->popFront(); |
---|
| 984 | } |
---|
[2] | 985 | else |
---|
| 986 | { |
---|
[56] | 987 | rpcPicYuvRec = new TComPicYuv; |
---|
[2] | 988 | rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); |
---|
| 989 | } |
---|
[56] | 990 | m_picYuvDepthRec[iViewIdx]->pushBack( rpcPicYuvRec ); |
---|
| 991 | } |
---|
[2] | 992 | } |
---|
| 993 | |
---|
| 994 | Void TAppEncTop::xDeleteBuffer( ) |
---|
| 995 | { |
---|
[56] | 996 | for(Int iViewIdx=0; iViewIdx<m_picYuvRec.size(); iViewIdx++) |
---|
[2] | 997 | { |
---|
[56] | 998 | if(m_picYuvRec[iViewIdx]) |
---|
[2] | 999 | { |
---|
[56] | 1000 | TComList<TComPicYuv*>::iterator iterPicYuvRec = m_picYuvRec[iViewIdx]->begin(); |
---|
| 1001 | Int iSize = Int( m_picYuvRec[iViewIdx]->size() ); |
---|
[2] | 1002 | for ( Int i = 0; i < iSize; i++ ) |
---|
| 1003 | { |
---|
[56] | 1004 | TComPicYuv* pcPicYuvRec = *(iterPicYuvRec++); |
---|
| 1005 | if(pcPicYuvRec) |
---|
| 1006 | { |
---|
[2] | 1007 | pcPicYuvRec->destroy(); |
---|
[56] | 1008 | delete pcPicYuvRec; |
---|
| 1009 | pcPicYuvRec = NULL; |
---|
| 1010 | } |
---|
[2] | 1011 | } |
---|
[56] | 1012 | } |
---|
[2] | 1013 | } |
---|
[56] | 1014 | for(Int iViewIdx=0; iViewIdx<m_picYuvDepthRec.size(); iViewIdx++) |
---|
[2] | 1015 | { |
---|
[56] | 1016 | if(m_picYuvDepthRec[iViewIdx]) |
---|
[2] | 1017 | { |
---|
[56] | 1018 | TComList<TComPicYuv*>::iterator iterPicYuvRec = m_picYuvDepthRec[iViewIdx]->begin(); |
---|
| 1019 | Int iSize = Int( m_picYuvDepthRec[iViewIdx]->size() ); |
---|
| 1020 | for ( Int i = 0; i < iSize; i++ ) |
---|
[2] | 1021 | { |
---|
[56] | 1022 | TComPicYuv* pcPicYuvRec = *(iterPicYuvRec++); |
---|
| 1023 | if(pcPicYuvRec) |
---|
| 1024 | { |
---|
| 1025 | pcPicYuvRec->destroy(); |
---|
| 1026 | delete pcPicYuvRec; |
---|
| 1027 | pcPicYuvRec = NULL; |
---|
| 1028 | } |
---|
| 1029 | } |
---|
[2] | 1030 | } |
---|
| 1031 | } |
---|
| 1032 | } |
---|
| 1033 | |
---|
| 1034 | /** \param iNumEncoded number of encoded frames |
---|
| 1035 | */ |
---|
[56] | 1036 | Void TAppEncTop::xWriteOutput(std::ostream& bitstreamFile, Int iNumEncoded, std::list<AccessUnit>& accessUnits, Int iViewIdx, Bool isDepth ) |
---|
[2] | 1037 | { |
---|
[56] | 1038 | Int i; |
---|
| 1039 | |
---|
| 1040 | if( iNumEncoded > 0 ) |
---|
[2] | 1041 | { |
---|
[56] | 1042 | TComList<TComPicYuv*>::iterator iterPicYuvRec = !isDepth ? m_picYuvRec[iViewIdx]->end() : m_picYuvDepthRec[iViewIdx]->end(); |
---|
| 1043 | |
---|
| 1044 | for ( i = 0; i < iNumEncoded; i++ ) |
---|
| 1045 | { |
---|
| 1046 | --iterPicYuvRec; |
---|
| 1047 | } |
---|
| 1048 | |
---|
| 1049 | for ( i = 0; i < iNumEncoded; i++ ) |
---|
| 1050 | { |
---|
| 1051 | TComPicYuv* pcPicYuvRec = *(iterPicYuvRec++); |
---|
| 1052 | if( !isDepth ) |
---|
| 1053 | { |
---|
| 1054 | if (m_pchReconFileList[iViewIdx]) |
---|
| 1055 | { |
---|
| 1056 | #if PIC_CROPPING |
---|
| 1057 | m_acTVideoIOYuvReconFileList[iViewIdx]->write( pcPicYuvRec, m_cropLeft, m_cropRight, m_cropTop, m_cropBottom ); |
---|
| 1058 | #else |
---|
| 1059 | m_acTVideoIOYuvReconFileList[iViewIdx]->write( pcPicYuvRec, m_aiPad ); |
---|
| 1060 | #endif |
---|
| 1061 | } |
---|
| 1062 | } |
---|
| 1063 | else |
---|
| 1064 | { |
---|
| 1065 | if (m_pchDepthReconFileList[iViewIdx]) |
---|
| 1066 | { |
---|
| 1067 | #if PIC_CROPPING |
---|
| 1068 | m_acTVideoIOYuvDepthReconFileList[iViewIdx]->write( pcPicYuvRec, m_cropLeft, m_cropRight, m_cropTop, m_cropBottom ); |
---|
| 1069 | #else |
---|
| 1070 | m_acTVideoIOYuvDepthReconFileList[iViewIdx]->write( pcPicYuvRec, m_aiPad ); |
---|
| 1071 | #endif |
---|
| 1072 | } |
---|
| 1073 | } |
---|
| 1074 | } |
---|
[2] | 1075 | } |
---|
[56] | 1076 | if( ! accessUnits.empty() ) |
---|
[2] | 1077 | { |
---|
[56] | 1078 | list<AccessUnit>::iterator aUIter; |
---|
| 1079 | for( aUIter = accessUnits.begin(); aUIter != accessUnits.end(); aUIter++ ) |
---|
[2] | 1080 | { |
---|
[56] | 1081 | const vector<unsigned>& stats = writeAnnexB(bitstreamFile, *aUIter); |
---|
| 1082 | rateStatsAccum(*aUIter, stats); |
---|
[2] | 1083 | } |
---|
| 1084 | } |
---|
[56] | 1085 | } |
---|
[2] | 1086 | |
---|
| 1087 | |
---|
| 1088 | TComPicYuv* TAppEncTop::xGetPicYuvFromView( Int iViewIdx, Int iPoc, Bool bDepth, Bool bRecon ) |
---|
| 1089 | { |
---|
[5] | 1090 | TComPic* pcPic = xGetPicFromView( iViewIdx, iPoc, bDepth); |
---|
| 1091 | TComPicYuv* pcPicYuv = NULL; |
---|
[2] | 1092 | |
---|
| 1093 | if (pcPic != NULL) |
---|
| 1094 | { |
---|
| 1095 | if( bRecon ) |
---|
| 1096 | { |
---|
| 1097 | if ( pcPic->getReconMark() ) |
---|
| 1098 | { |
---|
[5] | 1099 | pcPicYuv = pcPic->getPicYuvRec(); |
---|
[2] | 1100 | } |
---|
| 1101 | } |
---|
| 1102 | else |
---|
| 1103 | { |
---|
[5] | 1104 | pcPicYuv = pcPic->getPicYuvOrg(); |
---|
| 1105 | } |
---|
[2] | 1106 | }; |
---|
| 1107 | |
---|
[5] | 1108 | return pcPicYuv; |
---|
| 1109 | }; |
---|
[2] | 1110 | |
---|
[56] | 1111 | /** |
---|
| 1112 | * |
---|
| 1113 | */ |
---|
| 1114 | void TAppEncTop::rateStatsAccum(const AccessUnit& au, const std::vector<unsigned>& annexBsizes) |
---|
[2] | 1115 | { |
---|
[56] | 1116 | AccessUnit::const_iterator it_au = au.begin(); |
---|
| 1117 | vector<unsigned>::const_iterator it_stats = annexBsizes.begin(); |
---|
[2] | 1118 | |
---|
[56] | 1119 | for (; it_au != au.end(); it_au++, it_stats++) |
---|
[2] | 1120 | { |
---|
[56] | 1121 | switch ((*it_au)->m_nalUnitType) |
---|
[2] | 1122 | { |
---|
[56] | 1123 | case NAL_UNIT_CODED_SLICE: |
---|
| 1124 | #if H0566_TLA |
---|
| 1125 | case NAL_UNIT_CODED_SLICE_IDV: |
---|
| 1126 | case NAL_UNIT_CODED_SLICE_TLA: |
---|
| 1127 | case NAL_UNIT_CODED_SLICE_CRA: |
---|
| 1128 | #else |
---|
| 1129 | case NAL_UNIT_CODED_SLICE_DATAPART_A: |
---|
| 1130 | case NAL_UNIT_CODED_SLICE_DATAPART_B: |
---|
| 1131 | case NAL_UNIT_CODED_SLICE_CDR: |
---|
| 1132 | #endif |
---|
| 1133 | case NAL_UNIT_CODED_SLICE_IDR: |
---|
| 1134 | case NAL_UNIT_SPS: |
---|
| 1135 | case NAL_UNIT_PPS: |
---|
| 1136 | m_essentialBytes += *it_stats; |
---|
| 1137 | break; |
---|
| 1138 | default: |
---|
| 1139 | break; |
---|
[2] | 1140 | } |
---|
| 1141 | |
---|
[56] | 1142 | m_totalBytes += *it_stats; |
---|
[2] | 1143 | } |
---|
| 1144 | } |
---|
| 1145 | |
---|
[5] | 1146 | #if HHI_INTERVIEW_SKIP |
---|
[2] | 1147 | Void TAppEncTop::getUsedPelsMap( Int iViewIdx, Int iPoc, TComPicYuv* pcPicYuvUsedSplsMap ) |
---|
| 1148 | { |
---|
[5] | 1149 | AOT( iViewIdx <= 0); |
---|
| 1150 | AOT( iViewIdx >= m_iNumberOfViews ); |
---|
| 1151 | AOF( m_cCameraData.getCurFrameId() == iPoc ); |
---|
| 1152 | Int iViewSIdx = m_cCameraData.getBaseId2SortedId()[iViewIdx]; |
---|
| 1153 | Int iFirstViewSIdx = m_cCameraData.getBaseId2SortedId()[0]; |
---|
[2] | 1154 | |
---|
| 1155 | AOT( iViewSIdx == iFirstViewSIdx ); |
---|
| 1156 | |
---|
[5] | 1157 | Bool bFirstIsLeft = (iFirstViewSIdx < iViewSIdx); |
---|
[2] | 1158 | |
---|
[56] | 1159 | m_cUsedPelsRenderer.setShiftLUTs( |
---|
[2] | 1160 | m_cCameraData.getBaseViewShiftLUTD()[0][iViewIdx], |
---|
| 1161 | m_cCameraData.getBaseViewShiftLUTI()[0][iViewIdx], |
---|
| 1162 | m_cCameraData.getBaseViewShiftLUTI()[0][iViewIdx], |
---|
| 1163 | m_cCameraData.getBaseViewShiftLUTD()[0][iViewIdx], |
---|
| 1164 | m_cCameraData.getBaseViewShiftLUTI()[0][iViewIdx], |
---|
| 1165 | m_cCameraData.getBaseViewShiftLUTI()[0][iViewIdx], |
---|
| 1166 | -1 |
---|
[5] | 1167 | ); |
---|
[2] | 1168 | |
---|
| 1169 | TComPicYuv* pcPicYuvDepth = xGetPicYuvFromView(0, iPoc, true, true ); |
---|
[5] | 1170 | AOF( pcPicYuvDepth); |
---|
[2] | 1171 | |
---|
[5] | 1172 | m_cUsedPelsRenderer.getUsedSamplesMap( pcPicYuvDepth, pcPicYuvUsedSplsMap, bFirstIsLeft ); |
---|
[2] | 1173 | } |
---|
[5] | 1174 | #endif |
---|
| 1175 | #if HHI_VSO |
---|
[2] | 1176 | Void TAppEncTop::setupRenModel( Int iPoc, Int iEncViewIdx, Int iEncContent ) |
---|
| 1177 | { |
---|
[5] | 1178 | Int iEncViewSIdx = m_cCameraData.getBaseId2SortedId()[ iEncViewIdx ]; |
---|
[2] | 1179 | |
---|
| 1180 | // setup base views |
---|
[5] | 1181 | Int iNumOfBV = m_cRenModStrParser.getNumOfBaseViewsForView( iEncViewSIdx, iEncContent ); |
---|
[2] | 1182 | |
---|
| 1183 | for (Int iCurView = 0; iCurView < iNumOfBV; iCurView++ ) |
---|
[5] | 1184 | { |
---|
| 1185 | Int iBaseViewSIdx; |
---|
| 1186 | Int iVideoDistMode; |
---|
| 1187 | Int iDepthDistMode; |
---|
[2] | 1188 | |
---|
[5] | 1189 | m_cRenModStrParser.getBaseViewData( iEncViewSIdx, iEncContent, iCurView, iBaseViewSIdx, iVideoDistMode, iDepthDistMode ); |
---|
[2] | 1190 | |
---|
[5] | 1191 | AOT( iVideoDistMode < 0 || iVideoDistMode > 2 ); |
---|
[2] | 1192 | |
---|
[5] | 1193 | Int iBaseViewIdx = m_cCameraData.getBaseSortedId2Id()[ iBaseViewSIdx ]; |
---|
[2] | 1194 | |
---|
[5] | 1195 | TComPicYuv* pcPicYuvVideoRec = xGetPicYuvFromView( iBaseViewIdx, iPoc, false, true ); |
---|
| 1196 | TComPicYuv* pcPicYuvDepthRec = xGetPicYuvFromView( iBaseViewIdx, iPoc, true , true ); |
---|
| 1197 | TComPicYuv* pcPicYuvVideoOrg = xGetPicYuvFromView( iBaseViewIdx, iPoc, false, false ); |
---|
| 1198 | TComPicYuv* pcPicYuvDepthOrg = xGetPicYuvFromView( iBaseViewIdx, iPoc, true , false ); |
---|
[2] | 1199 | |
---|
[5] | 1200 | TComPicYuv* pcPicYuvVideoRef = ( iVideoDistMode == 2 ) ? pcPicYuvVideoOrg : NULL; |
---|
| 1201 | TComPicYuv* pcPicYuvDepthRef = ( iDepthDistMode == 2 ) ? pcPicYuvDepthOrg : NULL; |
---|
[2] | 1202 | |
---|
[5] | 1203 | TComPicYuv* pcPicYuvVideoTest = ( iVideoDistMode == 0 ) ? pcPicYuvVideoOrg : pcPicYuvVideoRec; |
---|
| 1204 | TComPicYuv* pcPicYuvDepthTest = ( iDepthDistMode == 0 ) ? pcPicYuvDepthOrg : pcPicYuvDepthRec; |
---|
| 1205 | |
---|
| 1206 | AOT( (iVideoDistMode == 2) != (pcPicYuvVideoRef != NULL) ); |
---|
| 1207 | AOT( (iDepthDistMode == 2) != (pcPicYuvDepthRef != NULL) ); |
---|
| 1208 | AOT( pcPicYuvDepthTest == NULL ); |
---|
| 1209 | AOT( pcPicYuvVideoTest == NULL ); |
---|
| 1210 | |
---|
| 1211 | m_cRendererModel.setBaseView( iBaseViewSIdx, pcPicYuvVideoTest, pcPicYuvDepthTest, pcPicYuvVideoRef, pcPicYuvDepthRef ); |
---|
[2] | 1212 | } |
---|
| 1213 | |
---|
[5] | 1214 | m_cRendererModel.setErrorMode( iEncViewSIdx, iEncContent, 0 ); |
---|
[2] | 1215 | // setup virtual views |
---|
[5] | 1216 | Int iNumOfSV = m_cRenModStrParser.getNumOfModelsForView( iEncViewSIdx, iEncContent ); |
---|
[2] | 1217 | for (Int iCurView = 0; iCurView < iNumOfSV; iCurView++ ) |
---|
[5] | 1218 | { |
---|
| 1219 | Int iOrgRefBaseViewSIdx; |
---|
| 1220 | Int iLeftBaseViewSIdx; |
---|
| 1221 | Int iRightBaseViewSIdx; |
---|
| 1222 | Int iSynthViewRelNum; |
---|
| 1223 | Int iModelNum; |
---|
| 1224 | Int iBlendMode; |
---|
| 1225 | m_cRenModStrParser.getSingleModelData(iEncViewSIdx, iEncContent, iCurView, iModelNum, iBlendMode,iLeftBaseViewSIdx, iRightBaseViewSIdx, iOrgRefBaseViewSIdx, iSynthViewRelNum ); |
---|
[2] | 1226 | |
---|
[5] | 1227 | Int iLeftBaseViewIdx = -1; |
---|
| 1228 | Int iRightBaseViewIdx = -1; |
---|
[2] | 1229 | |
---|
[5] | 1230 | TComPicYuv* pcPicYuvOrgRef = NULL; |
---|
| 1231 | Int** ppiShiftLUTLeft = NULL; |
---|
| 1232 | Int** ppiShiftLUTRight = NULL; |
---|
| 1233 | Int** ppiBaseShiftLUTLeft = NULL; |
---|
| 1234 | Int** ppiBaseShiftLUTRight = NULL; |
---|
[2] | 1235 | |
---|
| 1236 | |
---|
[5] | 1237 | Int iDistToLeft = -1; |
---|
[2] | 1238 | |
---|
[5] | 1239 | Int iSynthViewIdx = m_cCameraData.synthRelNum2Idx( iSynthViewRelNum ); |
---|
[2] | 1240 | |
---|
| 1241 | if ( iLeftBaseViewSIdx != -1 ) |
---|
| 1242 | { |
---|
[5] | 1243 | iLeftBaseViewIdx = m_cCameraData.getBaseSortedId2Id() [ iLeftBaseViewSIdx ]; |
---|
[2] | 1244 | ppiShiftLUTLeft = m_cCameraData.getSynthViewShiftLUTI()[ iLeftBaseViewIdx ][ iSynthViewIdx ]; |
---|
| 1245 | } |
---|
| 1246 | |
---|
| 1247 | if ( iRightBaseViewSIdx != -1 ) |
---|
| 1248 | { |
---|
[5] | 1249 | iRightBaseViewIdx = m_cCameraData.getBaseSortedId2Id() [iRightBaseViewSIdx ]; |
---|
[2] | 1250 | ppiShiftLUTRight = m_cCameraData.getSynthViewShiftLUTI()[ iRightBaseViewIdx ][ iSynthViewIdx ]; |
---|
| 1251 | } |
---|
| 1252 | |
---|
| 1253 | if ( iRightBaseViewSIdx != -1 && iLeftBaseViewSIdx != -1 ) |
---|
[5] | 1254 | { |
---|
| 1255 | iDistToLeft = m_cCameraData.getRelDistLeft( iSynthViewIdx , iLeftBaseViewIdx, iRightBaseViewIdx); |
---|
[2] | 1256 | ppiBaseShiftLUTLeft = m_cCameraData.getBaseViewShiftLUTI() [ iLeftBaseViewIdx ][ iRightBaseViewIdx ]; |
---|
| 1257 | ppiBaseShiftLUTRight = m_cCameraData.getBaseViewShiftLUTI() [ iRightBaseViewIdx ][ iLeftBaseViewIdx ]; |
---|
| 1258 | |
---|
| 1259 | } |
---|
| 1260 | |
---|
| 1261 | if ( iOrgRefBaseViewSIdx != -1 ) |
---|
| 1262 | { |
---|
[5] | 1263 | pcPicYuvOrgRef = xGetPicYuvFromView( m_cCameraData.getBaseSortedId2Id()[ iOrgRefBaseViewSIdx ] , iPoc, false, false ); |
---|
| 1264 | AOF ( pcPicYuvOrgRef ); |
---|
| 1265 | } |
---|
[2] | 1266 | |
---|
[5] | 1267 | m_cRendererModel.setSingleModel( iModelNum, ppiShiftLUTLeft, ppiBaseShiftLUTLeft, ppiShiftLUTRight, ppiBaseShiftLUTRight, iDistToLeft, pcPicYuvOrgRef ); |
---|
[2] | 1268 | } |
---|
| 1269 | } |
---|
[5] | 1270 | #endif |
---|
[2] | 1271 | |
---|
[56] | 1272 | |
---|
| 1273 | |
---|
| 1274 | /* |
---|
| 1275 | void TAppEncTop::printRateSummary() |
---|
| 1276 | { |
---|
| 1277 | double time = (double) m_iFrameRcvd / m_iFrameRate; |
---|
| 1278 | printf("Bytes written to file: %u (%.3f kbps)\n", m_totalBytes, 0.008 * m_totalBytes / time); |
---|
| 1279 | #if VERBOSE_RATE |
---|
| 1280 | printf("Bytes for SPS/PPS/Slice (Incl. Annex B): %u (%.3f kbps)\n", m_essentialBytes, 0.008 * m_essentialBytes / time); |
---|
| 1281 | #endif |
---|
| 1282 | } |
---|
| 1283 | */ |
---|
| 1284 | |
---|
| 1285 | std::vector<TComPic*> TAppEncTop::getInterViewRefPics( Int viewId, Int poc, Bool isDepth, TComSPS* sps ) |
---|
| 1286 | { |
---|
| 1287 | std::vector<TComPic*> apcRefPics( sps->getNumberOfUsableInterViewRefs(), (TComPic*)NULL ); |
---|
| 1288 | for( Int k = 0; k < sps->getNumberOfUsableInterViewRefs(); k++ ) |
---|
| 1289 | { |
---|
| 1290 | TComPic* pcRefPic = xGetPicFromView( sps->getUsableInterViewRef( k ) + viewId, poc, isDepth ); |
---|
| 1291 | assert( pcRefPic != NULL ); |
---|
| 1292 | apcRefPics[k] = pcRefPic; |
---|
| 1293 | } |
---|
| 1294 | return apcRefPics; |
---|
| 1295 | } |
---|
| 1296 | |
---|
| 1297 | TComPic* TAppEncTop::xGetPicFromView( Int viewIdx, Int poc, Bool isDepth ) |
---|
| 1298 | { |
---|
| 1299 | assert( ( viewIdx >= 0 ) && ( viewIdx < m_iNumberOfViews ) ); |
---|
| 1300 | |
---|
| 1301 | TComList<TComPic*>* apcListPic = (isDepth ? m_acTEncDepthTopList[viewIdx] : m_acTEncTopList[viewIdx])->getListPic() ; |
---|
| 1302 | |
---|
| 1303 | TComPic* pcPic = NULL; |
---|
| 1304 | for(TComList<TComPic*>::iterator it=apcListPic->begin(); it!=apcListPic->end(); it++) |
---|
| 1305 | { |
---|
| 1306 | if( (*it)->getPOC() == poc ) |
---|
| 1307 | { |
---|
| 1308 | pcPic = *it ; |
---|
| 1309 | break ; |
---|
| 1310 | } |
---|
| 1311 | } |
---|
| 1312 | |
---|
| 1313 | return pcPic; |
---|
| 1314 | }; |
---|
| 1315 | |
---|
| 1316 | //! \} |
---|