Newer
Older

Karsten Suehring
committed
endPic--;
Picture *pcPicTop, *pcPicBottom = NULL;
while (iterPic != endPic)
{
pcPicTop = *(iterPic);
iterPic++;
pcPicBottom = *(iterPic);
if( pcPicTop->layerId != layerId && layerId != NOT_VALID )
{
continue;
}

Karsten Suehring
committed
if ( pcPicTop->neededForOutput && pcPicBottom->neededForOutput && !(pcPicTop->getPOC()%2) && (pcPicBottom->getPOC() == pcPicTop->getPOC()+1) )
{
// 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 );

Karsten Suehring
committed
}
Alexey Filippov
committed
#if JVET_P2008_OUTPUT_LOG
writeLineToOutputLog(pcPicTop);
writeLineToOutputLog(pcPicBottom);
#endif

Karsten Suehring
committed
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
// update POC of display order
m_iPOCLastDisplay = pcPicBottom->getPOC();
// erase non-referenced picture in the reference picture list after display
if( ! pcPicTop->referenced && pcPicTop->reconstructed )
{
pcPicTop->reconstructed = false;
}
if( ! pcPicBottom->referenced && pcPicBottom->reconstructed )
{
pcPicBottom->reconstructed = false;
}
pcPicTop->neededForOutput = false;
pcPicBottom->neededForOutput = false;
if(pcPicTop)
{
pcPicTop->destroy();
delete pcPicTop;
pcPicTop = NULL;
}
}
}
if(pcPicBottom)
{
pcPicBottom->destroy();
delete pcPicBottom;
pcPicBottom = NULL;
}
}
else //Frame decoding
{
while (iterPic != pcListPic->end())
{
pcPic = *(iterPic);
if( pcPic->layerId != layerId && layerId != NOT_VALID )
{
iterPic++;
continue;
}

Karsten Suehring
committed
if (pcPic->neededForOutput)
{
// write to file
if (!m_reconFileName.empty())
{
const Window &conf = pcPic->getConformanceWindow();
const SPS* sps = pcPic->cs->sps;
ChromaFormat chromaFormatIDC = sps->getChromaFormatIdc();
m_cVideoIOYuvReconFile[pcPic->layerId].writeUpscaledPicture( *sps, *pcPic->cs->pps, pcPic->getRecoBuf(), m_outputColourSpaceConvert, m_packedYUVMode, m_upscaledOutput, NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range );
{
m_cVideoIOYuvReconFile[pcPic->layerId].write( pcPic->getRecoBuf().get( COMPONENT_Y ).width, pcPic->getRecoBuf().get( COMPONENT_Y ).height, pcPic->getRecoBuf(),

Karsten Suehring
committed
m_outputColourSpaceConvert,
m_packedYUVMode,
conf.getWindowLeftOffset() * SPS::getWinUnitX( chromaFormatIDC ),
conf.getWindowRightOffset() * SPS::getWinUnitX( chromaFormatIDC ),
conf.getWindowTopOffset() * SPS::getWinUnitY( chromaFormatIDC ),
conf.getWindowBottomOffset() * SPS::getWinUnitY( chromaFormatIDC ),

Karsten Suehring
committed
NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range );

Karsten Suehring
committed
}
Alexey Filippov
committed
#if JVET_P2008_OUTPUT_LOG
writeLineToOutputLog(pcPic);
#endif

Karsten Suehring
committed
// update POC of display order
m_iPOCLastDisplay = pcPic->getPOC();
// erase non-referenced picture in the reference picture list after display
if (!pcPic->referenced && pcPic->reconstructed)
{
pcPic->reconstructed = false;
}
pcPic->neededForOutput = false;
}
if(pcPic != NULL)
{
pcPic->destroy();
delete pcPic;
pcPic = NULL;
*iterPic = nullptr;

Karsten Suehring
committed
}
iterPic++;
}
}
pcListPic->remove_if([](Picture* p) { return p == nullptr; });

Karsten Suehring
committed
pcListPic->clear();
m_iPOCLastDisplay = -MAX_INT;
}
/** \param nalu Input nalu to check whether its LayerId is within targetDecLayerIdSet
*/
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
#if JVET_Q0814_DPB
bool DecApp::xIsNaluWithinTargetDecLayerIdSet( const InputNALUnit* nalu ) const
{
if( !m_targetDecLayerIdSet.size() ) // By default, the set is empty, meaning all LayerIds are allowed
{
return true;
}
return std::find( m_targetDecLayerIdSet.begin(), m_targetDecLayerIdSet.end(), nalu->m_nuhLayerId ) != m_targetDecLayerIdSet.end();
}
/** \param nalu Input nalu to check whether its LayerId is within targetOutputLayerIdSet
*/
bool DecApp::xIsNaluWithinTargetOutputLayerIdSet( const InputNALUnit* nalu ) const
{
if( !m_targetOutputLayerIdSet.size() ) // By default, the set is empty, meaning all LayerIds are allowed
{
return true;
}
return std::find( m_targetOutputLayerIdSet.begin(), m_targetOutputLayerIdSet.end(), nalu->m_nuhLayerId ) != m_targetOutputLayerIdSet.end();
}
#else

Karsten Suehring
committed
bool DecApp::isNaluWithinTargetDecLayerIdSet( InputNALUnit* nalu )
{
if ( m_targetDecLayerIdSet.size() == 0 ) // By default, the set is empty, meaning all LayerIds are allowed
{
return true;
}
for (std::vector<int>::iterator it = m_targetDecLayerIdSet.begin(); it != m_targetDecLayerIdSet.end(); it++)
{
if ( nalu->m_nuhLayerId == (*it) )
{
return true;
}
}
return false;
}
/** \param nalu Input nalu to check whether its LayerId is within targetOutputLayerIdSet
*/
bool DecApp::isNaluWithinTargetOutputLayerIdSet(InputNALUnit* nalu)
{
if (m_targetOutputLayerIdSet.size() == 0) // By default, the set is empty, meaning all LayerIds are allowed
{
return true;
}
for (std::vector<int>::iterator it = m_targetOutputLayerIdSet.begin(); it != m_targetOutputLayerIdSet.end(); it++)
{
if (nalu->m_nuhLayerId == (*it))
{
return true;
}
}
return false;
}