Changeset 494 in SHVCSoftware for trunk/source/Lib/TLibEncoder/TEncSlice.cpp


Ignore:
Timestamp:
16 Nov 2013, 22:09:25 (11 years ago)
Author:
seregin
Message:

reintegrate branch SHM-4.0-dev

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/source

  • trunk/source/Lib/TLibEncoder/TEncSlice.cpp

    r442 r494  
    22 * License, included below. This software may be subject to other third party
    33 * and contributor rights, including patent rights, and no such rights are
    4  * granted under this license. 
     4 * granted under this license.
    55 *
    66 * Copyright (c) 2010-2013, ITU/ISO/IEC
     
    5151  m_apcPicYuvPred = NULL;
    5252  m_apcPicYuvResi = NULL;
    53  
     53
    5454  m_pdRdPicLambda = NULL;
    5555  m_pdRdPicQp     = NULL;
     
    6969}
    7070
    71 Void TEncSlice::initCtxMem(  UInt i )               
    72 {   
     71Void TEncSlice::initCtxMem(  UInt i )
     72{
    7373  for (std::vector<TEncSbac*>::iterator j = CTXMem.begin(); j != CTXMem.end(); j++)
    7474  {
    7575    delete (*j);
    7676  }
    77   CTXMem.clear(); 
    78   CTXMem.resize(i); 
     77  CTXMem.clear();
     78  CTXMem.resize(i);
    7979}
    8080
     81#if AUXILIARY_PICTURES
     82Void TEncSlice::create( Int iWidth, Int iHeight, ChromaFormat chromaFormat, UInt iMaxCUWidth, UInt iMaxCUHeight, UChar uhTotalDepth )
     83{
     84  // create prediction picture
     85  if ( m_apcPicYuvPred == NULL )
     86  {
     87    m_apcPicYuvPred  = new TComPicYuv;
     88    m_apcPicYuvPred->create( iWidth, iHeight, chromaFormat, iMaxCUWidth, iMaxCUHeight, uhTotalDepth );
     89  }
     90
     91  // create residual picture
     92  if( m_apcPicYuvResi == NULL )
     93  {
     94    m_apcPicYuvResi  = new TComPicYuv;
     95    m_apcPicYuvResi->create( iWidth, iHeight, chromaFormat, iMaxCUWidth, iMaxCUHeight, uhTotalDepth );
     96  }
     97}
     98#else
    8199Void TEncSlice::create( Int iWidth, Int iHeight, UInt iMaxCUWidth, UInt iMaxCUHeight, UChar uhTotalDepth )
    82100{
     
    87105    m_apcPicYuvPred->create( iWidth, iHeight, iMaxCUWidth, iMaxCUHeight, uhTotalDepth );
    88106  }
    89  
     107
    90108  // create residual picture
    91109  if( m_apcPicYuvResi == NULL )
     
    95113  }
    96114}
     115#endif
    97116
    98117Void TEncSlice::destroy()
     
    105124    m_apcPicYuvPred  = NULL;
    106125  }
    107  
     126
    108127  // destroy residual picture
    109128  if ( m_apcPicYuvResi )
     
    113132    m_apcPicYuvResi  = NULL;
    114133  }
    115  
     134
    116135  // free lambda and QP arrays
    117136  if ( m_pdRdPicLambda ) { xFree( m_pdRdPicLambda ); m_pdRdPicLambda = NULL; }
     
    139158#if SVC_EXTENSION
    140159  m_ppcTEncTop        = pcEncTop->getLayerEnc();
    141 #endif 
     160#endif
    142161  m_pcGOPEncoder      = pcEncTop->getGOPEncoder();
    143162  m_pcCuEncoder       = pcEncTop->getCuEncoder();
    144163  m_pcPredSearch      = pcEncTop->getPredSearch();
    145  
     164
    146165  m_pcEntropyCoder    = pcEncTop->getEntropyCoder();
    147166  m_pcCavlcCoder      = pcEncTop->getCavlcCoder();
     
    149168  m_pcBinCABAC        = pcEncTop->getBinCABAC();
    150169  m_pcTrQuant         = pcEncTop->getTrQuant();
    151  
     170
    152171  m_pcBitCounter      = pcEncTop->getBitCounter();
    153172  m_pcRdCost          = pcEncTop->getRdCost();
    154173  m_pppcRDSbacCoder   = pcEncTop->getRDSbacCoder();
    155174  m_pcRDGoOnSbacCoder = pcEncTop->getRDGoOnSbacCoder();
    156  
     175
    157176  // create lambda and QP arrays
    158177  m_pdRdPicLambda     = (Double*)xMalloc( Double, m_pcCfg->getDeltaQpRD() * 2 + 1 );
     
    187206  Double dQP;
    188207  Double dLambda;
    189  
     208
    190209  rpcSlice = pcPic->getSlice(0);
    191210  rpcSlice->setSPS( pSPS );
     
    202221  rpcSlice->setPicOutputFlag( true );
    203222  rpcSlice->setPOC( pocCurr );
    204  
     223
    205224  // depth computation based on GOP size
    206225  Int depth;
     
    230249    }
    231250  }
    232  
     251
    233252  // slice type
    234253  SliceType eSliceType;
    235  
     254
    236255  eSliceType=B_SLICE;
    237256  eSliceType = (pocLast == 0 || pocCurr % m_pcCfg->getIntraPeriod() == 0 || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType;
    238  
     257
    239258  rpcSlice->setSliceType    ( eSliceType );
    240  
     259
    241260  // ------------------------------------------------------------------------------------------------------------------
    242261  // Non-referenced frame marking
    243262  // ------------------------------------------------------------------------------------------------------------------
    244  
     263
    245264  if(pocLast == 0)
    246265  {
     
    252271  }
    253272  rpcSlice->setReferenced(true);
    254  
     273
    255274  // ------------------------------------------------------------------------------------------------------------------
    256275  // QP setting
    257276  // ------------------------------------------------------------------------------------------------------------------
    258  
     277
    259278  dQP = m_pcCfg->getQP();
    260279  if(eSliceType!=I_SLICE)
    261280  {
    262281#if REPN_FORMAT_IN_VPS
    263     if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getQpBDOffsetY() ) && (rpcSlice->getSPS()->getUseLossless()))) 
    264 #else
    265     if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getSPS()->getQpBDOffsetY() ) && (rpcSlice->getSPS()->getUseLossless()))) 
     282    if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getQpBDOffsetY() ) && (rpcSlice->getSPS()->getUseLossless())))
     283#else
     284    if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getSPS()->getQpBDOffsetY() ) && (rpcSlice->getSPS()->getUseLossless())))
    266285#endif
    267286    {
     
    269288    }
    270289  }
    271  
     290
    272291  // modify QP
    273292  Int* pdQPs = m_pcCfg->getdQPs();
     
    285304  // Lambda computation
    286305  // ------------------------------------------------------------------------------------------------------------------
    287  
     306
    288307  Int iQP;
    289308  Double dOrigQP = dQP;
     
    294313    // compute QP value
    295314    dQP = dOrigQP + ((iDQpIdx+1)>>1)*(iDQpIdx%2 ? -1 : 1);
    296    
     315
    297316    // compute lambda value
    298317    Int    NumberBFrames = ( m_pcCfg->getGOPSize() - 1 );
     
    326345#endif
    327346    }
    328    
     347
    329348    // if hadamard is used in ME process
    330349    if ( !m_pcCfg->getUseHADME() && rpcSlice->getSliceType( ) != I_SLICE )
     
    332351      dLambda *= 0.95;
    333352    }
    334    
     353
    335354#if REPN_FORMAT_IN_VPS
    336355    iQP = max( -rpcSlice->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );
     
    343362    m_piRdPicQp    [iDQpIdx] = iQP;
    344363  }
    345  
     364
    346365  // obtain dQP = 0 case
    347366  dLambda = m_pdRdPicLambda[0];
    348367  dQP     = m_pdRdPicQp    [0];
    349368  iQP     = m_piRdPicQp    [0];
    350  
     369
    351370  if( rpcSlice->getSliceType( ) != I_SLICE )
    352371  {
     
    359378    Int nCurLayer = rpcSlice->getLayerId();
    360379    Double gamma = xCalEnhLambdaFactor( m_ppcTEncTop[nCurLayer-1]->getQP() - m_ppcTEncTop[nCurLayer]->getQP() ,
    361       1.0 * m_ppcTEncTop[nCurLayer]->getSourceWidth() * m_ppcTEncTop[nCurLayer]->getSourceHeight() 
     380      1.0 * m_ppcTEncTop[nCurLayer]->getSourceWidth() * m_ppcTEncTop[nCurLayer]->getSourceHeight()
    362381      / m_ppcTEncTop[nCurLayer-1]->getSourceWidth() / m_ppcTEncTop[nCurLayer-1]->getSourceHeight() );
    363382    dLambda *= gamma;
     
    392411#endif
    393412
    394 #if RDOQ_CHROMA_LAMBDA 
     413#if RDOQ_CHROMA_LAMBDA
    395414// for RDOQ
    396   m_pcTrQuant->setLambda( dLambda, dLambda / weight );   
     415  m_pcTrQuant->setLambda( dLambda, dLambda / weight );
    397416#else
    398417  m_pcTrQuant->setLambda( dLambda );
     
    401420#if SAO_CHROMA_LAMBDA
    402421// For SAO
    403   rpcSlice   ->setLambda( dLambda, dLambda / weight ); 
     422  rpcSlice   ->setLambda( dLambda, dLambda / weight );
    404423#else
    405424  rpcSlice   ->setLambda( dLambda );
    406425#endif
    407  
     426
    408427#if HB_LAMBDA_FOR_LDC
    409428  // restore original slice type
    410429  eSliceType = (pocLast == 0 || pocCurr % m_pcCfg->getIntraPeriod() == 0 || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType;
    411  
     430
    412431#if SVC_EXTENSION
    413432  if(m_pcCfg->getLayerId() > 0)
     
    418437  rpcSlice->setSliceType        ( eSliceType );
    419438#endif
    420  
     439
    421440  if (m_pcCfg->getUseRecalculateQPAccordingToLambda())
    422441  {
    423442    dQP = xGetQPValueAccordingToLambda( dLambda );
    424443#if REPN_FORMAT_IN_VPS
    425     iQP = max( -rpcSlice->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );   
    426 #else
    427     iQP = max( -pSPS->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );   
     444    iQP = max( -rpcSlice->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );
     445#else
     446    iQP = max( -pSPS->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );
    428447#endif
    429448  }
     
    438457  rpcSlice->setNumRefIdx(REF_PIC_LIST_0,m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive);
    439458  rpcSlice->setNumRefIdx(REF_PIC_LIST_1,m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive);
    440  
     459
    441460  if ( m_pcCfg->getDeblockingFilterMetric() )
    442461  {
     
    479498
    480499  rpcSlice->setDepth            ( depth );
    481  
     500
    482501  pcPic->setTLayer( m_pcCfg->getGOPEntry(iGOPid).m_temporalId );
    483 #if TEMP_SCALABILITY_FIX
    484   if((eSliceType==I_SLICE) || (rpcSlice->getPOC() == 0))
    485 #else
     502
    486503  if(eSliceType==I_SLICE)
    487 #endif
    488504  {
    489505    pcPic->setTLayer(0);
     
    493509  assert( m_apcPicYuvPred );
    494510  assert( m_apcPicYuvResi );
    495  
     511
    496512  pcPic->setPicYuvPred( m_apcPicYuvPred );
    497513  pcPic->setPicYuvResi( m_apcPicYuvResi );
     
    557573#endif
    558574
    559 #if RDOQ_CHROMA_LAMBDA 
     575#if RDOQ_CHROMA_LAMBDA
    560576  // for RDOQ
    561577  m_pcTrQuant->setLambda( lambda, lambda / weight );
     
    665681#endif
    666682
    667 #if RDOQ_CHROMA_LAMBDA 
     683#if RDOQ_CHROMA_LAMBDA
    668684  // for RDOQ
    669   m_pcTrQuant->setLambda( lambda, lambda / weight );   
     685  m_pcTrQuant->setLambda( lambda, lambda / weight );
    670686#else
    671687  m_pcTrQuant->setLambda( lambda );
     
    674690#if SAO_CHROMA_LAMBDA
    675691  // For SAO
    676   pcSlice   ->setLambda( lambda, lambda / weight ); 
     692  pcSlice   ->setLambda( lambda, lambda / weight );
    677693#else
    678694  pcSlice   ->setLambda( lambda );
     
    692708  Int iMaxSR = m_pcCfg->getSearchRange();
    693709  Int iNumPredDir = pcSlice->isInterP() ? 1 : 2;
    694  
     710
    695711  for (Int iDir = 0; iDir <= iNumPredDir; iDir++)
    696712  {
     
    726742  }
    727743#endif
    728  
     744
    729745  TComSlice* pcSlice        = rpcPic->getSlice(getSliceIdx());
    730746  Double     dPicRdCostBest = MAX_DOUBLE;
    731747  UInt       uiQpIdxBest = 0;
    732  
     748
    733749  Double dFrameLambda;
    734750#if FULL_NBIT
     
    737753  Int    SHIFT_QP = 12;
    738754#endif
    739  
     755
    740756  // set frame lambda
    741757  if (m_pcCfg->getGOPSize() > 1)
     
    748764  }
    749765  m_pcRdCost      ->setFrameLambda(dFrameLambda);
    750  
     766
    751767  // for each QP candidate
    752768  for ( UInt uiQpIdx = 0; uiQpIdx < 2 * m_pcCfg->getDeltaQpRD() + 1; uiQpIdx++ )
     
    776792#endif
    777793
    778 #if RDOQ_CHROMA_LAMBDA 
     794#if RDOQ_CHROMA_LAMBDA
    779795    // for RDOQ
    780796    m_pcTrQuant   ->setLambda( m_pdRdPicLambda[uiQpIdx], m_pdRdPicLambda[uiQpIdx] / weight );
     
    784800#if SAO_CHROMA_LAMBDA
    785801    // For SAO
    786     pcSlice       ->setLambda              ( m_pdRdPicLambda[uiQpIdx], m_pdRdPicLambda[uiQpIdx] / weight ); 
     802    pcSlice       ->setLambda              ( m_pdRdPicLambda[uiQpIdx], m_pdRdPicLambda[uiQpIdx] / weight );
    787803#else
    788804    pcSlice       ->setLambda              ( m_pdRdPicLambda[uiQpIdx] );
    789805#endif
    790    
     806
    791807    // try compress
    792808    compressSlice   ( rpcPic );
    793    
     809
    794810    Double dPicRdCost;
    795811    UInt64 uiPicDist        = m_uiPicDist;
    796812    UInt64 uiALFBits        = 0;
    797    
     813
    798814    m_pcGOPEncoder->preLoopFilterPicAll( rpcPic, uiPicDist, uiALFBits );
    799    
     815
    800816    // compute RD cost and choose the best
    801817    dPicRdCost = m_pcRdCost->calcRdCost64( m_uiPicTotalBits + uiALFBits, uiPicDist, true, DF_SSE_FRAME);
    802    
     818
    803819    if ( dPicRdCost < dPicRdCostBest )
    804820    {
     
    807823    }
    808824  }
    809  
     825
    810826  // set best values
    811827  pcSlice       ->setSliceQp             ( m_piRdPicQp    [uiQpIdxBest] );
     
    832848#endif
    833849
    834 #if RDOQ_CHROMA_LAMBDA 
    835   // for RDOQ 
    836   m_pcTrQuant   ->setLambda( m_pdRdPicLambda[uiQpIdxBest], m_pdRdPicLambda[uiQpIdxBest] / weight ); 
     850#if RDOQ_CHROMA_LAMBDA
     851  // for RDOQ
     852  m_pcTrQuant   ->setLambda( m_pdRdPicLambda[uiQpIdxBest], m_pdRdPicLambda[uiQpIdxBest] / weight );
    837853#else
    838854  m_pcTrQuant   ->setLambda              ( m_pdRdPicLambda[uiQpIdxBest] );
     
    840856#if SAO_CHROMA_LAMBDA
    841857  // For SAO
    842   pcSlice       ->setLambda              ( m_pdRdPicLambda[uiQpIdxBest], m_pdRdPicLambda[uiQpIdxBest] / weight ); 
     858  pcSlice       ->setLambda              ( m_pdRdPicLambda[uiQpIdxBest], m_pdRdPicLambda[uiQpIdxBest] / weight );
    843859#else
    844860  pcSlice       ->setLambda              ( m_pdRdPicLambda[uiQpIdxBest] );
     
    862878
    863879  UInt uiEncCUOrder;
    864   uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU()); 
     880  uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU());
    865881  for( uiEncCUOrder = uiStartCUAddr/rpcPic->getNumPartInCU();
    866882       uiEncCUOrder < (uiBoundingCUAddr+(rpcPic->getNumPartInCU()-1))/rpcPic->getNumPartInCU();
     
    898914  TComSlice* pcSlice            = rpcPic->getSlice(getSliceIdx());
    899915  xDetermineStartAndBoundingCUAddr ( uiStartCUAddr, uiBoundingCUAddr, rpcPic, false );
    900  
     916
    901917  // initialize cost values
    902918  m_uiPicTotalBits  = 0;
    903919  m_dPicRdCost      = 0;
    904920  m_uiPicDist       = 0;
    905  
     921
    906922  // set entropy coder
    907923  if( m_pcCfg->getUseSBACRD() )
     
    921937    m_pcEntropyCoder->setBitstream    ( m_pcBitCounter );
    922938  }
    923  
     939
    924940  //------------------------------------------------------------------------------
    925941  //  Weighted Prediction parameters estimation.
     
    930946    xCalcACDCParamSlice(pcSlice);
    931947  }
     948#if O0194_WEIGHTED_PREDICTION_CGS
     949  else
     950  {
     951    // Calculate for the base layer to be used in EL as Inter layer reference
     952    estimateILWpParam( pcSlice );   
     953  }
     954#endif
    932955
    933956  Bool bWp_explicit = (pcSlice->getSliceType()==P_SLICE && pcSlice->getPPS()->getUseWP()) || (pcSlice->getSliceType()==B_SLICE && pcSlice->getPPS()->getWPBiPred());
     
    10211044        m_pcBufferSbacCoders[uiTileCol].loadContexts( CTXMem[1] );
    10221045        Int iNumSubstreamsPerTile = iNumSubstreams/rpcPic->getPicSym()->getNumTiles();
    1023         uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU()); 
     1046        uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU());
    10241047        uiLin     = uiCUAddr / uiWidthInLCUs;
    10251048        uiSubStrm = rpcPic->getPicSym()->getTileIdxMap(rpcPic->getPicSym()->getCUOrderMap(uiCUAddr))*iNumSubstreamsPerTile
     
    10981121          pcCUTR = rpcPic->getCU( uiCUAddr - uiWidthInCU + 1 );
    10991122        }
    1100         if ( ((pcCUTR==NULL) || (pcCUTR->getSlice()==NULL) || 
     1123        if ( ((pcCUTR==NULL) || (pcCUTR->getSlice()==NULL) ||
    11011124             (pcCUTR->getSCUAddr()+uiMaxParts-1 < pcSlice->getSliceCurStartCUAddr()) ||
    11021125             ((rpcPic->getPicSym()->getTileIdxMap( pcCUTR->getAddr() ) != rpcPic->getPicSym()->getTileIdxMap(uiCUAddr)))
     
    11371160      m_pcEntropyCoder->setEntropyCoder ( m_pcRDGoOnSbacCoder, pcSlice );
    11381161      m_pcEntropyCoder->setBitstream( &pcBitCounters[uiSubStrm] );
    1139      
     1162
    11401163      ((TEncBinCABAC*)m_pcRDGoOnSbacCoder->getEncBinIf())->setBinCountingEnableFlag(true);
    11411164
     
    12421265        m_pcRdCost->setLambda(oldLambda);
    12431266#if RATE_CONTROL_INTRA
    1244         m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda, 
     1267        m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda,
    12451268          pcCU->getSlice()->getSliceType() == I_SLICE ? 0 : m_pcCfg->getLCULevelRC() );
    12461269#else
     
    12501273#endif
    12511274#endif
    1252      
     1275
    12531276      // restore entropy coder to an initial stage
    12541277      m_pcEntropyCoder->setEntropyCoder ( m_pppcRDSbacCoder[0][CI_CURR_BEST], pcSlice );
     
    12751298      {
    12761299         ppppcRDSbacCoders[uiSubStrm][0][CI_CURR_BEST]->load( m_pppcRDSbacCoder[0][CI_CURR_BEST] );
    1277        
     1300
    12781301         //Store probabilties of second LCU in line into buffer
    12791302         if ( ( uiCol == uiTileLCUX+1) && (depSliceSegmentsEnabled || (pcSlice->getPPS()->getNumSubstreams() > 1)) && m_pcCfg->getWaveFrontsynchro())
     
    13251348
    13261349#if RATE_CONTROL_INTRA
    1327         m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda, 
     1350        m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda,
    13281351          pcCU->getSlice()->getSliceType() == I_SLICE ? 0 : m_pcCfg->getLCULevelRC() );
    13291352#else
     
    13501373      }
    13511374    }
    1352    
     1375
    13531376    m_uiPicTotalBits += pcCU->getTotalBits();
    13541377    m_dPicRdCost     += pcCU->getTotalCost();
     
    14011424    m_pcEntropyCoder->setEntropyCoder ( m_pcSbacCoder, pcSlice );
    14021425  }
    1403  
     1426
    14041427  m_pcCuEncoder->setBitCounter( NULL );
    14051428  m_pcBitCounter = NULL;
     
    14271450      m_pcBufferSbacCoders[ui].load(m_pcSbacCoder); //init. state
    14281451    }
    1429    
     1452
    14301453    for (Int iSubstrmIdx=0; iSubstrmIdx < iNumSubstreams; iSubstrmIdx++)
    14311454    {
     
    15241547        }
    15251548        if ( (true/*bEnforceSliceRestriction*/ &&
    1526              ((pcCUTR==NULL) || (pcCUTR->getSlice()==NULL) || 
     1549             ((pcCUTR==NULL) || (pcCUTR->getSlice()==NULL) ||
    15271550             (pcCUTR->getSCUAddr()+uiMaxParts-1 < pcSlice->getSliceCurStartCUAddr()) ||
    15281551             ((rpcPic->getPicSym()->getTileIdxMap( pcCUTR->getAddr() ) != rpcPic->getPicSym()->getTileIdxMap(uiCUAddr)))
     
    15791602    }
    15801603
    1581     TComDataCU*& pcCU = rpcPic->getCU( uiCUAddr );   
     1604    TComDataCU*& pcCU = rpcPic->getCU( uiCUAddr );
    15821605    if ( pcSlice->getSPS()->getUseSAO() && (pcSlice->getSaoEnabledFlag()||pcSlice->getSaoEnabledFlagChroma()) )
    15831606    {
     
    16131636        if (allowMergeLeft)
    16141637        {
    1615           m_pcEntropyCoder->m_pcEntropyCoderIf->codeSaoMerge(mergeLeft); 
     1638          m_pcEntropyCoder->m_pcEntropyCoderIf->codeSaoMerge(mergeLeft);
    16161639        }
    16171640        else
     
    16761699#if ENC_DEC_TRACE
    16771700    g_bJustDoIt = g_bEncDecTraceDisable;
    1678 #endif   
     1701#endif
    16791702    if( m_pcCfg->getUseSBACRD() )
    16801703    {
    16811704       pcSbacCoders[uiSubStrm].load(m_pcSbacCoder);   //load back status of the entropy coder after encoding the LCU into relevant bitstream entropy coder
    1682        
     1705
    16831706
    16841707       //Store probabilties of second LCU in line into buffer
     
    17331756  UInt uiNumberOfCUsInFrame = rpcPic->getNumCUsInFrame();
    17341757  uiBoundingCUAddrSlice     = uiNumberOfCUsInFrame;
    1735   if (bEncodeSlice) 
     1758  if (bEncodeSlice)
    17361759  {
    17371760    UInt uiCUAddrIncrement;
     
    17691792      uiBoundingCUAddrSlice    = uiNumberOfCUsInFrame*rpcPic->getNumPartInCU();
    17701793      break;
    1771     } 
     1794    }
    17721795    // WPP: if a slice does not start at the beginning of a CTB row, it must end within the same CTB row
    17731796    if (pcSlice->getPPS()->getNumSubstreams() > 1 && (uiStartCUAddrSlice % (rpcPic->getFrameWidthInCU()*rpcPic->getNumPartInCU()) != 0))
     
    18091832      uiBoundingCUAddrSlice    = uiNumberOfCUsInFrame*rpcPic->getNumPartInCU();
    18101833      break;
    1811     } 
     1834    }
    18121835    // WPP: if a slice does not start at the beginning of a CTB row, it must end within the same CTB row
    18131836    if (pcSlice->getPPS()->getNumSubstreams() > 1 && (uiStartCUAddrSlice % (rpcPic->getFrameWidthInCU()*rpcPic->getNumPartInCU()) != 0))
     
    18191842
    18201843  Bool tileBoundary = false;
    1821   if ((m_pcCfg->getSliceMode() == FIXED_NUMBER_OF_LCU || m_pcCfg->getSliceMode() == FIXED_NUMBER_OF_BYTES) && 
     1844  if ((m_pcCfg->getSliceMode() == FIXED_NUMBER_OF_LCU || m_pcCfg->getSliceMode() == FIXED_NUMBER_OF_BYTES) &&
    18221845      (m_pcCfg->getNumRowsMinus1() > 0 || m_pcCfg->getNumColumnsMinus1() > 0))
    18231846  {
     
    18321855    }
    18331856    tileBoundingCUAddrSlice = lcuEncAddr*rpcPic->getNumPartInCU();
    1834    
     1857
    18351858    if (tileBoundingCUAddrSlice < uiBoundingCUAddrSlice)
    18361859    {
     
    18451868  startCUAddrSliceSegment    = pcSlice->getSliceSegmentCurStartCUAddr();
    18461869  boundingCUAddrSliceSegment = uiNumberOfCUsInFrame;
    1847   if (bEncodeSlice) 
     1870  if (bEncodeSlice)
    18481871  {
    18491872    UInt uiCUAddrIncrement;
     
    18801903      boundingCUAddrSliceSegment    = uiNumberOfCUsInFrame*rpcPic->getNumPartInCU();
    18811904      break;
    1882     } 
     1905    }
    18831906    // WPP: if a slice segment does not start at the beginning of a CTB row, it must end within the same CTB row
    18841907    if (pcSlice->getPPS()->getNumSubstreams() > 1 && (startCUAddrSliceSegment % (rpcPic->getFrameWidthInCU()*rpcPic->getNumPartInCU()) != 0))
     
    19191942      boundingCUAddrSliceSegment    = uiNumberOfCUsInFrame*rpcPic->getNumPartInCU();
    19201943      break;
    1921     } 
     1944    }
    19221945    // WPP: if a slice segment does not start at the beginning of a CTB row, it must end within the same CTB row
    19231946    if (pcSlice->getPPS()->getNumSubstreams() > 1 && (startCUAddrSliceSegment % (rpcPic->getFrameWidthInCU()*rpcPic->getNumPartInCU()) != 0))
     
    19271950    pcSlice->setSliceSegmentCurEndCUAddr( boundingCUAddrSliceSegment );
    19281951  }
    1929   if ((m_pcCfg->getSliceSegmentMode() == FIXED_NUMBER_OF_LCU || m_pcCfg->getSliceSegmentMode() == FIXED_NUMBER_OF_BYTES) && 
     1952  if ((m_pcCfg->getSliceSegmentMode() == FIXED_NUMBER_OF_LCU || m_pcCfg->getSliceSegmentMode() == FIXED_NUMBER_OF_BYTES) &&
    19301953    (m_pcCfg->getNumRowsMinus1() > 0 || m_pcCfg->getNumColumnsMinus1() > 0))
    19311954  {
     
    19792002  }
    19802003  UInt uiRealStartAddress = rpcPic->getPicSym()->getPicSCUEncOrder(uiExternalAddress*rpcPic->getNumPartInCU()+uiInternalAddress);
    1981  
     2004
    19822005  pcSlice->setSliceSegmentCurStartCUAddr(uiRealStartAddress);
    19832006  startCUAddrSliceSegment=uiRealStartAddress;
    1984  
     2007
    19852008  //calculate real slice start address
    19862009  uiInternalAddress = rpcPic->getPicSym()->getPicSCUAddr(pcSlice->getSliceCurStartCUAddr()) % rpcPic->getNumPartInCU();
     
    20072030  }
    20082031  uiRealStartAddress = rpcPic->getPicSym()->getPicSCUEncOrder(uiExternalAddress*rpcPic->getNumPartInCU()+uiInternalAddress);
    2009  
     2032
    20102033  pcSlice->setSliceCurStartCUAddr(uiRealStartAddress);
    20112034  uiStartCUAddrSlice=uiRealStartAddress;
    2012  
     2035
    20132036  // Make a joint decision based on reconstruction and dependent slice bounds
    20142037  startCUAddr    = max(uiStartCUAddrSlice   , startCUAddrSliceSegment   );
     
    20222045    if ( (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_LCU && m_pcCfg->getSliceSegmentMode()==FIXED_NUMBER_OF_LCU)
    20232046      || (m_pcCfg->getSliceMode()==0 && m_pcCfg->getSliceSegmentMode()==FIXED_NUMBER_OF_LCU)
    2024       || (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_LCU && m_pcCfg->getSliceSegmentMode()==0) 
     2047      || (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_LCU && m_pcCfg->getSliceSegmentMode()==0)
    20252048      || (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_TILES && m_pcCfg->getSliceSegmentMode()==FIXED_NUMBER_OF_LCU)
    2026       || (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_TILES && m_pcCfg->getSliceSegmentMode()==0) 
     2049      || (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_TILES && m_pcCfg->getSliceSegmentMode()==0)
    20272050      || (m_pcCfg->getSliceSegmentMode()==FIXED_NUMBER_OF_TILES && m_pcCfg->getSliceMode()==0)
    20282051      || tileBoundary
     
    20662089}
    20672090#endif
     2091#if O0194_WEIGHTED_PREDICTION_CGS
     2092Void TEncSlice::estimateILWpParam( TComSlice* pcSlice )
     2093{
     2094  xCalcACDCParamSlice(pcSlice);
     2095  wpACDCParam * temp_weightACDCParam;
     2096
     2097  pcSlice->getWpAcDcParam(temp_weightACDCParam);
     2098  g_refWeightACDCParam = (void *) temp_weightACDCParam;
     2099}
     2100#endif
    20682101//! \}
Note: See TracChangeset for help on using the changeset viewer.