diff --git a/source/App/EncoderApp/EncApp.cpp b/source/App/EncoderApp/EncApp.cpp index ba5e799efc7e1c08c01b8d41b3c1e718b8d51096..43a883985c35cb6f18b38f580e411820919449e5 100644 --- a/source/App/EncoderApp/EncApp.cpp +++ b/source/App/EncoderApp/EncApp.cpp @@ -873,6 +873,12 @@ void EncApp::xInitLibCfg() m_cEncLib.setFramePackingArrangementSEIId ( m_framePackingSEIId ); m_cEncLib.setFramePackingArrangementSEIQuincunx ( m_framePackingSEIQuincunx ); m_cEncLib.setFramePackingArrangementSEIInterpretation ( m_framePackingSEIInterpretation ); +#if JVET_V0061_SEI + m_cEncLib.setDoSEIEnabled ( m_doSEIEnabled ); + m_cEncLib.setDoSEICancelFlag ( m_doSEICancelFlag ); + m_cEncLib.setDoSEIPersistenceFlag ( m_doSEIPersistenceFlag); + m_cEncLib.setDoSEITransformType ( m_doSEITransformType); +#endif m_cEncLib.setParameterSetsInclusionIndicationSEIEnabled (m_parameterSetsInclusionIndicationSEIEnabled); m_cEncLib.setSelfContainedClvsFlag (m_selfContainedClvsFlag); m_cEncLib.setErpSEIEnabled ( m_erpSEIEnabled ); diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp index ed0823ede7f1c17389378d7d2f348eb10ae928f0..b8cad29f9d2813e1e63bc4e3761972495d3ceab1 100644 --- a/source/App/EncoderApp/EncAppCfg.cpp +++ b/source/App/EncoderApp/EncAppCfg.cpp @@ -619,6 +619,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) SMultiValueInput<uint32_t> cfg_kneeSEIOutputKneePointValue (0, 1000, 0, 999, defaultOutputKneeCodes, sizeof(defaultOutputKneeCodes)/sizeof(uint32_t)); const int defaultPrimaryCodes[6] = { 0,50000, 0,0, 50000,0 }; const int defaultWhitePointCode[2] = { 16667, 16667 }; + SMultiValueInput<int> cfg_DisplayPrimariesCode (0, 50000, 6, 6, defaultPrimaryCodes, sizeof(defaultPrimaryCodes )/sizeof(int)); SMultiValueInput<int> cfg_DisplayWhitePointCode (0, 50000, 2, 2, defaultWhitePointCode, sizeof(defaultWhitePointCode)/sizeof(int)); @@ -1261,6 +1262,12 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) "\t0: unspecified\n" "\t1: stereo pair, frame0 represents left view\n" "\t2: stereo pair, frame0 represents right view") +#if JVET_V0061_SEI + ("SEIDisplayOrientationEnabled", m_doSEIEnabled, false, "Controls if display orientation packing SEI message enabled") + ("SEIDisplayOrientationCancelFlag", m_doSEICancelFlag, true, "Specifies the persistence of any previous display orientation SEI message in output order.") + ("SEIDisplayOrientationPersistenceFlag", m_doSEIPersistenceFlag, false, "Specifies the persistence of the display orientation packing SEI message for the current layer.") + ("SEIDisplayOrientationTransformType", m_doSEITransformType, 0, "specifies the rotation and mirroring to be applied to the picture.") +#endif ("SEIParameterSetsInclusionIndication", m_parameterSetsInclusionIndicationSEIEnabled, false, "Control generation of Parameter sets inclusion indication SEI messages") ("SEISelfContainedClvsFlag", m_selfContainedClvsFlag, 0, "Self contained CLVS indication flag value") ("SEIMasteringDisplayColourVolume", m_masteringDisplay.colourVolumeSEIEnabled, false, "Control generation of mastering display colour volume SEI messages") @@ -3763,6 +3770,13 @@ bool EncAppCfg::xCheckParameter() xConfirmPara(m_framePackingSEIType < 3 || m_framePackingSEIType > 5 , "SEIFramePackingType must be in rage 3 to 5"); } +#if JVET_V0061_SEI + if (m_doSEIEnabled) + { + xConfirmPara(m_doSEITransformType < 0 || m_doSEITransformType > 7, "SEIDisplayOrientationTransformType must be in rage 0 to 7"); + } +#endif + if( m_erpSEIEnabled && !m_erpSEICancelFlag ) { xConfirmPara( m_erpSEIGuardBandType < 0 || m_erpSEIGuardBandType > 8, "SEIEquirectangularprojectionGuardBandType must be in the range of 0 to 7"); diff --git a/source/App/EncoderApp/EncAppCfg.h b/source/App/EncoderApp/EncAppCfg.h index 76eaa2db0c3430821e1646202c9ee04e74e2b35e..e752c0fbe402cb076253862ffa543ae492955b3c 100644 --- a/source/App/EncoderApp/EncAppCfg.h +++ b/source/App/EncoderApp/EncAppCfg.h @@ -513,11 +513,18 @@ protected: int m_framePackingSEIId; int m_framePackingSEIQuincunx; int m_framePackingSEIInterpretation; +#if JVET_V0061_SEI + bool m_doSEIEnabled; + bool m_doSEICancelFlag; + bool m_doSEIPersistenceFlag; + int m_doSEITransformType; +#endif bool m_parameterSetsInclusionIndicationSEIEnabled; int m_selfContainedClvsFlag; #if U0033_ALTERNATIVE_TRANSFER_CHARACTERISTICS_SEI int m_preferredTransferCharacteristics; #endif + // film grain characterstics sei bool m_fgcSEIEnabled; bool m_fgcSEICancelFlag; diff --git a/source/Lib/CommonLib/SEI.cpp b/source/Lib/CommonLib/SEI.cpp index ef10af904e04a42a4e7642452373c936355d177f..62bbe10db02a67a37441b081d35c6cb9e872bec7 100644 --- a/source/Lib/CommonLib/SEI.cpp +++ b/source/Lib/CommonLib/SEI.cpp @@ -161,6 +161,9 @@ const char *SEI::getSEIMessageString(SEI::PayloadType payloadType) case SEI::USER_DATA_UNREGISTERED: return "User data unregistered"; case SEI::FILM_GRAIN_CHARACTERISTICS: return "Film grain characteristics"; // not currently decoded case SEI::FRAME_PACKING: return "Frame packing arrangement"; +#if JVET_V0061_SEI + case SEI::DISPLAY_ORIENTATION: return "Display orientation"; +#endif case SEI::PARAMETER_SETS_INCLUSION_INDICATION: return "Parameter sets inclusion indication"; case SEI::DECODING_UNIT_INFO: return "Decoding unit information"; case SEI::SCALABLE_NESTING: return "Scalable nesting"; diff --git a/source/Lib/CommonLib/SEI.h b/source/Lib/CommonLib/SEI.h index 0c4e03602429756736faa1f2c30512dd852b6362..37dc2ccbb76b1485f2179a146e0b2c0224523e1c 100644 --- a/source/Lib/CommonLib/SEI.h +++ b/source/Lib/CommonLib/SEI.h @@ -61,6 +61,9 @@ public: USER_DATA_UNREGISTERED = 5, FILM_GRAIN_CHARACTERISTICS = 19, FRAME_PACKING = 45, +#if JVET_V0061_SEI + DISPLAY_ORIENTATION = 47, +#endif PARAMETER_SETS_INCLUSION_INDICATION = 129, DECODING_UNIT_INFO = 130, DECODED_PICTURE_HASH = 132, @@ -455,6 +458,21 @@ public: bool m_upsampledAspectRatio; }; +#if JVET_V0061_SEI +class SEIDisplayOrientation : public SEI +{ +public: + PayloadType payloadType() const { return DISPLAY_ORIENTATION; } + + SEIDisplayOrientation() {} + virtual ~SEIDisplayOrientation() {} + + bool m_doCancelFlag; + bool m_doPersistenceFlag; + int m_doTransformType; +}; +#endif + class SEIParameterSetsInclusionIndication : public SEI { public: diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index f878056f520f7adcc4a2e19f2cd6436446bea470..dac0104f785f7c3cfcc50aec4116a907ddc881b7 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -68,7 +68,11 @@ #define JVET_S0078_NOOUTPUTPRIORPICFLAG 0 // JVET-S0078: Handling of NoOutputOfPriorPicsFlag in output process +<<<<<<< HEAD #define JVET_S0117 1 // sub-picture extraction rewriting +======= +#define JVET_V0061_SEI 1 // JVET-V0061 Display orientation SEI message +>>>>>>> 54d76228... Display orientation SEI message //########### place macros to be be kept below this line ############### #define GDR_ENABLED 1 diff --git a/source/Lib/DecoderLib/SEIread.cpp b/source/Lib/DecoderLib/SEIread.cpp index 25fc7cbbfc3339715a1e51dbf49c07fe17635d10..67a1f0685b6500844af811ecf7173346bab3c4d0 100644 --- a/source/Lib/DecoderLib/SEIread.cpp +++ b/source/Lib/DecoderLib/SEIread.cpp @@ -234,6 +234,12 @@ void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType sei = new SEIFramePacking; xParseSEIFramePacking((SEIFramePacking&) *sei, payloadSize, pDecodedMessageOutputStream); break; +#if JVET_V0061_SEI + case SEI::DISPLAY_ORIENTATION: + sei = new SEIDisplayOrientation; + xParseSEIDisplayOrientation((SEIDisplayOrientation&)*sei, payloadSize, pDecodedMessageOutputStream); + break; +#endif case SEI::ANNOTATED_REGIONS: sei = new SEIAnnotatedRegions; xParseSEIAnnotatedRegions((SEIAnnotatedRegions&)*sei, payloadSize, pDecodedMessageOutputStream); @@ -1186,6 +1192,22 @@ void SEIReader::xParseSEIFramePacking(SEIFramePacking& sei, uint32_t payloadSize sei_read_flag( pDecodedMessageOutputStream, val, "fp_upsampled_aspect_ratio_flag" ); sei.m_upsampledAspectRatio = val; } +#if JVET_V0061_SEI +void SEIReader::xParseSEIDisplayOrientation(SEIDisplayOrientation& sei, uint32_t payloadSize, std::ostream* pDecodedMessageOutputStream) +{ + uint32_t val; + output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); + + sei_read_flag(pDecodedMessageOutputStream, val, "display_orientation_cancel_flag"); sei.m_doCancelFlag = val; + if (!sei.m_doCancelFlag) + { + sei_read_flag(pDecodedMessageOutputStream, val, "display_orientation_persistence_flag"); sei.m_doPersistenceFlag = val; + sei_read_code(pDecodedMessageOutputStream, 3, val, "display_orientation_transform_type"); sei.m_doTransformType = val; + CHECK((sei.m_doTransformType < 0) || (sei.m_doTransformType > 7), "Invalid transform type"); + } +} +#endif + void SEIReader::xParseSEIParameterSetsInclusionIndication(SEIParameterSetsInclusionIndication& sei, uint32_t payloadSize, std::ostream* pDecodedMessageOutputStream) { uint32_t val; diff --git a/source/Lib/DecoderLib/SEIread.h b/source/Lib/DecoderLib/SEIread.h index 94cbd7f666ad339228ad1eb6263260657faf86c3..c5a1abbd15b8b0f14593ed0fee43597429338753 100644 --- a/source/Lib/DecoderLib/SEIread.h +++ b/source/Lib/DecoderLib/SEIread.h @@ -69,6 +69,9 @@ protected: void xParseSEIFrameFieldinfo (SEIFrameFieldInfo& sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream); void xParseSEIDependentRAPIndication (SEIDependentRAPIndication& sei, uint32_t payLoadSize, std::ostream *pDecodedMessageOutputStream); void xParseSEIFramePacking (SEIFramePacking& sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream); +#if JVET_V0061_SEI + void xParseSEIDisplayOrientation (SEIDisplayOrientation& sei, uint32_t payloadSize, std::ostream* pDecodedMessageOutputStream); +#endif void xParseSEIParameterSetsInclusionIndication(SEIParameterSetsInclusionIndication& sei, uint32_t payloadSize, std::ostream* pDecodedMessageOutputStream); void xParseSEIMasteringDisplayColourVolume (SEIMasteringDisplayColourVolume& sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream); void xParseSEIAnnotatedRegions (SEIAnnotatedRegions& sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream); diff --git a/source/Lib/EncoderLib/EncCfg.h b/source/Lib/EncoderLib/EncCfg.h index 657288a663e6af3427ce90b4c3d0d2fce29e3c03..a767cb03567243d35cd3ade5d81eff3579295a41 100644 --- a/source/Lib/EncoderLib/EncCfg.h +++ b/source/Lib/EncoderLib/EncCfg.h @@ -547,6 +547,12 @@ protected: int m_framePackingSEIId; int m_framePackingSEIQuincunx; int m_framePackingSEIInterpretation; +#if JVET_V0061_SEI // Display orientation SEI message + bool m_doSEIEnabled; + bool m_doSEICancelFlag; + bool m_doSEIPersistenceFlag; + int m_doSEITransformType; +#endif bool m_parameterSetsInclusionIndicationSEIEnabled; bool m_selfContainedClvsFlag; bool m_bpDeltasGOPStructure; @@ -1564,6 +1570,16 @@ public: int getFramePackingArrangementSEIQuincunx() { return m_framePackingSEIQuincunx; } void setFramePackingArrangementSEIInterpretation(int b) { m_framePackingSEIInterpretation = b; } int getFramePackingArrangementSEIInterpretation() { return m_framePackingSEIInterpretation; } +#if JVET_V0061_SEI + void setDoSEIEnabled(bool b) { m_doSEIEnabled = b; } + bool getDoSEIEnabled() const { return m_doSEIEnabled; } + void setDoSEICancelFlag(bool b) { m_doSEICancelFlag = b; } + bool getDoSEICancelFlag() { return m_doSEICancelFlag; } + void setDoSEIPersistenceFlag(bool b) { m_doSEIPersistenceFlag = b; } + bool getDoSEIPersistenceFlag() { return m_doSEIPersistenceFlag; } + void setDoSEITransformType(const int type) { m_doSEITransformType = type; } + int getDOSEITransformType() const { return m_doSEITransformType; } +#endif void setParameterSetsInclusionIndicationSEIEnabled(bool b) { m_parameterSetsInclusionIndicationSEIEnabled = b; } bool getParameterSetsInclusionIndicationSEIEnabled() const { return m_parameterSetsInclusionIndicationSEIEnabled; } void setSelfContainedClvsFlag(bool b) { m_selfContainedClvsFlag = b; } diff --git a/source/Lib/EncoderLib/SEIwrite.cpp b/source/Lib/EncoderLib/SEIwrite.cpp index a00ca928479c7dacb4ec906a7fc30cafbb1e626f..21dbcc54552ccf7aff598eda7957054905e74c40 100644 --- a/source/Lib/EncoderLib/SEIwrite.cpp +++ b/source/Lib/EncoderLib/SEIwrite.cpp @@ -80,6 +80,11 @@ void SEIWriter::xWriteSEIpayloadData(OutputBitstream &bs, const SEI& sei, HRD &h case SEI::FRAME_PACKING: xWriteSEIFramePacking(*static_cast<const SEIFramePacking*>(&sei)); break; +#if JVET_V0061_SEI + case SEI::DISPLAY_ORIENTATION: + xWriteSEIDisplayOrientation(*static_cast<const SEIDisplayOrientation*>(&sei)); + break; +#endif case SEI::PARAMETER_SETS_INCLUSION_INDICATION: xWriteSEIParameterSetsInclusionIndication(*static_cast<const SEIParameterSetsInclusionIndication*>(&sei)); break; @@ -578,6 +583,20 @@ void SEIWriter::xWriteSEIFramePacking(const SEIFramePacking& sei) } +#if JVET_V0061_SEI +void SEIWriter::xWriteSEIDisplayOrientation(const SEIDisplayOrientation& sei) +{ + WRITE_FLAG(sei.m_doCancelFlag, "display_orientation_cancel_flag"); + + if (sei.m_doCancelFlag == 0) + { + WRITE_FLAG(sei.m_doPersistenceFlag, "display_orientation_persistence_flag"); + WRITE_CODE(sei.m_doTransformType, 3, "display_orientation_transform_type"); + WRITE_CODE(0, 3, "display_orientation_reserved_zero_3bits"); + } +} +#endif + void SEIWriter::xWriteSEIParameterSetsInclusionIndication(const SEIParameterSetsInclusionIndication& sei) { WRITE_FLAG(sei.m_selfContainedClvsFlag, "psii_self_contained_clvs_flag"); diff --git a/source/Lib/EncoderLib/SEIwrite.h b/source/Lib/EncoderLib/SEIwrite.h index ef3f9b4adb01e41d0b83b1c3e4096ea504737bb2..bfda04d992d29614a285304926442d9b0a1d42c3 100644 --- a/source/Lib/EncoderLib/SEIwrite.h +++ b/source/Lib/EncoderLib/SEIwrite.h @@ -61,6 +61,9 @@ protected: void xWriteSEIDependentRAPIndication(const SEIDependentRAPIndication& sei); void xWriteSEIScalableNesting(OutputBitstream& bs, const SEIScalableNesting& sei); void xWriteSEIFramePacking(const SEIFramePacking& sei); +#if JVET_V0061_SEI + void xWriteSEIDisplayOrientation(const SEIDisplayOrientation& sei); +#endif void xWriteSEIParameterSetsInclusionIndication(const SEIParameterSetsInclusionIndication& sei); void xWriteSEIMasteringDisplayColourVolume( const SEIMasteringDisplayColourVolume& sei); #if U0033_ALTERNATIVE_TRANSFER_CHARACTERISTICS_SEI