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

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

File:
1 edited

Legend:

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