Changeset 713 in SHVCSoftware for trunk/source/App


Ignore:
Timestamp:
21 Apr 2014, 04:44:16 (11 years ago)
Author:
seregin
Message:

merge with SHM-6-dev

Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/source

  • trunk/source/App/TAppDecoder/TAppDecCfg.cpp

    r595 r713  
    9292#if AVC_BASE
    9393  ("BLReconFile,-ibl",    cfg_BLReconFile,  string(""), "BL reconstructed YUV input file name")
     94#if !REPN_FORMAT_IN_VPS
    9495  ("BLSourceWidth,-wdt",    m_iBLSourceWidth,        0, "BL source picture width")
    9596  ("BLSourceHeight,-hgt",   m_iBLSourceHeight,       0, "BL source picture height")
     97#endif
    9698#if AVC_SYNTAX
    9799  ("BLSyntaxFile,-ibs",    cfg_BLSyntaxFile,  string(""), "BL syntax input file name") 
  • trunk/source/App/TAppDecoder/TAppDecCfg.h

    r595 r713  
    7474#if AVC_BASE
    7575  Char*         m_pchBLReconFile;                     ///< input BL reconstruction file name
     76#if !REPN_FORMAT_IN_VPS
    7677  Int           m_iBLSourceWidth;
    7778  Int           m_iBLSourceHeight;
     79#endif
    7880#if AVC_SYNTAX
    7981  Char*         m_pchBLSyntaxFile;                     ///< input BL syntax file name 
     
    8486#if SYNTAX_OUTPUT
    8587  Char*         m_pchBLSyntaxFile;                     ///< input BL syntax file name
     88#if !REPN_FORMAT_IN_VPS
    8689  Int           m_iBLSourceWidth;
    8790  Int           m_iBLSourceHeight;
     91#endif
    8892  Int           m_iBLFrames;
    8993#endif
     
    108112#if SVC_EXTENSION
    109113  , m_tgtLayerId(0)
    110 #if AVC_BASE
     114#if AVC_BASE && !REPN_FORMAT_IN_VPS
    111115  , m_iBLSourceWidth(0)
    112116  , m_iBLSourceHeight(0)
  • trunk/source/App/TAppDecoder/TAppDecTop.cpp

    r644 r713  
    163163  }
    164164  TComList<TComPic*> *cListPic = m_acTDecTop[0].getListPic();
     165#if AVC_SYNTAX || !REPN_FORMAT_IN_VPS
    165166  m_acTDecTop[0].setBLsize( m_iBLSourceWidth, m_iBLSourceHeight );
     167#endif
    166168  m_acTDecTop[0].setBLReconFile( &streamYUV );
    167169  pcBLPic.setLayerId( 0 );
     
    257259      Bool outputPicturesFlag = true; 
    258260#if NO_OUTPUT_OF_PRIOR_PICS
    259       if( m_acTDecTop[nalu.m_layerId].getNoOutputOfPriorPicsFlags() )
     261      if( m_acTDecTop[nalu.m_layerId].getNoOutputPriorPicsFlag() )
    260262      {
    261263        outputPicturesFlag = false;
     
    449451      loopFiltered = (nalu.m_nalUnitType == NAL_UNIT_EOS);
    450452    }
     453#if !FIX_WRITING_OUTPUT
     454#if SETTING_NO_OUT_PIC_PRIOR
     455    if (bNewPicture && m_cTDecTop.getNoOutputPriorPicsFlag())
     456    {
     457      m_cTDecTop.checkNoOutputPriorPics( pcListPic );
     458    }
     459#endif
     460#endif
    451461
    452462    if( pcListPic )
     
    460470        openedReconFile = true;
    461471      }
     472#if FIX_WRITING_OUTPUT
     473      // write reconstruction to file
     474      if( bNewPicture )
     475      {
     476        xWriteOutput( pcListPic, nalu.m_temporalId );
     477      }
     478#if SETTING_NO_OUT_PIC_PRIOR
     479      if ( (bNewPicture || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA) && m_cTDecTop.getNoOutputPriorPicsFlag() )
     480      {
     481        m_cTDecTop.checkNoOutputPriorPics( pcListPic );
     482        m_cTDecTop.setNoOutputPriorPicsFlag (false);
     483      }
     484#endif
     485#endif
    462486      if ( bNewPicture &&
    463487           (   nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL
     
    471495      if (nalu.m_nalUnitType == NAL_UNIT_EOS)
    472496      {
     497#if FIX_OUTPUT_EOS
     498        xWriteOutput( pcListPic, nalu.m_temporalId );
     499#else
    473500        xFlushOutput( pcListPic );       
    474       }
    475       // write reconstruction to file
     501#endif
     502      }
     503      // write reconstruction to file -- for additional bumping as defined in C.5.2.3
     504#if FIX_WRITING_OUTPUT
     505      if(!bNewPicture && nalu.m_nalUnitType >= NAL_UNIT_CODED_SLICE_TRAIL_N && nalu.m_nalUnitType <= NAL_UNIT_RESERVED_VCL31)
     506#else
    476507      if(bNewPicture)
     508#endif
    477509      {
    478510        xWriteOutput( pcListPic, nalu.m_temporalId );
     
    586618  TComList<TComPic*>::iterator iterPic   = pcListPic->begin();
    587619  Int numPicsNotYetDisplayed = 0;
     620  Int dpbFullness = 0;
     621#if SVC_EXTENSION
     622TComSPS* activeSPS = m_acTDecTop[layerId].getActiveSPS();
     623#else
     624  TComSPS* activeSPS = m_cTDecTop.getActiveSPS();
     625#endif
     626  UInt numReorderPicsHighestTid;
     627  UInt maxDecPicBufferingHighestTid;
     628  UInt maxNrSublayers = activeSPS->getMaxTLayers();
     629
     630  if(m_iMaxTemporalLayer == -1 || m_iMaxTemporalLayer >= maxNrSublayers)
     631  {
     632    numReorderPicsHighestTid = activeSPS->getNumReorderPics(maxNrSublayers-1);
     633    maxDecPicBufferingHighestTid =  activeSPS->getMaxDecPicBuffering(maxNrSublayers-1);
     634  }
     635  else
     636  {
     637    numReorderPicsHighestTid = activeSPS->getNumReorderPics(m_iMaxTemporalLayer);
     638    maxDecPicBufferingHighestTid = activeSPS->getMaxDecPicBuffering(m_iMaxTemporalLayer);
     639  }
    588640
    589641  while (iterPic != pcListPic->end())
     
    597649    {
    598650      numPicsNotYetDisplayed++;
     651      dpbFullness++;
     652    }
     653    else if(pcPic->getSlice( 0 )->isReferenced())
     654    {
     655      dpbFullness++;
    599656    }
    600657    iterPic++;
     
    619676
    620677#if SVC_EXTENSION
    621       if ( pcPicTop->getOutputMark() && (numPicsNotYetDisplayed >  pcPicTop->getNumReorderPics(tId) && !(pcPicTop->getPOC()%2) && pcPicBottom->getPOC() == pcPicTop->getPOC()+1)
    622         && pcPicBottom->getOutputMark() && (numPicsNotYetDisplayed >  pcPicBottom->getNumReorderPics(tId) && (pcPicTop->getPOC() == m_aiPOCLastDisplay[layerId]+1 || m_aiPOCLastDisplay[layerId]<0)))
    623 #else
    624       if ( pcPicTop->getOutputMark() && (numPicsNotYetDisplayed >  pcPicTop->getNumReorderPics(tId) && !(pcPicTop->getPOC()%2) && pcPicBottom->getPOC() == pcPicTop->getPOC()+1)
    625         && pcPicBottom->getOutputMark() && (numPicsNotYetDisplayed >  pcPicBottom->getNumReorderPics(tId) && (pcPicTop->getPOC() == m_iPOCLastDisplay+1 || m_iPOCLastDisplay<0)))
     678      if( pcPicTop->getOutputMark() && pcPicBottom->getOutputMark() &&
     679        (numPicsNotYetDisplayed >  numReorderPicsHighestTid || dpbFullness > maxDecPicBufferingHighestTid) &&
     680        (!(pcPicTop->getPOC()%2) && pcPicBottom->getPOC() == pcPicTop->getPOC()+1) &&       
     681        (pcPicTop->getPOC() == m_aiPOCLastDisplay[layerId]+1 || m_aiPOCLastDisplay[layerId]<0) )
     682#else
     683      if ( pcPicTop->getOutputMark() && pcPicBottom->getOutputMark() &&
     684          (numPicsNotYetDisplayed >  numReorderPicsHighestTid || dpbFullness > maxDecPicBufferingHighestTid) &&
     685          (!(pcPicTop->getPOC()%2) && pcPicBottom->getPOC() == pcPicTop->getPOC()+1) &&
     686          (pcPicTop->getPOC() == m_iPOCLastDisplay+1 || m_iPOCLastDisplay < 0))
    626687#endif
    627688      {
     
    634695          const Window &defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window();
    635696          const Bool isTff = pcPicTop->isTopField();
     697          TComPicYuv* pPicCYuvRecTop = pcPicTop->getPicYuvRec();
     698          TComPicYuv* pPicCYuvRecBot = pcPicBottom->getPicYuvRec();
     699#if Q0074_SEI_COLOR_MAPPING
     700          if( m_acTDecTop[layerId].m_ColorMapping->getColorMappingFlag() )
     701          {
     702            pPicCYuvRecTop = m_acTDecTop[layerId].m_ColorMapping->getColorMapping( pPicCYuvRecTop, 0, layerId );
     703            pPicCYuvRecBot = m_acTDecTop[layerId].m_ColorMapping->getColorMapping( pPicCYuvRecBot, 1, layerId );
     704          }
     705#endif
    636706#if REPN_FORMAT_IN_VPS
    637707          UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc();
    638708          Int xScal =  TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc );
    639           m_acTVideoIOYuvReconFile[layerId].write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
     709
     710          m_acTVideoIOYuvReconFile[layerId].write( pPicCYuvRecTop, pPicCYuvRecBot,
    640711            conf.getWindowLeftOffset()  * xScal + defDisp.getWindowLeftOffset(),
    641712            conf.getWindowRightOffset() * xScal + defDisp.getWindowRightOffset(),
    642713            conf.getWindowTopOffset()   * yScal + defDisp.getWindowTopOffset(),
    643714            conf.getWindowBottomOffset()* yScal + defDisp.getWindowBottomOffset(), isTff );
    644 
    645 #else
    646 #if O0194_DIFFERENT_BITDEPTH_EL_BL
    647           // Compile time bug-fix
    648           m_acTVideoIOYuvReconFile[layerId].write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
    649 #else
    650           m_cTVideoIOYuvReconFile.write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
    651 #endif
     715#else
     716          m_acTVideoIOYuvReconFile[layerId].write( pPicCYuvRecTop, pPicCYuvRecBot,
     717            conf.getWindowLeftOffset()   + defDisp.getWindowLeftOffset(),
     718            conf.getWindowRightOffset()  + defDisp.getWindowRightOffset(),
     719            conf.getWindowTopOffset()    + defDisp.getWindowTopOffset(),
     720            conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), isTff );
     721#endif
     722        }
     723
     724        // update POC of display order
     725        m_aiPOCLastDisplay[layerId] = pcPicBottom->getPOC();
     726#else
     727        if ( m_pchReconFile )
     728        {
     729          const Window &conf = pcPicTop->getConformanceWindow();
     730          const Window &defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window();
     731          const Bool isTff = pcPicTop->isTopField();
     732          TComPicYuv* pPicCYuvRecTop = pcPicTop->getPicYuvRec();
     733          TComPicYuv* pPicCYuvRecBot = pcPicBottom->getPicYuvRec();
     734#if Q0074_SEI_COLOR_MAPPING
     735          if ( m_cTDecTop.m_ColorMapping->getColorMappingFlag() )
     736          {
     737            pPicCYuvRecTop = m_cTDecTop.m_ColorMapping->getColorMapping( pPicCYuvRecTop, 0 );
     738            pPicCYuvRecBot = m_cTDecTop.m_ColorMapping->getColorMapping( pPicCYuvRecBot, 1 );
     739          }
     740#endif
     741          m_cTVideoIOYuvReconFile.write( pPicCYuvRecTop, pPicCYuvRecBot,
    652742            conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    653743            conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
    654744            conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
    655745            conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), isTff );
    656 #endif
    657746        }
    658747
    659748        // update POC of display order
    660         m_aiPOCLastDisplay[layerId] = pcPicBottom->getPOC();
     749        m_iPOCLastDisplay = pcPicBottom->getPOC();
     750#endif
     751
     752        // erase non-referenced picture in the reference picture list after display
     753        if ( !pcPicTop->getSlice(0)->isReferenced() && pcPicTop->getReconMark() == true )
     754        {
     755#if !DYN_REF_FREE
     756          pcPicTop->setReconMark(false);
     757
     758          // mark it should be extended later
     759          pcPicTop->getPicYuvRec()->setBorderExtension( false );
     760
     761#else
     762          pcPicTop->destroy();
     763          pcListPic->erase( iterPic );
     764          iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!
     765          continue;
     766#endif
     767        }
     768        if ( !pcPicBottom->getSlice(0)->isReferenced() && pcPicBottom->getReconMark() == true )
     769        {
     770#if !DYN_REF_FREE
     771          pcPicBottom->setReconMark(false);
     772
     773          // mark it should be extended later
     774          pcPicBottom->getPicYuvRec()->setBorderExtension( false );
     775
     776#else
     777          pcPicBottom->destroy();
     778          pcListPic->erase( iterPic );
     779          iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!
     780          continue;
     781#endif
     782        }
     783        pcPicTop->setOutputMark(false);
     784        pcPicBottom->setOutputMark(false);
     785      }
     786    }
     787  }
     788  else if (!pcPic->isField()) //Frame Decoding
     789  {
     790    iterPic = pcListPic->begin();
     791    while (iterPic != pcListPic->end())
     792    {
     793      pcPic = *(iterPic);
     794
     795#if SVC_EXTENSION
     796      if( pcPic->getOutputMark() && pcPic->getPOC() > m_aiPOCLastDisplay[layerId] &&
     797        (numPicsNotYetDisplayed >  numReorderPicsHighestTid || dpbFullness > maxDecPicBufferingHighestTid) )
     798#else
     799      if(pcPic->getOutputMark() && pcPic->getPOC() > m_iPOCLastDisplay &&
     800        (numPicsNotYetDisplayed >  numReorderPicsHighestTid || dpbFullness > maxDecPicBufferingHighestTid))
     801#endif
     802      {
     803        // write to file
     804        numPicsNotYetDisplayed--;
     805        if(pcPic->getSlice(0)->isReferenced() == false)
     806        {
     807          dpbFullness--;
     808        }
     809#if SVC_EXTENSION
     810        if( m_pchReconFile[layerId] )
     811        {
     812          const Window &conf = pcPic->getConformanceWindow();
     813          const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
     814          TComPicYuv* pPicCYuvRec = pcPic->getPicYuvRec();
     815#if Q0074_SEI_COLOR_MAPPING
     816          if ( m_acTDecTop[layerId].m_ColorMapping->getColorMappingFlag() )
     817          {
     818            pPicCYuvRec = m_acTDecTop[layerId].m_ColorMapping->getColorMapping( pPicCYuvRec, 0, layerId );
     819          }
     820#endif
     821
     822#if REPN_FORMAT_IN_VPS
     823          UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc();
     824          Int xScal =  TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc );
     825
     826          m_acTVideoIOYuvReconFile[layerId].write( pPicCYuvRec,
     827            conf.getWindowLeftOffset()  * xScal + defDisp.getWindowLeftOffset(),
     828            conf.getWindowRightOffset() * xScal + defDisp.getWindowRightOffset(),
     829            conf.getWindowTopOffset()   * yScal + defDisp.getWindowTopOffset(),
     830            conf.getWindowBottomOffset()* yScal + defDisp.getWindowBottomOffset() );
     831#else
     832          m_acTVideoIOYuvReconFile[layerId].write( pPicCYuvRec,
     833            conf.getWindowLeftOffset()   + defDisp.getWindowLeftOffset(),
     834            conf.getWindowRightOffset()  + defDisp.getWindowRightOffset(),
     835            conf.getWindowTopOffset()    + defDisp.getWindowTopOffset(),
     836            conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() );
     837#endif
     838        }
     839
     840        // update POC of display order
     841        m_aiPOCLastDisplay[layerId] = pcPic->getPOC();
    661842#else
    662843        if ( m_pchReconFile )
     844        {
     845#if SYNTAX_OUTPUT
     846          TComPicYuv* pPicCYuvRec = pcPic->getPicYuvRec();
     847#if Q0074_SEI_COLOR_MAPPING
     848          if( m_acTDecTop[layerIdx].m_ColorMapping->getColorMappingFlag() )
     849          {
     850            pPicCYuvRec = m_acTDecTop[layerIdx].m_ColorMapping->getColorMapping( pPicCYuvRec, 0, layerIdx );
     851          }
     852#endif
     853          const Window &conf = pcPic->getConformanceWindow();
     854          const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
     855          m_cTVideoIOYuvReconFile.write( pPicCYuvRec,
     856            conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
     857            conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
     858            conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
     859            conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() );
     860#endif
     861        }
     862
     863        // update POC of display order
     864        m_iPOCLastDisplay = pcPic->getPOC();
     865#endif
     866
     867        // erase non-referenced picture in the reference picture list after display
     868        if ( !pcPic->getSlice(0)->isReferenced() && pcPic->getReconMark() == true )
     869        {
     870#if !DYN_REF_FREE
     871          pcPic->setReconMark(false);
     872
     873          // mark it should be extended later
     874          pcPic->getPicYuvRec()->setBorderExtension( false );
     875
     876#else
     877          pcPic->destroy();
     878          pcListPic->erase( iterPic );
     879          iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!
     880          continue;
     881#endif
     882        }
     883        pcPic->setOutputMark(false);
     884      }
     885
     886      iterPic++;
     887    }
     888  }
     889}
     890
     891/** \param pcListPic list of pictures to be written to file
     892    \todo            DYN_REF_FREE should be revised
     893 */
     894#if SVC_EXTENSION
     895Void TAppDecTop::xFlushOutput( TComList<TComPic*>* pcListPic, UInt layerId )
     896#else
     897Void TAppDecTop::xFlushOutput( TComList<TComPic*>* pcListPic )
     898#endif
     899{
     900  if(!pcListPic || pcListPic->empty())
     901  {
     902    return;
     903  }
     904  TComList<TComPic*>::iterator iterPic   = pcListPic->begin();
     905
     906  iterPic   = pcListPic->begin();
     907  TComPic* pcPic = *(iterPic);
     908
     909  if (pcPic->isField()) //Field Decoding
     910  {
     911    TComList<TComPic*>::iterator endPic   = pcListPic->end();
     912    endPic--;
     913    TComPic *pcPicTop, *pcPicBottom = NULL;
     914    while (iterPic != endPic)
     915    {
     916      pcPicTop = *(iterPic);
     917      iterPic++;
     918      pcPicBottom = *(iterPic);
     919
     920      if ( pcPicTop->getOutputMark() && pcPicBottom->getOutputMark() && !(pcPicTop->getPOC()%2) && (pcPicBottom->getPOC() == pcPicTop->getPOC()+1) )
     921      {
     922        // write to file
     923#if SVC_EXTENSION
     924        if ( m_pchReconFile[layerId] )
    663925        {
    664926          const Window &conf = pcPicTop->getConformanceWindow();
    665927          const Window &defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window();
    666928          const Bool isTff = pcPicTop->isTopField();
    667           m_cTVideoIOYuvReconFile.write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
     929          TComPicYuv* pPicCYuvRecTop = pcPicTop->getPicYuvRec();
     930          TComPicYuv* pPicCYuvRecBot = pcPicBottom->getPicYuvRec();
     931#if Q0074_SEI_COLOR_MAPPING
     932          if( m_acTDecTop[layerId].m_ColorMapping->getColorMappingFlag() )
     933          {
     934            pPicCYuvRecTop = m_acTDecTop[layerId].m_ColorMapping->getColorMapping( pPicCYuvRecTop, 0, layerId );
     935            pPicCYuvRecBot = m_acTDecTop[layerId].m_ColorMapping->getColorMapping( pPicCYuvRecBot, 1, layerId );
     936          }
     937#endif
     938#if REPN_FORMAT_IN_VPS
     939          UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc();
     940          Int xScal =  TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc );
     941
     942          m_acTVideoIOYuvReconFile[layerId].write( pPicCYuvRecTop, pPicCYuvRecBot,
     943            conf.getWindowLeftOffset()  *xScal + defDisp.getWindowLeftOffset(),
     944            conf.getWindowRightOffset() *xScal + defDisp.getWindowRightOffset(),
     945            conf.getWindowTopOffset()   *yScal + defDisp.getWindowTopOffset(),
     946            conf.getWindowBottomOffset()*yScal + defDisp.getWindowBottomOffset(), isTff );
     947#else
     948          m_acTVideoIOYuvReconFile[layerId].write( pPicCYuvRecTop, pPicCYuvRecBot,
     949            conf.getWindowLeftOffset()   + defDisp.getWindowLeftOffset(),
     950            conf.getWindowRightOffset()  + defDisp.getWindowRightOffset(),
     951            conf.getWindowTopOffset()    + defDisp.getWindowTopOffset(),
     952            conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), isTff );
     953#endif
     954        }
     955
     956        // update POC of display order
     957        m_aiPOCLastDisplay[layerId] = pcPicBottom->getPOC();
     958#else
     959        if ( m_pchReconFile )
     960        {
     961          const Window &conf = pcPicTop->getConformanceWindow();
     962          const Window &defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window();
     963          const Bool isTff = pcPicTop->isTopField();
     964          TComPicYuv* pPicCYuvRecTop = pcPicTop->getPicYuvRec();
     965          TComPicYuv* pPicCYuvRecBot = pcPicBottom->getPicYuvRec();
     966#if Q0074_SEI_COLOR_MAPPING
     967          if( m_cTDecTop.m_ColorMapping->getColorMappingFlag() )
     968          {
     969            pPicCYuvRecTop = m_cTDecTop.m_ColorMapping->getColorMapping( pPicCYuvRecTop, 0 );
     970            pPicCYuvRecBot = m_cTDecTop.m_ColorMapping->getColorMapping( pPicCYuvRecBot, 1 );
     971          }
     972#endif
     973          m_cTVideoIOYuvReconFile.write( pPicCYuvRecTop, pPicCYuvRecBot,
    668974            conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    669975            conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
     
    7091015        pcPicTop->setOutputMark(false);
    7101016        pcPicBottom->setOutputMark(false);
    711       }
    712     }
    713   }
    714   else if (!pcPic->isField()) //Frame Decoding
    715   {
    716     iterPic = pcListPic->begin();
     1017
     1018#if !DYN_REF_FREE
     1019        if(pcPicTop)
     1020        {
     1021          pcPicTop->destroy();
     1022          delete pcPicTop;
     1023          pcPicTop = NULL;
     1024        }
     1025#endif
     1026      }
     1027    }
     1028    if(pcPicBottom)
     1029    {
     1030      pcPicBottom->destroy();
     1031      delete pcPicBottom;
     1032      pcPicBottom = NULL;
     1033    }
     1034  }
     1035  else //Frame decoding
     1036  {
    7171037    while (iterPic != pcListPic->end())
    7181038    {
    7191039      pcPic = *(iterPic);
    7201040
    721 #if SVC_EXTENSION
    722       if ( pcPic->getOutputMark() && (numPicsNotYetDisplayed >  pcPic->getNumReorderPics(tId) && pcPic->getPOC() > m_aiPOCLastDisplay[layerId]))
    723 #else
    724       if ( pcPic->getOutputMark() && (numPicsNotYetDisplayed >  pcPic->getNumReorderPics(tId) && pcPic->getPOC() > m_iPOCLastDisplay))
    725 #endif
     1041      if ( pcPic->getOutputMark() )
    7261042      {
    7271043        // write to file
    728         numPicsNotYetDisplayed--;
    7291044#if SVC_EXTENSION
    7301045        if ( m_pchReconFile[layerId] )
     
    7321047          const Window &conf = pcPic->getConformanceWindow();
    7331048          const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
     1049          TComPicYuv* pPicCYuvRec = pcPic->getPicYuvRec();
     1050#if Q0074_SEI_COLOR_MAPPING
     1051          if( m_acTDecTop[layerId].m_ColorMapping->getColorMappingFlag() )
     1052          {
     1053            pPicCYuvRec = m_acTDecTop[layerId].m_ColorMapping->getColorMapping( pPicCYuvRec, 0, layerId );
     1054          }
     1055#endif
    7341056#if REPN_FORMAT_IN_VPS
    7351057          UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc();
    7361058          Int xScal =  TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc );
    737           m_acTVideoIOYuvReconFile[layerId].write( pcPic->getPicYuvRec(),
    738             conf.getWindowLeftOffset()  * xScal + defDisp.getWindowLeftOffset(),
    739             conf.getWindowRightOffset() * xScal + defDisp.getWindowRightOffset(),
    740             conf.getWindowTopOffset()   * yScal + defDisp.getWindowTopOffset(),
    741             conf.getWindowBottomOffset()* yScal + defDisp.getWindowBottomOffset() );
    742 
    743 #else
    744           m_acTVideoIOYuvReconFile[layerId].write( pcPic->getPicYuvRec(),
    745             conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    746             conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
    747             conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
    748             conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() );
    749 #endif
    750         }
    751 
    752         // update POC of display order
    753         m_aiPOCLastDisplay[layerId] = pcPic->getPOC();
    754 #else
    755         if ( m_pchReconFile )
    756         {
    757 #if SYNTAX_OUTPUT
    758           const Window &conf = pcPic->getConformanceWindow();
    759           const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
    760           m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(),
    761             conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    762             conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
    763             conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
    764             conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() );
    765 #endif
    766         }
    767 
    768         // update POC of display order
    769         m_iPOCLastDisplay = pcPic->getPOC();
    770 #endif
    771 
    772         // erase non-referenced picture in the reference picture list after display
    773         if ( !pcPic->getSlice(0)->isReferenced() && pcPic->getReconMark() == true )
    774         {
    775 #if !DYN_REF_FREE
    776           pcPic->setReconMark(false);
    777 
    778           // mark it should be extended later
    779           pcPic->getPicYuvRec()->setBorderExtension( false );
    780 
    781 #else
    782           pcPic->destroy();
    783           pcListPic->erase( iterPic );
    784           iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!
    785           continue;
    786 #endif
    787         }
    788         pcPic->setOutputMark(false);
    789       }
    790 
    791       iterPic++;
    792     }
    793   }
    794 }
    795 
    796 /** \param pcListPic list of pictures to be written to file
    797     \todo            DYN_REF_FREE should be revised
    798  */
    799 #if SVC_EXTENSION
    800 Void TAppDecTop::xFlushOutput( TComList<TComPic*>* pcListPic, UInt layerId )
    801 #else
    802 Void TAppDecTop::xFlushOutput( TComList<TComPic*>* pcListPic )
    803 #endif
    804 {
    805   if(!pcListPic || pcListPic->empty())
    806   {
    807     return;
    808   }
    809   TComList<TComPic*>::iterator iterPic   = pcListPic->begin();
    810 
    811   iterPic   = pcListPic->begin();
    812   TComPic* pcPic = *(iterPic);
    813 
    814   if (pcPic->isField()) //Field Decoding
    815   {
    816     TComList<TComPic*>::iterator endPic   = pcListPic->end();
    817     endPic--;
    818     TComPic *pcPicTop, *pcPicBottom = NULL;
    819     while (iterPic != endPic)
    820     {
    821       pcPicTop = *(iterPic);
    822       iterPic++;
    823       pcPicBottom = *(iterPic);
    824 
    825       if ( pcPicTop->getOutputMark() && pcPicBottom->getOutputMark() && !(pcPicTop->getPOC()%2) && (pcPicBottom->getPOC() == pcPicTop->getPOC()+1) )
    826       {
    827         // write to file
    828 #if SVC_EXTENSION
    829         if ( m_pchReconFile[layerId] )
    830         {
    831           const Window &conf = pcPicTop->getConformanceWindow();
    832           const Window &defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window();
    833           const Bool isTff = pcPicTop->isTopField();
    834 #if REPN_FORMAT_IN_VPS
    835           UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc();
    836           Int xScal =  TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc );
    837           m_acTVideoIOYuvReconFile[layerId].write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
    838             conf.getWindowLeftOffset()  *xScal + defDisp.getWindowLeftOffset(),
    839             conf.getWindowRightOffset() *xScal + defDisp.getWindowRightOffset(),
    840             conf.getWindowTopOffset()   *yScal + defDisp.getWindowTopOffset(),
    841             conf.getWindowBottomOffset()*yScal + defDisp.getWindowBottomOffset(), isTff );
    842 
    843 #else
    844 #if O0194_DIFFERENT_BITDEPTH_EL_BL
    845           // Compile time bug-fix
    846           m_acTVideoIOYuvReconFile[layerId].write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
    847 #else
    848           m_cTVideoIOYuvReconFile[layerId].write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
    849 #endif
    850             conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    851             conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
    852             conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
    853             conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), isTff );
    854 #endif
    855         }
    856 
    857         // update POC of display order
    858         m_aiPOCLastDisplay[layerId] = pcPicBottom->getPOC();
    859 #else
    860         if ( m_pchReconFile )
    861         {
    862           const Window &conf = pcPicTop->getConformanceWindow();
    863           const Window &defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window();
    864           const Bool isTff = pcPicTop->isTopField();
    865           m_cTVideoIOYuvReconFile.write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
    866             conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    867             conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
    868             conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
    869             conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), isTff );
    870         }
    871 
    872         // update POC of display order
    873         m_iPOCLastDisplay = pcPicBottom->getPOC();
    874 #endif
    875 
    876         // erase non-referenced picture in the reference picture list after display
    877         if ( !pcPicTop->getSlice(0)->isReferenced() && pcPicTop->getReconMark() == true )
    878         {
    879 #if !DYN_REF_FREE
    880           pcPicTop->setReconMark(false);
    881 
    882           // mark it should be extended later
    883           pcPicTop->getPicYuvRec()->setBorderExtension( false );
    884 
    885 #else
    886           pcPicTop->destroy();
    887           pcListPic->erase( iterPic );
    888           iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!
    889           continue;
    890 #endif
    891         }
    892         if ( !pcPicBottom->getSlice(0)->isReferenced() && pcPicBottom->getReconMark() == true )
    893         {
    894 #if !DYN_REF_FREE
    895           pcPicBottom->setReconMark(false);
    896 
    897           // mark it should be extended later
    898           pcPicBottom->getPicYuvRec()->setBorderExtension( false );
    899 
    900 #else
    901           pcPicBottom->destroy();
    902           pcListPic->erase( iterPic );
    903           iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!
    904           continue;
    905 #endif
    906         }
    907         pcPicTop->setOutputMark(false);
    908         pcPicBottom->setOutputMark(false);
    909 
    910 #if !DYN_REF_FREE
    911         if(pcPicTop)
    912         {
    913           pcPicTop->destroy();
    914           delete pcPicTop;
    915           pcPicTop = NULL;
    916         }
    917 #endif
    918       }
    919     }
    920     if(pcPicBottom)
    921     {
    922       pcPicBottom->destroy();
    923       delete pcPicBottom;
    924       pcPicBottom = NULL;
    925     }
    926   }
    927   else //Frame decoding
    928   {
    929     while (iterPic != pcListPic->end())
    930     {
    931       pcPic = *(iterPic);
    932 
    933       if ( pcPic->getOutputMark() )
    934       {
    935         // write to file
    936 #if SVC_EXTENSION
    937         if ( m_pchReconFile[layerId] )
    938         {
    939           const Window &conf = pcPic->getConformanceWindow();
    940           const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
    941 #if REPN_FORMAT_IN_VPS
    942           UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc();
    943           Int xScal =  TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc );
    944           m_acTVideoIOYuvReconFile[layerId].write( pcPic->getPicYuvRec(),
     1059
     1060          m_acTVideoIOYuvReconFile[layerId].write( pPicCYuvRec,
    9451061            conf.getWindowLeftOffset()  *xScal + defDisp.getWindowLeftOffset(),
    9461062            conf.getWindowRightOffset() *xScal + defDisp.getWindowRightOffset(),
    9471063            conf.getWindowTopOffset()   *yScal + defDisp.getWindowTopOffset(),
    9481064            conf.getWindowBottomOffset()*yScal + defDisp.getWindowBottomOffset() );
    949 
    950 #else
    951           m_acTVideoIOYuvReconFile[layerId].write( pcPic->getPicYuvRec(),
    952             conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    953             conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
    954             conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
     1065#else
     1066          m_acTVideoIOYuvReconFile[layerId].write( pPicCYuvRec,
     1067            conf.getWindowLeftOffset()   + defDisp.getWindowLeftOffset(),
     1068            conf.getWindowRightOffset()  + defDisp.getWindowRightOffset(),
     1069            conf.getWindowTopOffset()    + defDisp.getWindowTopOffset(),
    9551070            conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() );
    9561071#endif
     
    9641079          const Window &conf = pcPic->getConformanceWindow();
    9651080          const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
    966           m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(),
     1081          TComPicYuv* pPicCYuvRec = pcPic->getPicYuvRec();
     1082#if Q0074_SEI_COLOR_MAPPING
     1083          if( m_cTDecTop.m_ColorMapping->getColorMappingFlag() )
     1084          {
     1085            pPicCYuvRec = m_cTDecTop.m_ColorMapping->getColorMapping( pPicCYuvRec );
     1086          }
     1087#endif
     1088          m_cTVideoIOYuvReconFile.write( pPicCYuvRec,
    9671089            conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    9681090            conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
     
    10451167    yScal = TComSPS::getWinUnitY( chromaFormatIdc );
    10461168#endif
    1047     m_acTVideoIOYuvReconFile[layerIdx].write( pic->getPicYuvRec(),
     1169    TComPicYuv* pPicCYuvRec = pic->getPicYuvRec();
     1170#if Q0074_SEI_COLOR_MAPPING
     1171    pPicCYuvRec = m_acTDecTop[layerIdx].m_ColorMapping->getColorMapping( pPicCYuvRec, 0, layerIdx );
     1172#endif
     1173    m_acTVideoIOYuvReconFile[layerIdx].write( pPicCYuvRec,
    10481174      conf.getWindowLeftOffset()  * xScal + defDisp.getWindowLeftOffset(),
    10491175      conf.getWindowRightOffset() * xScal + defDisp.getWindowRightOffset(),
  • trunk/source/App/TAppEncoder/TAppEncCfg.cpp

    r649 r713  
    339339  string* cfg_ReconFile      [MAX_LAYERS];
    340340  Double* cfg_fQP            [MAX_LAYERS];
     341#if Q0074_SEI_COLOR_MAPPING
     342  string* cfg_seiColorMappingFile[MAX_LAYERS];
     343#endif
    341344
    342345#if REPN_FORMAT_IN_VPS
     
    433436    cfg_IntraPeriod[layer]  = &m_acLayerCfg[layer].m_iIntraPeriod;
    434437    cfg_conformanceMode[layer] = &m_acLayerCfg[layer].m_conformanceMode;
     438#if Q0074_SEI_COLOR_MAPPING
     439    cfg_seiColorMappingFile[layer] = &m_acLayerCfg[layer].m_cSeiColorMappingFile;
     440#endif
    435441#if LAYER_CTB
    436442    // coding unit (CU) definition
     
    616622#endif
    617623  ("EnableElRapB,-use-rap-b",  m_elRapSliceBEnabled, 0, "Set ILP over base-layer I picture to B picture (default is P picture)")
     624#if Q0074_SEI_COLOR_MAPPING
     625  ("SEIColorMappingFile%d", cfg_seiColorMappingFile, string(""), MAX_LAYERS, "File Containing SEI Color Mapping data")
     626#endif
    618627#else //SVC_EXTENSION
    619628  ("InputFile,i",           cfg_InputFile,     string(""), "Original YUV input file name")
     
    710719  ("IntraPeriod,-ip",         m_iIntraPeriod,              -1, "Intra period in frames, (-1: only first frame)")
    711720#endif
     721#if ALLOW_RECOVERY_POINT_AS_RAP
     722  ("DecodingRefreshType,-dr", m_iDecodingRefreshType,       0, "Intra refresh type (0:none 1:CRA 2:IDR 3:RecPointSEI)")
     723#else
    712724  ("DecodingRefreshType,-dr", m_iDecodingRefreshType,       0, "Intra refresh type (0:none 1:CRA 2:IDR)")
     725#endif
    713726  ("GOPSize,g",               m_iGOPSize,                   1, "GOP size of temporal structure")
    714727  // motion options
     
    905918  ("SEIToneMapCameraIsoSpeedIdc",                     m_cameraIsoSpeedIdc,                        0, "Indicates the camera ISO speed for daylight illumination")
    906919  ("SEIToneMapCameraIsoSpeedValue",                   m_cameraIsoSpeedValue,                    400, "Specifies the camera ISO speed for daylight illumination of Extended_ISO")
     920  ("SEIToneMapExposureIndexIdc",                      m_exposureIndexIdc,                         0, "Indicates the exposure index setting of the camera")
     921  ("SEIToneMapExposureIndexValue",                    m_exposureIndexValue,                     400, "Specifies the exposure index setting of the cameran of Extended_ISO")
    907922  ("SEIToneMapExposureCompensationValueSignFlag",     m_exposureCompensationValueSignFlag,        0, "Specifies the sign of ExposureCompensationValue")
    908923  ("SEIToneMapExposureCompensationValueNumerator",    m_exposureCompensationValueNumerator,       0, "Specifies the numerator of ExposureCompensationValue")
     
    955970  ("CrossLayerBLAFlag",                m_crossLayerBLAFlag,                       false, "Specifies the value of cross_layer_bla_flag in VPS")
    956971#endif
     972#if Q0048_CGS_3D_ASYMLUT
     973  ("CGS",     m_nCGSFlag , 0, "whether CGS is enabled")
     974  ("CGSMaxOctantDepth", m_nCGSMaxOctantDepth , 1, "max octant depth")
     975  ("CGSMaxYPartNumLog",  m_nCGSMaxYPartNumLog2 , 2, "max Y part number ")
     976  ("CGSLUTBit",     m_nCGSLUTBit , 12, "bit depth of CGS LUT")
     977#endif
    957978  ;
    958979 
     
    12021223        if( i >= m_acLayerCfg[layer].m_numSamplePredRefLayers )
    12031224        {
    1204           printf( "NumSamplePredRefLayers: The number of columns whose width are defined is larger than the allowed number of columns.\n" );
     1225          printf( "NumSamplePredRefLayers%d: The number of columns whose width are defined is larger than the allowed number of columns.\n", layer );
    12051226          exit( EXIT_FAILURE );
    12061227        }
     
    12111232      if( i < m_acLayerCfg[layer].m_numSamplePredRefLayers )
    12121233      {
    1213         printf( "NumSamplePredRefLayers: The width of some columns is not defined.\n" );
     1234        printf( "NumSamplePredRefLayers%d: The width of some columns is not defined.\n", layer );
    12141235        exit( EXIT_FAILURE );
    12151236      }
     
    12331254        if( i >= m_acLayerCfg[layer].m_numMotionPredRefLayers )
    12341255        {
    1235           printf( "NumMotionPredRefLayers: The number of columns whose width are defined is larger than the allowed number of columns.\n" );
     1256          printf( "NumMotionPredRefLayers%d: The number of columns whose width are defined is larger than the allowed number of columns.\n", layer );
    12361257          exit( EXIT_FAILURE );
    12371258        }
     
    12421263      if( i < m_acLayerCfg[layer].m_numMotionPredRefLayers )
    12431264      {
    1244         printf( "NumMotionPredRefLayers: The width of some columns is not defined.\n" );
     1265        printf( "NumMotionPredRefLayers%d: The width of some columns is not defined.\n", layer );
    12451266        exit( EXIT_FAILURE );
    12461267      }
     
    12721293        if( i >= m_acLayerCfg[layer].m_numActiveRefLayers )
    12731294        {
    1274           printf( "NumActiveRefLayers: The number of columns whose width are defined is larger than the allowed number of columns.\n" );
     1295          printf( "NumActiveRefLayers%d: The number of columns whose width are defined is larger than the allowed number of columns.\n", layer );
    12751296          exit( EXIT_FAILURE );
    12761297        }
     
    12811302      if( i < m_acLayerCfg[layer].m_numActiveRefLayers )
    12821303      {
    1283         printf( "NumActiveRefLayers: The width of some columns is not defined.\n" );
     1304        printf( "NumActiveRefLayers%d: The width of some columns is not defined.\n", layer );
    12841305        exit( EXIT_FAILURE );
    12851306      }
     
    14741495    }
    14751496  }
     1497
    14761498#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
    14771499  if (m_interLayerConstrainedTileSetsSEIEnabled)
     
    15871609  xConfirmPara( (m_iIntraPeriod > 0 && m_iIntraPeriod < m_iGOPSize) || m_iIntraPeriod == 0, "Intra period must be more than GOP size, or -1 , not 0" );
    15881610#endif
     1611#if ALLOW_RECOVERY_POINT_AS_RAP
     1612  xConfirmPara( m_iDecodingRefreshType < 0 || m_iDecodingRefreshType > 3,                   "Decoding Refresh Type must be comprised between 0 and 3 included" );
     1613  if(m_iDecodingRefreshType == 3)
     1614  {
     1615    xConfirmPara( !m_recoveryPointSEIEnabled,                                               "When using RecoveryPointSEI messages as RA points, recoveryPointSEI must be enabled" );
     1616  }
     1617#else
    15891618  xConfirmPara( m_iDecodingRefreshType < 0 || m_iDecodingRefreshType > 2,                   "Decoding Refresh Type must be equal to 0, 1 or 2" );
     1619#endif
    15901620#if !SVC_EXTENSION
    15911621  xConfirmPara( m_iQP <  -6 * (m_internalBitDepthY - 8) || m_iQP > 51,                    "QP exceeds supported range (-QpBDOffsety to 51)" );
     
    21602190    xConfirmPara( m_toneMapModelId < 0 || m_toneMapModelId > 4 , "SEIToneMapModelId must be in rage 0 to 4");
    21612191    xConfirmPara( m_cameraIsoSpeedValue == 0, "SEIToneMapCameraIsoSpeedValue shall not be equal to 0");
     2192    xConfirmPara( m_exposureIndexValue  == 0, "SEIToneMapExposureIndexValue shall not be equal to 0");
    21622193    xConfirmPara( m_extendedRangeWhiteLevel < 100, "SEIToneMapExtendedRangeWhiteLevel should be greater than or equal to 100");
    21632194    xConfirmPara( m_nominalBlackLevelLumaCodeValue >= m_nominalWhiteLevelLumaCodeValue, "SEIToneMapNominalWhiteLevelLumaCodeValue shall be greater than SEIToneMapNominalBlackLevelLumaCodeValue");
     
    22862317  }
    22872318#endif
     2319#if Q0048_CGS_3D_ASYMLUT
     2320  xConfirmPara( m_nCGSFlag < 0 || m_nCGSFlag > 1 , "0<=CGS<=1" );
     2321#endif
    22882322#undef xConfirmPara
    22892323  if (check_failed)
     
    25452579  printf("RecalQP:%d", m_recalculateQPAccordingToLambda ? 1 : 0 );
    25462580#endif
     2581#if Q0048_CGS_3D_ASYMLUT
     2582  printf("CGS: %d CGSMaxOctantDepth: %d CGSMaxYPartNumLog2: %d CGSLUTBit:%d " , m_nCGSFlag , m_nCGSMaxOctantDepth , m_nCGSMaxYPartNumLog2 , m_nCGSLUTBit );
     2583#endif
    25472584  printf("\n\n");
    25482585 
  • trunk/source/App/TAppEncoder/TAppEncCfg.h

    r644 r713  
    255255  Int       m_cameraIsoSpeedIdc;
    256256  Int       m_cameraIsoSpeedValue;
     257  Int       m_exposureIndexIdc;
     258  Int       m_exposureIndexValue;
    257259  Int       m_exposureCompensationValueSignFlag;
    258260  Int       m_exposureCompensationValueNumerator;
     
    266268  Int*      m_codedPivotValue;
    267269  Int*      m_targetPivotValue;
     270#if Q0074_SEI_COLOR_MAPPING
     271  Char*     m_pchSEIColorMappingFile;             ///< SEI Color Mapping File (initialized from external file)
     272#endif
    268273  Int       m_framePackingSEIEnabled;
    269274  Int       m_framePackingSEIType;
     
    393398  Bool      m_useInterLayerWeightedPred;
    394399#endif
     400#if Q0048_CGS_3D_ASYMLUT
     401  Int  m_nCGSFlag;
     402  Int  m_nCGSMaxOctantDepth;
     403  Int  m_nCGSMaxYPartNumLog2;
     404  Int  m_nCGSLUTBit;
     405#endif
    395406public:
    396407  TAppEncCfg();
  • trunk/source/App/TAppEncoder/TAppEncLayerCfg.cpp

    r644 r713  
    171171  }
    172172#endif
     173#if REPN_FORMAT_IN_VPS
     174  printf("Real     Format               : %dx%d %dHz\n", m_iSourceWidth - ( m_confLeft + m_confRight ) * TComSPS::getWinUnitX( m_chromaFormatIDC ), m_iSourceHeight - ( m_confTop + m_confBottom ) * TComSPS::getWinUnitY( m_chromaFormatIDC ), m_iFrameRate );
     175#else
    173176  printf("Real     Format               : %dx%d %dHz\n", m_iSourceWidth - m_confLeft - m_confRight, m_iSourceHeight - m_confTop - m_confBottom, m_iFrameRate );
     177#endif
    174178  printf("Internal Format               : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate );
    175179#if O0194_DIFFERENT_BITDEPTH_EL_BL
     
    229233        m_aiPad[0] = m_confRight  = ((m_iSourceWidth / minCuSize) + 1) * minCuSize - m_iSourceWidth;
    230234        m_iSourceWidth  += m_confRight;
     235#if REPN_FORMAT_IN_VPS
     236        m_confRight /= TComSPS::getWinUnitX( m_chromaFormatIDC );
     237#endif
    231238      }
    232239      if (m_iSourceHeight % minCuSize)
     
    239246          m_aiPad[1] = m_confBottom << 1;
    240247        }
     248#if REPN_FORMAT_IN_VPS
     249        m_confBottom /= TComSPS::getWinUnitY( m_chromaFormatIDC );
     250#endif
    241251      }
    242252      break;
     
    249259      m_confRight  = m_aiPad[0];
    250260      m_confBottom = m_aiPad[1];
     261#if REPN_FORMAT_IN_VPS
     262      m_confRight /= TComSPS::getWinUnitX( m_chromaFormatIDC );
     263      m_confBottom /= TComSPS::getWinUnitY( m_chromaFormatIDC );
     264#endif
    251265      break;
    252266    }
     
    331345  xConfirmPara( m_aiPad[1] % TComSPS::getWinUnitY(CHROMA_420) != 0, "Vertical padding must be an integer multiple of the specified chroma subsampling");
    332346
     347#if !REPN_FORMAT_IN_VPS
    333348  xConfirmPara( m_confLeft   % TComSPS::getWinUnitX(CHROMA_420) != 0, "Left conformance window offset must be an integer multiple of the specified chroma subsampling");
    334349  xConfirmPara( m_confRight  % TComSPS::getWinUnitX(CHROMA_420) != 0, "Right conformance window offset must be an integer multiple of the specified chroma subsampling");
    335350  xConfirmPara( m_confTop    % TComSPS::getWinUnitY(CHROMA_420) != 0, "Top conformance window offset must be an integer multiple of the specified chroma subsampling");
    336351  xConfirmPara( m_confBottom % TComSPS::getWinUnitY(CHROMA_420) != 0, "Bottom conformance window offset must be an integer multiple of the specified chroma subsampling");
     352#endif
    337353
    338354#if LAYER_CTB 
  • trunk/source/App/TAppEncoder/TAppEncLayerCfg.h

    r644 r713  
    5454  Int       *m_predLayerIds;
    5555  Int       m_numActiveRefLayers;
     56#endif
     57#if Q0074_SEI_COLOR_MAPPING
     58  string    m_cSeiColorMappingFile;
    5659#endif
    5760
  • trunk/source/App/TAppEncoder/TAppEncTop.cpp

    r649 r713  
    9191  }
    9292
    93 #if REPN_FORMAT_IN_VPS
    94   vps->setRepFormatIdxPresentFlag( true );   // Could be disabled to optimize in some cases.
     93#if REPN_FORMAT_IN_VPS 
    9594  Int maxRepFormatIdx = -1;
    9695  Int formatIdx = -1;
     
    125124
    126125    assert( m_acLayerCfg[layer].getRepFormatIdx() != -1 && "RepFormatIdx not assigned for a layer" );
     126
    127127    vps->setVpsRepFormatIdx( layer, m_acLayerCfg[layer].getRepFormatIdx() );
     128
    128129    maxRepFormatIdx = std::max( m_acLayerCfg[layer].getRepFormatIdx(), maxRepFormatIdx );
    129130  }
     131
    130132  assert( vps->getVpsRepFormatIdx( 0 ) == 0 );  // Base layer should point to the first one.
     133
    131134  Int* mapIdxToLayer = new Int[maxRepFormatIdx + 1];
     135
    132136  // Check that all the indices from 0 to maxRepFormatIdx are used in the VPS
    133137  for(Int i = 0; i <= maxRepFormatIdx; i++)
     
    145149    assert( layer != m_numLayers );   // One of the VPS Rep format indices not set
    146150  }
     151
    147152  vps->setVpsNumRepFormats( maxRepFormatIdx + 1 );
     153
     154#if Q0195_REP_FORMAT_CLEANUP
     155  // When not present, the value of rep_format_idx_present_flag is inferred to be equal to 0
     156  vps->setRepFormatIdxPresentFlag( vps->getVpsNumRepFormats() > 1 ? true : false );
     157#else
     158  vps->setRepFormatIdxPresentFlag( true );
     159#endif
     160
    148161  for(UInt idx=0; idx < vps->getVpsNumRepFormats(); idx++)
    149162  {
     
    467480    m_acTEncTop[layer].setTMISEINominalWhiteLevelLumaCodeValue      ( m_nominalWhiteLevelLumaCodeValue );
    468481    m_acTEncTop[layer].setTMISEIExtendedWhiteLevelLumaCodeValue     ( m_extendedWhiteLevelLumaCodeValue );
     482#if Q0074_SEI_COLOR_MAPPING
     483    m_acTEncTop[layer].setColorMappingInfoSEIFile                   ( m_acLayerCfg[layer].m_cSeiColorMappingFile.empty() ? NULL : const_cast<Char *>(m_acLayerCfg[layer].m_cSeiColorMappingFile.c_str()) );
     484#endif
    469485    m_acTEncTop[layer].setFramePackingArrangementSEIEnabled( m_framePackingSEIEnabled );
    470486    m_acTEncTop[layer].setFramePackingArrangementSEIType( m_framePackingSEIType );
     
    592608    m_acTEncTop[layer].setCrossLayerBLAFlag( m_crossLayerBLAFlag );
    593609#endif
     610#if Q0048_CGS_3D_ASYMLUT
     611    m_acTEncTop[layer].setCGSFlag( layer == 0 ? 0 : m_nCGSFlag );
     612    m_acTEncTop[layer].setCGSMaxOctantDepth( m_nCGSMaxOctantDepth );
     613    m_acTEncTop[layer].setCGSMaxYPartNumLog2( m_nCGSMaxYPartNumLog2 );
     614    m_acTEncTop[layer].setCGSLUTBit( m_nCGSLUTBit );
     615#endif
    594616  }
    595617}
     
    767789  m_cTEncTop.setTMISEICameraIsoSpeedIdc                   ( m_cameraIsoSpeedIdc );
    768790  m_cTEncTop.setTMISEICameraIsoSpeedValue                 ( m_cameraIsoSpeedValue );
     791  m_cTEncTop.setTMISEIExposureIndexIdc                    ( m_exposureIndexIdc );
     792  m_cTEncTop.setTMISEIExposureIndexValue                  ( m_exposureIndexValue );
    769793  m_cTEncTop.setTMISEIExposureCompensationValueSignFlag   ( m_exposureCompensationValueSignFlag );
    770794  m_cTEncTop.setTMISEIExposureCompensationValueNumerator  ( m_exposureCompensationValueNumerator );
     
    775799  m_cTEncTop.setTMISEINominalWhiteLevelLumaCodeValue      ( m_nominalWhiteLevelLumaCodeValue );
    776800  m_cTEncTop.setTMISEIExtendedWhiteLevelLumaCodeValue     ( m_extendedWhiteLevelLumaCodeValue );
     801#if Q0074_SEI_COLOR_MAPPING
     802  m_cTEncTop.setColorMappingInfoSEIFile                   ( m_pchSEIColorMappingFile );
     803#endif
    777804  m_cTEncTop.setFramePackingArrangementSEIEnabled( m_framePackingSEIEnabled );
    778805  m_cTEncTop.setFramePackingArrangementSEIType( m_framePackingSEIType );
     
    9741001  vps->setMaxLayerId(m_numLayers - 1);    // Set max-layer ID
    9751002
     1003  vps->setVpsExtensionFlag( m_numLayers > 1 ? true : false );
     1004
    9761005  vps->setNumLayerSets(m_numLayers);
    9771006  for(Int setId = 1; setId < vps->getNumLayerSets(); setId++)
     
    10681097#if VPS_TSLAYERS
    10691098    vps->setMaxTSLayersPresentFlag(true);
    1070     for( i = 0; i < MAX_VPS_LAYER_ID_PLUS1 - 1; i++ )
    1071     {
    1072         vps->setMaxTSLayersMinus1(i, vps->getMaxTLayers()-1);
     1099    for( i = 0; i < vps->getMaxLayers(); i++ )
     1100    {
     1101      vps->setMaxTSLayersMinus1(i, vps->getMaxTLayers()-1);
    10731102    }
    10741103#endif
     
    10811110  if (vps->getMaxTidRefPresentFlag())
    10821111  {
    1083     for( i = 0; i < MAX_VPS_LAYER_ID_PLUS1 - 1; i++ )
     1112    for( i = 0; i < vps->getMaxLayers() - 1; i++ )
    10841113    {
    10851114#if N0120_MAX_TID_REF_CFG
    10861115#if O0225_MAX_TID_FOR_REF_LAYERS
    1087       for( Int j = i+1; j <= MAX_VPS_LAYER_ID_PLUS1 - 1; j++)
     1116      for( Int j = i+1; j < vps->getMaxLayers(); j++)
    10881117      {
    10891118        vps->setMaxTidIlRefPicsPlus1(i, j, m_acTEncTop[i].getMaxTidIlRefPicsPlus1());
     
    10941123#else
    10951124#if O0225_MAX_TID_FOR_REF_LAYERS
    1096       for( Int j = i+1; j <= MAX_VPS_LAYER_ID_PLUS1 - 1; j++)
     1125      for( Int j = i+1; j < vps->getMaxLayers(); j++)
    10971126      {
    10981127        vps->setMaxTidIlRefPicsPlus1(i, j, vps->getMaxTLayers()+1);
     
    11061135  else
    11071136  {
    1108     for( i = 0; i < MAX_VPS_LAYER_ID_PLUS1 - 1; i++ )
     1137    for( i = 0; i < vps->getMaxLayers() - 1; i++ )
    11091138    {
    11101139#if O0225_MAX_TID_FOR_REF_LAYERS
    1111       for( Int j = i+1; j <= MAX_VPS_LAYER_ID_PLUS1 - 1; j++)
     1140      for( Int j = i+1; j < vps->getMaxLayers(); j++)
    11121141      {
    11131142        vps->setMaxTidIlRefPicsPlus1(i, j, 7);
     
    12971326  if(vps->getMaxLayers() > MAX_REF_LAYERS)
    12981327  {
    1299     for(UInt layerCtr = 1;layerCtr <= vps->getMaxLayers() - 1; layerCtr++)
     1328    for(UInt layerCtr = 1; layerCtr <= vps->getMaxLayers() - 1; layerCtr++)
    13001329    {
    13011330      assert( vps->getNumRefLayers(vps->getLayerIdInNuh(layerCtr)) <= MAX_REF_LAYERS);
     
    14001429      Int iPicWidth         = pcCfgLayer->getSourceWidth();
    14011430      Int iPicHeight        = pcCfgLayer->getSourceHeight();
     1431#if LAYER_CTB
     1432      UInt uiWidthInCU       = ( iPicWidth  % m_acLayerCfg[layerId].m_uiMaxCUWidth  ) ? iPicWidth  / m_acLayerCfg[layerId].m_uiMaxCUWidth  + 1 : iPicWidth  / m_acLayerCfg[layerId].m_uiMaxCUWidth;
     1433      UInt uiHeightInCU      = ( iPicHeight % m_acLayerCfg[layerId].m_uiMaxCUHeight ) ? iPicHeight / m_acLayerCfg[layerId].m_uiMaxCUHeight + 1 : iPicHeight / m_acLayerCfg[layerId].m_uiMaxCUHeight;
     1434#else
    14021435      UInt uiWidthInCU       = ( iPicWidth %m_uiMaxCUWidth  ) ? iPicWidth /m_uiMaxCUWidth  + 1 : iPicWidth /m_uiMaxCUWidth;
    14031436      UInt uiHeightInCU      = ( iPicHeight%m_uiMaxCUHeight ) ? iPicHeight/m_uiMaxCUHeight + 1 : iPicHeight/m_uiMaxCUHeight;
     1437#endif
    14041438      UInt uiNumCUsInFrame   = uiWidthInCU * uiHeightInCU;
    14051439
     1440#if LAYER_CTB
     1441      UInt maxCU = pcCfgLayer->getSliceArgument() >> ( m_acLayerCfg[layerId].m_uiMaxCUDepth << 1);
     1442#else
    14061443      UInt maxCU = pcCfgLayer->getSliceArgument() >> ( m_uiMaxCUDepth << 1);
     1444#endif
    14071445      UInt numDU = ( pcCfgLayer->getSliceMode() == 1 ) ? ( uiNumCUsInFrame / maxCU ) : ( 0 );
    14081446      if( uiNumCUsInFrame % maxCU != 0 || numDU == 0 )
Note: See TracChangeset for help on using the changeset viewer.