Ignore:
Timestamp:
8 Feb 2014, 00:23:11 (11 years ago)
Author:
tech
Message:

Merged HM 13.0. (No yet checked).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-10.0rc1-dev0/source/Lib/TLibEncoder/TEncTop.cpp

    r773 r837  
    44 * granted under this license. 
    55 *
    6  * Copyright (c) 2010-2013, ITU/ISO/IEC
     6* Copyright (c) 2010-2014, ITU/ISO/IEC
    77 * All rights reserved.
    88 *
     
    106106  if (m_bUseSAO)
    107107  {
    108     m_cEncSAO.setSaoLcuBoundary(getSaoLcuBoundary());
    109     m_cEncSAO.setSaoLcuBasedOptimization(getSaoLcuBasedOptimization());
    110     m_cEncSAO.setMaxNumOffsetsPerPic(getMaxNumOffsetsPerPic());
    111     m_cEncSAO.create( getSourceWidth(), getSourceHeight(), g_uiMaxCUWidth, g_uiMaxCUHeight );
    112     m_cEncSAO.createEncBuffer();
     108    m_cEncSAO.create( getSourceWidth(), getSourceHeight(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
     109#if SAO_ENCODE_ALLOW_USE_PREDEBLOCK
     110    m_cEncSAO.createEncData(getSaoLcuBoundary());
     111#else
     112    m_cEncSAO.createEncData();
     113#endif
    113114  }
    114115#if ADAPTIVE_QP_SELECTION
     
    120121  m_cLoopFilter.        create( g_uiMaxCUDepth );
    121122
    122 #if RATE_CONTROL_LAMBDA_DOMAIN
    123123  if ( m_RCEnableRateControl )
    124124  {
     
    131131#endif
    132132  }
    133 #else
    134 #if KWU_FIX_URQ
    135   if(m_enableRateCtrl)
    136 #endif
    137     m_cRateCtrl.create(getIntraPeriod(), getGOPSize(), getFrameRate(), getTargetBitrate(), getQP(), getNumLCUInUnit(), getSourceWidth(), getSourceHeight(), g_uiMaxCUWidth, g_uiMaxCUHeight);
    138 #endif
    139   // if SBAC-based RD optimization is used
    140   if( m_bUseSBACRD )
    141   {
    142133    m_pppcRDSbacCoder = new TEncSbac** [g_uiMaxCUDepth+1];
    143134#if FAST_BIT_EST
     
    168159    }
    169160  }
    170 }
    171161
    172162/**
     
    195185    m_pcSbacCoders[ui].init( &m_pcBinCoderCABACs[ui] );
    196186  }
    197   if( m_bUseSBACRD )
    198   {
     187
    199188    m_ppppcRDSbacCoders      = new TEncSbac***    [iNumSubstreams];
    200189    m_ppppcBinCodersCABAC    = new TEncBinCABAC***[iNumSubstreams];
     
    218207    }
    219208  }
    220 }
    221209
    222210Void TEncTop::destroy ()
     
    228216  if (m_cSPS.getUseSAO())
    229217  {
     218    m_cEncSAO.destroyEncData();
    230219    m_cEncSAO.destroy();
    231     m_cEncSAO.destroyEncBuffer();
    232220  }
    233221  m_cLoopFilter.        destroy();
    234222  m_cRateCtrl.          destroy();
    235   // SBAC RD
    236   if( m_bUseSBACRD )
    237   {
     223
    238224    Int iDepth;
    239225    for ( iDepth = 0; iDepth < g_uiMaxCUDepth+1; iDepth++ )
     
    276262    delete[] m_ppppcRDSbacCoders;
    277263    delete[] m_ppppcBinCodersCABAC;
    278   }
    279264  delete[] m_pcSbacCoders;
    280265  delete[] m_pcBinCoderCABACs;
     
    439424#endif
    440425 
    441 #if RATE_CONTROL_LAMBDA_DOMAIN
    442426  if ( m_RCEnableRateControl )
    443427  {
    444428    m_cRateCtrl.initRCGOP( m_iNumPicRcvd );
    445429  }
    446 #endif
    447 
    448430#if H_MV
    449431  }
     
    457439#endif
    458440
    459 #if RATE_CONTROL_LAMBDA_DOMAIN
    460441  if ( m_RCEnableRateControl )
    461442  {
    462443    m_cRateCtrl.destroyRCGOP();
    463444  }
    464 #endif
    465445 
    466446  iNumEncoded         = m_iNumPicRcvd;
     
    510490    TComPic *pcTopField;
    511491    xGetNewPicBuffer( pcTopField );
    512     pcTopField->getPicSym()->allocSaoParam(&m_cEncSAO);
    513492    pcTopField->setReconMark (false);
    514493   
     
    532511    Pel * pcTopFieldV =  pcTopField->getPicYuvOrg()->getCrAddr();
    533512   
    534     // compute image characteristics
    535     if ( getUseAdaptiveQP() )
    536     {
    537       m_cPreanalyzer.xPreanalyze( dynamic_cast<TEncPic*>( pcTopField ) );
    538     }
    539    
    540513    /* -- Defield -- */
    541514   
     
    546519    separateFields(PicBufV + nPadChroma + (nStride >> 1)*nPadChroma, pcTopFieldV, nStride >> 1, nWidth >> 1, nHeight >> 1, isTop);
    547520   
     521    // compute image characteristics
     522    if ( getUseAdaptiveQP() )
     523    {
     524      m_cPreanalyzer.xPreanalyze( dynamic_cast<TEncPic*>( pcTopField ) );
     525    }   
    548526  }
    549527 
     
    562540    TComPic* pcBottomField;
    563541    xGetNewPicBuffer( pcBottomField );
    564     pcBottomField->getPicSym()->allocSaoParam(&m_cEncSAO);
    565542    pcBottomField->setReconMark (false);
    566543   
    567     TComPicYuv* rpcPicYuvRec = new TComPicYuv;
     544    TComPicYuv* rpcPicYuvRec;
    568545    if ( rcListPicYuvRecOut.size() == (UInt)m_iGOPSize )
    569546    {
     
    572549    else
    573550    {
     551      rpcPicYuvRec = new TComPicYuv;
    574552      rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
    575553    }
     
    595573    Pel * pcBottomFieldV =  pcBottomField->getPicYuvOrg()->getCrAddr();
    596574   
    597     // Compute image characteristics
    598     if ( getUseAdaptiveQP() )
    599     {
    600       m_cPreanalyzer.xPreanalyze( dynamic_cast<TEncPic*>( pcBottomField ) );
    601     }
    602    
    603575    /* -- Defield -- */
    604576   
     
    609581    separateFields(PicBufV + nPadChroma + (nStride >> 1)*nPadChroma, pcBottomFieldV, nStride >> 1, nWidth >> 1, nHeight >> 1, isTop);
    610582   
     583    // Compute image characteristics
     584    if ( getUseAdaptiveQP() )
     585    {
     586      m_cPreanalyzer.xPreanalyze( dynamic_cast<TEncPic*>( pcBottomField ) );
     587    }   
    611588  }
    612589 
     
    624601  m_uiNumAllPicCoded += iNumEncoded;
    625602}
    626 #endif
    627 
    628 
    629603
    630604// ====================================================================================================================
     
    671645      rpcPic->create( m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
    672646                      m_conformanceWindow, m_defaultDisplayWindow, m_numReorderPics);
    673     }
    674     if (getUseSAO())
    675     {
    676       rpcPic->getPicSym()->allocSaoParam(&m_cEncSAO);
    677647    }
    678648    m_cListPic.pushBack( rpcPic );
     
    760730 
    761731  m_cSPS.setTMVPFlagsPresent(false);
    762   m_cSPS.setUseLossless   ( m_useLossless  );
    763732
    764733  m_cSPS.setMaxTrSize   ( 1 << m_uiQuadtreeTULog2MaxSize );
     
    794763  m_cSPS.setMaxTLayers( m_maxTempLayer );
    795764  m_cSPS.setTemporalIdNestingFlag( ( m_maxTempLayer == 1 ) ? true : false );
    796   for ( i = 0; i < m_cSPS.getMaxTLayers(); i++ )
     765  for ( i = 0; i < min(m_cSPS.getMaxTLayers(),(UInt) MAX_TLAYER); i++ )
    797766  {
    798767    m_cSPS.setMaxDecPicBuffering(m_maxDecPicBuffering[i], i);
     
    860829  m_cPPS.setSPSId( getLayerIdInVps() );
    861830#endif
    862 
    863831#if H_3D
    864832  m_cPPS.setDLT( getDLT() );
    865833#endif
    866 
    867834  m_cPPS.setConstrainedIntraPred( m_bUseConstrainedIntraPred );
    868835  Bool bUseDQP = (getMaxCuDQPDepth() > 0)? true : false;
    869836
    870   Int lowestQP = - m_cSPS.getQpBDOffsetY();
    871 
    872   if(getUseLossless())
    873   {
    874     if ((getMaxCuDQPDepth() == 0) && (getMaxDeltaQP() == 0 ) && (getQP() == lowestQP) )
    875     {
    876       bUseDQP = false;
    877     }
    878     else
    879     {
    880       bUseDQP = true;
    881     }
    882   }
    883   else
    884   {
    885     if(bUseDQP == false)
    886     {
    887837      if((getMaxDeltaQP() != 0 )|| getUseAdaptiveQP())
    888838      {
    889839        bUseDQP = true;
    890840      }
    891     }
    892   }
    893841
    894842  if(bUseDQP)
     
    905853  }
    906854
    907 #if RATE_CONTROL_LAMBDA_DOMAIN
    908855  if ( m_RCEnableRateControl )
    909856  {
     
    912859    m_cPPS.setMinCuDQPSize( m_cPPS.getSPS()->getMaxCUWidth() >> ( m_cPPS.getMaxCuDQPDepth()) );
    913860  }
    914 #endif
    915 #if !RATE_CONTROL_LAMBDA_DOMAIN && KWU_FIX_URQ
    916   if ( m_enableRateCtrl )
    917   {
    918     m_cPPS.setUseDQP(true);
    919     m_cPPS.setMaxCuDQPDepth( 0 );
    920     m_cPPS.setMinCuDQPSize( m_cPPS.getSPS()->getMaxCUWidth() >> ( m_cPPS.getMaxCuDQPDepth()) );
    921   }
    922 #endif
    923861
    924862  m_cPPS.setChromaCbQpOffset( m_chromaCbQpOffset );
Note: See TracChangeset for help on using the changeset viewer.