Changeset 1313 in 3DVCSoftware for trunk/source/Lib/TLibRenderer/TRenFilter.cpp


Ignore:
Timestamp:
13 Aug 2015, 17:38:13 (9 years ago)
Author:
tech
Message:

Merged 14.1-update-dev1@1312.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/Lib/TLibRenderer/TRenFilter.cpp

    r1179 r1313  
    3636#include "TRenFilter.h"
    3737#include "TRenInterpFilter.h"
    38 #if H_3D
     38#if NH_3D
    3939
    4040///// COMMON /////
    41 Void TRenFilter::setSubPelShiftLUT( Int iLutPrec, Int** piSubPelShiftLUT, Int iShift )
     41template<UInt bitDepth>
     42Void TRenFilter<bitDepth>::setSubPelShiftLUT( Int iLutPrec, Int** piSubPelShiftLUT, Int iShift )
    4243{
    4344  //ToDo: use same rounding for left and right
     
    5960  }
    6061}
    61 
    62 Void TRenFilter::setupZLUT( Bool bBlendUseDistWeight, Int iBlendZThresPerc, Int iRelDistToLeft, Int** ppiBaseShiftLUTLeft, Int** ppiBaseShiftLUTRight, Int& riBlendZThres, Int& riBlendDistWeight, Int* piInvZLUTLeft, Int* piInvZLUTRight )
     62template<UInt bitDepth>
     63Void TRenFilter<bitDepth>::setupZLUT( Bool bBlendUseDistWeight, Int iBlendZThresPerc, Int iRelDistToLeft, Int** ppiBaseShiftLUTLeft, Int** ppiBaseShiftLUTRight, Int& riBlendZThres, Int& riBlendDistWeight, Int* piInvZLUTLeft, Int* piInvZLUTRight )
    6364{
    6465  AOT( iRelDistToLeft == -1 );
     
    7576}
    7677
    77 Void TRenFilter::filledToUsedPelMap( PelImage* pcFilledImage, PelImage* pcUsedPelsImage, Int iUsedPelMapMarExt )
     78template<UInt bitDepth>
     79Void TRenFilter<bitDepth>::filledToUsedPelMap( PelImage* pcFilledImage, PelImage* pcUsedPelsImage, Int iUsedPelMapMarExt )
    7880{
    7981  // Convert to binary map
     
    156158
    157159/////////// Copy /////////////
    158 Void TRenFilter::copy(Pel* pcInputPlaneData, Int iInputStride, Int iWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride  )
     160template<UInt bitDepth>
     161Void TRenFilter<bitDepth>::copy(const Pel* pcInputPlaneData, Int iInputStride, Int iWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride  )
    159162{
    160163  xDistributeArray(pcInputPlaneData, iInputStride, 1, 1, iWidth, iHeight ,pcOutputPlaneData, iOutputStride, 1 , 1 );
     
    163166
    164167/////////// Horizontal Mirror ///////////
    165 template <typename T>
    166 Void TRenFilter::mirrorHor( TRenImage<T> *pcImage )
     168template<UInt bitDepth> template <typename T>
     169Void TRenFilter<bitDepth>::mirrorHor( TRenImage<T> *pcImage )
    167170{
    168171  for (UInt uCurPlane = 0 ; uCurPlane < pcImage->getNumberOfPlanes(); uCurPlane++ )
     
    172175}
    173176
    174 template <typename T>
    175 Void TRenFilter::mirrorHor( TRenImagePlane<T> *pcImagePlane )
     177template<UInt bitDepth> template <typename T>
     178Void TRenFilter<bitDepth>::mirrorHor( TRenImagePlane<T> *pcImagePlane )
    176179{
    177180  T* pcPlaneData = pcImagePlane->getPlaneDataOrg();
     
    194197
    195198/////////// Comparison ///////////
    196 Int64 TRenFilter::SSE   (PelImagePlane* pcInputPlane1, PelImagePlane* pcInputPlane2, Bool bLuma )
     199template<UInt bitDepth>
     200Int64 TRenFilter<bitDepth>::SSE   (PelImagePlane* pcInputPlane1, PelImagePlane* pcInputPlane2, Bool bLuma )
    197201{
    198202  UInt uiWidth     = pcInputPlane1->getWidth();
     
    208212}
    209213
    210 Int64 TRenFilter::SSE( Pel* piSrc1, Int iSrcStride1, Int iWidth, Int iHeight,  Pel* piSrc2, Int iSrcStride2, Bool bLuma )
     214template<UInt bitDepth>
     215Int64 TRenFilter<bitDepth>::SSE( Pel* piSrc1, Int iSrcStride1, Int iWidth, Int iHeight,  Pel* piSrc2, Int iSrcStride2, Bool bLuma )
    211216{
    212217  Int64 iSSE = 0;
    213218
    214219
    215   Int iShift = DISTORTION_PRECISION_ADJUSTMENT( ( bLuma ? g_bitDepthY : g_bitDepthC ) - 8 ) << 1 ;
     220  Int iShift = ( bitDepth - 8 ) << 1 ;
    216221  for(Int iPosY = 0; iPosY < iHeight; iPosY++)
    217222  {
     
    227232}
    228233
    229 template <typename T>
    230 Bool TRenFilter::compare( TRenImage<T> *pInputImage1, TRenImage<T> *pInputImage2 )
     234template<UInt bitDepth> template <typename T>
     235Bool TRenFilter<bitDepth>::compare( TRenImage<T> *pInputImage1, TRenImage<T> *pInputImage2 )
    231236{
    232237  Bool bIsEqual = true;
     
    238243}
    239244
    240 template <typename T>
    241 Bool TRenFilter::compare   (TRenImagePlane<T>* pcInputPlane1  , TRenImagePlane<T>* pcInputPlane2   )
     245template<UInt bitDepth> template <typename T>
     246Bool TRenFilter<bitDepth>::compare   (TRenImagePlane<T>* pcInputPlane1  , TRenImagePlane<T>* pcInputPlane2   )
    242247{
    243248  UInt uiWidth  = pcInputPlane1->getWidth();
     
    265270
    266271/////////// Sampling ///////////
    267 
    268 inline Void TRenFilter::sampleUp2Tap13(PelImage* pcInputImage, PelImage* pcOutputImage)
     272template<UInt bitDepth>
     273inline Void TRenFilter<bitDepth>::sampleUp2Tap13(PelImage* pcInputImage, PelImage* pcOutputImage)
    269274{ // UpSampling from JSVM Software (DownConvertStatic) ???
    270275
    271   AOF( g_bitDepthC == g_bitDepthY );
    272276  UInt uiNumPlanes = pcInputImage->getNumberOfPlanes();
    273277
     
    400404      {
    401405        // Scale and copy to image buffer.
    402         pcOutputPlaneData[iOffset+i] = ClipY((Pel) ((piDst[i] + iAddH) / iDivH));
     406        pcOutputPlaneData[iOffset+i] = ClipBD((Pel) ((piDst[i] + iAddH) / iDivH), bitDepth);
    403407      }
    404408    }
     
    410414}
    411415
    412 
    413 Void TRenFilter::sampleDown2Tap13(PelImage* pcInputImage, PelImage* pcOutputImage)
     416template<UInt bitDepth>
     417Void TRenFilter<bitDepth>::sampleDown2Tap13(PelImage* pcInputImage, PelImage* pcOutputImage)
    414418{ // DownSampling from JSVM Software (DownConvertStatic) ??
    415419
     
    422426};
    423427
    424 Void TRenFilter::sampleDown2Tap13( Pel* pcInputPlaneData, Int iInputStride, Int iWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride  )
     428template<UInt bitDepth>
     429Void TRenFilter<bitDepth>::sampleDown2Tap13( Pel* pcInputPlaneData, Int iInputStride, Int iWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride  )
    425430{ // DownSampling from JSVM Software (DownConvertStatic) ??
    426  
    427   AOF( g_bitDepthC == g_bitDepthY );
    428431
    429432  Int iOffset, iPosX, iPosY, k;
     
    549552    {
    550553      // Scale and copy back to image buffer.
    551       pcOutputPlaneData[iOutputStride*iPosY+iPosX] = ClipY( ( Pel) ( (piDst[iPosY] + iAddV) / iDivV));
     554      pcOutputPlaneData[iOutputStride*iPosY+iPosX] = ClipBD( ( Pel) ( (piDst[iPosY] + iAddV) / iDivV), bitDepth );
    552555    }
    553556  }
     
    557560}
    558561
    559 Void TRenFilter::sampleDown2Tap13(PelImagePlane* pcInputPlane, PelImagePlane* pcOutputPlane)
     562template<UInt bitDepth>
     563Void TRenFilter<bitDepth>::sampleDown2Tap13(PelImagePlane* pcInputPlane, PelImagePlane* pcOutputPlane)
    560564{ // DownSampling from JSVM Software (DownConvertStatic) ??
    561565  Int iWidth       = pcInputPlane->getWidth();
     
    574578};
    575579
    576 Void TRenFilter::sampleVerDown2Tap13( PelImagePlane* pcInputPlane, PelImagePlane* pcOutputPlane, Int uiPad)
    577 {
    578   assert( g_bitDepthY == g_bitDepthC); // ToDo: Update renderer to work with different luma/chroma bit depth
     580template<UInt bitDepth>
     581Void TRenFilter<bitDepth>::sampleVerDown2Tap13( PelImagePlane* pcInputPlane, PelImagePlane* pcOutputPlane, Int uiPad)
     582
    579583  // DownSampling from JSVM Software (DownConvertStatic) ??
    580584  Int iWidth       = pcInputPlane->getWidth();
     
    622626
    623627      Int iSum = iTmp4 + iTmp3 - iTmp2 + ((iTmp0 + iTmp4 + iTmp5 - iTmp2) << 1) + ( ( iTmp3 - iTmp1)  << 2) + (  iTmp5 << 3 ) + (( iTmp4 + iTmp5 ) << 4);
    624       pcOutputPlaneData[ iXPos ] = (Pel) ClipY((iSum + 32) >> 6);
     628      pcOutputPlaneData[ iXPos ] = (Pel) ClipBD((iSum + 32) >> 6, bitDepth);
    625629      pcTmpIn++;
    626630    }
     
    630634};
    631635
    632 Void TRenFilter::sampleHorDown2Tap13( PelImagePlane* pcInputPlane, PelImagePlane* pcOutputPlane, Int uiPad )
     636template<UInt bitDepth>
     637Void TRenFilter<bitDepth>::sampleHorDown2Tap13( PelImagePlane* pcInputPlane, PelImagePlane* pcOutputPlane, Int uiPad )
    633638{
    634   assert( g_bitDepthY == g_bitDepthC); // ToDo: Update renderer to work with different luma/chroma bit depth
    635   // DownSampling from JSVM Software (DownConvertStatic) ??
     639    // DownSampling from JSVM Software (DownConvertStatic) ??
    636640  Int iWidth       = pcInputPlane->getWidth();
    637641  Int iHeight      = pcInputPlane->getHeight();
     
    663667
    664668      Int iSum = iTmp4 + iTmp3 - iTmp2 + ((iTmp0 + iTmp4 + iTmp5 - iTmp2) << 1) + ( ( iTmp3 - iTmp1)  << 2) + (  iTmp5 << 3 ) + (( iTmp4 + iTmp5 ) << 4);
    665       pcOutputPlaneData[ iXPos ] = (Pel) ClipY((iSum + 32) >> 6);
     669      pcOutputPlaneData[ iXPos ] = (Pel) ClipBD((iSum + 32) >> 6, bitDepth);
    666670      pcTmpIn += 2;
    667671    }
     
    671675};
    672676
    673 inline Pel TRenFilter::xMedian3(Pel* pcData)
     677template<UInt bitDepth>
     678inline Pel TRenFilter<bitDepth>::xMedian3(Pel* pcData)
    674679{
    675680  Bool bGT01 = pcData[0] >  pcData[1];
     
    680685}
    681686
    682 
    683 Void TRenFilter::lineMedian3( PelImage* pcImage )
     687template<UInt bitDepth>
     688Void TRenFilter<bitDepth>::lineMedian3( PelImage* pcImage )
    684689{
    685690
     
    722727}
    723728
    724 
    725 Void TRenFilter::convRect( PelImage* pcImage, UInt uiSize )
     729template<UInt bitDepth>
     730Void TRenFilter<bitDepth>::convRect( PelImage* pcImage, UInt uiSize )
    726731{
    727732  DoubleImage cKernel(uiSize, uiSize,1,0);
     
    730735}
    731736
    732 Void TRenFilter::binominal( PelImage* pcInputImage, PelImage* pcOutputImage, UInt uiSize )
     737template<UInt bitDepth>
     738Void TRenFilter<bitDepth>::binominal( PelImage* pcInputImage, PelImage* pcOutputImage, UInt uiSize )
    733739{
    734740  assert( pcInputImage->getNumberOfFullPlanes()   == pcOutputImage->getNumberOfFullPlanes  () );
     
    747753}
    748754
    749 Void TRenFilter::binominal( PelImagePlane* pcInputPlane, PelImagePlane* pcOutputPlane, UInt uiSize )
     755template<UInt bitDepth>
     756Void TRenFilter<bitDepth>::binominal( PelImagePlane* pcInputPlane, PelImagePlane* pcOutputPlane, UInt uiSize )
    750757{
    751758  Int iWidth  = pcInputPlane ->getWidth ();
     
    777784  {
    778785  case 1:
    779     fpFilter = &TRenFilter::xFiltBinom3;
     786    fpFilter = &TRenFilter<bitDepth>::xFiltBinom3;
    780787    break;
    781788  case 2:
    782     fpFilter = &TRenFilter::xFiltBinom5;
     789    fpFilter = &TRenFilter<bitDepth>::xFiltBinom5;
    783790    break;
    784791  case 3:
    785     fpFilter = &TRenFilter::xFiltBinom7;
     792    fpFilter = &TRenFilter<bitDepth>::xFiltBinom7;
    786793    break;
    787794  case 4:
    788     fpFilter = &TRenFilter::xFiltBinom9;
     795    fpFilter = &TRenFilter<bitDepth>::xFiltBinom9;
    789796    break;
    790797  default:
     
    818825}
    819826
    820 Pel TRenFilter::xFiltBinom3( Pel* pcInputData, Int iStride )
    821 {
    822   assert( g_bitDepthY == g_bitDepthC); // ToDo: Update renderer to work with different luma/chroma bit depth
    823 
     827template<UInt bitDepth>
     828Pel TRenFilter<bitDepth>::xFiltBinom3( Pel* pcInputData, Int iStride )
     829{
    824830  Int iSum = pcInputData[-1 * iStride ] + pcInputData[ 0 ] +  (pcInputData[iStride ] << 1 );
    825   return ClipY( (iSum +  2) >>  2 );
    826 }
    827 
    828 Pel TRenFilter::xFiltBinom5( Pel* pcInputData, Int iStride )
    829 {
    830   assert( g_bitDepthY == g_bitDepthC); // ToDo: Update renderer to work with different luma/chroma bit depth
    831   // { 1,4,6,4,1 }
     831  return ClipBD( (iSum +  2) >>  2 , bitDepth);
     832}
     833
     834template<UInt bitDepth>
     835Pel TRenFilter<bitDepth>::xFiltBinom5( Pel* pcInputData, Int iStride )
     836{
     837    // { 1,4,6,4,1 }
    832838  Int iStride0  = 0;
    833839  Int iStrideM1 = iStride0  - iStride;
     
    841847
    842848  Int iSum = iTmp0 +  (iTmp2 << 1) + ((iTmp1 + iTmp2) << 2);
    843   return ClipY( (iSum +  8) >>  4 );
    844 }
    845 
    846 Pel TRenFilter::xFiltBinom7( Pel* pcInputData, Int iStride )
    847 {
    848   assert( g_bitDepthY == g_bitDepthC); // ToDo: Update renderer to work with different luma/chroma bit depth
    849   // { 1,6,15,20,15,6,1 }
     849  return ClipBD( (iSum +  8) >>  4 , bitDepth);
     850}
     851
     852template<UInt bitDepth>
     853Pel TRenFilter<bitDepth>::xFiltBinom7( Pel* pcInputData, Int iStride )
     854{
     855    // { 1,6,15,20,15,6,1 }
    850856  Int iStride0  = 0;
    851857  Int iStrideM1 = iStride0  - iStride;
     
    863869  Int iSum = iTmp0 - iTmp2 + ( iTmp1  << 1) + ( (iTmp1 + iTmp3) << 2) + ((iTmp2 + iTmp3) << 4);
    864870
    865   return ClipY( (iSum +  32) >>  6 );
    866 }
    867 
    868 Pel TRenFilter::xFiltBinom9( Pel* pcInputData, Int iStride )
    869 {
    870   assert( g_bitDepthY == g_bitDepthC); // ToDo: Update renderer to work with different luma/chroma bit depth
     871  return ClipBD( (iSum +  32) >>  6 , bitDepth);
     872}
     873
     874template<UInt bitDepth>
     875Pel TRenFilter<bitDepth>::xFiltBinom9( Pel* pcInputData, Int iStride )
     876{
    871877  // {  1     8    28    56    70    56    28     8     1 }
    872878  Int iStride0  = 0;
     
    888894  Int iSum = iTmp0 + ((iTmp4 ) << 1) + ( ( iTmp4 - iTmp2 ) << 2) +  ( (iTmp1 - iTmp3) << 3 ) +  ((iTmp2 ) << 5) + ((iTmp3+ iTmp4 ) << 6);
    889895
    890   return ClipY( (iSum +  128) >>  8 );
    891 }
    892 
    893 
    894 Pel TRenFilter::interpCHSpline(Double dX, Double dS0, Double dS1, Int iQ0, Int iQ1, Int iQ2, Int iQ3)
     896  return ClipBD( (iSum +  128) >>  8 , bitDepth);
     897}
     898
     899template<UInt bitDepth>
     900Pel TRenFilter<bitDepth>::interpCHSpline(Double dX, Double dS0, Double dS1, Int iQ0, Int iQ1, Int iQ2, Int iQ3)
    895901{
    896902  Double dSq = (dX - dS0) / (dS1 - dS0);
     
    916922}
    917923
    918 Void TRenFilter::diffHorSym(PelImage* pcInputImage, IntImage* pcOutputImage)
     924template<UInt bitDepth>
     925Void TRenFilter<bitDepth>::diffHorSym(PelImage* pcInputImage, IntImage* pcOutputImage)
    919926{
    920927  for (UInt uiCurPlane = 0; uiCurPlane < pcInputImage->getNumberOfPlanes(); uiCurPlane++)
     
    924931}
    925932
    926 Void TRenFilter::diffHorSym(PelImagePlane* pcInputPlane, IntImagePlane* pcOutputPlane)
     933template<UInt bitDepth>
     934Void TRenFilter<bitDepth>::diffHorSym(PelImagePlane* pcInputPlane, IntImagePlane* pcOutputPlane)
    927935{
    928936  UInt uiInputStride = pcInputPlane ->getStride();
     
    950958}
    951959
    952 Void TRenFilter::laplace( DoubleImage* pcInputImage, DoubleImage* pcOutputImage )
     960template<UInt bitDepth>
     961Void TRenFilter<bitDepth>::laplace( DoubleImage* pcInputImage, DoubleImage* pcOutputImage )
    953962{
    954963  for (UInt uiCurPlane = 0; uiCurPlane < pcInputImage->getNumberOfPlanes(); uiCurPlane++)
     
    10221031}
    10231032
    1024 
    1025 Void TRenFilter::conv( PelImage* pcImage, DoubleImage* pcKernel )
     1033template<UInt bitDepth>
     1034Void TRenFilter<bitDepth>::conv( PelImage* pcImage, DoubleImage* pcKernel )
    10261035{
    10271036  PelImage* pcTemp = pcImage->create();
     
    10961105
    10971106// Horizontal Up sampling luma
    1098 Void TRenFilter::sampleHorUp( Int iLog2HorSampFac, Pel* pcInputPlaneData, Int iInputStride, Int iInputWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride  )
    1099 {
    1100   TRenInterpFilter cFilter;
     1107template<UInt bitDepth>
     1108Void TRenFilter<bitDepth>::sampleHorUp( Int iLog2HorSampFac, Pel* pcInputPlaneData, Int iInputStride, Int iInputWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride  )
     1109{
     1110  TRenInterpFilter<bitDepth> cFilter;
    11011111  switch ( iLog2HorSampFac )
    11021112  {
     
    11181128
    11191129// horizontal up sampling chroma
    1120 Void TRenFilter::sampleCHorUp(Int iLog2HorSampFac, Pel* pcInputPlaneData, Int iInputStride, Int iInputWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride  )
     1130template<UInt bitDepth>
     1131Void TRenFilter<bitDepth>::sampleCHorUp(Int iLog2HorSampFac, Pel* pcInputPlaneData, Int iInputStride, Int iInputWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride  )
    11211132{
    11221133  switch ( iLog2HorSampFac )
     
    11271138  case 1:
    11281139    xDistributeArray( pcInputPlaneData,   iInputStride  , 1, 1, iInputWidth,   iHeight   , pcOutputPlaneData                  , iOutputStride, 2 , 1 );
    1129     xInterpHorChroma( pcInputPlaneData  , iInputStride  , 1, 1, iInputWidth,   iHeight   , pcOutputPlaneData                +1, iOutputStride, 2 , 1, &TRenInterpFilter::xCTI_Filter_VPS04_C_HAL );
     1140    xInterpHorChroma( pcInputPlaneData  , iInputStride  , 1, 1, iInputWidth,   iHeight   , pcOutputPlaneData                +1, iOutputStride, 2 , 1, &TRenInterpFilter<REN_BIT_DEPTH>::xCTI_Filter_VPS04_C_HAL );
    11301141    break;
    11311142  case 2:
    11321143    xDistributeArray( pcInputPlaneData,   iInputStride  , 1, 1, iInputWidth,   iHeight   , pcOutputPlaneData                  , iOutputStride, 4 , 1 );
    1133     xInterpHorChroma( pcInputPlaneData  , iInputStride  , 1, 1, iInputWidth,   iHeight   , pcOutputPlaneData                +1, iOutputStride, 4 , 1, &TRenInterpFilter::xCTI_Filter_VP04_C_QUA0 );
    1134     xInterpHorChroma( pcInputPlaneData  , iInputStride  , 1, 1, iInputWidth,   iHeight   , pcOutputPlaneData                +2, iOutputStride, 4 , 1, &TRenInterpFilter::xCTI_Filter_VPS04_C_HAL );
    1135     xInterpHorChroma( pcInputPlaneData  , iInputStride  , 1, 1, iInputWidth,   iHeight   , pcOutputPlaneData                +3, iOutputStride, 4 , 1, &TRenInterpFilter::xCTI_Filter_VP04_C_QUA1 );
    1136     break;
    1137   }
    1138 }
    1139 
    1140 Void TRenFilter::sampleCUpHorUp( Int iLog2HorSampFac, Pel* pcInputPlaneData, Int iInputStride, Int iInputWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride  )
     1144    xInterpHorChroma( pcInputPlaneData  , iInputStride  , 1, 1, iInputWidth,   iHeight   , pcOutputPlaneData                +1, iOutputStride, 4 , 1, &TRenInterpFilter<REN_BIT_DEPTH>::xCTI_Filter_VP04_C_QUA0 );
     1145    xInterpHorChroma( pcInputPlaneData  , iInputStride  , 1, 1, iInputWidth,   iHeight   , pcOutputPlaneData                +2, iOutputStride, 4 , 1, &TRenInterpFilter<REN_BIT_DEPTH>::xCTI_Filter_VPS04_C_HAL );
     1146    xInterpHorChroma( pcInputPlaneData  , iInputStride  , 1, 1, iInputWidth,   iHeight   , pcOutputPlaneData                +3, iOutputStride, 4 , 1, &TRenInterpFilter<REN_BIT_DEPTH>::xCTI_Filter_VP04_C_QUA1 );
     1147    break;
     1148  }
     1149}
     1150
     1151template<UInt bitDepth>
     1152Void TRenFilter<bitDepth>::sampleCUpHorUp( Int iLog2HorSampFac, Pel* pcInputPlaneData, Int iInputStride, Int iInputWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride  )
    11411153{
    11421154
     
    11451157  case 0:
    11461158    xDistributeArray( pcInputPlaneData-1, iInputStride  , 1, 1, iInputWidth+3, iHeight   , pcOutputPlaneData                -2, iOutputStride, 2,  2 );
    1147     xInterpVerChroma( pcInputPlaneData-1, iInputStride  , 1, 1, iInputWidth+3, iHeight   , pcOutputPlaneData+1*iOutputStride-2, iOutputStride, 2 , 2, &TRenInterpFilter::xCTI_Filter_VPS04_C_HAL );
    1148     xInterpHorChroma( pcOutputPlaneData , iOutputStride , 2, 1, iInputWidth,   iHeight*2 , pcOutputPlaneData+1                , iOutputStride, 2 , 1, &TRenInterpFilter::xCTI_Filter_VPS04_C_HAL );
     1159    xInterpVerChroma( pcInputPlaneData-1, iInputStride  , 1, 1, iInputWidth+3, iHeight   , pcOutputPlaneData+1*iOutputStride-2, iOutputStride, 2 , 2, &TRenInterpFilter<REN_BIT_DEPTH>::xCTI_Filter_VPS04_C_HAL );
     1160    xInterpHorChroma( pcOutputPlaneData , iOutputStride , 2, 1, iInputWidth,   iHeight*2 , pcOutputPlaneData+1                , iOutputStride, 2 , 1, &TRenInterpFilter<REN_BIT_DEPTH>::xCTI_Filter_VPS04_C_HAL );
    11491161    break;
    11501162  case 1:
    11511163    xDistributeArray( pcInputPlaneData-1, iInputStride  , 1, 1, iInputWidth+3, iHeight   , pcOutputPlaneData                -4, iOutputStride, 4 , 2 );
    1152     xInterpVerChroma( pcInputPlaneData-1, iInputStride  , 1, 1, iInputWidth+3, iHeight   , pcOutputPlaneData+1*iOutputStride-4, iOutputStride, 4 , 2, &TRenInterpFilter::xCTI_Filter_VPS04_C_HAL );
    1153     xInterpHorChroma( pcOutputPlaneData , iOutputStride , 4, 1, iInputWidth, iHeight*2 , pcOutputPlaneData                +1, iOutputStride, 4 , 1, &TRenInterpFilter::xCTI_Filter_VP04_C_QUA0 );
    1154     xInterpHorChroma( pcOutputPlaneData , iOutputStride , 4, 1, iInputWidth, iHeight*2 , pcOutputPlaneData                +2, iOutputStride, 4 , 1, &TRenInterpFilter::xCTI_Filter_VPS04_C_HAL );
    1155     xInterpHorChroma( pcOutputPlaneData , iOutputStride , 4, 1, iInputWidth, iHeight*2 , pcOutputPlaneData                +3, iOutputStride, 4 , 1, &TRenInterpFilter::xCTI_Filter_VP04_C_QUA1 );
     1164    xInterpVerChroma( pcInputPlaneData-1, iInputStride  , 1, 1, iInputWidth+3, iHeight   , pcOutputPlaneData+1*iOutputStride-4, iOutputStride, 4 , 2, &TRenInterpFilter<REN_BIT_DEPTH>::xCTI_Filter_VPS04_C_HAL );
     1165    xInterpHorChroma( pcOutputPlaneData , iOutputStride , 4, 1, iInputWidth, iHeight*2 , pcOutputPlaneData                +1, iOutputStride, 4 , 1, &TRenInterpFilter<REN_BIT_DEPTH>::xCTI_Filter_VP04_C_QUA0 );
     1166    xInterpHorChroma( pcOutputPlaneData , iOutputStride , 4, 1, iInputWidth, iHeight*2 , pcOutputPlaneData                +2, iOutputStride, 4 , 1, &TRenInterpFilter<REN_BIT_DEPTH>::xCTI_Filter_VPS04_C_HAL );
     1167    xInterpHorChroma( pcOutputPlaneData , iOutputStride , 4, 1, iInputWidth, iHeight*2 , pcOutputPlaneData                +3, iOutputStride, 4 , 1, &TRenInterpFilter<REN_BIT_DEPTH>::xCTI_Filter_VP04_C_QUA1 );
    11561168    break;
    11571169  case 2:
    11581170    xDistributeArray( pcInputPlaneData-1, iInputStride  , 1, 1, iInputWidth+3, iHeight   , pcOutputPlaneData                -8, iOutputStride, 8 , 2 );
    1159     xInterpVerChroma( pcInputPlaneData-1, iInputStride  , 1, 1, iInputWidth+3, iHeight   , pcOutputPlaneData+1*iOutputStride-8, iOutputStride, 8 , 2, &TRenInterpFilter::xCTI_Filter_VPS04_C_HAL );
    1160     xInterpHorChroma( pcOutputPlaneData , iOutputStride , 8, 1, iInputWidth,   iHeight*2 , pcOutputPlaneData                +1, iOutputStride, 8 , 1, &TRenInterpFilter::xCTI_Filter_VP04_C_OCT0 );
    1161     xInterpHorChroma( pcOutputPlaneData , iOutputStride , 8, 1, iInputWidth,   iHeight*2 , pcOutputPlaneData                +2, iOutputStride, 8 , 1, &TRenInterpFilter::xCTI_Filter_VP04_C_QUA0 );
    1162     xInterpHorChroma( pcOutputPlaneData , iOutputStride , 8, 1, iInputWidth,   iHeight*2 , pcOutputPlaneData                +3, iOutputStride, 8 , 1, &TRenInterpFilter::xCTI_Filter_VP04_C_OCT1 );
    1163     xInterpHorChroma( pcOutputPlaneData , iOutputStride , 8, 1, iInputWidth,   iHeight*2 , pcOutputPlaneData                +4, iOutputStride, 8 , 1, &TRenInterpFilter::xCTI_Filter_VPS04_C_HAL );
    1164     xInterpHorChroma( pcOutputPlaneData , iOutputStride , 8, 1, iInputWidth,   iHeight*2 , pcOutputPlaneData                +5, iOutputStride, 8 , 1, &TRenInterpFilter::xCTI_Filter_VP04_C_OCT2 );
    1165     xInterpHorChroma( pcOutputPlaneData , iOutputStride , 8, 1, iInputWidth,   iHeight*2 , pcOutputPlaneData                +6, iOutputStride, 8 , 1, &TRenInterpFilter::xCTI_Filter_VP04_C_QUA1 );
    1166     xInterpHorChroma( pcOutputPlaneData , iOutputStride , 8, 1, iInputWidth,   iHeight*2 , pcOutputPlaneData                +7, iOutputStride, 8 , 1, &TRenInterpFilter::xCTI_Filter_VP04_C_OCT3 );
     1171    xInterpVerChroma( pcInputPlaneData-1, iInputStride  , 1, 1, iInputWidth+3, iHeight   , pcOutputPlaneData+1*iOutputStride-8, iOutputStride, 8 , 2, &TRenInterpFilter<REN_BIT_DEPTH>::xCTI_Filter_VPS04_C_HAL );
     1172    xInterpHorChroma( pcOutputPlaneData , iOutputStride , 8, 1, iInputWidth,   iHeight*2 , pcOutputPlaneData                +1, iOutputStride, 8 , 1, &TRenInterpFilter<REN_BIT_DEPTH>::xCTI_Filter_VP04_C_OCT0 );
     1173    xInterpHorChroma( pcOutputPlaneData , iOutputStride , 8, 1, iInputWidth,   iHeight*2 , pcOutputPlaneData                +2, iOutputStride, 8 , 1, &TRenInterpFilter<REN_BIT_DEPTH>::xCTI_Filter_VP04_C_QUA0 );
     1174    xInterpHorChroma( pcOutputPlaneData , iOutputStride , 8, 1, iInputWidth,   iHeight*2 , pcOutputPlaneData                +3, iOutputStride, 8 , 1, &TRenInterpFilter<REN_BIT_DEPTH>::xCTI_Filter_VP04_C_OCT1 );
     1175    xInterpHorChroma( pcOutputPlaneData , iOutputStride , 8, 1, iInputWidth,   iHeight*2 , pcOutputPlaneData                +4, iOutputStride, 8 , 1, &TRenInterpFilter<REN_BIT_DEPTH>::xCTI_Filter_VPS04_C_HAL );
     1176    xInterpHorChroma( pcOutputPlaneData , iOutputStride , 8, 1, iInputWidth,   iHeight*2 , pcOutputPlaneData                +5, iOutputStride, 8 , 1, &TRenInterpFilter<REN_BIT_DEPTH>::xCTI_Filter_VP04_C_OCT2 );
     1177    xInterpHorChroma( pcOutputPlaneData , iOutputStride , 8, 1, iInputWidth,   iHeight*2 , pcOutputPlaneData                +6, iOutputStride, 8 , 1, &TRenInterpFilter<REN_BIT_DEPTH>::xCTI_Filter_VP04_C_QUA1 );
     1178    xInterpHorChroma( pcOutputPlaneData , iOutputStride , 8, 1, iInputWidth,   iHeight*2 , pcOutputPlaneData                +7, iOutputStride, 8 , 1, &TRenInterpFilter<REN_BIT_DEPTH>::xCTI_Filter_VP04_C_OCT3 );
    11671179    break;
    11681180  }
     
    11711183// Down Sampling
    11721184// Down sample luma
    1173 Void TRenFilter::sampleHorDown(Int iLog2HorSampFac,  Pel* pcInputPlaneData, Int iInputStride, Int iInputWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride  )
     1185template<UInt bitDepth>
     1186Void TRenFilter<bitDepth>::sampleHorDown(Int iLog2HorSampFac,  Pel* pcInputPlaneData, Int iInputStride, Int iInputWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride  )
    11741187{
    11751188  switch ( iLog2HorSampFac )
     
    11871200}
    11881201
    1189 
    1190 Void TRenFilter::sampleCHorDown(Int iLog2HorSampFac,  Pel* pcInputPlaneData, Int iInputStride, Int iInputWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride  )
     1202template<UInt bitDepth>
     1203Void TRenFilter<bitDepth>::sampleCHorDown(Int iLog2HorSampFac,  Pel* pcInputPlaneData, Int iInputStride, Int iInputWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride  )
    11911204{
    11921205  //GT: currently the same as for luma
     
    11971210
    11981211// Up sampling chroma
    1199 Void TRenFilter::sampleCDownHorDown( Int iLog2HorSampFac,  Pel* pcInputPlaneData, Int iInputStride, Int iInputWidth, Int iInputHeight, Pel* pcOutputPlaneData, Int iOutputStride  )
     1212template<UInt bitDepth>
     1213Void TRenFilter<bitDepth>::sampleCDownHorDown( Int iLog2HorSampFac,  Pel* pcInputPlaneData, Int iInputStride, Int iInputWidth, Int iInputHeight, Pel* pcOutputPlaneData, Int iOutputStride  )
    12001214{
    12011215  // create buffer
     
    12191233}
    12201234
    1221 Void TRenFilter::xDistributeArray(Pel* pcSrc, Int iSrcStride, Int iSrcStepX, Int iSrcStepY, Int iWidth, Int iHeight, Pel* pcDst, Int iDstStride, Int iDstStepX, Int iDstStepY)
     1235template<UInt bitDepth>
     1236Void TRenFilter<bitDepth>::xDistributeArray(const Pel* pcSrc, Int iSrcStride, Int iSrcStepX, Int iSrcStepY, Int iWidth, Int iHeight, Pel* pcDst, Int iDstStride, Int iDstStepX, Int iDstStepY)
    12221237{
    12231238  iDstStride *= iDstStepY;
     
    12261241  {
    12271242    Pel* pcCurDst = pcDst;
    1228     Pel* pcCurSrc  = pcSrc;
     1243    const Pel* pcCurSrc  = pcSrc;
    12291244    for (Int iXPos = 0; iXPos < iWidth; iXPos ++)
    12301245    {
     
    12391254}
    12401255
    1241 Void TRenFilter::xInterpHorChroma( Pel* piSrc, Int iSrcStride, Int iSrcStepX, Int iSrcStepY, Int iWidth, Int iHeight, Pel* piDst, Int iDstStride, Int iDstStepX, Int iDstStepY, FpChromaIntFilt fpFilter )
    1242 {
    1243   assert( g_bitDepthY == g_bitDepthC); // ToDo: Update renderer to work with different luma/chroma bit depth
     1256template<UInt bitDepth>
     1257Void TRenFilter<bitDepth>::xInterpHorChroma( Pel* piSrc, Int iSrcStride, Int iSrcStepX, Int iSrcStepY, Int iWidth, Int iHeight, Pel* piDst, Int iDstStride, Int iDstStepX, Int iDstStepY, FpChromaIntFilt fpFilter )
     1258{
    12441259  Int   iSum;
    12451260  Pel*  piSrcTmp;
    12461261
    1247   TRenInterpFilter cFilter;
     1262  TRenInterpFilter<REN_BIT_DEPTH> cFilter;
    12481263  for ( Int y = iHeight; y != 0; y-- )
    12491264  {
     
    12521267    {
    12531268      iSum      = (cFilter.*fpFilter)( piSrcTmp,  iSrcStepX );
    1254       piDst[x * iDstStepX ] =  ClipC ((iSum +  32) >>  6 );
     1269      piDst[x * iDstStepX ] =  ClipBD ((iSum +  32) >>  6 , bitDepth);
    12551270      piSrcTmp+= iSrcStepX;
    12561271    }
     
    12601275}
    12611276
    1262 Void TRenFilter::xInterpVerChroma( Pel* piSrc, Int iSrcStride, Int iSrcStepX, Int iSrcStepY, Int iWidth, Int iHeight, Pel* piDst, Int iDstStride, Int iDstStepX, Int iDstStepY, FpChromaIntFilt fpFilter )
    1263 {
    1264   assert( g_bitDepthY == g_bitDepthC); // ToDo: Update renderer to work with different luma/chroma bit depth
     1277template<UInt bitDepth>
     1278Void TRenFilter<bitDepth>::xInterpVerChroma( Pel* piSrc, Int iSrcStride, Int iSrcStepX, Int iSrcStepY, Int iWidth, Int iHeight, Pel* piDst, Int iDstStride, Int iDstStepX, Int iDstStepY, FpChromaIntFilt fpFilter )
     1279{
    12651280  Int   iSum;
    12661281  Pel*  piSrcTmp;
    12671282
    1268   TRenInterpFilter cFilter;
     1283  TRenInterpFilter<bitDepth> cFilter;
    12691284  for ( Int y = iHeight; y != 0; y-- )
    12701285  {
     
    12731288    {
    12741289      iSum      = (cFilter.*fpFilter)( piSrcTmp,  iSrcStepY * iSrcStride );
    1275       piDst[x * iDstStepX ]  =  ClipC ((iSum +  32) >>  6 );
     1290      piDst[x * iDstStepX ]  =  ClipBD ((iSum +  32) >>  6, bitDepth );
    12761291      piSrcTmp += iSrcStepX;
    12771292    }
     
    12811296}
    12821297
    1283 
    1284 Void TRenFilter::xSampleDownHor2( Pel* piSrc, Int iSrcStride, Int iSrcWidth, Int iHeight, Pel* piDst, Int iDstStride  )
    1285 {
    1286  
    1287   assert( g_bitDepthY == g_bitDepthC); // ToDo: Update renderer to work with different luma/chroma bit depth
     1298template<UInt bitDepth>
     1299Void TRenFilter<bitDepth>::xSampleDownHor2( Pel* piSrc, Int iSrcStride, Int iSrcWidth, Int iHeight, Pel* piDst, Int iDstStride  )
     1300{
    12881301
    12891302  Int   iSum;
     
    12981311      // { 1,2,1 }
    12991312      iSum = piSrcTmp[0] + piSrcTmp[2] +  (piSrcTmp[1] << 1);
    1300       piDst[x] = ClipY( (iSum +  2) >>  2 );
     1313      piDst[x] = ClipBD( (iSum +  2) >>  2 , bitDepth);
    13011314      piSrcTmp += 2;
    13021315    }
     
    13061319};
    13071320
    1308 Void TRenFilter::xSampleDownVer2( Pel* piSrc, Int iSrcStride, Int iSrcWidth, Int iSrcHeight, Pel* piDst, Int iDstStride  )
    1309 {
    1310   assert( g_bitDepthY == g_bitDepthC); // ToDo: Update renderer to work with different luma/chroma bit depth
    1311 
     1321template<UInt bitDepth>
     1322Void TRenFilter<bitDepth>::xSampleDownVer2( Pel* piSrc, Int iSrcStride, Int iSrcWidth, Int iSrcHeight, Pel* piDst, Int iDstStride  )
     1323{
    13121324  Int   iSum;
    13131325  Pel*  piSrcTmp;
     
    13201332      // { 1,2,1 }
    13211333      iSum = piSrcTmp[0] + piSrcTmp[ iSrcStride << 1] +  (piSrcTmp[ iSrcStride ] << 1);
    1322       piDst[x] = ClipY( (iSum +  2) >>  2 );
     1334      piDst[x] = ClipBD( (iSum +  2) >>  2, bitDepth );
    13231335      piSrcTmp += 1;
    13241336    }
     
    13281340};
    13291341
    1330 Void TRenFilter::xSampleDownHor4( Pel* piSrc, Int iSrcStride, Int iSrcWidth, Int iHeight, Pel* piDst, Int iDstStride  )
    1331 {
    1332   assert( g_bitDepthY == g_bitDepthC); // ToDo: Update renderer to work with different luma/chroma bit depth
     1342template<UInt bitDepth>
     1343Void TRenFilter<bitDepth>::xSampleDownHor4( Pel* piSrc, Int iSrcStride, Int iSrcWidth, Int iHeight, Pel* piDst, Int iDstStride  )
     1344{
    13331345
    13341346  Int   iSum;
     
    13481360
    13491361      iSum = iTmp0 +  (iTmp2 << 1) + ((iTmp1 + iTmp2) << 2);
    1350       piDst[x] = ClipY( (iSum +  8) >>  4 );
     1362      piDst[x] = ClipBD( (iSum +  8) >>  4, bitDepth );
    13511363      piSrcTmp += 4;
    13521364    }
     
    13561368};
    13571369
    1358 Void TRenFilter::xSampleDownHor8( Pel* piSrc, Int iSrcStride, Int iSrcWidth, Int iHeight, Pel* piDst, Int iDstStride  )
    1359 {
    1360   assert( g_bitDepthY == g_bitDepthC); // ToDo: Update renderer to work with different luma/chroma bit depth
    1361 
     1370template<UInt bitDepth>
     1371Void TRenFilter<bitDepth>::xSampleDownHor8( Pel* piSrc, Int iSrcStride, Int iSrcWidth, Int iHeight, Pel* piDst, Int iDstStride  )
     1372{
    13621373  Int   iSum;
    13631374  Pel*  piSrcTmp;
     
    13771388
    13781389      iSum = iTmp0 - iTmp2 + ( iTmp1  << 1) + ( (iTmp1 + iTmp3) << 2) + ((iTmp2 + iTmp3) << 4);
    1379       piDst[x] = ClipY( (iSum +  32) >>  6 );
     1390      piDst[x] = ClipBD( (iSum +  32) >>  6 , bitDepth);
    13801391      piSrcTmp += 8;
    13811392    }
     
    13851396};
    13861397
    1387 Void TRenFilter::xDilate( Pel* piSrc, Int iSrcStride, Int iWidth, Int iHeight, Pel* piDst, Int iDstStride, Int iSize, Bool bVerticalDir, Bool bToTopOrLeft )
     1398template<UInt bitDepth>
     1399Void TRenFilter<bitDepth>::xDilate( Pel* piSrc, Int iSrcStride, Int iWidth, Int iHeight, Pel* piDst, Int iDstStride, Int iSize, Bool bVerticalDir, Bool bToTopOrLeft )
    13881400{
    13891401  Int iFDimStart   = 0;
     
    14521464
    14531465
    1454 template Bool TRenFilter::compare   (TRenImage<Pel     >*, TRenImage<Pel>*      );
    1455 template Bool TRenFilter::compare   (TRenImagePlane<Pel>*, TRenImagePlane<Pel>* );
    1456 
    1457 template Void TRenFilter::mirrorHor(        TRenImage<Double>        *pcImage );
    1458 template Void TRenFilter::mirrorHor(        TRenImage<Pel>           *pcImage );
    1459 template Void TRenFilter::mirrorHor(        TRenImage<Int>           *pcImage );
    1460 template Void TRenFilter::mirrorHor(        TRenImagePlane<Pel>      *pcImagePlane );
     1466template class TRenFilter<REN_BIT_DEPTH>;
     1467
     1468template Bool TRenFilter<REN_BIT_DEPTH>::compare   (TRenImage<Pel     >*, TRenImage<Pel>*      );
     1469template Bool TRenFilter<REN_BIT_DEPTH>::compare   (TRenImagePlane<Pel>*, TRenImagePlane<Pel>* );
     1470                         
     1471template Void TRenFilter<REN_BIT_DEPTH>::mirrorHor( TRenImage<Double>        *pcImage );
     1472template Void TRenFilter<REN_BIT_DEPTH>::mirrorHor( TRenImage<Pel>           *pcImage );
     1473template Void TRenFilter<REN_BIT_DEPTH>::mirrorHor( TRenImage<Int>           *pcImage );
     1474template Void TRenFilter<REN_BIT_DEPTH>::mirrorHor( TRenImagePlane<Pel>      *pcImagePlane );
    14611475
    14621476#endif
Note: See TracChangeset for help on using the changeset viewer.