...
 
Commits (39)
ColorTransform : 1
Log2MaxTbSize : 5
DualITree: 0
LMCSEnable : 0
\ No newline at end of file
......@@ -105,6 +105,42 @@ void BitstreamExtractorApp::xReadPicHeader(InputNALUnit &nalu)
}
#if JVET_R0107_BITSTREAM_EXTACTION
Slice BitstreamExtractorApp::xParseSliceHeader(InputNALUnit &nalu)
{
m_hlSynaxReader.setBitstream(&nalu.getBitstream());
Slice slice;
slice.initSlice();
slice.setNalUnitType(nalu.m_nalUnitType);
slice.setNalUnitLayerId(nalu.m_nuhLayerId);
slice.setTLayer(nalu.m_temporalId);
m_hlSynaxReader.parseSliceHeader(&slice, &m_picHeader, &m_parameterSetManager, m_prevTid0Poc, m_prevPicPOC);
return slice;
}
bool BitstreamExtractorApp::xCheckSliceSubpicture(Slice &slice, int targetSubPicId)
{
PPS *pps = m_parameterSetManager.getPPS(m_picHeader.getPPSId());
CHECK(nullptr == pps, "referenced PPS not found");
SPS *sps = m_parameterSetManager.getSPS(pps->getSPSId());
CHECK(nullptr == sps, "referenced SPS not found");
if (sps->getSubPicInfoPresentFlag())
{
// subpic ID is explicitly indicated
msg(VERBOSE, "found slice subpic id %d\n", slice.getSliceSubPicId());
return (targetSubPicId == slice.getSliceSubPicId());
}
else
{
THROW("Subpicture signalling disbled, cannot extract.");
}
return true;
}
#else
bool BitstreamExtractorApp::xCheckSliceSubpicture(InputNALUnit &nalu, int targetSubPicId)
{
m_hlSynaxReader.setBitstream(&nalu.getBitstream());
......@@ -134,6 +170,7 @@ bool BitstreamExtractorApp::xCheckSliceSubpicture(InputNALUnit &nalu, int target
return true;
}
#endif
void BitstreamExtractorApp::xRewriteSPS (SPS &targetSPS, const SPS &sourceSPS, SubPic &subPic)
{
......@@ -353,7 +390,14 @@ void BitstreamExtractorApp::xWritePPS(PPS *pps, std::ostream& out, int layerId,
// returns true, if the NAL unit is to be discarded
bool BitstreamExtractorApp::xCheckNumSubLayers(InputNALUnit &nalu, VPS *vps)
{
#if JVET_R0107_BITSTREAM_EXTACTION
bool retval = (nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_IDR_N_LP)
&& (nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_IDR_W_RADL)
&& (nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_CRA)
&& !( (nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_GDR) && (m_picHeader.getRecoveryPocCnt() == 0) );
#else
bool retval = (nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_IDR_N_LP) && (nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_IDR_W_RADL) && (nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_CRA);
#endif
retval &= nalu.m_temporalId >= vps->getNumSubLayersInLayerInOLS(m_targetOlsIdx, vps->getGeneralLayerIdx(nalu.m_nuhLayerId));
......@@ -624,12 +668,23 @@ uint32_t BitstreamExtractorApp::decode()
delete vps;
}
}
#if JVET_R0107_BITSTREAM_EXTACTION
Slice slice;
if (nalu.isSlice())
{
slice = xParseSliceHeader(nalu);
}
#endif
if (m_subPicId>=0)
{
if ( nalu.isSlice() )
{
// check for subpicture ID
#if JVET_R0107_BITSTREAM_EXTACTION
writeInpuNalUnitToStream = xCheckSliceSubpicture(slice, m_subPicId);
#else
writeInpuNalUnitToStream = xCheckSliceSubpicture(nalu, m_subPicId);
#endif
}
if (nalu.m_nalUnitType == NAL_UNIT_FD)
{
......
......@@ -66,7 +66,12 @@ protected:
void xRewriteSPS (SPS &targetSPS, const SPS &sourceSPS, SubPic &subPic);
void xRewritePPS (PPS &targetPPS, const PPS &sourcePPS, SubPic &subPic);
#if JVET_R0107_BITSTREAM_EXTACTION
Slice xParseSliceHeader(InputNALUnit &nalu);
bool xCheckSliceSubpicture(Slice &slice, int subPicId);
#else
bool xCheckSliceSubpicture(InputNALUnit &nalu, int subPicId);
#endif
void xReadPicHeader(InputNALUnit &nalu);
void xSetSPSUpdated(int spsId) { return m_updatedSPSList.push_back(spsId); }
......
......@@ -286,10 +286,12 @@ uint32_t DecApp::decode()
{
m_cDecLib.CheckNoOutputPriorPicFlagsInAccessUnit();
m_cDecLib.resetAccessUnitNoOutputPriorPicFlags();
m_cDecLib.checkLayerIdIncludedInCvss();
m_cDecLib.resetAccessUnitEos();
m_cDecLib.resetAudIrapOrGdrAuFlag();
}
if(bNewAccessUnit)
{
m_cDecLib.isCvsStart();
m_cDecLib.checkTidLayerIdInAccessUnit();
m_cDecLib.resetAccessUnitSeiTids();
m_cDecLib.checkSEIInAccessUnit();
......@@ -369,6 +371,12 @@ void DecApp::xCreateDecLib()
std::ostream &os=m_seiMessageFileStream.is_open() ? m_seiMessageFileStream : std::cout;
m_cDecLib.setDecodedSEIMessageOutputStream(&os);
}
#if JVET_S0257_DUMP_360SEI_MESSAGE
if (!m_outputDecoded360SEIMessagesFilename.empty())
{
m_cDecLib.setDecoded360SEIMessageFileName(m_outputDecoded360SEIMessagesFilename);
}
#endif
m_cDecLib.m_targetSubPicIdx = this->m_targetSubPicIdx;
m_cDecLib.initScalingList();
}
......
......@@ -97,6 +97,9 @@ bool DecAppCfg::parseCfg( int argc, char* argv[] )
("TarDecLayerIdSetFile,l", cfg_TargetDecLayerIdSetFile, string(""), "targetDecLayerIdSet file name. The file should include white space separated LayerId values to be decoded. Omitting the option or a value of -1 in the file decodes all layers.")
("SEIColourRemappingInfoFilename", m_colourRemapSEIFileName, string(""), "Colour Remapping YUV output file name. If empty, no remapping is applied (ignore SEI message)\n")
("OutputDecodedSEIMessagesFilename", m_outputDecodedSEIMessagesFilename, string(""), "When non empty, output decoded SEI messages to the indicated file. If file is '-', then output to stdout\n")
#if JVET_S0257_DUMP_360SEI_MESSAGE
("360DumpFile", m_outputDecoded360SEIMessagesFilename, string(""), "When non empty, output decoded 360 SEI messages to the indicated file.\n")
#endif
("ClipOutputVideoToRec709Range", m_bClipOutputVideoToRec709Range, false, "If true then clip output video to the Rec. 709 Range on saving")
("PYUV", m_packedYUVMode, false, "If true then output 10-bit and 12-bit YUV data as 5-byte and 3-byte (respectively) packed YUV data. Ignored for interlaced output.")
#if ENABLE_TRACING
......@@ -235,6 +238,9 @@ DecAppCfg::DecAppCfg()
, m_colourRemapSEIFileName()
, m_targetDecLayerIdSet()
, m_outputDecodedSEIMessagesFilename()
#if JVET_S0257_DUMP_360SEI_MESSAGE
, m_outputDecoded360SEIMessagesFilename()
#endif
, m_bClipOutputVideoToRec709Range(false)
, m_packedYUVMode(false)
, m_statMode(0)
......
......@@ -72,6 +72,9 @@ protected:
std::string m_colourRemapSEIFileName; ///< output Colour Remapping file name
std::vector<int> m_targetDecLayerIdSet; ///< set of LayerIds to be included in the sub-bitstream extraction process.
std::string m_outputDecodedSEIMessagesFilename; ///< filename to output decoded SEI messages to. If '-', then use stdout. If empty, do not output details.
#if JVET_S0257_DUMP_360SEI_MESSAGE
std::string m_outputDecoded360SEIMessagesFilename; ///< filename to output decoded 360 SEI messages to.
#endif
bool m_bClipOutputVideoToRec709Range; ///< If true, clip the output video to the Rec 709 range on saving.
......
......@@ -252,6 +252,9 @@ void EncApp::xInitLibCfg()
m_cEncLib.setAvoidIntraInDepLayer ( m_avoidIntraInDepLayer );
//====== SPS constraint flags =======
#if JVET_S0179_CONDITIONAL_SIGNAL_GCI
m_cEncLib.setGciPresentFlag (true);
#endif
m_cEncLib.setOnePictureOnlyConstraintFlag ( m_onePictureOnlyConstraintFlag );
m_cEncLib.setIntraOnlyConstraintFlag ( m_intraConstraintFlag ); // NOTE: This setting is not used, and is confused with setIntraConstraintFlag
m_cEncLib.setMaxBitDepthConstraintIdc ( m_bitDepthConstraint - 8 );
......
......@@ -81,6 +81,9 @@ EncAppCfg::EncAppCfg()
, m_snrInternalColourSpace(false)
, m_outputInternalColourSpace(false)
, m_packedYUVMode(false)
#if JVET_S0179_CONDITIONAL_SIGNAL_GCI
, m_gciPresentFlag(true)
#endif
, m_bIntraOnlyConstraintFlag(false)
, m_maxBitDepthConstraintIdc(0)
, m_maxChromaFormatConstraintIdc(CHROMA_420)
......@@ -1615,6 +1618,17 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
CHECK(m_resChangeInClvsEnabled, "resolution change in CLVS and subpictures cannot be enabled together");
}
#if JVET_S0221_NUM_VB_CHECK
if (m_virtualBoundariesPresentFlag)
{
if (m_iSourceWidth <= 8)
CHECK(m_numVerVirtualBoundaries != 0, "The number of vertical virtual boundaries shall be 0 when the picture width is less than or equal to 8");
if (m_iSourceHeight <= 8)
CHECK(m_numHorVirtualBoundaries != 0, "The number of horizontal virtual boundaries shall be 0 when the picture height is less than or equal to 8");
}
#endif
if (m_cfgSubpictureLevelInfoSEI.m_enabled)
{
CHECK (m_numSubPics != m_cfgSubpictureLevelInfoSEI.m_numSubpictures, "NumSubPics must be equal to SEISubpicLevelInfoNumSubpics" );
......
......@@ -131,6 +131,9 @@ protected:
bool m_bClipOutputVideoToRec709Range;
bool m_packedYUVMode; ///< If true, output 10-bit and 12-bit YUV data as 5-byte and 3-byte (respectively) packed YUV data
#if JVET_S0179_CONDITIONAL_SIGNAL_GCI
bool m_gciPresentFlag;
#endif
bool m_bIntraOnlyConstraintFlag;
uint32_t m_maxBitDepthConstraintIdc;
uint32_t m_maxChromaFormatConstraintIdc;
......
......@@ -388,7 +388,7 @@ void IntraPrediction::initPredIntraParams(const PredictionUnit & pu, const CompA
const int signAng = intraPredAngleMode < 0 ? -1 : 1;
absAng = angTable [absAngMode];
m_ipaParam.invAngle = invAngTable[absAngMode];
m_ipaParam.absInvAngle = invAngTable[absAngMode];
m_ipaParam.intraPredAngle = signAng * absAng;
if (intraPredAngleMode < 0)
{
......@@ -399,7 +399,7 @@ void IntraPrediction::initPredIntraParams(const PredictionUnit & pu, const CompA
const int sideSize = m_ipaParam.isModeVer ? puSize.height : puSize.width;
const int maxScale = 2;
m_ipaParam.angularScale = std::min(maxScale, floorLog2(sideSize) - (floorLog2(3 * m_ipaParam.invAngle - 2) - 8));
m_ipaParam.angularScale = std::min(maxScale, floorLog2(sideSize) - (floorLog2(3 * m_ipaParam.absInvAngle - 2) - 8));
m_ipaParam.applyPDPC &= m_ipaParam.angularScale >= 0;
}
}
......@@ -464,7 +464,7 @@ void IntraPrediction::xPredIntraAng( const CPelBuf &pSrc, PelBuf &pDst, const Ch
const bool bIsModeVer = m_ipaParam.isModeVer;
const int multiRefIdx = m_ipaParam.multiRefIndex;
const int intraPredAngle = m_ipaParam.intraPredAngle;
const int invAngle = m_ipaParam.invAngle;
const int absInvAngle = m_ipaParam.absInvAngle;
Pel* refMain;
Pel* refSide;
......@@ -490,7 +490,7 @@ void IntraPrediction::xPredIntraAng( const CPelBuf &pSrc, PelBuf &pDst, const Ch
int sizeSide = bIsModeVer ? height : width;
for (int k = -sizeSide; k <= -1; k++)
{
refMain[k] = refSide[std::min((-k * invAngle + 256) >> 9, sizeSide)];
refMain[k] = refSide[std::min((-k * absInvAngle + 256) >> 9, sizeSide)];
}
}
else
......@@ -618,7 +618,7 @@ void IntraPrediction::xPredIntraAng( const CPelBuf &pSrc, PelBuf &pDst, const Ch
for (int x = 0; x < std::min(3 << scale, width); x++)
{
invAngleSum += invAngle;
invAngleSum += absInvAngle;
int wL = 32 >> (2 * x >> scale);
Pel left = refSide[y + (invAngleSum >> 9) + 1];
......
......@@ -83,7 +83,7 @@ private:
bool isModeVer;
int multiRefIndex;
int intraPredAngle;
int invAngle;
int absInvAngle;
bool interpolationFlag;
int angularScale;
......@@ -94,7 +94,7 @@ private:
, isModeVer(false)
, multiRefIndex(-1)
, intraPredAngle(std::numeric_limits<int>::max())
, invAngle(std::numeric_limits<int>::max())
, absInvAngle(std::numeric_limits<int>::max())
, interpolationFlag(false)
, angularScale(-1)
// clang-format on
......
......@@ -57,7 +57,9 @@ Slice::Slice()
, m_prevIRAPSubpicType ( NAL_UNIT_INVALID )
, m_rpl0Idx ( -1 )
, m_rpl1Idx ( -1 )
#if !JVET_S0052_RM_SEPARATE_COLOUR_PLANE
, m_colourPlaneId ( 0 )
#endif
, m_eNalUnitType ( NAL_UNIT_CODED_SLICE_IDR_W_RADL )
, m_pictureHeaderInSliceHeader ( false )
, m_eSliceType ( I_SLICE )
......@@ -161,7 +163,9 @@ void Slice::initSlice()
m_aiNumRefIdx[i] = 0;
}
m_colFromL0Flag = true;
#if !JVET_S0052_RM_SEPARATE_COLOUR_PLANE
m_colourPlaneId = 0;
#endif
m_colRefIdx = 0;
m_lmcsEnabledFlag = 0;
m_explicitScalingListUsed = 0;
......@@ -2691,7 +2695,9 @@ SPS::SPS()
, m_SBT ( false )
, m_ISP ( false )
, m_chromaFormatIdc (CHROMA_420)
#if !JVET_S0052_RM_SEPARATE_COLOUR_PLANE
, m_separateColourPlaneFlag ( 0 )
#endif
, m_uiMaxTLayers ( 1)
, m_ptlDpbHrdParamsPresentFlag (1)
, m_SubLayerDpbParamsFlag (0)
......
......@@ -235,6 +235,9 @@ private:
class ConstraintInfo
{
#if JVET_S0179_CONDITIONAL_SIGNAL_GCI
bool m_gciPresentFlag;
#endif
bool m_nonPackedConstraintFlag;
bool m_nonProjectedConstraintFlag;
bool m_noResChangeInClvsConstraintFlag;
......@@ -300,7 +303,12 @@ class ConstraintInfo
public:
ConstraintInfo()
#if JVET_S0179_CONDITIONAL_SIGNAL_GCI
: m_gciPresentFlag(true)
, m_nonPackedConstraintFlag(false)
#else
: m_nonPackedConstraintFlag (false)
#endif
, m_nonProjectedConstraintFlag(false)
, m_noResChangeInClvsConstraintFlag(false)
, m_oneTilePerPicConstraintFlag(false)
......@@ -365,6 +373,11 @@ public:
{}
#if JVET_S0179_CONDITIONAL_SIGNAL_GCI
bool getGciPresentFlag() const { return m_gciPresentFlag; }
void setGciPresentFlag(bool b) { m_gciPresentFlag = b; }
#endif
bool getNonPackedConstraintFlag() const { return m_nonPackedConstraintFlag; }
void setNonPackedConstraintFlag(bool b) { m_nonPackedConstraintFlag = b; }
......@@ -1274,7 +1287,9 @@ private:
bool m_SBT;
bool m_ISP;
ChromaFormat m_chromaFormatIdc;
#if !JVET_S0052_RM_SEPARATE_COLOUR_PLANE
bool m_separateColourPlaneFlag; //!< separate colour plane flag
#endif
uint32_t m_uiMaxTLayers; // maximum number of temporal layers
......@@ -1451,8 +1466,10 @@ public:
int getLayerId() const { return m_layerId; }
ChromaFormat getChromaFormatIdc () const { return m_chromaFormatIdc; }
void setChromaFormatIdc (ChromaFormat i) { m_chromaFormatIdc = i; }
#if !JVET_S0052_RM_SEPARATE_COLOUR_PLANE
void setSeparateColourPlaneFlag ( bool b ) { m_separateColourPlaneFlag = b; }
bool getSeparateColourPlaneFlag () const { return m_separateColourPlaneFlag; }
#endif
static int getWinUnitX (int chromaFormatIdc) { CHECK(chromaFormatIdc < 0 || chromaFormatIdc >= NUM_CHROMA_FORMAT, "Invalid chroma format parameter"); return m_winUnitX[chromaFormatIdc]; }
static int getWinUnitY (int chromaFormatIdc) { CHECK(chromaFormatIdc < 0 || chromaFormatIdc >= NUM_CHROMA_FORMAT, "Invalid chroma format parameter"); return m_winUnitY[chromaFormatIdc]; }
......@@ -2528,7 +2545,9 @@ private:
ReferencePictureList m_localRPL1; //< RPL for L1 when present in slice header
int m_rpl0Idx; //< index of used RPL in the SPS or -1 for local RPL in the slice header
int m_rpl1Idx; //< index of used RPL in the SPS or -1 for local RPL in the slice header
#if !JVET_S0052_RM_SEPARATE_COLOUR_PLANE
int m_colourPlaneId; //!< 4:4:4 colour plane ID
#endif
NalUnitType m_eNalUnitType; ///< Nal unit type for the slice
bool m_pictureHeaderInSliceHeader;
uint32_t m_nuhLayerId; ///< Nal unit layer id
......@@ -2777,8 +2796,10 @@ public:
bool isPocRestrictedByDRAP( int poc, bool precedingDRAPinDecodingOrder );
bool isPOCInRefPicList( const ReferencePictureList *rpl, int poc );
void checkConformanceForDRAP( uint32_t temporalId );
#if !JVET_S0052_RM_SEPARATE_COLOUR_PLANE
void setColourPlaneId( int id ) { m_colourPlaneId = id; }
int getColourPlaneId() const { return m_colourPlaneId; }
#endif
void setLambdas( const double lambdas[MAX_NUM_COMPONENT] ) { for (int component = 0; component < MAX_NUM_COMPONENT; component++) m_lambdas[component] = lambdas[component]; }
const double* getLambdas() const { return m_lambdas; }
......
......@@ -50,12 +50,20 @@
#include <assert.h>
#include <cassert>
//########### place macros to be removed in next cycle below this line ###############
#define JVET_S0179_CONDITIONAL_SIGNAL_GCI 1 // JVET-S0179: Conditional signalling of GCI fields
#define JVET_S0074_SPS_REORDER 1 // JVET-S0074: aspect 1, rearrange some syntax elements in SPS
#define JVET_S0132_HLS_REORDER 1 // Rearrange syntax elements in SPS and PPS
#define JVET_S0221_NUM_VB_CHECK 1 // JVET_S0221: Constraints on the number of virtual boundaries
#define JVET_S0052_RM_SEPARATE_COLOUR_PLANE 1 // JVET-S0052: Remove separate colour plane coding from VVC version 1
//########### place macros to be be kept below this line ###############
#define JVET_S0257_DUMP_360SEI_MESSAGE 1 // Software support of 360 SEI messages
#define JVET_R0351_HIGH_BIT_DEPTH_SUPPORT 1 // JVET-R0351: high bit depth coding support (syntax changes, no mathematical differences for CTCs)
#define JVET_R0351_HIGH_BIT_DEPTH_ENABLED 0 // JVET-R0351: high bit depth coding enabled (increases accuracies of some calculations, e.g. transforms)
......@@ -63,6 +71,8 @@
#define JVET_M0497_MATRIX_MULT 0 // 0: Fast method; 1: Matrix multiplication
#define JVET_R0107_BITSTREAM_EXTACTION 1 // JVET-R0107 Proposal 3:Bitsteam extraction modifications
#define APPLY_SBT_SL_ON_MTS 1 // apply save & load fast algorithm on inter MTS when SBT is on
typedef std::pair<int, bool> TrMode;
......
......@@ -922,6 +922,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx,
const CodingStructure &cs = *pu.cs;
const Slice &slice = *pu.cs->slice;
const uint32_t maxNumMergeCand = pu.cs->sps->getMaxNumMergeCand();
CHECK (maxNumMergeCand > MRG_MAX_NUM_CANDS, "selected maximum number of merge candidate exceeds global limit");
for (uint32_t ui = 0; ui < maxNumMergeCand; ++ui)
{
mrgCtx.BcwIdx[ui] = BCW_DEFAULT;
......
......@@ -427,6 +427,7 @@ DecLib::DecLib()
, m_bFirstSliceInPicture(true)
, m_firstSliceInSequence{ true }
, m_firstSliceInBitstream(true)
, m_isFirstAuInCvs( true )
, m_prevSliceSkipped(false)
, m_skippedPOC(0)
, m_lastPOCNoOutputPriorPics(-1)
......@@ -434,6 +435,10 @@ DecLib::DecLib()
, m_lastNoOutputBeforeRecoveryFlag{ false }
, m_sliceLmcsApsId(-1)
, m_pDecodedSEIOutputStream(NULL)
, m_audIrapOrGdrAuFlag( false )
#if JVET_S0257_DUMP_360SEI_MESSAGE
, m_decoded360SeiDumpFileName()
#endif
, m_decodedPictureHashSEIEnabled(false)
, m_numberOfChecksumErrorsDetected(0)
, m_warningMessageSkipPicture(false)
......@@ -451,6 +456,7 @@ DecLib::DecLib()
#if ENABLE_SIMD_OPT_BUFFER
g_pelBufOP.initPelBufOpsX86();
#endif
memset(m_accessUnitEos, false, sizeof(m_accessUnitEos));
for (int i = 0; i < MAX_VPS_LAYERS; i++)
{
m_associatedIRAPType[i] = NAL_UNIT_INVALID;
......@@ -886,37 +892,47 @@ void DecLib::xCreateUnavailablePicture(int iUnavailablePoc, bool longTermFlag, c
{
m_pocRandomAccess = iUnavailablePoc;
}
}
void DecLib::isCvsStart()
void DecLib::checkLayerIdIncludedInCvss()
{
for (auto pic = m_accessUnitPicInfo.begin(); pic != m_accessUnitPicInfo.end(); pic++)
if (getVPS() == nullptr || getVPS()->getMaxLayers() == 1)
{
if (pic->m_nalUnitType != NAL_UNIT_CODED_SLICE_IDR_N_LP && pic->m_nalUnitType != NAL_UNIT_CODED_SLICE_IDR_W_RADL)
{
checkIncludedInFirstAu();
return;
}
}
//save the first AU info for a CVS start
m_firstAccessUnitPicInfo.assign(m_accessUnitPicInfo.begin(), m_accessUnitPicInfo.end());
}
void DecLib::checkIncludedInFirstAu()
{
if (m_audIrapOrGdrAuFlag &&
(m_isFirstAuInCvs || m_accessUnitPicInfo.begin()->m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP || m_accessUnitPicInfo.begin()->m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL))
{
// store layerIDs in the first AU
m_firstAccessUnitPicInfo.assign(m_accessUnitPicInfo.begin(), m_accessUnitPicInfo.end());
}
else
{
// check whether the layerIDs in an AU are included in the layerIDs of the first AU
for (auto pic = m_accessUnitPicInfo.begin(); pic != m_accessUnitPicInfo.end(); pic++)
{
bool isFind = 0;
bool layerIdFind;
for (auto picFirst = m_firstAccessUnitPicInfo.begin(); picFirst != m_firstAccessUnitPicInfo.end(); picFirst++)
{
if (pic->m_nuhLayerId == picFirst->m_nuhLayerId)
layerIdFind = pic->m_nuhLayerId == picFirst->m_nuhLayerId ? true : false;
if (layerIdFind)
{
isFind = 1;
break;
}
}
CHECK(!isFind, "each picture in an AU in a CVS shall have nuh_layer_id equal to the nuh_layer_id of one of the pictures present in the first AU of the CVS");
CHECK(!layerIdFind, "each picture in an AU in a CVS shall have nuh_layer_id equal to the nuh_layer_id of one of the pictures present in the first AU of the CVS");
}
}
// update the value of m_isFirstAuInCvs for the next AU according to NAL_UNIT_EOS in each layer
for (auto pic = m_accessUnitPicInfo.begin(); pic != m_accessUnitPicInfo.end(); pic++)
{
m_isFirstAuInCvs = m_accessUnitEos[pic->m_nuhLayerId] ? true : false;
if(!m_isFirstAuInCvs)
{
break;
}
}
}
......@@ -1767,6 +1783,9 @@ void DecLib::xParsePrefixSEImessages()
const SPS *sps = m_parameterSetManager.getActiveSPS();
const VPS *vps = m_parameterSetManager.getVPS(sps->getVPSId());
m_seiReader.parseSEImessage( &(nalu.getBitstream()), m_SEIs, nalu.m_nalUnitType, nalu.m_nuhLayerId, nalu.m_temporalId, vps, sps, m_HRD, m_pDecodedSEIOutputStream );
#if JVET_S0257_DUMP_360SEI_MESSAGE
m_seiCfgDump.write360SeiDump( m_decoded360SeiDumpFileName, m_SEIs, sps );
#endif
m_accessUnitSeiPayLoadTypes.push_back(std::tuple<NalUnitType, int, SEI::PayloadType>(nalu.m_nalUnitType, nalu.m_nuhLayerId, m_SEIs.back()->payloadType()));
delete m_prefixSEINALUs.front();
m_prefixSEINALUs.pop_front();
......@@ -2680,6 +2699,9 @@ bool DecLib::decode(InputNALUnit& nalu, int& iSkipFrame, int& iPOCLastDisplay, i
const SPS *sps = m_parameterSetManager.getActiveSPS();
const VPS *vps = m_parameterSetManager.getVPS(sps->getVPSId());
m_seiReader.parseSEImessage( &(nalu.getBitstream()), m_pcPic->SEIs, nalu.m_nalUnitType, nalu.m_nuhLayerId, nalu.m_temporalId, vps, sps, m_HRD, m_pDecodedSEIOutputStream );
#if JVET_S0257_DUMP_360SEI_MESSAGE
m_seiCfgDump.write360SeiDump(m_decoded360SeiDumpFileName, m_pcPic->SEIs, sps);
#endif
m_accessUnitSeiPayLoadTypes.push_back(std::tuple<NalUnitType, int, SEI::PayloadType>(nalu.m_nalUnitType, nalu.m_nuhLayerId, m_pcPic->SEIs.back()->payloadType()));
}
else
......@@ -2712,14 +2734,14 @@ bool DecLib::decode(InputNALUnit& nalu, int& iSkipFrame, int& iPOCLastDisplay, i
m_prevPOC = MAX_INT;
m_prevSliceSkipped = false;
m_skippedPOC = 0;
m_accessUnitEos[nalu.m_nuhLayerId] = true;
return false;
case NAL_UNIT_ACCESS_UNIT_DELIMITER:
{
AUDReader audReader;
uint32_t picType;
uint32_t audIrapOrGdrAuFlag;
audReader.parseAccessUnitDelimiter(&(nalu.getBitstream()), audIrapOrGdrAuFlag, picType);
audReader.parseAccessUnitDelimiter(&(nalu.getBitstream()), m_audIrapOrGdrAuFlag, picType);
return !m_bFirstSliceInPicture;
}
......
......@@ -105,6 +105,9 @@ private:
HLSyntaxReader m_HLSReader;
CABACDecoder m_CABACDecoder;
SEIReader m_seiReader;
#if JVET_S0257_DUMP_360SEI_MESSAGE
SeiCfgFileDump m_seiCfgDump;
#endif
LoopFilter m_cLoopFilter;
SampleAdaptiveOffset m_cSAO;
AdaptiveLoopFilter m_cALF;
......@@ -125,6 +128,8 @@ private:
bool m_bFirstSliceInPicture;
bool m_firstSliceInSequence[MAX_VPS_LAYERS];
bool m_firstSliceInBitstream;
bool m_isFirstAuInCvs;
bool m_accessUnitEos[MAX_VPS_LAYERS];
bool m_prevSliceSkipped;
int m_skippedPOC;
int m_lastPOCNoOutputPriorPics;
......@@ -132,6 +137,10 @@ private:
bool m_lastNoOutputBeforeRecoveryFlag[MAX_VPS_LAYERS]; //value of variable NoOutputBeforeRecoveryFlag of the assocated CRA/GDR pic
int m_sliceLmcsApsId; //value of LmcsApsId, constraint is same id for all slices in one picture
std::ostream *m_pDecodedSEIOutputStream;
uint32_t m_audIrapOrGdrAuFlag;
#if JVET_S0257_DUMP_360SEI_MESSAGE
std::string m_decoded360SeiDumpFileName;
#endif
int m_decodedPictureHashSEIEnabled; ///< Checksum(3)/CRC(2)/MD5(1)/disable(0) acting on decoded picture hash SEI message
uint32_t m_numberOfChecksumErrorsDetected;
......@@ -219,6 +228,9 @@ public:
bool getFirstSliceInSequence(int layerId) const { return m_firstSliceInSequence[layerId]; }
void setFirstSliceInSequence(bool val, int layerId) { m_firstSliceInSequence[layerId] = val; }
void setDecodedSEIMessageOutputStream(std::ostream *pOpStream) { m_pDecodedSEIOutputStream = pOpStream; }
#if JVET_S0257_DUMP_360SEI_MESSAGE
void setDecoded360SEIMessageFileName(std::string &Dump360SeiFileName) { m_decoded360SeiDumpFileName = Dump360SeiFileName; }
#endif
uint32_t getNumberOfChecksumErrorsDetected() const { return m_numberOfChecksumErrorsDetected; }
int getDebugCTU( ) const { return m_debugCTU; }
......@@ -229,11 +241,12 @@ public:
void resetAccessUnitPicInfo() { m_accessUnitPicInfo.clear(); }
void resetAccessUnitApsNals() { m_accessUnitApsNals.clear(); }
void resetAccessUnitSeiTids() { m_accessUnitSeiTids.clear(); }
void resetAudIrapOrGdrAuFlag() { m_audIrapOrGdrAuFlag = false; }
void resetAccessUnitEos() { memset(m_accessUnitEos, false, sizeof(m_accessUnitEos)); }
void checkTidLayerIdInAccessUnit();
void resetAccessUnitSeiPayLoadTypes() { m_accessUnitSeiPayLoadTypes.clear(); }
void checkSEIInAccessUnit();
void isCvsStart();
void checkIncludedInFirstAu();
void checkLayerIdIncludedInCvss();
void CheckNoOutputPriorPicFlagsInAccessUnit();
void resetAccessUnitNoOutputPriorPicFlags() { m_accessUnitNoOutputPriorPicFlags.clear(); }
void checkSeiInPictureUnit();
......@@ -254,6 +267,7 @@ public:
void setAPSMapEnc( ParameterSetMap<APS>* apsMap ) { m_apsMapEnc = apsMap; }
bool isNewPicture( std::ifstream *bitstreamFile, class InputByteStream *bytestream );
bool isNewAccessUnit( bool newPicture, std::ifstream *bitstreamFile, class InputByteStream *bytestream );
protected:
void xUpdateRasInit(Slice* slice);
......
......@@ -1390,6 +1390,146 @@ void SEIReader::xParseSEISampleAspectRatioInfo(SEISampleAspectRatioInfo& sei, ui
}
}
#if JVET_S0257_DUMP_360SEI_MESSAGE
void SeiCfgFileDump::write360SeiDump (std::string decoded360MessageFileName, SEIMessages& seis, const SPS* sps)
{
if (m_360SEIMessageDumped)
{
return;
}
SEIMessages equirectangularProjectionSEIs = getSeisByType(seis, SEI::EQUIRECTANGULAR_PROJECTION);
if (!equirectangularProjectionSEIs.empty())
{
SEIEquirectangularProjection* sei = (SEIEquirectangularProjection*)equirectangularProjectionSEIs.front();
xDumpSEIEquirectangularProjection(*sei, sps, decoded360MessageFileName);
m_360SEIMessageDumped = true;
}
else
{
SEIMessages generalizedCubemapProjectionSEIs = getSeisByType(seis, SEI::GENERALIZED_CUBEMAP_PROJECTION);
if (!generalizedCubemapProjectionSEIs.empty())
{
SEIGeneralizedCubemapProjection* sei = (SEIGeneralizedCubemapProjection*)generalizedCubemapProjectionSEIs.front();
xDumpSEIGeneralizedCubemapProjection(*sei, sps, decoded360MessageFileName);
m_360SEIMessageDumped = true;
}
}
}
void SeiCfgFileDump::xDumpSEIEquirectangularProjection (SEIEquirectangularProjection &sei, const SPS* sps, std::string decoded360MessageFileName)
{
if (!decoded360MessageFileName.empty())
{
FILE *fp = fopen(decoded360MessageFileName.c_str(), "w");
if (fp)
{
int chromaFormatTable[4] = {400, 420, 422, 444};
fprintf(fp, "InputBitDepth : %d # Input bitdepth\n", sps->getBitDepth(CHANNEL_TYPE_LUMA));
fprintf(fp, "InputChromaFormat : %d # Ratio of luminance to chrominance samples\n", chromaFormatTable[sps->getChromaFormatIdc()]);
fprintf(fp, "SourceWidth : %d # Input frame width\n", sps->getMaxPicWidthInLumaSamples());
fprintf(fp, "SourceHeight : %d # Input frame height\n\n", sps->getMaxPicHeightInLumaSamples());
fprintf(fp, "InputGeometryType : 0 # 0: equirectangular; 1: cubemap; 2: equalarea; this should be in the cfg of per sequence.\n");
if (sei.m_erpGuardBandFlag == 1)
{
fprintf(fp, "InputPERP : 1 # 0: original ERP input; 1: padded ERP input\n");
fprintf(fp, "CodingPERP : 0 # 0: coding with original ERP size; 1: coding with padded ERP\n");
}
fclose(fp);
m_360SEIMessageDumped = true;
}
else
{
msg( ERROR, "File %s could not be opened.\n", decoded360MessageFileName.c_str() );
}
}
}
void SeiCfgFileDump::xDumpSEIGeneralizedCubemapProjection (SEIGeneralizedCubemapProjection &sei, const SPS* sps, std::string decoded360MessageFileName)
{
if (!sei.m_gcmpCancelFlag)
{
int numFace = sei.m_gcmpPackingType == 4 || sei.m_gcmpPackingType == 5 ? 5 : 6;
int packingTypeTable[6][2] = {{6, 1}, {3, 2}, {2, 3}, {1, 6}, {1, 5}, {5, 1}};
int rotationTable[4] = {0, 90, 180, 270};
std::string packingTypeStr = "";
std::string gcmpsettingsStr = "";
std::ostringstream oss;
packingTypeStr += "SourceFPStructure : " + std::to_string(packingTypeTable[sei.m_gcmpPackingType][0]) + " " + std::to_string(packingTypeTable[sei.m_gcmpPackingType][1]);
gcmpsettingsStr += "InputGCMPSettings : ";
for (int i = 0; i < numFace; i++)
{
int rotation = rotationTable[sei.m_gcmpFaceRotation[i]];
if (sei.m_gcmpFaceIndex[i] == 1)
{
rotation = (rotation + 270) % 360 + 360;
}
else if (sei.m_gcmpFaceIndex[i] == 2)
{
rotation = (rotation + 180) % 360 + 360;
}
else
{
rotation += 360;
}
if (i % packingTypeTable[sei.m_gcmpPackingType][1] == 0)
{
packingTypeStr += " ";
}
packingTypeStr += std::to_string(sei.m_gcmpFaceIndex[i]) + " " + std::to_string(rotation) + " ";
if (sei.m_gcmpMappingFunctionType == 2)
{
double a = ((int)sei.m_gcmpFunctionCoeffU[i] + 1) / 128.0;
double b = ((int)sei.m_gcmpFunctionCoeffV[i] + 1) / 128.0;
oss.str("");
oss<<a;
std::string a_str = oss.str();
oss.str("");
oss<<b;
std::string b_str = oss.str();
gcmpsettingsStr += a_str + " " + std::to_string(sei.m_gcmpFunctionUAffectedByVFlag[i]) + " " + b_str + " " + std::to_string(sei.m_gcmpFunctionVAffectedByUFlag[i]) + " ";
}
}
if (!decoded360MessageFileName.empty())
{
FILE *fp = fopen(decoded360MessageFileName.c_str(), "w");
if (fp)
{
int chromaFormatTable[4] = {400, 420, 422, 444};
fprintf(fp, "InputBitDepth : %d # Input bitdepth\n", sps->getBitDepth(CHANNEL_TYPE_LUMA));
fprintf(fp, "InputChromaFormat : %d # Ratio of luminance to chrominance samples\n", chromaFormatTable[sps->getChromaFormatIdc()]);
fprintf(fp, "SourceWidth : %d # Input frame width\n", sps->getMaxPicWidthInLumaSamples());
fprintf(fp, "SourceHeight : %d # Input frame height\n\n", sps->getMaxPicHeightInLumaSamples());
fprintf(fp, "InputGeometryType : 15 # 0: equirectangular; 1: cubemap; 2: equalarea; this should be in the cfg of per sequence.\n");
packingTypeStr += " # frame packing order: numRows numCols Row0Idx0 ROT Row0Idx1 ROT ... Row1...";
gcmpsettingsStr += " # mapping function parameters for each face: u coefficient, u affected by v flag, v coefficient, v affected by u flag";
fprintf(fp, "%s\n", packingTypeStr.c_str());
fprintf(fp, "InputGCMPMappingType : %d # 0: CMP; 1: EAC; 2: parameterized CMP\n", (int)sei.m_gcmpMappingFunctionType);
if ((int)sei.m_gcmpMappingFunctionType == 2)
fprintf(fp, "%s\n", gcmpsettingsStr.c_str());
fprintf(fp, "InputGCMPPaddingFlag : %d # 0: input without guard bands; 1: input with guard bands\n", sei.m_gcmpGuardBandFlag);
if (sei.m_gcmpGuardBandFlag)
{
fprintf(fp, "InputGCMPPaddingType : %d # 0: unspecified(repetitive padding is used); 1: repetitive padding; 2: copy from neighboring face; 3: geometry padding\n", (int)sei.m_gcmpGuardBandType);
fprintf(fp, "InputGCMPPaddingExteriorFlag : %d # 0: guard bands only on discontinuous edges; 1: guard bands on both discontinuous edges and frame boundaries\n", sei.m_gcmpGuardBandBoundaryExteriorFlag);
fprintf(fp, "InputGCMPPaddingSize : %d # guard band size for input GCMP\n", (int)sei.m_gcmpGuardBandSamplesMinus1 + 1);
}
fclose(fp);
m_360SEIMessageDumped = true;
}
else
{
msg( ERROR, "File %s could not be opened.\n", decoded360MessageFileName.c_str() );
}
}
}
}
#endif
//! \}
......@@ -96,6 +96,27 @@ protected:
HRD m_nestedHrd;
};
#if JVET_S0257_DUMP_360SEI_MESSAGE
class SeiCfgFileDump
{
public:
SeiCfgFileDump()
: m_360SEIMessageDumped(false)
{};
virtual ~SeiCfgFileDump() {};
void write360SeiDump (std::string decoded360MessageFileName, SEIMessages& seis, const SPS* sps);
protected:
void xDumpSEIEquirectangularProjection (SEIEquirectangularProjection &sei, const SPS* sps, std::string decoded360MessageFileName);
void xDumpSEIGeneralizedCubemapProjection (SEIGeneralizedCubemapProjection &sei, const SPS* sps, std::string decoded360MessageFileName);
bool m_360SEIMessageDumped;
};
#endif
//! \}
......
This diff is collapsed.
......@@ -175,6 +175,9 @@ protected:
bool m_printSequenceMSE;
bool m_cabacZeroWordPaddingEnabled;
#if JVET_S0179_CONDITIONAL_SIGNAL_GCI
bool m_gciPresentFlag;
#endif
bool m_onePictureOnlyConstraintFlag;
bool m_bIntraOnlyConstraintFlag;
uint32_t m_maxBitDepthConstraintIdc;
......@@ -771,6 +774,10 @@ public:
void setMaxChromaFormatConstraintIdc(uint32_t u) { m_maxChromaFormatConstraintIdc = u; }
bool getFrameConstraintFlag() const { return m_bFrameConstraintFlag; }
void setFrameConstraintFlag(bool bVal) { m_bFrameConstraintFlag = bVal; }
#if JVET_S0179_CONDITIONAL_SIGNAL_GCI
bool getGciPresentFlag() const { return m_gciPresentFlag; }
void setGciPresentFlag(bool b) { m_gciPresentFlag = b; }
#endif
bool getSingleLayerConstraintFlag() const { return m_singleLayerConstraintFlag; }
void setSingleLayerConstraintFlag(bool bVal) { m_singleLayerConstraintFlag = bVal; }
......
......@@ -1089,6 +1089,10 @@ void EncLib::xInitSPS( SPS& sps )
{
ProfileTierLevel* profileTierLevel = sps.getProfileTierLevel();
ConstraintInfo* cinfo = profileTierLevel->getConstraintInfo();
#if JVET_S0179_CONDITIONAL_SIGNAL_GCI
cinfo->setGciPresentFlag(m_gciPresentFlag);
#endif
cinfo->setNonPackedConstraintFlag (m_nonPackedConstraintFlag);
cinfo->setNonProjectedConstraintFlag(m_nonProjectedConstraintFlag);
cinfo->setNoResChangeInClvsConstraintFlag(m_noResChangeInClvsConstraintFlag);
......@@ -1718,8 +1722,12 @@ void EncLib::xInitPPS(PPS &pps, const SPS &sps)
{
chromaDbfOffsetNotSameAsLuma = false;
}
#if !JVET_S0052_RM_SEPARATE_COLOUR_PLANE
const uint32_t chromaArrayType = (int)sps.getSeparateColourPlaneFlag() ? 0 : sps.getChromaFormatIdc();
if( ( chromaArrayType != CHROMA_400 ) && ( chromaQPOffsetNotZero || chromaDbfOffsetNotSameAsLuma ) )
#else
if ((sps.getChromaFormatIdc() != CHROMA_400) && (chromaQPOffsetNotZero || chromaDbfOffsetNotSameAsLuma))
#endif
{
pps.setPPSChromaToolFlag(true);
}
......
......@@ -2664,6 +2664,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner)
RefPicList eCurRefList = (curRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0);
int refIdxCur = cs.slice->getSymRefIdx( curRefList );
int refIdxTar = cs.slice->getSymRefIdx( tarRefList );
CHECK (refIdxCur==-1 || refIdxTar==-1, "Uninitialized reference index not allowed");
if ( aacAMVPInfo[curRefList][refIdxCur].mvCand[0] == aacAMVPInfo[curRefList][refIdxCur].mvCand[1] )
aacAMVPInfo[curRefList][refIdxCur].numCand = 1;
......
This diff is collapsed.