Ignore:
Timestamp:
26 Jan 2013, 19:36:53 (12 years ago)
Author:
mitsubishi-htm
Message:

-Integration of JCT3V-C0152 & JCT3V-C0131
-This check-in enable C0131 only

Location:
branches/HTM-5.1-dev3-MERL/source/Lib/TLibDecoder
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-5.1-dev3-MERL/source/Lib/TLibDecoder/TDecCu.cpp

    r189 r231  
    361361
    362362      UInt uiCurrPartNumb = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1);
     363
    363364      for( UInt ui = 0; ui < uiCurrPartNumb; ui++ )
    364365      {
    365366        const UChar uhNewDepth = max<UInt>( uiDepth, pcTextureCU->getDepth( uiAbsPartIdx + ui ) );
     367#if MERL_VSP_C0152
     368        Int vspIdx = pcTextureCU->getVSPIndex( uiAbsPartIdx + ui);
     369        pcCU->setVSPIndex( uiAbsPartIdx + ui, vspIdx);
     370#endif
    366371        pcCU->setPredictionMode( uiAbsPartIdx + ui, MODE_SKIP );
    367372        pcCU->setPartitionSize( uiAbsPartIdx + ui, SIZE_2Nx2N );
     
    376381#if SIMP_MRG_PRUN     
    377382    UInt uiMergeIndex = pcCU->getMergeIndex(uiAbsPartIdx);
     383#if MERL_VSP_C0152
     384    Int iVSPIndexTrue[3] = {-1, -1, -1};
     385    m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, iVSPIndexTrue, uiMergeIndex );
     386    {
     387      Int iVSPIdx = 0;
     388      Int numVspIdx;
     389      numVspIdx = 3;
     390      for (Int i = 0; i < numVspIdx; i++)
     391      {
     392        if (iVSPIndexTrue[i] == uiMergeIndex)
     393          {
     394            iVSPIdx = i+1;
     395            break;
     396          }
     397      }
     398      pcCU->setVSPIndexSubParts( iVSPIdx, uiAbsPartIdx, 0, uiDepth );  //Initialize the VSP, may change later in get InterMergeCandidates()
     399    }
     400#else
    378401    m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
     402#endif
    379403#else
    380404    m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
     
    467491
    468492      UInt uiCurrPartNumb = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1);
     493
    469494      for( UInt ui = 0; ui < uiCurrPartNumb; ui++ )
    470495      {
    471496        const UChar uhNewDepth = max<UInt>( uiDepth, pcTextureCU->getDepth( uiAbsPartIdx + ui ) );
     497#if MERL_VSP_C0152
     498        Int vspIdx = pcTextureCU->getVSPIndex( uiAbsPartIdx + ui);
     499        pcCU->setVSPIndex( uiAbsPartIdx + ui, vspIdx);
     500#endif
    472501        pcCU->setPredictionMode( uiAbsPartIdx + ui, MODE_INTER );
    473502        pcCU->setPartitionSize( uiAbsPartIdx + ui, SIZE_2Nx2N );
     
    658687 
    659688  // inter prediction
     689#if MERL_VSP_C0152
     690  m_pcPrediction->motionCompensationBWVSP( pcCU, m_ppcYuvReco[uiDepth], uiAbsPartIdx );
     691#else
    660692  m_pcPrediction->motionCompensation( pcCU, m_ppcYuvReco[uiDepth] );
    661  
     693#endif
    662694#if HHI_MPI
    663695  if( pcCU->getTextureModeDepth( 0 ) != -1 )
     
    10471079  // reconstruct residual based on mask + DC residuals
    10481080  Pel apDCResiValues[2];
    1049   Pel apDCRecoValues[2];
     1081  //Pel apDCRecoValues[2];
    10501082  for( UInt ui = 0; ui < uiNumSegments; ui++ )
    10511083  {
     
    10541086    Pel   pRecoValue  = GetIdx2DepthValue( pPredIdx + pResiIdx );
    10551087   
    1056     apDCRecoValues[ui]  = pRecoValue;
     1088    //apDCRecoValues[ui]  = pRecoValue;
    10571089    apDCResiValues[ui]  = pRecoValue - apDCPredValues[ui];
    10581090  }
  • branches/HTM-5.1-dev3-MERL/source/Lib/TLibDecoder/TDecCu.h

    r189 r231  
    6565#endif
    6666  TComDataCU**        m_ppcCU;            ///< CU data array
    67  
     67
    6868  // access channel
    6969  TComTrQuant*        m_pcTrQuant;
     
    8585  /// destroy internal buffers
    8686  Void  destroy                 ();
    87  
     87
    8888  /// decode CU information
    8989  Void  decodeCU                ( TComDataCU* pcCU, UInt& ruiIsLast );
  • branches/HTM-5.1-dev3-MERL/source/Lib/TLibDecoder/TDecEntropy.cpp

    r189 r231  
    337337#if SIMP_MRG_PRUN       
    338338      UInt uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx);
     339#if MERL_VSP_C0152
     340      Int iVSPIndexTrue[3] = {-1, -1, -1};
     341      pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, iVSPIndexTrue, uiMergeIndex );
     342
     343      if(pcCU->getTextureModeDepth( uiSubPartIdx ) == uiDepth)//MPI is used
     344      {
     345        TComDataCU *pcTextureCU = pcCU->getSlice()->getTexturePic()->getCU( pcCU->getAddr() );
     346        UInt uiCurrPartNumb = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1);
     347        for( UInt ui = 0; ui < uiCurrPartNumb; ui++ )
     348        {
     349          Int vspIdx = pcTextureCU->getVSPIndex( uiAbsPartIdx + ui);
     350          pcCU->setVSPIndex( uiAbsPartIdx + ui, vspIdx);
     351        }
     352      }
     353      else // MPI not used
     354      {
     355        Int iVSPIdx = 0;
     356        Int numVspIdx;
     357        numVspIdx = 3;
     358        for (Int i = 0; i < numVspIdx; i++)
     359        {
     360          if (iVSPIndexTrue[i] == uiMergeIndex)
     361            {
     362              iVSPIdx = i+1;
     363              break;
     364            }
     365        }
     366        pcCU->setVSPIndexSubParts( iVSPIdx, uiSubPartIdx, uiPartIdx, uiDepth );  //Initialize the VSP, may change later in get InterMergeCandidates()
     367      }
     368
     369#else
    339370      pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
     371#endif
    340372#else     
    341373      pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
  • branches/HTM-5.1-dev3-MERL/source/Lib/TLibDecoder/TDecGop.cpp

    r189 r231  
    511511    m_vAlfCUCtrlSlices.clear();
    512512  }
     513  fflush(stdout);
    513514}
    514515
  • branches/HTM-5.1-dev3-MERL/source/Lib/TLibDecoder/TDecTop.cpp

    r210 r231  
    5959    m_aaiCodedScale       [ uiId ] = new Int [ MAX_VIEW_NUM ];
    6060  }
     61
     62#if MERL_VSP_C0152
     63  xCreateLUTs( (UInt)MAX_VIEW_NUM, (UInt)MAX_VIEW_NUM, m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT );
     64  m_iLog2Precision   = LOG2_DISP_PREC_LUT;
     65  m_uiBitDepthForLUT = 8; // fixed
     66#endif
    6167}
    6268
     
    7278  delete [] m_aiViewOrderIndex;
    7379  delete [] m_aiViewReceived;
     80
     81#if MERL_VSP_C0152
     82  xDeleteArray( m_adBaseViewShiftLUT, MAX_VIEW_NUM, MAX_VIEW_NUM, 2 );
     83  xDeleteArray( m_aiBaseViewShiftLUT, MAX_VIEW_NUM, MAX_VIEW_NUM, 2 );
     84#endif
    7485}
    7586
     
    8596  m_uiMaxViewId             = 0;
    8697}
     98
     99#if MERL_VSP_C0152
     100Void
     101CamParsCollector::xCreateLUTs( UInt uiNumberSourceViews, UInt uiNumberTargetViews, Double****& radLUT, Int****& raiLUT)
     102{
     103  //AOF( m_uiBitDepthForLUT == 8 );
     104  //AOF(radLUT == NULL && raiLUT == NULL );
     105
     106  uiNumberSourceViews = Max( 1, uiNumberSourceViews );
     107  uiNumberTargetViews = Max( 1, uiNumberTargetViews );
     108
     109  radLUT         = new Double***[ uiNumberSourceViews ];
     110  raiLUT         = new Int   ***[ uiNumberSourceViews ];
     111
     112  for( UInt uiSourceView = 0; uiSourceView < uiNumberSourceViews; uiSourceView++ )
     113  {
     114    radLUT        [ uiSourceView ] = new Double**[ uiNumberTargetViews ];
     115    raiLUT        [ uiSourceView ] = new Int   **[ uiNumberTargetViews ];
     116
     117    for( UInt uiTargetView = 0; uiTargetView < uiNumberTargetViews; uiTargetView++ )
     118    {
     119      radLUT        [ uiSourceView ][ uiTargetView ]      = new Double*[ 2 ];
     120      radLUT        [ uiSourceView ][ uiTargetView ][ 0 ] = new Double [ 257 ];
     121      radLUT        [ uiSourceView ][ uiTargetView ][ 1 ] = new Double [ 257 ];
     122
     123      raiLUT        [ uiSourceView ][ uiTargetView ]      = new Int*   [ 2 ];
     124      raiLUT        [ uiSourceView ][ uiTargetView ][ 0 ] = new Int    [ 257 ];
     125      raiLUT        [ uiSourceView ][ uiTargetView ][ 1 ] = new Int    [ 257 ];
     126    }
     127  }
     128}
     129
     130Void
     131  CamParsCollector::xInitLUTs( UInt uiSourceView, UInt uiTargetView, Int iScale, Int iOffset, Double****& radLUT, Int****& raiLUT)
     132{
     133  Int     iLog2DivLuma   = m_uiBitDepthForLUT + m_uiCamParsCodedPrecision + 1 - m_iLog2Precision;   AOF( iLog2DivLuma > 0 );
     134  Int     iLog2DivChroma = iLog2DivLuma + 1;
     135
     136  iOffset <<= m_uiBitDepthForLUT;
     137
     138  Double dScale  = (Double) iScale  / (( Double ) ( 1 << iLog2DivLuma ));
     139  Double dOffset = (Double) iOffset / (( Double ) ( 1 << iLog2DivLuma ));
     140
     141  // offsets including rounding offsets
     142  Int64 iOffsetLuma   = iOffset + ( ( 1 << iLog2DivLuma   ) >> 1 );
     143  Int64 iOffsetChroma = iOffset + ( ( 1 << iLog2DivChroma ) >> 1 );
     144
     145
     146  for( UInt uiDepthValue = 0; uiDepthValue < 256; uiDepthValue++ )
     147  {
     148
     149    // real-valued look-up tables
     150    Double  dShiftLuma      = ( (Double)uiDepthValue * dScale + dOffset ) * Double( 1 << m_iLog2Precision );
     151    Double  dShiftChroma    = dShiftLuma / 2;
     152    radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ uiDepthValue ] = dShiftLuma;
     153    radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ uiDepthValue ] = dShiftChroma;
     154
     155    // integer-valued look-up tables
     156    Int64   iTempScale      = (Int64)uiDepthValue * iScale;
     157    Int64   iShiftLuma      = ( iTempScale + iOffsetLuma   ) >> iLog2DivLuma;
     158    Int64   iShiftChroma    = ( iTempScale + iOffsetChroma ) >> iLog2DivChroma;
     159    raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ uiDepthValue ] = (Int)iShiftLuma;
     160    raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ uiDepthValue ] = (Int)iShiftChroma;
     161
     162    // maximum deviation
     163    //dMaxDispDev     = Max( dMaxDispDev,    fabs( Double( (Int) iTestScale   ) - dShiftLuma * Double( 1 << iLog2DivLuma ) ) / Double( 1 << iLog2DivLuma ) );
     164    //dMaxRndDispDvL  = Max( dMaxRndDispDvL, fabs( Double( (Int) iShiftLuma   ) - dShiftLuma   ) );
     165    //dMaxRndDispDvC  = Max( dMaxRndDispDvC, fabs( Double( (Int) iShiftChroma ) - dShiftChroma ) );
     166  }
     167
     168  radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 256 ] = radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 255 ];
     169  radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 256 ] = radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 255 ];
     170  raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 256 ] = raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 255 ];
     171  raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 256 ] = raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 255 ];
     172}
     173#endif // end MERL_VSP_C0152
    87174
    88175Void
     
    167254        m_aaiCodedScale [ uiViewId ][ uiBaseId ]  = pcSlice->getInvCodedScale () [ uiBaseId ];
    168255        m_aaiCodedOffset[ uiViewId ][ uiBaseId ]  = pcSlice->getInvCodedOffset() [ uiBaseId ];
     256#if MERL_VSP_C0152
     257        xInitLUTs( uiBaseId, uiViewId, m_aaiCodedScale[ uiBaseId ][ uiViewId ], m_aaiCodedOffset[ uiBaseId ][ uiViewId ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT);
     258        xInitLUTs( uiViewId, uiBaseId, m_aaiCodedScale[ uiViewId ][ uiBaseId ], m_aaiCodedOffset[ uiViewId ][ uiBaseId ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT);
     259#endif
    169260      }
    170261      else
     
    174265        m_aaiCodedScale [ uiViewId ][ uiBaseId ]  = pcSlice->getSPS()->getInvCodedScale () [ uiBaseId ];
    175266        m_aaiCodedOffset[ uiViewId ][ uiBaseId ]  = pcSlice->getSPS()->getInvCodedOffset() [ uiBaseId ];
     267#if MERL_VSP_C0152
     268        xInitLUTs( uiBaseId, uiViewId, m_aaiCodedScale[ uiBaseId ][ uiViewId ], m_aaiCodedOffset[ uiBaseId ][ uiViewId ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT );
     269        xInitLUTs( uiViewId, uiBaseId, m_aaiCodedScale[ uiViewId ][ uiBaseId ], m_aaiCodedOffset[ uiViewId ][ uiBaseId ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT );
     270#endif
    176271      }
    177272    }
     
    188283        m_aaiCodedScale [ uiViewId ][ uiBaseId ]  = pcSlice->getInvCodedScale () [ uiBaseId ];
    189284        m_aaiCodedOffset[ uiViewId ][ uiBaseId ]  = pcSlice->getInvCodedOffset() [ uiBaseId ];
     285#if MERL_VSP_C0152
     286        xInitLUTs( uiBaseId, uiViewId, m_aaiCodedScale[ uiBaseId ][ uiViewId ], m_aaiCodedOffset[ uiBaseId ][ uiViewId ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT );
     287        xInitLUTs( uiViewId, uiBaseId, m_aaiCodedScale[ uiViewId ][ uiBaseId ], m_aaiCodedOffset[ uiViewId ][ uiBaseId ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT );
     288#endif
    190289      }
    191290    }
     
    258357#endif
    259358#if ENC_DEC_TRACE
    260   g_hTrace = fopen( "TraceDec.txt", "wb" );
     359  if(!g_hTrace) g_hTrace = fopen( "TraceDec.txt", "wb" );
    261360  g_bJustDoIt = g_bEncDecTraceDisable;
    262361  g_nSymbolCounter = 0;
     
    277376{
    278377#if ENC_DEC_TRACE
    279   fclose( g_hTrace );
     378  if(g_hTrace) fclose( g_hTrace );
     379  g_hTrace=NULL;
    280380#endif
    281381}
     
    304404  m_cResidualGenerator.destroy();
    305405#endif
     406
    306407}
    307408
     
    11091210    initWedgeLists();
    11101211  }
     1212#endif
     1213
     1214#if MERL_VSP_C0152 // set BW LUT
     1215  if( m_pcCamParsCollector ) // Initialize the LUT elements
     1216  {
     1217    m_pcCamParsCollector->setSlice( pcSlice );
     1218  }
     1219  if( pcSlice->getViewId() !=0 )
     1220  {
     1221    TComPic* pcBaseTxtPic = m_tAppDecTop->getPicFromView(  0, pcSlice->getPOC(), false );  // get base view reconstructed texture
     1222    TComPic* pcBaseDepthPic = m_tAppDecTop->getPicFromView(  0, pcSlice->getPOC(), true ); // get base view reconstructed depth
     1223     pcSlice->setRefPicBaseTxt(pcBaseTxtPic);
     1224     pcSlice->setRefPicBaseDepth(pcBaseDepthPic);
     1225  }
     1226  getTAppDecTop()->setBWVSPLUT( pcSlice, pcSlice->getViewId(),  pcSlice->getPOC() ); // get the LUT for backward warping
    11111227#endif
    11121228
  • branches/HTM-5.1-dev3-MERL/source/Lib/TLibDecoder/TDecTop.h

    r210 r231  
    7777  Bool  isInitialized() const { return m_bInitialized; }
    7878
     79#if MERL_VSP_C0152
     80  Int**** getBaseViewShiftLUTI()  { return m_aiBaseViewShiftLUT;   }
     81#endif
    7982private:
    8083  Bool  xIsComplete ();
     
    97100  Int     m_iLastPOC;
    98101  UInt    m_uiMaxViewId;
     102
     103#if MERL_VSP_C0152
     104  UInt    m_uiBitDepthForLUT;
     105  UInt    m_iLog2Precision;
     106  UInt    m_uiInputBitDepth;
     107  // look-up tables
     108  Double****   m_adBaseViewShiftLUT;       ///< Disparity LUT
     109  Int****      m_aiBaseViewShiftLUT;       ///< Disparity LUT
     110  Void xCreateLUTs( UInt uiNumberSourceViews, UInt uiNumberTargetViews, Double****& radLUT, Int****& raiLUT);
     111  Void xInitLUTs( UInt uiSourceView, UInt uiTargetView, Int iScale, Int iOffset, Double****& radLUT, Int****& raiLUT);
     112  template<class T> Void  xDeleteArray  ( T*& rpt, UInt uiSize1, UInt uiSize2, UInt uiSize3 );
     113  template<class T> Void  xDeleteArray  ( T*& rpt, UInt uiSize1, UInt uiSize2 );
     114  template<class T> Void  xDeleteArray  ( T*& rpt, UInt uiSize );
     115#endif
     116
    99117};
     118
     119#if MERL_VSP_C0152
     120template <class T>
     121Void CamParsCollector::xDeleteArray( T*& rpt, UInt uiSize1, UInt uiSize2, UInt uiSize3 )
     122{
     123  if( rpt )
     124  {
     125    for( UInt uiK = 0; uiK < uiSize1; uiK++ )
     126    {
     127      for( UInt uiL = 0; uiL < uiSize2; uiL++ )
     128      {
     129        for( UInt uiM = 0; uiM < uiSize3; uiM++ )
     130        {
     131          delete[] rpt[ uiK ][ uiL ][ uiM ];
     132        }
     133        delete[] rpt[ uiK ][ uiL ];
     134      }
     135      delete[] rpt[ uiK ];
     136    }
     137    delete[] rpt;
     138  }
     139  rpt = NULL;
     140};
     141
     142
     143template <class T>
     144Void CamParsCollector::xDeleteArray( T*& rpt, UInt uiSize1, UInt uiSize2 )
     145{
     146  if( rpt )
     147  {
     148    for( UInt uiK = 0; uiK < uiSize1; uiK++ )
     149    {
     150      for( UInt uiL = 0; uiL < uiSize2; uiL++ )
     151      {
     152        delete[] rpt[ uiK ][ uiL ];
     153      }
     154      delete[] rpt[ uiK ];
     155    }
     156    delete[] rpt;
     157  }
     158  rpt = NULL;
     159};
     160
     161
     162template <class T>
     163Void CamParsCollector::xDeleteArray( T*& rpt, UInt uiSize )
     164{
     165  if( rpt )
     166  {
     167    for( UInt uiK = 0; uiK < uiSize; uiK++ )
     168    {
     169      delete[] rpt[ uiK ];
     170    }
     171    delete[] rpt;
     172  }
     173  rpt = NULL;
     174};
     175
     176#endif
    100177
    101178/// decoder class
     
    206283  ParameterSetManagerDecoder* xGetParaSetDec ()        {return  &m_parameterSetManagerDecoder;}
    207284#endif
     285
    208286protected:
    209287  Void  xGetNewPicBuffer  (TComSlice* pcSlice, TComPic*& rpcPic);
Note: See TracChangeset for help on using the changeset viewer.