Changeset 1403 in 3DVCSoftware


Ignore:
Timestamp:
26 May 2016, 15:14:19 (9 years ago)
Author:
tech
Message:

Fixes.

Location:
branches/HTM-16.1-dev/source/Lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-16.1-dev/source/Lib/TLibDecoder/SEIread.cpp

    r1402 r1403  
    12781278  sei_read_code( pDecodedMessageOutputStream, 32, code, "min_display_mastering_luminance" ); sei.values.minLuminance = code;
    12791279}
     1280
     1281#if U0033_ALTERNATIVE_TRANSFER_CHARACTERISTICS_SEI
     1282Void SEIReader::xParseSEIAlternativeTransferCharacteristics(SEIAlternativeTransferCharacteristics& sei, UInt payloadSize, ostream* pDecodedMessageOutputStream)
     1283{
     1284  UInt code;
     1285  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1286
     1287  sei_read_code(pDecodedMessageOutputStream, 8, code, "preferred_transfer_characteristics"); sei.m_preferredTransferCharacteristics = code;
     1288}
     1289#endif
     1290
    12801291#if NH_MV
    12811292Void SEIReader::xParseSEILayersNotPresent(SEILayersNotPresent &sei, UInt payloadSize, const TComVPS *vps, std::ostream *pDecodedMessageOutputStream)
  • branches/HTM-16.1-dev/source/Lib/TLibEncoder/TEncSlice.cpp

    r1401 r1403  
    4949 : m_encCABACTableIdx(I_SLICE)
    5050{
    51   m_apcPicYuvPred = NULL;
    52   m_apcPicYuvResi = NULL;
    53 
    54   m_pdRdPicLambda = NULL;
    55   m_pdRdPicQp     = NULL;
    56   m_piRdPicQp     = NULL;
    5751}
    5852
    5953TEncSlice::~TEncSlice()
    6054{
     55  destroy();
    6156}
    6257
     
    6459{
    6560  // create prediction picture
    66   if ( m_apcPicYuvPred == NULL )
    67   {
    68     m_apcPicYuvPred  = new TComPicYuv;
    69     m_apcPicYuvPred->create( iWidth, iHeight, chromaFormat, iMaxCUWidth, iMaxCUHeight, uhTotalDepth, true );
    70   }
     61  m_picYuvPred.create( iWidth, iHeight, chromaFormat, iMaxCUWidth, iMaxCUHeight, uhTotalDepth, true );
    7162
    7263  // create residual picture
    73   if( m_apcPicYuvResi == NULL )
    74   {
    75     m_apcPicYuvResi  = new TComPicYuv;
    76     m_apcPicYuvResi->create( iWidth, iHeight, chromaFormat, iMaxCUWidth, iMaxCUHeight, uhTotalDepth, true );
    77   }
     64  m_picYuvResi.create( iWidth, iHeight, chromaFormat, iMaxCUWidth, iMaxCUHeight, uhTotalDepth, true );
    7865}
    7966
    8067Void TEncSlice::destroy()
    8168{
    82   // destroy prediction picture
    83   if ( m_apcPicYuvPred )
    84   {
    85     m_apcPicYuvPred->destroy();
    86     delete m_apcPicYuvPred;
    87     m_apcPicYuvPred  = NULL;
    88   }
    89 
    90   // destroy residual picture
    91   if ( m_apcPicYuvResi )
    92   {
    93     m_apcPicYuvResi->destroy();
    94     delete m_apcPicYuvResi;
    95     m_apcPicYuvResi  = NULL;
    96   }
     69  m_picYuvPred.destroy();
     70  m_picYuvResi.destroy();
    9771
    9872  // free lambda and QP arrays
    99   if ( m_pdRdPicLambda )
    100   {
    101     xFree( m_pdRdPicLambda );
    102     m_pdRdPicLambda = NULL;
    103   }
    104   if ( m_pdRdPicQp )
    105   {
    106     xFree( m_pdRdPicQp );
    107     m_pdRdPicQp = NULL;
    108   }
    109   if ( m_piRdPicQp )
    110   {
    111     xFree( m_piRdPicQp );
    112     m_piRdPicQp = NULL;
    113   }
     73  m_vdRdPicLambda.clear();
     74  m_vdRdPicQp.clear();
     75  m_viRdPicQp.clear();
    11476}
    11577
     
    13395
    13496  // create lambda and QP arrays
    135   m_pdRdPicLambda     = (Double*)xMalloc( Double, m_pcCfg->getDeltaQpRD() * 2 + 1 );
    136   m_pdRdPicQp         = (Double*)xMalloc( Double, m_pcCfg->getDeltaQpRD() * 2 + 1 );
    137   m_piRdPicQp         = (Int*   )xMalloc( Int,    m_pcCfg->getDeltaQpRD() * 2 + 1 );
     97  m_vdRdPicLambda.resize(m_pcCfg->getDeltaQpRD() * 2 + 1 );
     98  m_vdRdPicQp.resize(    m_pcCfg->getDeltaQpRD() * 2 + 1 );
     99  m_viRdPicQp.resize(    m_pcCfg->getDeltaQpRD() * 2 + 1 );
    138100#if KWU_RC_MADPRED_E0227
    139101  if(m_pcCfg->getUseRateCtrl())
     
    427389    }
    428390
     391#if W0062_RECALCULATE_QP_TO_ALIGN_WITH_LAMBDA
     392    Double lambdaRef = 0.57*pow(2.0, qp_temp/3.0);
     393    // QP correction due to modified lambda
     394    Double qpOffset = floor((3.0*log(dLambda/lambdaRef)/log(2.0)) +0.5);
     395    dQP += qpOffset;
     396#endif
     397
    429398    iQP = max( -rpcSlice->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );
    430399
    431     m_pdRdPicLambda[iDQpIdx] = dLambda;
    432     m_pdRdPicQp    [iDQpIdx] = dQP;
    433     m_piRdPicQp    [iDQpIdx] = iQP;
     400    m_vdRdPicLambda[iDQpIdx] = dLambda;
     401    m_vdRdPicQp    [iDQpIdx] = dQP;
     402    m_viRdPicQp    [iDQpIdx] = iQP;
    434403  }
    435404
    436405  // obtain dQP = 0 case
    437   dLambda = m_pdRdPicLambda[0];
    438   dQP     = m_pdRdPicQp    [0];
    439   iQP     = m_piRdPicQp    [0];
     406  dLambda = m_vdRdPicLambda[0];
     407  dQP     = m_vdRdPicQp    [0];
     408  iQP     = m_viRdPicQp    [0];
    440409
    441410
     
    446415#endif
    447416  const std::vector<Double> &intraLambdaModifiers=m_pcCfg->getIntraLambdaModifier();
     417
     418#if W0038_CQP_ADJ
     419  if(rpcSlice->getPPS()->getSliceChromaQpFlag())
     420  {
     421    const Bool bUseIntraOrPeriodicOffset = rpcSlice->getSliceType()==I_SLICE || (m_pcCfg->getSliceChromaOffsetQpPeriodicity()!=0 && (rpcSlice->getPOC()%m_pcCfg->getSliceChromaOffsetQpPeriodicity())==0);
     422    Int cbQP = bUseIntraOrPeriodicOffset? m_pcCfg->getSliceChromaOffsetQpIntraOrPeriodic(false) : m_pcCfg->getGOPEntry(iGOPid).m_CbQPoffset;
     423    Int crQP = bUseIntraOrPeriodicOffset? m_pcCfg->getSliceChromaOffsetQpIntraOrPeriodic(true)  : m_pcCfg->getGOPEntry(iGOPid).m_CrQPoffset;
     424
     425    cbQP = Clip3( -12, 12, cbQP + rpcSlice->getPPS()->getQpOffset(COMPONENT_Cb) ) - rpcSlice->getPPS()->getQpOffset(COMPONENT_Cb);
     426    crQP = Clip3( -12, 12, crQP + rpcSlice->getPPS()->getQpOffset(COMPONENT_Cr) ) - rpcSlice->getPPS()->getQpOffset(COMPONENT_Cr);
     427    rpcSlice->setSliceChromaQpDelta(COMPONENT_Cb, Clip3( -12, 12, cbQP));
     428    assert(rpcSlice->getSliceChromaQpDelta(COMPONENT_Cb)+rpcSlice->getPPS()->getQpOffset(COMPONENT_Cb)<=12 && rpcSlice->getSliceChromaQpDelta(COMPONENT_Cb)+rpcSlice->getPPS()->getQpOffset(COMPONENT_Cb)>=-12);
     429    rpcSlice->setSliceChromaQpDelta(COMPONENT_Cr, Clip3( -12, 12, crQP));
     430    assert(rpcSlice->getSliceChromaQpDelta(COMPONENT_Cr)+rpcSlice->getPPS()->getQpOffset(COMPONENT_Cr)<=12 && rpcSlice->getSliceChromaQpDelta(COMPONENT_Cr)+rpcSlice->getPPS()->getQpOffset(COMPONENT_Cr)>=-12);
     431  }
     432  else
     433  {
     434    rpcSlice->setSliceChromaQpDelta( COMPONENT_Cb, 0 );
     435    rpcSlice->setSliceChromaQpDelta( COMPONENT_Cr, 0 );
     436  }
     437#endif
    448438
    449439  Double lambdaModifier;
     
    517507#endif
    518508  rpcSlice->setSliceQpDelta      ( 0 );
     509#if !W0038_CQP_ADJ
    519510  rpcSlice->setSliceChromaQpDelta( COMPONENT_Cb, 0 );
    520511  rpcSlice->setSliceChromaQpDelta( COMPONENT_Cr, 0 );
     512#endif
    521513  rpcSlice->setUseChromaQpAdj( rpcSlice->getPPS()->getPpsRangeExtension().getChromaQpOffsetListEnabledFlag() );
    522514#if NH_MV
     
    575567  rpcSlice->setTLayer( pcPic->getTLayer() );
    576568
    577   assert( m_apcPicYuvPred );
    578   assert( m_apcPicYuvResi );
    579 
    580   pcPic->setPicYuvPred( m_apcPicYuvPred );
    581   pcPic->setPicYuvResi( m_apcPicYuvResi );
     569  pcPic->setPicYuvPred( &m_picYuvPred );
     570  pcPic->setPicYuvResi( &m_picYuvResi );
    582571  rpcSlice->setSliceMode            ( m_pcCfg->getSliceMode()            );
    583572  rpcSlice->setSliceArgument        ( m_pcCfg->getSliceArgument()        );
     
    679668  if (m_pcCfg->getGOPSize() > 1)
    680669  {
    681     dFrameLambda = 0.68 * pow (2, (m_piRdPicQp[0]  - SHIFT_QP) / 3.0) * (pcSlice->isInterB()? 2 : 1);
     670    dFrameLambda = 0.68 * pow (2, (m_viRdPicQp[0]  - SHIFT_QP) / 3.0) * (pcSlice->isInterB()? 2 : 1);
    682671  }
    683672  else
    684673  {
    685     dFrameLambda = 0.68 * pow (2, (m_piRdPicQp[0] - SHIFT_QP) / 3.0);
     674    dFrameLambda = 0.68 * pow (2, (m_viRdPicQp[0] - SHIFT_QP) / 3.0);
    686675  }
    687676  m_pcRdCost      ->setFrameLambda(dFrameLambda);
     
    690679  for ( UInt uiQpIdx = 0; uiQpIdx < 2 * m_pcCfg->getDeltaQpRD() + 1; uiQpIdx++ )
    691680  {
    692     pcSlice       ->setSliceQp             ( m_piRdPicQp    [uiQpIdx] );
     681    pcSlice       ->setSliceQp             ( m_viRdPicQp    [uiQpIdx] );
    693682#if ADAPTIVE_QP_SELECTION
    694     pcSlice       ->setSliceQpBase         ( m_piRdPicQp    [uiQpIdx] );
    695 #endif
    696     setUpLambda(pcSlice, m_pdRdPicLambda[uiQpIdx], m_piRdPicQp    [uiQpIdx]);
     683    pcSlice       ->setSliceQpBase         ( m_viRdPicQp    [uiQpIdx] );
     684#endif
     685    setUpLambda(pcSlice, m_vdRdPicLambda[uiQpIdx], m_viRdPicQp    [uiQpIdx]);
    697686
    698687    // try compress
     
    730719
    731720  // set best values
    732   pcSlice       ->setSliceQp             ( m_piRdPicQp    [uiQpIdxBest] );
     721  pcSlice       ->setSliceQp             ( m_viRdPicQp    [uiQpIdxBest] );
    733722#if ADAPTIVE_QP_SELECTION
    734   pcSlice       ->setSliceQpBase         ( m_piRdPicQp    [uiQpIdxBest] );
    735 #endif
    736   setUpLambda(pcSlice, m_pdRdPicLambda[uiQpIdxBest], m_piRdPicQp    [uiQpIdxBest]);
     723  pcSlice       ->setSliceQpBase         ( m_viRdPicQp    [uiQpIdxBest] );
     724#endif
     725  setUpLambda(pcSlice, m_vdRdPicLambda[uiQpIdxBest], m_viRdPicQp    [uiQpIdxBest]);
    737726}
    738727
Note: See TracChangeset for help on using the changeset viewer.