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


Ignore:
Timestamp:
11 Dec 2015, 00:05:48 (9 years ago)
Author:
seregin
Message:

infer parameters in SPS after activation, fixing chroma scaling for non 4:2:0

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

Legend:

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

    r1500 r1502  
    12251225#endif
    12261226
    1227 #if SCALABLE_REXT
    1228   const ChromaFormat chFmt = pcSlice->getChromaFormatIdc();
    1229 #else
    12301227  const ChromaFormat chFmt = sps->getChromaFormatIdc();
    1231 #endif
    12321228  const UInt numValidComp=getNumberValidComponents(chFmt);
    12331229  const Bool bChroma=(chFmt!=CHROMA_400);
     
    12411237    pcSlice->setDependentSliceSegmentFlag(false);
    12421238  }
    1243 #if SVC_EXTENSION
    1244   Int numCTUs = ((pcSlice->getPicWidthInLumaSamples()+sps->getMaxCUWidth()-1)/sps->getMaxCUWidth())*((pcSlice->getPicHeightInLumaSamples()+sps->getMaxCUHeight()-1)/sps->getMaxCUHeight());
    1245 #else
    12461239  Int numCTUs = ((sps->getPicWidthInLumaSamples()+sps->getMaxCUWidth()-1)/sps->getMaxCUWidth())*((sps->getPicHeightInLumaSamples()+sps->getMaxCUHeight()-1)/sps->getMaxCUHeight());
    1247 #endif 
    12481240  UInt sliceSegmentAddress = 0;
    12491241  Int bitsSliceSegmentAddress = 0;
     
    18321824    pcSlice->setSliceQp (26 + pps->getPicInitQPMinus26() + iCode);
    18331825
    1834 #if SVC_EXTENSION
    1835     assert( pcSlice->getSliceQp() >= -pcSlice->getQpBDOffset(CHANNEL_TYPE_LUMA) );
    1836 #else   
    18371826    assert( pcSlice->getSliceQp() >= -sps->getQpBDOffset(CHANNEL_TYPE_LUMA) );
    1838 #endif
    18391827    assert( pcSlice->getSliceQp() <=  51 );
    18401828
     
    23652353#endif
    23662354
    2367 #if SVC_EXTENSION
    2368   Int qpBdOffsetY = pcCU->getSlice()->getQpBDOffset(CHANNEL_TYPE_LUMA);
    2369 #else
    23702355  Int qpBdOffsetY = pcCU->getSlice()->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA);
    2371 #endif
    23722356  const Int qp = (((Int) pcCU->getRefQP( uiAbsPartIdx ) + iDQp + 52 + 2*qpBdOffsetY )%(52+ qpBdOffsetY)) -  qpBdOffsetY;
    23732357
     
    24292413{
    24302414        WPScalingParam *wp;
    2431 #if SCALABLE_REXT
    2432   const ChromaFormat    chFmt        = pcSlice->getChromaFormatIdc();
    2433 #else
    24342415  const ChromaFormat    chFmt        = sps->getChromaFormatIdc();
    2435 #endif
    24362416  const Int             numValidComp = Int(getNumberValidComponents(chFmt));
    24372417  const Bool            bChroma      = (chFmt!=CHROMA_400);
     
    24962476        wp[COMPONENT_Y].iWeight = (iDeltaWeight + (1<<wp[COMPONENT_Y].uiLog2WeightDenom));
    24972477        READ_SVLC( wp[COMPONENT_Y].iOffset, iNumRef==0?"luma_offset_l0[i]":"luma_offset_l1[i]" );
    2498 #if SVC_EXTENSION
    2499         Int range=sps->getSpsRangeExtension().getHighPrecisionOffsetsEnabledFlag() ? (1<<pcSlice->getBitDepth(CHANNEL_TYPE_LUMA))/2 : 128;       
    2500 #else
    25012478        Int range=sps->getSpsRangeExtension().getHighPrecisionOffsetsEnabledFlag() ? (1<<sps->getBitDepth(CHANNEL_TYPE_LUMA))/2 : 128;
    2502 #endif
    25032479        assert( wp[0].iOffset >= -range );
    25042480        assert( wp[0].iOffset <   range );
     
    25132489        if ( wp[COMPONENT_Cb].bPresentFlag )
    25142490        {
    2515 #if SVC_EXTENSION
    2516           Int range=sps->getSpsRangeExtension().getHighPrecisionOffsetsEnabledFlag() ? (1<<pcSlice->getBitDepth(CHANNEL_TYPE_CHROMA))/2 : 128;
    2517 #else
    25182491          Int range=sps->getSpsRangeExtension().getHighPrecisionOffsetsEnabledFlag() ? (1<<sps->getBitDepth(CHANNEL_TYPE_CHROMA))/2 : 128;
    2519 #endif
    25202492          for ( Int j=1 ; j<numValidComp ; j++ )
    25212493          {
  • branches/SHM-dev/source/Lib/TLibDecoder/TDecCu.cpp

    r1483 r1502  
    219219  UInt uiBPelY   = uiTPelY + (maxCuHeight>>uiDepth) - 1;
    220220
    221 #if SVC_EXTENSION
    222   TComSlice * pcSlice = pcPic->getSlice(pcPic->getCurrSliceIdx());
    223 
    224   if( ( uiRPelX < pcSlice->getPicWidthInLumaSamples() ) && ( uiBPelY < pcSlice->getPicHeightInLumaSamples() ) )
    225 #else
    226221  if( ( uiRPelX < sps.getPicWidthInLumaSamples() ) && ( uiBPelY < sps.getPicHeightInLumaSamples() ) )
    227 #endif
    228222  {
    229223    m_pcEntropyDecoder->decodeSplitFlag( pcCU, uiAbsPartIdx, uiDepth );
     
    252246      uiTPelY   = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiIdx] ];
    253247
    254 #if SVC_EXTENSION
    255       if ( !isLastCtuOfSliceSegment && ( uiLPelX < pcCU->getSlice()->getPicWidthInLumaSamples() ) && ( uiTPelY < pcCU->getSlice()->getPicHeightInLumaSamples() ) )
    256 #else
    257248      if ( !isLastCtuOfSliceSegment && ( uiLPelX < sps.getPicWidthInLumaSamples() ) && ( uiTPelY < sps.getPicHeightInLumaSamples() ) )
    258 #endif
    259249      {
    260250        xDecodeCU( pcCU, uiIdx, uiDepth+1, isLastCtuOfSliceSegment );
     
    404394  UInt uiBPelY   = uiTPelY + (sps.getMaxCUHeight()>>uiDepth) - 1;
    405395
    406 #if SVC_EXTENSION
    407   if( ( uiRPelX >= pcSlice->getPicWidthInLumaSamples() ) || ( uiBPelY >= pcSlice->getPicHeightInLumaSamples() ) )
    408 #else
    409396  if( ( uiRPelX >= sps.getPicWidthInLumaSamples() ) || ( uiBPelY >= sps.getPicHeightInLumaSamples() ) )
    410 #endif
    411397  {
    412398    bBoundary = true;
     
    423409      uiTPelY = pCtu->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiIdx] ];
    424410
    425 #if SVC_EXTENSION
    426       if( ( uiLPelX < pcSlice->getPicWidthInLumaSamples() ) && ( uiTPelY < pcSlice->getPicHeightInLumaSamples() ) )
    427 #else
    428411      if( ( uiLPelX < sps.getPicWidthInLumaSamples() ) && ( uiTPelY < sps.getPicHeightInLumaSamples() ) )
    429 #endif
    430412      {
    431413        xDecompressCU(pCtu, uiIdx, uiNextDepth );
     
    501483  if  ( pcCU->getQtRootCbf( 0) )
    502484  {
    503 #if SVC_EXTENSION
    504     m_ppcYuvReco[uiDepth]->addClip( m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth], 0, pcCU->getWidth( 0 ), pcCU->getSlice()->getBitDepths() );
    505 #else
    506485    m_ppcYuvReco[uiDepth]->addClip( m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth], 0, pcCU->getWidth( 0 ), pcCU->getSlice()->getSPS()->getBitDepths() );
    507 #endif
    508486  }
    509487  else
     
    647625#endif
    648626
    649 #if SVC_EXTENSION
    650   const Int clipbd = pcCU->getSlice()->getBitDepth(toChannelType(compID));
    651 #else
    652627  const Int clipbd = sps.getBitDepth(toChannelType(compID));
    653 #endif
    654628#if O0043_BEST_EFFORT_DECODING
    655629  const Int bitDepthDelta = sps.getStreamBitDepth(toChannelType(compID)) - clipbd;
     
    834808        Pel* piPicReco         = pcCU->getPic()->getPicYuvRec()->getAddr(compID, pcCU->getCtuRsAddr(), pcCU->getZorderIdxInCtu()+uiPartIdx);
    835809  const UInt uiPicStride       = pcCU->getPic()->getPicYuvRec()->getStride(compID);
    836 #if SVC_EXTENSION
    837   const UInt uiPcmLeftShiftBit = pcCU->getSlice()->getBitDepth(toChannelType(compID)) - pcCU->getSlice()->getSPS()->getPCMBitDepth(toChannelType(compID));
    838 #else
    839810  const TComSPS &sps           = *(pcCU->getSlice()->getSPS());
    840811  const UInt uiPcmLeftShiftBit = sps.getBitDepth(toChannelType(compID)) - sps.getPCMBitDepth(toChannelType(compID));
    841 #endif
    842812
    843813  for(UInt uiY = 0; uiY < uiHeight; uiY++ )
  • branches/SHM-dev/source/Lib/TLibDecoder/TDecGop.cpp

    r1482 r1502  
    239239      printf ("Warning: Got multiple decoded picture hash SEI messages. Using first.");
    240240    }
    241 #if SVC_EXTENSION
    242     calcAndPrintHashStatus(*(pcPic->getPicYuvRec()), hash, pcSlice->getBitDepths(), m_numberOfChecksumErrorsDetected);
    243 #else
    244241    calcAndPrintHashStatus(*(pcPic->getPicYuvRec()), hash, pcSlice->getSPS()->getBitDepths(), m_numberOfChecksumErrorsDetected);
    245 #endif
    246242  }
    247243#if CONFORMANCE_BITSTREAM_MODE
  • branches/SHM-dev/source/Lib/TLibDecoder/TDecSbac.cpp

    r1442 r1502  
    951951  {
    952952    UInt uiSign;
    953 #if SVC_EXTENSION
    954     Int qpBdOffsetY = pcCU->getSlice()->getQpBDOffset(CHANNEL_TYPE_LUMA);
    955 #else
    956953    Int qpBdOffsetY = pcCU->getSlice()->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA);
    957 #endif
    958954    m_pcTDecBinIf->decodeBinEP(uiSign RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(STATS__CABAC_BITS__DELTA_QP_EP));
    959955    iDQp = uiDQp;
  • branches/SHM-dev/source/Lib/TLibDecoder/TDecSlice.cpp

    r1287 r1502  
    201201          aboveMergeAvail = pcPic->getSAOMergeAvailability(ctuRsAddr, ctuRsAddr-frameWidthInCtus);
    202202        }
    203 #if SVC_EXTENSION
    204         pcSbacDecoder->parseSAOBlkParam( saoblkParam, sliceEnabled, leftMergeAvail, aboveMergeAvail, pcSlice->getBitDepths());
    205 #else
    206203        pcSbacDecoder->parseSAOBlkParam( saoblkParam, sliceEnabled, leftMergeAvail, aboveMergeAvail, pcSlice->getSPS()->getBitDepths());
    207 #endif
    208204      }
    209205    }
  • branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.cpp

    r1499 r1502  
    524524        // it is needed where the VPS is accessed through the slice
    525525        pBLPic->getSlice(0)->setVPS( vps );
     526        pBLPic->getPicSym()->inferSpsForNonHEVCBL();
     527        pBLPic->getSlice(0)->setSPS( &pBLPic->getPicSym()->getSPS() );
    526528      }
    527529    }
     
    596598      assert( vps->getVpsRepFormat( sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : vps->getVpsRepFormatIdx(layerIdx))->getBitDepthVpsChroma()         <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerIdx))->getBitDepthVpsChroma());
    597599    }
     600
     601    updateSPS->inferSPS( m_layerId, vps );
    598602#endif //SVC_EXTENSION
    599603
     
    627631
    628632    // Initialise the various objects for the new set of settings
    629 #if SVC_EXTENSION
    630     m_cSAO.create( pSlice->getPicWidthInLumaSamples(), pSlice->getPicHeightInLumaSamples(), pSlice->getChromaFormatIdc(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxTotalCUDepth(), pps->getPpsRangeExtension().getLog2SaoOffsetScale(CHANNEL_TYPE_LUMA), pps->getPpsRangeExtension().getLog2SaoOffsetScale(CHANNEL_TYPE_CHROMA) );
    631 #else
    632633    m_cSAO.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), sps->getChromaFormatIdc(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxTotalCUDepth(), pps->getPpsRangeExtension().getLog2SaoOffsetScale(CHANNEL_TYPE_LUMA), pps->getPpsRangeExtension().getLog2SaoOffsetScale(CHANNEL_TYPE_CHROMA) );
    633 #endif
    634634    m_cLoopFilter.create( sps->getMaxTotalCUDepth() );
    635 #if SCALABLE_REXT
    636     m_cPrediction.initTempBuff(pSlice->getChromaFormatIdc());
    637 #else
    638635    m_cPrediction.initTempBuff(sps->getChromaFormatIdc());
    639 #endif
    640636
    641637
     
    692688
    693689    // Recursive structure
    694 #if SVC_EXTENSION
    695     m_cCuDecoder.create ( sps->getMaxTotalCUDepth(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), pSlice->getChromaFormatIdc() );
     690    m_cCuDecoder.create ( sps->getMaxTotalCUDepth(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getChromaFormatIdc() );
     691#if SVC_EXTENSION
    696692    m_cCuDecoder.init   ( m_ppcTDecTop, &m_cEntropyDecoder, &m_cTrQuant, &m_cPrediction, m_layerId );
    697693#else
    698     m_cCuDecoder.create ( sps->getMaxTotalCUDepth(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getChromaFormatIdc() );
    699694    m_cCuDecoder.init   ( &m_cEntropyDecoder, &m_cTrQuant, &m_cPrediction );
    700695#endif
     
    13991394      if( pFile->good() )
    14001395      {
    1401         Bool is16bit  = pBLPic->getSlice(0)->getBitDepth(CHANNEL_TYPE_LUMA) > 8 || pBLPic->getSlice(0)->getBitDepth(CHANNEL_TYPE_CHROMA) > 8;
     1396        Bool is16bit  = pBLPic->getSlice(0)->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) > 8 || pBLPic->getSlice(0)->getSPS()->getBitDepth(CHANNEL_TYPE_CHROMA) > 8;
    14021397        UInt uiWidth  = pBLPic->getPicYuvRec()->getWidth(COMPONENT_Y);
    14031398        UInt uiHeight = pBLPic->getPicYuvRec()->getHeight(COMPONENT_Y);
     
    17011696        if( pcSlice->getPPS()->getCGSFlag() && m_c3DAsymLUTPPS.isRefLayer( pcSlice->getVPS()->getRefLayerId(m_layerId, refLayerIdc) ) )
    17021697        {
    1703           assert( pcSlice->getBaseColPic( refLayerIdc )->getSlice( 0 )->getBitDepth(CHANNEL_TYPE_LUMA) == m_c3DAsymLUTPPS.getInputBitDepthY() );
    1704           assert( pcSlice->getBaseColPic( refLayerIdc )->getSlice( 0 )->getBitDepth(CHANNEL_TYPE_CHROMA) == m_c3DAsymLUTPPS.getInputBitDepthC() );
    1705           assert( pcSlice->getBitDepth(CHANNEL_TYPE_LUMA) >= m_c3DAsymLUTPPS.getOutputBitDepthY() );
    1706           assert( pcSlice->getBitDepth(CHANNEL_TYPE_LUMA) >= m_c3DAsymLUTPPS.getOutputBitDepthC() );
     1698          assert( pcSlice->getBaseColPic( refLayerIdc )->getSlice( 0 )->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) == m_c3DAsymLUTPPS.getInputBitDepthY() );
     1699          assert( pcSlice->getBaseColPic( refLayerIdc )->getSlice( 0 )->getSPS()->getBitDepth(CHANNEL_TYPE_CHROMA) == m_c3DAsymLUTPPS.getInputBitDepthC() );
     1700          assert( pcSlice->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) >= m_c3DAsymLUTPPS.getOutputBitDepthY() );
     1701          assert( pcSlice->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) >= m_c3DAsymLUTPPS.getOutputBitDepthC() );
    17071702
    17081703          if( !m_pColorMappedPic )
     
    17211716          if( pcSlice->getVPS()->isSamplePredictionType( pcSlice->getVPS()->getLayerIdxInVps(m_layerId), pcSlice->getVPS()->getLayerIdxInVps(refLayerId) ) )
    17221717          {
    1723             m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, m_pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, m_pcPic->getPicYuvRec(), pcSlice->getBaseColPic( refLayerIdc )->getSlice( 0 )->getBitDepth(CHANNEL_TYPE_LUMA), pcSlice->getBaseColPic( refLayerIdc )->getSlice( 0 )->getBitDepth(CHANNEL_TYPE_CHROMA));
     1718            m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, m_pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, m_pcPic->getPicYuvRec(), pcSlice->getBaseColPic( refLayerIdc )->getSlice( 0 )->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA), pcSlice->getBaseColPic( refLayerIdc )->getSlice( 0 )->getSPS()->getBitDepth(CHANNEL_TYPE_CHROMA));
    17241719          }
    17251720        }
     
    18961891        pcSlice->getSPS()->getMaxLog2TrDynamicRange(CHANNEL_TYPE_CHROMA)
    18971892    };
    1898 #if SVC_EXTENSION
    1899     m_cTrQuant.setFlatScalingList(maxLog2TrDynamicRange, pcSlice->getBitDepths());
    1900 #else
    19011893    m_cTrQuant.setFlatScalingList(maxLog2TrDynamicRange, pcSlice->getSPS()->getBitDepths());
    1902 #endif
    19031894    m_cTrQuant.setUseScalingList(false);
    19041895  }
     
    24592450    {
    24602451      m_pColorMappedPic = new TComPicYuv;
    2461       m_pColorMappedPic->create( pcSlice->getPicWidthInLumaSamples(), pcSlice->getPicHeightInLumaSamples(), pcSlice->getChromaFormatIdc()/*CHROMA_420*/, pcSlice->getSPS()->getMaxCUWidth(), pcSlice->getSPS()->getMaxCUHeight(), pcSlice->getSPS()->getMaxTotalCUDepth(), true, NULL );
     2452      m_pColorMappedPic->create( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), pcSlice->getSPS()->getChromaFormatIdc(), pcSlice->getSPS()->getMaxCUWidth(), pcSlice->getSPS()->getMaxCUHeight(), pcSlice->getSPS()->getMaxTotalCUDepth(), true, NULL );
    24622453    }
    24632454  }
     
    26142605    TComPicYuv* pcPicYuvRecBase = (*(pcTDecTopBase->getListPic()->begin()))->getPicYuvRec();
    26152606
    2616     const Int bitDepthLuma = vps.getBitDepth(CHANNEL_TYPE_LUMA, &sps, m_layerId);
    2617     const Int bitDepthChroma = vps.getBitDepth(CHANNEL_TYPE_CHROMA, &sps, m_layerId);
    2618     const Int refBitDepthLuma = (*(pcTDecTopBase->getListPic()->begin()))->getSlice(0)->getBitDepth(CHANNEL_TYPE_LUMA);
    2619     const Int refBitDepthChroma = (*(pcTDecTopBase->getListPic()->begin()))->getSlice(0)->getBitDepth(CHANNEL_TYPE_CHROMA);
     2607    const Int bitDepthLuma = sps.getBitDepth(CHANNEL_TYPE_LUMA);
     2608    const Int bitDepthChroma = sps.getBitDepth(CHANNEL_TYPE_CHROMA);
     2609    const Int refBitDepthLuma = (*(pcTDecTopBase->getListPic()->begin()))->getSlice(0)->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA);
     2610    const Int refBitDepthChroma = (*(pcTDecTopBase->getListPic()->begin()))->getSlice(0)->getSPS()->getBitDepth(CHANNEL_TYPE_CHROMA);
    26202611   
    26212612    Bool sameBitDepths = ( bitDepthLuma == refBitDepthLuma ) && ( bitDepthChroma == refBitDepthChroma );
    26222613
    2623     if( pcPicYuvRecBase->getWidth(COMPONENT_Y) == vps.getPicWidthInLumaSamples(&sps, m_layerId) && pcPicYuvRecBase->getHeight(COMPONENT_Y) == vps.getPicHeightInLumaSamples(&sps, m_layerId) && equalOffsets && zeroPhase )
     2614    if( pcPicYuvRecBase->getWidth(COMPONENT_Y) == sps.getPicWidthInLumaSamples() && pcPicYuvRecBase->getHeight(COMPONENT_Y) == sps.getPicHeightInLumaSamples() && equalOffsets && zeroPhase )
    26242615    {
    26252616      pic->setEqualPictureSizeAndOffsetFlag( i, true );
Note: See TracChangeset for help on using the changeset viewer.