Commit 8e8356c5 authored by Hendry's avatar Hendry

JVET-S0078: Handling of NoOutputOfPriorPicsFlag for output process

parent 2abcb6a6
Pipeline #5518 passed with stage
in 11 minutes and 48 seconds
......@@ -133,6 +133,9 @@ uint32_t DecApp::decode()
#if JVET_S0155_EOS_NALU_CHECK
bool isEosPresentInPu = false;
#endif
#if JVET_S0078_NOOUTPUTPRIORPICFLAG
bool firstSliceInAU = true;
#endif
while (!!bitstreamFile)
{
......@@ -170,7 +173,9 @@ uint32_t DecApp::decode()
#if JVET_R0270
m_newCLVS[nalu.m_nuhLayerId] = true; // An IDR picture starts a new CLVS
#endif
#if !JVET_S0078_NOOUTPUTPRIORPICFLAG
xFlushOutput(pcListPic, nalu.m_nuhLayerId);
#endif
}
#if JVET_R0270
if (m_cDecLib.getFirstSliceInPicture() && nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA && isEosPresentInPu)
......@@ -299,7 +304,7 @@ uint32_t DecApp::decode()
m_cVideoIOYuvReconFile[nalu.m_nuhLayerId].open( reconFileName, true, m_outputBitDepth, m_outputBitDepth, bitDepths.recon ); // write mode
}
}
// write reconstruction to file
// write reconstruction to file -- for additional bumping as defined in C.5.2.3
if( bNewPicture )
{
xWriteOutput( pcListPic, nalu.m_temporalId );
......@@ -309,13 +314,51 @@ uint32_t DecApp::decode()
xWriteOutput( pcListPic, nalu.m_temporalId );
m_cDecLib.setFirstSliceInPicture (false);
}
// write reconstruction to file -- for additional bumping as defined in C.5.2.3
// write reconstruction to file -- for bumping process
if (!bNewPicture && ((nalu.m_nalUnitType >= NAL_UNIT_CODED_SLICE_TRAIL && nalu.m_nalUnitType <= NAL_UNIT_RESERVED_IRAP_VCL_12)
|| (nalu.m_nalUnitType >= NAL_UNIT_CODED_SLICE_IDR_W_RADL && nalu.m_nalUnitType <= NAL_UNIT_CODED_SLICE_GDR)))
{
#if JVET_S0078_NOOUTPUTPRIORPICFLAG
bool firstPicInCVSAUThatIsNotAU0 = false;
if( firstSliceInAU )
{
if( m_targetDecLayerIdSet.size() > 0 )
{
if( m_cDecLib.getAudIrapOrGdrAuFlag() )
{
firstPicInCVSAUThatIsNotAU0 = true;
}
}
else
{
if( nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL ||
nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP ||
(nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA && isEosPresentInPu) )
{
firstPicInCVSAUThatIsNotAU0 = true;
}
}
}
if( firstPicInCVSAUThatIsNotAU0 )
{
xFlushOutput(pcListPic, NOT_VALID, m_cDecLib.getNoOutputPriorPicsFlag());
}
else
{
xWriteOutput(pcListPic, nalu.m_temporalId);
}
#else
xWriteOutput( pcListPic, nalu.m_temporalId );
#endif
}
}
#if JVET_S0078_NOOUTPUTPRIORPICFLAG
if( (nalu.m_nalUnitType >= NAL_UNIT_CODED_SLICE_TRAIL && nalu.m_nalUnitType <= NAL_UNIT_RESERVED_IRAP_VCL_12) ||
(nalu.m_nalUnitType >= NAL_UNIT_CODED_SLICE_IDR_W_RADL && nalu.m_nalUnitType <= NAL_UNIT_CODED_SLICE_GDR))
{
firstSliceInAU = false;
}
#endif
if( bNewPicture )
{
m_cDecLib.checkSeiInPictureUnit();
......@@ -347,6 +390,9 @@ uint32_t DecApp::decode()
m_cDecLib.resetAccessUnitNals();
m_cDecLib.resetAccessUnitApsNals();
m_cDecLib.resetAccessUnitPicInfo();
#if JVET_S0078_NOOUTPUTPRIORPICFLAG
firstSliceInAU = true;
#endif
}
}
......@@ -616,7 +662,11 @@ void DecApp::xWriteOutput( PicList* pcListPic, uint32_t tId )
/** \param pcListPic list of pictures to be written to file
*/
void DecApp::xFlushOutput( PicList* pcListPic, const int layerId )
#if JVET_S0078_NOOUTPUTPRIORPICFLAG
void DecApp::xFlushOutput(PicList *pcListPic, const int layerId, bool noOutputOfPriorPicsFlag)
#else
void DecApp::xFlushOutput(PicList *pcListPic, const int layerId)
#endif
{
if(!pcListPic || pcListPic->empty())
{
......@@ -645,23 +695,30 @@ void DecApp::xFlushOutput( PicList* pcListPic, const int layerId )
if ( pcPicTop->neededForOutput && pcPicBottom->neededForOutput && !(pcPicTop->getPOC()%2) && (pcPicBottom->getPOC() == pcPicTop->getPOC()+1) )
{
// write to file
if ( !m_reconFileName.empty() )
#if JVET_S0078_NOOUTPUTPRIORPICFLAG
if (!noOutputOfPriorPicsFlag)
{
const Window &conf = pcPicTop->cs->pps->getConformanceWindow();
const bool isTff = pcPicTop->topField;
#endif
// write to file
if ( !m_reconFileName.empty() )
{
const Window &conf = pcPicTop->cs->pps->getConformanceWindow();
const bool isTff = pcPicTop->topField;
m_cVideoIOYuvReconFile[pcPicTop->layerId].write( pcPicTop->getRecoBuf(), pcPicBottom->getRecoBuf(),
m_outputColourSpaceConvert,
false, // TODO: m_packedYUVMode,
conf.getWindowLeftOffset() * SPS::getWinUnitX( pcPicTop->cs->sps->getChromaFormatIdc() ),
conf.getWindowRightOffset() * SPS::getWinUnitX( pcPicTop->cs->sps->getChromaFormatIdc() ),
conf.getWindowTopOffset() * SPS::getWinUnitY( pcPicTop->cs->sps->getChromaFormatIdc() ),
conf.getWindowBottomOffset() * SPS::getWinUnitY( pcPicTop->cs->sps->getChromaFormatIdc() ),
NUM_CHROMA_FORMAT, isTff );
m_cVideoIOYuvReconFile[pcPicTop->layerId].write( pcPicTop->getRecoBuf(), pcPicBottom->getRecoBuf(),
m_outputColourSpaceConvert,
false, // TODO: m_packedYUVMode,
conf.getWindowLeftOffset() * SPS::getWinUnitX( pcPicTop->cs->sps->getChromaFormatIdc() ),
conf.getWindowRightOffset() * SPS::getWinUnitX( pcPicTop->cs->sps->getChromaFormatIdc() ),
conf.getWindowTopOffset() * SPS::getWinUnitY( pcPicTop->cs->sps->getChromaFormatIdc() ),
conf.getWindowBottomOffset() * SPS::getWinUnitY( pcPicTop->cs->sps->getChromaFormatIdc() ),
NUM_CHROMA_FORMAT, isTff );
}
writeLineToOutputLog(pcPicTop);
writeLineToOutputLog(pcPicBottom);
#if JVET_S0078_NOOUTPUTPRIORPICFLAG
}
writeLineToOutputLog(pcPicTop);
writeLineToOutputLog(pcPicBottom);
#endif
// update POC of display order
m_iPOCLastDisplay = pcPicBottom->getPOC();
......@@ -706,30 +763,36 @@ void DecApp::xFlushOutput( PicList* pcListPic, const int layerId )
if (pcPic->neededForOutput)
{
// write to file
if (!m_reconFileName.empty())
#if JVET_S0078_NOOUTPUTPRIORPICFLAG
if (!noOutputOfPriorPicsFlag)
{
const Window &conf = pcPic->getConformanceWindow();
const SPS* sps = pcPic->cs->sps;
ChromaFormat chromaFormatIDC = sps->getChromaFormatIdc();
if( m_upscaledOutput )
{
m_cVideoIOYuvReconFile[pcPic->layerId].writeUpscaledPicture( *sps, *pcPic->cs->pps, pcPic->getRecoBuf(), m_outputColourSpaceConvert, m_packedYUVMode, m_upscaledOutput, NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range );
}
else
#endif
// write to file
if (!m_reconFileName.empty())
{
m_cVideoIOYuvReconFile[pcPic->layerId].write( pcPic->getRecoBuf().get( COMPONENT_Y ).width, pcPic->getRecoBuf().get( COMPONENT_Y ).height, pcPic->getRecoBuf(),
m_outputColourSpaceConvert,
m_packedYUVMode,
conf.getWindowLeftOffset() * SPS::getWinUnitX( chromaFormatIDC ),
conf.getWindowRightOffset() * SPS::getWinUnitX( chromaFormatIDC ),
conf.getWindowTopOffset() * SPS::getWinUnitY( chromaFormatIDC ),
conf.getWindowBottomOffset() * SPS::getWinUnitY( chromaFormatIDC ),
NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range );
const Window &conf = pcPic->getConformanceWindow();
const SPS* sps = pcPic->cs->sps;
ChromaFormat chromaFormatIDC = sps->getChromaFormatIdc();
if( m_upscaledOutput )
{
m_cVideoIOYuvReconFile[pcPic->layerId].writeUpscaledPicture( *sps, *pcPic->cs->pps, pcPic->getRecoBuf(), m_outputColourSpaceConvert, m_packedYUVMode, m_upscaledOutput, NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range );
}
else
{
m_cVideoIOYuvReconFile[pcPic->layerId].write( pcPic->getRecoBuf().get( COMPONENT_Y ).width, pcPic->getRecoBuf().get( COMPONENT_Y ).height, pcPic->getRecoBuf(),
m_outputColourSpaceConvert,
m_packedYUVMode,
conf.getWindowLeftOffset() * SPS::getWinUnitX( chromaFormatIDC ),
conf.getWindowRightOffset() * SPS::getWinUnitX( chromaFormatIDC ),
conf.getWindowTopOffset() * SPS::getWinUnitY( chromaFormatIDC ),
conf.getWindowBottomOffset() * SPS::getWinUnitY( chromaFormatIDC ),
NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range );
}
}
writeLineToOutputLog(pcPic);
#if JVET_S0078_NOOUTPUTPRIORPICFLAG
}
writeLineToOutputLog(pcPic);
#endif
// update POC of display order
m_iPOCLastDisplay = pcPic->getPOC();
......
......@@ -87,7 +87,11 @@ private:
void xCreateDecLib (); ///< create internal classes
void xDestroyDecLib (); ///< destroy internal classes
void xWriteOutput ( PicList* pcListPic , uint32_t tId); ///< write YUV to file
#if JVET_S0078_NOOUTPUTPRIORPICFLAG
void xFlushOutput( PicList* pcListPic, const int layerId = NOT_VALID, bool noOutputOfPriorPicsFlag = false ); ///< flush all remaining decoded pictures to file
#else
void xFlushOutput( PicList* pcListPic, const int layerId = NOT_VALID ); ///< flush all remaining decoded pictures to file
#endif
bool isNewPicture(ifstream *bitstreamFile, class InputByteStream *bytestream); ///< check if next NAL unit will be the first NAL unit from a new picture
bool isNewAccessUnit(bool newPicture, ifstream *bitstreamFile, class InputByteStream *bytestream); ///< check if next NAL unit will be the first NAL unit from a new access unit
......
......@@ -52,6 +52,8 @@
//########### place macros to be removed in next cycle below this line ###############
#define JVET_S0078_NOOUTPUTPRIORPICFLAG 1 // JVET-S0078: Handling of NoOutputOfPriorPicsFlag in output process
#define JVET_S0193_NO_OUTPUT_PRIOR_PIC 1 // JVET-S0193: Move ph_no_output_of_prior_pics_flag to SH
#define JVET_S0219_ASPECT2_CHANGE_ORDER_APS_PARAMS_TYPE 1 // JVET-S0219 aspect2: change the order to put the aps_params_type before the aps_adaptation_parameter_set_id.
......
......@@ -231,6 +231,9 @@ public:
void updatePrevGDRInSameLayer();
void updatePrevIRAPAndGDRSubpic();
#if JVET_S0078_NOOUTPUTPRIORPICFLAG
bool getAudIrapOrGdrAuFlag() const { return m_audIrapOrGdrAuFlag; }
#endif
bool getNoOutputPriorPicsFlag () const { return m_isNoOutputPriorPics; }
void setNoOutputPriorPicsFlag (bool val) { m_isNoOutputPriorPics = val; }
void setFirstSliceInPicture (bool val) { m_bFirstSliceInPicture = val; }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment