Ticket #560: transform_skip.patch

File transform_skip.patch, 3.0 KB (added by cuilinglan, 13 years ago)
  • TLibCommon/TComTrQuant.cpp

     
    16361636#else
    16371637  UInt uiBitDepth = g_uiBitDepth + g_uiBitIncrement;
    16381638#endif
    1639   UInt iTransformShift = MAX_TR_DYNAMIC_RANGE - uiBitDepth - uiLog2TrSize;
    1640   Int j,k;
    1641   for (j = 0; j < height; j++)
    1642   {   
    1643     for(k = 0; k < width; k ++)
    1644     {
    1645       psCoeff[j*height + k] = piBlkResi[j * uiStride + k] << iTransformShift;     
     1639  Int  shift = MAX_TR_DYNAMIC_RANGE - uiBitDepth - uiLog2TrSize;
     1640  UInt transformSkipShift;
     1641  Int  j,k;
     1642  if(shift > 0)
     1643  {
     1644    transformSkipShift = shift;
     1645    for (j = 0; j < height; j++)
     1646    {   
     1647      for(k = 0; k < width; k ++)
     1648      {
     1649        psCoeff[j*height + k] = piBlkResi[j * uiStride + k] << transformSkipShift;     
     1650      }
    16461651    }
    16471652  }
     1653  else
     1654  {
     1655    //The case when uiBitDepth >= 13
     1656    transformSkipShift = - shift;
     1657    for (j = 0; j < height; j++)
     1658    {   
     1659      for(k = 0; k < width; k ++)
     1660      {
     1661        psCoeff[j*height + k] = piBlkResi[j * uiStride + k] >> transformSkipShift;     
     1662      }
     1663    }
     1664  }
    16481665}
    16491666
    16501667/** Wrapper function between HM interface and core NxN transform skipping
     
    16621679#else
    16631680  UInt uiBitDepth = g_uiBitDepth + g_uiBitIncrement;
    16641681#endif
    1665   UInt iTransformShift = MAX_TR_DYNAMIC_RANGE - uiBitDepth - uiLog2TrSize;
    1666   UInt iAdd = (1 << (iTransformShift -1));
    1667   Int j,k;
    1668   for ( j = 0; j < height; j++ )
    1669   {   
    1670     for(k = 0; k < width; k ++)
    1671     {
    1672       pResidual[j * uiStride + k] =  (plCoef[j*width+k] + iAdd) >> iTransformShift;
     1682  Int  shift = MAX_TR_DYNAMIC_RANGE - uiBitDepth - uiLog2TrSize;
     1683  UInt transformSkipShift;
     1684  Int  j,k;
     1685  if(shift > 0)
     1686  {
     1687    UInt iAdd;
     1688    transformSkipShift = shift;
     1689    iAdd = (1 << (transformSkipShift -1));
     1690    for ( j = 0; j < height; j++ )
     1691    {   
     1692      for(k = 0; k < width; k ++)
     1693      {
     1694        pResidual[j * uiStride + k] =  (plCoef[j*width+k] + iAdd) >> transformSkipShift;
     1695      }
    16731696    }
    16741697  }
     1698  else
     1699  {
     1700    //The case when uiBitDepth >= 13
     1701    transformSkipShift = - shift;
     1702    for ( j = 0; j < height; j++ )
     1703    {   
     1704      for(k = 0; k < width; k ++)
     1705      {
     1706        pResidual[j * uiStride + k] =  plCoef[j*width+k] << transformSkipShift;
     1707      }
     1708    }
     1709  }
    16751710}
    16761711#endif
    16771712
  • TLibDecoder/TDecSbac.cpp

     
    11221122 
    11231123  UInt useTansformSkip;
    11241124  m_pcTDecBinIf->decodeBin( useTansformSkip , m_cTransformSkipSCModel.get( 0, eTType? TEXT_CHROMA: TEXT_LUMA, 0 ) );
    1125   if(eTType!= TEXT_LUMA && uiDepth == 4)
     1125  if(eTType!= TEXT_LUMA)
    11261126  {
    1127     uiDepth --;
     1127    const UInt uiLog2TrafoSize = g_aucConvertToBit[pcCU->getSlice()->getSPS()->getMaxCUWidth()] + 2 - uiDepth;
     1128    if(uiLog2TrafoSize == 2)
     1129    {
     1130      uiDepth --;
     1131    }
    11281132  }
    11291133  DTRACE_CABAC_VL( g_nSymbolCounter++ )
    11301134  DTRACE_CABAC_T("\tparseTransformSkip()");