Changeset 677 in SHVCSoftware for branches/SHM-6-dev/source/Lib/TLibDecoder


Ignore:
Timestamp:
15 Apr 2014, 05:23:37 (11 years ago)
Author:
qualcomm
Message:

Integration of JCTVC-Q0048 Asymmetric 3D LUT based CGS

Location:
branches/SHM-6-dev/source/Lib/TLibDecoder
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-6-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r674 r677  
    3939#include "SEIread.h"
    4040#include "TDecSlice.h"
     41#if Q0048_CGS_3D_ASYMLUT
     42#include "../TLibCommon/TCom3DAsymLUT.h"
     43#endif
    4144
    4245//! \ingroup TLibDecoder
     
    175178}
    176179
    177 Void TDecCavlc::parsePPS(TComPPS* pcPPS)
     180Void TDecCavlc::parsePPS(TComPPS* pcPPS
     181#if Q0048_CGS_3D_ASYMLUT
     182  , TCom3DAsymLUT * pc3DAsymLUT , Int nLayerID
     183#endif
     184  )
    178185{
    179186#if ENC_DEC_TRACE
     
    348355      READ_FLAG( uiCode, "poc_reset_info_present_flag" );
    349356      pcPPS->setPocResetInfoPresentFlag(uiCode ? true : false);
     357#if Q0048_CGS_3D_ASYMLUT
     358      READ_FLAG( uiCode , "colour_mapping_enabled_flag" );
     359      pcPPS->setCGSFlag( uiCode );
     360      if( pcPPS->getCGSFlag() == Q0048_CGS_3D_ASYMLUT_PPSUPDATE )
     361      {
     362        xParse3DAsymLUT( pc3DAsymLUT );
     363        pcPPS->setCGSOutputBitDepthY( pc3DAsymLUT->getOutputBitDepthY() );
     364        pcPPS->setCGSOutputBitDepthC( pc3DAsymLUT->getOutputBitDepthC() );
     365      }
     366#endif
    350367#endif
    351368    }
     
    37203737}
    37213738
     3739#if Q0048_CGS_3D_ASYMLUT
     3740Void TDecCavlc::xParse3DAsymLUT( TCom3DAsymLUT * pc3DAsymLUT )
     3741{
     3742  UInt uiCurOctantDepth , uiCurPartNumLog2 , uiInputBitDepthM8 , uiOutputBitDepthM8 , uiResQaunBit;
     3743  READ_CODE( 2 , uiCurOctantDepth , "cm_octant_depth" );
     3744  READ_CODE( 2 , uiCurPartNumLog2 , "cm_y_part_num_log2" );     
     3745  READ_CODE( 3 , uiInputBitDepthM8 , "cm_input_bit_depth_minus8" );
     3746  Int iInputBitDepthCDelta;
     3747  READ_SVLC(iInputBitDepthCDelta, "cm_input_bit_depth_chroma delta");
     3748  READ_CODE( 3 , uiOutputBitDepthM8 , "cm_output_bit_depth_minus8" );
     3749  Int iOutputBitDepthCDelta;
     3750  READ_SVLC(iOutputBitDepthCDelta, "cm_output_bit_depth_chroma_delta");
     3751  READ_CODE( 2 , uiResQaunBit , "cm_res_quant_bit" );
     3752  pc3DAsymLUT->destroy();
     3753  pc3DAsymLUT->create( uiCurOctantDepth , uiInputBitDepthM8 + 8 ,  uiInputBitDepthM8 + 8 + iInputBitDepthCDelta, uiOutputBitDepthM8 + 8 , uiOutputBitDepthM8 + 8 + iOutputBitDepthCDelta ,uiCurPartNumLog2 );
     3754  pc3DAsymLUT->setResQuantBit( uiResQaunBit );
     3755
     3756  xParse3DAsymLUTOctant( pc3DAsymLUT , 0 , 0 , 0 , 0 , 1 << pc3DAsymLUT->getCurOctantDepth() );
     3757}
     3758
     3759Void TDecCavlc::xParse3DAsymLUTOctant( TCom3DAsymLUT * pc3DAsymLUT , Int nDepth , Int yIdx , Int uIdx , Int vIdx , Int nLength )
     3760{
     3761  UInt uiOctantSplit = nDepth < pc3DAsymLUT->getCurOctantDepth();
     3762  if( nDepth < pc3DAsymLUT->getCurOctantDepth() )
     3763    READ_FLAG( uiOctantSplit , "split_octant_flag" );
     3764  Int nYPartNum = 1 << pc3DAsymLUT->getCurYPartNumLog2();
     3765  if( uiOctantSplit )
     3766  {
     3767    Int nHalfLength = nLength >> 1;
     3768    for( Int l = 0 ; l < 2 ; l++ )
     3769    {
     3770      for( Int m = 0 ; m < 2 ; m++ )
     3771      {
     3772        for( Int n = 0 ; n < 2 ; n++ )
     3773        {
     3774          xParse3DAsymLUTOctant( pc3DAsymLUT , nDepth + 1 , yIdx + l * nHalfLength * nYPartNum , uIdx + m * nHalfLength , vIdx + n * nHalfLength , nHalfLength );
     3775        }
     3776      }
     3777    }
     3778  }
     3779  else
     3780  {
     3781    for( Int l = 0 ; l < nYPartNum ; l++ )
     3782    {
     3783      for( Int nVertexIdx = 0 ; nVertexIdx < 4 ; nVertexIdx++ )
     3784      {
     3785        UInt uiCodeVertex = 0;
     3786        Int deltaY = 0 , deltaU = 0 , deltaV = 0;
     3787        READ_FLAG( uiCodeVertex , "coded_vertex_flag" );
     3788        if( uiCodeVertex )
     3789        {
     3790          READ_SVLC( deltaY , "resY" );
     3791          READ_SVLC( deltaU , "resU" );
     3792          READ_SVLC( deltaV , "resV" );
     3793        }
     3794        pc3DAsymLUT->setCuboidVertexResTree( yIdx + l , uIdx , vIdx , nVertexIdx , deltaY , deltaU , deltaV );
     3795      }
     3796    }
     3797  }
     3798}
     3799#endif
    37223800//! \}
    37233801
  • branches/SHM-6-dev/source/Lib/TLibDecoder/TDecCAVLC.h

    r672 r677  
    4646#include "SyntaxElementParser.h"
    4747
     48#if Q0048_CGS_3D_ASYMLUT
     49class TCom3DAsymLUT;
     50#endif
    4851//! \ingroup TLibDecoder
    4952//! \{
     
    97100  Void  parseSPS            ( TComSPS* pcSPS );
    98101#endif //SVC_EXTENSION
    99   Void  parsePPS            ( TComPPS* pcPPS);
     102  Void  parsePPS            ( TComPPS* pcPPS
     103#if Q0048_CGS_3D_ASYMLUT
     104    , TCom3DAsymLUT * pc3DAsymLUT , Int nLayerID
     105#endif
     106    );
    100107  Void  parseVUI            ( TComVUI* pcVUI, TComSPS* pcSPS );
    101108  Void  parseSEI            ( SEIMessages& );
     
    137144protected:
    138145  Bool  xMoreRbspData();
     146
     147#if Q0048_CGS_3D_ASYMLUT
     148  Void xParse3DAsymLUT( TCom3DAsymLUT * pc3DAsymLUT );
     149  Void xParse3DAsymLUTOctant( TCom3DAsymLUT * pc3DAsymLUT , Int nDepth , Int yIdx , Int uIdx , Int vIdx , Int nLength );
     150#endif
    139151};
    140152
  • branches/SHM-6-dev/source/Lib/TLibDecoder/TDecEntropy.h

    r644 r677  
    4949class TDecCavlc;
    5050class ParameterSetManagerDecoder;
     51#if Q0048_CGS_3D_ASYMLUT
     52class TCom3DAsymLUT;
     53#endif
    5154
    5255//! \ingroup TLibDecoder
     
    7174  virtual Void  parseSPS                  ( TComSPS* pcSPS )                                      = 0;
    7275#endif
    73   virtual Void  parsePPS                  ( TComPPS* pcPPS )                                      = 0;
     76  virtual Void  parsePPS                  ( TComPPS* pcPPS
     77#if Q0048_CGS_3D_ASYMLUT
     78    , TCom3DAsymLUT * pc3DAsymLUT , Int nLayerID
     79#endif
     80    )                                      = 0;
    7481
    7582  virtual Void parseSliceHeader          ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager)       = 0;
     
    138145  Void    decodeSPS                   ( TComSPS* pcSPS     )    { m_pcEntropyDecoderIf->parseSPS(pcSPS);                    }
    139146#endif
    140   Void    decodePPS                   ( TComPPS* pcPPS )    { m_pcEntropyDecoderIf->parsePPS(pcPPS);                    }
     147  Void    decodePPS                   ( TComPPS* pcPPS
     148#if Q0048_CGS_3D_ASYMLUT
     149    , TCom3DAsymLUT * pc3DAsymLUT , Int nLayerID
     150#endif
     151    )    { m_pcEntropyDecoderIf->parsePPS(pcPPS
     152#if Q0048_CGS_3D_ASYMLUT
     153    , pc3DAsymLUT , nLayerID
     154#endif
     155    );                    }
    141156  Void    decodeSliceHeader           ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager)  { m_pcEntropyDecoderIf->parseSliceHeader(rpcSlice, parameterSetManager);         }
    142157
  • branches/SHM-6-dev/source/Lib/TLibDecoder/TDecSbac.h

    r644 r677  
    8181  Void  parseSPS                  ( TComSPS* /*pcSPS*/ ) {}
    8282#endif
    83   Void  parsePPS                  ( TComPPS* /*pcPPS*/ ) {}
     83  Void  parsePPS                  ( TComPPS* /*pcPPS*/
     84#if Q0048_CGS_3D_ASYMLUT
     85    , TCom3DAsymLUT * /*pc3DAsymLUT*/ , Int /*nLayerID*/
     86#endif
     87    ) {}
    8488
    8589  Void  parseSliceHeader          ( TComSlice*& /*rpcSlice*/, ParameterSetManagerDecoder* /*parameterSetManager*/) {}
  • branches/SHM-6-dev/source/Lib/TLibDecoder/TDecTop.cpp

    r669 r677  
    9393  m_subDpbIdx = -1;
    9494#endif
     95#if Q0048_CGS_3D_ASYMLUT
     96  m_pColorMappedPic = NULL;
     97#endif
    9598}
    9699
     
    99102#if ENC_DEC_TRACE
    100103  fclose( g_hTrace );
     104#endif
     105#if Q0048_CGS_3D_ASYMLUT
     106  if(m_pColorMappedPic)
     107  {
     108    m_pColorMappedPic->destroy();
     109    delete m_pColorMappedPic;
     110    m_pColorMappedPic = NULL;
     111  }
    101112#endif
    102113}
     
    357368        Bool sameBitDepths = ( g_bitDepthYLayer[m_layerId] == g_bitDepthYLayer[refLayerId] ) && ( g_bitDepthCLayer[m_layerId] == g_bitDepthCLayer[refLayerId] );
    358369
    359         if( pcPicYuvRecBase->getWidth() != pcSlice->getPicWidthInLumaSamples() || pcPicYuvRecBase->getHeight() != pcSlice->getPicHeightInLumaSamples() || !zeroOffsets || !sameBitDepths )
     370        if( pcPicYuvRecBase->getWidth() != pcSlice->getPicWidthInLumaSamples() || pcPicYuvRecBase->getHeight() != pcSlice->getPicHeightInLumaSamples() || !zeroOffsets || !sameBitDepths
     371#if Q0048_CGS_3D_ASYMLUT
     372          || pcSlice->getPPS()->getCGSFlag() > 0
     373#endif
     374          )
    360375#else
    361376        if(pcPicYuvRecBase->getWidth() != pcSlice->getPicWidthInLumaSamples() || pcPicYuvRecBase->getHeight() != pcSlice->getPicHeightInLumaSamples() || !zeroOffsets )
     
    15331548        g_posScalingFactor[refLayerIdc][1] = ((heightBL << 16) + (heightEL >> 1)) / heightEL;
    15341549
     1550#if Q0048_CGS_3D_ASYMLUT
     1551        TComPicYuv* pBaseColRec = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec();
     1552        if( pcSlice->getPPS()->getCGSFlag() != Q0048_CGS_3D_ASYMLUT_OFF )
     1553        {
     1554          if(!m_pColorMappedPic)
     1555            initAsymLut(pcSlice->getBaseColPic(refLayerIdc)->getSlice(0));
     1556          m_c3DAsymLUTPPS.colorMapping( pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(),  m_pColorMappedPic );
     1557          pBaseColRec = m_pColorMappedPic;
     1558        }
     1559#endif
    15351560#if SVC_UPSAMPLING
    15361561        if( pcPic->isSpatialEnhLayer(refLayerIdc) )
     
    15431568#if O0215_PHASE_ALIGNMENT
    15441569#if O0194_JOINT_US_BITSHIFT
     1570#if Q0048_CGS_3D_ASYMLUT
     1571          m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), scalEL, pcSlice->getVPS()->getPhaseAlignFlag() );
     1572#else
    15451573          m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL, pcSlice->getVPS()->getPhaseAlignFlag() );
     1574#endif
     1575#else
     1576#if Q0048_CGS_3D_ASYMLUT
     1577          m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc), pcSlice->getVPS()->getPhaseAlignFlag() );
    15461578#else
    15471579          m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL, pcSlice->getVPS()->getPhaseAlignFlag() );
    15481580#endif
     1581#endif
    15491582#else
    15501583#if O0194_JOINT_US_BITSHIFT
     1584#if Q0048_CGS_3D_ASYMLUT
     1585          m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), scalEL );
     1586#else
    15511587          m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL );
     1588#endif
     1589#else
     1590#if Q0048_CGS_3D_ASYMLUT
     1591          m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), scalEL );
    15521592#else
    15531593          m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL );
     1594#endif
    15541595#endif
    15551596#endif
     
    17631804}
    17641805
    1765 Void TDecTop::xDecodePPS()
     1806Void TDecTop::xDecodePPS(
     1807#if Q0048_CGS_3D_ASYMLUT
     1808  TCom3DAsymLUT * pc3DAsymLUT
     1809#endif
     1810  )
    17661811{
    17671812  TComPPS* pps = new TComPPS();
     
    17711816#endif
    17721817
    1773   m_cEntropyDecoder.decodePPS( pps );
     1818  m_cEntropyDecoder.decodePPS( pps
     1819#if Q0048_CGS_3D_ASYMLUT
     1820    , pc3DAsymLUT , m_layerId
     1821#endif
     1822    );
    17741823  m_parameterSetManagerDecoder.storePrefetchedPPS( pps );
    17751824
     
    19491998
    19501999    case NAL_UNIT_PPS:
    1951       xDecodePPS();
     2000      xDecodePPS(
     2001#if Q0048_CGS_3D_ASYMLUT
     2002        &m_c3DAsymLUTPPS
     2003#endif
     2004        );
    19522005      return false;
    19532006     
     
    23132366}
    23142367#endif
     2368
     2369#if Q0048_CGS_3D_ASYMLUT
     2370Void TDecTop::initAsymLut(TComSlice *pcSlice)
     2371{
     2372  if(m_layerId>0)
     2373  {
     2374    if(!m_pColorMappedPic)
     2375    {
     2376      Int picWidth    = pcSlice->getPicWidthInLumaSamples();
     2377      Int picHeight   = pcSlice->getPicHeightInLumaSamples();
     2378      m_pColorMappedPic = new TComPicYuv;
     2379      m_pColorMappedPic->create( picWidth, picHeight, pcSlice->getChromaFormatIdc()/*CHROMA_420*/, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, NULL );
     2380    }
     2381  }
     2382}
     2383#endif
    23152384#endif //SVC_EXTENSION
    23162385//! \}
  • branches/SHM-6-dev/source/Lib/TLibDecoder/TDecTop.h

    r669 r677  
    4545#include "TLibCommon/TComTrQuant.h"
    4646#include "TLibCommon/SEI.h"
     47#if Q0048_CGS_3D_ASYMLUT
     48#include "TLibCommon/TCom3DAsymLUT.h"
     49#endif
    4750
    4851#include "TDecGop.h"
     
    7982  // functional classes
    8083  TComPrediction          m_cPrediction;
     84#if Q0048_CGS_3D_ASYMLUT
     85  TCom3DAsymLUT           m_c3DAsymLUTPPS;
     86  TComPicYuv*             m_pColorMappedPic;
     87#endif
    8188  TComTrQuant             m_cTrQuant;
    8289  TDecGop                 m_cGopDecoder;
     
    268275  Void      xDecodeVPS();
    269276  Void      xDecodeSPS();
    270   Void      xDecodePPS();
     277  Void      xDecodePPS(
     278#if Q0048_CGS_3D_ASYMLUT
     279    TCom3DAsymLUT * pc3DAsymLUT
     280#endif
     281    );
    271282  Void      xDecodeSEI( TComInputBitstream* bs, const NalUnitType nalUnitType );
    272283
     
    279290  Void setFirstPicInLayerDecodedFlag(Bool x) { m_firstPicInLayerDecodedFlag = x;   }
    280291#endif
     292#if Q0048_CGS_3D_ASYMLUT
     293  Void initAsymLut(TComSlice *pcSlice);
     294#endif
    281295};// END CLASS DEFINITION TDecTop
    282296
Note: See TracChangeset for help on using the changeset viewer.