Changeset 1397 in SHVCSoftware


Ignore:
Timestamp:
4 Aug 2015, 03:26:38 (9 years ago)
Author:
seregin
Message:

port rev 4550

Location:
branches/SHM-dev/source/Lib
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-dev/source/Lib/TLibCommon/TComRdCost.cpp

    r1395 r1397  
    194194  // initialize
    195195  rcDistParam.iSubShift  = 0;
     196  rcDistParam.m_maximumDistortionForEarlyExit = std::numeric_limits<Distortion>::max();
    196197}
    197198
     
    210211  rcDistParam.iRows    = pcPatternKey->getROIYHeight();
    211212  rcDistParam.DistFunc = m_afpDistortFunc[DF_SAD + g_aucConvertToBit[ rcDistParam.iCols ] + 1 ];
     213  rcDistParam.m_maximumDistortionForEarlyExit = std::numeric_limits<Distortion>::max();
    212214
    213215  if (rcDistParam.iCols == 12)
     
    244246  rcDistParam.iCols    = pcPatternKey->getROIYWidth();
    245247  rcDistParam.iRows    = pcPatternKey->getROIYHeight();
     248
     249  rcDistParam.m_maximumDistortionForEarlyExit = std::numeric_limits<Distortion>::max();
    246250
    247251  // set distortion function
     
    283287  rcDP.bitDepth     = bitDepth;
    284288  rcDP.DistFunc     = m_afpDistortFunc[ ( bHadamard ? DF_HADS : DF_SADS ) + g_aucConvertToBit[ iWidth ] + 1 ];
     289  rcDP.m_maximumDistortionForEarlyExit = std::numeric_limits<Distortion>::max();
    285290}
    286291
     
    358363    return TComRdCostWeightPrediction::xGetSADw( pcDtParam );
    359364  }
    360   const Pel* piOrg   = pcDtParam->pOrg;
    361   const Pel* piCur   = pcDtParam->pCur;
    362   Int  iRows   = pcDtParam->iRows;
    363   Int  iCols   = pcDtParam->iCols;
    364   Int  iStrideCur = pcDtParam->iStrideCur;
    365   Int  iStrideOrg = pcDtParam->iStrideOrg;
     365  const Pel* piOrg           = pcDtParam->pOrg;
     366  const Pel* piCur           = pcDtParam->pCur;
     367  const Int  iCols           = pcDtParam->iCols;
     368  const Int  iStrideCur      = pcDtParam->iStrideCur;
     369  const Int  iStrideOrg      = pcDtParam->iStrideOrg;
     370  const UInt distortionShift = DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth - 8);
    366371
    367372  Distortion uiSum = 0;
    368373
    369   for( ; iRows != 0; iRows-- )
     374  for(Int iRows = pcDtParam->iRows ; iRows != 0; iRows-- )
    370375  {
    371376    for (Int n = 0; n < iCols; n++ )
     
    373378      uiSum += abs( piOrg[n] - piCur[n] );
    374379    }
    375     piOrg += iStrideOrg;
    376     piCur += iStrideCur;
    377   }
    378 
    379   return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8) );
     380    if (pcDtParam->m_maximumDistortionForEarlyExit < ( uiSum >> distortionShift ))
     381    {
     382      return ( uiSum >> distortionShift );
     383    }
     384    piOrg += iStrideOrg;
     385    piCur += iStrideCur;
     386  }
     387
     388  return ( uiSum >> distortionShift );
    380389}
    381390
  • branches/SHM-dev/source/Lib/TLibCommon/TComRdCost.h

    r1395 r1397  
    8181  const WPScalingParam *wpCur;           // weighted prediction scaling parameters for current ref
    8282  ComponentID           compIdx;
     83  Distortion            m_maximumDistortionForEarlyExit; /// During cost calculations, if distortion exceeds this value, cost calculations may early-terminate.
    8384
    8485  // (vertical) subsampling shift (for reducing complexity)
     
    99100     wpCur(NULL),
    100101     compIdx(MAX_NUM_COMPONENT),
     102     m_maximumDistortionForEarlyExit(std::numeric_limits<Distortion>::max()),
    101103     iSubShift(0)
    102104  { }
  • branches/SHM-dev/source/Lib/TLibCommon/TComRdCostWeightPrediction.cpp

    r1259 r1397  
    7070  const Int             shift      = wpCur.shift;
    7171  const Int             round      = wpCur.round;
     72  const Int        distortionShift = DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
    7273
    7374  Distortion uiSum = 0;
     
    8081
    8182      uiSum += abs( piOrg[n] - pred );
     83    }
     84    if (pcDtParam->m_maximumDistortionForEarlyExit <  ( uiSum >> distortionShift))
     85    {
     86      return uiSum >> distortionShift;
    8287    }
    8388    piOrg += iStrideOrg;
     
    8792  pcDtParam->compIdx = MAX_NUM_COMPONENT;  // reset for DEBUG (assert test)
    8893
    89   return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
     94  return uiSum >> distortionShift;
    9095}
    9196
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncSearch.cpp

    r1389 r1397  
    386386  // distortion
    387387  m_cDistParam.bitDepth = pcPatternKey->getBitDepthY();
     388  m_cDistParam.m_maximumDistortionForEarlyExit = rcStruct.uiBestSad;
     389
    388390  if(m_pcEncCfg->getFastSearch() == SELECTIVE)
    389391  {
     
    439441          rcStruct.uiBestRound    = 0;
    440442          rcStruct.ucPointNr      = ucPointNr;
     443          m_cDistParam.m_maximumDistortionForEarlyExit = uiSad;
    441444        }
    442445      }
     
    458461      rcStruct.uiBestRound    = 0;
    459462      rcStruct.ucPointNr      = ucPointNr;
     463      m_cDistParam.m_maximumDistortionForEarlyExit = uiSad;
    460464    }
    461465  }
     
    882886      uiDistBest  = uiDist;
    883887      uiDirecBest = i;
     888      m_cDistParam.m_maximumDistortionForEarlyExit = uiDist;
    884889    }
    885890  }
     
    34043409            }
    34053410          }
    3406 #if (ENCODER_FAST_MODE)
     3411#if ENCODER_FAST_MODE
    34073412          }
    34083413#endif
    34093414        }
    3410 #if (ENCODER_FAST_MODE)
     3415#if ENCODER_FAST_MODE
    34113416        } // for loop-iRefIdxTemp
    34123417#endif
     
    40644069        iBestX    = x;
    40654070        iBestY    = y;
     4071        m_cDistParam.m_maximumDistortionForEarlyExit = uiSad;
    40664072      }
    40674073    }
Note: See TracChangeset for help on using the changeset viewer.