Changeset 1545 in SHVCSoftware for branches


Ignore:
Timestamp:
22 Mar 2016, 23:52:56 (9 years ago)
Author:
seregin
Message:

port rev 4721

Location:
branches/SHM-dev/source
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.cpp

    r1544 r1545  
    196196  in>>entry.m_POC;
    197197  in>>entry.m_QPOffset;
     198#if W0038_CQP_ADJ
     199  in>>entry.m_CbQPoffset;
     200  in>>entry.m_CrQPoffset;
     201#endif
    198202  in>>entry.m_QPFactor;
    199203  in>>entry.m_tcOffsetDiv2;
     
    13031307  ("CbQpOffset,-cbqpofs",                             m_cbQpOffset,                                         0, "Chroma Cb QP Offset")
    13041308  ("CrQpOffset,-crqpofs",                             m_crQpOffset,                                         0, "Chroma Cr QP Offset")
    1305 
     1309#if W0038_CQP_ADJ
     1310  ("SliceChromaQPOffsetPeriodicity",                  m_sliceChromaQpOffsetPeriodicity,                    0u, "Used in conjunction with Slice Cb/Cr QpOffsetIntraOrPeriodic. Use 0 (default) to disable periodic nature.")
     1311  ("SliceCbQpOffsetIntraOrPeriodic",                  m_sliceChromaQpOffsetIntraOrPeriodic[0],              0, "Chroma Cb QP Offset at slice level for I slice or for periodic inter slices as defined by SliceChromaQPOffsetPeriodicity. Replaces offset in the GOP table.")
     1312  ("SliceCrQpOffsetIntraOrPeriodic",                  m_sliceChromaQpOffsetIntraOrPeriodic[1],              0, "Chroma Cr QP Offset at slice level for I slice or for periodic inter slices as defined by SliceChromaQPOffsetPeriodicity. Replaces offset in the GOP table.")
     1313#endif
    13061314#if ADAPTIVE_QP_SELECTION
    13071315  ("AdaptiveQpSelection,-aqps",                       m_bUseAdaptQpSelect,                              false, "AdaptiveQpSelection")
     
    13271335  ("LoopFilterBetaOffset_div2",                       m_loopFilterBetaOffsetDiv2,                           0)
    13281336  ("LoopFilterTcOffset_div2",                         m_loopFilterTcOffsetDiv2,                             0)
     1337#if W0038_DB_OPT
     1338  ("DeblockingFilterMetric",                          m_deblockingFilterMetric,                             0)
     1339#else
    13291340  ("DeblockingFilterMetric",                          m_DeblockingFilterMetric,                         false)
    1330 
     1341#endif
    13311342  // Coding tools
    13321343  ("AMP",                                             m_enableAMP,                                       true, "Enable asymmetric motion partitions")
     
    34303441
    34313442  xConfirmPara( m_iQP <  -6 * (m_internalBitDepth[CHANNEL_TYPE_LUMA] - 8) || m_iQP > 51,    "QP exceeds supported range (-QpBDOffsety to 51)" );
     3443#if W0038_DB_OPT
     3444  xConfirmPara( m_deblockingFilterMetric!=0 && (m_bLoopFilterDisable || m_loopFilterOffsetInPPS), "If DeblockingFilterMetric is non-zero then both LoopFilterDisable and LoopFilterOffsetInPPS must be 0");
     3445#else
    34323446  xConfirmPara( m_DeblockingFilterMetric && (m_bLoopFilterDisable || m_loopFilterOffsetInPPS), "If DeblockingFilterMetric is true then both LoopFilterDisable and LoopFilterOffsetInPPS must be 0");
     3447#endif
    34333448  xConfirmPara( m_loopFilterBetaOffsetDiv2 < -6 || m_loopFilterBetaOffsetDiv2 > 6,        "Loop Filter Beta Offset div. 2 exceeds supported range (-6 to 6)");
    34343449  xConfirmPara( m_loopFilterTcOffsetDiv2 < -6 || m_loopFilterTcOffsetDiv2 > 6,            "Loop Filter Tc Offset div. 2 exceeds supported range (-6 to 6)");
     
    36113626    }
    36123627  }
     3628
     3629#if W0038_CQP_ADJ
     3630  for(Int i=0; i<m_iGOPSize; i++)
     3631  {
     3632    xConfirmPara( abs(m_GOPList[i].m_CbQPoffset               ) > 12, "Cb QP Offset for one of the GOP entries exceeds supported range (-12 to 12)" );
     3633    xConfirmPara( abs(m_GOPList[i].m_CbQPoffset + m_cbQpOffset) > 12, "Cb QP Offset for one of the GOP entries, when combined with the PPS Cb offset, exceeds supported range (-12 to 12)" );
     3634    xConfirmPara( abs(m_GOPList[i].m_CrQPoffset               ) > 12, "Cr QP Offset for one of the GOP entries exceeds supported range (-12 to 12)" );
     3635    xConfirmPara( abs(m_GOPList[i].m_CrQPoffset + m_crQpOffset) > 12, "Cr QP Offset for one of the GOP entries, when combined with the PPS Cr offset, exceeds supported range (-12 to 12)" );
     3636  }
     3637  xConfirmPara( abs(m_sliceChromaQpOffsetIntraOrPeriodic[0]                 > 12), "Intra/periodic Cb QP Offset exceeds supported range (-12 to 12)" );
     3638  xConfirmPara( abs(m_sliceChromaQpOffsetIntraOrPeriodic[0]  + m_cbQpOffset > 12), "Intra/periodic Cb QP Offset, when combined with the PPS Cb offset, exceeds supported range (-12 to 12)" );
     3639  xConfirmPara( abs(m_sliceChromaQpOffsetIntraOrPeriodic[1]                 > 12), "Intra/periodic Cr QP Offset exceeds supported range (-12 to 12)" );
     3640  xConfirmPara( abs(m_sliceChromaQpOffsetIntraOrPeriodic[1]  + m_crQpOffset > 12), "Intra/periodic Cr QP Offset, when combined with the PPS Cr offset, exceeds supported range (-12 to 12)" );
     3641#endif
    36133642
    36143643  m_extraRPSs=0;
  • branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.h

    r1544 r1545  
    262262  Int       m_cbQpOffset;                                     ///< Chroma Cb QP Offset (0:default)
    263263  Int       m_crQpOffset;                                     ///< Chroma Cr QP Offset (0:default)
    264 
     264#if W0038_CQP_ADJ
     265  UInt      m_sliceChromaQpOffsetPeriodicity;                 ///< Used in conjunction with Slice Cb/Cr QpOffsetIntraOrPeriodic. Use 0 (default) to disable periodic nature.
     266  Int       m_sliceChromaQpOffsetIntraOrPeriodic[2/*Cb,Cr*/]; ///< Chroma Cb QP Offset at slice level for I slice or for periodic inter slices as defined by SliceChromaQPOffsetPeriodicity. Replaces offset in the GOP table.
     267#endif
    265268#if ADAPTIVE_QP_SELECTION
    266269  Bool      m_bUseAdaptQpSelect;
     
    324327  Int       m_loopFilterBetaOffsetDiv2;                     ///< beta offset for deblocking filter
    325328  Int       m_loopFilterTcOffsetDiv2;                       ///< tc offset for deblocking filter
     329#if W0038_DB_OPT
     330  Int       m_deblockingFilterMetric;                         ///< blockiness metric in encoder
     331#else
    326332  Bool      m_DeblockingFilterMetric;                         ///< blockiness metric in encoder
    327 
     333#endif
    328334  // coding tools (PCM)
    329335  Bool      m_usePCM;                                         ///< flag for using IPCM
  • branches/SHM-dev/source/App/TAppEncoder/TAppEncTop.cpp

    r1544 r1545  
    603603  m_cTEncTop.setLoopFilterBetaOffset                              ( m_loopFilterBetaOffsetDiv2  );
    604604  m_cTEncTop.setLoopFilterTcOffset                                ( m_loopFilterTcOffsetDiv2    );
     605#if W0038_DB_OPT
     606  m_cTEncTop.setDeblockingFilterMetric                            ( m_deblockingFilterMetric );
     607#else
    605608  m_cTEncTop.setDeblockingFilterMetric                            ( m_DeblockingFilterMetric );
     609#endif
    606610
    607611  //====== Motion search ========
     
    621625  m_cTEncTop.setChromaCbQpOffset                                  ( m_cbQpOffset     );
    622626  m_cTEncTop.setChromaCrQpOffset                                  ( m_crQpOffset  );
    623 
     627#if W0038_CQP_ADJ
     628  m_cTEncTop.setSliceChromaOffsetQpIntraOrPeriodic                ( m_sliceChromaQpOffsetPeriodicity, m_sliceChromaQpOffsetIntraOrPeriodic );
     629#endif
    624630  m_cTEncTop.setChromaFormatIdc                                   ( m_chromaFormatIDC  );
    625631
  • branches/SHM-dev/source/Lib/TLibCommon/CommonDef.h

    r1543 r1545  
    257257static const Int LAST_SIGNIFICANT_GROUPS =                        10 ;
    258258
     259#if W0038_DB_OPT
     260static const Int MAX_ENCODER_DEBLOCKING_QUALITY_LAYERS =           8 ;
     261#endif
     262
    259263#if SVC_EXTENSION
    260264static const Int CGS_FILTER_LENGTH =                               13;
  • branches/SHM-dev/source/Lib/TLibCommon/TypeDef.h

    r1538 r1545  
    209209#define V0078_ADAPTIVE_LOWER_BOUND                        1 ///< Target bits saturation with adaptive lower bound
    210210#endif
     211#define W0038_DB_OPT                                      1 ///< adaptive DB parameter selection, LoopFilterOffsetInPPS and LoopFilterDisable are set to 0 and DeblockingFilterMetric=2;
     212#define W0038_CQP_ADJ                                     1 ///< chroma QP adjustment based on TL, CQPTLAdjustEnabled is set to 1;
    211213
    212214// ====================================================================================================================
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncCfg.h

    r1544 r1545  
    5151  Int m_POC;
    5252  Int m_QPOffset;
     53#if W0038_CQP_ADJ
     54  Int m_CbQPoffset;
     55  Int m_CrQPoffset;
     56#endif
    5357  Double m_QPFactor;
    5458  Int m_tcOffsetDiv2;
     
    6973  : m_POC(-1)
    7074  , m_QPOffset(0)
     75#if W0038_CQP_ADJ
     76  , m_CbQPoffset(0)
     77  , m_CrQPoffset(0)
     78#endif
    7179  , m_QPFactor(0)
    7280  , m_tcOffsetDiv2(0)
     
    132140
    133141  //====== Coding Structure ========
    134   UInt      m_uiIntraPeriod;
     142  UInt      m_uiIntraPeriod;                    // TODO: make this an Int - it can be -1!
    135143  UInt      m_uiDecodingRefreshType;            ///< the type of decoding refresh employed for the random access.
    136144  Int       m_iGOPSize;
     
    167175  Int       m_loopFilterBetaOffsetDiv2;
    168176  Int       m_loopFilterTcOffsetDiv2;
     177#if W0038_DB_OPT
     178  Int       m_deblockingFilterMetric;
     179#else
    169180  Bool      m_DeblockingFilterMetric;
     181#endif
    170182  Bool      m_bUseSAO;
    171183  Bool      m_bTestSAODisableAtPictureLevel;
     
    192204  Int       m_chromaCbQpOffset;                 //  Chroma Cb QP Offset (0:default)
    193205  Int       m_chromaCrQpOffset;                 //  Chroma Cr Qp Offset (0:default)
     206#if W0038_CQP_ADJ
     207  UInt      m_sliceChromaQpOffsetPeriodicity;                 ///< Used in conjunction with Slice Cb/Cr QpOffsetIntraOrPeriodic. Use 0 (default) to disable periodic nature.
     208  Int       m_sliceChromaQpOffsetIntraOrPeriodic[2/*Cb,Cr*/]; ///< Chroma Cb QP Offset at slice level for I slice or for periodic inter slices as defined by SliceChromaQPOffsetPeriodicity. Replaces offset in the GOP table.
     209#endif
     210
    194211  ChromaFormat m_chromaFormatIDC;
    195212
     
    570587  Void      setLoopFilterBetaOffset         ( Int   i )      { m_loopFilterBetaOffsetDiv2  = i; }
    571588  Void      setLoopFilterTcOffset           ( Int   i )      { m_loopFilterTcOffsetDiv2    = i; }
     589#if W0038_DB_OPT
     590  Void      setDeblockingFilterMetric       ( Int   i )      { m_deblockingFilterMetric = i; }
     591#else
    572592  Void      setDeblockingFilterMetric       ( Bool  b )      { m_DeblockingFilterMetric = b; }
    573 
     593#endif
    574594  //====== Motion search ========
    575595  Void      setDisableIntraPUsInInterSlices ( Bool  b )      { m_bDisableIntraPUsInInterSlices = b; }
     
    591611  Void      setChromaCbQpOffset             ( Int   i )      { m_chromaCbQpOffset = i; }
    592612  Void      setChromaCrQpOffset             ( Int   i )      { m_chromaCrQpOffset = i; }
     613#if W0038_CQP_ADJ
     614  Void      setSliceChromaOffsetQpIntraOrPeriodic( UInt periodicity, Int sliceChromaQpOffsetIntraOrPeriodic[2]) { m_sliceChromaQpOffsetPeriodicity = periodicity; memcpy(m_sliceChromaQpOffsetIntraOrPeriodic, sliceChromaQpOffsetIntraOrPeriodic, sizeof(m_sliceChromaQpOffsetIntraOrPeriodic)); }
     615  Int       getSliceChromaOffsetQpIntraOrPeriodic( Bool bIsCr) const                                            { return m_sliceChromaQpOffsetIntraOrPeriodic[bIsCr?1:0]; }
     616  UInt      getSliceChromaOffsetQpPeriodicity() const                                                           { return m_sliceChromaQpOffsetPeriodicity; }
     617#endif
    593618
    594619  Void      setChromaFormatIdc              ( ChromaFormat cf ) { m_chromaFormatIDC = cf; }
     
    649674  Int       getLoopFilterBetaOffset         ()      { return m_loopFilterBetaOffsetDiv2; }
    650675  Int       getLoopFilterTcOffset           ()      { return m_loopFilterTcOffsetDiv2; }
     676#if W0038_DB_OPT
     677  Int       getDeblockingFilterMetric       ()      { return m_deblockingFilterMetric; }
     678#else
    651679  Bool      getDeblockingFilterMetric       ()      { return m_DeblockingFilterMetric; }
     680#endif
    652681
    653682  //==== Motion search ========
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.cpp

    r1544 r1545  
    105105  m_associatedIRAPType = NAL_UNIT_CODED_SLICE_IDR_N_LP;
    106106  m_associatedIRAPPOC  = 0;
     107#if W0038_DB_OPT
     108  m_pcDeblockingTempPicYuv = NULL;
     109#endif
    107110#if SVC_EXTENSION
    108111  m_pocCraWithoutReset = 0;
     
    156159Void  TEncGOP::destroy()
    157160{
     161#if W0038_DB_OPT
     162  if (m_pcDeblockingTempPicYuv)
     163  {
     164    m_pcDeblockingTempPicYuv->destroy();
     165    delete m_pcDeblockingTempPicYuv;
     166    m_pcDeblockingTempPicYuv = NULL;
     167  }
     168#endif
    158169}
    159170
     
    24912502    if ( m_pcCfg->getDeblockingFilterMetric() )
    24922503    {
    2493       applyDeblockingFilterMetric(pcPic, uiNumSliceSegments);
     2504#if W0038_DB_OPT
     2505      if ( m_pcCfg->getDeblockingFilterMetric()==2 )
     2506      {
     2507        applyDeblockingFilterParameterSelection(pcPic, uiNumSliceSegments, iGOPid);
     2508      }
     2509      else
     2510      {
     2511#endif
     2512        applyDeblockingFilterMetric(pcPic, uiNumSliceSegments);
     2513#if W0038_DB_OPT
     2514      }
     2515#endif
    24942516    }
    24952517    m_pcLoopFilter->loopFilterPic( pcPic );
     
    36913713}
    36923714
     3715#if W0038_DB_OPT
     3716Void TEncGOP::applyDeblockingFilterParameterSelection( TComPic* pcPic, const UInt numSlices, const Int gopID )
     3717{
     3718  enum DBFltParam
     3719  {
     3720    DBFLT_PARAM_AVAILABLE = 0,
     3721    DBFLT_DISABLE_FLAG,
     3722    DBFLT_BETA_OFFSETD2,
     3723    DBFLT_TC_OFFSETD2,
     3724    //NUM_DBFLT_PARAMS
     3725  };
     3726  const Int MAX_BETA_OFFSET = 3;
     3727  const Int MIN_BETA_OFFSET = -3;
     3728  const Int MAX_TC_OFFSET = 3;
     3729  const Int MIN_TC_OFFSET = -3;
     3730
     3731  TComPicYuv* pcPicYuvRec = pcPic->getPicYuvRec();
     3732  TComPicYuv* pcPicYuvOrg = pcPic ->getPicYuvOrg();
     3733
     3734  const Int currQualityLayer = (pcPic->getSlice(0)->getSliceType() != I_SLICE) ? m_pcCfg->getGOPEntry(gopID).m_temporalId+1 : 0;
     3735  assert(currQualityLayer <MAX_ENCODER_DEBLOCKING_QUALITY_LAYERS);
     3736
     3737  if(!m_pcDeblockingTempPicYuv)
     3738  {
     3739    m_pcDeblockingTempPicYuv         = new TComPicYuv;
     3740    m_pcDeblockingTempPicYuv->create( m_pcEncTop->getSourceWidth(), m_pcEncTop->getSourceHeight(), m_pcEncTop->getChromaFormatIdc(),  pcPic->getSlice(0)->getSPS()->getMaxCUWidth(), pcPic->getSlice(0)->getSPS()->getMaxCUHeight(), pcPic->getSlice(0)->getSPS()->getMaxTotalCUDepth(),true );
     3741    memset(m_DBParam, 0, sizeof(m_DBParam));
     3742  }
     3743
     3744  //preserve current reconstruction
     3745  pcPicYuvRec->copyToPic(m_pcDeblockingTempPicYuv);
     3746
     3747  const Bool bNoFiltering      = m_DBParam[currQualityLayer][DBFLT_PARAM_AVAILABLE] && m_DBParam[currQualityLayer][DBFLT_DISABLE_FLAG]==false /*&& pcPic->getTLayer()==0*/;
     3748  const Int  maxBetaOffsetDiv2 = bNoFiltering? Clip3(MIN_BETA_OFFSET, MAX_BETA_OFFSET, m_DBParam[currQualityLayer][DBFLT_BETA_OFFSETD2]+1) : MAX_BETA_OFFSET;
     3749  const Int  minBetaOffsetDiv2 = bNoFiltering? Clip3(MIN_BETA_OFFSET, MAX_BETA_OFFSET, m_DBParam[currQualityLayer][DBFLT_BETA_OFFSETD2]-1) : MIN_BETA_OFFSET;
     3750  const Int  maxTcOffsetDiv2   = bNoFiltering? Clip3(MIN_TC_OFFSET, MAX_TC_OFFSET, m_DBParam[currQualityLayer][DBFLT_TC_OFFSETD2]+2)       : MAX_TC_OFFSET;
     3751  const Int  minTcOffsetDiv2   = bNoFiltering? Clip3(MIN_TC_OFFSET, MAX_TC_OFFSET, m_DBParam[currQualityLayer][DBFLT_TC_OFFSETD2]-2)       : MIN_TC_OFFSET;
     3752
     3753  UInt64 distBetaPrevious      = std::numeric_limits<UInt64>::max();
     3754  UInt64 distMin               = std::numeric_limits<UInt64>::max();
     3755  Bool   bDBFilterDisabledBest = true;
     3756  Int    betaOffsetDiv2Best    = 0;
     3757  Int    tcOffsetDiv2Best      = 0;
     3758
     3759  for(Int betaOffsetDiv2=maxBetaOffsetDiv2; betaOffsetDiv2>=minBetaOffsetDiv2; betaOffsetDiv2--)
     3760  {
     3761    UInt64 distTcMin = std::numeric_limits<UInt64>::max();
     3762    for(Int tcOffsetDiv2=maxTcOffsetDiv2; tcOffsetDiv2 >= minTcOffsetDiv2; tcOffsetDiv2--)
     3763    {
     3764      for (Int i=0; i<numSlices; i++)
     3765      {
     3766        pcPic->getSlice(i)->setDeblockingFilterOverrideFlag(true);
     3767        pcPic->getSlice(i)->setDeblockingFilterDisable(false);
     3768        pcPic->getSlice(i)->setDeblockingFilterBetaOffsetDiv2( betaOffsetDiv2 );
     3769        pcPic->getSlice(i)->setDeblockingFilterTcOffsetDiv2( tcOffsetDiv2 );
     3770      }
     3771      m_pcDeblockingTempPicYuv->copyToPic(pcPicYuvRec); // restore reconstruction
     3772      m_pcLoopFilter->loopFilterPic( pcPic );
     3773      const UInt64 dist = xFindDistortionFrame(pcPicYuvOrg, pcPicYuvRec, pcPic->getPicSym()->getSPS().getBitDepths());
     3774      if(dist < distMin)
     3775      {
     3776        distMin = dist;
     3777        bDBFilterDisabledBest = false;
     3778        betaOffsetDiv2Best  = betaOffsetDiv2;
     3779        tcOffsetDiv2Best = tcOffsetDiv2;
     3780      }
     3781      if(dist < distTcMin)
     3782      {
     3783        distTcMin = dist;
     3784      }
     3785      else if(tcOffsetDiv2 <-2)
     3786      {
     3787        break;
     3788      }
     3789    }
     3790    if(betaOffsetDiv2<-1 && distTcMin >= distBetaPrevious)
     3791    {
     3792      break;
     3793    }
     3794    distBetaPrevious = distTcMin;
     3795  }
     3796
     3797  //update:
     3798  m_DBParam[currQualityLayer][DBFLT_PARAM_AVAILABLE] = 1;
     3799  m_DBParam[currQualityLayer][DBFLT_DISABLE_FLAG]    = bDBFilterDisabledBest;
     3800  m_DBParam[currQualityLayer][DBFLT_BETA_OFFSETD2]   = betaOffsetDiv2Best;
     3801  m_DBParam[currQualityLayer][DBFLT_TC_OFFSETD2]     = tcOffsetDiv2Best;
     3802
     3803  m_pcDeblockingTempPicYuv->copyToPic(pcPicYuvRec); //restore reconstruction
     3804
     3805  if(bDBFilterDisabledBest)
     3806  {
     3807    for (Int i=0; i<numSlices; i++)
     3808    {
     3809      pcPic->getSlice(i)->setDeblockingFilterOverrideFlag(true);
     3810      pcPic->getSlice(i)->setDeblockingFilterDisable(true);
     3811    }
     3812  }
     3813  else if(betaOffsetDiv2Best ==pcPic->getSlice(0)->getPPS()->getDeblockingFilterBetaOffsetDiv2() &&  tcOffsetDiv2Best==pcPic->getSlice(0)->getPPS()->getDeblockingFilterTcOffsetDiv2())
     3814  {
     3815    for (Int i=0; i<numSlices; i++)
     3816    {
     3817      pcPic->getSlice(i)->setDeblockingFilterOverrideFlag(false);
     3818      pcPic->getSlice(i)->setDeblockingFilterDisable(        pcPic->getSlice(i)->getPPS()->getPicDisableDeblockingFilterFlag() );
     3819      pcPic->getSlice(i)->setDeblockingFilterBetaOffsetDiv2( pcPic->getSlice(i)->getPPS()->getDeblockingFilterBetaOffsetDiv2() );
     3820      pcPic->getSlice(i)->setDeblockingFilterTcOffsetDiv2(   pcPic->getSlice(i)->getPPS()->getDeblockingFilterTcOffsetDiv2()   );
     3821    }
     3822  }
     3823  else
     3824  {
     3825    for (Int i=0; i<numSlices; i++)
     3826    {
     3827      pcPic->getSlice(i)->setDeblockingFilterOverrideFlag(true);
     3828      pcPic->getSlice(i)->setDeblockingFilterDisable( false );
     3829      pcPic->getSlice(i)->setDeblockingFilterBetaOffsetDiv2(betaOffsetDiv2Best);
     3830      pcPic->getSlice(i)->setDeblockingFilterTcOffsetDiv2(tcOffsetDiv2Best);
     3831    }
     3832  }
     3833}
     3834#endif
     3835
    36933836#if SVC_EXTENSION
    36943837#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.h

    r1502 r1545  
    137137  Bool                    m_bufferingPeriodSEIPresentInAU;
    138138  SEIEncoder              m_seiEncoder;
     139#if W0038_DB_OPT
     140  TComPicYuv*             m_pcDeblockingTempPicYuv;
     141  Int                     m_DBParam[MAX_ENCODER_DEBLOCKING_QUALITY_LAYERS][4];   //[layer_id][0: available; 1: bDBDisabled; 2: Beta Offset Div2; 3: Tc Offset Div2;]
     142#endif
    139143
    140144#if SVC_EXTENSION
     
    270274
    271275  Void applyDeblockingFilterMetric( TComPic* pcPic, UInt uiNumSlices );
     276#if W0038_DB_OPT
     277  Void applyDeblockingFilterParameterSelection( TComPic* pcPic, const UInt numSlices, const Int gopID );
     278#endif
    272279
    273280#if SVC_EXTENSION
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncSlice.cpp

    r1540 r1545  
    391391  const std::vector<Double> &intraLambdaModifiers=m_pcCfg->getIntraLambdaModifier();
    392392
     393#if W0038_CQP_ADJ
     394  if(rpcSlice->getPPS()->getSliceChromaQpFlag())
     395  {
     396    const Bool bUseIntraOrPeriodicOffset = rpcSlice->getSliceType()==I_SLICE || (m_pcCfg->getSliceChromaOffsetQpPeriodicity()!=0 && (rpcSlice->getPOC()%m_pcCfg->getSliceChromaOffsetQpPeriodicity())==0);
     397    Int cbQP = bUseIntraOrPeriodicOffset? m_pcCfg->getSliceChromaOffsetQpIntraOrPeriodic(false) : m_pcCfg->getGOPEntry(iGOPid).m_CbQPoffset;
     398    Int crQP = bUseIntraOrPeriodicOffset? m_pcCfg->getSliceChromaOffsetQpIntraOrPeriodic(true)  : m_pcCfg->getGOPEntry(iGOPid).m_CrQPoffset;
     399
     400    cbQP = Clip3( -12, 12, cbQP + rpcSlice->getPPS()->getQpOffset(COMPONENT_Cb) ) - rpcSlice->getPPS()->getQpOffset(COMPONENT_Cb);
     401    crQP = Clip3( -12, 12, crQP + rpcSlice->getPPS()->getQpOffset(COMPONENT_Cr) ) - rpcSlice->getPPS()->getQpOffset(COMPONENT_Cr);
     402    rpcSlice->setSliceChromaQpDelta(COMPONENT_Cb, Clip3( -12, 12, cbQP));
     403    assert(rpcSlice->getSliceChromaQpDelta(COMPONENT_Cb)+rpcSlice->getPPS()->getQpOffset(COMPONENT_Cb)<=12 && rpcSlice->getSliceChromaQpDelta(COMPONENT_Cb)+rpcSlice->getPPS()->getQpOffset(COMPONENT_Cb)>=-12);
     404    rpcSlice->setSliceChromaQpDelta(COMPONENT_Cr, Clip3( -12, 12, crQP));
     405    assert(rpcSlice->getSliceChromaQpDelta(COMPONENT_Cr)+rpcSlice->getPPS()->getQpOffset(COMPONENT_Cr)<=12 && rpcSlice->getSliceChromaQpDelta(COMPONENT_Cr)+rpcSlice->getPPS()->getQpOffset(COMPONENT_Cr)>=-12);
     406  }
     407  else
     408  {
     409    rpcSlice->setSliceChromaQpDelta( COMPONENT_Cb, 0 );
     410    rpcSlice->setSliceChromaQpDelta( COMPONENT_Cr, 0 );
     411  }
     412#endif
     413
    393414  Double lambdaModifier;
    394415  if( rpcSlice->getSliceType( ) != I_SLICE || intraLambdaModifiers.empty())
     
    446467#endif
    447468  rpcSlice->setSliceQpDelta      ( 0 );
     469#if !W0038_CQP_ADJ
    448470  rpcSlice->setSliceChromaQpDelta( COMPONENT_Cb, 0 );
    449471  rpcSlice->setSliceChromaQpDelta( COMPONENT_Cr, 0 );
     472#endif
    450473  rpcSlice->setUseChromaQpAdj( rpcSlice->getPPS()->getPpsRangeExtension().getChromaQpOffsetListEnabledFlag() );
    451474  rpcSlice->setNumRefIdx(REF_PIC_LIST_0,m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive);
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncTop.cpp

    r1544 r1545  
    12691269  m_cPPS.setQpOffset(COMPONENT_Cb, m_chromaCbQpOffset );
    12701270  m_cPPS.setQpOffset(COMPONENT_Cr, m_chromaCrQpOffset );
     1271#if W0038_CQP_ADJ
     1272  Bool bChromaDeltaQPEnabled = false;
     1273  {
     1274    bChromaDeltaQPEnabled = ( m_sliceChromaQpOffsetIntraOrPeriodic[0] || m_sliceChromaQpOffsetIntraOrPeriodic[1] );
     1275    if( !bChromaDeltaQPEnabled )
     1276    {
     1277      for( Int i=0; i<m_iGOPSize; i++ )
     1278      {
     1279        if( m_GOPList[i].m_CbQPoffset || m_GOPList[i].m_CrQPoffset )
     1280        {
     1281          bChromaDeltaQPEnabled = true;
     1282          break;
     1283        }
     1284      }
     1285    }
     1286  }
     1287  m_cPPS.setSliceChromaQpFlag(bChromaDeltaQPEnabled);
     1288#endif
    12711289
    12721290  m_cPPS.setEntropyCodingSyncEnabledFlag( m_entropyCodingSyncEnabledFlag );
Note: See TracChangeset for help on using the changeset viewer.