Ignore:
Timestamp:
1 Nov 2012, 19:22:41 (12 years ago)
Author:
mitsubishi-htm
Message:

Initial integration of VSP into HTM 4.0.1. The version used for JCT3V-B0102 at Shanghai meeting.

  • VC9 project/solution files updated. Other Visual C++ project/solution files are not updated.
  • Linux make file updated.

TODO

  • A second release is expected to include some bug fix and improvements on the interface, e.g. to move switches from macro definition to the configuration file.
  • A third release is expected after being integrated within HTM 5.x, which is to be used for CE1.h anchor.
Location:
branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibRenderer
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibRenderer/TRenFilter.cpp

    r56 r166  
    11541154}
    11551155
     1156#if NTT_SUBPEL
     1157// Convert luma sample
     1158Void TRenFilter::sampleConv( Pel* pcInputPlaneData, Int iInputStride, Int iInputWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride, Pel* pcDepthPlaneData, Int iDepthStride, Int** ppiFposLUT )
     1159{
     1160  TRenInterpFilter cFilter;
     1161
     1162  xDistributeArrayOnDepthCondition  ( pcInputPlaneData, iInputStride, 1 , 1, iInputWidth, iHeight, pcOutputPlaneData, iOutputStride, 1, 1, pcDepthPlaneData, iDepthStride, 1, 1, ppiFposLUT);
     1163  cFilter.xCTI_FilterQuarter0Hor    ( pcInputPlaneData, iInputStride, 1, iInputWidth, iHeight, iOutputStride, 1, pcOutputPlaneData, pcDepthPlaneData, iDepthStride, 1, ppiFposLUT );
     1164  cFilter.xCTI_FilterHalfHor        ( pcInputPlaneData, iInputStride, 1, iInputWidth, iHeight, iOutputStride, 1, pcOutputPlaneData, pcDepthPlaneData, iDepthStride, 1, ppiFposLUT );
     1165  cFilter.xCTI_FilterQuarter1Hor    ( pcInputPlaneData, iInputStride, 1, iInputWidth, iHeight, iOutputStride, 1, pcOutputPlaneData, pcDepthPlaneData, iDepthStride, 1, ppiFposLUT );
     1166}
     1167
     1168Void TRenFilter::sampleCVerUp( Pel* pcInputPlaneData, Int iInputStride, Int iInputWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride  )
     1169{
     1170  xDistributeArray( pcInputPlaneData-3, iInputStride, 1, 1, iInputWidth+6, iHeight, pcOutputPlaneData              -3, iOutputStride, 1, 2 );
     1171  xInterpVerChroma( pcInputPlaneData-3, iInputStride, 1, 1, iInputWidth+6, iHeight, pcOutputPlaneData+iOutputStride-3, iOutputStride, 1, 2, &TRenInterpFilter::xCTI_Filter_VPS04_C_HAL );
     1172}
     1173
     1174Void TRenFilter::sampleCConv( Pel* pcInputPlaneData, Int iInputStride, Int iInputWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride, Pel* pcDepthPlaneData, Int iDepthStride, Int** ppiFposLUT )
     1175{
     1176  // assume quater resolution depth
     1177  xDistributeArrayOnDepthCondition( pcInputPlaneData, iInputStride, 1, 1, iInputWidth, iHeight, pcOutputPlaneData, iOutputStride, 1, 1, pcDepthPlaneData, iDepthStride, 2, 2, ppiFposLUT);
     1178  xInterpHorChromaOnDepthCondition( pcInputPlaneData, iInputStride, 1, 1, iInputWidth, iHeight, pcOutputPlaneData, iOutputStride, 1, 1, pcDepthPlaneData, iDepthStride, 2, 2, ppiFposLUT, 1, &TRenInterpFilter::xCTI_Filter_VP04_C_QUA0 );
     1179  xInterpHorChromaOnDepthCondition( pcInputPlaneData, iInputStride, 1, 1, iInputWidth, iHeight, pcOutputPlaneData, iOutputStride, 1, 1, pcDepthPlaneData, iDepthStride, 2, 2, ppiFposLUT, 2, &TRenInterpFilter::xCTI_Filter_VPS04_C_HAL );
     1180  xInterpHorChromaOnDepthCondition( pcInputPlaneData, iInputStride, 1, 1, iInputWidth, iHeight, pcOutputPlaneData, iOutputStride, 1, 1, pcDepthPlaneData, iDepthStride, 2, 2, ppiFposLUT, 3, &TRenInterpFilter::xCTI_Filter_VP04_C_QUA1 );
     1181}
     1182
     1183Void TRenFilter::sampleCConvHorUp( Pel* pcInputPlaneData, Int iInputStride, Int iInputWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride, Pel* pcDepthPlaneData, Int iDepthStride, Int** ppiFposLUT )
     1184{
     1185  xDistributeArrayOnDepthCondition( pcInputPlaneData, iInputStride, 1, 1, iInputWidth, iHeight, pcOutputPlaneData, iOutputStride, 2, 1, pcDepthPlaneData, iDepthStride, 2, 1, ppiFposLUT);
     1186  xInterpHorChromaOnDepthCondition( pcInputPlaneData, iInputStride, 1, 1, iInputWidth, iHeight, pcOutputPlaneData, iOutputStride, 2, 1, pcDepthPlaneData, iDepthStride, 2, 1, ppiFposLUT, 1, &TRenInterpFilter::xCTI_Filter_VP04_C_OCT0 );
     1187  xInterpHorChromaOnDepthCondition( pcInputPlaneData, iInputStride, 1, 1, iInputWidth, iHeight, pcOutputPlaneData, iOutputStride, 2, 1, pcDepthPlaneData, iDepthStride, 2, 1, ppiFposLUT, 2, &TRenInterpFilter::xCTI_Filter_VP04_C_QUA0 );
     1188  xInterpHorChromaOnDepthCondition( pcInputPlaneData, iInputStride, 1, 1, iInputWidth, iHeight, pcOutputPlaneData, iOutputStride, 2, 1, pcDepthPlaneData, iDepthStride, 2, 1, ppiFposLUT, 3, &TRenInterpFilter::xCTI_Filter_VP04_C_OCT1 );
     1189
     1190  pcOutputPlaneData++; pcDepthPlaneData++;
     1191  xInterpHorChromaOnDepthCondition( pcInputPlaneData, iInputStride, 1, 1, iInputWidth, iHeight, pcOutputPlaneData, iOutputStride, 2, 1, pcDepthPlaneData, iDepthStride, 2, 1, ppiFposLUT, 0, &TRenInterpFilter::xCTI_Filter_VPS04_C_HAL );
     1192  xInterpHorChromaOnDepthCondition( pcInputPlaneData, iInputStride, 1, 1, iInputWidth, iHeight, pcOutputPlaneData, iOutputStride, 2, 1, pcDepthPlaneData, iDepthStride, 2, 1, ppiFposLUT, 1, &TRenInterpFilter::xCTI_Filter_VP04_C_OCT2 );
     1193  xInterpHorChromaOnDepthCondition( pcInputPlaneData, iInputStride, 1, 1, iInputWidth, iHeight, pcOutputPlaneData, iOutputStride, 2, 1, pcDepthPlaneData, iDepthStride, 2, 1, ppiFposLUT, 2, &TRenInterpFilter::xCTI_Filter_VP04_C_QUA1 );
     1194  xInterpHorChromaOnDepthCondition( pcInputPlaneData, iInputStride, 1, 1, iInputWidth, iHeight, pcOutputPlaneData, iOutputStride, 2, 1, pcDepthPlaneData, iDepthStride, 2, 1, ppiFposLUT, 3, &TRenInterpFilter::xCTI_Filter_VP04_C_OCT3 );
     1195}
     1196#endif
    11561197
    11571198// Down Sampling
     
    12241265  }
    12251266}
     1267
     1268#if NTT_SUBPEL
     1269Void TRenFilter::xDistributeArrayOnDepthCondition(Pel* pcSrc, Int iSrcStride, Int iSrcStepX, Int iSrcStepY, Int iWidth, Int iHeight, Pel* pcDst, Int iDstStride, Int iDstStepX, Int iDstStepY, Pel* pcDep, Int iDepStride, Int iDepStepX, Int iDepStepY, Int** ppiFposLUT)
     1270{
     1271  iDstStride *= iDstStepY;
     1272  iSrcStride *= iSrcStepY;
     1273  iDepStride *= iDepStepY;
     1274
     1275  for (Int iYPos = 0; iYPos < iHeight; iYPos++ )
     1276  {
     1277    Pel* pcCurDst = pcDst;
     1278    Pel* pcCurSrc = pcSrc;
     1279    Pel* pcCurDep = pcDep;
     1280
     1281    for (Int iXPos = 0; iXPos < iWidth; iXPos ++)
     1282    {
     1283      if( ppiFposLUT[0][ *pcCurDep ] == 0 )
     1284      {
     1285        *pcCurDst = *pcCurSrc;
     1286      }
     1287      pcCurDst += iDstStepX;
     1288      pcCurSrc += iSrcStepX;
     1289      pcCurDep += iDepStepX;
     1290    }
     1291    pcDst  += iDstStride;
     1292    pcSrc  += iSrcStride;
     1293    pcDep  += iDepStride;
     1294  }
     1295}
     1296
     1297Void TRenFilter::xInterpHorChromaOnDepthCondition( Pel* piSrc, Int iSrcStride, Int iSrcStepX, Int iSrcStepY, Int iWidth, Int iHeight, Pel* piDst, Int iDstStride, Int iDstStepX, Int iDstStepY, Pel* piDep, Int iDepStride, Int iDepStepX, Int iDepStepY, Int** ppiFposLUT, Int iTargetFpos, FpChromaIntFilt fpFilter )
     1298{
     1299  Int   iSum;
     1300  Pel*  piSrcTmpP;
     1301  Pel*  piSrcTmpN;
     1302  Pel*  piSrcTmp;
     1303
     1304  Int   iDepX;
     1305
     1306  TRenInterpFilter cFilter;
     1307  for ( Int y = 0; y < iHeight; y++ )
     1308  {
     1309    piSrcTmpP = piSrc - iSrcStepX;
     1310    piSrcTmpN = piSrc - iSrcStepX*2;
     1311    iDepX = 0;
     1312    for ( Int x = 0; x < iWidth; x++ )
     1313    {
     1314#if 0 // NTT bugfix
     1315      if( abs(ppiFposLUT[0][ piDep[iDepX] ]) == iTargetFpos )
     1316#else
     1317      if( ppiFposLUT[0][ piDep[iDepX] ] == iTargetFpos || ppiFposLUT[0][ piDep[iDepX] ]+4 == iTargetFpos )
     1318#endif
     1319      {
     1320        piSrcTmp = ppiFposLUT[0][ piDep[ iDepX ] ] >= 0 ? piSrcTmpP : piSrcTmpN;
     1321        iSum      = (cFilter.*fpFilter)( piSrcTmp,  iSrcStepX );
     1322        piDst[x * iDstStepX ] =  Clip ((iSum +  32) >>  6 );
     1323      }
     1324      piSrcTmpP += iSrcStepX;
     1325      piSrcTmpN += iSrcStepX;
     1326      iDepX += iDepStepX;
     1327    }
     1328    piSrc += iSrcStride * iSrcStepY;
     1329    piDst += iDstStride * iDstStepY;
     1330    piDep += iDepStride * iDepStepY;
     1331  }
     1332}
     1333#endif
    12261334
    12271335
  • branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibRenderer/TRenFilter.h

    r56 r166  
    103103  static Void sampleCUpHorUp    (Int iLog2HorSampFac, Pel* pcInputPlaneData, Int iInputStride, Int iInputWidth, Int iHeight,      Pel* pcOutputPlaneData, Int iOutputStride );
    104104
     105#if NTT_SUBPEL
     106  static Void sampleConv        (Pel* pcInputPlaneData, Int iInputStride, Int iInputWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride, Pel* pcDepthPlaneData, Int iDepthStride, Int** ppiFposLUT );
     107  static Void sampleCVerUp      (Pel* pcInputPlaneData, Int iInputStride, Int iInputWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride );
     108  static Void sampleCConv       (Pel* pcInputPlaneData, Int iInputStride, Int iInputWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride, Pel* pcDepthPlaneData, Int iDepthStride, Int** ppiFposLUT );
     109  static Void sampleCConvHorUp  (Pel* pcInputPlaneData, Int iInputStride, Int iInputWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride, Pel* pcDepthPlaneData, Int iDepthStride, Int** ppiFposLUT );
     110#endif
     111
    105112  //// Down sampling (13 tap)
    106113
     
    131138  static Void xDistributeArray(Pel* pcSrc, Int iSrcStride, Int iSrcStepX, Int iSrcStepY, Int iWidth, Int iHeight, Pel* pcDst, Int iDstStride, Int iDstStepX, Int iDstStepY );
    132139
     140#if NTT_SUBPEL
     141  static Void xDistributeArrayOnDepthCondition(Pel* pcSrc, Int iSrcStride, Int iSrcStepX, Int iSrcStepY, Int iWidth, Int iHeight, Pel* pcDst, Int iDstStride, Int iDstStepX, Int iDstStepY, Pel* pcDep, Int iDepStride, Int iDepStepX, Int iDepStepY, Int** ppiFposLUT);
     142  static Void xInterpHorChromaOnDepthCondition(Pel* piSrc, Int iSrcStride, Int iSrcStepX, Int iSrcStepY, Int iWidth, Int iHeight, Pel* piDst, Int iDstStride, Int iDstStepX, Int iDstStepY, Pel* piDep, Int iDepStride, Int iDepStepX, Int iDepStepY, Int** ppiFposLUT, Int iTargetFpos, FpChromaIntFilt fpFilter );
     143#endif
     144
    133145  // Binominal Filtering
    134146  static Pel  xFiltBinom3     (Pel* pcInputData, Int iStride );
  • branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibRenderer/TRenInterpFilter.h

    r165 r166  
    7272  __inline Void xCTI_FilterQuarter1Hor(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst);
    7373  __inline Void xCTI_FilterQuarter1Hor(Int* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst);
    74  
     74
     75#if NTT_SUBPEL
     76  __inline Void xCTI_FilterHalfHor    (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst, Pel* piDep, Int iDepStride, Int iDepStep, Int** ppiFposLUT);
     77  __inline Void xCTI_FilterQuarter0Hor(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst, Pel* piDep, Int iDepStride, Int iDepStep, Int** ppiFposLUT);
     78  __inline Void xCTI_FilterQuarter1Hor(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst, Pel* piDep, Int iDepStride, Int iDepStep, Int** ppiFposLUT);
     79#endif
     80
    7581  __inline Void xCTI_FilterHalfVer (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Int*& rpiDst, Int iDstStridePel, Pel*& rpiDstPel );
    7682  __inline Void xCTI_FilterHalfVer (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Int*& rpiDst );
     
    683689}
    684690
     691#if NTT_SUBPEL
     692__inline Void TRenInterpFilter::xCTI_FilterHalfHor(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst, Pel* piDep, Int iDepStride, Int iDepStep, Int** ppiFposLUT)
     693{
     694  Pel*  piDst    = rpiDst;
     695  Int   iSum;
     696  Pel*  piSrcTmp;
     697  Int iSrcStep2 = iSrcStep*2;
     698  Int iSrcStep3 = iSrcStep*3;
     699  Int iSrcStep4 = iSrcStep*4;
     700  Int iSrcStep5 = iSrcStep*5;
     701  Int iSrcStep6 = iSrcStep*6;
     702  Int iSrcStep7 = iSrcStep*7;
     703
     704  Int iTmp0, iTmp1, iTmp2, iTmp3, iTmpA;
     705
     706  Pel *piSrcTmpP, *piSrcTmpN;
     707  Int iDepX;
     708
     709  for ( Int y = iHeight; y != 0; y-- )
     710  {
     711    piSrcTmpP = &piSrc[ -3*iSrcStep ];
     712    piSrcTmpN = &piSrc[ -4*iSrcStep ];
     713    iDepX = 0;
     714    for ( Int x = 0; x < iWidth; x++ )
     715    {
     716      // { -1,4,-11,40,40,-11,4,-1   }
     717#if 0 // NTT bugfix
     718      if( abs(ppiFposLUT[0][ piDep[ iDepX ] ]) == 2 )
     719#else
     720      if( ppiFposLUT[0][ piDep[ iDepX ] ] == 2 ||  ppiFposLUT[0][ piDep[ iDepX ] ] == -2 )
     721#endif
     722      {
     723        piSrcTmp = ppiFposLUT[0][ piDep[ iDepX ] ] > 0 ? piSrcTmpP : piSrcTmpN;
     724
     725        iTmp0 = piSrcTmp[        0]+piSrcTmp[iSrcStep7];
     726        iTmp1 = piSrcTmp[iSrcStep]+piSrcTmp[iSrcStep6];
     727        iTmp2 = piSrcTmp[iSrcStep2]+piSrcTmp[iSrcStep5];
     728        iTmp3 = piSrcTmp[iSrcStep3]+piSrcTmp[iSrcStep4];
     729
     730        iTmpA = (iTmp3 << 2) - iTmp2;
     731
     732        iSum  = (   iTmp1          << 2 )
     733              + (   iTmpA          << 3 )
     734              + (   iTmpA          << 1 )
     735              -    iTmp0 -  iTmp2;
     736
     737        piDst   [x * iDstStep] = Clip( (iSum +  32) >>  6 );
     738      }
     739      piSrcTmpP += iSrcStep;
     740      piSrcTmpN += iSrcStep;
     741      iDepX += iDepStep;
     742    }
     743    piSrc += iSrcStride;
     744    piDst += iDstStride;
     745    piDep += iDepStride;
     746  }
     747  return;
     748}
     749
     750__inline Void TRenInterpFilter::xCTI_FilterQuarter0Hor(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst, Pel* piDep, Int iDepStride, Int iDepStep, Int** ppiFposLUT)
     751{
     752  Pel*  piDst    = rpiDst;
     753  Int   iSum;
     754  Pel*  piSrcTmp;
     755  Int iSrcStep2 = iSrcStep*2;
     756  Int iSrcStep3 = iSrcStep*3;
     757  Int iSrcStep4 = iSrcStep*4;
     758  Int iSrcStep5 = iSrcStep*5;
     759  Int iSrcStep6 = iSrcStep*6;
     760  Int iSrcStep7 = iSrcStep*7;
     761
     762  Int iTmp1, iTmp2;
     763
     764  Pel *piSrcTmpP, *piSrcTmpN;
     765  Int iDepX;
     766
     767  for ( Int y = iHeight; y != 0; y-- )
     768  {
     769    piSrcTmpP = &piSrc[ -3*iSrcStep ];
     770    piSrcTmpN = &piSrc[ -4*iSrcStep ];
     771    iDepX = 0;
     772    for ( Int x = 0; x < iWidth; x++ )
     773    {
     774      // {-1,   4,  -10,  57,   19,  -7,   3,   -1  },
     775#if 0 // NTT bugfix
     776      if( abs(ppiFposLUT[0][ piDep[ iDepX ] ]) == 1 )
     777#else
     778      if( ppiFposLUT[0][ piDep[ iDepX ] ] == 1 ||  ppiFposLUT[0][ piDep[ iDepX ] ] == -3 )
     779#endif
     780      {
     781        piSrcTmp = ppiFposLUT[0][ piDep[ iDepX ] ] > 0 ? piSrcTmpP : piSrcTmpN;
     782
     783        iTmp1 = piSrcTmp[iSrcStep3] + piSrcTmp[iSrcStep5];
     784        iTmp2 = piSrcTmp[iSrcStep6] + piSrcTmp[iSrcStep4];
     785
     786        iSum  =  iTmp1 + iTmp2 - piSrcTmp[0] - piSrcTmp[iSrcStep7]
     787               - ( ( piSrcTmp[iSrcStep2] - iTmp2 ) << 1 )
     788               + (  piSrcTmp[iSrcStep]             << 2 )
     789               - ( ( piSrcTmp[iSrcStep2] + iTmp1 ) << 3 )
     790               + (   piSrcTmp[iSrcStep4]           << 4 );
     791
     792        piDst   [x * iDstStep] = Clip(( (iSum +  32) >>  6 )+ piSrcTmp[iSrcStep3]);
     793      }
     794      piSrcTmpP += iSrcStep;
     795      piSrcTmpN += iSrcStep;
     796      iDepX += iDepStep;
     797    }
     798    piSrc += iSrcStride;
     799    piDst += iDstStride;
     800    piDep += iDepStride;
     801  }
     802  return;
     803}
     804
     805__inline Void TRenInterpFilter::xCTI_FilterQuarter1Hor(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst, Pel* piDep, Int iDepStride, Int iDepStep, Int** ppiFposLUT)
     806{
     807  Pel*  piDst    = rpiDst;
     808  Int   iSum;
     809  Pel*  piSrcTmp;
     810  Int iSrcStep2 = iSrcStep*2;
     811  Int iSrcStep3 = iSrcStep*3;
     812  Int iSrcStep4 = iSrcStep*4;
     813  Int iSrcStep5 = iSrcStep*5;
     814  Int iSrcStep6 = iSrcStep*6;
     815  Int iSrcStep7 = iSrcStep*7;
     816
     817  Int  iTmp1, iTmp2;
     818
     819  Pel *piSrcTmpP, *piSrcTmpN;
     820  Int iDepX;
     821
     822  for ( Int y = iHeight; y != 0; y-- )
     823  {
     824    piSrcTmpP = &piSrc[ -3*iSrcStep ];
     825    piSrcTmpN = &piSrc[ -4*iSrcStep ];
     826    iDepX = 0;
     827    for ( Int x = 0; x < iWidth; x++ )
     828    {
     829      // {-1,   3,  -7,  19,   57,  -10,   4,   -1  },
     830#if 0 // NTT bugfix
     831      if( abs(ppiFposLUT[0][ piDep[ iDepX ] ]) == 3 )
     832#else
     833      if( ppiFposLUT[0][ piDep[ iDepX ] ] == 3 ||  ppiFposLUT[0][ piDep[ iDepX ] ] == -1 )
     834#endif
     835      {
     836        piSrcTmp = ppiFposLUT[0][ piDep[ iDepX ] ] > 0 ? piSrcTmpP : piSrcTmpN;
     837
     838        iTmp1 = piSrcTmp[iSrcStep4] + piSrcTmp[iSrcStep2];
     839        iTmp2 = piSrcTmp[iSrcStep ] + piSrcTmp[iSrcStep3];
     840
     841        iSum  =  iTmp1 + iTmp2 - piSrcTmp[0] - piSrcTmp[iSrcStep7]
     842              - ( ( piSrcTmp[iSrcStep5] - iTmp2 ) << 1 )
     843              + (   piSrcTmp[iSrcStep6]           << 2 )
     844              - ( ( piSrcTmp[iSrcStep5] + iTmp1 ) << 3 )
     845              + (   piSrcTmp[iSrcStep3]           << 4 );
     846     
     847        piDst   [x * iDstStep] = Clip( ((iSum +  32) >>  6) + piSrcTmp[iSrcStep4] );
     848      }
     849      piSrcTmpP += iSrcStep;
     850      piSrcTmpN += iSrcStep;
     851      iDepX += iDepStep;
     852    }
     853    piSrc += iSrcStride;
     854    piDst += iDstStride;
     855    piDep += iDepStride;
     856  }
     857  return;
     858}
     859#endif
     860
    685861__inline Void TRenInterpFilter::xCTI_FilterQuarter0Hor(Int* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst)
    686862{
  • branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibRenderer/TRenModel.cpp

    r101 r166  
    700700  }
    701701}
     702
  • branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibRenderer/TRenSingleModel.cpp

    r100 r166  
    19431943}
    19441944#endif
     1945
  • branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibRenderer/TRenTop.cpp

    r100 r166  
    127127}
    128128
     129#if NTT_SUBPEL
     130Void TRenTop::xConvertInputVideoSubpel( PelImage* pcOrgInputImage, PelImage* pcConvInputImage, PelImage* pcInputDepth, Bool bMirror )
     131{
     132  PelImagePlane*  pcOrgPlane;
     133  PelImagePlane*  pcConvPlane;
     134  PelImagePlane*  pcDepthPlane;
     135  PelImagePlane*  pcTmpPlane;
     136
     137  Int    ** ppiFposLUT = bMirror ? m_ppiFposLUTRightMirror : m_ppiFposLUTLeft;
     138
     139  AOT( m_iLog2SamplingFactor );
     140  AOF( m_iInterpolationMode == eRenInt8Tap2 );
     141
     142  pcDepthPlane = pcInputDepth->getPlane( 0 );
     143  pcTmpPlane = pcConvInputImage->getPlane( 0 );
     144
     145  AOF( m_bUVUp ); // Currently only m_bUVUp=true is supported
     146  for (UInt uiPlane = 1; uiPlane < 3; uiPlane++)
     147  {
     148    pcOrgPlane  = pcOrgInputImage ->getPlane(uiPlane);
     149    pcConvPlane = pcConvInputImage->getPlane(uiPlane);
     150
     151    if ( m_bUVUp )
     152    {
     153      TRenFilter::sampleCVerUp    (pcOrgPlane->getPlaneData(), pcOrgPlane->getStride(), pcOrgPlane->getWidth(), pcOrgPlane->getHeight()  , pcTmpPlane ->getPlaneData(), pcTmpPlane ->getStride() );
     154      TRenFilter::sampleCConvHorUp(pcTmpPlane->getPlaneData(), pcTmpPlane->getStride(), pcOrgPlane->getWidth(), pcOrgPlane->getHeight()*2, pcConvPlane->getPlaneData(), pcConvPlane->getStride(), pcDepthPlane->getPlaneData(), pcDepthPlane->getStride(), ppiFposLUT );
     155    }
     156    else
     157    {
     158      TRenFilter::sampleCConv     (pcOrgPlane->getPlaneData(), pcOrgPlane->getStride(), pcOrgPlane->getWidth(), pcOrgPlane->getHeight()*2, pcConvPlane->getPlaneData(), pcConvPlane->getStride(), pcDepthPlane->getPlaneData(), pcDepthPlane->getStride(), ppiFposLUT );
     159    }
     160  }
     161
     162  pcOrgPlane  = pcOrgInputImage ->getPlane(0);
     163  pcConvPlane = pcConvInputImage->getPlane(0);
     164  TRenFilter::sampleConv(pcOrgPlane->getPlaneData(), pcOrgPlane->getStride(), pcOrgPlane->getWidth(), pcOrgPlane->getHeight(), pcConvPlane->getPlaneData(), pcConvPlane->getStride(), pcDepthPlane->getPlaneData(), pcDepthPlane->getStride(), ppiFposLUT);
     165}
     166
     167Void TRenTop::xConvertInputDepthSubpel( PelImage* pcOrgInputImage, PelImage* pcConvInputImage)
     168{
     169  PelImagePlane*  pcOrgPlane ;
     170  PelImagePlane*  pcConvPlane;
     171
     172  // Full Plane
     173  pcOrgPlane  = pcOrgInputImage ->getPlane(0);
     174  pcConvPlane = pcConvInputImage->getPlane(0);
     175
     176  AOT( m_iLog2SamplingFactor );
     177  AOF( m_iInterpolationMode == eRenInt8Tap2 );
     178
     179  TRenFilter::sampleHorUp(m_iLog2SamplingFactor, pcOrgPlane->getPlaneData(), pcOrgPlane->getStride(), pcOrgPlane->getWidth(), pcOrgPlane->getHeight(), pcConvPlane->getPlaneData(), pcConvPlane->getStride());
     180
     181  AOF( m_bUVUp );
     182  if ( !m_bUVUp ) //GT: depth down
     183  {
     184    // Quarter Plane
     185    PelImagePlane* pcTempPlane = new PelImagePlane(pcOrgInputImage->getPlane(0)->getWidth(), ( pcOrgInputImage->getPlane(0)->getHeight() >> 1), REN_LUMA_MARGIN );
     186
     187    TRenFilter::sampleVerDown2Tap13(pcOrgInputImage->getPlane(0), pcTempPlane, PICYUV_PAD);
     188    pcConvPlane = pcConvInputImage->getPlane(1);
     189
     190    if ( m_iLog2SamplingFactor == 0 )
     191    {
     192      TRenFilter::sampleHorDown2Tap13(pcTempPlane, pcConvPlane, 0 );
     193    }
     194    else
     195    {
     196      TRenFilter::sampleHorUp    ( m_iLog2SamplingFactor - 1, pcTempPlane->getPlaneData(), pcTempPlane->getStride(), pcTempPlane->getWidth(), pcTempPlane->getHeight(), pcConvPlane->getPlaneData(), pcConvPlane->getStride());
     197    }
     198    delete pcTempPlane;
     199  }
     200}
     201#endif
     202
    129203Void TRenTop::xConvertInputDepth( PelImage* pcOrgInputImage, PelImage* pcConvInputImage)
    130204{
     
    193267}
    194268
     269#if NTT_SUBPEL
     270Void TRenTop::xConvertInputDataSubpel( PelImage* pcOrgInputImage, PelImage* pcOrgInputDepth, PelImage* pcConvInputImage, PelImage* pcConvInputDepth, Bool bMirror )
     271{
     272  //ToDo: remove unnecessary copying
     273  if ( bMirror )
     274  {
     275    m_pcTempImage->getPlane(0)->assign( pcOrgInputDepth->getPlane(0) );
     276    TRenFilter::mirrorHor( m_pcTempImage->getPlane(0) );
     277    m_pcTempImage->getPlane(0)->extendMargin();
     278    xConvertInputDepthSubpel( m_pcTempImage, pcConvInputDepth );
     279
     280    m_pcTempImage->assign( pcOrgInputImage );
     281    TRenFilter::mirrorHor( m_pcTempImage );
     282    m_pcTempImage->extendMargin();
     283    xConvertInputVideoSubpel( m_pcTempImage, pcConvInputImage, pcConvInputDepth, bMirror );
     284  }
     285  else
     286  {
     287    m_pcTempImage->getPlane(0)->assign( pcOrgInputDepth->getPlane(0) );
     288    m_pcTempImage->getPlane(0)->extendMargin();
     289    xConvertInputDepthSubpel( m_pcTempImage, pcConvInputDepth );
     290
     291    m_pcTempImage->assign( pcOrgInputImage );
     292    m_pcTempImage->extendMargin();
     293    xConvertInputVideoSubpel( m_pcTempImage, pcConvInputImage, pcConvInputDepth, bMirror );
     294  }
     295}
     296#endif
    195297
    196298Void TRenTop::xConvertOutputData( PelImage* pcOrgOutputImage, PelImage* pcConvOutputImage, Bool bMirror )
     
    229331}
    230332
     333#if VSP_N
     334Void TRenTop::xConvertOutputDataPlane0( PelImage* pcOrgOutputImage, PelImage* pcConvOutputImage, Bool bMirror )
     335{
     336  Int iLog2SamplingFactor = m_iLog2SamplingFactor;
     337
     338  PelImagePlane* pcOrgPlane  = pcOrgOutputImage ->getPlane(0);
     339  PelImagePlane* pcConvPlane = pcConvOutputImage->getPlane(0);
     340
     341  pcOrgPlane->extendMargin();
     342
     343  TRenFilter::sampleHorDown( iLog2SamplingFactor, pcOrgPlane->getPlaneData(), pcOrgPlane->getStride(), pcOrgPlane->getWidth(), pcOrgPlane->getHeight(), pcConvPlane->getPlaneData(), pcConvPlane->getStride());
     344
     345  if ( bMirror )
     346  {
     347    TRenFilter::mirrorHor( pcConvOutputImage );
     348  }
     349
     350}
     351#endif
     352
    231353Void TRenTop::setShiftLUTs( Double** ppdShiftLUTLeft, Int** ppiShiftLUTLeft, Int** ppiBaseShiftLUTLeft, Double** ppdShiftLUTRight, Int** ppiShiftLUTRight, Int** ppiBaseShiftLUTRight,  Int iRelDistToLeft )
    232354{
     
    254376  }
    255377}
     378
     379#if NTT_SUBPEL
     380Void TRenTop::setFposLUTs( Int** ppiFposLUTLeft, Int** ppiFposLUTRight )
     381{
     382  m_ppiFposLUTLeft  = ppiFposLUTLeft;
     383  m_ppiFposLUTRight = ppiFposLUTRight;
     384
     385  if (  m_ppiFposLUTRight != NULL )
     386  {
     387    for( UInt uiPlane = 0; uiPlane < 2; uiPlane++)
     388    {
     389      for (UInt uiDepthValue = 0; uiDepthValue <= 256; uiDepthValue++)
     390      {
     391        m_ppiFposLUTRightMirror[uiPlane][uiDepthValue] = - m_ppiFposLUTRight[uiPlane][uiDepthValue];
     392      }
     393    }
     394  }
     395}
     396#endif
    256397
    257398Void TRenTop::extrapolateView( TComPicYuv* pcPicYuvVideo, TComPicYuv* pcPicYuvDepth, TComPicYuv* pcPicYuvSynthOut, Bool bRenderFromLeft )
     
    278419  xCutMargin        ( &cOutputImage );
    279420};
     421
     422#if VSP_N
     423Void TRenTop::extrapolateAvailabilityView( TComPicYuv* pcPicYuvVideo, TComPicYuv* pcPicYuvDepth, TComPicYuv* pcPicYuvSynthOut, TComPicYuv* pcPicYuvAvailOut, Bool bRenderFromLeft )
     424{
     425  AOF( m_bExtrapolate );
     426  AOF( bRenderFromLeft ? m_ppiShiftLUTLeft || m_ppdShiftLUTLeft : m_ppiShiftLUTRight || m_ppdShiftLUTRight );
     427  AOF( m_auiInputResolution[0] == pcPicYuvVideo->getWidth ());
     428  AOF( m_auiInputResolution[1] == pcPicYuvVideo->getHeight());
     429
     430  PelImage cInputImage ( pcPicYuvVideo    );
     431  PelImage cInputDepth ( pcPicYuvDepth    , true);
     432  PelImage cOutputImage( pcPicYuvSynthOut );
     433  PelImage cFillImage  ( pcPicYuvAvailOut );
     434
     435  m_pcOutputImage->init();
     436  m_pcFilled     ->assign(REN_IS_HOLE);
     437
     438  xPreProcessDepth ( &cInputDepth,  &cInputDepth);
     439#if NTT_SUBPEL
     440  if( m_iInterpolationMode == eRenInt8Tap2 )
     441    xConvertInputDataSubpel(&cInputImage, &cInputDepth, m_pcInputImage, m_pcInputDepth, !bRenderFromLeft );
     442  else
     443    xConvertInputData( &cInputImage, &cInputDepth, m_pcInputImage, m_pcInputDepth, !bRenderFromLeft );
     444#else
     445  xConvertInputData( &cInputImage, &cInputDepth, m_pcInputImage, m_pcInputDepth, !bRenderFromLeft );
     446#endif
     447  xShiftPixels(m_pcInputImage, m_pcInputDepth, m_pcOutputImage, m_pcFilled, bRenderFromLeft);
     448  xRemBoundaryNoise ( m_pcOutputImage, m_pcFilled, m_pcOutputImage, bRenderFromLeft); // Erode
     449  xFillHoles        ( m_pcOutputImage, m_pcFilled, m_pcOutputImage, bRenderFromLeft);
     450  xConvertOutputData( m_pcOutputImage, &cOutputImage, !bRenderFromLeft );
     451  //if (!bRenderFromLeft)  TRenFilter::mirrorHor( &cFillImage );
     452  xConvertOutputDataPlane0( m_pcFilled, &cFillImage, !bRenderFromLeft );
     453  xPostProcessImage (&cOutputImage, &cOutputImage);
     454  xCutMargin        ( &cOutputImage );
     455};
     456#endif
    280457
    281458Void TRenTop::getUsedSamplesMap( TComPicYuv* pcPicYuvDepth, TComPicYuv* pcUsedSampleMap, Bool bRenderFromLeft )
     
    751928  {
    752929  case eRenIntFullPel:
     930#if NTT_SUBPEL
     931  case eRenInt8Tap2:
     932#endif
    753933    xShiftPlanePixelsFullPel( apcInPlane, pcDepthPlane, apcOutPlane, pcPlaneFilled, uiNumberOfPlanes);
    754934    break;
     
    8261006          }
    8271007          pcFilledData[iShiftedPos] = REN_IS_FILLED;
     1008
     1009#if NTT_SUBPEL
     1010          if(m_bInstantHoleFilling && (iDiff > 0) )
     1011          {
     1012            Int iRefPos = (iPrevShiftedPos == -1) ? iShiftedPos : iPrevShiftedPos;
     1013           
     1014            for (Int iCurPos = iPrevShiftedPos+1; iCurPos < iShiftedPos; iCurPos++)
     1015            {
     1016              for( UInt uiCurPlane = 0; uiCurPlane < uiNumberOfPlanes; uiCurPlane++)
     1017              {
     1018                apcOutputData[uiCurPlane][iCurPos] =  apcOutputData[uiCurPlane][iRefPos];
     1019              }
     1020              pcFilledData[iCurPos] = REN_IS_FILLED;
     1021            }
     1022          }
     1023#endif
    8281024        }
    8291025        iPrevShiftedPos = iShiftedPos;
    8301026      }
    8311027    }
     1028#if NTT_SUBPEL
     1029    if( (iPrevShiftedPos+1) != iWidth )
     1030    {
     1031      for (Int iCurPos = iPrevShiftedPos+1; iCurPos < iWidth; iCurPos++)
     1032      {
     1033        for( UInt uiCurPlane = 0; uiCurPlane < uiNumberOfPlanes; uiCurPlane++)
     1034        {
     1035          apcOutputData[uiCurPlane][iCurPos] =  apcOutputData[uiCurPlane][iPrevShiftedPos];
     1036        }
     1037        pcFilledData[iCurPos] = REN_IS_FILLED;
     1038      }
     1039    }
     1040#endif
    8321041    for( UInt uiCurPlane = 0; uiCurPlane < uiNumberOfPlanes; uiCurPlane++)
    8331042    {
     
    14501659
    14511660    for( Int iXPos = iSourcePos + 1; iXPos <  iWidth; iXPos++)
    1452         {
     1661    {
    14531662      for( UInt uiCurPlane = 0; uiCurPlane < uiNumberOfPlanes; uiCurPlane++)
    1454           {
     1663      {
    14551664        apcOutputData[uiCurPlane][iXPos] = apcInputData[uiCurPlane][iSourcePos];
    14561665      }
    1457             }
     1666    }
    14581667
    14591668    // Fill Left Gap
     
    14691678      {
    14701679        apcOutputData[uiCurPlane][iXPos] = apcInputData[uiCurPlane][iSourcePos];
    1471           }
    1472         }
     1680      }
     1681    }
    14731682
    14741683    // Go to next line
     
    20322241  m_ppiShiftLUTRightMirror[0] = new Int[257];
    20332242  m_ppiShiftLUTRightMirror[1] = new Int[257];
     2243
     2244#if NTT_SUBPEL
     2245  m_ppiFposLUTLeft   = 0;
     2246  m_ppiFposLUTRight  = 0;
     2247  m_ppiFposLUTRightMirror    = new Int*[2];
     2248  m_ppiFposLUTRightMirror[0] = new Int[257];
     2249  m_ppiFposLUTRightMirror[1] = new Int[257];
     2250#endif
    20342251
    20352252  m_aiShiftLUTCur    = 0;
     
    21162333  m_iHoleFillingMode = iHoleFillingMode;
    21172334
     2335#if NTT_SUBPEL
     2336  m_bInstantHoleFilling   = (m_iInterpolationMode == eRenInt8Tap || m_iInterpolationMode == eRenInt8Tap2 ) && (m_iHoleFillingMode != 0 );
     2337#else
    21182338  m_bInstantHoleFilling   = (m_iInterpolationMode == eRenInt8Tap ) && (m_iHoleFillingMode != 0 );
     2339#endif
    21192340
    21202341  // PostProcessing
     
    21542375    {
    21552376      m_aaiSubPelShift[uiEntry] = new Int[ iNumEntries ];
    2156         }
     2377    }
    21572378
    21582379    TRenFilter::setSubPelShiftLUT(m_iRelShiftLUTPrec, m_aaiSubPelShift, -1);
     
    21842405  };
    21852406
     2407#if NTT_SUBPEL
     2408  if ( m_ppiFposLUTRightMirror != NULL )
     2409  {
     2410    delete[] m_ppiFposLUTRightMirror[0];
     2411    delete[] m_ppiFposLUTRightMirror[1];
     2412    delete[] m_ppiFposLUTRightMirror;
     2413  };
     2414#endif
     2415
    21862416  if (m_piInvZLUTLeft      != NULL ) delete[] m_piInvZLUTLeft   ;
    21872417  if (m_piInvZLUTLeft      != NULL ) delete[] m_piInvZLUTRight  ;
  • branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibRenderer/TRenTop.h

    r56 r166  
    5050  // Interpolation Modes
    5151
     52#if NTT_SUBPEL
     53  enum { eRenIntFullPel = 0, eRenIntLinInt = 1, eRenIntLinReal = 2, eRenIntFEM = 3, eRenInt8Tap = 4, eRenInt8Tap2 = 5 };
     54#else
    5255  enum { eRenIntFullPel = 0, eRenIntLinInt = 1, eRenIntLinReal = 2, eRenIntFEM = 3, eRenInt8Tap = 4 };
     56#endif
    5357
    5458  // HoleFilling
     
    9397                           Int**    ppiBaseShiftLUTRight,
    9498                           Int      iRelDistLeft );
     99#if NTT_SUBPEL
     100  Void setFposLUTs      ( Int**    ppiFposLUTLeft, Int**    ppiFposLUTRight );
     101  Void setInterpolationMode ( Int iMode ) { m_iInterpolationMode = iMode; }
     102#endif
    95103
    96104  // View Synthesis
     
    99107                           TComPicYuv* pcPicYuvSynthOut,
    100108                           Bool bRenderFromLeft );
     109
     110#if VSP_N
     111  Void extrapolateAvailabilityView   ( TComPicYuv* pcPicYuvVideo,
     112                                       TComPicYuv* pcPicYuvDepth,
     113                                       TComPicYuv* pcPicYuvSynthOut,
     114                                       TComPicYuv* pcPicYuvAvailOut,
     115                                       Bool bRenderFromLeft );
     116#endif
    101117
    102118  Void interpolateView   ( TComPicYuv* pcPicYuvVideoLeft,
     
    166182  Void xConvertInputData         ( PelImage* pcOrgInputImage, PelImage* pcOrgInputDepth, PelImage* pcConvInputImage, PelImage* pcConvInputDepth, Bool bMirror);
    167183  Void xConvertOutputData        ( PelImage* pOrgOutputImage, PelImage* pConvOutputImage, Bool bMirror);
     184#if VSP_N
     185  Void xConvertOutputDataPlane0  ( PelImage* pOrgOutputImage, PelImage* pConvOutputImage, Bool bMirror);
     186#endif
     187#if NTT_SUBPEL
     188  Void xConvertInputDataSubpel   ( PelImage* pcOrgInputImage, PelImage* pcOrgInputDepth, PelImage* pcConvInputImage, PelImage* pcConvInputDepth, Bool bMirror);
     189  Void xConvertInputVideoSubpel  ( PelImage* pcOrgInputImage, PelImage* pcConvInputImage, PelImage* pcInputDepth, Bool bMirror );
     190  Void xConvertInputDepthSubpel  ( PelImage* pcOrgInputImage, PelImage* pcConvInputImage);
     191#endif
    168192
    169193  Void xGetDataPointers          ( PelImage*& rpcInputImage,  PelImage*& rpcOutputImage, PelImage*& rpcInputDepth, PelImage*& rpcOutputDepth, PelImage*& rpcFilled, Bool bRenderDepth );
     
    229253  Int**    m_ppiShiftLUTRightMirror; // For rendering the mirrored view
    230254  Int*     m_aiShiftLUTCur;
     255#if NTT_SUBPEL
     256  Int**    m_ppiFposLUTLeft;
     257  Int**    m_ppiFposLUTRight;
     258  Int**    m_ppiFposLUTRightMirror; // For rendering the mirrored view
     259#endif
    231260
    232261  // Look up tables Z
Note: See TracChangeset for help on using the changeset viewer.