source: 3DVCSoftware/branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComPic.cpp @ 456

Last change on this file since 456 was 456, checked in by tech, 11 years ago

Fixed linux compiler warnings and changed some variable names to match styleguide.

  • Property svn:eol-style set to native
File size: 19.5 KB
Line 
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-2013, ITU/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 ITU/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/** \file     TComPic.cpp
35    \brief    picture class
36*/
37
38#include "TComPic.h"
39#include "SEI.h"
40
41//! \ingroup TLibCommon
42//! \{
43
44// ====================================================================================================================
45// Constructor / destructor / create / destroy
46// ====================================================================================================================
47
48TComPic::TComPic()
49: m_uiTLayer                              (0)
50, m_bUsedByCurr                           (false)
51, m_bIsLongTerm                           (false)
52, m_bIsUsedAsLongTerm                     (false)
53, m_apcPicSym                             (NULL)
54, m_pcPicYuvPred                          (NULL)
55, m_pcPicYuvResi                          (NULL)
56, m_bReconstructed                        (false)
57, m_bNeededForOutput                      (false)
58, m_uiCurrSliceIdx                        (0)
59, m_pSliceSUMap                           (NULL)
60, m_pbValidSlice                          (NULL)
61, m_sliceGranularityForNDBFilter          (0)
62, m_bIndependentSliceBoundaryForNDBFilter (false)
63, m_bIndependentTileBoundaryForNDBFilter  (false)
64, m_pNDBFilterYuvTmp                      (NULL)
65, m_bCheckLTMSB                           (false)
66#if H_MV
67, m_layerId                               (0)
68, m_viewId                                (0)
69#if H_3D
70, m_viewIndex                             (0)
71, m_isDepth                               (false)
72, m_aaiCodedScale                         (0)
73, m_aaiCodedOffset                        (0)
74#endif
75#endif
76{
77  m_apcPicYuv[0]      = NULL;
78  m_apcPicYuv[1]      = NULL;
79#if H_3D_NBDV
80  m_iNumDdvCandPics   = 0;
81  m_eRapRefList       = REF_PIC_LIST_0;
82  m_uiRapRefIdx       = 0;
83#endif
84}
85
86TComPic::~TComPic()
87{
88}
89
90Void TComPic::create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, Window &conformanceWindow, Window &defaultDisplayWindow,
91                      Int *numReorderPics, Bool bIsVirtual)
92
93{
94  m_apcPicSym     = new TComPicSym;  m_apcPicSym   ->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth );
95  if (!bIsVirtual)
96  {
97    m_apcPicYuv[0]  = new TComPicYuv;  m_apcPicYuv[0]->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth );
98  }
99  m_apcPicYuv[1]  = new TComPicYuv;  m_apcPicYuv[1]->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth );
100 
101  // there are no SEI messages associated with this picture initially
102  if (m_SEIs.size() > 0)
103  {
104    deleteSEIs (m_SEIs);
105  }
106  m_bUsedByCurr = false;
107
108  /* store conformance window parameters with picture */
109  m_conformanceWindow = conformanceWindow;
110 
111  /* store display window parameters with picture */
112  m_defaultDisplayWindow = defaultDisplayWindow;
113
114  /* store number of reorder pics with picture */
115  memcpy(m_numReorderPics, numReorderPics, MAX_TLAYER*sizeof(Int));
116
117  return;
118}
119
120Void TComPic::destroy()
121{
122  if (m_apcPicSym)
123  {
124    m_apcPicSym->destroy();
125    delete m_apcPicSym;
126    m_apcPicSym = NULL;
127  }
128 
129  if (m_apcPicYuv[0])
130  {
131    m_apcPicYuv[0]->destroy();
132    delete m_apcPicYuv[0];
133    m_apcPicYuv[0]  = NULL;
134  }
135 
136  if (m_apcPicYuv[1])
137  {
138    m_apcPicYuv[1]->destroy();
139    delete m_apcPicYuv[1];
140    m_apcPicYuv[1]  = NULL;
141  }
142 
143  deleteSEIs(m_SEIs);
144}
145
146Void TComPic::compressMotion()
147{
148  TComPicSym* pPicSym = getPicSym(); 
149  for ( UInt uiCUAddr = 0; uiCUAddr < pPicSym->getFrameHeightInCU()*pPicSym->getFrameWidthInCU(); uiCUAddr++ )
150  {
151    TComDataCU* pcCU = pPicSym->getCU(uiCUAddr);
152    pcCU->compressMV(); 
153  } 
154}
155
156/** Create non-deblocked filter information
157 * \param pSliceStartAddress array for storing slice start addresses
158 * \param numSlices number of slices in picture
159 * \param sliceGranularityDepth slice granularity
160 * \param bNDBFilterCrossSliceBoundary cross-slice-boundary in-loop filtering; true for "cross".
161 * \param numTiles number of tiles in picture
162 * \param bNDBFilterCrossTileBoundary cross-tile-boundary in-loop filtering; true for "cross".
163 */
164Void TComPic::createNonDBFilterInfo(std::vector<Int> sliceStartAddress, Int sliceGranularityDepth
165                                    ,std::vector<Bool>* LFCrossSliceBoundary
166                                    ,Int numTiles
167                                    ,Bool bNDBFilterCrossTileBoundary)
168{
169  UInt maxNumSUInLCU = getNumPartInCU();
170  UInt numLCUInPic   = getNumCUsInFrame();
171  UInt picWidth      = getSlice(0)->getSPS()->getPicWidthInLumaSamples();
172  UInt picHeight     = getSlice(0)->getSPS()->getPicHeightInLumaSamples();
173  Int  numLCUsInPicWidth = getFrameWidthInCU();
174  Int  numLCUsInPicHeight= getFrameHeightInCU();
175  UInt maxNumSUInLCUWidth = getNumPartInWidth();
176  UInt maxNumSUInLCUHeight= getNumPartInHeight();
177  Int  numSlices = (Int) sliceStartAddress.size() - 1;
178  m_bIndependentSliceBoundaryForNDBFilter = false;
179  if(numSlices > 1)
180  {
181    for(Int s=0; s< numSlices; s++)
182    {
183      if((*LFCrossSliceBoundary)[s] == false)
184      {
185        m_bIndependentSliceBoundaryForNDBFilter = true;
186      }
187    }
188  }
189  m_sliceGranularityForNDBFilter = sliceGranularityDepth;
190  m_bIndependentTileBoundaryForNDBFilter  = (bNDBFilterCrossTileBoundary)?(false) :((numTiles > 1)?(true):(false));
191
192  m_pbValidSlice = new Bool[numSlices];
193  for(Int s=0; s< numSlices; s++)
194  {
195    m_pbValidSlice[s] = true;
196  }
197  m_pSliceSUMap = new Int[maxNumSUInLCU * numLCUInPic];
198
199  //initialization
200  for(UInt i=0; i< (maxNumSUInLCU * numLCUInPic); i++ )
201  {
202    m_pSliceSUMap[i] = -1;
203  }
204  for( UInt CUAddr = 0; CUAddr < numLCUInPic ; CUAddr++ )
205  {
206    TComDataCU* pcCU = getCU( CUAddr );
207    pcCU->setSliceSUMap(m_pSliceSUMap + (CUAddr* maxNumSUInLCU)); 
208    pcCU->getNDBFilterBlocks()->clear();
209  }
210  m_vSliceCUDataLink.clear();
211
212  m_vSliceCUDataLink.resize(numSlices);
213
214  UInt startAddr, endAddr, firstCUInStartLCU, startLCU, endLCU, lastCUInEndLCU, uiAddr;
215  UInt LPelX, TPelY, LCUX, LCUY;
216  UInt currSU;
217  UInt startSU, endSU;
218
219  for(Int s=0; s< numSlices; s++)
220  {
221    //1st step: decide the real start address
222    startAddr = sliceStartAddress[s];
223    endAddr   = sliceStartAddress[s+1] -1;
224
225    startLCU            = startAddr / maxNumSUInLCU;
226    firstCUInStartLCU   = startAddr % maxNumSUInLCU;
227
228    endLCU              = endAddr   / maxNumSUInLCU;
229    lastCUInEndLCU      = endAddr   % maxNumSUInLCU;   
230
231    uiAddr = m_apcPicSym->getCUOrderMap(startLCU);
232
233    LCUX      = getCU(uiAddr)->getCUPelX();
234    LCUY      = getCU(uiAddr)->getCUPelY();
235    LPelX     = LCUX + g_auiRasterToPelX[ g_auiZscanToRaster[firstCUInStartLCU] ];
236    TPelY     = LCUY + g_auiRasterToPelY[ g_auiZscanToRaster[firstCUInStartLCU] ];
237    currSU    = firstCUInStartLCU;
238
239    Bool bMoveToNextLCU = false;
240    Bool bSliceInOneLCU = (startLCU == endLCU);
241
242    while(!( LPelX < picWidth ) || !( TPelY < picHeight ))
243    {
244      currSU ++;
245
246      if(bSliceInOneLCU)
247      {
248        if(currSU > lastCUInEndLCU)
249        {
250          m_pbValidSlice[s] = false;
251          break;
252        }
253      }
254
255      if(currSU >= maxNumSUInLCU )
256      {
257        bMoveToNextLCU = true;
258        break;
259      }
260
261      LPelX = LCUX + g_auiRasterToPelX[ g_auiZscanToRaster[currSU] ];
262      TPelY = LCUY + g_auiRasterToPelY[ g_auiZscanToRaster[currSU] ];
263
264    }
265
266
267    if(!m_pbValidSlice[s])
268    {
269      continue;
270    }
271
272    if(currSU != firstCUInStartLCU)
273    {
274      if(!bMoveToNextLCU)
275      {
276        firstCUInStartLCU = currSU;
277      }
278      else
279      {
280        startLCU++;
281        firstCUInStartLCU = 0;
282        assert( startLCU < getNumCUsInFrame());
283      }
284      assert(startLCU*maxNumSUInLCU + firstCUInStartLCU < endAddr);
285    }
286
287
288    //2nd step: assign NonDBFilterInfo to each processing block
289    for(UInt i= startLCU; i <= endLCU; i++)
290    {
291      startSU = (i == startLCU)?(firstCUInStartLCU):(0);
292      endSU   = (i == endLCU  )?(lastCUInEndLCU   ):(maxNumSUInLCU -1);
293
294      uiAddr = m_apcPicSym->getCUOrderMap(i);
295      Int iTileID= m_apcPicSym->getTileIdxMap(uiAddr);
296
297      TComDataCU* pcCU = getCU(uiAddr);
298      m_vSliceCUDataLink[s].push_back(pcCU);
299
300      createNonDBFilterInfoLCU(iTileID, s, pcCU, startSU, endSU, m_sliceGranularityForNDBFilter, picWidth, picHeight);
301    }
302  }
303
304  //step 3: border availability
305  for(Int s=0; s< numSlices; s++)
306  {
307    if(!m_pbValidSlice[s])
308    {
309      continue;
310    }
311
312    for(Int i=0; i< m_vSliceCUDataLink[s].size(); i++)
313    {
314      TComDataCU* pcCU = m_vSliceCUDataLink[s][i];
315      uiAddr = pcCU->getAddr();
316
317      if(pcCU->getPic()==0)
318      {
319        continue;
320      }
321      Int iTileID= m_apcPicSym->getTileIdxMap(uiAddr);
322      Bool bTopTileBoundary = false, bDownTileBoundary= false, bLeftTileBoundary= false, bRightTileBoundary= false;
323
324      if(m_bIndependentTileBoundaryForNDBFilter)
325      {
326        //left
327        if( uiAddr % numLCUsInPicWidth != 0)
328        {
329          bLeftTileBoundary = ( m_apcPicSym->getTileIdxMap(uiAddr -1) != iTileID )?true:false;
330        }
331        //right
332        if( (uiAddr % numLCUsInPicWidth) != (numLCUsInPicWidth -1) )
333        {
334          bRightTileBoundary = ( m_apcPicSym->getTileIdxMap(uiAddr +1) != iTileID)?true:false;
335        }
336        //top
337        if( uiAddr >= numLCUsInPicWidth)
338        {
339          bTopTileBoundary = (m_apcPicSym->getTileIdxMap(uiAddr - numLCUsInPicWidth) !=  iTileID )?true:false;
340        }
341        //down
342        if( uiAddr + numLCUsInPicWidth < numLCUInPic )
343        {
344          bDownTileBoundary = (m_apcPicSym->getTileIdxMap(uiAddr + numLCUsInPicWidth) != iTileID)?true:false;
345        }
346
347      }
348
349      pcCU->setNDBFilterBlockBorderAvailability(numLCUsInPicWidth, numLCUsInPicHeight, maxNumSUInLCUWidth, maxNumSUInLCUHeight,picWidth, picHeight
350        , *LFCrossSliceBoundary
351        ,bTopTileBoundary, bDownTileBoundary, bLeftTileBoundary, bRightTileBoundary
352        ,m_bIndependentTileBoundaryForNDBFilter);
353
354    }
355
356  }
357
358  if( m_bIndependentSliceBoundaryForNDBFilter || m_bIndependentTileBoundaryForNDBFilter)
359  {
360    m_pNDBFilterYuvTmp = new TComPicYuv();
361    m_pNDBFilterYuvTmp->create(picWidth, picHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth);
362  }
363
364}
365
366/** Create non-deblocked filter information for LCU
367 * \param tileID tile index
368 * \param sliceID slice index
369 * \param pcCU CU data pointer
370 * \param startSU start SU index in LCU
371 * \param endSU end SU index in LCU
372 * \param sliceGranularyDepth slice granularity
373 * \param picWidth picture width
374 * \param picHeight picture height
375 */
376Void TComPic::createNonDBFilterInfoLCU(Int tileID, Int sliceID, TComDataCU* pcCU, UInt startSU, UInt endSU, Int sliceGranularyDepth, UInt picWidth, UInt picHeight)
377{
378  UInt LCUX          = pcCU->getCUPelX();
379  UInt LCUY          = pcCU->getCUPelY();
380  Int* pCUSliceMap    = pcCU->getSliceSUMap();
381  UInt maxNumSUInLCU = getNumPartInCU();
382  UInt maxNumSUInSGU = maxNumSUInLCU >> (sliceGranularyDepth << 1);
383  UInt maxNumSUInLCUWidth = getNumPartInWidth();
384  UInt LPelX, TPelY;
385  UInt currSU;
386
387
388  //get the number of valid NBFilterBLock
389  currSU   = startSU;
390  while(currSU <= endSU)
391  {
392    LPelX = LCUX + g_auiRasterToPelX[ g_auiZscanToRaster[currSU] ];
393    TPelY = LCUY + g_auiRasterToPelY[ g_auiZscanToRaster[currSU] ];
394
395    while(!( LPelX < picWidth ) || !( TPelY < picHeight ))
396    {
397      currSU += maxNumSUInSGU;
398      if(currSU >= maxNumSUInLCU || currSU > endSU)
399      {
400        break;
401      }
402      LPelX = LCUX + g_auiRasterToPelX[ g_auiZscanToRaster[currSU] ];
403      TPelY = LCUY + g_auiRasterToPelY[ g_auiZscanToRaster[currSU] ];
404    }
405
406    if(currSU >= maxNumSUInLCU || currSU > endSU)
407    {
408      break;
409    }
410
411    NDBFBlockInfo NDBFBlock;
412
413    NDBFBlock.tileID  = tileID;
414    NDBFBlock.sliceID = sliceID;
415    NDBFBlock.posY    = TPelY;
416    NDBFBlock.posX    = LPelX;
417    NDBFBlock.startSU = currSU;
418
419    UInt uiLastValidSU  = currSU;
420    UInt uiIdx, uiLPelX_su, uiTPelY_su;
421    for(uiIdx = currSU; uiIdx < currSU + maxNumSUInSGU; uiIdx++)
422    {
423      if(uiIdx > endSU)
424      {
425        break;       
426      }
427      uiLPelX_su   = LCUX + g_auiRasterToPelX[ g_auiZscanToRaster[uiIdx] ];
428      uiTPelY_su   = LCUY + g_auiRasterToPelY[ g_auiZscanToRaster[uiIdx] ];
429      if( !(uiLPelX_su < picWidth ) || !( uiTPelY_su < picHeight ))
430      {
431        continue;
432      }
433      pCUSliceMap[uiIdx] = sliceID;
434      uiLastValidSU = uiIdx;
435    }
436    NDBFBlock.endSU = uiLastValidSU;
437
438    UInt rTLSU = g_auiZscanToRaster[ NDBFBlock.startSU ];
439    UInt rBRSU = g_auiZscanToRaster[ NDBFBlock.endSU   ];
440    NDBFBlock.widthSU  = (rBRSU % maxNumSUInLCUWidth) - (rTLSU % maxNumSUInLCUWidth)+ 1;
441    NDBFBlock.heightSU = (UInt)(rBRSU / maxNumSUInLCUWidth) - (UInt)(rTLSU / maxNumSUInLCUWidth)+ 1;
442    NDBFBlock.width    = NDBFBlock.widthSU  * getMinCUWidth();
443    NDBFBlock.height   = NDBFBlock.heightSU * getMinCUHeight();
444
445    pcCU->getNDBFilterBlocks()->push_back(NDBFBlock);
446
447    currSU += maxNumSUInSGU;
448  }
449
450}
451
452/** destroy non-deblocked filter information for LCU
453 */
454Void TComPic::destroyNonDBFilterInfo()
455{
456  if(m_pbValidSlice != NULL)
457  {
458    delete[] m_pbValidSlice;
459    m_pbValidSlice = NULL;
460  }
461
462  if(m_pSliceSUMap != NULL)
463  {
464    delete[] m_pSliceSUMap;
465    m_pSliceSUMap = NULL;
466  }
467  for( UInt CUAddr = 0; CUAddr < getNumCUsInFrame() ; CUAddr++ )
468  {
469    TComDataCU* pcCU = getCU( CUAddr );
470    pcCU->getNDBFilterBlocks()->clear();
471  }
472
473  if( m_bIndependentSliceBoundaryForNDBFilter || m_bIndependentTileBoundaryForNDBFilter)
474  {
475    m_pNDBFilterYuvTmp->destroy();
476    delete m_pNDBFilterYuvTmp;
477    m_pNDBFilterYuvTmp = NULL;
478  }
479
480}
481#if H_MV
482Void TComPic::print( Bool legend )
483{
484  if ( legend )
485    std::cout  << "LId"        << "\t" << "POC"   << "\t" << "Rec"          << "\t" << "Ref"                       << "\t" << "LT"            << std::endl;
486  else
487    std::cout  << getLayerId() << "\t" << getPOC()<< "\t" << getReconMark() << "\t" << getSlice(0)->isReferenced() << "\t" << getIsLongTerm() << std::endl;
488}
489
490TComPic* TComPicLists::getPic( Int layerIdInNuh, Int poc )
491{
492  TComPic* pcPic = NULL;
493  for(TComList<TComList<TComPic*>*>::iterator itL = m_lists.begin(); ( itL != m_lists.end() && pcPic == NULL ); itL++)
494  {   
495    for(TComList<TComPic*>::iterator itP=(*itL)->begin(); ( itP!=(*itL)->end() && pcPic == NULL ); itP++)
496    {
497      TComPic* currPic = (*itP); 
498      if ( ( currPic->getPOC() == poc ) && ( currPic->getLayerId() == layerIdInNuh ) )
499      {
500        pcPic = currPic ;     
501      }
502    }
503  }
504  return pcPic;
505}
506
507#if H_3D
508TComPic* TComPicLists::getPic( Int viewIndex, Bool depthFlag, Int poc )
509{
510  return getPic   ( m_vps->getLayerIdInNuh( viewIndex, depthFlag ), poc );
511}
512
513Void TComPicLists::print()
514{
515  Bool first = true;     
516  for(TComList<TComList<TComPic*>*>::iterator itL = m_lists.begin(); ( itL != m_lists.end() ); itL++)
517  {   
518    for(TComList<TComPic*>::iterator itP=(*itL)->begin(); ( itP!=(*itL)->end() ); itP++)
519    {
520      if ( first )
521      {
522        (*itP)->print( true );       
523        first = false; 
524      }
525      (*itP)->print( false );       
526    }
527  }
528}
529
530TComPicYuv* TComPicLists::getPicYuv( Int layerIdInNuh, Int poc, Bool reconFlag )
531{
532  TComPic*    pcPic = getPic( layerIdInNuh, poc );
533  TComPicYuv* pcPicYuv = NULL;
534
535  if (pcPic != NULL)
536  {
537    if( reconFlag )
538    {
539      if ( pcPic->getReconMark() )
540      {
541        pcPicYuv = pcPic->getPicYuvRec();
542      }
543    }
544    else
545    {
546      pcPicYuv = pcPic->getPicYuvOrg();
547    }
548  };
549
550  return pcPicYuv;
551}
552
553TComPicYuv* TComPicLists::getPicYuv( Int viewIndex, Bool depthFlag, Int poc, Bool recon )
554{ 
555  Int layerIdInNuh = m_vps->getLayerIdInNuh( viewIndex, depthFlag ); 
556  return getPicYuv( layerIdInNuh, poc, recon );
557}
558#endif // H_3D
559#endif // H_MV
560
561#if H_3D_NBDV
562Int TComPic::getDisCandRefPictures( Int iColPOC )
563{
564  UInt       uiTempLayerCurr = 7;
565  TComSlice* currSlice       = getSlice(getCurrSliceIdx());
566  UInt       numDdvCandPics  = 0;
567
568  if ( !currSlice->getEnableTMVPFlag() )
569    return numDdvCandPics;
570
571  numDdvCandPics += 1;
572
573  UInt pocCurr = currSlice->getPOC();
574  UInt pocDiff = 255;
575
576  for(UInt lpNr = 0; lpNr < (currSlice->isInterB() ? 2: 1); lpNr ++)
577  {
578    UInt x = lpNr ? currSlice->getColFromL0Flag() : 1 - currSlice->getColFromL0Flag();
579
580    for (UInt i = 0; i < currSlice->getNumRefIdx(RefPicList(x)); i++)
581    {
582      if(currSlice->getViewIndex() == currSlice->getRefPic((RefPicList)x, i)->getViewIndex() 
583        && (x == currSlice->getColFromL0Flag()||currSlice->getRefPOC((RefPicList)x, i)!= iColPOC) && numDdvCandPics!=2)
584      {
585        TComSlice* refSlice    = currSlice->getRefPic((RefPicList)x, i)->getSlice(getCurrSliceIdx());
586        Bool       bRAP        = (refSlice->getViewIndex() && refSlice->isIRAP())? 1: 0; 
587        UInt       uiTempLayer = currSlice->getRefPic((RefPicList)x, i)->getSlice(getCurrSliceIdx())->getTLayer(); 
588       
589        if( bRAP )
590        {
591          this->setRapRefIdx(i);
592          this->setRapRefList((RefPicList)x);
593          numDdvCandPics = 2;
594
595          return numDdvCandPics;
596        }
597        else if (uiTempLayerCurr > uiTempLayer) 
598        {
599           uiTempLayerCurr = uiTempLayer; 
600        }
601      }
602    }
603  }
604
605  UInt z   = -1; // GT: Added to make code compile needs to be checked!
606  UInt idx = 0;
607 
608  for(UInt lpNr = 0; lpNr < (currSlice->isInterB() ? 2: 1); lpNr ++)
609  {
610    UInt x = lpNr? currSlice->getColFromL0Flag() : 1-currSlice->getColFromL0Flag();
611   
612    for (UInt i = 0; i < currSlice->getNumRefIdx(RefPicList(x)); i++)
613    {
614      Int iTempPoc = currSlice->getRefPic((RefPicList)x, i)->getPOC();
615      Int iTempDiff = (iTempPoc > pocCurr) ? (iTempPoc - pocCurr): (pocCurr - iTempPoc);
616     
617      if(currSlice->getViewIndex() == currSlice->getRefPic((RefPicList)x, i)->getViewIndex() &&  (x == currSlice->getColFromL0Flag()||currSlice->getRefPOC((RefPicList)x, i)!= iColPOC) 
618        && currSlice->getRefPic((RefPicList)x, i)->getSlice(getCurrSliceIdx())->getTLayer() == uiTempLayerCurr && pocDiff > iTempDiff)
619      {
620        pocDiff = iTempDiff;
621        z       = x;
622        idx     = i;
623      }
624    }
625  }
626
627  if( pocDiff < 255 )
628  {
629    this->setRapRefIdx(idx);
630    this->setRapRefList((RefPicList) z );
631    numDdvCandPics = 2;
632  }
633
634  return numDdvCandPics;
635}
636#endif
637//! \}
Note: See TracBrowser for help on using the repository browser.