Changeset 1240 in SHVCSoftware


Ignore:
Timestamp:
13 Jul 2015, 21:01:49 (9 years ago)
Author:
seregin
Message:

port rev 4228

Location:
branches/SHM-dev/source/Lib/TLibCommon
Files:
2 edited

Legend:

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

    r1239 r1240  
    16391639  UInt uiY = 0;
    16401640
    1641         UInt &majorAxis             = (mode == RDPCM_HOR) ? uiX      : uiY;
    1642         UInt &minorAxis             = (mode == RDPCM_HOR) ? uiY      : uiX;
    1643   const UInt  majorAxisLimit        = (mode == RDPCM_HOR) ? uiWidth  : uiHeight;
    1644   const UInt  minorAxisLimit        = (mode == RDPCM_HOR) ? uiHeight : uiWidth;
    1645   const UInt  referenceSampleOffset = (mode == RDPCM_HOR) ? 1        : uiWidth;
    1646 
    1647   const Bool bUseHalfRoundingPoint = (mode != RDPCM_OFF);
     1641        UInt &majorAxis             = (mode == RDPCM_VER) ? uiX      : uiY;
     1642        UInt &minorAxis             = (mode == RDPCM_VER) ? uiY      : uiX;
     1643  const UInt  majorAxisLimit        = (mode == RDPCM_VER) ? uiWidth  : uiHeight;
     1644  const UInt  minorAxisLimit        = (mode == RDPCM_VER) ? uiHeight : uiWidth;
     1645  static const TCoeff pelMin=(Int) std::numeric_limits<Pel>::min();
     1646  static const TCoeff pelMax=(Int) std::numeric_limits<Pel>::max();
     1647
     1648  const Bool bUseHalfRoundingPoint  = (mode != RDPCM_OFF);
    16481649
    16491650  uiAbsSum = 0;
     
    16511652  for ( majorAxis = 0; majorAxis < majorAxisLimit; majorAxis++ )
    16521653  {
     1654    TCoeff accumulatorValue = 0; // 32-bit accumulator
    16531655    for ( minorAxis = 0; minorAxis < minorAxisLimit; minorAxis++ )
    16541656    {
     
    16561658      const UInt coefficientIndex = (rotateResidual ? (uiSizeMinus1-sampleIndex) : sampleIndex);
    16571659      const Pel  currentSample    = pcResidual[(uiY * uiStride) + uiX];
    1658       const Pel  referenceSample  = ((mode != RDPCM_OFF) && (majorAxis > 0)) ? reconstructedResi[sampleIndex - referenceSampleOffset] : 0;
    1659 
    1660       const Pel  encoderSideDelta = currentSample - referenceSample;
     1660      const TCoeff encoderSideDelta = TCoeff(currentSample) - accumulatorValue;
    16611661
    16621662      Pel reconstructedDelta;
     
    16741674      uiAbsSum += abs(pcCoeff[coefficientIndex]);
    16751675
    1676       reconstructedResi[sampleIndex] = reconstructedDelta + referenceSample;
     1676      if (mode == RDPCM_OFF)
     1677      {
     1678        reconstructedResi[sampleIndex] = reconstructedDelta;
     1679      }
     1680      else
     1681      {
     1682        accumulatorValue += reconstructedDelta;
     1683        reconstructedResi[sampleIndex] = (Pel) Clip3<TCoeff>(pelMin, pelMax, accumulatorValue);
     1684      }
    16771685    }
    16781686  }
     
    17731781    }
    17741782
     1783    static const TCoeff pelMin=(TCoeff) std::numeric_limits<Pel>::min();
     1784    static const TCoeff pelMax=(TCoeff) std::numeric_limits<Pel>::max();
    17751785    if (rdpcmMode == RDPCM_VER)
    17761786    {
    1777       pcResidual += uiStride; //start from row 1
    1778 
    1779       for( UInt uiY = 1; uiY < uiHeight; uiY++ )
    1780       {
    1781         for( UInt uiX = 0; uiX < uiWidth; uiX++ )
     1787      for( UInt uiX = 0; uiX < uiWidth; uiX++ )
     1788      {
     1789        Pel *pcCurResidual = pcResidual+uiX;
     1790        TCoeff accumulator = *pcCurResidual; // 32-bit accumulator
     1791        pcCurResidual+=uiStride;
     1792        for( UInt uiY = 1; uiY < uiHeight; uiY++, pcCurResidual+=uiStride )
    17821793        {
    1783           pcResidual[ uiX ] = pcResidual[ uiX ] + pcResidual [ (Int)uiX - (Int)uiStride ];
     1794          accumulator += *(pcCurResidual);
     1795          *pcCurResidual = (Pel)Clip3<TCoeff>(pelMin, pelMax, accumulator);
    17841796        }
    1785         pcResidual += uiStride;
    17861797      }
    17871798    }
     
    17901801      for( UInt uiY = 0; uiY < uiHeight; uiY++ )
    17911802      {
    1792         for( UInt uiX = 1; uiX < uiWidth; uiX++ )
     1803        Pel *pcCurResidual = pcResidual+uiY*uiStride;
     1804        TCoeff accumulator = *pcCurResidual;
     1805        pcCurResidual++;
     1806        for( UInt uiX = 1; uiX < uiWidth; uiX++, pcCurResidual++ )
    17931807        {
    1794           pcResidual[ uiX ] = pcResidual[ uiX ] + pcResidual [ (Int)uiX-1 ];
     1808          accumulator += *(pcCurResidual);
     1809          *pcCurResidual = (Pel)Clip3<TCoeff>(pelMin, pelMax, accumulator);
    17951810        }
    1796         pcResidual += uiStride;
    17971811      }
    17981812    }
     
    31463160}
    31473161
    3148 Void TComTrQuant::transformSkipQuantOneSample(TComTU &rTu, const ComponentID compID, const Pel resiDiff, TCoeff* pcCoeff, const UInt uiPos, const QpParam &cQP, const Bool bUseHalfRoundingPoint)
     3162Void TComTrQuant::transformSkipQuantOneSample(TComTU &rTu, const ComponentID compID, const TCoeff resiDiff, TCoeff* pcCoeff, const UInt uiPos, const QpParam &cQP, const Bool bUseHalfRoundingPoint)
    31493163{
    31503164        TComDataCU    *pcCU                           = rTu.getCU();
  • branches/SHM-dev/source/Lib/TLibCommon/TComTrQuant.h

    r1235 r1240  
    195195  Double* getSliceSumC()    { return m_sliceSumC; }
    196196#endif
    197   Void transformSkipQuantOneSample(TComTU &rTu, const ComponentID compID, const Pel resiDiff, TCoeff* pcCoeff, const UInt uiPos, const QpParam &cQP, const Bool bUseHalfRoundingPoint);
     197  Void transformSkipQuantOneSample(TComTU &rTu, const ComponentID compID, const TCoeff resiDiff, TCoeff* pcCoeff, const UInt uiPos, const QpParam &cQP, const Bool bUseHalfRoundingPoint);
    198198  Void invTrSkipDeQuantOneSample(TComTU &rTu, ComponentID compID, TCoeff pcCoeff, Pel &reconSample, const QpParam &cQP, UInt uiPos );
    199199
Note: See TracChangeset for help on using the changeset viewer.