source: 3DVCSoftware/branches/0.3-nokia/source/App/TAppEncoder/TAppEncTop.cpp @ 193

Last change on this file since 193 was 50, checked in by nokia, 13 years ago

FCO bug-fix to 3DV-HTM version 0.4: decoder crushed with texture-only coding.

  • Property svn:eol-style set to native
File size: 54.3 KB
RevLine 
[5]1/* The copyright in this software is being made available under the BSD
2 * License, included below. This software may be subject to other third party
3 * and contributor rights, including patent rights, and no such rights are
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 */
[2]33
34
[5]35
[2]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
51TAppEncTop::TAppEncTop()
52{
[5]53#if HHI_VSO
[2]54  m_iLastFramePutInERViewBuffer = -1;
[5]55#endif
[2]56}
57
58TAppEncTop::~TAppEncTop()
59{
60}
61
62
63Void 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
[5]113#if HHI_VSO
[2]114    //====== VSO =========
115    m_acTEncTopList[iViewIdx]->setForceLambdaScaleVSO          ( false );
116    m_acTEncTopList[iViewIdx]->setLambdaScaleVSO               ( 1     );
117    m_acTEncTopList[iViewIdx]->setVSOMode                      ( 0     );
[5]118#endif
[2]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
[5]143#if HHI_VSO
[2]144    m_acTEncTopList[iViewIdx]->setUseVSO                       ( false ); //GT: might be enabled later for VSO Mode 4
[5]145#endif
[2]146
[50]147#if BITSTREAM_EXTRACTION
148    m_acTEncTopList[iViewIdx]->setLayerId                      ( ( (UInt)iViewIdx ) << 1 );
149#endif
[2]150    m_acTEncTopList[iViewIdx]->setViewId                       ( (UInt)iViewIdx );
151    m_acTEncTopList[iViewIdx]->setViewOrderIdx                 ( m_cCameraData.getViewOrderIndex()[ iViewIdx ] );
152    m_acTEncTopList[iViewIdx]->setIsDepth                      ( false );
153    m_acTEncTopList[iViewIdx]->setCamParPrecision              ( m_cCameraData.getCamParsCodedPrecision  () );
154    m_acTEncTopList[iViewIdx]->setCamParInSliceHeader          ( m_cCameraData.getVaryingCameraParameters() );
155    m_acTEncTopList[iViewIdx]->setCodedScale                   ( m_cCameraData.getCodedScale             () );
156    m_acTEncTopList[iViewIdx]->setCodedOffset                  ( m_cCameraData.getCodedOffset            () );
[5]157#if DEPTH_MAP_GENERATION
[2]158    m_acTEncTopList[iViewIdx]->setPredDepthMapGeneration       ( m_uiPredDepthMapGeneration );
[5]159    m_acTEncTopList[iViewIdx]->setPdmPrecision                 ( (UInt)m_cCameraData.getPdmPrecision     () );
160    m_acTEncTopList[iViewIdx]->setPdmScaleNomDelta             (       m_cCameraData.getPdmScaleNomDelta () );
161    m_acTEncTopList[iViewIdx]->setPdmOffset                    (       m_cCameraData.getPdmOffset        () );
162#endif
163#if HHI_INTER_VIEW_MOTION_PRED
[2]164    m_acTEncTopList[iViewIdx]->setMultiviewMvPredMode          ( m_uiMultiviewMvPredMode );
165    m_acTEncTopList[iViewIdx]->setMultiviewMvRegMode           ( iViewIdx ? m_uiMultiviewMvRegMode       : 0   );
166    m_acTEncTopList[iViewIdx]->setMultiviewMvRegLambdaScale    ( iViewIdx ? m_dMultiviewMvRegLambdaScale : 0.0 );
[5]167#endif
168#if HHI_INTER_VIEW_RESIDUAL_PRED
[2]169    m_acTEncTopList[iViewIdx]->setMultiviewResPredMode         ( m_uiMultiviewResPredMode );
[5]170#endif
[2]171
[5]172
173#if HHI_INTERVIEW_SKIP
[2]174    m_acTEncTopList[iViewIdx]->setInterViewSkip            ( iViewIdx ? m_uiInterViewSkip : 0 );
[5]175#if HHI_INTERVIEW_SKIP_LAMBDA_SCALE
176    m_acTEncTopList[iViewIdx]->setInterViewSkipLambdaScale ( iViewIdx ? (Int)m_dInterViewSkipLambdaScale : 1 );
[2]177#endif
178#endif
179    m_acTEncTopList[iViewIdx]->setUseMRG                       ( m_bUseMRG      ); // SOPH:
180
181#if LM_CHROMA
182    m_acTEncTopList[iViewIdx]->setUseLMChroma                  ( m_bUseLMChroma );
183#endif
184
185#if HHI_RMP_SWITCH
186    m_acTEncTopList[iViewIdx]->setUseRMP                     ( m_bUseRMP );
187#endif
188#ifdef ROUNDING_CONTROL_BIPRED
189    m_acTEncTopList[iViewIdx]->setUseRoundingControlBipred(m_useRoundingControlBipred);
190#endif
[5]191#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
192    m_acTEncTopList[iViewIdx]->setUseDMM( false );
[2]193#endif
194#if CONSTRAINED_INTRA_PRED
195    m_acTEncTopList[iViewIdx]->setUseConstrainedIntraPred      ( m_bUseConstrainedIntraPred );
196#endif
197#ifdef WEIGHT_PRED
198    //====== Weighted Prediction ========
199    m_acTEncTopList[iViewIdx]->setUseWP                         ( m_bUseWeightPred      );
200    m_acTEncTopList[iViewIdx]->setWPBiPredIdc                   ( m_uiBiPredIdc         );
201#endif
202    //====== Slice ========
203    m_acTEncTopList[iViewIdx]->setSliceMode               ( m_iSliceMode                );
204    m_acTEncTopList[iViewIdx]->setSliceArgument           ( m_iSliceArgument            );
205
206    //====== Entropy Slice ========
207    m_acTEncTopList[iViewIdx]->setEntropySliceMode        ( m_iEntropySliceMode         );
208    m_acTEncTopList[iViewIdx]->setEntropySliceArgument    ( m_iEntropySliceArgument     );
209#if MTK_NONCROSS_INLOOP_FILTER
210    if(m_iSliceMode == 0 )
211    {
212      m_bLFCrossSliceBoundaryFlag = true;
213    }
214    m_acTEncTopList[iViewIdx]->setLFCrossSliceBoundaryFlag( m_bLFCrossSliceBoundaryFlag );
215#endif
216#if MTK_SAO
217    m_acTEncTopList[iViewIdx]->setUseSAO               ( m_abUseSAO[0]     );
218#endif
[5]219#if HHI_MPI
[2]220    m_acTEncTopList[iViewIdx]->setUseMVI( false );
[5]221#endif
[2]222
223    m_acTEncTopList[iViewIdx]->setPictureDigestEnabled(m_pictureDigestEnabled);
224    m_acTEncTopList[iViewIdx]->setQpChangeFrame( m_iQpChangeFrame );
225    m_acTEncTopList[iViewIdx]->setQpChangeOffsetVideo( m_iQpChangeOffsetVideo );
226    m_acTEncTopList[iViewIdx]->setQpChangeOffsetDepth( m_iQpChangeOffsetDepth );
227  }
228  if( m_bUsingDepthMaps )
229  {
230
[5]231#if HHI_VSO
[2]232    for (Int iViewIdx=0; iViewIdx<m_iNumberOfExternalRefs; iViewIdx++)
233    {
234        m_acTVideoIOYuvERFileList.push_back(new TVideoIOYuv);
235    }
[5]236#endif
[2]237
238    for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++)
239    {
[34]240#if FLEX_CODING_ORDER
241      // Detect whether depth comes before than texture for this view
242      Bool isDepthFirst = false;
243      if ( m_b3DVFlexOrder )
244      {
245        for ( Int ii=1; ii<12; ii+=2 )
246        {
247          Int iViewIdxCfg = (Int)(m_pchMVCJointCodingOrder[ii]-'0');
248          if ( iViewIdxCfg == iViewIdx )
249          {
250            if ( m_pchMVCJointCodingOrder[ii-1]=='D' ) // depth comes first for this view
251            {
252              isDepthFirst = true;
253            }
254            else
255            {
256              assert(m_pchMVCJointCodingOrder[ii-1]=='T');
257            }
258            break;
259          }
260        }
261      }
262#endif
[2]263      m_iDepthFrameRcvdVector.push_back(0) ;
264      m_acTEncDepthTopList.push_back(new TEncTop);
265
266      m_acTVideoIOYuvDepthInputFileList.push_back(new TVideoIOYuv);
267
268      m_acTVideoIOYuvDepthReconFileList.push_back(new TVideoIOYuv);
269      m_cListPicYuvDepthRecList.push_back(new TComList<TComPicYuv*>) ;
270      m_aiNextDepthPocToDump.push_back( 0 );
271      m_cListPicYuvDepthRecMap.push_back( std::map<PicOrderCnt,TComPicYuv*>() );
272      m_acTEncDepthTopList[iViewIdx]->setFrameRate                    ( m_iFrameRate );
273      m_acTEncDepthTopList[iViewIdx]->setFrameSkip                    ( m_FrameSkip );
274      m_acTEncDepthTopList[iViewIdx]->setSourceWidth                  ( m_iSourceWidth );
275      m_acTEncDepthTopList[iViewIdx]->setSourceHeight                 ( m_iSourceHeight );
276      m_acTEncDepthTopList[iViewIdx]->setFrameToBeEncoded             ( m_iFrameToBeEncoded );
277
278      //====== Coding Structure ========
279#if DCM_DECODING_REFRESH
280      m_acTEncDepthTopList[iViewIdx]->setDecodingRefreshType          ( m_iDecodingRefreshType );
281#endif
282      m_acTEncDepthTopList[iViewIdx]->setCPSSize                      ( m_uiCodedPictureStoreSize );
283      m_acTEncDepthTopList[iViewIdx]->setGOPSize                      ( m_iGOPSize );
284      m_acTEncDepthTopList[iViewIdx]->setRateGOPSize                  ( m_iRateGOPSize );
285
286      m_acTEncDepthTopList[iViewIdx]->setSeqStructure                              ( m_cInputFormatString );
287
288      m_acTEncDepthTopList[iViewIdx]->setQP                           ( m_aiQP[1] );
289
290      m_acTEncDepthTopList[iViewIdx]->setTemporalLayerQPOffset        ( m_aiTLayerQPOffset );
291      m_acTEncDepthTopList[iViewIdx]->setPad                          ( m_aiPad );
292
293      //===== Slice ========
294
295      //====== Entropy Coding ========
296      m_acTEncDepthTopList[iViewIdx]->setSymbolMode                   ( m_iSymbolMode );
297
298      //====== Loop/Deblock Filter ========
299      m_acTEncDepthTopList[iViewIdx]->setLoopFilterDisable            ( m_abLoopFilterDisable[1]   );
300      m_acTEncDepthTopList[iViewIdx]->setLoopFilterAlphaC0Offset      ( m_iLoopFilterAlphaC0Offset );
301      m_acTEncDepthTopList[iViewIdx]->setLoopFilterBetaOffset         ( m_iLoopFilterBetaOffset    );
302
303      //====== Motion search ========
304      m_acTEncDepthTopList[iViewIdx]->setFastSearch                   ( m_iFastSearch  );
305      m_acTEncDepthTopList[iViewIdx]->setSearchRange                  ( m_iSearchRange );
306      m_acTEncDepthTopList[iViewIdx]->setBipredSearchRange            ( m_bipredSearchRange );
307      m_acTEncDepthTopList[iViewIdx]->setMaxDeltaQP                   ( m_iMaxDeltaQP  );
308
309      //====== Tool list ========
310      m_acTEncDepthTopList[iViewIdx]->setUseSBACRD                    ( m_bUseSBACRD   );
311      m_acTEncDepthTopList[iViewIdx]->setDeltaQpRD                    ( m_uiDeltaQpRD  );
312      m_acTEncDepthTopList[iViewIdx]->setUseASR                       ( m_bUseASR      );
313      m_acTEncDepthTopList[iViewIdx]->setUseHADME                     ( m_bUseHADME    );
314      m_acTEncDepthTopList[iViewIdx]->setUseALF                       ( m_abUseALF[1]  );
315#if MQT_ALF_NPASS
316      m_acTEncDepthTopList[iViewIdx]->setALFEncodePassReduction       ( m_iALFEncodePassReduction );
317#endif
318#if DCM_COMB_LIST
319      m_acTEncDepthTopList[iViewIdx]->setUseLComb                     ( m_bUseLComb    );
320      m_acTEncDepthTopList[iViewIdx]->setLCMod                        ( m_bLCMod         );
321#endif
322      m_acTEncDepthTopList[iViewIdx]->setdQPs                         ( m_aidQP        );
323      m_acTEncDepthTopList[iViewIdx]->setUseRDOQ                      ( m_abUseRDOQ[1] );
324      m_acTEncDepthTopList[iViewIdx]->setUseLDC                       ( m_bUseLDC      );
325      m_acTEncDepthTopList[iViewIdx]->setUsePAD                       ( m_bUsePAD      );
326      m_acTEncDepthTopList[iViewIdx]->setQuadtreeTULog2MaxSize        ( m_uiQuadtreeTULog2MaxSize );
327      m_acTEncDepthTopList[iViewIdx]->setQuadtreeTULog2MinSize        ( m_uiQuadtreeTULog2MinSize );
328      m_acTEncDepthTopList[iViewIdx]->setQuadtreeTUMaxDepthInter      ( m_uiQuadtreeTUMaxDepthInter );
329      m_acTEncDepthTopList[iViewIdx]->setQuadtreeTUMaxDepthIntra      ( m_uiQuadtreeTUMaxDepthIntra );
330      m_acTEncDepthTopList[iViewIdx]->setUseFastEnc                   ( m_bUseFastEnc  );
331
[5]332#if HHI_VSO
[2]333      m_acTEncDepthTopList[iViewIdx]->setUseVSO                       ( m_bUseVSO      ); //GT: might be enabled/disabled later for VSO Mode 4
334      m_acTEncDepthTopList[iViewIdx]->setForceLambdaScaleVSO          ( m_bForceLambdaScaleVSO );
335      m_acTEncDepthTopList[iViewIdx]->setLambdaScaleVSO               ( m_dLambdaScaleVSO );
[5]336#if HHI_VSO_DIST_INT
[2]337      m_acTEncDepthTopList[iViewIdx]->setAllowNegDist                 ( m_bAllowNegDist );
338#endif
339      m_acTEncDepthTopList[iViewIdx]->setVSOMode                      ( m_uiVSOMode );
[5]340#endif
[2]341
[50]342#if BITSTREAM_EXTRACTION
343      m_acTEncDepthTopList[iViewIdx]->setLayerId                      ( ( ( (UInt)iViewIdx ) << 1 ) + 1 );
344#endif
[2]345      m_acTEncDepthTopList[iViewIdx]->setViewId                       ( (UInt)iViewIdx );
346      m_acTEncDepthTopList[iViewIdx]->setViewOrderIdx                 ( m_cCameraData.getViewOrderIndex()[ iViewIdx ] );
347      m_acTEncDepthTopList[iViewIdx]->setIsDepth                      ( true );
348      m_acTEncDepthTopList[iViewIdx]->setCamParPrecision              ( 0 );
349      m_acTEncDepthTopList[iViewIdx]->setCamParInSliceHeader          ( false );
350      m_acTEncDepthTopList[iViewIdx]->setCodedScale                   ( 0 );
351      m_acTEncDepthTopList[iViewIdx]->setCodedOffset                  ( 0 );
[5]352#if DEPTH_MAP_GENERATION
[2]353      m_acTEncDepthTopList[iViewIdx]->setPredDepthMapGeneration       ( 0 );
[5]354#endif
355#if HHI_INTER_VIEW_MOTION_PRED
[2]356      m_acTEncDepthTopList[iViewIdx]->setMultiviewMvPredMode          ( 0 );
357      m_acTEncDepthTopList[iViewIdx]->setMultiviewMvRegMode           ( 0 );
358      m_acTEncDepthTopList[iViewIdx]->setMultiviewMvRegLambdaScale    ( 0.0 );
[5]359#endif
360#if HHI_INTER_VIEW_RESIDUAL_PRED
[2]361      m_acTEncDepthTopList[iViewIdx]->setMultiviewResPredMode         ( 0 );
[5]362#endif
[2]363
[5]364#if HHI_INTERVIEW_SKIP
[2]365      m_acTEncDepthTopList[iViewIdx]->setInterViewSkip            ( 0 );
[5]366#if HHI_INTERVIEW_SKIP_LAMBDA_SCALE
[2]367      m_acTEncDepthTopList[iViewIdx]->setInterViewSkipLambdaScale ( 1 );
368#endif
369#endif
370      m_acTEncDepthTopList[iViewIdx]->setUseMRG                       ( m_bUseMRG      ); // SOPH:
371
372#if LM_CHROMA
373      m_acTEncDepthTopList[iViewIdx]->setUseLMChroma                  ( m_bUseLMChroma );
374#endif
375
376#if HHI_RMP_SWITCH
377      m_acTEncDepthTopList[iViewIdx]->setUseRMP                     ( m_bUseRMP );
378#endif
379#ifdef ROUNDING_CONTROL_BIPRED
380      m_acTEncDepthTopList[iViewIdx]->setUseRoundingControlBipred(m_useRoundingControlBipred);
381#endif
[5]382#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
383      m_acTEncDepthTopList[iViewIdx]->setUseDMM( m_bUseDMM );
[2]384#endif
[34]385#if FLEX_CODING_ORDER && HHI_DMM_PRED_TEX
386      m_acTEncDepthTopList[iViewIdx]->setUseDMM34( (m_b3DVFlexOrder && isDepthFirst) ? false : m_bUseDMM );
387#endif
[2]388#if CONSTRAINED_INTRA_PRED
389      m_acTEncDepthTopList[iViewIdx]->setUseConstrainedIntraPred      ( m_bUseConstrainedIntraPred );
390#endif
391#ifdef WEIGHT_PRED
392    //====== Weighted Prediction ========
393      m_acTEncDepthTopList[iViewIdx]->setUseWP                         ( m_bUseWeightPred      );
394      m_acTEncDepthTopList[iViewIdx]->setWPBiPredIdc                   ( m_uiBiPredIdc         );
395#endif
396      //====== Slice ========
397      m_acTEncDepthTopList[iViewIdx]->setSliceMode               ( m_iSliceMode                );
398      m_acTEncDepthTopList[iViewIdx]->setSliceArgument           ( m_iSliceArgument            );
399
400      //====== Entropy Slice ========
401      m_acTEncDepthTopList[iViewIdx]->setEntropySliceMode        ( m_iEntropySliceMode         );
402      m_acTEncDepthTopList[iViewIdx]->setEntropySliceArgument    ( m_iEntropySliceArgument     );
403#if MTK_NONCROSS_INLOOP_FILTER
404      if(m_iSliceMode == 0 )
405      {
406        m_bLFCrossSliceBoundaryFlag = true;
407      }
408      m_acTEncDepthTopList[iViewIdx]->setLFCrossSliceBoundaryFlag( m_bLFCrossSliceBoundaryFlag );
409#endif
410#if MTK_SAO
411      m_acTEncDepthTopList[iViewIdx]->setUseSAO               ( m_abUseSAO[1]     );
412#endif
[5]413#if HHI_MPI
[34]414#if FLEX_CODING_ORDER
415      m_acTEncDepthTopList[iViewIdx]->setUseMVI( (m_b3DVFlexOrder && isDepthFirst) ? false : m_bUseMVI );
416#else
[2]417      m_acTEncDepthTopList[iViewIdx]->setUseMVI( m_bUseMVI );
[5]418#endif
[34]419#endif
420     
[2]421      m_acTEncDepthTopList[iViewIdx]->setPictureDigestEnabled(m_pictureDigestEnabled);
422
423      m_acTEncDepthTopList[iViewIdx]->setQpChangeFrame( m_iQpChangeFrame );
424      m_acTEncDepthTopList[iViewIdx]->setQpChangeOffsetVideo( m_iQpChangeOffsetVideo );
425      m_acTEncDepthTopList[iViewIdx]->setQpChangeOffsetDepth( m_iQpChangeOffsetDepth );
426    }
427  }
[5]428#if HHI_INTER_VIEW_MOTION_PRED
[2]429  else if( m_uiMultiviewMvRegMode )
430  {
431    for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++)
432    {
433      m_acTVideoIOYuvDepthInputFileList.push_back( new TVideoIOYuv );
434    }
435  }
[5]436#endif
[2]437
[5]438#if HHI_VSO
[2]439  if ( m_bUseVSO )
440  {
441    if ( m_uiVSOMode == 4 )
[5]442    {
[2]443      m_cRendererModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, m_iSourceHeight, LOG2_DISP_PREC_LUT, 0 );
444
445      for ( Int iViewNum = 0; iViewNum < m_iNumberOfViews; iViewNum++ )
446      {
447        for (Int iContent = 0; iContent < 2; iContent++ )
448        {
[5]449          Int iNumOfModels   = m_cRenModStrParser.getNumOfModelsForView(iViewNum, iContent);
450          Bool bUseVSO = (iNumOfModels != 0);
[2]451
[5]452          TEncTop* pcEncTop = ( iContent == 0 ) ? m_acTEncTopList[iViewNum] : m_acTEncDepthTopList[iViewNum];
453          pcEncTop->setUseVSO( bUseVSO );
454          pcEncTop->getRdCost()->setRenModel( bUseVSO ? &m_cRendererModel : NULL );
455
[2]456          for (Int iCurModel = 0; iCurModel < iNumOfModels; iCurModel++ )
457          {
[5]458            Int iModelNum; Int iLeftViewNum; Int iRightViewNum; Int iDump; Int iOrgRefNum; Int iBlendMode;
[2]459
[5]460            m_cRenModStrParser.getSingleModelData  ( iViewNum, iContent, iCurModel, iModelNum, iBlendMode, iLeftViewNum, iRightViewNum, iOrgRefNum, iDump ) ;
461            m_cRendererModel  .createSingleModel   ( iViewNum, iContent, iModelNum, iLeftViewNum, iRightViewNum, (iOrgRefNum != -1), iBlendMode );
[2]462          }
463        }
464      }
465    }
466    else
467    {
468      m_cRendererTop.init(m_iSourceWidth, m_iSourceHeight,true,0,0,true, 0,0,0,0,0,0,0,1,0,0 );  //GT: simplest configuration
469    }
[5]470  }
471#endif
[2]472
[5]473#if HHI_INTERVIEW_SKIP
474  m_cUsedPelsRenderer.init(m_iSourceWidth, m_iSourceHeight, true, 0, LOG2_DISP_PREC_LUT, true, 0, 0, 0, 0, 0, 6, 4, 1, 0, 6 );
475#endif
[2]476}
477
478Void TAppEncTop::xCreateLib()
479{
480  // Video I/O
481  m_cTVideoIOBitsFile.openBits( m_pchBitstreamFile, true  );  // write mode
482
483  for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++)
484  {
485    m_acTVideoIOYuvInputFileList[iViewIdx]->open( m_pchInputFileList[iViewIdx],     false, m_uiInputBitDepth, m_uiInternalBitDepth );  // read  mode
486    m_acTVideoIOYuvInputFileList[iViewIdx]->skipFrames(m_FrameSkip, m_iSourceWidth, m_iSourceHeight);
487    m_acTVideoIOYuvReconFileList[iViewIdx]->open( m_pchReconFileList[iViewIdx],     true, m_uiOutputBitDepth, m_uiInternalBitDepth);  // write mode
488
489    // Neo Decoder
490    m_acTEncTopList[iViewIdx]->create();
491
492    if( m_bUsingDepthMaps )
493    {
494      m_acTVideoIOYuvDepthInputFileList[iViewIdx]->open( m_pchDepthInputFileList[iViewIdx],     false, m_uiInputBitDepth, m_uiInternalBitDepth );  // read  mode
495      m_acTVideoIOYuvDepthInputFileList[iViewIdx]->skipFrames(m_FrameSkip, m_iSourceWidth, m_iSourceHeight);
496
497      m_acTVideoIOYuvDepthReconFileList[iViewIdx]->open( m_pchDepthReconFileList[iViewIdx],     true, m_uiOutputBitDepth, m_uiInternalBitDepth);  // write mode
498
499      // Neo Decoder
500      m_acTEncDepthTopList[iViewIdx]->create();
501    }
[5]502#if HHI_INTER_VIEW_MOTION_PRED
[2]503    else if( m_uiMultiviewMvRegMode )
504    {
505      m_acTVideoIOYuvDepthInputFileList[iViewIdx]->open( m_pchDepthInputFileList[iViewIdx],     false, m_uiInputBitDepth, m_uiInternalBitDepth );  // read  mode
506      m_acTVideoIOYuvDepthInputFileList[iViewIdx]->skipFrames(m_FrameSkip, m_iSourceWidth, m_iSourceHeight);
507    }
[5]508#endif
[2]509  }
510
[5]511#if HHI_VSO
[2]512  for(Int iViewIdx=0; iViewIdx < m_iNumberOfExternalRefs; iViewIdx++)
513  {
514    m_acTVideoIOYuvERFileList[iViewIdx]->open( m_pchERRefFileList[iViewIdx], false, m_uiInputBitDepth, m_uiInternalBitDepth ); // read mode
515  }
[5]516#endif
[2]517}
518
519Void TAppEncTop::xDestroyLib()
520{
521
522  m_cTVideoIOBitsFile.closeBits();
523
[5]524#if HHI_VSO
[2]525  for ( Int iViewIdx = 0; iViewIdx < m_iNumberOfExternalRefs; iViewIdx++ )
526  {
527    m_acTVideoIOYuvERFileList[iViewIdx]->close();
528    delete m_acTVideoIOYuvERFileList[iViewIdx];
529    m_acTVideoIOYuvERFileList[iViewIdx] = 0;
530  };
[5]531#endif
[2]532
533  for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++)
534  {
535    m_acTVideoIOYuvInputFileList[iViewIdx]->close();
536    m_acTVideoIOYuvReconFileList[iViewIdx]->close();
537
538    delete m_acTVideoIOYuvInputFileList[iViewIdx] ; m_acTVideoIOYuvInputFileList[iViewIdx] = NULL;
539    delete m_acTVideoIOYuvReconFileList[iViewIdx] ; m_acTVideoIOYuvReconFileList[iViewIdx] = NULL;
540
541    delete m_cListPicYuvRecList[iViewIdx] ; m_cListPicYuvRecList[iViewIdx] = NULL;
542
543    m_acTEncTopList[iViewIdx]->destroy();
544    delete m_acTEncTopList[iViewIdx] ; m_acTEncTopList[iViewIdx] = NULL;
545
546    if( iViewIdx < Int( m_acTVideoIOYuvDepthInputFileList.size() ) && m_acTVideoIOYuvDepthInputFileList[iViewIdx] )
547    {
548      m_acTVideoIOYuvDepthInputFileList[iViewIdx]->close( );
549      delete m_acTVideoIOYuvDepthInputFileList[iViewIdx] ;
550    }
551    if( iViewIdx < Int( m_acTVideoIOYuvDepthReconFileList.size() ) && m_acTVideoIOYuvDepthReconFileList[iViewIdx] )
552    {
553      m_acTVideoIOYuvDepthReconFileList[iViewIdx]->close () ;
554      delete m_acTVideoIOYuvDepthReconFileList[iViewIdx];
555    }
556    if( iViewIdx < Int( m_acTEncDepthTopList.size() ) && m_acTEncDepthTopList[iViewIdx] )
557    {
558      m_acTEncDepthTopList[iViewIdx]->destroy();
559      delete m_acTEncDepthTopList[iViewIdx];
560    }
561    if( iViewIdx < Int( m_cListPicYuvDepthRecList.size() ) && m_cListPicYuvDepthRecList[iViewIdx] )
562    {
563      delete m_cListPicYuvDepthRecList[iViewIdx ];
564    }
565  }
566}
567
568Void TAppEncTop::xInitLib()
569{
570  for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++)
571  {
572    m_acTEncTopList[iViewIdx]->init( this );
573  }
574  for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++)
575  {
576    m_acTEncTopList[iViewIdx]->setTEncTopList( &m_acTEncTopList  );
577  }
578  if ( m_bUsingDepthMaps )
579  {
580    for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++)
581    {
582      m_acTEncDepthTopList[iViewIdx]->init( this );
583    }
584    for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++)
585    {
586      m_acTEncDepthTopList[iViewIdx]->setTEncTopList( &m_acTEncDepthTopList  );
587    }
588  }
589}
590
591// ====================================================================================================================
592// Public member functions
593// ====================================================================================================================
594
595/**
596 - create internal class
597 - initialize internal variable
598 - until the end of input YUV file, call encoding function in TEncTop class
599 - delete allocated buffers
600 - destroy internal class
601 .
602 */
603//GT PRE LOAD ENC BUFFER
604Void TAppEncTop::encode()
605{
606  TComPicYuv*       pcPicYuvOrg      = new TComPicYuv;
607  TComPicYuv*       pcDepthPicYuvOrg = new TComPicYuv;
608  TComPicYuv*       pcPdmDepthOrg    = new TComPicYuv;
609  TComPicYuv*       pcPicYuvRec      = NULL;
610  //TComPicYuv*       pcDepthPicYuvRec = NULL;
611
612  // initialize internal class & member variables
613  xInitLibCfg();
614  xCreateLib();
615  xInitLib();
616
617  // main encoder loop
618
619  //GT: setup and init Bools for Eos and Continue Reading
620  Bool  bAllEos = false;
[21]621  Bool  bAllContinueReadingPics = false;
[2]622  std::vector<Bool>  bEos ;
623  std::vector<Bool>  bContinueReadingPics ;
624
625  Bool  bAllDepthEos = false;
[21]626  Bool  bAllContinueReadingDepthPics = false;
[2]627  std::vector<Bool>  bDepthEos ;
628  std::vector<Bool>  bContinueReadingDepthPics ;
629  for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++ )
630  {
631    bEos.push_back( false ) ;
632    bContinueReadingPics.push_back( true );
633    if( m_bUsingDepthMaps)
634    {
635      bDepthEos.push_back( false ) ;
636      bContinueReadingDepthPics.push_back( true ) ;
637    }
638  }
639  // allocate original YUV buffer
640  pcPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
641  if( m_bUsingDepthMaps)
642  {
643    pcDepthPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
644  }
[5]645#if HHI_INTER_VIEW_MOTION_PRED
[2]646  if( m_uiMultiviewMvRegMode )
647  {
648    pcPdmDepthOrg->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
649  }
[5]650#endif
[2]651
652  TComBitstream*    pcBitstream = new TComBitstream;
653  pcBitstream->create( (m_iSourceWidth * m_iSourceHeight * 3) >> 1 ) ; //GT: is size reasonable ??
654
655  while ( !(bAllEos&& bAllContinueReadingPics) )
656  {
657    bAllContinueReadingPics = false;
658    bAllContinueReadingDepthPics = false;
659
660    //GT: Read all Buffers
661    for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++ ) //GT; store frames first
662    {
663      if (!bEos[iViewIdx] && bContinueReadingPics[iViewIdx] ) //GT: read frames to buffer
664      {
665        // get buffers
666        xGetBuffer( pcPicYuvRec, iViewIdx, m_cListPicYuvRecList ); // ringbuffer of size gopsize -> m_cListPicYuvRec, m_cListBitstream
667        // read input YUV file
668        m_acTVideoIOYuvInputFileList[iViewIdx]->read( pcPicYuvOrg, m_aiPad  ) ;
669        bEos[iViewIdx] = ( m_acTVideoIOYuvInputFileList[iViewIdx]->isEof() == 1 ?   true : false  );             //GT: End of File
670        bEos[iViewIdx] = ( m_iFrameRcvdVector[iViewIdx] == (m_iFrameToBeEncoded - 1) ?    true : bEos[iViewIdx]   );   //GT: FramesToBeEncoded Reached
671        bAllEos = bAllEos|bEos[iViewIdx] ;
672
[5]673#if HHI_INTER_VIEW_MOTION_PRED
[2]674        if( m_uiMultiviewMvRegMode && iViewIdx )
675        {
676          m_acTVideoIOYuvDepthInputFileList[iViewIdx]->read( pcPdmDepthOrg, m_aiPad, m_bUsingDepthMaps );
677        }
[5]678#endif
[2]679
680        // increase number of received frames
681        m_iFrameRcvdVector[iViewIdx]++ ;
682      }
683
[5]684#if HHI_INTER_VIEW_MOTION_PRED
[2]685      m_acTEncTopList[iViewIdx]->receivePic( bEos[iViewIdx],  pcPicYuvOrg, m_cListPicYuvRecList[iViewIdx]->back(), ( m_uiMultiviewMvRegMode && iViewIdx ? pcPdmDepthOrg : 0 ) );
[5]686#else
687      m_acTEncTopList[iViewIdx]->receivePic( bEos[iViewIdx],  pcPicYuvOrg, m_cListPicYuvRecList[iViewIdx]->back(), 0 );
688#endif
[2]689
690      if( m_bUsingDepthMaps )
691      {
692        if (!bDepthEos[iViewIdx] && bContinueReadingDepthPics[iViewIdx] )
693        {
694          // get buffers
695          xGetBuffer( pcPicYuvRec, iViewIdx, m_cListPicYuvDepthRecList ); // ringbuffer of size gopsize -> m_cListPicYuvRec, m_cListBitstream
696          // read input YUV file
697          m_acTVideoIOYuvDepthInputFileList[iViewIdx]->read( pcDepthPicYuvOrg, m_aiPad  ) ;
698          bDepthEos[iViewIdx] = ( m_acTVideoIOYuvDepthInputFileList[iViewIdx]->isEof() == 1 ?   true : false  );
699          bDepthEos[iViewIdx] = ( m_iDepthFrameRcvdVector[iViewIdx] == (m_iFrameToBeEncoded - 1) ?    true : bDepthEos[iViewIdx]   );
700          bAllDepthEos = bAllDepthEos|bDepthEos[iViewIdx] ;
701          // increase number of received frames
702          m_iDepthFrameRcvdVector[iViewIdx]++ ;
703        }
704        m_acTEncDepthTopList[iViewIdx]->receivePic( bDepthEos[iViewIdx],  pcDepthPicYuvOrg, m_cListPicYuvDepthRecList[iViewIdx]->back() );
705      }
706    }
707
708    //===== store current POC =====
709    Bool  bCurrPocCoded = m_acTEncTopList[ 0 ]->currentPocWillBeCoded();
710    Int   iCurrPoc      = m_acTEncTopList[ 0 ]->getNextFrameId();
711
712    //===== update camera parameters =====
713    if( bCurrPocCoded )
714    {
715      m_cCameraData.update( (UInt)iCurrPoc );
716    }
717
[5]718#if HHI_VSO   
[2]719    if ( m_bUseVSO && ( m_uiVSOMode != 4) )
720    {
721      //GT: Read external reference pics or render references
722      xStoreVSORefPicsInBuffer();       //GT;
723    }
[5]724#endif
[2]725
[34]726#if FLEX_CODING_ORDER
727    if (m_b3DVFlexOrder)
728    {
729      Int i=0;
730      Int iViewIdx = 0;
731      bool bThisViewContinueReadingPics = false;
732      bool bThisViewContinueReadingDepthPics = false;
733      Int iNumberofDepthViews = m_bUsingDepthMaps?m_iNumberOfViews:0;
734      for(Int j=0; j < (m_iNumberOfViews+ iNumberofDepthViews); j++ )     // Start encoding
735      {
736        if (m_pchMVCJointCodingOrder[i]=='T')
737        {
738          i++;
739          assert(isdigit(m_pchMVCJointCodingOrder[i]));
740          iViewIdx = (Int)(m_pchMVCJointCodingOrder[i]-'0');
741          bThisViewContinueReadingPics = bContinueReadingPics[iViewIdx];
742          m_acTEncTopList[iViewIdx]->encode( bEos[iViewIdx], m_cListPicYuvRecMap[iViewIdx], pcBitstream, bThisViewContinueReadingPics );
743          bContinueReadingPics[iViewIdx]=bThisViewContinueReadingPics;
744          bAllContinueReadingPics = bAllContinueReadingPics||bContinueReadingPics[iViewIdx];
745
746          if(pcBitstream->getNumberOfWrittenBits()!=0)
747          {
748            m_cTVideoIOBitsFile.writeBits( pcBitstream );
749          }
750          pcBitstream->resetBits(); //GT: also done later in ....
751          pcBitstream->rewindStreamPacket( );
752          // write bistream to file if necessary
753          xWriteOutput( iViewIdx ); //GT: Write Reconfiles (when gop is complete?)
754          i++;
755        }
756        else if ( m_pchMVCJointCodingOrder[i] == 'D')
757        {
758          i++;
759          if( m_bUsingDepthMaps )
760          {
761            assert(isdigit(m_pchMVCJointCodingOrder[i]));
762            iViewIdx = (Int)(m_pchMVCJointCodingOrder[i]-'0');
763            bThisViewContinueReadingDepthPics = bContinueReadingDepthPics[iViewIdx];
764            m_acTEncDepthTopList[iViewIdx]->encode( bDepthEos[iViewIdx], m_cListPicYuvDepthRecMap[iViewIdx], pcBitstream, bThisViewContinueReadingDepthPics );
765            bContinueReadingDepthPics[iViewIdx]=bThisViewContinueReadingDepthPics;
766
767            bAllContinueReadingDepthPics = bAllContinueReadingDepthPics||bContinueReadingDepthPics[iViewIdx];
768            if(pcBitstream->getNumberOfWrittenBits()!=0)
769            {
770              m_cTVideoIOBitsFile.writeBits( pcBitstream );
771            }
772            pcBitstream->resetBits();
773            pcBitstream->rewindStreamPacket( );
774            // write bistream to file if necessary
775            xWriteOutput( iViewIdx, true );
776            i++;
777          }
778        }
779      }
780    }
781    else
782    {
783#endif
[2]784    //GT: Encode
785    for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++ )     // Start encoding
786    {
787      bool bThisViewContinueReadingPics = bContinueReadingPics[iViewIdx];
788      m_acTEncTopList[iViewIdx]->encode( bEos[iViewIdx], m_cListPicYuvRecMap[iViewIdx], pcBitstream, bThisViewContinueReadingPics );
789      bContinueReadingPics[iViewIdx]=bThisViewContinueReadingPics;
790      bAllContinueReadingPics = bAllContinueReadingPics||bContinueReadingPics[iViewIdx];
791
792      if(pcBitstream->getNumberOfWrittenBits()!=0)
793      {
794        m_cTVideoIOBitsFile.writeBits( pcBitstream );
795      }
796      pcBitstream->resetBits(); //GT: also done later in ....
797      pcBitstream->rewindStreamPacket( );
798      // write bistream to file if necessary
799      xWriteOutput( iViewIdx ); //GT: Write Reconfiles (when gop is complete?)
800
801      if( m_bUsingDepthMaps )
802      {
803        bool bThisViewContinueReadingDepthPics = bContinueReadingDepthPics[iViewIdx];
804        m_acTEncDepthTopList[iViewIdx]->encode( bDepthEos[iViewIdx], m_cListPicYuvDepthRecMap[iViewIdx], pcBitstream, bThisViewContinueReadingDepthPics );
805        bContinueReadingDepthPics[iViewIdx]=bThisViewContinueReadingDepthPics;
806
807        bAllContinueReadingDepthPics = bAllContinueReadingDepthPics||bContinueReadingDepthPics[iViewIdx];
808        if(pcBitstream->getNumberOfWrittenBits()!=0)
809        {
810          m_cTVideoIOBitsFile.writeBits( pcBitstream );
811        }
812        pcBitstream->resetBits();
813        pcBitstream->rewindStreamPacket( );
814        // write bistream to file if necessary
815        xWriteOutput( iViewIdx, true );
816      }
817    }
[34]818#if FLEX_CODING_ORDER
819        }
820#endif
[2]821    // delete extra picture buffers
822    if( bCurrPocCoded )
823    {
824      for( Int iViewIdx = 0; iViewIdx < m_iNumberOfViews; iViewIdx++ )
825      {
826        if( iViewIdx < (Int)m_acTEncTopList.size() && m_acTEncTopList[iViewIdx] )
827        {
828          m_acTEncTopList[iViewIdx]->deleteExtraPicBuffers( iCurrPoc );
829        }
830        if( iViewIdx < (Int)m_acTEncDepthTopList.size() && m_acTEncDepthTopList[iViewIdx] )
831        {
832          m_acTEncDepthTopList[iViewIdx]->deleteExtraPicBuffers( iCurrPoc );
833        }
834      }
835    }
836
837#if AMVP_BUFFERCOMPRESS
[5]838    // compress motion for entire access
[2]839    if( bCurrPocCoded )
840    {
841      for( Int iViewIdx = 0; iViewIdx < m_iNumberOfViews; iViewIdx++ )
842      {
843        if( iViewIdx < (Int)m_acTEncTopList.size() && m_acTEncTopList[iViewIdx] )
844        {
845          m_acTEncTopList[iViewIdx]->compressMotion( iCurrPoc );
846        }
847        if( iViewIdx < (Int)m_acTEncDepthTopList.size() && m_acTEncDepthTopList[iViewIdx] )
848        {
849          m_acTEncDepthTopList[iViewIdx]->compressMotion( iCurrPoc );
850        }
851      }
852    }
853#endif
854  }
855
856  // write output
857  for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++ )
858  {
859    m_acTEncTopList[iViewIdx]->printOutSummary(m_acTEncTopList[iViewIdx]->getNumAllPicCoded());
860    if ( m_bUsingDepthMaps )
861    {
862      m_acTEncDepthTopList[iViewIdx]->printOutSummary(m_acTEncDepthTopList[iViewIdx]->getNumAllPicCoded());
863    }
864  }
865
866  // delete original YUV buffer
867  pcPicYuvOrg->destroy();
868  delete pcPicYuvOrg;
869  pcPicYuvOrg = NULL;
870
871  // valgrind
872  if( m_bUsingDepthMaps)
873  {
874    pcDepthPicYuvOrg->destroy();
875  }
876  delete pcDepthPicYuvOrg ;
877  pcDepthPicYuvOrg = NULL ;
878
879  pcBitstream->destroy();
880  delete pcBitstream;
881  pcBitstream = NULL ;
882
883
884  // delete used buffers in encoder class
885  for(Int iViewIdx =0; iViewIdx < m_iNumberOfViews; iViewIdx++)
886  {
887    m_acTEncTopList[iViewIdx]->deletePicBuffer() ;
888  }
889
890  if( m_bUsingDepthMaps)
891  {
892    for(Int iViewIdx =0; iViewIdx < m_iNumberOfViews; iViewIdx++)
893    {
894      m_acTEncDepthTopList[iViewIdx]->deletePicBuffer() ;
895    }
896  }
897
898  if ( pcPdmDepthOrg )
899  {
[5]900    pcPdmDepthOrg->destroy();
901    delete pcPdmDepthOrg;
902    pcPdmDepthOrg = NULL;
[2]903  }
904
905  // delete buffers & classes
906  xDeleteBuffer();
907  xDestroyLib();
908}
909
910// ====================================================================================================================
911// Protected member functions
912// ====================================================================================================================
913
914/**
915 - application has picture buffer list with size of GOP
916 - picture buffer list acts as ring buffer
917 - end of the list has the latest picture
918 .
919 */
920Void TAppEncTop::xGetBuffer( TComPicYuv*& rpcPicYuvRec, Int iViewIdx, std::vector< TComList<TComPicYuv*>*>& racBuffer )
921{
922  if ( m_uiCodedPictureStoreSize   == 0 )
923    {
924      if (racBuffer[iViewIdx]->size() == 0)
925      {
926        rpcPicYuvRec = new TComPicYuv;
927        rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
928
929        racBuffer[iViewIdx]->pushBack( rpcPicYuvRec );
930      }
931      rpcPicYuvRec = racBuffer[iViewIdx]->popFront(); //GT why? only one in list ?? A: only to get rpcPicYuvRec
932      racBuffer[iViewIdx]->pushBack( rpcPicYuvRec );
933      return;
934    }
935
936    // org. buffer
937  if ( racBuffer[iViewIdx]->size() == (UInt)m_uiCodedPictureStoreSize )
938    {
939      rpcPicYuvRec = racBuffer[iViewIdx]->popFront();
940    }
941    else
942    {
943      rpcPicYuvRec = new TComPicYuv;
944      rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
945    }
946    racBuffer[iViewIdx]->pushBack( rpcPicYuvRec );
947}
948
949Void TAppEncTop::xDeleteBuffer( )
950{
951  TComList<TComBitstream*>::iterator iterBitstream = m_cListBitstream.begin();
952
953  Int iSize = Int( m_cListBitstream.size() );
954
955  for ( Int i = 0; i < iSize; i++ )
956  {
957    TComBitstream* pcBitstream = *(iterBitstream++);
958
959    pcBitstream->destroy();
960
961    delete pcBitstream; pcBitstream = NULL;
962  }
963
964  for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++)
965  {
966    TComList<TComPicYuv*>::iterator iterPicYuvRec  = m_cListPicYuvRecList[iViewIdx]->begin();
967
968    iSize = Int( m_cListPicYuvRecList[iViewIdx]->size() );
969
970    for ( Int i = 0; i < iSize; i++ )
971    {
972        TComPicYuv*  pcPicYuvRec  = *(iterPicYuvRec++);
973        pcPicYuvRec->destroy();
974        delete pcPicYuvRec; pcPicYuvRec = NULL;
975    }
976  }
977  if( m_bUsingDepthMaps)
978  {
979    for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++)
980    {
981      TComList<TComPicYuv*>::iterator iterPicYuvRec  = m_cListPicYuvDepthRecList[iViewIdx]->begin();
982
983      iSize = Int( m_cListPicYuvDepthRecList[iViewIdx]->size() );
984
985      for ( Int i = 0; i < iSize; i++ )
986      {
987          TComPicYuv*  pcPicYuvRec  = *(iterPicYuvRec++);
988          pcPicYuvRec->destroy();
989          delete pcPicYuvRec; pcPicYuvRec = NULL;
990      }
991    }
992  }
993
994  // Delete ERFiles
995
[5]996#if HHI_VSO
[2]997  std::map< Int,vector<TComPicYuv*> >::iterator iterMapPicExtRefView = m_cMapPicExtRefView.begin();
998  while ( iterMapPicExtRefView != m_cMapPicExtRefView.end() )
999  {
1000    for ( UInt uiViewNumber = 0; uiViewNumber < iterMapPicExtRefView->second.size(); uiViewNumber++ )
1001    {
1002      if ( iterMapPicExtRefView->second[uiViewNumber] )
1003      {
1004        iterMapPicExtRefView->second[uiViewNumber]->destroy();
1005        delete iterMapPicExtRefView->second[uiViewNumber];
1006      }
1007    }
1008    iterMapPicExtRefView++;
1009  }
[5]1010#endif
[2]1011}
1012
1013/** \param iNumEncoded  number of encoded frames
1014 */
1015Void TAppEncTop::xWriteOutput( Int iViewIdx, Bool isDepth )
1016{
1017  std::map<PicOrderCnt, TComPicYuv*> &rcMap = ( isDepth ? m_cListPicYuvDepthRecMap          : m_cListPicYuvRecMap          )[iViewIdx];
1018  PicOrderCnt  &riNextPocToDump             = ( isDepth ? m_aiNextDepthPocToDump            : m_aiNextPocToDump            )[iViewIdx];
1019  TVideoIOYuv* &rpcTVideoIOYuvReconFile     = ( isDepth ? m_acTVideoIOYuvDepthReconFileList : m_acTVideoIOYuvReconFileList )[iViewIdx];
1020  std::map<PicOrderCnt, TComPicYuv*>::iterator i;
1021
1022  while( ! rcMap.empty() && ( i = rcMap.begin() )->first == riNextPocToDump )
1023  {
1024    riNextPocToDump++;
1025    rpcTVideoIOYuvReconFile->write( i->second, m_aiPad );
1026    rcMap.erase( i );
1027  }
1028}
1029
1030// GT FIX
1031std::vector<TComPic*> TAppEncTop::getSpatialRefPics( Int iViewIdx, Int iPoc, Bool bIsDepthCoder )
1032{
1033  std::vector<TComPic*> apcRefPics( iViewIdx, (TComPic*)NULL );
1034  for( int iRefViewIdx = 0; iRefViewIdx < iViewIdx; iRefViewIdx++ )
1035  {
1036// GT FIX
1037    TComPic* pcRefPic = xGetPicFromView(iRefViewIdx, iPoc, bIsDepthCoder);
1038
1039    assert( pcRefPic != NULL );
1040    apcRefPics[iRefViewIdx] = pcRefPic;
1041  }
1042  return apcRefPics;
1043}
1044
1045
1046TComPic* TAppEncTop::xGetPicFromView( Int iViewIdx, Int iPoc, bool bDepth )
1047{
1048  assert( ( iViewIdx >= 0) && ( iViewIdx < m_iNumberOfViews ) );
1049
1050  TComPic* pcPic = 0;
1051  TComList<TComPic*>* apcListPic;
1052
1053  apcListPic = (bDepth ?  m_acTEncDepthTopList[iViewIdx] : m_acTEncTopList[iViewIdx])->getListPic() ;
1054
1055  for(TComList<TComPic*>::iterator it=apcListPic->begin(); it!=apcListPic->end(); it++)
1056  {
1057    if( (*it)->getPOC() == iPoc )
1058    {
1059      pcPic = *it ;
1060      break ;
1061    }
1062  }
1063
1064  return pcPic;
1065};
1066
1067TComPicYuv* TAppEncTop::xGetPicYuvFromView( Int iViewIdx, Int iPoc, Bool bDepth, Bool bRecon )
1068{
[5]1069  TComPic*    pcPic = xGetPicFromView( iViewIdx, iPoc, bDepth);
1070  TComPicYuv* pcPicYuv = NULL;
[2]1071
1072  if (pcPic != NULL)
1073  {
1074    if( bRecon )
1075    {
1076      if ( pcPic->getReconMark() )
1077      {
[5]1078        pcPicYuv = pcPic->getPicYuvRec();
[2]1079      }
1080    }
1081    else
1082    {
[5]1083      pcPicYuv = pcPic->getPicYuvOrg();
1084    }
[2]1085  };
1086
[5]1087  return pcPicYuv;
1088};
[2]1089
[5]1090#if HHI_VSO
[2]1091Void TAppEncTop::xSetBasePicYuv( Int iViewIdx, Int iPoc, TComMVDRefData* pcRefInfo, InterViewReference eView, bool bDepth )
1092{
1093
1094  if ( ( iViewIdx < 0) || ( iViewIdx >= m_iNumberOfViews ) )
1095    return;
1096
1097  if ( !m_bUsingDepthMaps && bDepth )
1098    return;
1099
1100  TComPic* pcPic = xGetPicFromView( iViewIdx, iPoc, bDepth);
1101
1102  if (pcPic == 0)
1103    return;
1104
1105  pcRefInfo->setPicYuvBaseView(eView, bDepth, pcPic->getPicYuvOrg(),  pcPic->getReconMark() ? pcPic->getPicYuvRec() : NULL );
1106
1107};
1108
1109Void TAppEncTop::setMVDPic( Int iViewIdx, Int iPoc, TComMVDRefData* pcMVDRefData )
1110{
1111  AOF( iViewIdx >= 0);
1112  AOF( iViewIdx <  m_iNumberOfViews  );
1113
1114  xSetBasePicYuv(iViewIdx - 1, iPoc, pcMVDRefData, PREVVIEW, false);
1115  xSetBasePicYuv(iViewIdx    , iPoc, pcMVDRefData, CURRVIEW, false );
1116  xSetBasePicYuv(iViewIdx + 1, iPoc, pcMVDRefData, NEXTVIEW, false );
1117
1118  if ( m_bUsingDepthMaps )
1119  {
1120    xSetBasePicYuv(iViewIdx - 1, iPoc, pcMVDRefData, PREVVIEW, true );
1121    xSetBasePicYuv(iViewIdx    , iPoc, pcMVDRefData, CURRVIEW, true );
1122    xSetBasePicYuv(iViewIdx + 1, iPoc, pcMVDRefData, NEXTVIEW, true );
1123  }
1124
[5]1125
[2]1126  xSetBaseLUT       (iViewIdx, iViewIdx-1  , pcMVDRefData, PREVVIEW );
1127  xSetBaseLUT       (iViewIdx, iViewIdx+1  , pcMVDRefData, NEXTVIEW );
1128
[5]1129
[2]1130  if ( m_bUseVSO && m_uiVSOMode != 4)
1131  {
1132    xSetERPicYuvs               (iViewIdx, iPoc, pcMVDRefData);
1133    pcMVDRefData->setShiftLUTsERView(m_cCameraData.getSynthViewShiftLUTD()[iViewIdx],  m_cCameraData.getSynthViewShiftLUTI()[iViewIdx] );
1134    pcMVDRefData->setRefViewInd     (m_aaiBaseViewRefInd[iViewIdx], m_aaiERViewRefInd[iViewIdx], m_aaiERViewRefLutInd[iViewIdx]);
1135  }
1136};
1137
[5]1138
[2]1139Void TAppEncTop::xSetBaseLUT( Int iViewIdxSource, Int iViewIdxTarget, TComMVDRefData* pcRefInfo, InterViewReference eView )
1140{
1141  if ( ( iViewIdxSource < 0) || ( iViewIdxSource >= m_iNumberOfViews )||( iViewIdxTarget < 0) || ( iViewIdxTarget >= m_iNumberOfViews ) )
1142    return;
1143  assert( abs( iViewIdxTarget - iViewIdxSource ) <= 1 );  //GT; Not supported yet
1144  pcRefInfo->setShiftLUTsBaseView(eView, m_cCameraData.getBaseViewShiftLUTD()[iViewIdxSource][iViewIdxTarget],m_cCameraData.getBaseViewShiftLUTI()[iViewIdxSource][iViewIdxTarget] );
1145};
1146
1147Void TAppEncTop::xSetERPicYuvs( Int iViewIdx, Int iPoc, TComMVDRefData* pcReferenceInfo )
1148{
1149  std::vector<TComPicYuv*> apcExtRefViews;
1150
1151  std::map< Int, vector<TComPicYuv*> >::iterator cMapIt;
1152  cMapIt = m_cMapPicExtRefView.find(iPoc);
1153
1154  assert(  cMapIt != m_cMapPicExtRefView.end() );
1155
1156  pcReferenceInfo->setPicYuvERViews( cMapIt->second );
1157}
1158
1159Void TAppEncTop::xStoreVSORefPicsInBuffer()
1160{
1161  // X-Check if all Encoders have received the same number of pics
1162  Int iNumRcvd = m_iFrameRcvdVector[0];
1163  for ( UInt uiViewNumber = 0; uiViewNumber < m_iNumberOfViews; uiViewNumber ++ )
1164  {
1165    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!!
1166  };
1167
1168  Int iCurPoc = iNumRcvd - 1;
1169
1170  if ( iCurPoc <= m_iLastFramePutInERViewBuffer )
1171  {
1172    return;
1173  }
1174
1175  std::vector<TComPicYuv*> apcExtRefViewVec;
1176
1177  Int iNumberOfReferenceViews = 0;
1178  if (m_iNumberOfExternalRefs != 0)
1179  {
1180    m_aaiERViewRefLutInd = m_aaiERViewRefInd;
1181    // Insert Rendered Views form File
1182
1183    iNumberOfReferenceViews = m_iNumberOfExternalRefs;
1184
1185    for ( UInt uiViewNumber = 0; uiViewNumber < iNumberOfReferenceViews; uiViewNumber++ )
1186    {
1187      TComPicYuv* pcPicYuvERView = new TComPicYuv;
1188      pcPicYuvERView->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
1189
1190      m_acTVideoIOYuvERFileList[uiViewNumber]->read( pcPicYuvERView, m_aiPad  ) ;
1191
1192      apcExtRefViewVec.push_back( pcPicYuvERView );
1193    }
1194  }
1195  else
1196  { //Render Views
1197
1198    for ( UInt uiViewNumber = 0; uiViewNumber < m_iNumberOfViews; uiViewNumber++ )
1199    {
1200      m_aaiERViewRefInd   [uiViewNumber].clear();
1201      m_aaiERViewRefLutInd[uiViewNumber].clear();
1202    }
1203
1204    iNumberOfReferenceViews = 0;
1205    for ( UInt iSynthViewIdx = 0; iSynthViewIdx < m_cCameraData.getSynthViewNumbers().size(); iSynthViewIdx++ )
1206    {
1207      // Get Left and right view
1208      Int  iLeftViewIdx  = -1;
1209      Int  iRightViewIdx = -1;
1210      Bool bIsBaseView;
1211
1212      Int iRelDistToLeft;
1213      m_cCameraData.getLeftRightBaseView( iSynthViewIdx, iLeftViewIdx, iRightViewIdx, iRelDistToLeft, bIsBaseView );
1214
1215      if  ((iLeftViewIdx == -1) || (iRightViewIdx == -1))
1216      {
1217        std::cerr << "Left or right View not given." << endl;
1218        exit(EXIT_FAILURE);
1219      }
1220
1221      m_cRendererTop.setShiftLUTs(
1222        m_cCameraData.getSynthViewShiftLUTD()[iLeftViewIdx] [iSynthViewIdx],
1223        m_cCameraData.getSynthViewShiftLUTI()[iLeftViewIdx] [iSynthViewIdx],
1224        m_cCameraData.getBaseViewShiftLUTI ()[iLeftViewIdx] [iRightViewIdx],
1225        m_cCameraData.getSynthViewShiftLUTD()[iRightViewIdx][iSynthViewIdx],
1226        m_cCameraData.getSynthViewShiftLUTI()[iRightViewIdx][iSynthViewIdx],
1227        m_cCameraData.getBaseViewShiftLUTI ()[iRightViewIdx][iLeftViewIdx],
1228        iRelDistToLeft
1229      );
1230      if ( bIsBaseView ) continue;
1231
1232      // Render from left
1233      TComPicYuv* pcPicYuvERView = new TComPicYuv;
1234      pcPicYuvERView->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
1235      m_cRendererTop.extrapolateView( xGetPicFromView( iLeftViewIdx, iCurPoc, false )->getPicYuvOrg(), xGetPicFromView( iLeftViewIdx, iCurPoc, true )->getPicYuvOrg(), pcPicYuvERView, true );
1236
1237      apcExtRefViewVec.push_back( pcPicYuvERView );
1238
1239      m_aaiERViewRefInd   [ iLeftViewIdx].push_back( iNumberOfReferenceViews );
1240      m_aaiERViewRefLutInd[ iLeftViewIdx].push_back( iSynthViewIdx );
1241      iNumberOfReferenceViews++;
1242
1243      //Render from right
1244      pcPicYuvERView = new TComPicYuv;
1245      pcPicYuvERView->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
1246
1247      m_cRendererTop.extrapolateView( xGetPicFromView( iRightViewIdx, iCurPoc, false )->getPicYuvOrg(), xGetPicFromView( iRightViewIdx, iCurPoc, true )->getPicYuvOrg(), pcPicYuvERView, false );
1248      apcExtRefViewVec.push_back( pcPicYuvERView );
1249
1250      m_aaiERViewRefInd   [ iRightViewIdx].push_back( iNumberOfReferenceViews );
1251      m_aaiERViewRefLutInd[ iRightViewIdx].push_back( iSynthViewIdx );
1252      iNumberOfReferenceViews++;
1253    }
1254  }
1255
1256  m_iLastFramePutInERViewBuffer++;
1257  m_cMapPicExtRefView.insert( std::make_pair( m_iLastFramePutInERViewBuffer, apcExtRefViewVec ) );
1258
1259  if ( m_cMapPicExtRefView.size() >  (UInt)m_iGOPSize + 1 )
1260  {
1261    for ( UInt uiViewNumber = 0; uiViewNumber < (UInt) m_cMapPicExtRefView.begin()->second.size(); uiViewNumber++ )
1262    {
1263      if ( m_cMapPicExtRefView.begin()->second[uiViewNumber] )
1264      {
1265        m_cMapPicExtRefView.begin()->second[uiViewNumber]->destroy();
1266        delete m_cMapPicExtRefView.begin()->second[uiViewNumber];
1267      }
1268    }
1269    m_cMapPicExtRefView.erase ( m_cMapPicExtRefView.begin() );
1270  }
1271}
[5]1272#endif
[2]1273
[5]1274#if HHI_INTERVIEW_SKIP
[2]1275Void TAppEncTop::getUsedPelsMap( Int iViewIdx, Int iPoc, TComPicYuv* pcPicYuvUsedSplsMap )
1276{
[5]1277  AOT( iViewIdx <= 0);
1278  AOT( iViewIdx >= m_iNumberOfViews );
1279  AOF( m_uiInterViewSkip != 0 );
1280  AOF( m_cCameraData.getCurFrameId() == iPoc );
[2]1281
[5]1282  Int iViewSIdx      = m_cCameraData.getBaseId2SortedId()[iViewIdx];
1283  Int iFirstViewSIdx = m_cCameraData.getBaseId2SortedId()[0];
[2]1284
1285  AOT( iViewSIdx == iFirstViewSIdx );
1286
[5]1287  Bool bFirstIsLeft = (iFirstViewSIdx < iViewSIdx);
[2]1288
1289    m_cUsedPelsRenderer.setShiftLUTs(
1290      m_cCameraData.getBaseViewShiftLUTD()[0][iViewIdx],
1291      m_cCameraData.getBaseViewShiftLUTI()[0][iViewIdx],
1292      m_cCameraData.getBaseViewShiftLUTI()[0][iViewIdx],
1293      m_cCameraData.getBaseViewShiftLUTD()[0][iViewIdx],
1294      m_cCameraData.getBaseViewShiftLUTI()[0][iViewIdx],
1295      m_cCameraData.getBaseViewShiftLUTI()[0][iViewIdx],
1296      -1
[5]1297      );
[2]1298
[5]1299
[2]1300  TComPicYuv* pcPicYuvDepth = xGetPicYuvFromView(0, iPoc, true, true );
[5]1301  AOF( pcPicYuvDepth);
[2]1302
[5]1303  m_cUsedPelsRenderer.getUsedSamplesMap( pcPicYuvDepth, pcPicYuvUsedSplsMap, bFirstIsLeft );
[2]1304
1305}
[5]1306#endif
[2]1307
[5]1308#if HHI_VSO
[2]1309Void TAppEncTop::setupRenModel( Int iPoc, Int iEncViewIdx, Int iEncContent )
1310{
[5]1311  Int iEncViewSIdx = m_cCameraData.getBaseId2SortedId()[ iEncViewIdx ];
[2]1312
1313  // setup base views
[5]1314  Int iNumOfBV = m_cRenModStrParser.getNumOfBaseViewsForView( iEncViewSIdx, iEncContent );
[2]1315
1316  for (Int iCurView = 0; iCurView < iNumOfBV; iCurView++ )
[5]1317  {
1318    Int iBaseViewSIdx;
1319    Int iVideoDistMode;
1320    Int iDepthDistMode;
[2]1321
[5]1322    m_cRenModStrParser.getBaseViewData( iEncViewSIdx, iEncContent, iCurView, iBaseViewSIdx, iVideoDistMode, iDepthDistMode );
[2]1323
[5]1324    AOT( iVideoDistMode < 0 || iVideoDistMode > 2 );
[2]1325
[5]1326    Int iBaseViewIdx = m_cCameraData.getBaseSortedId2Id()[ iBaseViewSIdx ];
[2]1327
[5]1328    TComPicYuv* pcPicYuvVideoRec  = xGetPicYuvFromView( iBaseViewIdx, iPoc, false, true  );
1329    TComPicYuv* pcPicYuvDepthRec  = xGetPicYuvFromView( iBaseViewIdx, iPoc, true , true  );
1330    TComPicYuv* pcPicYuvVideoOrg  = xGetPicYuvFromView( iBaseViewIdx, iPoc, false, false );
1331    TComPicYuv* pcPicYuvDepthOrg  = xGetPicYuvFromView( iBaseViewIdx, iPoc, true , false );
[2]1332
[5]1333    TComPicYuv* pcPicYuvVideoRef  = ( iVideoDistMode == 2 ) ? pcPicYuvVideoOrg  : NULL;
1334    TComPicYuv* pcPicYuvDepthRef  = ( iDepthDistMode == 2 ) ? pcPicYuvDepthOrg  : NULL;
[2]1335
[5]1336    TComPicYuv* pcPicYuvVideoTest = ( iVideoDistMode == 0 ) ? pcPicYuvVideoOrg  : pcPicYuvVideoRec;
1337    TComPicYuv* pcPicYuvDepthTest = ( iDepthDistMode == 0 ) ? pcPicYuvDepthOrg  : pcPicYuvDepthRec;
1338
1339    AOT( (iVideoDistMode == 2) != (pcPicYuvVideoRef != NULL) );
1340    AOT( (iDepthDistMode == 2) != (pcPicYuvDepthRef != NULL) );
1341    AOT( pcPicYuvDepthTest == NULL );
1342    AOT( pcPicYuvVideoTest == NULL );
1343
1344    m_cRendererModel.setBaseView( iBaseViewSIdx, pcPicYuvVideoTest, pcPicYuvDepthTest, pcPicYuvVideoRef, pcPicYuvDepthRef );
[2]1345  }
1346
[5]1347  m_cRendererModel.setErrorMode( iEncViewSIdx, iEncContent, 0 );
[2]1348  // setup virtual views
[5]1349  Int iNumOfSV  = m_cRenModStrParser.getNumOfModelsForView( iEncViewSIdx, iEncContent );
[2]1350  for (Int iCurView = 0; iCurView < iNumOfSV; iCurView++ )
[5]1351  {
1352    Int iOrgRefBaseViewSIdx;
1353    Int iLeftBaseViewSIdx;
1354    Int iRightBaseViewSIdx;
1355    Int iSynthViewRelNum;
1356    Int iModelNum;
1357    Int iBlendMode;
1358    m_cRenModStrParser.getSingleModelData(iEncViewSIdx, iEncContent, iCurView, iModelNum, iBlendMode,iLeftBaseViewSIdx, iRightBaseViewSIdx, iOrgRefBaseViewSIdx, iSynthViewRelNum );
[2]1359
[5]1360    Int iLeftBaseViewIdx    = -1;
1361    Int iRightBaseViewIdx   = -1;
[2]1362
[5]1363    TComPicYuv* pcPicYuvOrgRef  = NULL;
1364    Int**      ppiShiftLUTLeft  = NULL;
1365    Int**      ppiShiftLUTRight = NULL;
1366    Int**      ppiBaseShiftLUTLeft  = NULL;
1367    Int**      ppiBaseShiftLUTRight = NULL;
[2]1368
1369
[5]1370    Int        iDistToLeft      = -1;
[2]1371
[5]1372    Int iSynthViewIdx = m_cCameraData.synthRelNum2Idx( iSynthViewRelNum );
[2]1373
1374    if ( iLeftBaseViewSIdx != -1 )
1375    {
[5]1376      iLeftBaseViewIdx   = m_cCameraData.getBaseSortedId2Id()   [ iLeftBaseViewSIdx ];
[2]1377      ppiShiftLUTLeft    = m_cCameraData.getSynthViewShiftLUTI()[ iLeftBaseViewIdx  ][ iSynthViewIdx  ];
1378    }
1379
1380    if ( iRightBaseViewSIdx != -1 )
1381    {
[5]1382      iRightBaseViewIdx  = m_cCameraData.getBaseSortedId2Id()   [iRightBaseViewSIdx ];
[2]1383      ppiShiftLUTRight   = m_cCameraData.getSynthViewShiftLUTI()[ iRightBaseViewIdx ][ iSynthViewIdx ];
1384    }
1385
1386    if ( iRightBaseViewSIdx != -1 && iLeftBaseViewSIdx != -1 )
[5]1387    {
1388      iDistToLeft    = m_cCameraData.getRelDistLeft(  iSynthViewIdx , iLeftBaseViewIdx, iRightBaseViewIdx);
[2]1389      ppiBaseShiftLUTLeft  = m_cCameraData.getBaseViewShiftLUTI() [ iLeftBaseViewIdx  ][ iRightBaseViewIdx ];
1390      ppiBaseShiftLUTRight = m_cCameraData.getBaseViewShiftLUTI() [ iRightBaseViewIdx ][ iLeftBaseViewIdx  ];
1391
1392    }
1393
1394    if ( iOrgRefBaseViewSIdx != -1 )
1395    {
[5]1396      pcPicYuvOrgRef = xGetPicYuvFromView( m_cCameraData.getBaseSortedId2Id()[ iOrgRefBaseViewSIdx ] , iPoc, false, false );
1397      AOF ( pcPicYuvOrgRef );
1398    }
[2]1399
[5]1400    m_cRendererModel.setSingleModel( iModelNum, ppiShiftLUTLeft, ppiBaseShiftLUTLeft, ppiShiftLUTRight, ppiBaseShiftLUTRight, iDistToLeft, pcPicYuvOrgRef );
[2]1401  }
1402}
[5]1403#endif
[2]1404
Note: See TracBrowser for help on using the repository browser.