Changeset 41 in 3DVCSoftware for branches/0.3-poznan-univ/source/Lib/TLibDecoder


Ignore:
Timestamp:
26 Mar 2012, 09:03:21 (13 years ago)
Author:
poznan-univ
Message:

Adjustment for FlexCO, and high-level syntax improvement.

Location:
branches/0.3-poznan-univ/source/Lib/TLibDecoder
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/0.3-poznan-univ/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r28 r41  
    238238#endif
    239239#if POZNAN_DBMP
    240           xReadFlag( uiCode );
    241           pcSPS->setDBMP  ( uiCode );
     240  xReadFlag( uiCode ); pcSPS->setDBMP  ( uiCode );
    242241#endif
    243242#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU
    244           xReadFlag( uiCode );
    245           pcSPS->setUseCUSkip ( uiCode );
     243  xReadFlag( uiCode ); pcSPS->setUseCUSkip ( uiCode );
    246244#endif
    247245  xReadFlag( uiCode ); // SPS base view flag
     
    279277#endif
    280278#if POZNAN_NONLINEAR_DEPTH
    281 #if POZNAN_NONLINEAR_DEPTH_SEND_AS_BYTE
    282       uiCode = 0;
    283       xReadCode(8, uiCode);
    284       pcSPS->setDepthPower(dequantizeDepthPower(uiCode));
    285 #else
    286       uiCode = 0;
    287       xReadCode(sizeof(float)*8, uiCode); // We do not send seign
    288       //uiCode &= ~0x80000000;
    289       pcSPS->setDepthPower(*((float*)&uiCode)); 
    290 #endif
    291       printf("\nfDepthPower = %f", pcSPS->getDepthPower());
     279      xReadFlag( uiCode );
     280      pcSPS->setUseNonlinearDepth( uiCode ? true : false );
     281      pcSPS->getNonlinearDepthModel().Clear();
     282      if( uiCode )
     283      {
     284        uiCode = 0; //Owieczka Necessary??
     285        xReadUvlc( uiCode );
     286        int num = pcSPS->getNonlinearDepthModel().m_iNum = uiCode;
     287        for (int i=1; i<=num; ++i)
     288        {
     289          uiCode = 0;
     290          xReadUvlc( uiCode );
     291          pcSPS->getNonlinearDepthModel().m_aiPoints[i] = uiCode;     
     292        }
     293        pcSPS->getNonlinearDepthModel().m_aiPoints[0] = 0;
     294        pcSPS->getNonlinearDepthModel().m_aiPoints[num+1] = 0;
     295        pcSPS->getNonlinearDepthModel().Init();
     296      }
    292297#endif
    293298    }
  • branches/0.3-poznan-univ/source/Lib/TLibDecoder/TDecTop.cpp

    r28 r41  
    9090  m_uiMaxViewId             = 0;
    9191#if POZNAN_NONLINEAR_DEPTH
    92   m_fDepthPower             = 1.0;
     92  m_cNonlinearDepthModel.Clear();
     93  m_bUseNonlinearDepth      = false;
    9394#endif
    9495}
     
    140141  Int64 iOffsetChroma = iOffset + ( ( 1 << iLog2DivChroma ) >> 1 );
    141142
     143
     144  for( UInt uiDepthValue = 0; uiDepthValue < 256; uiDepthValue++ )
     145  {
     146
     147    // real-valued look-up tables
    142148#if POZNAN_NONLINEAR_DEPTH
    143   TComNonlinearDepthBackward cNonlinearDepthBwd(m_fDepthPower, (POZNAN_LUT_INCREASED_PRECISION) ? g_uiBitIncrement : 0, (POZNAN_LUT_INCREASED_PRECISION) ? g_uiBitIncrement : 0);
    144 #endif
    145 
    146   for( UInt uiDepthValue = 0; uiDepthValue < 256; uiDepthValue++ )
    147   {
    148     Double  dDepthValue = (Double)uiDepthValue;
    149     Int64   iDepthValue = (Int64)uiDepthValue;
    150 #if POZNAN_NONLINEAR_DEPTH
    151     dDepthValue = cNonlinearDepthBwd(dDepthValue);
    152     iDepthValue = (Int64)(dDepthValue+0.5);
    153 #endif
    154 #if POZNAN_LUT_INCREASED_PRECISION
    155     dDepthValue /= (1<<g_uiBitIncrement);
    156 #endif
    157 
    158     // real-valued look-up tables
    159     Double  dShiftLuma      = ( dDepthValue * dScale + dOffset ) * Double( 1 << m_iLog2Precision );
     149    Double  dShiftLuma;
     150    if( m_bUseNonlinearDepth )
     151      dShiftLuma      = ( m_cNonlinearDepthModel.BackwardD( (Double)uiDepthValue, dScale) + dOffset ) * Double( 1 << m_iLog2Precision );
     152    else
     153      dShiftLuma      = ( (Double)uiDepthValue * dScale + dOffset ) * Double( 1 << m_iLog2Precision );
     154#else
     155    Double  dShiftLuma      = ( (Double)uiDepthValue * dScale + dOffset ) * Double( 1 << m_iLog2Precision );
     156#endif
    160157    Double  dShiftChroma    = dShiftLuma / 2;
    161158    radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ uiDepthValue ] = dShiftLuma;
     
    163160
    164161    // integer-valued look-up tables
    165     Int64   iTempScale      = iDepthValue * iScale;
    166 #if POZNAN_LUT_INCREASED_PRECISION
    167     iTempScale >>= g_uiBitIncrement;
     162#if POZNAN_NONLINEAR_DEPTH
     163    Int64   iTempScale;
     164    if( m_bUseNonlinearDepth )
     165      iTempScale      = (Int64)m_cNonlinearDepthModel.BackwardI(uiDepthValue, iScale);
     166    else
     167      iTempScale      = (Int64)uiDepthValue * iScale;
     168#else
     169    Int64   iTempScale      = (Int64)uiDepthValue * iScale;
    168170#endif
    169171    Int64   iTestScale      = ( iTempScale + iOffset       );   // for checking accuracy of camera parameters
     
    233235  {
    234236#if POZNAN_NONLINEAR_DEPTH
    235     m_fDepthPower = pcSlice->getSPS()->getDepthPower();
     237    m_bUseNonlinearDepth = pcSlice->getSPS()->getUseNonlinearDepth();
     238    m_cNonlinearDepthModel = pcSlice->getSPS()->getNonlinearDepthModel();   
    236239#endif
    237240    return;
     
    240243  {
    241244#if POZNAN_NONLINEAR_DEPTH
    242     pcSlice->getSPS()->setDepthPower(m_fDepthPower); // OLGIERD: ToDo - QP-Tex should not use getDepthPower() from texture SPS.
     245    pcSlice->getSPS()->setUseNonlinearDepth(m_bUseNonlinearDepth);
     246    pcSlice->getSPS()->setNonlinearDepthModel(m_cNonlinearDepthModel); // OLGIERD: ToDo - QP-Tex should not use getDepthPower() from texture SPS.
    243247#endif
    244248  }
     
    684688
    685689#if DCM_SKIP_DECODING_FRAMES
     690#if FLEX_CODING_ORDER
     691Bool TDecTop::decode (Bool bEos, TComBitstream* pcBitstream, UInt& ruiPOC, TComList<TComPic*>*& rpcListPic, NalUnitType& reNalUnitType, TComSPS& cComSPS, Int& iSkipFrame,  Int& iPOCLastDisplay, Bool& bNewPictureType)
     692#else
    686693Bool TDecTop::decode (Bool bEos, TComBitstream* pcBitstream, UInt& ruiPOC, TComList<TComPic*>*& rpcListPic, NalUnitType& reNalUnitType, TComSPS& cComSPS, Int& iSkipFrame,  Int& iPOCLastDisplay)
     694#endif
    687695#else
    688696Void TDecTop::decode (Bool bEos, TComBitstream* pcBitstream, UInt& ruiPOC, TComList<TComPic*>*& rpcListPic, NalUnitType& reNalUnitType, TComSPS& cComSPS )
     
    712720      TComSPS cTempSPS;
    713721      m_cEntropyDecoder.decodeSPS( &cTempSPS );
     722#if FLEX_CODING_ORDER
     723      m_cNewSPS = cTempSPS;
     724#endif
    714725
    715726      if( (m_iViewIdx == cTempSPS.getViewId()) && ( m_bIsDepth == cTempSPS.isDepth() ) )
     
    724735        if(!cTempSPS.isDepth() && cTempSPS.getViewId())
    725736        {
    726           Float fDepthPower = getDecTop()->getPicFromView( 0, pcPic->getPOC(), true )->getSPS()->getDepthPower();
    727           cTempSPS.setDepthPower(fDepthPower);
     737          cTempSPS.setUseNonlinearDepth(getDecTop()->getPicFromView( 0, pcPic->getPOC(), true )->getSPS()->getUseNonlinearDepth());
     738          cTempSPS.setNonlinearDepthModel(getDecTop()->getPicFromView( 0, pcPic->getPOC(), true )->getSPS()->getNonlinearDepthModel());
    728739        }
    729740#endif
     
    802813      {
    803814        m_uiPrevPOC = m_apcSlicePilot->getPOC();
     815#if FLEX_CODING_ORDER
     816        bNewPictureType = m_cNewSPS.isDepth();
     817#endif
    804818        return true;
    805819      }
     
    887901        // Set reference list
    888902        std::vector<TComPic*> apcSpatRefPics = getDecTop()->getSpatialRefPics( pcPic->getViewIdx(), pcSlice->getPOC(), m_cSPS.isDepth() );
    889         TComPic * const pcTexturePic = m_cSPS.isDepth() ? getDecTop()->getPicFromView( pcPic->getViewIdx(), pcSlice->getPOC(), false ) : NULL;
     903        TComPic * const pcTexturePic = ( m_cSPS.isDepth()) ? getDecTop()->getPicFromView( pcPic->getViewIdx(), pcSlice->getPOC(), false ) : NULL;
     904        TComPic * const pcDepthPic   = (!m_cSPS.isDepth()) ? getDecTop()->getPicFromView( pcPic->getViewIdx(), pcSlice->getPOC(), true  ) : NULL;
     905#if FLEX_CODING_ORDER
     906        if (pcTexturePic != NULL)
     907        {
     908          assert( ! m_cSPS.isDepth() || pcTexturePic != NULL );
     909          pcSlice->setTexturePic( pcTexturePic );
     910        }
     911        if (pcDepthPic != NULL)
     912        {
     913          assert(   m_cSPS.isDepth() || pcDepthPic != NULL );
     914          pcSlice->setDepthPic( pcDepthPic );
     915        }
     916#else
    890917        assert( ! m_cSPS.isDepth() || pcTexturePic != NULL );
    891918        pcSlice->setTexturePic( pcTexturePic );
     919        pcSlice->setDepthPic( pcDepthPic );
    892920        pcSlice->setViewIdx( pcPic->getViewIdx() );
     921#endif
    893922#if SONY_COLPIC_AVAILABILITY
    894923        pcSlice->setViewOrderIdx( pcPic->getViewOrderIdx() );
     
    949978      //*
    950979#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     980#if FLEX_CODING_ORDER
     981      Bool bHaveReconDepth = (pcSlice->getDepthPic() != NULL) && (pcSlice->getDepthPic()->getReconMark());
     982      if(!getIsDepth() && pcSlice->getSPS()->getUseTexDqpAccordingToDepth() && !bHaveReconDepth )
     983#else
    951984      if(!getIsDepth() && pcSlice->getSPS()->getUseTexDqpAccordingToDepth())
     985#endif
    952986      {
    953987        getDecTop()->storeDepthSynthPicsInBuffer(pcSlice->getViewIdx(),pcSlice->getSPS()->getViewOrderIdx(),pcSlice->getPOC());
  • branches/0.3-poznan-univ/source/Lib/TLibDecoder/TDecTop.h

    r28 r41  
    121121#endif
    122122#if POZNAN_NONLINEAR_DEPTH
    123   Float               m_fDepthPower;
     123  TComNonlinearDepthModel m_cNonlinearDepthModel;
     124  Bool m_bUseNonlinearDepth;
    124125#endif
    125126
     
    205206  TComList<TComPic*>      m_cListPic;         //  Dynamic buffer
    206207  TComSPS                 m_cSPS;
     208#if FLEX_CODING_ORDER
     209  TComSPS                 m_cNewSPS;
     210#endif
    207211  TComPPS                 m_cPPS;
    208212  TComSlice*              m_apcSlicePilot;
     
    265269  Void  init( TAppDecTop* pcTAppDecTop, Bool bFirstInstance = true );
    266270#if DCM_SKIP_DECODING_FRAMES
     271#if FLEX_CODING_ORDER
     272  Bool  decode (Bool bEos, TComBitstream* pcBitstream, UInt& ruiPOC, TComList<TComPic*>*& rpcListPic, NalUnitType& reNalUnitType, TComSPS& cComSPS, Int& iSkipFrame, Int& iPOCLastDisplay, Bool& bNewPictureType);
     273#else
    267274  Bool  decode (Bool bEos, TComBitstream* pcBitstream, UInt& ruiPOC, TComList<TComPic*>*& rpcListPic, NalUnitType& reNalUnitType, TComSPS& cComSPS, Int& iSkipFrame, Int& iPOCLastDisplay);
     275#endif
    268276#else
    269277  Void  decode ( Bool bEos, TComBitstream* pcBitstream, UInt& ruiPOC, TComList<TComPic*>*& rpcListPic, NalUnitType& reNalUnitType, TComSPS& cComSPS );
Note: See TracChangeset for help on using the changeset viewer.