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