Ignore:
Timestamp:
13 Nov 2013, 23:25:47 (11 years ago)
Author:
nokia
Message:

Integration of O0194: Support different bit-depth values for different layers, enable weighted prediction for ILR for color gamut scalability.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-4.0-dev/source/Lib/TLibEncoder/WeightPredAnalysis.cpp

    r313 r466  
    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  for ( Int iList =0 ; iList<2 ; iList++ )
    5252  {
    53     for ( Int iRefIdx=0 ; iRefIdx<MAX_NUM_REF ; iRefIdx++ ) 
     53    for ( Int iRefIdx=0 ; iRefIdx<MAX_NUM_REF ; iRefIdx++ )
    5454    {
    5555      for ( Int comp=0 ; comp<3 ;comp++ )
     
    7474  TComPicYuv*   pPic = slice->getPic()->getPicYuvOrg();
    7575  Int   iSample  = 0;
     76#if O0194_WEIGHTED_PREDICTION_CGS
     77  // Define here to assign the parameter of "iSample"
     78  wpACDCParam weightACDCParam[3];
     79#endif
    7680
    7781  // calculate DC/AC value for Y
     
    8185  pOrg = pPic->getLumaAddr();
    8286  Int64  iOrgACY  = xCalcACValueSlice(slice, pOrg, iOrgNormDCY);
     87#if O0194_WEIGHTED_PREDICTION_CGS
     88  weightACDCParam[0].iSamples = iSample;
     89#endif
    8390
    8491  // calculate DC/AC value for Cb
     
    8895  pOrg = pPic->getCbAddr();
    8996  Int64  iOrgACCb  = xCalcACValueUVSlice(slice, pOrg, iOrgNormDCCb);
     97#if O0194_WEIGHTED_PREDICTION_CGS
     98  weightACDCParam[1].iSamples = iSample;
     99#endif
    90100
    91101  // calculate DC/AC value for Cr
     
    95105  pOrg = pPic->getCrAddr();
    96106  Int64  iOrgACCr  = xCalcACValueUVSlice(slice, pOrg, iOrgNormDCCr);
    97 
     107#if O0194_WEIGHTED_PREDICTION_CGS
     108  weightACDCParam[2].iSamples = iSample;
     109#endif
     110
     111#if !O0194_WEIGHTED_PREDICTION_CGS
    98112  wpACDCParam weightACDCParam[3];
     113#endif
    99114  weightACDCParam[0].iAC = iOrgACY;
    100115  weightACDCParam[0].iDC = iOrgNormDCY;
     
    138153  for ( Int iList=0 ; iList<2 ; iList++ )
    139154  {
    140     for ( Int iRefIdx=0 ; iRefIdx<MAX_NUM_REF ; iRefIdx++ ) 
    141     {
    142       for ( Int iComp=0 ; iComp<3 ;iComp++ ) 
     155    for ( Int iRefIdx=0 ; iRefIdx<MAX_NUM_REF ; iRefIdx++ )
     156    {
     157      for ( Int iComp=0 ; iComp<3 ;iComp++ )
    143158      {
    144159        wpScalingParam  *pwp = &(m_wp[iList][iRefIdx][iComp]);
     
    154169    for ( Int iList=0 ; iList<2 ; iList++ )
    155170    {
    156       for ( Int iRefIdx=0 ; iRefIdx<MAX_NUM_REF ; iRefIdx++ ) 
     171      for ( Int iRefIdx=0 ; iRefIdx<MAX_NUM_REF ; iRefIdx++ )
    157172      {
    158         for ( Int iComp=0 ; iComp<3 ;iComp++ ) 
     173        for ( Int iComp=0 ; iComp<3 ;iComp++ )
    159174        {
    160175          wpScalingParam  *pwp = &(m_wp[iList][iRefIdx][iComp]);
     
    195210  // selecting whether WP is used, or not
    196211  xSelectWP(slice, m_wp, iDenom);
    197  
     212
    198213  slice->setWpScaling( m_wp );
    199214
     
    216231      slice->getWpAcDcParam(currWeightACDCParam);
    217232      slice->getRefPic(eRefPicList, refIdxTemp)->getSlice(0)->getWpAcDcParam(refWeightACDCParam);
     233#if O0194_WEIGHTED_PREDICTION_CGS
     234      if (slice->getRefPic(eRefPicList, refIdxTemp)->isILR(1)){
     235        refWeightACDCParam = (wpACDCParam *)g_refWeightACDCParam;
     236      }
     237#endif
    218238
    219239      for ( Int comp = 0; comp < 3; comp++ )
     
    229249        Int64 refDC = refWeightACDCParam[comp].iDC;
    230250        Int64 refAC = refWeightACDCParam[comp].iAC;
     251#if O0194_WEIGHTED_PREDICTION_CGS
     252        if (slice->getRefPic(eRefPicList, refIdxTemp)->isILR(1)){
     253          refAC *= (double)currWeightACDCParam[comp].iSamples/refWeightACDCParam[comp].iSamples;
     254#if O0194_JOINT_US_BITSHIFT
     255          refAC *= (1<<(g_bitDepthYLayer[1]-g_bitDepthYLayer[0]));
     256          refDC *= (1<<(g_bitDepthYLayer[1]-g_bitDepthYLayer[0]));
     257#endif
     258         }
     259#endif
    231260
    232261        // calculating iWeight and iOffset params
     
    234263        Int weight = (Int)( 0.5 + dWeight * (Double)(1<<log2Denom) );
    235264        Int offset = (Int)( ((currDC<<log2Denom) - ((Int64)weight * refDC) + (Int64)realOffset) >> realLog2Denom );
     265#if O0194_WEIGHTED_PREDICTION_CGS
     266        if (slice->getRefPic(eRefPicList, refIdxTemp)->isILR(1)){
     267        }
     268        else{
     269          dWeight = 1;
     270          offset  = 0;
     271        }
     272        weight = (Int)( 0.5 + dWeight * (Double)(1<<log2Denom) );
     273#endif
    236274
    237275        // Chroma offset range limitation
     
    253291        if(deltaWeight > 127 || deltaWeight < -128)
    254292          return (false);
     293#if O0194_WEIGHTED_PREDICTION_CGS
     294        // make sure the reference frames other than ILR are not using weighted prediction
     295        if (!(slice->getRefPic(eRefPicList, refIdxTemp)->isILR(1))){
     296          continue;
     297        }
     298#endif
    255299
    256300        m_wp[refList][refIdxTemp][comp].bPresentFlag = true;
     
    264308}
    265309
    266 /** select whether weighted pred enables or not. 
     310/** select whether weighted pred enables or not.
    267311 * \param TComSlice *slice
    268312 * \param wpScalingParam
     
    325369}
    326370
    327 /** calculate DC value of original image for luma. 
     371/** calculate DC value of original image for luma.
    328372 * \param TComSlice *slice
    329373 * \param Pel *pPel
     
    345389}
    346390
    347 /** calculate AC value of original image for luma. 
     391/** calculate AC value of original image for luma.
    348392 * \param TComSlice *slice
    349393 * \param Pel *pPel
     
    363407}
    364408
    365 /** calculate DC value of original image for chroma. 
     409/** calculate DC value of original image for chroma.
    366410 * \param TComSlice *slice
    367411 * \param Pel *pPel
     
    383427}
    384428
    385 /** calculate AC value of original image for chroma. 
     429/** calculate AC value of original image for chroma.
    386430 * \param TComSlice *slice
    387431 * \param Pel *pPel
     
    401445}
    402446
    403 /** calculate DC value. 
     447/** calculate DC value.
    404448 * \param Pel *pPel
    405449 * \param Int iWidth
     
    423467}
    424468
    425 /** calculate AC value. 
     469/** calculate AC value.
    426470 * \param Pel *pPel
    427471 * \param Int iWidth
     
    446490}
    447491
    448 /** calculate SAD values for both WP version and non-WP version. 
     492/** calculate SAD values for both WP version and non-WP version.
    449493 * \param Pel *pOrgPel
    450494 * \param Pel *pRefPel
Note: See TracChangeset for help on using the changeset viewer.