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.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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  ;
Note: See TracChangeset for help on using the changeset viewer.