Changeset 1287 in SHVCSoftware for branches/SHM-dev/source/App


Ignore:
Timestamp:
17 Jul 2015, 05:43:37 (10 years ago)
Author:
seregin
Message:

port rev 4322 (g_bitDepth)

Location:
branches/SHM-dev/source/App
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-dev/source/App/TAppDecoder/TAppDecTop.cpp

    r1273 r1287  
    5757
    5858#if Q0074_COLOUR_REMAPPING_SEI
    59 static Void applyColourRemapping(TComPicYuv& pic, const SEIColourRemappingInfo* colourRemappingInfoSEI, UInt layerId=0 );
     59static Void applyColourRemapping(TComPicYuv& pic, const SEIColourRemappingInfo* colourRemappingInfoSEI, const BitDepths& bitDpeths, UInt layerId=0 );
    6060static std::vector<SEIColourRemappingInfo> storeCriSEI; //Persistent Colour Remapping Information SEI
    6161static SEIColourRemappingInfo *seiColourRemappingInfoPrevious=NULL ;
     
    290290#endif
    291291    {
    292       // Set bitdepth for each layer when doing DBF
    293       g_bitDepth[CHANNEL_TYPE_LUMA]   = g_bitDepthLayer[CHANNEL_TYPE_LUMA][curLayerId];
    294       g_bitDepth[CHANNEL_TYPE_CHROMA] = g_bitDepthLayer[CHANNEL_TYPE_CHROMA][curLayerId];
    295 
    296292      if (!loopFiltered[curLayerId] || bitstreamFile)
    297293      {
     
    322318      if ( m_pchReconFile[curLayerId] && !openedReconFile[curLayerId] )
    323319      {
     320        const BitDepths &bitDepths=pcListPic->front()->getSlice(0)->getBitDepths(); // use bit depths of first reconstructed picture.
    324321        for (UInt channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++)
    325322        {
    326323          if (m_outputBitDepth[channelType] == 0)
    327324          {
    328             m_outputBitDepth[channelType] = g_bitDepth[channelType];
     325            m_outputBitDepth[channelType] = bitDepths.recon[channelType];
    329326          }
    330327        }
    331         m_acTVideoIOYuvReconFile[curLayerId].open( m_pchReconFile[curLayerId], true, m_outputBitDepth, m_outputBitDepth, g_bitDepth ); // write mode
     328        m_acTVideoIOYuvReconFile[curLayerId].open( m_pchReconFile[curLayerId], true, m_outputBitDepth, m_outputBitDepth, bitDepths.recon ); // write mode
    332329
    333330        openedReconFile[curLayerId] = true;
     
    541538      if ( m_pchReconFile && !openedReconFile )
    542539      {
     540        const BitDepths &bitDepths=pcListPic->front()->getPicSym()->getSPS().getBitDepths(); // use bit depths of first reconstructed picture.
    543541        for (UInt channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++)
    544542        {
    545543          if (m_outputBitDepth[channelType] == 0)
    546544          {
    547             m_outputBitDepth[channelType] = g_bitDepth[channelType];
     545            m_outputBitDepth[channelType] = bitDepths.recon[channelType];
    548546          }
    549547        }
    550548
    551         m_cTVideoIOYuvReconFile.open( m_pchReconFile, true, m_outputBitDepth, m_outputBitDepth, g_bitDepth ); // write mode
     549        m_cTVideoIOYuvReconFile.open( m_pchReconFile, true, m_outputBitDepth, m_outputBitDepth, bitDepths.recon ); // write mode
    552550        openedReconFile = true;
    553551      }
     
    12981296      {
    12991297        //printf ("\n\nColour Remapping is applied to POC : %d and LayerId : %d ",pic->getPOC(), pic->getLayerId());
    1300         applyColourRemapping(*pic->getPicYuvRec(), seiColourRemappingInfo
    13011298#if SVC_EXTENSION
    1302        , pic->getLayerId()
    1303 #endif
    1304         );
     1299        applyColourRemapping(*pic->getPicYuvRec(), seiColourRemappingInfo, pic->getSlice(0)->getBitDepths(), pic->getLayerId());
     1300#else
     1301        applyColourRemapping(*pic->getPicYuvRec(), seiColourRemappingInfo, pic->getSlice(0)->getBitDepths());
     1302#endif
    13051303      }
    13061304      else  // using the last CRI SEI received
     
    13081306        const SEIColourRemappingInfo *seiColourRemappingInfoCopy;
    13091307        seiColourRemappingInfoCopy = seiColourRemappingInfoPrevious;
    1310         applyColourRemapping(*pic->getPicYuvRec(), seiColourRemappingInfoCopy
    13111308#if SVC_EXTENSION
    1312         , pic->getLayerId()
    1313 #endif
    1314         );
     1309        applyColourRemapping(*pic->getPicYuvRec(), seiColourRemappingInfoCopy, pic->getSlice(0)->getBitDepths(), pic->getLayerId());
     1310#else
     1311        applyColourRemapping(*pic->getPicYuvRec(), seiColourRemappingInfoCopy, pic->getSlice(0)->getBitDepths());
     1312#endif
    13151313      }
    13161314
     
    15451543
    15461544        TComPictureHash recon_digest;
    1547         Int numChar = calcMD5(*pic->getPicYuvRec(), recon_digest);
     1545        Int numChar = calcMD5(*pic->getPicYuvRec(), recon_digest, pic->getSlice(0)->getBitDepths());
    15481546        fprintf(fptr, "%8d%9d    MD5:%s\n", pic->getLayerId(), pic->getSlice(0)->getPOC(), hashToString(recon_digest, numChar).c_str());
    15491547        fclose(fptr);
     
    15701568      if( this->getDecodedYuvLayerRefresh(layerId) )
    15711569      {
    1572         m_outputBitDepth[CHANNEL_TYPE_LUMA]   = g_bitDepth[CHANNEL_TYPE_LUMA]   = g_bitDepthLayer[CHANNEL_TYPE_LUMA][layerId];
    1573         m_outputBitDepth[CHANNEL_TYPE_CHROMA] = g_bitDepth[CHANNEL_TYPE_CHROMA] = g_bitDepthLayer[CHANNEL_TYPE_CHROMA][layerId];
    1574 
    15751570        char tempFileName[256];
    15761571        strcpy(tempFileName, this->getDecodedYuvLayerFileName( layerId ).c_str());
    1577         m_confReconFile[layerId].open(tempFileName, true, m_outputBitDepth, m_outputBitDepth, g_bitDepth ); // write mode
     1572
     1573        const TComVPS *vps = m_acTDecTop->getLayerDec(layerId)->getParameterSetManager()->getActiveVPS();
     1574        const TComSPS *sps = m_acTDecTop->getLayerDec(layerId)->getParameterSetManager()->getActiveSPS();
     1575        const BitDepths &bitDpeths = vps->getBitDepths(sps, layerId);
     1576        Int bitDepth[] = {bitDpeths.recon[CHANNEL_TYPE_LUMA], bitDpeths.recon[CHANNEL_TYPE_CHROMA]};
     1577
     1578        m_confReconFile[layerId].open(tempFileName, true, m_outputBitDepth, m_outputBitDepth, bitDepth ); // write mode
    15781579        this->setDecodedYuvLayerRefresh( layerId, false );
    15791580      }
     
    18451846
    18461847#if Q0074_COLOUR_REMAPPING_SEI
    1847 Void xInitColourRemappingLut( const Int bitDepthY, const Int bitDepthC, std::vector<Int>(&preLut)[3], std::vector<Int>(&postLut)[3], const SEIColourRemappingInfo* const pCriSEI )
     1848Void xInitColourRemappingLut( const BitDepths &bitDepths, std::vector<Int>(&preLut)[3], std::vector<Int>(&postLut)[3], const SEIColourRemappingInfo* const pCriSEI )
    18481849{
    18491850  for ( Int c=0 ; c<3 ; c++ )
    18501851  { 
    1851     Int bitDepth = c ? bitDepthC : bitDepthY ;
     1852    Int bitDepth = bitDepths.recon[toChannelType(ComponentID(c))];
    18521853    preLut[c].resize(1 << bitDepth);
    18531854    postLut[c].resize(1 << pCriSEI->m_colourRemapBitDepth);
     
    19021903}
    19031904
    1904 static void applyColourRemapping(TComPicYuv& pic, const SEIColourRemappingInfo* pCriSEI, UInt layerId )
     1905static Void applyColourRemapping(TComPicYuv& pic, const SEIColourRemappingInfo* pCriSEI, const BitDepths& bitDpeths, UInt layerId )
    19051906
    19061907  if( !storeCriSEI.size() )
     
    19401941    YUVOut[2] = picColourRemapped.getAddr(COMPONENT_Cr);
    19411942
    1942 #if SVC_EXTENSION
    1943     Int bitDepthY = g_bitDepthLayer[CHANNEL_TYPE_LUMA][layerId];
    1944     Int bitDepthC = g_bitDepthLayer[CHANNEL_TYPE_CHROMA][layerId];
    1945 
    1946 #else
    1947     Int bitDepthY = g_bitDepth[CHANNEL_TYPE_LUMA];
    1948     Int bitDepthC = g_bitDepth[CHANNEL_TYPE_CHROMA];
    1949 #endif
    1950 
    19511943    std::vector<Int> preLut[3];
    19521944    std::vector<Int> postLut[3];
    1953     xInitColourRemappingLut( bitDepthY, bitDepthC, preLut, postLut, &storeCriSEI[layerId] );
     1945    xInitColourRemappingLut( bitDpeths, preLut, postLut, &storeCriSEI[layerId] );
    19541946   
    19551947    Int roundingOffset = (storeCriSEI[layerId].m_log2MatrixDenom==0) ? 0 : (1 << (storeCriSEI[layerId].m_log2MatrixDenom - 1));
  • branches/SHM-dev/source/App/TAppDecoder/TAppDecTop.h

    r1259 r1287  
    9696  Void  xInitDecLib       (); ///< initialize decoder class
    9797 
     98#if Q0074_COLOUR_REMAPPING_SEI
     99  Void  xInitColourRemappingLut( const BitDepths &bitDepths, std::vector<Int>(&preLut)[3], std::vector<Int>(&postLut)[3], const SEIColourRemappingInfo* const pCriSEI );
     100#endif
    98101#if SVC_EXTENSION
    99102  Void  xWriteOutput      ( TComList<TComPic*>* pcListPic, UInt layerId, UInt tId ); ///< write YUV to file
  • branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.cpp

    r1286 r1287  
    43084308  g_uiMaxCUDepth = m_uiMaxCUDepth;
    43094309#endif
    4310 
    4311   // set internal bit-depth and constants
    4312   for (UInt channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++)
    4313   {
    4314 #if O0043_BEST_EFFORT_DECODING
    4315     g_bitDepthInStream[channelType] = g_bitDepth[channelType] = m_internalBitDepth[channelType];
    4316 #else
    4317     g_bitDepth   [channelType] = m_internalBitDepth[channelType];
    4318 #endif
    4319   }
    43204310}
    43214311#endif
     
    44894479  printf("TOOL CFG: ");
    44904480#if !SVC_EXTENSION
    4491   printf("IBD:%d ", ((g_bitDepth[CHANNEL_TYPE_LUMA] > m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA]) || (g_bitDepth[CHANNEL_TYPE_CHROMA] > m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA])));
     4481  printf("IBD:%d ", ((m_internalBitDepth[CHANNEL_TYPE_LUMA] > m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA]) || (m_internalBitDepth[CHANNEL_TYPE_CHROMA] > m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA])));
    44924482#endif
    44934483  printf("HAD:%d ", m_bUseHADME           );
  • branches/SHM-dev/source/App/TAppEncoder/TAppEncTop.cpp

    r1285 r1287  
    217217  {
    218218    //1
    219     g_bitDepth[CHANNEL_TYPE_LUMA]   = m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_LUMA];
    220     g_bitDepth[CHANNEL_TYPE_CHROMA] = m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_CHROMA];
    221 
    222     // Set this to be used in Upsampling filter in function "TComUpsampleFilter::upsampleBasePic"
    223     g_bitDepthLayer[CHANNEL_TYPE_LUMA][m_acLayerCfg[layer].m_layerId]   = g_bitDepth[CHANNEL_TYPE_LUMA];
    224     g_bitDepthLayer[CHANNEL_TYPE_CHROMA][m_acLayerCfg[layer].m_layerId] = g_bitDepth[CHANNEL_TYPE_CHROMA];
    225 
    226219    m_acTEncTop[layer].setInterLayerWeightedPredFlag                      ( m_useInterLayerWeightedPred );
    227220   
     
    475468    for( UInt channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++ )
    476469    {
    477       m_acTEncTop[layer].setPCMBitDepth                                      ((ChannelType)channelType, m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_MSBExtendedBitDepth[channelType] : m_acLayerCfg[layer].m_internalBitDepth[channelType]);
     470      m_acTEncTop[layer].setBitDepth                                       ((ChannelType)channelType, m_acLayerCfg[layer].m_internalBitDepth[channelType]);
     471      m_acTEncTop[layer].setPCMBitDepth                                    ((ChannelType)channelType, m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_MSBExtendedBitDepth[channelType] : m_acLayerCfg[layer].m_internalBitDepth[channelType]);
    478472    }
    479473    m_acTEncTop[layer].setPCMLog2MaxSize                                   ( m_pcmLog2MaxSize);
     
    904898  for (UInt channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++)
    905899  {
    906 //#if O0043_BEST_EFFORT_DECODING
    907     //g_bitDepthInStream[channelType] = g_bitDepth[channelType] = m_internalBitDepth[channelType];
    908 //#else
    909     //g_bitDepth   [channelType] = m_internalBitDepth[channelType];
    910 //#endif
     900    m_cTEncTop.setBitDepth((ChannelType)channelType, m_internalBitDepth[channelType]);
    911901    m_cTEncTop.setPCMBitDepth((ChannelType)channelType, m_bPCMInputBitDepthFlag ? m_MSBExtendedBitDepth[channelType] : m_internalBitDepth[channelType]);
    912902  }
     
    10941084  {
    10951085    //2
    1096     for( UInt channelTypeIndex = 0; channelTypeIndex < MAX_NUM_CHANNEL_TYPE; channelTypeIndex++)
    1097     {
    1098       g_bitDepth[channelTypeIndex]    = m_acLayerCfg[layer].m_internalBitDepth[channelTypeIndex];
    1099     }
    1100 
    11011086#if LAYER_CTB
    11021087    g_uiMaxCUWidth  = g_auiLayerMaxCUWidth[layer];
     
    11931178  {
    11941179    //3
    1195     for (UInt channelTypeIndex = 0; channelTypeIndex < MAX_NUM_CHANNEL_TYPE; channelTypeIndex++)
    1196     {
    1197       g_bitDepth[channelTypeIndex]    = m_acLayerCfg[layer].m_internalBitDepth[channelTypeIndex];
    1198     }
    11991180#if LAYER_CTB
    12001181    g_uiMaxCUWidth  = g_auiLayerMaxCUWidth[layer];
     
    12331214        Int layerIdx = vps->getLayerIdxInVps(m_layerSetLayerIdList[setId][i]);
    12341215        //4
    1235         g_bitDepth[CHANNEL_TYPE_LUMA]   = m_acLayerCfg[layerIdx].m_internalBitDepth[CHANNEL_TYPE_LUMA];
    1236         g_bitDepth[CHANNEL_TYPE_CHROMA] = m_acLayerCfg[layerIdx].m_internalBitDepth[CHANNEL_TYPE_CHROMA];
    1237 
    12381216        vps->setLayerIdIncludedFlag(true, setId, layerId);
    12391217      }
     
    12501228        //4
    12511229        UInt layerId = vps->getLayerIdInNuh(layerIdx);
    1252         g_bitDepth[CHANNEL_TYPE_LUMA]   = m_acLayerCfg[layerIdx].m_internalBitDepth[CHANNEL_TYPE_LUMA];
    1253         g_bitDepth[CHANNEL_TYPE_CHROMA] = m_acLayerCfg[layerIdx].m_internalBitDepth[CHANNEL_TYPE_CHROMA];
    12541230
    12551231        if (layerId <= setId)
     
    17021678  {
    17031679    //5
    1704     g_bitDepth[CHANNEL_TYPE_LUMA]   = m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_LUMA];
    1705     g_bitDepth[CHANNEL_TYPE_CHROMA] = m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_CHROMA];
    1706 
    17071680    // allocate original YUV buffer
    17081681    pcPicYuvOrg[layer] = new TComPicYuv;
     
    17391712      {
    17401713        //6
    1741         for (UInt channelTypeIndex = 0; channelTypeIndex < MAX_NUM_CHANNEL_TYPE; channelTypeIndex++)
    1742         {
    1743           g_bitDepth[channelTypeIndex]    = m_acLayerCfg[layer].m_internalBitDepth[channelTypeIndex];
    1744         }
    17451714#if LAYER_CTB
    17461715        g_uiMaxCUWidth  = g_auiLayerMaxCUWidth[layer];
     
    17591728        if( m_acLayerCfg[layer].getChromaFormatIDC() == CHROMA_400 || (m_apcTEncTop[0]->getVPS()->getScalabilityMask(AUX_ID) && (m_acLayerCfg[layer].getAuxId() == AUX_ALPHA || m_acLayerCfg[layer].getAuxId() == AUX_DEPTH)) )
    17601729        {
    1761           pcPicYuvOrg[layer]->convertToMonochrome();
     1730          pcPicYuvOrg[layer]->convertToMonochrome(m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_CHROMA]);
    17621731        }
    17631732#endif
     
    18231792      {
    18241793        //7
    1825         for( UInt channelTypeIndex = 0; channelTypeIndex < MAX_NUM_CHANNEL_TYPE; channelTypeIndex++ )
    1826         {
    1827           g_bitDepth[channelTypeIndex]    = m_acLayerCfg[layer].m_internalBitDepth[channelTypeIndex];
    1828         }
    18291794#if LAYER_CTB
    18301795        g_uiMaxCUWidth  = g_auiLayerMaxCUWidth[layer];
     
    18951860    {
    18961861      //8
    1897       for( UInt channelTypeIndex = 0; channelTypeIndex < MAX_NUM_CHANNEL_TYPE; channelTypeIndex++ )
    1898       {
    1899         g_bitDepth[channelTypeIndex]    = m_acLayerCfg[layer].m_internalBitDepth[channelTypeIndex];
    1900       }
    1901 
    19021862      // write bistream to file if necessary
    19031863      iNumEncoded = m_acTEncTop[layer].getNumPicRcvd();
     
    19831943  for(layer = 0; layer < m_numLayers; layer++)
    19841944  {
    1985     m_gcAnalyzeAll[layer].printOut('a', m_acLayerCfg[layer].getChromaFormatIDC(), printMSEBasedSNR, printSequenceMSE, layer);
     1945    const BitDepths bitDepths(m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_LUMA], m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_CHROMA]);
     1946
     1947    m_gcAnalyzeAll[layer].printOut('a', m_acLayerCfg[layer].getChromaFormatIDC(), printMSEBasedSNR, printSequenceMSE, bitDepths, layer);
    19861948  }
    19871949
     
    19891951  for(layer = 0; layer < m_numLayers; layer++)
    19901952  {
    1991     m_gcAnalyzeI[layer].printOut('i', m_acLayerCfg[layer].getChromaFormatIDC(), printMSEBasedSNR, printSequenceMSE, layer);
     1953    const BitDepths bitDepths(m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_LUMA], m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_CHROMA]);
     1954
     1955    m_gcAnalyzeI[layer].printOut('i', m_acLayerCfg[layer].getChromaFormatIDC(), printMSEBasedSNR, printSequenceMSE, bitDepths, layer);
    19921956  }
    19931957
     
    19951959  for(layer = 0; layer < m_numLayers; layer++)
    19961960  {
    1997     m_gcAnalyzeP[layer].printOut('p', m_acLayerCfg[layer].getChromaFormatIDC(), printMSEBasedSNR, printSequenceMSE, layer);
     1961    const BitDepths bitDepths(m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_LUMA], m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_CHROMA]);
     1962
     1963    m_gcAnalyzeP[layer].printOut('p', m_acLayerCfg[layer].getChromaFormatIDC(), printMSEBasedSNR, printSequenceMSE, bitDepths, layer);
    19981964  }
    19991965
     
    20011967  for(layer = 0; layer < m_numLayers; layer++)
    20021968  {
    2003     m_gcAnalyzeB[layer].printOut('b', m_acLayerCfg[layer].getChromaFormatIDC(), printMSEBasedSNR, printSequenceMSE, layer);
     1969    const BitDepths bitDepths(m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_LUMA], m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_CHROMA]);
     1970
     1971    m_gcAnalyzeB[layer].printOut('b', m_acLayerCfg[layer].getChromaFormatIDC(), printMSEBasedSNR, printSequenceMSE, bitDepths, layer);
    20041972  }
    20051973
     
    20081976    for(layer = 0; layer < m_numLayers; layer++)
    20091977    {
     1978      const BitDepths bitDepths(m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_LUMA], m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_CHROMA]);
     1979
    20101980      //-- interlaced summary
    20111981      m_gcAnalyzeAll_in.setFrmRate( m_acLayerCfg[layer].getFrameRate());
     
    20141984
    20151985      printf( "\n\nSUMMARY INTERLACED ---------------------------------------------\n" );
    2016       m_gcAnalyzeAll_in.printOut('a', m_acLayerCfg[layer].getChromaFormatIDC(), printMSEBasedSNR, printSequenceMSE, layer);
     1986      m_gcAnalyzeAll_in.printOut('a', m_acLayerCfg[layer].getChromaFormatIDC(), printMSEBasedSNR, printSequenceMSE, bitDepths, layer);
    20171987
    20181988#if _SUMMARY_OUT_
Note: See TracChangeset for help on using the changeset viewer.