| 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 |
|---|
| 4 | * granted under this license. |
|---|
| 5 | * |
|---|
| 6 | * Copyright (c) 2010-2011, ISO/IEC |
|---|
| 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. |
|---|
| 17 | * * Neither the name of the ISO/IEC nor the names of its contributors may |
|---|
| 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 | */ |
|---|
| 33 | |
|---|
| 34 | |
|---|
| 35 | |
|---|
| 36 | /** \file TAppEncTop.cpp |
|---|
| 37 | \brief Encoder application class |
|---|
| 38 | */ |
|---|
| 39 | |
|---|
| 40 | #include <list> |
|---|
| 41 | #include <stdio.h> |
|---|
| 42 | #include <fcntl.h> |
|---|
| 43 | #include <assert.h> |
|---|
| 44 | |
|---|
| 45 | #include "TAppEncTop.h" |
|---|
| 46 | |
|---|
| 47 | // ==================================================================================================================== |
|---|
| 48 | // Constructor / destructor / initialization / destroy |
|---|
| 49 | // ==================================================================================================================== |
|---|
| 50 | |
|---|
| 51 | TAppEncTop::TAppEncTop() |
|---|
| 52 | { |
|---|
| 53 | #if HHI_VSO |
|---|
| 54 | m_iLastFramePutInERViewBuffer = -1; |
|---|
| 55 | #endif |
|---|
| 56 | } |
|---|
| 57 | |
|---|
| 58 | TAppEncTop::~TAppEncTop() |
|---|
| 59 | { |
|---|
| 60 | } |
|---|
| 61 | |
|---|
| 62 | |
|---|
| 63 | Void TAppEncTop::xInitLibCfg() |
|---|
| 64 | { |
|---|
| 65 | for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) |
|---|
| 66 | { |
|---|
| 67 | m_iFrameRcvdVector.push_back(0) ; |
|---|
| 68 | m_acTEncTopList.push_back(new TEncTop); |
|---|
| 69 | |
|---|
| 70 | m_acTVideoIOYuvInputFileList.push_back(new TVideoIOYuv); |
|---|
| 71 | |
|---|
| 72 | m_acTVideoIOYuvReconFileList.push_back(new TVideoIOYuv); |
|---|
| 73 | m_cListPicYuvRecList.push_back(new TComList<TComPicYuv*>) ; |
|---|
| 74 | m_aiNextPocToDump.push_back( 0 ); |
|---|
| 75 | m_cListPicYuvRecMap.push_back( std::map<PicOrderCnt,TComPicYuv*>() ); |
|---|
| 76 | m_acTEncTopList[iViewIdx]->setFrameRate ( m_iFrameRate ); |
|---|
| 77 | m_acTEncTopList[iViewIdx]->setFrameSkip ( m_FrameSkip ); |
|---|
| 78 | m_acTEncTopList[iViewIdx]->setSourceWidth ( m_iSourceWidth ); |
|---|
| 79 | m_acTEncTopList[iViewIdx]->setSourceHeight ( m_iSourceHeight ); |
|---|
| 80 | m_acTEncTopList[iViewIdx]->setFrameToBeEncoded ( m_iFrameToBeEncoded ); |
|---|
| 81 | |
|---|
| 82 | //====== Coding Structure ======== |
|---|
| 83 | #if DCM_DECODING_REFRESH |
|---|
| 84 | m_acTEncTopList[iViewIdx]->setDecodingRefreshType ( m_iDecodingRefreshType ); |
|---|
| 85 | #endif |
|---|
| 86 | m_acTEncTopList[iViewIdx]->setCPSSize ( m_uiCodedPictureStoreSize ); |
|---|
| 87 | m_acTEncTopList[iViewIdx]->setGOPSize ( m_iGOPSize ); |
|---|
| 88 | m_acTEncTopList[iViewIdx]->setRateGOPSize ( m_iRateGOPSize ); |
|---|
| 89 | |
|---|
| 90 | m_acTEncTopList[iViewIdx]->setSeqStructure ( m_cInputFormatString ); |
|---|
| 91 | |
|---|
| 92 | m_acTEncTopList[iViewIdx]->setQP ( m_aiQP[0] ); |
|---|
| 93 | |
|---|
| 94 | m_acTEncTopList[iViewIdx]->setTemporalLayerQPOffset ( m_aiTLayerQPOffset ); |
|---|
| 95 | m_acTEncTopList[iViewIdx]->setPad ( m_aiPad ); |
|---|
| 96 | |
|---|
| 97 | //===== Slice ======== |
|---|
| 98 | |
|---|
| 99 | //====== Entropy Coding ======== |
|---|
| 100 | m_acTEncTopList[iViewIdx]->setSymbolMode ( m_iSymbolMode ); |
|---|
| 101 | |
|---|
| 102 | //====== Loop/Deblock Filter ======== |
|---|
| 103 | m_acTEncTopList[iViewIdx]->setLoopFilterDisable ( m_abLoopFilterDisable[0] ); |
|---|
| 104 | m_acTEncTopList[iViewIdx]->setLoopFilterAlphaC0Offset ( m_iLoopFilterAlphaC0Offset ); |
|---|
| 105 | m_acTEncTopList[iViewIdx]->setLoopFilterBetaOffset ( m_iLoopFilterBetaOffset ); |
|---|
| 106 | |
|---|
| 107 | //====== Motion search ======== |
|---|
| 108 | m_acTEncTopList[iViewIdx]->setFastSearch ( m_iFastSearch ); |
|---|
| 109 | m_acTEncTopList[iViewIdx]->setSearchRange ( m_iSearchRange ); |
|---|
| 110 | m_acTEncTopList[iViewIdx]->setBipredSearchRange ( m_bipredSearchRange ); |
|---|
| 111 | m_acTEncTopList[iViewIdx]->setMaxDeltaQP ( m_iMaxDeltaQP ); |
|---|
| 112 | |
|---|
| 113 | #if HHI_VSO |
|---|
| 114 | //====== VSO ========= |
|---|
| 115 | m_acTEncTopList[iViewIdx]->setForceLambdaScaleVSO ( false ); |
|---|
| 116 | m_acTEncTopList[iViewIdx]->setLambdaScaleVSO ( 1 ); |
|---|
| 117 | m_acTEncTopList[iViewIdx]->setVSOMode ( 0 ); |
|---|
| 118 | #endif |
|---|
| 119 | |
|---|
| 120 | //====== Tool list ======== |
|---|
| 121 | m_acTEncTopList[iViewIdx]->setUseSBACRD ( m_bUseSBACRD ); |
|---|
| 122 | m_acTEncTopList[iViewIdx]->setDeltaQpRD ( m_uiDeltaQpRD ); |
|---|
| 123 | m_acTEncTopList[iViewIdx]->setUseASR ( m_bUseASR ); |
|---|
| 124 | m_acTEncTopList[iViewIdx]->setUseHADME ( m_bUseHADME ); |
|---|
| 125 | m_acTEncTopList[iViewIdx]->setUseALF ( m_abUseALF[0] ); |
|---|
| 126 | #if MQT_ALF_NPASS |
|---|
| 127 | m_acTEncTopList[iViewIdx]->setALFEncodePassReduction ( m_iALFEncodePassReduction ); |
|---|
| 128 | #endif |
|---|
| 129 | #if DCM_COMB_LIST |
|---|
| 130 | m_acTEncTopList[iViewIdx]->setUseLComb ( m_bUseLComb ); |
|---|
| 131 | m_acTEncTopList[iViewIdx]->setLCMod ( m_bLCMod ); |
|---|
| 132 | #endif |
|---|
| 133 | m_acTEncTopList[iViewIdx]->setdQPs ( m_aidQP ); |
|---|
| 134 | m_acTEncTopList[iViewIdx]->setUseRDOQ ( m_abUseRDOQ[0] ); |
|---|
| 135 | m_acTEncTopList[iViewIdx]->setUseLDC ( m_bUseLDC ); |
|---|
| 136 | m_acTEncTopList[iViewIdx]->setUsePAD ( m_bUsePAD ); |
|---|
| 137 | m_acTEncTopList[iViewIdx]->setQuadtreeTULog2MaxSize ( m_uiQuadtreeTULog2MaxSize ); |
|---|
| 138 | m_acTEncTopList[iViewIdx]->setQuadtreeTULog2MinSize ( m_uiQuadtreeTULog2MinSize ); |
|---|
| 139 | m_acTEncTopList[iViewIdx]->setQuadtreeTUMaxDepthInter ( m_uiQuadtreeTUMaxDepthInter ); |
|---|
| 140 | m_acTEncTopList[iViewIdx]->setQuadtreeTUMaxDepthIntra ( m_uiQuadtreeTUMaxDepthIntra ); |
|---|
| 141 | m_acTEncTopList[iViewIdx]->setUseFastEnc ( m_bUseFastEnc ); |
|---|
| 142 | |
|---|
| 143 | #if POZNAN_NONLINEAR_DEPTH |
|---|
| 144 | m_acTEncTopList[iViewIdx]->setNonlinearDepthModel ( m_cNonlinearDepthModel ); |
|---|
| 145 | m_acTEncTopList[iViewIdx]->setUseNonlinearDepth ( m_bUseNonlinearDepth ); |
|---|
| 146 | #endif |
|---|
| 147 | |
|---|
| 148 | #if HHI_VSO |
|---|
| 149 | m_acTEncTopList[iViewIdx]->setUseVSO ( false ); //GT: might be enabled later for VSO Mode 4 |
|---|
| 150 | #endif |
|---|
| 151 | |
|---|
| 152 | m_acTEncTopList[iViewIdx]->setViewId ( (UInt)iViewIdx ); |
|---|
| 153 | m_acTEncTopList[iViewIdx]->setViewOrderIdx ( m_cCameraData.getViewOrderIndex()[ iViewIdx ] ); |
|---|
| 154 | m_acTEncTopList[iViewIdx]->setIsDepth ( false ); |
|---|
| 155 | m_acTEncTopList[iViewIdx]->setCamParPrecision ( m_cCameraData.getCamParsCodedPrecision () ); |
|---|
| 156 | m_acTEncTopList[iViewIdx]->setCamParInSliceHeader ( m_cCameraData.getVaryingCameraParameters() ); |
|---|
| 157 | m_acTEncTopList[iViewIdx]->setCodedScale ( m_cCameraData.getCodedScale () ); |
|---|
| 158 | m_acTEncTopList[iViewIdx]->setCodedOffset ( m_cCameraData.getCodedOffset () ); |
|---|
| 159 | #if DEPTH_MAP_GENERATION |
|---|
| 160 | m_acTEncTopList[iViewIdx]->setPredDepthMapGeneration ( m_uiPredDepthMapGeneration ); |
|---|
| 161 | m_acTEncTopList[iViewIdx]->setPdmPrecision ( (UInt)m_cCameraData.getPdmPrecision () ); |
|---|
| 162 | m_acTEncTopList[iViewIdx]->setPdmScaleNomDelta ( m_cCameraData.getPdmScaleNomDelta () ); |
|---|
| 163 | m_acTEncTopList[iViewIdx]->setPdmOffset ( m_cCameraData.getPdmOffset () ); |
|---|
| 164 | #endif |
|---|
| 165 | #if HHI_INTER_VIEW_MOTION_PRED |
|---|
| 166 | m_acTEncTopList[iViewIdx]->setMultiviewMvPredMode ( m_uiMultiviewMvPredMode ); |
|---|
| 167 | m_acTEncTopList[iViewIdx]->setMultiviewMvRegMode ( iViewIdx ? m_uiMultiviewMvRegMode : 0 ); |
|---|
| 168 | m_acTEncTopList[iViewIdx]->setMultiviewMvRegLambdaScale ( iViewIdx ? m_dMultiviewMvRegLambdaScale : 0.0 ); |
|---|
| 169 | #endif |
|---|
| 170 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
|---|
| 171 | m_acTEncTopList[iViewIdx]->setMultiviewResPredMode ( m_uiMultiviewResPredMode ); |
|---|
| 172 | #endif |
|---|
| 173 | |
|---|
| 174 | #if POZNAN_DBMP |
|---|
| 175 | m_acTEncTopList[iViewIdx]->setDBMP ( m_uiDBMP ); |
|---|
| 176 | #endif |
|---|
| 177 | |
|---|
| 178 | #if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU |
|---|
| 179 | m_acTEncTopList[iViewIdx]->setUseCUSkip ( m_uiUseCUSkip ); |
|---|
| 180 | #endif |
|---|
| 181 | |
|---|
| 182 | #if HHI_INTERVIEW_SKIP |
|---|
| 183 | m_acTEncTopList[iViewIdx]->setInterViewSkip ( iViewIdx ? m_uiInterViewSkip : 0 ); |
|---|
| 184 | #if HHI_INTERVIEW_SKIP_LAMBDA_SCALE |
|---|
| 185 | m_acTEncTopList[iViewIdx]->setInterViewSkipLambdaScale ( iViewIdx ? (Int)m_dInterViewSkipLambdaScale : 1 ); |
|---|
| 186 | #endif |
|---|
| 187 | #endif |
|---|
| 188 | m_acTEncTopList[iViewIdx]->setUseMRG ( m_bUseMRG ); // SOPH: |
|---|
| 189 | |
|---|
| 190 | #if LM_CHROMA |
|---|
| 191 | m_acTEncTopList[iViewIdx]->setUseLMChroma ( m_bUseLMChroma ); |
|---|
| 192 | #endif |
|---|
| 193 | |
|---|
| 194 | #if HHI_RMP_SWITCH |
|---|
| 195 | m_acTEncTopList[iViewIdx]->setUseRMP ( m_bUseRMP ); |
|---|
| 196 | #endif |
|---|
| 197 | #ifdef ROUNDING_CONTROL_BIPRED |
|---|
| 198 | m_acTEncTopList[iViewIdx]->setUseRoundingControlBipred(m_useRoundingControlBipred); |
|---|
| 199 | #endif |
|---|
| 200 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
|---|
| 201 | m_acTEncTopList[iViewIdx]->setUseDMM( false ); |
|---|
| 202 | #endif |
|---|
| 203 | #if CONSTRAINED_INTRA_PRED |
|---|
| 204 | m_acTEncTopList[iViewIdx]->setUseConstrainedIntraPred ( m_bUseConstrainedIntraPred ); |
|---|
| 205 | #endif |
|---|
| 206 | #ifdef WEIGHT_PRED |
|---|
| 207 | //====== Weighted Prediction ======== |
|---|
| 208 | m_acTEncTopList[iViewIdx]->setUseWP ( m_bUseWeightPred ); |
|---|
| 209 | m_acTEncTopList[iViewIdx]->setWPBiPredIdc ( m_uiBiPredIdc ); |
|---|
| 210 | #endif |
|---|
| 211 | //====== Slice ======== |
|---|
| 212 | m_acTEncTopList[iViewIdx]->setSliceMode ( m_iSliceMode ); |
|---|
| 213 | m_acTEncTopList[iViewIdx]->setSliceArgument ( m_iSliceArgument ); |
|---|
| 214 | |
|---|
| 215 | //====== Entropy Slice ======== |
|---|
| 216 | m_acTEncTopList[iViewIdx]->setEntropySliceMode ( m_iEntropySliceMode ); |
|---|
| 217 | m_acTEncTopList[iViewIdx]->setEntropySliceArgument ( m_iEntropySliceArgument ); |
|---|
| 218 | #if MTK_NONCROSS_INLOOP_FILTER |
|---|
| 219 | if(m_iSliceMode == 0 ) |
|---|
| 220 | { |
|---|
| 221 | m_bLFCrossSliceBoundaryFlag = true; |
|---|
| 222 | } |
|---|
| 223 | m_acTEncTopList[iViewIdx]->setLFCrossSliceBoundaryFlag( m_bLFCrossSliceBoundaryFlag ); |
|---|
| 224 | #endif |
|---|
| 225 | #if MTK_SAO |
|---|
| 226 | m_acTEncTopList[iViewIdx]->setUseSAO ( m_abUseSAO[0] ); |
|---|
| 227 | #endif |
|---|
| 228 | #if HHI_MPI |
|---|
| 229 | m_acTEncTopList[iViewIdx]->setUseMVI( false ); |
|---|
| 230 | #endif |
|---|
| 231 | |
|---|
| 232 | m_acTEncTopList[iViewIdx]->setPictureDigestEnabled(m_pictureDigestEnabled); |
|---|
| 233 | m_acTEncTopList[iViewIdx]->setQpChangeFrame( m_iQpChangeFrame ); |
|---|
| 234 | m_acTEncTopList[iViewIdx]->setQpChangeOffsetVideo( m_iQpChangeOffsetVideo ); |
|---|
| 235 | m_acTEncTopList[iViewIdx]->setQpChangeOffsetDepth( m_iQpChangeOffsetDepth ); |
|---|
| 236 | |
|---|
| 237 | |
|---|
| 238 | #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH |
|---|
| 239 | m_acTEncTopList[iViewIdx]->setUseTexDqpAccordingToDepth ( m_bUseTexDqpAccordingToDepth ); |
|---|
| 240 | #endif |
|---|
| 241 | #if POZNAN_TEXTURE_TU_DELTA_QP_PARAM_IN_CFG_FOR_ENC |
|---|
| 242 | m_acTEncTopList[iViewIdx]->setTexDqpAccordingToDepthOffset( m_dTexDqpAccordingToDepthOffset ); |
|---|
| 243 | m_acTEncTopList[iViewIdx]->setTexDqpAccordingToDepthMul( m_dTexDqpAccordingToDepthMul ); |
|---|
| 244 | m_acTEncTopList[iViewIdx]->setTexDqpAccordingToDepthTopBottomRow( m_iTexDqpAccordingToDepthTopBottomRow ); |
|---|
| 245 | #endif |
|---|
| 246 | } |
|---|
| 247 | if( m_bUsingDepthMaps ) |
|---|
| 248 | { |
|---|
| 249 | |
|---|
| 250 | #if HHI_VSO |
|---|
| 251 | for (Int iViewIdx=0; iViewIdx<m_iNumberOfExternalRefs; iViewIdx++) |
|---|
| 252 | { |
|---|
| 253 | m_acTVideoIOYuvERFileList.push_back(new TVideoIOYuv); |
|---|
| 254 | } |
|---|
| 255 | #endif |
|---|
| 256 | |
|---|
| 257 | for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) |
|---|
| 258 | { |
|---|
| 259 | #if FLEX_CODING_ORDER |
|---|
| 260 | // Detect whether depth comes before than texture for this view |
|---|
| 261 | Bool isDepthFirst = false; |
|---|
| 262 | if ( m_b3DVFlexOrder ) |
|---|
| 263 | { |
|---|
| 264 | for ( Int ii=1; ii<12; ii+=2 ) |
|---|
| 265 | { |
|---|
| 266 | Int iViewIdxCfg = (Int)(m_pchMVCJointCodingOrder[ii]-'0'); |
|---|
| 267 | if ( iViewIdxCfg == iViewIdx ) |
|---|
| 268 | { |
|---|
| 269 | if ( m_pchMVCJointCodingOrder[ii-1]=='D' ) // depth comes first for this view |
|---|
| 270 | { |
|---|
| 271 | isDepthFirst = true; |
|---|
| 272 | } |
|---|
| 273 | else |
|---|
| 274 | { |
|---|
| 275 | assert(m_pchMVCJointCodingOrder[ii-1]=='T'); |
|---|
| 276 | } |
|---|
| 277 | break; |
|---|
| 278 | } |
|---|
| 279 | } |
|---|
| 280 | } |
|---|
| 281 | #endif |
|---|
| 282 | m_iDepthFrameRcvdVector.push_back(0) ; |
|---|
| 283 | m_acTEncDepthTopList.push_back(new TEncTop); |
|---|
| 284 | |
|---|
| 285 | m_acTVideoIOYuvDepthInputFileList.push_back(new TVideoIOYuv); |
|---|
| 286 | |
|---|
| 287 | m_acTVideoIOYuvDepthReconFileList.push_back(new TVideoIOYuv); |
|---|
| 288 | m_cListPicYuvDepthRecList.push_back(new TComList<TComPicYuv*>) ; |
|---|
| 289 | m_aiNextDepthPocToDump.push_back( 0 ); |
|---|
| 290 | m_cListPicYuvDepthRecMap.push_back( std::map<PicOrderCnt,TComPicYuv*>() ); |
|---|
| 291 | m_acTEncDepthTopList[iViewIdx]->setFrameRate ( m_iFrameRate ); |
|---|
| 292 | m_acTEncDepthTopList[iViewIdx]->setFrameSkip ( m_FrameSkip ); |
|---|
| 293 | m_acTEncDepthTopList[iViewIdx]->setSourceWidth ( m_iSourceWidth ); |
|---|
| 294 | m_acTEncDepthTopList[iViewIdx]->setSourceHeight ( m_iSourceHeight ); |
|---|
| 295 | m_acTEncDepthTopList[iViewIdx]->setFrameToBeEncoded ( m_iFrameToBeEncoded ); |
|---|
| 296 | |
|---|
| 297 | //====== Coding Structure ======== |
|---|
| 298 | #if DCM_DECODING_REFRESH |
|---|
| 299 | m_acTEncDepthTopList[iViewIdx]->setDecodingRefreshType ( m_iDecodingRefreshType ); |
|---|
| 300 | #endif |
|---|
| 301 | m_acTEncDepthTopList[iViewIdx]->setCPSSize ( m_uiCodedPictureStoreSize ); |
|---|
| 302 | m_acTEncDepthTopList[iViewIdx]->setGOPSize ( m_iGOPSize ); |
|---|
| 303 | m_acTEncDepthTopList[iViewIdx]->setRateGOPSize ( m_iRateGOPSize ); |
|---|
| 304 | |
|---|
| 305 | m_acTEncDepthTopList[iViewIdx]->setSeqStructure ( m_cInputFormatString ); |
|---|
| 306 | |
|---|
| 307 | m_acTEncDepthTopList[iViewIdx]->setQP ( m_aiQP[1] ); |
|---|
| 308 | |
|---|
| 309 | m_acTEncDepthTopList[iViewIdx]->setTemporalLayerQPOffset ( m_aiTLayerQPOffset ); |
|---|
| 310 | m_acTEncDepthTopList[iViewIdx]->setPad ( m_aiPad ); |
|---|
| 311 | |
|---|
| 312 | //===== Slice ======== |
|---|
| 313 | |
|---|
| 314 | //====== Entropy Coding ======== |
|---|
| 315 | m_acTEncDepthTopList[iViewIdx]->setSymbolMode ( m_iSymbolMode ); |
|---|
| 316 | |
|---|
| 317 | //====== Loop/Deblock Filter ======== |
|---|
| 318 | m_acTEncDepthTopList[iViewIdx]->setLoopFilterDisable ( m_abLoopFilterDisable[1] ); |
|---|
| 319 | m_acTEncDepthTopList[iViewIdx]->setLoopFilterAlphaC0Offset ( m_iLoopFilterAlphaC0Offset ); |
|---|
| 320 | m_acTEncDepthTopList[iViewIdx]->setLoopFilterBetaOffset ( m_iLoopFilterBetaOffset ); |
|---|
| 321 | |
|---|
| 322 | //====== Motion search ======== |
|---|
| 323 | m_acTEncDepthTopList[iViewIdx]->setFastSearch ( m_iFastSearch ); |
|---|
| 324 | m_acTEncDepthTopList[iViewIdx]->setSearchRange ( m_iSearchRange ); |
|---|
| 325 | m_acTEncDepthTopList[iViewIdx]->setBipredSearchRange ( m_bipredSearchRange ); |
|---|
| 326 | m_acTEncDepthTopList[iViewIdx]->setMaxDeltaQP ( m_iMaxDeltaQP ); |
|---|
| 327 | |
|---|
| 328 | //====== Tool list ======== |
|---|
| 329 | m_acTEncDepthTopList[iViewIdx]->setUseSBACRD ( m_bUseSBACRD ); |
|---|
| 330 | m_acTEncDepthTopList[iViewIdx]->setDeltaQpRD ( m_uiDeltaQpRD ); |
|---|
| 331 | m_acTEncDepthTopList[iViewIdx]->setUseASR ( m_bUseASR ); |
|---|
| 332 | m_acTEncDepthTopList[iViewIdx]->setUseHADME ( m_bUseHADME ); |
|---|
| 333 | m_acTEncDepthTopList[iViewIdx]->setUseALF ( m_abUseALF[1] ); |
|---|
| 334 | #if MQT_ALF_NPASS |
|---|
| 335 | m_acTEncDepthTopList[iViewIdx]->setALFEncodePassReduction ( m_iALFEncodePassReduction ); |
|---|
| 336 | #endif |
|---|
| 337 | #if DCM_COMB_LIST |
|---|
| 338 | m_acTEncDepthTopList[iViewIdx]->setUseLComb ( m_bUseLComb ); |
|---|
| 339 | m_acTEncDepthTopList[iViewIdx]->setLCMod ( m_bLCMod ); |
|---|
| 340 | #endif |
|---|
| 341 | m_acTEncDepthTopList[iViewIdx]->setdQPs ( m_aidQP ); |
|---|
| 342 | m_acTEncDepthTopList[iViewIdx]->setUseRDOQ ( m_abUseRDOQ[1] ); |
|---|
| 343 | m_acTEncDepthTopList[iViewIdx]->setUseLDC ( m_bUseLDC ); |
|---|
| 344 | m_acTEncDepthTopList[iViewIdx]->setUsePAD ( m_bUsePAD ); |
|---|
| 345 | m_acTEncDepthTopList[iViewIdx]->setQuadtreeTULog2MaxSize ( m_uiQuadtreeTULog2MaxSize ); |
|---|
| 346 | m_acTEncDepthTopList[iViewIdx]->setQuadtreeTULog2MinSize ( m_uiQuadtreeTULog2MinSize ); |
|---|
| 347 | m_acTEncDepthTopList[iViewIdx]->setQuadtreeTUMaxDepthInter ( m_uiQuadtreeTUMaxDepthInter ); |
|---|
| 348 | m_acTEncDepthTopList[iViewIdx]->setQuadtreeTUMaxDepthIntra ( m_uiQuadtreeTUMaxDepthIntra ); |
|---|
| 349 | m_acTEncDepthTopList[iViewIdx]->setUseFastEnc ( m_bUseFastEnc ); |
|---|
| 350 | |
|---|
| 351 | #if HHI_VSO |
|---|
| 352 | m_acTEncDepthTopList[iViewIdx]->setUseVSO ( m_bUseVSO ); //GT: might be enabled/disabled later for VSO Mode 4 |
|---|
| 353 | m_acTEncDepthTopList[iViewIdx]->setForceLambdaScaleVSO ( m_bForceLambdaScaleVSO ); |
|---|
| 354 | m_acTEncDepthTopList[iViewIdx]->setLambdaScaleVSO ( m_dLambdaScaleVSO ); |
|---|
| 355 | #if HHI_VSO_DIST_INT |
|---|
| 356 | m_acTEncDepthTopList[iViewIdx]->setAllowNegDist ( m_bAllowNegDist ); |
|---|
| 357 | #endif |
|---|
| 358 | m_acTEncDepthTopList[iViewIdx]->setVSOMode ( m_uiVSOMode ); |
|---|
| 359 | #endif |
|---|
| 360 | |
|---|
| 361 | m_acTEncDepthTopList[iViewIdx]->setViewId ( (UInt)iViewIdx ); |
|---|
| 362 | m_acTEncDepthTopList[iViewIdx]->setViewOrderIdx ( m_cCameraData.getViewOrderIndex()[ iViewIdx ] ); |
|---|
| 363 | m_acTEncDepthTopList[iViewIdx]->setIsDepth ( true ); |
|---|
| 364 | m_acTEncDepthTopList[iViewIdx]->setCamParPrecision ( 0 ); |
|---|
| 365 | m_acTEncDepthTopList[iViewIdx]->setCamParInSliceHeader ( false ); |
|---|
| 366 | m_acTEncDepthTopList[iViewIdx]->setCodedScale ( 0 ); |
|---|
| 367 | m_acTEncDepthTopList[iViewIdx]->setCodedOffset ( 0 ); |
|---|
| 368 | #if DEPTH_MAP_GENERATION |
|---|
| 369 | m_acTEncDepthTopList[iViewIdx]->setPredDepthMapGeneration ( 0 ); |
|---|
| 370 | #endif |
|---|
| 371 | #if HHI_INTER_VIEW_MOTION_PRED |
|---|
| 372 | m_acTEncDepthTopList[iViewIdx]->setMultiviewMvPredMode ( 0 ); |
|---|
| 373 | m_acTEncDepthTopList[iViewIdx]->setMultiviewMvRegMode ( 0 ); |
|---|
| 374 | m_acTEncDepthTopList[iViewIdx]->setMultiviewMvRegLambdaScale ( 0.0 ); |
|---|
| 375 | #endif |
|---|
| 376 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
|---|
| 377 | m_acTEncDepthTopList[iViewIdx]->setMultiviewResPredMode ( 0 ); |
|---|
| 378 | #endif |
|---|
| 379 | |
|---|
| 380 | #if HHI_INTERVIEW_SKIP |
|---|
| 381 | m_acTEncDepthTopList[iViewIdx]->setInterViewSkip ( 0 ); |
|---|
| 382 | #if HHI_INTERVIEW_SKIP_LAMBDA_SCALE |
|---|
| 383 | m_acTEncDepthTopList[iViewIdx]->setInterViewSkipLambdaScale ( 1 ); |
|---|
| 384 | #endif |
|---|
| 385 | #endif |
|---|
| 386 | m_acTEncDepthTopList[iViewIdx]->setUseMRG ( m_bUseMRG ); // SOPH: |
|---|
| 387 | |
|---|
| 388 | #if LM_CHROMA |
|---|
| 389 | m_acTEncDepthTopList[iViewIdx]->setUseLMChroma ( m_bUseLMChroma ); |
|---|
| 390 | #endif |
|---|
| 391 | |
|---|
| 392 | #if HHI_RMP_SWITCH |
|---|
| 393 | m_acTEncDepthTopList[iViewIdx]->setUseRMP ( m_bUseRMP ); |
|---|
| 394 | #endif |
|---|
| 395 | #ifdef ROUNDING_CONTROL_BIPRED |
|---|
| 396 | m_acTEncDepthTopList[iViewIdx]->setUseRoundingControlBipred(m_useRoundingControlBipred); |
|---|
| 397 | #endif |
|---|
| 398 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
|---|
| 399 | m_acTEncDepthTopList[iViewIdx]->setUseDMM( m_bUseDMM ); |
|---|
| 400 | #endif |
|---|
| 401 | #if FLEX_CODING_ORDER && HHI_DMM_PRED_TEX |
|---|
| 402 | m_acTEncDepthTopList[iViewIdx]->setUseDMM34( (m_b3DVFlexOrder && isDepthFirst) ? false : m_bUseDMM ); |
|---|
| 403 | #endif |
|---|
| 404 | #if CONSTRAINED_INTRA_PRED |
|---|
| 405 | m_acTEncDepthTopList[iViewIdx]->setUseConstrainedIntraPred ( m_bUseConstrainedIntraPred ); |
|---|
| 406 | #endif |
|---|
| 407 | #ifdef WEIGHT_PRED |
|---|
| 408 | //====== Weighted Prediction ======== |
|---|
| 409 | m_acTEncDepthTopList[iViewIdx]->setUseWP ( m_bUseWeightPred ); |
|---|
| 410 | m_acTEncDepthTopList[iViewIdx]->setWPBiPredIdc ( m_uiBiPredIdc ); |
|---|
| 411 | #endif |
|---|
| 412 | //====== Slice ======== |
|---|
| 413 | m_acTEncDepthTopList[iViewIdx]->setSliceMode ( m_iSliceMode ); |
|---|
| 414 | m_acTEncDepthTopList[iViewIdx]->setSliceArgument ( m_iSliceArgument ); |
|---|
| 415 | |
|---|
| 416 | //====== Entropy Slice ======== |
|---|
| 417 | m_acTEncDepthTopList[iViewIdx]->setEntropySliceMode ( m_iEntropySliceMode ); |
|---|
| 418 | m_acTEncDepthTopList[iViewIdx]->setEntropySliceArgument ( m_iEntropySliceArgument ); |
|---|
| 419 | #if MTK_NONCROSS_INLOOP_FILTER |
|---|
| 420 | if(m_iSliceMode == 0 ) |
|---|
| 421 | { |
|---|
| 422 | m_bLFCrossSliceBoundaryFlag = true; |
|---|
| 423 | } |
|---|
| 424 | m_acTEncDepthTopList[iViewIdx]->setLFCrossSliceBoundaryFlag( m_bLFCrossSliceBoundaryFlag ); |
|---|
| 425 | #endif |
|---|
| 426 | #if MTK_SAO |
|---|
| 427 | m_acTEncDepthTopList[iViewIdx]->setUseSAO ( m_abUseSAO[1] ); |
|---|
| 428 | #endif |
|---|
| 429 | #if HHI_MPI |
|---|
| 430 | #if FLEX_CODING_ORDER |
|---|
| 431 | m_acTEncDepthTopList[iViewIdx]->setUseMVI( (m_b3DVFlexOrder && isDepthFirst) ? false : m_bUseMVI ); |
|---|
| 432 | #else |
|---|
| 433 | m_acTEncDepthTopList[iViewIdx]->setUseMVI( m_bUseMVI ); |
|---|
| 434 | #endif |
|---|
| 435 | #endif |
|---|
| 436 | #if POZNAN_DBMP |
|---|
| 437 | m_acTEncDepthTopList[iViewIdx]->setDBMP ( m_uiDBMP ); |
|---|
| 438 | #endif |
|---|
| 439 | #if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU |
|---|
| 440 | m_acTEncDepthTopList[iViewIdx]->setUseCUSkip ( m_uiUseCUSkip ); |
|---|
| 441 | #endif |
|---|
| 442 | #if POZNAN_NONLINEAR_DEPTH |
|---|
| 443 | m_acTEncDepthTopList[iViewIdx]->setNonlinearDepthModel ( m_cNonlinearDepthModel ); |
|---|
| 444 | m_acTEncDepthTopList[iViewIdx]->setUseNonlinearDepth ( m_bUseNonlinearDepth ); |
|---|
| 445 | #endif |
|---|
| 446 | |
|---|
| 447 | m_acTEncDepthTopList[iViewIdx]->setPictureDigestEnabled(m_pictureDigestEnabled); |
|---|
| 448 | |
|---|
| 449 | m_acTEncDepthTopList[iViewIdx]->setQpChangeFrame( m_iQpChangeFrame ); |
|---|
| 450 | m_acTEncDepthTopList[iViewIdx]->setQpChangeOffsetVideo( m_iQpChangeOffsetVideo ); |
|---|
| 451 | m_acTEncDepthTopList[iViewIdx]->setQpChangeOffsetDepth( m_iQpChangeOffsetDepth ); |
|---|
| 452 | } |
|---|
| 453 | } |
|---|
| 454 | #if HHI_INTER_VIEW_MOTION_PRED |
|---|
| 455 | else if( m_uiMultiviewMvRegMode ) |
|---|
| 456 | { |
|---|
| 457 | for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) |
|---|
| 458 | { |
|---|
| 459 | m_acTVideoIOYuvDepthInputFileList.push_back( new TVideoIOYuv ); |
|---|
| 460 | } |
|---|
| 461 | } |
|---|
| 462 | #endif |
|---|
| 463 | |
|---|
| 464 | #if HHI_VSO |
|---|
| 465 | if ( m_bUseVSO ) |
|---|
| 466 | { |
|---|
| 467 | if ( m_uiVSOMode == 4 ) |
|---|
| 468 | { |
|---|
| 469 | m_cRendererModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, m_iSourceHeight, LOG2_DISP_PREC_LUT, 0 ); |
|---|
| 470 | |
|---|
| 471 | for ( Int iViewNum = 0; iViewNum < m_iNumberOfViews; iViewNum++ ) |
|---|
| 472 | { |
|---|
| 473 | for (Int iContent = 0; iContent < 2; iContent++ ) |
|---|
| 474 | { |
|---|
| 475 | Int iNumOfModels = m_cRenModStrParser.getNumOfModelsForView(iViewNum, iContent); |
|---|
| 476 | Bool bUseVSO = (iNumOfModels != 0); |
|---|
| 477 | |
|---|
| 478 | TEncTop* pcEncTop = ( iContent == 0 ) ? m_acTEncTopList[iViewNum] : m_acTEncDepthTopList[iViewNum]; |
|---|
| 479 | pcEncTop->setUseVSO( bUseVSO ); |
|---|
| 480 | pcEncTop->getRdCost()->setRenModel( bUseVSO ? &m_cRendererModel : NULL ); |
|---|
| 481 | |
|---|
| 482 | for (Int iCurModel = 0; iCurModel < iNumOfModels; iCurModel++ ) |
|---|
| 483 | { |
|---|
| 484 | Int iModelNum; Int iLeftViewNum; Int iRightViewNum; Int iDump; Int iOrgRefNum; Int iBlendMode; |
|---|
| 485 | |
|---|
| 486 | m_cRenModStrParser.getSingleModelData ( iViewNum, iContent, iCurModel, iModelNum, iBlendMode, iLeftViewNum, iRightViewNum, iOrgRefNum, iDump ) ; |
|---|
| 487 | m_cRendererModel .createSingleModel ( iViewNum, iContent, iModelNum, iLeftViewNum, iRightViewNum, (iOrgRefNum != -1), iBlendMode ); |
|---|
| 488 | } |
|---|
| 489 | } |
|---|
| 490 | } |
|---|
| 491 | } |
|---|
| 492 | else |
|---|
| 493 | { |
|---|
| 494 | m_cRendererTop.init(m_iSourceWidth, m_iSourceHeight,true,0,0,true, 0,0,0,0,0,0,0,1,0,0 ); //GT: simplest configuration |
|---|
| 495 | } |
|---|
| 496 | } |
|---|
| 497 | #endif |
|---|
| 498 | |
|---|
| 499 | #if POZNAN_SYNTH |
|---|
| 500 | //m_cAvailabilityRenderer.init(m_iSourceWidth, m_iSourceHeight,true,0,0,true, 0,0,0,0,0,0,0,1,0,0 ); //GT: simplest configuration |
|---|
| 501 | m_cAvailabilityRenderer.init(m_iSourceWidth, m_iSourceHeight,true,0,LOG2_DISP_PREC_LUT,true, 0,0,0,0,0,6,4,1,0,6 ); //GT: simplest configuration |
|---|
| 502 | #endif |
|---|
| 503 | |
|---|
| 504 | #if HHI_INTERVIEW_SKIP |
|---|
| 505 | m_cUsedPelsRenderer.init(m_iSourceWidth, m_iSourceHeight, true, 0, LOG2_DISP_PREC_LUT, true, 0, 0, 0, 0, 0, 6, 4, 1, 0, 6 ); |
|---|
| 506 | #endif |
|---|
| 507 | |
|---|
| 508 | #if POZNAN_MP |
|---|
| 509 | #if POZNAN_MP_USE_DEPTH_MAP_GENERATION |
|---|
| 510 | m_pcMP = new TComMP(m_iSourceHeight, m_iSourceWidth); |
|---|
| 511 | #else |
|---|
| 512 | //m_pcMP = new TComMP(m_iSourceHeight, m_iSourceWidth, &m_cCameraData); |
|---|
| 513 | m_pcMP = new TComMP(m_iSourceHeight, m_iSourceWidth, m_cCameraData.getBaseViewShiftLUTI()); |
|---|
| 514 | #endif |
|---|
| 515 | #endif |
|---|
| 516 | |
|---|
| 517 | } |
|---|
| 518 | |
|---|
| 519 | Void TAppEncTop::xCreateLib() |
|---|
| 520 | { |
|---|
| 521 | // Video I/O |
|---|
| 522 | m_cTVideoIOBitsFile.openBits( m_pchBitstreamFile, true ); // write mode |
|---|
| 523 | |
|---|
| 524 | for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) |
|---|
| 525 | { |
|---|
| 526 | m_acTVideoIOYuvInputFileList[iViewIdx]->open( m_pchInputFileList[iViewIdx], false, m_uiInputBitDepth, m_uiInternalBitDepth ); // read mode |
|---|
| 527 | m_acTVideoIOYuvInputFileList[iViewIdx]->skipFrames(m_FrameSkip, m_iSourceWidth, m_iSourceHeight); |
|---|
| 528 | m_acTVideoIOYuvReconFileList[iViewIdx]->open( m_pchReconFileList[iViewIdx], true, m_uiOutputBitDepth, m_uiInternalBitDepth); // write mode |
|---|
| 529 | |
|---|
| 530 | // Neo Decoder |
|---|
| 531 | m_acTEncTopList[iViewIdx]->create(); |
|---|
| 532 | |
|---|
| 533 | if( m_bUsingDepthMaps ) |
|---|
| 534 | { |
|---|
| 535 | m_acTVideoIOYuvDepthInputFileList[iViewIdx]->open( m_pchDepthInputFileList[iViewIdx], false, m_uiInputBitDepth, m_uiInternalBitDepth ); // read mode |
|---|
| 536 | m_acTVideoIOYuvDepthInputFileList[iViewIdx]->skipFrames(m_FrameSkip, m_iSourceWidth, m_iSourceHeight); |
|---|
| 537 | |
|---|
| 538 | m_acTVideoIOYuvDepthReconFileList[iViewIdx]->open( m_pchDepthReconFileList[iViewIdx], true, m_uiOutputBitDepth, m_uiInternalBitDepth); // write mode |
|---|
| 539 | |
|---|
| 540 | // Neo Decoder |
|---|
| 541 | m_acTEncDepthTopList[iViewIdx]->create(); |
|---|
| 542 | } |
|---|
| 543 | #if HHI_INTER_VIEW_MOTION_PRED |
|---|
| 544 | else if( m_uiMultiviewMvRegMode ) |
|---|
| 545 | { |
|---|
| 546 | m_acTVideoIOYuvDepthInputFileList[iViewIdx]->open( m_pchDepthInputFileList[iViewIdx], false, m_uiInputBitDepth, m_uiInternalBitDepth ); // read mode |
|---|
| 547 | m_acTVideoIOYuvDepthInputFileList[iViewIdx]->skipFrames(m_FrameSkip, m_iSourceWidth, m_iSourceHeight); |
|---|
| 548 | } |
|---|
| 549 | #endif |
|---|
| 550 | } |
|---|
| 551 | |
|---|
| 552 | #if HHI_VSO |
|---|
| 553 | for(Int iViewIdx=0; iViewIdx < m_iNumberOfExternalRefs; iViewIdx++) |
|---|
| 554 | { |
|---|
| 555 | m_acTVideoIOYuvERFileList[iViewIdx]->open( m_pchERRefFileList[iViewIdx], false, m_uiInputBitDepth, m_uiInternalBitDepth ); // read mode |
|---|
| 556 | } |
|---|
| 557 | #endif |
|---|
| 558 | } |
|---|
| 559 | |
|---|
| 560 | Void TAppEncTop::xDestroyLib() |
|---|
| 561 | { |
|---|
| 562 | |
|---|
| 563 | m_cTVideoIOBitsFile.closeBits(); |
|---|
| 564 | |
|---|
| 565 | #if POZNAN_MP |
|---|
| 566 | if (m_pcMP) { delete m_pcMP; m_pcMP=NULL; }; |
|---|
| 567 | #endif |
|---|
| 568 | |
|---|
| 569 | #if HHI_VSO |
|---|
| 570 | for ( Int iViewIdx = 0; iViewIdx < m_iNumberOfExternalRefs; iViewIdx++ ) |
|---|
| 571 | { |
|---|
| 572 | m_acTVideoIOYuvERFileList[iViewIdx]->close(); |
|---|
| 573 | delete m_acTVideoIOYuvERFileList[iViewIdx]; |
|---|
| 574 | m_acTVideoIOYuvERFileList[iViewIdx] = 0; |
|---|
| 575 | }; |
|---|
| 576 | #endif |
|---|
| 577 | |
|---|
| 578 | for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) |
|---|
| 579 | { |
|---|
| 580 | m_acTVideoIOYuvInputFileList[iViewIdx]->close(); |
|---|
| 581 | m_acTVideoIOYuvReconFileList[iViewIdx]->close(); |
|---|
| 582 | |
|---|
| 583 | delete m_acTVideoIOYuvInputFileList[iViewIdx] ; m_acTVideoIOYuvInputFileList[iViewIdx] = NULL; |
|---|
| 584 | delete m_acTVideoIOYuvReconFileList[iViewIdx] ; m_acTVideoIOYuvReconFileList[iViewIdx] = NULL; |
|---|
| 585 | |
|---|
| 586 | delete m_cListPicYuvRecList[iViewIdx] ; m_cListPicYuvRecList[iViewIdx] = NULL; |
|---|
| 587 | |
|---|
| 588 | m_acTEncTopList[iViewIdx]->destroy(); |
|---|
| 589 | delete m_acTEncTopList[iViewIdx] ; m_acTEncTopList[iViewIdx] = NULL; |
|---|
| 590 | |
|---|
| 591 | if( iViewIdx < Int( m_acTVideoIOYuvDepthInputFileList.size() ) && m_acTVideoIOYuvDepthInputFileList[iViewIdx] ) |
|---|
| 592 | { |
|---|
| 593 | m_acTVideoIOYuvDepthInputFileList[iViewIdx]->close( ); |
|---|
| 594 | delete m_acTVideoIOYuvDepthInputFileList[iViewIdx] ; |
|---|
| 595 | } |
|---|
| 596 | if( iViewIdx < Int( m_acTVideoIOYuvDepthReconFileList.size() ) && m_acTVideoIOYuvDepthReconFileList[iViewIdx] ) |
|---|
| 597 | { |
|---|
| 598 | m_acTVideoIOYuvDepthReconFileList[iViewIdx]->close () ; |
|---|
| 599 | delete m_acTVideoIOYuvDepthReconFileList[iViewIdx]; |
|---|
| 600 | } |
|---|
| 601 | if( iViewIdx < Int( m_acTEncDepthTopList.size() ) && m_acTEncDepthTopList[iViewIdx] ) |
|---|
| 602 | { |
|---|
| 603 | m_acTEncDepthTopList[iViewIdx]->destroy(); |
|---|
| 604 | delete m_acTEncDepthTopList[iViewIdx]; |
|---|
| 605 | } |
|---|
| 606 | if( iViewIdx < Int( m_cListPicYuvDepthRecList.size() ) && m_cListPicYuvDepthRecList[iViewIdx] ) |
|---|
| 607 | { |
|---|
| 608 | delete m_cListPicYuvDepthRecList[iViewIdx ]; |
|---|
| 609 | } |
|---|
| 610 | } |
|---|
| 611 | } |
|---|
| 612 | |
|---|
| 613 | Void TAppEncTop::xInitLib() |
|---|
| 614 | { |
|---|
| 615 | for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) |
|---|
| 616 | { |
|---|
| 617 | m_acTEncTopList[iViewIdx]->init( this ); |
|---|
| 618 | } |
|---|
| 619 | for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) |
|---|
| 620 | { |
|---|
| 621 | m_acTEncTopList[iViewIdx]->setTEncTopList( &m_acTEncTopList ); |
|---|
| 622 | } |
|---|
| 623 | if ( m_bUsingDepthMaps ) |
|---|
| 624 | { |
|---|
| 625 | for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) |
|---|
| 626 | { |
|---|
| 627 | m_acTEncDepthTopList[iViewIdx]->init( this ); |
|---|
| 628 | } |
|---|
| 629 | for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) |
|---|
| 630 | { |
|---|
| 631 | m_acTEncDepthTopList[iViewIdx]->setTEncTopList( &m_acTEncDepthTopList ); |
|---|
| 632 | } |
|---|
| 633 | } |
|---|
| 634 | } |
|---|
| 635 | |
|---|
| 636 | // ==================================================================================================================== |
|---|
| 637 | // Public member functions |
|---|
| 638 | // ==================================================================================================================== |
|---|
| 639 | |
|---|
| 640 | /** |
|---|
| 641 | - create internal class |
|---|
| 642 | - initialize internal variable |
|---|
| 643 | - until the end of input YUV file, call encoding function in TEncTop class |
|---|
| 644 | - delete allocated buffers |
|---|
| 645 | - destroy internal class |
|---|
| 646 | . |
|---|
| 647 | */ |
|---|
| 648 | //GT PRE LOAD ENC BUFFER |
|---|
| 649 | Void TAppEncTop::encode() |
|---|
| 650 | { |
|---|
| 651 | TComPicYuv* pcPicYuvOrg = new TComPicYuv; |
|---|
| 652 | TComPicYuv* pcDepthPicYuvOrg = new TComPicYuv; |
|---|
| 653 | TComPicYuv* pcPdmDepthOrg = new TComPicYuv; |
|---|
| 654 | TComPicYuv* pcPicYuvRec = NULL; |
|---|
| 655 | //TComPicYuv* pcDepthPicYuvRec = NULL; |
|---|
| 656 | |
|---|
| 657 | // initialize internal class & member variables |
|---|
| 658 | xInitLibCfg(); |
|---|
| 659 | xCreateLib(); |
|---|
| 660 | xInitLib(); |
|---|
| 661 | |
|---|
| 662 | // main encoder loop |
|---|
| 663 | |
|---|
| 664 | //GT: setup and init Bools for Eos and Continue Reading |
|---|
| 665 | Bool bAllEos = false; |
|---|
| 666 | Bool bAllContinueReadingPics = false; |
|---|
| 667 | std::vector<Bool> bEos ; |
|---|
| 668 | std::vector<Bool> bContinueReadingPics ; |
|---|
| 669 | |
|---|
| 670 | Bool bAllDepthEos = false; |
|---|
| 671 | Bool bAllContinueReadingDepthPics = false; |
|---|
| 672 | std::vector<Bool> bDepthEos ; |
|---|
| 673 | std::vector<Bool> bContinueReadingDepthPics ; |
|---|
| 674 | |
|---|
| 675 | for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++ ) |
|---|
| 676 | { |
|---|
| 677 | bEos.push_back( false ) ; |
|---|
| 678 | bContinueReadingPics.push_back( true ); |
|---|
| 679 | if( m_bUsingDepthMaps) |
|---|
| 680 | { |
|---|
| 681 | bDepthEos.push_back( false ) ; |
|---|
| 682 | bContinueReadingDepthPics.push_back( true ) ; |
|---|
| 683 | } |
|---|
| 684 | } |
|---|
| 685 | // allocate original YUV buffer |
|---|
| 686 | pcPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); |
|---|
| 687 | if( m_bUsingDepthMaps) |
|---|
| 688 | { |
|---|
| 689 | pcDepthPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); |
|---|
| 690 | } |
|---|
| 691 | #if HHI_INTER_VIEW_MOTION_PRED |
|---|
| 692 | if( m_uiMultiviewMvRegMode ) |
|---|
| 693 | { |
|---|
| 694 | pcPdmDepthOrg->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); |
|---|
| 695 | } |
|---|
| 696 | #endif |
|---|
| 697 | |
|---|
| 698 | TComBitstream* pcBitstream = new TComBitstream; |
|---|
| 699 | pcBitstream->create( (m_iSourceWidth * m_iSourceHeight * 3) >> 1 ) ; //GT: is size reasonable ?? |
|---|
| 700 | |
|---|
| 701 | while ( !(bAllEos&& bAllContinueReadingPics) ) |
|---|
| 702 | { |
|---|
| 703 | bAllContinueReadingPics = false; |
|---|
| 704 | bAllContinueReadingDepthPics = false; |
|---|
| 705 | |
|---|
| 706 | //GT: Read all Buffers |
|---|
| 707 | for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++ ) //GT; store frames first |
|---|
| 708 | { |
|---|
| 709 | if (!bEos[iViewIdx] && bContinueReadingPics[iViewIdx] ) //GT: read frames to buffer |
|---|
| 710 | { |
|---|
| 711 | // get buffers |
|---|
| 712 | xGetBuffer( pcPicYuvRec, iViewIdx, m_cListPicYuvRecList ); // ringbuffer of size gopsize -> m_cListPicYuvRec, m_cListBitstream |
|---|
| 713 | // read input YUV file |
|---|
| 714 | m_acTVideoIOYuvInputFileList[iViewIdx]->read( pcPicYuvOrg, m_aiPad ) ; |
|---|
| 715 | bEos[iViewIdx] = ( m_acTVideoIOYuvInputFileList[iViewIdx]->isEof() == 1 ? true : false ); //GT: End of File |
|---|
| 716 | bEos[iViewIdx] = ( m_iFrameRcvdVector[iViewIdx] == (m_iFrameToBeEncoded - 1) ? true : bEos[iViewIdx] ); //GT: FramesToBeEncoded Reached |
|---|
| 717 | bAllEos = bAllEos|bEos[iViewIdx] ; |
|---|
| 718 | |
|---|
| 719 | #if HHI_INTER_VIEW_MOTION_PRED |
|---|
| 720 | if( m_uiMultiviewMvRegMode && iViewIdx ) |
|---|
| 721 | { |
|---|
| 722 | m_acTVideoIOYuvDepthInputFileList[iViewIdx]->read( pcPdmDepthOrg, m_aiPad, m_bUsingDepthMaps ); |
|---|
| 723 | #if POZNAN_NONLINEAR_DEPTH |
|---|
| 724 | if( m_bUseNonlinearDepth ) |
|---|
| 725 | pcPdmDepthOrg->nonlinearDepthForward(pcPdmDepthOrg, m_cNonlinearDepthModel); |
|---|
| 726 | #endif |
|---|
| 727 | } |
|---|
| 728 | #endif |
|---|
| 729 | |
|---|
| 730 | // increase number of received frames |
|---|
| 731 | m_iFrameRcvdVector[iViewIdx]++ ; |
|---|
| 732 | } |
|---|
| 733 | |
|---|
| 734 | #if HHI_INTER_VIEW_MOTION_PRED |
|---|
| 735 | m_acTEncTopList[iViewIdx]->receivePic( bEos[iViewIdx], pcPicYuvOrg, m_cListPicYuvRecList[iViewIdx]->back(), ( m_uiMultiviewMvRegMode && iViewIdx ? pcPdmDepthOrg : 0 ) ); |
|---|
| 736 | #else |
|---|
| 737 | m_acTEncTopList[iViewIdx]->receivePic( bEos[iViewIdx], pcPicYuvOrg, m_cListPicYuvRecList[iViewIdx]->back(), 0 ); |
|---|
| 738 | #endif |
|---|
| 739 | |
|---|
| 740 | if( m_bUsingDepthMaps ) |
|---|
| 741 | { |
|---|
| 742 | if (!bDepthEos[iViewIdx] && bContinueReadingDepthPics[iViewIdx] ) |
|---|
| 743 | { |
|---|
| 744 | // get buffers |
|---|
| 745 | xGetBuffer( pcPicYuvRec, iViewIdx, m_cListPicYuvDepthRecList ); // ringbuffer of size gopsize -> m_cListPicYuvRec, m_cListBitstream |
|---|
| 746 | // read input YUV file |
|---|
| 747 | m_acTVideoIOYuvDepthInputFileList[iViewIdx]->read( pcDepthPicYuvOrg, m_aiPad ) ; |
|---|
| 748 | #if POZNAN_NONLINEAR_DEPTH |
|---|
| 749 | if( m_bUseNonlinearDepth ) |
|---|
| 750 | pcDepthPicYuvOrg->nonlinearDepthForward(pcDepthPicYuvOrg, m_cNonlinearDepthModel); |
|---|
| 751 | #endif |
|---|
| 752 | bDepthEos[iViewIdx] = ( m_acTVideoIOYuvDepthInputFileList[iViewIdx]->isEof() == 1 ? true : false ); |
|---|
| 753 | bDepthEos[iViewIdx] = ( m_iDepthFrameRcvdVector[iViewIdx] == (m_iFrameToBeEncoded - 1) ? true : bDepthEos[iViewIdx] ); |
|---|
| 754 | bAllDepthEos = bAllDepthEos|bDepthEos[iViewIdx] ; |
|---|
| 755 | // increase number of received frames |
|---|
| 756 | m_iDepthFrameRcvdVector[iViewIdx]++ ; |
|---|
| 757 | } |
|---|
| 758 | m_acTEncDepthTopList[iViewIdx]->receivePic( bDepthEos[iViewIdx], pcDepthPicYuvOrg, m_cListPicYuvDepthRecList[iViewIdx]->back() ); |
|---|
| 759 | } |
|---|
| 760 | } |
|---|
| 761 | |
|---|
| 762 | //===== store current POC ===== |
|---|
| 763 | Bool bCurrPocCoded = m_acTEncTopList[ 0 ]->currentPocWillBeCoded(); |
|---|
| 764 | Int iCurrPoc = m_acTEncTopList[ 0 ]->getNextFrameId(); |
|---|
| 765 | |
|---|
| 766 | //===== update camera parameters ===== |
|---|
| 767 | if( bCurrPocCoded ) |
|---|
| 768 | { |
|---|
| 769 | m_cCameraData.update( (UInt)iCurrPoc ); |
|---|
| 770 | } |
|---|
| 771 | |
|---|
| 772 | #if HHI_VSO |
|---|
| 773 | if ( m_bUseVSO && ( m_uiVSOMode != 4) ) |
|---|
| 774 | { |
|---|
| 775 | //GT: Read external reference pics or render references |
|---|
| 776 | xStoreVSORefPicsInBuffer(); //GT; |
|---|
| 777 | } |
|---|
| 778 | #endif |
|---|
| 779 | |
|---|
| 780 | #if FLEX_CODING_ORDER |
|---|
| 781 | if (m_b3DVFlexOrder) |
|---|
| 782 | { |
|---|
| 783 | Int i=0; |
|---|
| 784 | Int iViewIdx = 0; |
|---|
| 785 | bool bThisViewContinueReadingPics = false; |
|---|
| 786 | bool bThisViewContinueReadingDepthPics = false; |
|---|
| 787 | Int iNumberofDepthViews = m_bUsingDepthMaps?m_iNumberOfViews:0; |
|---|
| 788 | for(Int j=0; j < (m_iNumberOfViews+ iNumberofDepthViews); j++ ) // Start encoding |
|---|
| 789 | { |
|---|
| 790 | if (m_pchMVCJointCodingOrder[i]=='T') |
|---|
| 791 | { |
|---|
| 792 | i++; |
|---|
| 793 | assert(isdigit(m_pchMVCJointCodingOrder[i])); |
|---|
| 794 | iViewIdx = (Int)(m_pchMVCJointCodingOrder[i]-'0'); |
|---|
| 795 | bThisViewContinueReadingPics = bContinueReadingPics[iViewIdx]; |
|---|
| 796 | #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH |
|---|
| 797 | // If no depth picture reconstruction for current view and current POC is available sythesize one |
|---|
| 798 | Int iCurrPoc = m_acTEncTopList[ 0 ]->getNextFrameId(); |
|---|
| 799 | Bool bCurrPicDepthRec = getPicFromView( iViewIdx, iCurrPoc, true ) != NULL && getPicFromView( iViewIdx, iCurrPoc, true )->getReconMark(); |
|---|
| 800 | if(m_bUseTexDqpAccordingToDepth && !bCurrPicDepthRec) |
|---|
| 801 | { |
|---|
| 802 | xStoreDepthSynthPicsInBuffer(iViewIdx); |
|---|
| 803 | } |
|---|
| 804 | #endif |
|---|
| 805 | m_acTEncTopList[iViewIdx]->encode( bEos[iViewIdx], m_cListPicYuvRecMap[iViewIdx], pcBitstream, bThisViewContinueReadingPics ); |
|---|
| 806 | bContinueReadingPics[iViewIdx]=bThisViewContinueReadingPics; |
|---|
| 807 | bAllContinueReadingPics = bAllContinueReadingPics||bContinueReadingPics[iViewIdx]; |
|---|
| 808 | |
|---|
| 809 | if(pcBitstream->getNumberOfWrittenBits()!=0) |
|---|
| 810 | { |
|---|
| 811 | m_cTVideoIOBitsFile.writeBits( pcBitstream ); |
|---|
| 812 | } |
|---|
| 813 | pcBitstream->resetBits(); //GT: also done later in .... |
|---|
| 814 | pcBitstream->rewindStreamPacket( ); |
|---|
| 815 | // write bistream to file if necessary |
|---|
| 816 | xWriteOutput( iViewIdx ); //GT: Write Reconfiles (when gop is complete?) |
|---|
| 817 | i++; |
|---|
| 818 | } |
|---|
| 819 | else if ( m_pchMVCJointCodingOrder[i] == 'D') |
|---|
| 820 | { |
|---|
| 821 | i++; |
|---|
| 822 | if( m_bUsingDepthMaps ) |
|---|
| 823 | { |
|---|
| 824 | assert(isdigit(m_pchMVCJointCodingOrder[i])); |
|---|
| 825 | iViewIdx = (Int)(m_pchMVCJointCodingOrder[i]-'0'); |
|---|
| 826 | bThisViewContinueReadingDepthPics = bContinueReadingDepthPics[iViewIdx]; |
|---|
| 827 | m_acTEncDepthTopList[iViewIdx]->encode( bDepthEos[iViewIdx], m_cListPicYuvDepthRecMap[iViewIdx], pcBitstream, bThisViewContinueReadingDepthPics ); |
|---|
| 828 | bContinueReadingDepthPics[iViewIdx]=bThisViewContinueReadingDepthPics; |
|---|
| 829 | |
|---|
| 830 | bAllContinueReadingDepthPics = bAllContinueReadingDepthPics||bContinueReadingDepthPics[iViewIdx]; |
|---|
| 831 | if(pcBitstream->getNumberOfWrittenBits()!=0) |
|---|
| 832 | { |
|---|
| 833 | m_cTVideoIOBitsFile.writeBits( pcBitstream ); |
|---|
| 834 | } |
|---|
| 835 | pcBitstream->resetBits(); |
|---|
| 836 | pcBitstream->rewindStreamPacket( ); |
|---|
| 837 | // write bistream to file if necessary |
|---|
| 838 | xWriteOutput( iViewIdx, true ); |
|---|
| 839 | i++; |
|---|
| 840 | } |
|---|
| 841 | } |
|---|
| 842 | } |
|---|
| 843 | } |
|---|
| 844 | else |
|---|
| 845 | { |
|---|
| 846 | #endif |
|---|
| 847 | //GT: Encode |
|---|
| 848 | for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++ ) // Start encoding |
|---|
| 849 | { |
|---|
| 850 | #if POZNAN_SYNTH |
|---|
| 851 | if( m_uiUseCUSkip ) |
|---|
| 852 | { |
|---|
| 853 | xStoreSynthPicsInBuffer(iViewIdx,false); |
|---|
| 854 | } |
|---|
| 855 | #endif |
|---|
| 856 | //* |
|---|
| 857 | #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH |
|---|
| 858 | #if FLEX_CODING_ORDER |
|---|
| 859 | // If no depth picture reconstruction for current view and current POC is available sythesize one |
|---|
| 860 | Int iCurrPoc = m_acTEncTopList[ 0 ]->getNextFrameId(); |
|---|
| 861 | Bool bCurrPicDepthRec = getPicFromView( iViewIdx, iCurrPoc, true ) != NULL && getPicFromView( iViewIdx, iCurrPoc, true )->getReconMark(); |
|---|
| 862 | if(m_bUseTexDqpAccordingToDepth && !bCurrPicDepthRec) |
|---|
| 863 | #else |
|---|
| 864 | if(m_bUseTexDqpAccordingToDepth) |
|---|
| 865 | #endif |
|---|
| 866 | { |
|---|
| 867 | xStoreDepthSynthPicsInBuffer(iViewIdx); |
|---|
| 868 | } |
|---|
| 869 | #endif |
|---|
| 870 | //*/ |
|---|
| 871 | bool bThisViewContinueReadingPics = bContinueReadingPics[iViewIdx]; |
|---|
| 872 | m_acTEncTopList[iViewIdx]->encode( bEos[iViewIdx], m_cListPicYuvRecMap[iViewIdx], pcBitstream, bThisViewContinueReadingPics ); |
|---|
| 873 | bContinueReadingPics[iViewIdx]=bThisViewContinueReadingPics; |
|---|
| 874 | bAllContinueReadingPics = bAllContinueReadingPics||bContinueReadingPics[iViewIdx]; |
|---|
| 875 | |
|---|
| 876 | if(pcBitstream->getNumberOfWrittenBits()!=0) |
|---|
| 877 | { |
|---|
| 878 | m_cTVideoIOBitsFile.writeBits( pcBitstream ); |
|---|
| 879 | } |
|---|
| 880 | pcBitstream->resetBits(); //GT: also done later in .... |
|---|
| 881 | pcBitstream->rewindStreamPacket( ); |
|---|
| 882 | // write bistream to file if necessary |
|---|
| 883 | xWriteOutput( iViewIdx ); //GT: Write Reconfiles (when gop is complete?) |
|---|
| 884 | |
|---|
| 885 | if( m_bUsingDepthMaps ) |
|---|
| 886 | { |
|---|
| 887 | #if POZNAN_SYNTH |
|---|
| 888 | if( m_uiUseCUSkip ) |
|---|
| 889 | { |
|---|
| 890 | xStoreSynthPicsInBuffer(iViewIdx,true); |
|---|
| 891 | } |
|---|
| 892 | #endif |
|---|
| 893 | bool bThisViewContinueReadingDepthPics = bContinueReadingDepthPics[iViewIdx]; |
|---|
| 894 | m_acTEncDepthTopList[iViewIdx]->encode( bDepthEos[iViewIdx], m_cListPicYuvDepthRecMap[iViewIdx], pcBitstream, bThisViewContinueReadingDepthPics ); |
|---|
| 895 | bContinueReadingDepthPics[iViewIdx]=bThisViewContinueReadingDepthPics; |
|---|
| 896 | |
|---|
| 897 | bAllContinueReadingDepthPics = bAllContinueReadingDepthPics||bContinueReadingDepthPics[iViewIdx]; |
|---|
| 898 | if(pcBitstream->getNumberOfWrittenBits()!=0) |
|---|
| 899 | { |
|---|
| 900 | m_cTVideoIOBitsFile.writeBits( pcBitstream ); |
|---|
| 901 | } |
|---|
| 902 | pcBitstream->resetBits(); |
|---|
| 903 | pcBitstream->rewindStreamPacket( ); |
|---|
| 904 | // write bistream to file if necessary |
|---|
| 905 | xWriteOutput( iViewIdx, true ); |
|---|
| 906 | } |
|---|
| 907 | } |
|---|
| 908 | #if FLEX_CODING_ORDER |
|---|
| 909 | } |
|---|
| 910 | #endif |
|---|
| 911 | // delete extra picture buffers |
|---|
| 912 | if( bCurrPocCoded ) |
|---|
| 913 | { |
|---|
| 914 | for( Int iViewIdx = 0; iViewIdx < m_iNumberOfViews; iViewIdx++ ) |
|---|
| 915 | { |
|---|
| 916 | if( iViewIdx < (Int)m_acTEncTopList.size() && m_acTEncTopList[iViewIdx] ) |
|---|
| 917 | { |
|---|
| 918 | m_acTEncTopList[iViewIdx]->deleteExtraPicBuffers( iCurrPoc ); |
|---|
| 919 | } |
|---|
| 920 | if( iViewIdx < (Int)m_acTEncDepthTopList.size() && m_acTEncDepthTopList[iViewIdx] ) |
|---|
| 921 | { |
|---|
| 922 | m_acTEncDepthTopList[iViewIdx]->deleteExtraPicBuffers( iCurrPoc ); |
|---|
| 923 | } |
|---|
| 924 | } |
|---|
| 925 | } |
|---|
| 926 | |
|---|
| 927 | #if AMVP_BUFFERCOMPRESS |
|---|
| 928 | // compress motion for entire access |
|---|
| 929 | if( bCurrPocCoded ) |
|---|
| 930 | { |
|---|
| 931 | for( Int iViewIdx = 0; iViewIdx < m_iNumberOfViews; iViewIdx++ ) |
|---|
| 932 | { |
|---|
| 933 | if( iViewIdx < (Int)m_acTEncTopList.size() && m_acTEncTopList[iViewIdx] ) |
|---|
| 934 | { |
|---|
| 935 | m_acTEncTopList[iViewIdx]->compressMotion( iCurrPoc ); |
|---|
| 936 | } |
|---|
| 937 | if( iViewIdx < (Int)m_acTEncDepthTopList.size() && m_acTEncDepthTopList[iViewIdx] ) |
|---|
| 938 | { |
|---|
| 939 | m_acTEncDepthTopList[iViewIdx]->compressMotion( iCurrPoc ); |
|---|
| 940 | } |
|---|
| 941 | } |
|---|
| 942 | } |
|---|
| 943 | #endif |
|---|
| 944 | } |
|---|
| 945 | |
|---|
| 946 | // write output |
|---|
| 947 | for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++ ) |
|---|
| 948 | { |
|---|
| 949 | m_acTEncTopList[iViewIdx]->printOutSummary(m_acTEncTopList[iViewIdx]->getNumAllPicCoded()); |
|---|
| 950 | if ( m_bUsingDepthMaps ) |
|---|
| 951 | { |
|---|
| 952 | m_acTEncDepthTopList[iViewIdx]->printOutSummary(m_acTEncDepthTopList[iViewIdx]->getNumAllPicCoded()); |
|---|
| 953 | } |
|---|
| 954 | } |
|---|
| 955 | |
|---|
| 956 | // delete original YUV buffer |
|---|
| 957 | pcPicYuvOrg->destroy(); |
|---|
| 958 | delete pcPicYuvOrg; |
|---|
| 959 | pcPicYuvOrg = NULL; |
|---|
| 960 | |
|---|
| 961 | // valgrind |
|---|
| 962 | if( m_bUsingDepthMaps) |
|---|
| 963 | { |
|---|
| 964 | pcDepthPicYuvOrg->destroy(); |
|---|
| 965 | } |
|---|
| 966 | delete pcDepthPicYuvOrg ; |
|---|
| 967 | pcDepthPicYuvOrg = NULL ; |
|---|
| 968 | |
|---|
| 969 | pcBitstream->destroy(); |
|---|
| 970 | delete pcBitstream; |
|---|
| 971 | pcBitstream = NULL ; |
|---|
| 972 | |
|---|
| 973 | |
|---|
| 974 | // delete used buffers in encoder class |
|---|
| 975 | for(Int iViewIdx =0; iViewIdx < m_iNumberOfViews; iViewIdx++) |
|---|
| 976 | { |
|---|
| 977 | m_acTEncTopList[iViewIdx]->deletePicBuffer() ; |
|---|
| 978 | } |
|---|
| 979 | |
|---|
| 980 | if( m_bUsingDepthMaps) |
|---|
| 981 | { |
|---|
| 982 | for(Int iViewIdx =0; iViewIdx < m_iNumberOfViews; iViewIdx++) |
|---|
| 983 | { |
|---|
| 984 | m_acTEncDepthTopList[iViewIdx]->deletePicBuffer() ; |
|---|
| 985 | } |
|---|
| 986 | } |
|---|
| 987 | |
|---|
| 988 | if ( pcPdmDepthOrg ) |
|---|
| 989 | { |
|---|
| 990 | pcPdmDepthOrg->destroy(); |
|---|
| 991 | delete pcPdmDepthOrg; |
|---|
| 992 | pcPdmDepthOrg = NULL; |
|---|
| 993 | } |
|---|
| 994 | |
|---|
| 995 | // delete buffers & classes |
|---|
| 996 | xDeleteBuffer(); |
|---|
| 997 | xDestroyLib(); |
|---|
| 998 | } |
|---|
| 999 | |
|---|
| 1000 | // ==================================================================================================================== |
|---|
| 1001 | // Protected member functions |
|---|
| 1002 | // ==================================================================================================================== |
|---|
| 1003 | |
|---|
| 1004 | /** |
|---|
| 1005 | - application has picture buffer list with size of GOP |
|---|
| 1006 | - picture buffer list acts as ring buffer |
|---|
| 1007 | - end of the list has the latest picture |
|---|
| 1008 | . |
|---|
| 1009 | */ |
|---|
| 1010 | Void TAppEncTop::xGetBuffer( TComPicYuv*& rpcPicYuvRec, Int iViewIdx, std::vector< TComList<TComPicYuv*>*>& racBuffer ) |
|---|
| 1011 | { |
|---|
| 1012 | if ( m_uiCodedPictureStoreSize == 0 ) |
|---|
| 1013 | { |
|---|
| 1014 | if (racBuffer[iViewIdx]->size() == 0) |
|---|
| 1015 | { |
|---|
| 1016 | rpcPicYuvRec = new TComPicYuv; |
|---|
| 1017 | rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); |
|---|
| 1018 | |
|---|
| 1019 | racBuffer[iViewIdx]->pushBack( rpcPicYuvRec ); |
|---|
| 1020 | } |
|---|
| 1021 | rpcPicYuvRec = racBuffer[iViewIdx]->popFront(); //GT why? only one in list ?? A: only to get rpcPicYuvRec |
|---|
| 1022 | racBuffer[iViewIdx]->pushBack( rpcPicYuvRec ); |
|---|
| 1023 | return; |
|---|
| 1024 | } |
|---|
| 1025 | |
|---|
| 1026 | // org. buffer |
|---|
| 1027 | if ( racBuffer[iViewIdx]->size() == (UInt)m_uiCodedPictureStoreSize ) |
|---|
| 1028 | { |
|---|
| 1029 | rpcPicYuvRec = racBuffer[iViewIdx]->popFront(); |
|---|
| 1030 | } |
|---|
| 1031 | else |
|---|
| 1032 | { |
|---|
| 1033 | rpcPicYuvRec = new TComPicYuv; |
|---|
| 1034 | rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); |
|---|
| 1035 | } |
|---|
| 1036 | racBuffer[iViewIdx]->pushBack( rpcPicYuvRec ); |
|---|
| 1037 | } |
|---|
| 1038 | |
|---|
| 1039 | Void TAppEncTop::xDeleteBuffer( ) |
|---|
| 1040 | { |
|---|
| 1041 | TComList<TComBitstream*>::iterator iterBitstream = m_cListBitstream.begin(); |
|---|
| 1042 | |
|---|
| 1043 | Int iSize = Int( m_cListBitstream.size() ); |
|---|
| 1044 | |
|---|
| 1045 | for ( Int i = 0; i < iSize; i++ ) |
|---|
| 1046 | { |
|---|
| 1047 | TComBitstream* pcBitstream = *(iterBitstream++); |
|---|
| 1048 | |
|---|
| 1049 | pcBitstream->destroy(); |
|---|
| 1050 | |
|---|
| 1051 | delete pcBitstream; pcBitstream = NULL; |
|---|
| 1052 | } |
|---|
| 1053 | |
|---|
| 1054 | for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) |
|---|
| 1055 | { |
|---|
| 1056 | TComList<TComPicYuv*>::iterator iterPicYuvRec = m_cListPicYuvRecList[iViewIdx]->begin(); |
|---|
| 1057 | |
|---|
| 1058 | iSize = Int( m_cListPicYuvRecList[iViewIdx]->size() ); |
|---|
| 1059 | |
|---|
| 1060 | for ( Int i = 0; i < iSize; i++ ) |
|---|
| 1061 | { |
|---|
| 1062 | TComPicYuv* pcPicYuvRec = *(iterPicYuvRec++); |
|---|
| 1063 | pcPicYuvRec->destroy(); |
|---|
| 1064 | delete pcPicYuvRec; pcPicYuvRec = NULL; |
|---|
| 1065 | } |
|---|
| 1066 | } |
|---|
| 1067 | if( m_bUsingDepthMaps) |
|---|
| 1068 | { |
|---|
| 1069 | for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) |
|---|
| 1070 | { |
|---|
| 1071 | TComList<TComPicYuv*>::iterator iterPicYuvRec = m_cListPicYuvDepthRecList[iViewIdx]->begin(); |
|---|
| 1072 | |
|---|
| 1073 | iSize = Int( m_cListPicYuvDepthRecList[iViewIdx]->size() ); |
|---|
| 1074 | |
|---|
| 1075 | for ( Int i = 0; i < iSize; i++ ) |
|---|
| 1076 | { |
|---|
| 1077 | TComPicYuv* pcPicYuvRec = *(iterPicYuvRec++); |
|---|
| 1078 | pcPicYuvRec->destroy(); |
|---|
| 1079 | delete pcPicYuvRec; pcPicYuvRec = NULL; |
|---|
| 1080 | } |
|---|
| 1081 | } |
|---|
| 1082 | } |
|---|
| 1083 | |
|---|
| 1084 | // Delete ERFiles |
|---|
| 1085 | |
|---|
| 1086 | #if HHI_VSO |
|---|
| 1087 | std::map< Int,vector<TComPicYuv*> >::iterator iterMapPicExtRefView = m_cMapPicExtRefView.begin(); |
|---|
| 1088 | while ( iterMapPicExtRefView != m_cMapPicExtRefView.end() ) |
|---|
| 1089 | { |
|---|
| 1090 | for ( UInt uiViewNumber = 0; uiViewNumber < iterMapPicExtRefView->second.size(); uiViewNumber++ ) |
|---|
| 1091 | { |
|---|
| 1092 | if ( iterMapPicExtRefView->second[uiViewNumber] ) |
|---|
| 1093 | { |
|---|
| 1094 | iterMapPicExtRefView->second[uiViewNumber]->destroy(); |
|---|
| 1095 | delete iterMapPicExtRefView->second[uiViewNumber]; |
|---|
| 1096 | } |
|---|
| 1097 | } |
|---|
| 1098 | iterMapPicExtRefView++; |
|---|
| 1099 | } |
|---|
| 1100 | #endif |
|---|
| 1101 | } |
|---|
| 1102 | |
|---|
| 1103 | /** \param iNumEncoded number of encoded frames |
|---|
| 1104 | */ |
|---|
| 1105 | Void TAppEncTop::xWriteOutput( Int iViewIdx, Bool isDepth ) |
|---|
| 1106 | { |
|---|
| 1107 | std::map<PicOrderCnt, TComPicYuv*> &rcMap = ( isDepth ? m_cListPicYuvDepthRecMap : m_cListPicYuvRecMap )[iViewIdx]; |
|---|
| 1108 | PicOrderCnt &riNextPocToDump = ( isDepth ? m_aiNextDepthPocToDump : m_aiNextPocToDump )[iViewIdx]; |
|---|
| 1109 | TVideoIOYuv* &rpcTVideoIOYuvReconFile = ( isDepth ? m_acTVideoIOYuvDepthReconFileList : m_acTVideoIOYuvReconFileList )[iViewIdx]; |
|---|
| 1110 | std::map<PicOrderCnt, TComPicYuv*>::iterator i; |
|---|
| 1111 | |
|---|
| 1112 | while( ! rcMap.empty() && ( i = rcMap.begin() )->first == riNextPocToDump ) |
|---|
| 1113 | { |
|---|
| 1114 | riNextPocToDump++; |
|---|
| 1115 | #if POZNAN_NONLINEAR_DEPTH |
|---|
| 1116 | if(isDepth && m_bUseNonlinearDepth) |
|---|
| 1117 | { |
|---|
| 1118 | TComPicYuv *pcPicOrg = i->second; |
|---|
| 1119 | TComPicYuv *pcPicPow = new TComPicYuv; |
|---|
| 1120 | //pcPicYuvRec->createCompatibleAs(*iterPicYuvRec); |
|---|
| 1121 | pcPicPow->create( pcPicOrg->getWidth(), pcPicOrg->getHeight(), pcPicOrg->getMaxCuWidth(), pcPicOrg->getMaxCuHeight(), pcPicOrg->getMaxCuDepth() ); |
|---|
| 1122 | //cPicPower.create(pcSPS->getWidth(), pcSPS->getHeight(), pcSPS->getMaxCUWidth(), pcSPS->getMaxCUHeight(), pcSPS->getMaxCUDepth() ); |
|---|
| 1123 | pcPicOrg->nonlinearDepthBackward(pcPicPow, m_cNonlinearDepthModel); |
|---|
| 1124 | rpcTVideoIOYuvReconFile->write( pcPicPow, m_aiPad ); |
|---|
| 1125 | // to do destroy pcPicow |
|---|
| 1126 | } else |
|---|
| 1127 | #endif |
|---|
| 1128 | rpcTVideoIOYuvReconFile->write( i->second, m_aiPad ); |
|---|
| 1129 | rcMap.erase( i ); |
|---|
| 1130 | } |
|---|
| 1131 | } |
|---|
| 1132 | |
|---|
| 1133 | // GT FIX |
|---|
| 1134 | std::vector<TComPic*> TAppEncTop::getSpatialRefPics( Int iViewIdx, Int iPoc, Bool bIsDepthCoder ) |
|---|
| 1135 | { |
|---|
| 1136 | std::vector<TComPic*> apcRefPics( iViewIdx, (TComPic*)NULL ); |
|---|
| 1137 | for( int iRefViewIdx = 0; iRefViewIdx < iViewIdx; iRefViewIdx++ ) |
|---|
| 1138 | { |
|---|
| 1139 | // GT FIX |
|---|
| 1140 | TComPic* pcRefPic = xGetPicFromView(iRefViewIdx, iPoc, bIsDepthCoder); |
|---|
| 1141 | |
|---|
| 1142 | assert( pcRefPic != NULL ); |
|---|
| 1143 | apcRefPics[iRefViewIdx] = pcRefPic; |
|---|
| 1144 | } |
|---|
| 1145 | return apcRefPics; |
|---|
| 1146 | } |
|---|
| 1147 | |
|---|
| 1148 | |
|---|
| 1149 | TComPic* TAppEncTop::xGetPicFromView( Int iViewIdx, Int iPoc, bool bDepth ) |
|---|
| 1150 | { |
|---|
| 1151 | assert( ( iViewIdx >= 0) && ( iViewIdx < m_iNumberOfViews ) ); |
|---|
| 1152 | |
|---|
| 1153 | TComPic* pcPic = 0; |
|---|
| 1154 | TComList<TComPic*>* apcListPic; |
|---|
| 1155 | |
|---|
| 1156 | apcListPic = (bDepth ? m_acTEncDepthTopList[iViewIdx] : m_acTEncTopList[iViewIdx])->getListPic() ; |
|---|
| 1157 | |
|---|
| 1158 | for(TComList<TComPic*>::iterator it=apcListPic->begin(); it!=apcListPic->end(); it++) |
|---|
| 1159 | { |
|---|
| 1160 | if( (*it)->getPOC() == iPoc ) |
|---|
| 1161 | { |
|---|
| 1162 | pcPic = *it ; |
|---|
| 1163 | break ; |
|---|
| 1164 | } |
|---|
| 1165 | } |
|---|
| 1166 | |
|---|
| 1167 | return pcPic; |
|---|
| 1168 | }; |
|---|
| 1169 | |
|---|
| 1170 | TComPicYuv* TAppEncTop::xGetPicYuvFromView( Int iViewIdx, Int iPoc, Bool bDepth, Bool bRecon ) |
|---|
| 1171 | { |
|---|
| 1172 | TComPic* pcPic = xGetPicFromView( iViewIdx, iPoc, bDepth); |
|---|
| 1173 | TComPicYuv* pcPicYuv = NULL; |
|---|
| 1174 | |
|---|
| 1175 | if (pcPic != NULL) |
|---|
| 1176 | { |
|---|
| 1177 | if( bRecon ) |
|---|
| 1178 | { |
|---|
| 1179 | if ( pcPic->getReconMark() ) |
|---|
| 1180 | { |
|---|
| 1181 | pcPicYuv = pcPic->getPicYuvRec(); |
|---|
| 1182 | } |
|---|
| 1183 | } |
|---|
| 1184 | else |
|---|
| 1185 | { |
|---|
| 1186 | pcPicYuv = pcPic->getPicYuvOrg(); |
|---|
| 1187 | } |
|---|
| 1188 | }; |
|---|
| 1189 | |
|---|
| 1190 | return pcPicYuv; |
|---|
| 1191 | }; |
|---|
| 1192 | |
|---|
| 1193 | #if HHI_VSO |
|---|
| 1194 | Void TAppEncTop::xSetBasePicYuv( Int iViewIdx, Int iPoc, TComMVDRefData* pcRefInfo, InterViewReference eView, bool bDepth ) |
|---|
| 1195 | { |
|---|
| 1196 | |
|---|
| 1197 | if ( ( iViewIdx < 0) || ( iViewIdx >= m_iNumberOfViews ) ) |
|---|
| 1198 | return; |
|---|
| 1199 | |
|---|
| 1200 | if ( !m_bUsingDepthMaps && bDepth ) |
|---|
| 1201 | return; |
|---|
| 1202 | |
|---|
| 1203 | TComPic* pcPic = xGetPicFromView( iViewIdx, iPoc, bDepth); |
|---|
| 1204 | |
|---|
| 1205 | if (pcPic == 0) |
|---|
| 1206 | return; |
|---|
| 1207 | |
|---|
| 1208 | pcRefInfo->setPicYuvBaseView(eView, bDepth, pcPic->getPicYuvOrg(), pcPic->getReconMark() ? pcPic->getPicYuvRec() : NULL ); |
|---|
| 1209 | |
|---|
| 1210 | }; |
|---|
| 1211 | |
|---|
| 1212 | Void TAppEncTop::setMVDPic( Int iViewIdx, Int iPoc, TComMVDRefData* pcMVDRefData ) |
|---|
| 1213 | { |
|---|
| 1214 | AOF( iViewIdx >= 0); |
|---|
| 1215 | AOF( iViewIdx < m_iNumberOfViews ); |
|---|
| 1216 | |
|---|
| 1217 | xSetBasePicYuv(iViewIdx - 1, iPoc, pcMVDRefData, PREVVIEW, false); |
|---|
| 1218 | xSetBasePicYuv(iViewIdx , iPoc, pcMVDRefData, CURRVIEW, false ); |
|---|
| 1219 | xSetBasePicYuv(iViewIdx + 1, iPoc, pcMVDRefData, NEXTVIEW, false ); |
|---|
| 1220 | |
|---|
| 1221 | if ( m_bUsingDepthMaps ) |
|---|
| 1222 | { |
|---|
| 1223 | xSetBasePicYuv(iViewIdx - 1, iPoc, pcMVDRefData, PREVVIEW, true ); |
|---|
| 1224 | xSetBasePicYuv(iViewIdx , iPoc, pcMVDRefData, CURRVIEW, true ); |
|---|
| 1225 | xSetBasePicYuv(iViewIdx + 1, iPoc, pcMVDRefData, NEXTVIEW, true ); |
|---|
| 1226 | } |
|---|
| 1227 | |
|---|
| 1228 | |
|---|
| 1229 | xSetBaseLUT (iViewIdx, iViewIdx-1 , pcMVDRefData, PREVVIEW ); |
|---|
| 1230 | xSetBaseLUT (iViewIdx, iViewIdx+1 , pcMVDRefData, NEXTVIEW ); |
|---|
| 1231 | |
|---|
| 1232 | |
|---|
| 1233 | if ( m_bUseVSO && m_uiVSOMode != 4) |
|---|
| 1234 | { |
|---|
| 1235 | xSetERPicYuvs (iViewIdx, iPoc, pcMVDRefData); |
|---|
| 1236 | pcMVDRefData->setShiftLUTsERView(m_cCameraData.getSynthViewShiftLUTD()[iViewIdx], m_cCameraData.getSynthViewShiftLUTI()[iViewIdx] ); |
|---|
| 1237 | pcMVDRefData->setRefViewInd (m_aaiBaseViewRefInd[iViewIdx], m_aaiERViewRefInd[iViewIdx], m_aaiERViewRefLutInd[iViewIdx]); |
|---|
| 1238 | } |
|---|
| 1239 | }; |
|---|
| 1240 | |
|---|
| 1241 | |
|---|
| 1242 | Void TAppEncTop::xSetBaseLUT( Int iViewIdxSource, Int iViewIdxTarget, TComMVDRefData* pcRefInfo, InterViewReference eView ) |
|---|
| 1243 | { |
|---|
| 1244 | if ( ( iViewIdxSource < 0) || ( iViewIdxSource >= m_iNumberOfViews )||( iViewIdxTarget < 0) || ( iViewIdxTarget >= m_iNumberOfViews ) ) |
|---|
| 1245 | return; |
|---|
| 1246 | assert( abs( iViewIdxTarget - iViewIdxSource ) <= 1 ); //GT; Not supported yet |
|---|
| 1247 | pcRefInfo->setShiftLUTsBaseView(eView, m_cCameraData.getBaseViewShiftLUTD()[iViewIdxSource][iViewIdxTarget],m_cCameraData.getBaseViewShiftLUTI()[iViewIdxSource][iViewIdxTarget] ); |
|---|
| 1248 | }; |
|---|
| 1249 | |
|---|
| 1250 | Void TAppEncTop::xSetERPicYuvs( Int iViewIdx, Int iPoc, TComMVDRefData* pcReferenceInfo ) |
|---|
| 1251 | { |
|---|
| 1252 | std::vector<TComPicYuv*> apcExtRefViews; |
|---|
| 1253 | |
|---|
| 1254 | std::map< Int, vector<TComPicYuv*> >::iterator cMapIt; |
|---|
| 1255 | cMapIt = m_cMapPicExtRefView.find(iPoc); |
|---|
| 1256 | |
|---|
| 1257 | assert( cMapIt != m_cMapPicExtRefView.end() ); |
|---|
| 1258 | |
|---|
| 1259 | pcReferenceInfo->setPicYuvERViews( cMapIt->second ); |
|---|
| 1260 | } |
|---|
| 1261 | |
|---|
| 1262 | Void TAppEncTop::xStoreVSORefPicsInBuffer() |
|---|
| 1263 | { |
|---|
| 1264 | // X-Check if all Encoders have received the same number of pics |
|---|
| 1265 | Int iNumRcvd = m_iFrameRcvdVector[0]; |
|---|
| 1266 | for ( UInt uiViewNumber = 0; uiViewNumber < m_iNumberOfViews; uiViewNumber ++ ) |
|---|
| 1267 | { |
|---|
| 1268 | assert( ( m_iFrameRcvdVector[uiViewNumber] == iNumRcvd ) && ( m_iDepthFrameRcvdVector[uiViewNumber] == iNumRcvd ) ); //GT; if assert here, the encoder instances are not synchronized any more, re-think this function and the ERView Buffer!! |
|---|
| 1269 | }; |
|---|
| 1270 | |
|---|
| 1271 | Int iCurPoc = iNumRcvd - 1; |
|---|
| 1272 | |
|---|
| 1273 | if ( iCurPoc <= m_iLastFramePutInERViewBuffer ) |
|---|
| 1274 | { |
|---|
| 1275 | return; |
|---|
| 1276 | } |
|---|
| 1277 | |
|---|
| 1278 | std::vector<TComPicYuv*> apcExtRefViewVec; |
|---|
| 1279 | |
|---|
| 1280 | Int iNumberOfReferenceViews = 0; |
|---|
| 1281 | if (m_iNumberOfExternalRefs != 0) |
|---|
| 1282 | { |
|---|
| 1283 | m_aaiERViewRefLutInd = m_aaiERViewRefInd; |
|---|
| 1284 | // Insert Rendered Views form File |
|---|
| 1285 | |
|---|
| 1286 | iNumberOfReferenceViews = m_iNumberOfExternalRefs; |
|---|
| 1287 | |
|---|
| 1288 | for ( UInt uiViewNumber = 0; uiViewNumber < iNumberOfReferenceViews; uiViewNumber++ ) |
|---|
| 1289 | { |
|---|
| 1290 | TComPicYuv* pcPicYuvERView = new TComPicYuv; |
|---|
| 1291 | pcPicYuvERView->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); |
|---|
| 1292 | |
|---|
| 1293 | m_acTVideoIOYuvERFileList[uiViewNumber]->read( pcPicYuvERView, m_aiPad ) ; |
|---|
| 1294 | |
|---|
| 1295 | apcExtRefViewVec.push_back( pcPicYuvERView ); |
|---|
| 1296 | } |
|---|
| 1297 | } |
|---|
| 1298 | else |
|---|
| 1299 | { //Render Views |
|---|
| 1300 | |
|---|
| 1301 | for ( UInt uiViewNumber = 0; uiViewNumber < m_iNumberOfViews; uiViewNumber++ ) |
|---|
| 1302 | { |
|---|
| 1303 | m_aaiERViewRefInd [uiViewNumber].clear(); |
|---|
| 1304 | m_aaiERViewRefLutInd[uiViewNumber].clear(); |
|---|
| 1305 | } |
|---|
| 1306 | |
|---|
| 1307 | iNumberOfReferenceViews = 0; |
|---|
| 1308 | for ( UInt iSynthViewIdx = 0; iSynthViewIdx < m_cCameraData.getSynthViewNumbers().size(); iSynthViewIdx++ ) |
|---|
| 1309 | { |
|---|
| 1310 | // Get Left and right view |
|---|
| 1311 | Int iLeftViewIdx = -1; |
|---|
| 1312 | Int iRightViewIdx = -1; |
|---|
| 1313 | Bool bIsBaseView; |
|---|
| 1314 | |
|---|
| 1315 | Int iRelDistToLeft; |
|---|
| 1316 | m_cCameraData.getLeftRightBaseView( iSynthViewIdx, iLeftViewIdx, iRightViewIdx, iRelDistToLeft, bIsBaseView ); |
|---|
| 1317 | |
|---|
| 1318 | if ((iLeftViewIdx == -1) || (iRightViewIdx == -1)) |
|---|
| 1319 | { |
|---|
| 1320 | std::cerr << "Left or right View not given." << endl; |
|---|
| 1321 | exit(EXIT_FAILURE); |
|---|
| 1322 | } |
|---|
| 1323 | |
|---|
| 1324 | m_cRendererTop.setShiftLUTs( |
|---|
| 1325 | m_cCameraData.getSynthViewShiftLUTD()[iLeftViewIdx] [iSynthViewIdx], |
|---|
| 1326 | m_cCameraData.getSynthViewShiftLUTI()[iLeftViewIdx] [iSynthViewIdx], |
|---|
| 1327 | m_cCameraData.getBaseViewShiftLUTI ()[iLeftViewIdx] [iRightViewIdx], |
|---|
| 1328 | m_cCameraData.getSynthViewShiftLUTD()[iRightViewIdx][iSynthViewIdx], |
|---|
| 1329 | m_cCameraData.getSynthViewShiftLUTI()[iRightViewIdx][iSynthViewIdx], |
|---|
| 1330 | m_cCameraData.getBaseViewShiftLUTI ()[iRightViewIdx][iLeftViewIdx], |
|---|
| 1331 | iRelDistToLeft |
|---|
| 1332 | ); |
|---|
| 1333 | if ( bIsBaseView ) continue; |
|---|
| 1334 | |
|---|
| 1335 | // Render from left |
|---|
| 1336 | TComPicYuv* pcPicYuvERView = new TComPicYuv; |
|---|
| 1337 | pcPicYuvERView->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); |
|---|
| 1338 | m_cRendererTop.extrapolateView( xGetPicFromView( iLeftViewIdx, iCurPoc, false )->getPicYuvOrg(), xGetPicFromView( iLeftViewIdx, iCurPoc, true )->getPicYuvOrg(), pcPicYuvERView, true ); |
|---|
| 1339 | |
|---|
| 1340 | apcExtRefViewVec.push_back( pcPicYuvERView ); |
|---|
| 1341 | |
|---|
| 1342 | m_aaiERViewRefInd [ iLeftViewIdx].push_back( iNumberOfReferenceViews ); |
|---|
| 1343 | m_aaiERViewRefLutInd[ iLeftViewIdx].push_back( iSynthViewIdx ); |
|---|
| 1344 | iNumberOfReferenceViews++; |
|---|
| 1345 | |
|---|
| 1346 | //Render from right |
|---|
| 1347 | pcPicYuvERView = new TComPicYuv; |
|---|
| 1348 | pcPicYuvERView->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); |
|---|
| 1349 | |
|---|
| 1350 | m_cRendererTop.extrapolateView( xGetPicFromView( iRightViewIdx, iCurPoc, false )->getPicYuvOrg(), xGetPicFromView( iRightViewIdx, iCurPoc, true )->getPicYuvOrg(), pcPicYuvERView, false ); |
|---|
| 1351 | apcExtRefViewVec.push_back( pcPicYuvERView ); |
|---|
| 1352 | |
|---|
| 1353 | m_aaiERViewRefInd [ iRightViewIdx].push_back( iNumberOfReferenceViews ); |
|---|
| 1354 | m_aaiERViewRefLutInd[ iRightViewIdx].push_back( iSynthViewIdx ); |
|---|
| 1355 | iNumberOfReferenceViews++; |
|---|
| 1356 | } |
|---|
| 1357 | } |
|---|
| 1358 | |
|---|
| 1359 | m_iLastFramePutInERViewBuffer++; |
|---|
| 1360 | m_cMapPicExtRefView.insert( std::make_pair( m_iLastFramePutInERViewBuffer, apcExtRefViewVec ) ); |
|---|
| 1361 | |
|---|
| 1362 | if ( m_cMapPicExtRefView.size() > (UInt)m_iGOPSize + 1 ) |
|---|
| 1363 | { |
|---|
| 1364 | for ( UInt uiViewNumber = 0; uiViewNumber < (UInt) m_cMapPicExtRefView.begin()->second.size(); uiViewNumber++ ) |
|---|
| 1365 | { |
|---|
| 1366 | if ( m_cMapPicExtRefView.begin()->second[uiViewNumber] ) |
|---|
| 1367 | { |
|---|
| 1368 | m_cMapPicExtRefView.begin()->second[uiViewNumber]->destroy(); |
|---|
| 1369 | delete m_cMapPicExtRefView.begin()->second[uiViewNumber]; |
|---|
| 1370 | } |
|---|
| 1371 | } |
|---|
| 1372 | m_cMapPicExtRefView.erase ( m_cMapPicExtRefView.begin() ); |
|---|
| 1373 | } |
|---|
| 1374 | } |
|---|
| 1375 | #endif |
|---|
| 1376 | |
|---|
| 1377 | #if POZNAN_SYNTH |
|---|
| 1378 | Void TAppEncTop::xStoreSynthPicsInBuffer(Int iCoddedViewIdx,Bool bDepth) |
|---|
| 1379 | { |
|---|
| 1380 | Int iCurPoc; |
|---|
| 1381 | if(bDepth) |
|---|
| 1382 | { |
|---|
| 1383 | iCurPoc = m_acTEncDepthTopList[ iCoddedViewIdx ]->getNextFrameId(); |
|---|
| 1384 | if (!(m_acTEncDepthTopList[ iCoddedViewIdx ]->currentPocWillBeCoded())) return; |
|---|
| 1385 | } |
|---|
| 1386 | else |
|---|
| 1387 | { |
|---|
| 1388 | iCurPoc = m_acTEncTopList[ iCoddedViewIdx ]->getNextFrameId(); |
|---|
| 1389 | if (!(m_acTEncTopList[ iCoddedViewIdx ]->currentPocWillBeCoded())) return; |
|---|
| 1390 | } |
|---|
| 1391 | |
|---|
| 1392 | Int iNumberOfReferenceViews = 0; |
|---|
| 1393 | Int iNearestViewIdx = -1; |
|---|
| 1394 | Bool bRenderFromLeft; |
|---|
| 1395 | |
|---|
| 1396 | Int iRelDistToLeft; |
|---|
| 1397 | if(iCoddedViewIdx==0) //First on View Coded List |
|---|
| 1398 | { |
|---|
| 1399 | //TComPic* pcPic = xGetPicFromView( iCoddedViewIdx, iCurPoc, false ); |
|---|
| 1400 | return; |
|---|
| 1401 | } |
|---|
| 1402 | m_cCameraData.getNearestBaseView(iCoddedViewIdx, iNearestViewIdx, iRelDistToLeft, bRenderFromLeft); |
|---|
| 1403 | |
|---|
| 1404 | m_cAvailabilityRenderer.setShiftLUTs( |
|---|
| 1405 | m_cCameraData.getBaseViewShiftLUTD()[iNearestViewIdx][iCoddedViewIdx], |
|---|
| 1406 | m_cCameraData.getBaseViewShiftLUTI()[iNearestViewIdx][iCoddedViewIdx], |
|---|
| 1407 | m_cCameraData.getBaseViewShiftLUTI()[iNearestViewIdx][iCoddedViewIdx], |
|---|
| 1408 | m_cCameraData.getBaseViewShiftLUTD()[iNearestViewIdx][iCoddedViewIdx],//right |
|---|
| 1409 | m_cCameraData.getBaseViewShiftLUTI()[iNearestViewIdx][iCoddedViewIdx], |
|---|
| 1410 | m_cCameraData.getBaseViewShiftLUTI()[iNearestViewIdx][iCoddedViewIdx], |
|---|
| 1411 | iRelDistToLeft |
|---|
| 1412 | ); |
|---|
| 1413 | |
|---|
| 1414 | |
|---|
| 1415 | //TComPicYuv* pcPicYuvERView = new TComPicYuv; |
|---|
| 1416 | //pcPicYuvERView->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); |
|---|
| 1417 | |
|---|
| 1418 | TComPic* pcPic = xGetPicFromView( iCoddedViewIdx, iCurPoc, bDepth ); |
|---|
| 1419 | pcPic->addSynthesisBuffer(); |
|---|
| 1420 | pcPic->addAvailabilityBuffer(); |
|---|
| 1421 | // usun to i wykorzystaj synteze która robi krzysztof dla glebi - tylko najpierw ja przeson przed kodowanie tekstury //to do |
|---|
| 1422 | /* |
|---|
| 1423 | #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH |
|---|
| 1424 | if(!bDepth) |
|---|
| 1425 | { |
|---|
| 1426 | pcPic->addSynthesisDepthBuffer(); |
|---|
| 1427 | TComPicYuv* pcPicYuvSynthDepthView = pcPic->getPicYuvSynthDepth(); |
|---|
| 1428 | m_cAvailabilityRenderer.extrapolateAvailabilityView( xGetPicFromView( iNearestViewIdx, iCurPoc, true )->getPicYuvRec(), xGetPicFromView( iNearestViewIdx, iCurPoc, true )->getPicYuvRec(), pcPicYuvSynthDepthView, pcPic->getPicYuvAvail(), bRenderFromLeft ); |
|---|
| 1429 | #if POZNAN_OUTPUT_SYNTH |
|---|
| 1430 | Char acFilenameBaseD[1024]; |
|---|
| 1431 | //printf("\niNearestViewIdx: %d, iCurPoc: %d, bRenderFromLeft: %s\n", iNearestViewIdx, iCurPoc, (bRenderFromLeft)?"true":"false"); |
|---|
| 1432 | ::sprintf( acFilenameBaseD, "SynthInputDepth_%s_V%d.yuv", ( false ? "Dec" : "Enc" ),iCoddedViewIdx ); |
|---|
| 1433 | xGetPicFromView( iNearestViewIdx, iCurPoc, true )->getPicYuvRec()->dump(acFilenameBaseD, iCurPoc!=0); |
|---|
| 1434 | ::sprintf( acFilenameBaseD, "SynthDepth_%s_V%d.yuv", ( false ? "Dec" : "Enc" ),iCoddedViewIdx ); |
|---|
| 1435 | pcPicYuvSynthDepthView->dump(acFilenameBaseD, iCurPoc!=0); |
|---|
| 1436 | #endif |
|---|
| 1437 | } |
|---|
| 1438 | #endif//*/ |
|---|
| 1439 | TComPicYuv* pcPicYuvSynthView = pcPic->getPicYuvSynth(); |
|---|
| 1440 | TComPicYuv* pcPicYuvAvailView = pcPic->getPicYuvAvail(); |
|---|
| 1441 | |
|---|
| 1442 | //m_cAvailabilityRenderer.extrapolateAvailabilityView( xGetPicFromView( iNearestViewIdx, iCurPoc, false )->getPicYuvRec(), xGetPicFromView( iNearestViewIdx, iCurPoc, true )->getPicYuvRec(), pcPicYuvERView, pcPicYuvAvailView, bRenderFromLeft ); |
|---|
| 1443 | m_cAvailabilityRenderer.extrapolateAvailabilityView( xGetPicFromView( iNearestViewIdx, iCurPoc, bDepth )->getPicYuvRec(), xGetPicFromView( iNearestViewIdx, iCurPoc, true )->getPicYuvRec(), pcPicYuvSynthView, pcPicYuvAvailView, bRenderFromLeft ); |
|---|
| 1444 | |
|---|
| 1445 | pcPicYuvAvailView->setBorderExtension( false );//Needed?? |
|---|
| 1446 | pcPicYuvAvailView->extendPicBorder();//Needed?? |
|---|
| 1447 | |
|---|
| 1448 | pcPicYuvSynthView->setBorderExtension( false );//Needed?? |
|---|
| 1449 | pcPicYuvSynthView->extendPicBorder();//Needed?? |
|---|
| 1450 | |
|---|
| 1451 | //TComPic* pcPicDepth = xGetPicFromView( iCoddedViewIdx, iCurPoc, true ); |
|---|
| 1452 | //pcPicDepth->addAvailabilityBuffer(); |
|---|
| 1453 | //pcPicDepth->addSynthesisBuffer(); |
|---|
| 1454 | //pcPicYuvAvailView->copyToPic(pcPicDepth->getPicYuvAvail()); |
|---|
| 1455 | |
|---|
| 1456 | #if POZNAN_OUTPUT_AVAILABLE_MAP |
|---|
| 1457 | { |
|---|
| 1458 | Char acFilenameBase[1024]; |
|---|
| 1459 | ::sprintf( acFilenameBase, "Available_%s_%s_V%d.yuv", (bDepth?"Depth":"Tex"),( false ? "Dec" : "Enc" ),iCoddedViewIdx ); |
|---|
| 1460 | pcPicYuvAvailView->dump(acFilenameBase, iCurPoc!=0); |
|---|
| 1461 | } |
|---|
| 1462 | #endif |
|---|
| 1463 | #if POZNAN_OUTPUT_SYNTH |
|---|
| 1464 | { |
|---|
| 1465 | Char acFilenameBase[1024]; |
|---|
| 1466 | ::sprintf( acFilenameBase, "Synth_%s_%s_V%d.yuv", (bDepth?"Depth":"Tex"),( false ? "Dec" : "Enc" ),iCoddedViewIdx ); |
|---|
| 1467 | pcPicYuvSynthView->dump(acFilenameBase, iCurPoc!=0); |
|---|
| 1468 | } |
|---|
| 1469 | #endif |
|---|
| 1470 | |
|---|
| 1471 | //Usun pcPicYuvERView i inne bufforki |
|---|
| 1472 | } |
|---|
| 1473 | #endif |
|---|
| 1474 | |
|---|
| 1475 | //* |
|---|
| 1476 | #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH |
|---|
| 1477 | Void TAppEncTop::xStoreDepthSynthPicsInBuffer(Int iCoddedViewIdx) |
|---|
| 1478 | { |
|---|
| 1479 | Int iLeftViewIdx = -1; |
|---|
| 1480 | Int iRightViewIdx = -1; |
|---|
| 1481 | Int iNearestViewIdx = -1; |
|---|
| 1482 | Bool bRenderFromLeft; |
|---|
| 1483 | |
|---|
| 1484 | Int iCurPoc = m_acTEncTopList[ iCoddedViewIdx ]->getNextFrameId(); |
|---|
| 1485 | if (!(m_acTEncTopList[ iCoddedViewIdx ]->currentPocWillBeCoded())) return; |
|---|
| 1486 | |
|---|
| 1487 | Int iRelDistToLeft = 128; |
|---|
| 1488 | if(iCoddedViewIdx==0) //First on View Coded List |
|---|
| 1489 | { |
|---|
| 1490 | //TComPic* pcPic = getPicFromView( iCoddedViewIdx, iCurPoc, false ); |
|---|
| 1491 | return; |
|---|
| 1492 | } |
|---|
| 1493 | iNearestViewIdx = 0; |
|---|
| 1494 | //bRenderFromLeft = iCoddedViewOrderIdx>0?true:false; |
|---|
| 1495 | //bRenderFromLeft = iCoddedViewOrderIdx<0?true:false; |
|---|
| 1496 | //m_cCamParsCollector.getNearestBaseView(iCoddedViewIdx, iNearestViewIdx, iRelDistToLeft, bRenderFromLeft); |
|---|
| 1497 | bRenderFromLeft = iCoddedViewIdx>1?true:false; |
|---|
| 1498 | |
|---|
| 1499 | m_cAvailabilityRenderer.setShiftLUTs( |
|---|
| 1500 | m_cCameraData.getBaseViewShiftLUTD()[iNearestViewIdx][iCoddedViewIdx], |
|---|
| 1501 | m_cCameraData.getBaseViewShiftLUTI()[iNearestViewIdx][iCoddedViewIdx], |
|---|
| 1502 | m_cCameraData.getBaseViewShiftLUTI()[iNearestViewIdx][iCoddedViewIdx], |
|---|
| 1503 | m_cCameraData.getBaseViewShiftLUTD()[iNearestViewIdx][iCoddedViewIdx],//right |
|---|
| 1504 | m_cCameraData.getBaseViewShiftLUTI()[iNearestViewIdx][iCoddedViewIdx], |
|---|
| 1505 | m_cCameraData.getBaseViewShiftLUTI()[iNearestViewIdx][iCoddedViewIdx], |
|---|
| 1506 | iRelDistToLeft |
|---|
| 1507 | ); |
|---|
| 1508 | |
|---|
| 1509 | TComPic* pcPic = getPicFromView( iCoddedViewIdx, iCurPoc, false ); |
|---|
| 1510 | |
|---|
| 1511 | TComPicYuv* pcPicYuvSynthDepthView = pcPic->getPicYuvSynthDepth(); |
|---|
| 1512 | if(!pcPicYuvSynthDepthView) |
|---|
| 1513 | { |
|---|
| 1514 | pcPic->addSynthesisDepthBuffer(); |
|---|
| 1515 | pcPicYuvSynthDepthView = pcPic->getPicYuvSynthDepth(); |
|---|
| 1516 | } |
|---|
| 1517 | |
|---|
| 1518 | Int iWidth = pcPicYuvSynthDepthView->getWidth (); |
|---|
| 1519 | Int iHeight = pcPicYuvSynthDepthView->getHeight (); |
|---|
| 1520 | UInt uiMaxCuWidth = pcPicYuvSynthDepthView->getMaxCuWidth (); |
|---|
| 1521 | UInt uiMaxCuHeight = pcPicYuvSynthDepthView->getMaxCuHeight(); |
|---|
| 1522 | UInt uiMaxCuDepth = pcPicYuvSynthDepthView->getMaxCuDepth (); |
|---|
| 1523 | |
|---|
| 1524 | TComPicYuv* pcPicYuvAvailView = new TComPicYuv; |
|---|
| 1525 | pcPicYuvAvailView->create( iWidth, iHeight, uiMaxCuWidth, uiMaxCuHeight, uiMaxCuDepth ); |
|---|
| 1526 | |
|---|
| 1527 | m_cAvailabilityRenderer.extrapolateAvailabilityView( getPicFromView( iNearestViewIdx, iCurPoc, true )->getPicYuvRec(), getPicFromView( iNearestViewIdx, iCurPoc, true )->getPicYuvRec(), pcPicYuvSynthDepthView, pcPicYuvAvailView, bRenderFromLeft ); |
|---|
| 1528 | |
|---|
| 1529 | pcPicYuvAvailView->destroy(); |
|---|
| 1530 | delete pcPicYuvAvailView; |
|---|
| 1531 | |
|---|
| 1532 | #if POZNAN_OUTPUT_SYNTH |
|---|
| 1533 | Char acFilenameBaseD[1024]; |
|---|
| 1534 | //printf("\niNearestViewIdx: %d, iCurPoc: %d, bRenderFromLeft: %s\n", iNearestViewIdx, iCurPoc, (bRenderFromLeft)?"true":"false"); |
|---|
| 1535 | ::sprintf( acFilenameBaseD, "SynthInputDepth_%s_V%d.yuv", ( false ? "Dec" : "Enc" ),iCoddedViewIdx ); |
|---|
| 1536 | getPicFromView( iNearestViewIdx, iCurPoc, true )->getPicYuvRec()->dump(acFilenameBaseD, iCurPoc!=0); |
|---|
| 1537 | ::sprintf( acFilenameBaseD, "SynthDepth_%s_V%d.yuv", ( false ? "Dec" : "Enc" ),iCoddedViewIdx ); |
|---|
| 1538 | pcPicYuvSynthDepthView->dump(acFilenameBaseD, iCurPoc!=0); |
|---|
| 1539 | #endif |
|---|
| 1540 | |
|---|
| 1541 | } |
|---|
| 1542 | #endif//*/ |
|---|
| 1543 | |
|---|
| 1544 | |
|---|
| 1545 | #if HHI_INTERVIEW_SKIP |
|---|
| 1546 | Void TAppEncTop::getUsedPelsMap( Int iViewIdx, Int iPoc, TComPicYuv* pcPicYuvUsedSplsMap ) |
|---|
| 1547 | { |
|---|
| 1548 | AOT( iViewIdx <= 0); |
|---|
| 1549 | AOT( iViewIdx >= m_iNumberOfViews ); |
|---|
| 1550 | AOF( m_uiInterViewSkip != 0 ); |
|---|
| 1551 | AOF( m_cCameraData.getCurFrameId() == iPoc ); |
|---|
| 1552 | |
|---|
| 1553 | Int iViewSIdx = m_cCameraData.getBaseId2SortedId()[iViewIdx]; |
|---|
| 1554 | Int iFirstViewSIdx = m_cCameraData.getBaseId2SortedId()[0]; |
|---|
| 1555 | |
|---|
| 1556 | AOT( iViewSIdx == iFirstViewSIdx ); |
|---|
| 1557 | |
|---|
| 1558 | Bool bFirstIsLeft = (iFirstViewSIdx < iViewSIdx); |
|---|
| 1559 | |
|---|
| 1560 | m_cUsedPelsRenderer.setShiftLUTs( |
|---|
| 1561 | m_cCameraData.getBaseViewShiftLUTD()[0][iViewIdx], |
|---|
| 1562 | m_cCameraData.getBaseViewShiftLUTI()[0][iViewIdx], |
|---|
| 1563 | m_cCameraData.getBaseViewShiftLUTI()[0][iViewIdx], |
|---|
| 1564 | m_cCameraData.getBaseViewShiftLUTD()[0][iViewIdx], |
|---|
| 1565 | m_cCameraData.getBaseViewShiftLUTI()[0][iViewIdx], |
|---|
| 1566 | m_cCameraData.getBaseViewShiftLUTI()[0][iViewIdx], |
|---|
| 1567 | -1 |
|---|
| 1568 | ); |
|---|
| 1569 | |
|---|
| 1570 | |
|---|
| 1571 | TComPicYuv* pcPicYuvDepth = xGetPicYuvFromView(0, iPoc, true, true ); |
|---|
| 1572 | AOF( pcPicYuvDepth); |
|---|
| 1573 | |
|---|
| 1574 | m_cUsedPelsRenderer.getUsedSamplesMap( pcPicYuvDepth, pcPicYuvUsedSplsMap, bFirstIsLeft ); |
|---|
| 1575 | |
|---|
| 1576 | } |
|---|
| 1577 | #endif |
|---|
| 1578 | |
|---|
| 1579 | #if HHI_VSO |
|---|
| 1580 | Void TAppEncTop::setupRenModel( Int iPoc, Int iEncViewIdx, Int iEncContent ) |
|---|
| 1581 | { |
|---|
| 1582 | Int iEncViewSIdx = m_cCameraData.getBaseId2SortedId()[ iEncViewIdx ]; |
|---|
| 1583 | |
|---|
| 1584 | // setup base views |
|---|
| 1585 | Int iNumOfBV = m_cRenModStrParser.getNumOfBaseViewsForView( iEncViewSIdx, iEncContent ); |
|---|
| 1586 | |
|---|
| 1587 | for (Int iCurView = 0; iCurView < iNumOfBV; iCurView++ ) |
|---|
| 1588 | { |
|---|
| 1589 | Int iBaseViewSIdx; |
|---|
| 1590 | Int iVideoDistMode; |
|---|
| 1591 | Int iDepthDistMode; |
|---|
| 1592 | |
|---|
| 1593 | m_cRenModStrParser.getBaseViewData( iEncViewSIdx, iEncContent, iCurView, iBaseViewSIdx, iVideoDistMode, iDepthDistMode ); |
|---|
| 1594 | |
|---|
| 1595 | AOT( iVideoDistMode < 0 || iVideoDistMode > 2 ); |
|---|
| 1596 | |
|---|
| 1597 | Int iBaseViewIdx = m_cCameraData.getBaseSortedId2Id()[ iBaseViewSIdx ]; |
|---|
| 1598 | |
|---|
| 1599 | TComPicYuv* pcPicYuvVideoRec = xGetPicYuvFromView( iBaseViewIdx, iPoc, false, true ); |
|---|
| 1600 | TComPicYuv* pcPicYuvDepthRec = xGetPicYuvFromView( iBaseViewIdx, iPoc, true , true ); |
|---|
| 1601 | TComPicYuv* pcPicYuvVideoOrg = xGetPicYuvFromView( iBaseViewIdx, iPoc, false, false ); |
|---|
| 1602 | TComPicYuv* pcPicYuvDepthOrg = xGetPicYuvFromView( iBaseViewIdx, iPoc, true , false ); |
|---|
| 1603 | |
|---|
| 1604 | TComPicYuv* pcPicYuvVideoRef = ( iVideoDistMode == 2 ) ? pcPicYuvVideoOrg : NULL; |
|---|
| 1605 | TComPicYuv* pcPicYuvDepthRef = ( iDepthDistMode == 2 ) ? pcPicYuvDepthOrg : NULL; |
|---|
| 1606 | |
|---|
| 1607 | TComPicYuv* pcPicYuvVideoTest = ( iVideoDistMode == 0 ) ? pcPicYuvVideoOrg : pcPicYuvVideoRec; |
|---|
| 1608 | TComPicYuv* pcPicYuvDepthTest = ( iDepthDistMode == 0 ) ? pcPicYuvDepthOrg : pcPicYuvDepthRec; |
|---|
| 1609 | |
|---|
| 1610 | AOT( (iVideoDistMode == 2) != (pcPicYuvVideoRef != NULL) ); |
|---|
| 1611 | AOT( (iDepthDistMode == 2) != (pcPicYuvDepthRef != NULL) ); |
|---|
| 1612 | AOT( pcPicYuvDepthTest == NULL ); |
|---|
| 1613 | AOT( pcPicYuvVideoTest == NULL ); |
|---|
| 1614 | |
|---|
| 1615 | m_cRendererModel.setBaseView( iBaseViewSIdx, pcPicYuvVideoTest, pcPicYuvDepthTest, pcPicYuvVideoRef, pcPicYuvDepthRef ); |
|---|
| 1616 | } |
|---|
| 1617 | |
|---|
| 1618 | m_cRendererModel.setErrorMode( iEncViewSIdx, iEncContent, 0 ); |
|---|
| 1619 | // setup virtual views |
|---|
| 1620 | Int iNumOfSV = m_cRenModStrParser.getNumOfModelsForView( iEncViewSIdx, iEncContent ); |
|---|
| 1621 | for (Int iCurView = 0; iCurView < iNumOfSV; iCurView++ ) |
|---|
| 1622 | { |
|---|
| 1623 | Int iOrgRefBaseViewSIdx; |
|---|
| 1624 | Int iLeftBaseViewSIdx; |
|---|
| 1625 | Int iRightBaseViewSIdx; |
|---|
| 1626 | Int iSynthViewRelNum; |
|---|
| 1627 | Int iModelNum; |
|---|
| 1628 | Int iBlendMode; |
|---|
| 1629 | m_cRenModStrParser.getSingleModelData(iEncViewSIdx, iEncContent, iCurView, iModelNum, iBlendMode,iLeftBaseViewSIdx, iRightBaseViewSIdx, iOrgRefBaseViewSIdx, iSynthViewRelNum ); |
|---|
| 1630 | |
|---|
| 1631 | Int iLeftBaseViewIdx = -1; |
|---|
| 1632 | Int iRightBaseViewIdx = -1; |
|---|
| 1633 | |
|---|
| 1634 | TComPicYuv* pcPicYuvOrgRef = NULL; |
|---|
| 1635 | Int** ppiShiftLUTLeft = NULL; |
|---|
| 1636 | Int** ppiShiftLUTRight = NULL; |
|---|
| 1637 | Int** ppiBaseShiftLUTLeft = NULL; |
|---|
| 1638 | Int** ppiBaseShiftLUTRight = NULL; |
|---|
| 1639 | |
|---|
| 1640 | |
|---|
| 1641 | Int iDistToLeft = -1; |
|---|
| 1642 | |
|---|
| 1643 | Int iSynthViewIdx = m_cCameraData.synthRelNum2Idx( iSynthViewRelNum ); |
|---|
| 1644 | |
|---|
| 1645 | if ( iLeftBaseViewSIdx != -1 ) |
|---|
| 1646 | { |
|---|
| 1647 | iLeftBaseViewIdx = m_cCameraData.getBaseSortedId2Id() [ iLeftBaseViewSIdx ]; |
|---|
| 1648 | ppiShiftLUTLeft = m_cCameraData.getSynthViewShiftLUTI()[ iLeftBaseViewIdx ][ iSynthViewIdx ]; |
|---|
| 1649 | } |
|---|
| 1650 | |
|---|
| 1651 | if ( iRightBaseViewSIdx != -1 ) |
|---|
| 1652 | { |
|---|
| 1653 | iRightBaseViewIdx = m_cCameraData.getBaseSortedId2Id() [iRightBaseViewSIdx ]; |
|---|
| 1654 | ppiShiftLUTRight = m_cCameraData.getSynthViewShiftLUTI()[ iRightBaseViewIdx ][ iSynthViewIdx ]; |
|---|
| 1655 | } |
|---|
| 1656 | |
|---|
| 1657 | if ( iRightBaseViewSIdx != -1 && iLeftBaseViewSIdx != -1 ) |
|---|
| 1658 | { |
|---|
| 1659 | iDistToLeft = m_cCameraData.getRelDistLeft( iSynthViewIdx , iLeftBaseViewIdx, iRightBaseViewIdx); |
|---|
| 1660 | ppiBaseShiftLUTLeft = m_cCameraData.getBaseViewShiftLUTI() [ iLeftBaseViewIdx ][ iRightBaseViewIdx ]; |
|---|
| 1661 | ppiBaseShiftLUTRight = m_cCameraData.getBaseViewShiftLUTI() [ iRightBaseViewIdx ][ iLeftBaseViewIdx ]; |
|---|
| 1662 | |
|---|
| 1663 | } |
|---|
| 1664 | |
|---|
| 1665 | if ( iOrgRefBaseViewSIdx != -1 ) |
|---|
| 1666 | { |
|---|
| 1667 | pcPicYuvOrgRef = xGetPicYuvFromView( m_cCameraData.getBaseSortedId2Id()[ iOrgRefBaseViewSIdx ] , iPoc, false, false ); |
|---|
| 1668 | AOF ( pcPicYuvOrgRef ); |
|---|
| 1669 | } |
|---|
| 1670 | |
|---|
| 1671 | m_cRendererModel.setSingleModel( iModelNum, ppiShiftLUTLeft, ppiBaseShiftLUTLeft, ppiShiftLUTRight, ppiBaseShiftLUTRight, iDistToLeft, pcPicYuvOrgRef ); |
|---|
| 1672 | } |
|---|
| 1673 | } |
|---|
| 1674 | #endif |
|---|
| 1675 | |
|---|