Commit e5f71b7a authored by Karsten Suehring's avatar Karsten Suehring
Browse files

Content colour volume SEI


- adds functionality to read/write i(n) type syntax elements
Patch-by: Alexis Tourapis's avatarAlexandros Tourapis <atourapis@apple.com>
parent 33356983
......@@ -1139,6 +1139,24 @@ Bool TAppEncCfg::parseCfg( Int argc, TChar* argv[] )
("SEIPreferredTransferCharacterisics", m_preferredTransferCharacteristics, -1, "Value for the preferred_transfer_characteristics field of the Alternative transfer characteristics SEI which will override the corresponding entry in the VUI. If negative, do not produce the respective SEI message")
("SEIGreenMetadataType", m_greenMetadataType, 0u, "Value for the green_metadata_type specifies the type of metadata that is present in the SEI message. If green_metadata_type is 1, then metadata enabling quality recovery after low-power encoding is present")
("SEIXSDMetricType", m_xsdMetricType, 0u, "Value for the xsd_metric_type indicates the type of the objective quality metric. PSNR is the only type currently supported")
#if CCV_SEI_MESSAGE
("SEICCVEnabled", m_ccvSEIEnabled, false, "Enables the Content Colour Volume SEI message")
("SEICCVCancelFlag", m_ccvSEICancelFlag, true, "Specifies the persistence of any previous content colour volume SEI message in output order.")
("SEICCVPersistenceFlag", m_ccvSEIPersistenceFlag, false, "Specifies the persistence of the content colour volume SEI message for the current layer.")
("SEICCVPrimariesPresent", m_ccvSEIPrimariesPresentFlag, true, "Specifies whether the CCV primaries are present in the content colour volume SEI message.")
("m_ccvSEIPrimariesX0", m_ccvSEIPrimariesX[0], 0.300, "Specifies the x coordinate of the first (green) primary for the content colour volume SEI message")
("m_ccvSEIPrimariesY0", m_ccvSEIPrimariesY[0], 0.600, "Specifies the y coordinate of the first (green) primary for the content colour volume SEI message")
("m_ccvSEIPrimariesX1", m_ccvSEIPrimariesX[1], 0.150, "Specifies the x coordinate of the second (blue) primary for the content colour volume SEI message")
("m_ccvSEIPrimariesY1", m_ccvSEIPrimariesY[1], 0.060, "Specifies the y coordinate of the second (blue) primary for the content colour volume SEI message")
("m_ccvSEIPrimariesX2", m_ccvSEIPrimariesX[2], 0.640, "Specifies the x coordinate of the third (red) primary for the content colour volume SEI message")
("m_ccvSEIPrimariesY2", m_ccvSEIPrimariesY[2], 0.330, "Specifies the y coordinate of the third (red) primary for the content colour volume SEI message")
("SEICCVMinLuminanceValuePresent", m_ccvSEIMinLuminanceValuePresentFlag, true, "Specifies whether the CCV min luminance value is present in the content colour volume SEI message")
("SEICCVMinLuminanceValue", m_ccvSEIMinLuminanceValue, 0.0, "specifies the CCV min luminance value in the content colour volume SEI message")
("SEICCVMaxLuminanceValuePresent", m_ccvSEIMaxLuminanceValuePresentFlag, true, "Specifies whether the CCV max luminance value is present in the content colour volume SEI message")
("SEICCVMaxLuminanceValue", m_ccvSEIMaxLuminanceValue, 0.1, "specifies the CCV max luminance value in the content colour volume SEI message")
("SEICCVAvgLuminanceValuePresent", m_ccvSEIAvgLuminanceValuePresentFlag, true, "Specifies whether the CCV avg luminance value is present in the content colour volume SEI message")
("SEICCVAvgLuminanceValue", m_ccvSEIAvgLuminanceValue, 0.01, "specifies the CCV avg luminance value in the content colour volume SEI message")
#endif
#if ERP_SR_OV_SEI_MESSAGE
("SEIErpEnabled", m_erpSEIEnabled, false, "Control generation of equirectangular projection SEI messages")
("SEIErpCancelFlag", m_erpSEICancelFlag, true, "Indicate that equirectangular projection SEI message cancels the persistence or follows")
......
......@@ -341,6 +341,20 @@ protected:
Int m_preferredTransferCharacteristics;
UInt m_greenMetadataType;
UInt m_xsdMetricType;
#if CCV_SEI_MESSAGE
Bool m_ccvSEIEnabled;
Bool m_ccvSEICancelFlag;
Bool m_ccvSEIPersistenceFlag;
Bool m_ccvSEIPrimariesPresentFlag;
Bool m_ccvSEIMinLuminanceValuePresentFlag;
Bool m_ccvSEIMaxLuminanceValuePresentFlag;
Bool m_ccvSEIAvgLuminanceValuePresentFlag;
Double m_ccvSEIPrimariesX[MAX_NUM_COMPONENT]; // Int(32)
Double m_ccvSEIPrimariesY[MAX_NUM_COMPONENT]; // Int(32)
Double m_ccvSEIMinLuminanceValue; // UInt(32)
Double m_ccvSEIMaxLuminanceValue; // UInt(32)
Double m_ccvSEIAvgLuminanceValue; // UInt(32)
#endif
#if ERP_SR_OV_SEI_MESSAGE
Bool m_erpSEIEnabled;
Bool m_erpSEICancelFlag;
......
......@@ -344,6 +344,26 @@ Void TAppEncTop::xInitLibCfg()
}
m_cTEncTop.setKneeSEIEnabled ( m_kneeSEIEnabled );
m_cTEncTop.setKneeFunctionInformationSEI ( m_kneeFunctionInformationSEI );
#if CCV_SEI_MESSAGE
m_cTEncTop.setCcvSEIEnabled (m_ccvSEIEnabled);
m_cTEncTop.setCcvSEICancelFlag (m_ccvSEICancelFlag);
m_cTEncTop.setCcvSEIPersistenceFlag (m_ccvSEIPersistenceFlag);
m_cTEncTop.setCcvSEIEnabled (m_ccvSEIEnabled);
m_cTEncTop.setCcvSEICancelFlag (m_ccvSEICancelFlag);
m_cTEncTop.setCcvSEIPersistenceFlag (m_ccvSEIPersistenceFlag);
m_cTEncTop.setCcvSEIPrimariesPresentFlag (m_ccvSEIPrimariesPresentFlag);
m_cTEncTop.setCcvSEIMinLuminanceValuePresentFlag (m_ccvSEIMinLuminanceValuePresentFlag);
m_cTEncTop.setCcvSEIMaxLuminanceValuePresentFlag (m_ccvSEIMaxLuminanceValuePresentFlag);
m_cTEncTop.setCcvSEIAvgLuminanceValuePresentFlag (m_ccvSEIAvgLuminanceValuePresentFlag);
for(Int i = 0; i < MAX_NUM_COMPONENT; i++) {
m_cTEncTop.setCcvSEIPrimariesX (m_ccvSEIPrimariesX[i], i);
m_cTEncTop.setCcvSEIPrimariesY (m_ccvSEIPrimariesY[i], i);
}
m_cTEncTop.setCcvSEIMinLuminanceValue (m_ccvSEIMinLuminanceValue);
m_cTEncTop.setCcvSEIMaxLuminanceValue (m_ccvSEIMaxLuminanceValue);
m_cTEncTop.setCcvSEIAvgLuminanceValue (m_ccvSEIAvgLuminanceValue);
#endif
#if ERP_SR_OV_SEI_MESSAGE
m_cTEncTop.setErpSEIEnabled ( m_erpSEIEnabled );
m_cTEncTop.setErpSEICancelFlag ( m_erpSEICancelFlag );
......
......@@ -156,6 +156,9 @@ const TChar *SEI::getSEIMessageString(SEI::PayloadType payloadType)
case SEI::CODED_REGION_COMPLETION: return "Coded region completion";
case SEI::ALTERNATIVE_TRANSFER_CHARACTERISTICS: return "Alternative transfer characteristics";
case SEI::AMBIENT_VIEWING_ENVIRONMENT: return "Ambient viewing environment";
#if CCV_SEI_MESSAGE
case SEI::CONTENT_COLOUR_VOLUME: return "Content Colour Volume";
#endif
#if ERP_SR_OV_SEI_MESSAGE
case SEI::EQUIRECTANGULAR_PROJECTION: return "Equirectangular projection";
case SEI::SPHERE_ROTATION: return "Sphere rotation";
......
......@@ -92,6 +92,9 @@ public:
CODED_REGION_COMPLETION = 146, // TODO: add encoder command line control to create these messages
ALTERNATIVE_TRANSFER_CHARACTERISTICS = 147,
AMBIENT_VIEWING_ENVIRONMENT = 148, // TODO: add encoder command line control to create these messages
#if CCV_SEI_MESSAGE
CONTENT_COLOUR_VOLUME = 149,
#endif
#if ERP_SR_OV_SEI_MESSAGE
EQUIRECTANGULAR_PROJECTION = 150,
SPHERE_ROTATION = 154,
......@@ -754,6 +757,28 @@ public:
std::vector<Int> m_kneeOutputKneePoint;
};
#if CCV_SEI_MESSAGE
class SEIContentColourVolume : public SEI
{
public:
PayloadType payloadType() const { return CONTENT_COLOUR_VOLUME; }
SEIContentColourVolume() {}
virtual ~SEIContentColourVolume() {}
Bool m_ccvCancelFlag;
Bool m_ccvPersistenceFlag;
Bool m_ccvPrimariesPresentFlag;
Bool m_ccvMinLuminanceValuePresentFlag;
Bool m_ccvMaxLuminanceValuePresentFlag;
Bool m_ccvAvgLuminanceValuePresentFlag;
Int m_ccvPrimariesX[MAX_NUM_COMPONENT];
Int m_ccvPrimariesY[MAX_NUM_COMPONENT];
UInt m_ccvMinLuminanceValue;
UInt m_ccvMaxLuminanceValue;
UInt m_ccvAvgLuminanceValue;
};
#endif
#if ERP_SR_OV_SEI_MESSAGE
class SEIEquirectangularProjection : public SEI
{
......
......@@ -94,9 +94,11 @@
#endif
#define MCTS_ENC_CHECK 1 ///< Temporal MCTS encoder constraint and decoder checks. Also requires SEITMCTSTileConstraint to be enabled to enforce constraint
#define CCV_SEI_MESSAGE 1 // Content Colour Volume SEI message
#define RWP_SEI_MESSAGE 1 // region-wise SEI message
#define CMP_SEI_MESSAGE 1 // cubemap projection SEI message
#define ERP_SR_OV_SEI_MESSAGE 1 //equirectangular projection, sphere rotation, and omni viewport SEI message
#define ERP_SR_OV_SEI_MESSAGE 1 // equirectangular projection, sphere rotation, and omni viewport SEI message
// ====================================================================================================================
// Tool Switches
// ====================================================================================================================
......
......@@ -62,6 +62,17 @@ Void xTraceSEIMessageType(SEI::PayloadType payloadType)
}
#endif
#if CCV_SEI_MESSAGE
Void SEIReader::sei_read_scode(std::ostream *pOS, UInt uiLength, Int& ruiCode, const TChar *pSymbolName)
{
READ_SCODE(uiLength, ruiCode, pSymbolName);
if (pOS)
{
(*pOS) << " " << std::setw(55) << pSymbolName << ": " << ruiCode << "\n";
}
}
#endif
Void SEIReader::sei_read_code(std::ostream *pOS, UInt uiLength, UInt& ruiCode, const TChar *pSymbolName)
{
READ_CODE(uiLength, ruiCode, pSymbolName);
......@@ -107,6 +118,7 @@ static inline Void output_sei_message_header(SEI &sei, std::ostream *pDecodedMes
}
}
#undef READ_SCODE
#undef READ_CODE
#undef READ_SVLC
#undef READ_UVLC
......@@ -350,6 +362,12 @@ Void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType
sei = new SEIAmbientViewingEnvironment;
xParseSEIAmbientViewingEnvironment((SEIAmbientViewingEnvironment&) *sei, payloadSize, pDecodedMessageOutputStream);
break;
#if CCV_SEI_MESSAGE
case SEI::CONTENT_COLOUR_VOLUME:
sei = new SEIContentColourVolume;
xParseSEIContentColourVolume((SEIContentColourVolume&) *sei, payloadSize, pDecodedMessageOutputStream);
break;
#endif
#if ERP_SR_OV_SEI_MESSAGE
case SEI::EQUIRECTANGULAR_PROJECTION:
sei = new SEIEquirectangularProjection;
......@@ -1409,6 +1427,47 @@ Void SEIReader::xParseSEIKneeFunctionInfo(SEIKneeFunctionInfo& sei, UInt payload
}
}
#if CCV_SEI_MESSAGE
Void SEIReader::xParseSEIContentColourVolume(SEIContentColourVolume& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
{
Int i;
UInt val;
output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
sei_read_flag( pDecodedMessageOutputStream, val, "ccv_cancel_flag" ); sei.m_ccvCancelFlag = val;
if ( !sei.m_ccvCancelFlag )
{
Int iVal;
sei_read_flag( pDecodedMessageOutputStream, val, "ccv_persistence_flag" ); sei.m_ccvPersistenceFlag = val;
sei_read_flag( pDecodedMessageOutputStream, val, "ccv_primaries_present_flag" ); sei.m_ccvPrimariesPresentFlag = val;
sei_read_flag( pDecodedMessageOutputStream, val, "ccv_min_luminance_value_present_flag" ); sei.m_ccvMinLuminanceValuePresentFlag = val;
sei_read_flag( pDecodedMessageOutputStream, val, "ccv_max_luminance_value_present_flag" ); sei.m_ccvMaxLuminanceValuePresentFlag = val;
sei_read_flag( pDecodedMessageOutputStream, val, "ccv_avg_luminance_value_present_flag" ); sei.m_ccvAvgLuminanceValuePresentFlag = val;
if (sei.m_ccvPrimariesPresentFlag)
{
for (i = 0; i < MAX_NUM_COMPONENT; i++)
{
sei_read_scode( pDecodedMessageOutputStream, 32, iVal, "ccv_primaries_x[i]" ); sei.m_ccvPrimariesX[i] = iVal;
sei_read_scode( pDecodedMessageOutputStream, 32, iVal, "ccv_primaries_y[i]" ); sei.m_ccvPrimariesY[i] = iVal;
}
}
if (sei.m_ccvMinLuminanceValuePresentFlag)
{
sei_read_code( pDecodedMessageOutputStream, 32, val, "ccv_min_luminance_value" ); sei.m_ccvMinLuminanceValue = val;
}
if (sei.m_ccvMaxLuminanceValuePresentFlag)
{
sei_read_code( pDecodedMessageOutputStream, 32, val, "ccv_max_luminance_value" ); sei.m_ccvMaxLuminanceValue = val;
}
if (sei.m_ccvAvgLuminanceValuePresentFlag)
{
sei_read_code( pDecodedMessageOutputStream, 32, val, "ccv_avg_luminance_value" ); sei.m_ccvAvgLuminanceValue = val;
}
}
}
#endif
#if ERP_SR_OV_SEI_MESSAGE
Void SEIReader::xParseSEIEquirectangularProjection(SEIEquirectangularProjection& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
{
......
......@@ -90,6 +90,9 @@ protected:
Void xParseSEITempMotionConstraintsTileSets (SEITempMotionConstrainedTileSets& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
Void xParseSEIChromaResamplingFilterHint (SEIChromaResamplingFilterHint& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
Void xParseSEIKneeFunctionInfo (SEIKneeFunctionInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
#if CCV_SEI_MESSAGE
Void xParseSEIContentColourVolume (SEIContentColourVolume& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
#endif
#if ERP_SR_OV_SEI_MESSAGE
Void xParseSEIEquirectangularProjection (SEIEquirectangularProjection &sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
Void xParseSEISphereRotation (SEISphereRotation &sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
......@@ -99,7 +102,7 @@ protected:
Void xParseSEICubemapProjection (SEICubemapProjection& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
#endif
#if RWP_SEI_MESSAGE
Void xParseSEIRegionWisePacking (SEIRegionWisePacking& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
Void xParseSEIRegionWisePacking (SEIRegionWisePacking& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
#endif
Void xParseSEIColourRemappingInfo (SEIColourRemappingInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
Void xParseSEIDeinterlaceFieldIdentification(SEIDeinterlaceFieldIdentification& sei,UInt payLoadSize, std::ostream *pDecodedMessageOutputStream);
......@@ -109,6 +112,9 @@ protected:
Void xParseSEIAlternativeTransferCharacteristics(SEIAlternativeTransferCharacteristics& sei, UInt payLoadSize, std::ostream *pDecodedMessageOutputStream);
Void xParseSEIAmbientViewingEnvironment (SEIAmbientViewingEnvironment& sei, UInt payLoadSize, std::ostream *pDecodedMessageOutputStream);
#if CCV_SEI_MESSAGE
Void sei_read_scode(std::ostream *pOS, UInt uiLength, Int& ruiCode, const TChar *pSymbolName);
#endif
Void sei_read_code(std::ostream *pOS, UInt uiLength, UInt& ruiCode, const TChar *pSymbolName);
Void sei_read_uvlc(std::ostream *pOS, UInt& ruiCode, const TChar *pSymbolName);
Void sei_read_svlc(std::ostream *pOS, Int& ruiCode, const TChar *pSymbolName);
......
......@@ -63,6 +63,15 @@ Void xTraceFillerData ()
#if DECODER_PARTIAL_CONFORMANCE_CHECK!=0
#if CCV_SEI_MESSAGE
Void SyntaxElementParser::xReadSCodeChk ( UInt length, Int& val, const TChar *pSymbolName, const Int minValIncl, const Int maxValIncl )
{
READ_SCODE(length, val, pSymbolName);
TDecConformanceCheck::checkRange(val, pSymbolName, minValIncl, maxValIncl);
}
#endif
Void SyntaxElementParser::xReadCodeChk ( UInt length, UInt& val, const TChar *pSymbolName, const UInt minValIncl, const UInt maxValIncl )
{
READ_CODE(length, val, pSymbolName);
......@@ -91,6 +100,44 @@ Void SyntaxElementParser::xReadFlagChk ( UInt& val, const TChar *pSymbolName, c
// ====================================================================================================================
// Protected member functions
// ====================================================================================================================
#if CCV_SEI_MESSAGE
#if RExt__DECODER_DEBUG_BIT_STATISTICS || ENC_DEC_TRACE
Void SyntaxElementParser::xReadSCode (UInt uiLength, Int& rValue, const TChar *pSymbolName)
#else
Void SyntaxElementParser::xReadSCode (UInt uiLength, Int& rValue)
#endif
{
UInt val;
assert ( uiLength > 0 );
m_pcBitstream->read (uiLength, val);
if((val & (1 << (uiLength-1))) == 0)
{
rValue = val;
}
else
{
val &= (1<< (uiLength-1)) - 1;
rValue = ~val + 1;
}
#if RExt__DECODER_DEBUG_BIT_STATISTICS
TComCodingStatistics::IncrementStatisticEP(pSymbolName, uiLength, rValue);
#endif
#if ENC_DEC_TRACE
fprintf( g_hTrace, "%8lld ", g_nSymbolCounter++ );
if (uiLength < 10)
{
fprintf( g_hTrace, "%-50s i(%d) : %d\n", pSymbolName, uiLength, rValue );
}
else
{
fprintf( g_hTrace, "%-50s i(%d) : %d\n", pSymbolName, uiLength, rValue );
}
fflush ( g_hTrace );
#endif
}
#endif
#if RExt__DECODER_DEBUG_BIT_STATISTICS || ENC_DEC_TRACE
Void SyntaxElementParser::xReadCode (UInt uiLength, UInt& rValue, const TChar *pSymbolName)
#else
......
......@@ -46,34 +46,49 @@
#include "TDecConformance.h"
#if DECODER_PARTIAL_CONFORMANCE_CHECK!=0
#define READ_CODE_CHK(length, code, name, minValIncl, maxValIncl) xReadCodeChk ( length, code, name, minValIncl, maxValIncl )
#define READ_UVLC_CHK( code, name, minValIncl, maxValIncl) xReadUvlcChk ( code, name, minValIncl, maxValIncl )
#define READ_SVLC_CHK( code, name, minValIncl, maxValIncl) xReadSvlcChk ( code, name, minValIncl, maxValIncl )
#define READ_FLAG_CHK( code, name, minValIncl, maxValIncl) xReadFlagChk ( code, name, minValIncl, maxValIncl )
#if CCV_SEI_MESSAGE
#define READ_SCODE_CHK(length, code, name, minValIncl, maxValIncl) xReadSCodeChk ( length, code, name, minValIncl, maxValIncl )
#endif
#define READ_CODE_CHK(length, code, name, minValIncl, maxValIncl) xReadCodeChk ( length, code, name, minValIncl, maxValIncl )
#define READ_UVLC_CHK( code, name, minValIncl, maxValIncl) xReadUvlcChk ( code, name, minValIncl, maxValIncl )
#define READ_SVLC_CHK( code, name, minValIncl, maxValIncl) xReadSvlcChk ( code, name, minValIncl, maxValIncl )
#define READ_FLAG_CHK( code, name, minValIncl, maxValIncl) xReadFlagChk ( code, name, minValIncl, maxValIncl )
#elif RExt__DECODER_DEBUG_BIT_STATISTICS || ENC_DEC_TRACE
#define READ_CODE_CHK(length, code, name, minValIncl, maxValIncl) xReadCode ( length, code, name )
#define READ_UVLC_CHK( code, name, minValIncl, maxValIncl) xReadUvlc ( code, name )
#define READ_SVLC_CHK( code, name, minValIncl, maxValIncl) xReadSvlc ( code, name )
#define READ_FLAG_CHK( code, name, minValIncl, maxValIncl) xReadFlag ( code, name )
#if CCV_SEI_MESSAGE
#define READ_SCODE_CHK(length, code, name, minValIncl, maxValIncl) xReadSCode ( length, code, name )
#endif
#define READ_CODE_CHK(length, code, name, minValIncl, maxValIncl) xReadCode ( length, code, name )
#define READ_UVLC_CHK( code, name, minValIncl, maxValIncl) xReadUvlc ( code, name )
#define READ_SVLC_CHK( code, name, minValIncl, maxValIncl) xReadSvlc ( code, name )
#define READ_FLAG_CHK( code, name, minValIncl, maxValIncl) xReadFlag ( code, name )
#else
#define READ_CODE_CHK(length, code, name, minValIncl, maxValIncl) xReadCode ( length, code )
#define READ_UVLC_CHK( code, name, minValIncl, maxValIncl) xReadUvlc ( code )
#define READ_SVLC_CHK( code, name, minValIncl, maxValIncl) xReadSvlc ( code )
#define READ_FLAG_CHK( code, name, minValIncl, maxValIncl) xReadFlag ( code )
#if CCV_SEI_MESSAGE
#define READ_SCODE_CHK(length, code, name, minValIncl, maxValIncl) xReadSCode ( length, code )
#endif
#define READ_CODE_CHK(length, code, name, minValIncl, maxValIncl) xReadCode ( length, code )
#define READ_UVLC_CHK( code, name, minValIncl, maxValIncl) xReadUvlc ( code )
#define READ_SVLC_CHK( code, name, minValIncl, maxValIncl) xReadSvlc ( code )
#define READ_FLAG_CHK( code, name, minValIncl, maxValIncl) xReadFlag ( code )
#endif
#if RExt__DECODER_DEBUG_BIT_STATISTICS || ENC_DEC_TRACE
#define READ_CODE(length, code, name) xReadCode ( length, code, name )
#define READ_UVLC( code, name) xReadUvlc ( code, name )
#define READ_SVLC( code, name) xReadSvlc ( code, name )
#define READ_FLAG( code, name) xReadFlag ( code, name )
#if CCV_SEI_MESSAGE
#define READ_SCODE(length, code, name) xReadSCode ( length, code, name )
#endif
#define READ_CODE(length, code, name) xReadCode ( length, code, name )
#define READ_UVLC( code, name) xReadUvlc ( code, name )
#define READ_SVLC( code, name) xReadSvlc ( code, name )
#define READ_FLAG( code, name) xReadFlag ( code, name )
#else
#define READ_CODE(length, code, name) xReadCode ( length, code )
#define READ_UVLC( code, name) xReadUvlc ( code )
#define READ_SVLC( code, name) xReadSvlc ( code )
#define READ_FLAG( code, name) xReadFlag ( code )
#if CCV_SEI_MESSAGE
#define READ_SCODE(length, code, name) xReadSCode ( length, code )
#endif
#define READ_CODE(length, code, name) xReadCode ( length, code )
#define READ_UVLC( code, name) xReadUvlc ( code )
#define READ_SVLC( code, name) xReadSvlc ( code )
#define READ_FLAG( code, name) xReadFlag ( code )
#endif
......@@ -95,18 +110,27 @@ protected:
virtual ~SyntaxElementParser() {};
#if DECODER_PARTIAL_CONFORMANCE_CHECK!=0
Void xReadCodeChk ( UInt length, UInt& val, const TChar *pSymbolName, const UInt minValIncl, const UInt maxValIncl );
Void xReadUvlcChk ( UInt& val, const TChar *pSymbolName, const UInt minValIncl, const UInt maxValIncl );
Void xReadSvlcChk ( Int& val, const TChar *pSymbolName, const Int minValIncl, const Int maxValIncl );
Void xReadFlagChk ( UInt& val, const TChar *pSymbolName, const UInt minValIncl, const UInt maxValIncl );
#if CCV_SEI_MESSAGE
Void xReadSCodeChk ( UInt length, Int& val, const TChar *pSymbolName, const Int minValIncl, const Int maxValIncl );
#endif
Void xReadCodeChk ( UInt length, UInt& val, const TChar *pSymbolName, const UInt minValIncl, const UInt maxValIncl );
Void xReadUvlcChk ( UInt& val, const TChar *pSymbolName, const UInt minValIncl, const UInt maxValIncl );
Void xReadSvlcChk ( Int& val, const TChar *pSymbolName, const Int minValIncl, const Int maxValIncl );
Void xReadFlagChk ( UInt& val, const TChar *pSymbolName, const UInt minValIncl, const UInt maxValIncl );
#endif
#if RExt__DECODER_DEBUG_BIT_STATISTICS || ENC_DEC_TRACE
#if CCV_SEI_MESSAGE
Void xReadSCode ( UInt length, Int& val, const TChar *pSymbolName );
#endif
Void xReadCode ( UInt length, UInt& val, const TChar *pSymbolName );
Void xReadUvlc ( UInt& val, const TChar *pSymbolName );
Void xReadSvlc ( Int& val, const TChar *pSymbolName );
Void xReadFlag ( UInt& val, const TChar *pSymbolName );
#else
#if CCV_SEI_MESSAGE
Void xReadSCode ( UInt length, Int& val );
#endif
Void xReadCode ( UInt length, UInt& val );
Void xReadUvlc ( UInt& val );
Void xReadSvlc ( Int& val );
......
......@@ -207,9 +207,9 @@ Void TDecCavlc::parsePPS(TComPPS* pcPPS)
READ_CODE(3, uiCode, "num_extra_slice_header_bits"); pcPPS->setNumExtraSliceHeaderBits(uiCode);
READ_FLAG ( uiCode, "sign_data_hiding_enabled_flag" ); pcPPS->setSignDataHidingEnabledFlag( uiCode );
READ_FLAG( uiCode, "sign_data_hiding_enabled_flag" ); pcPPS->setSignDataHidingEnabledFlag( uiCode );
READ_FLAG( uiCode, "cabac_init_present_flag" ); pcPPS->setCabacInitPresentFlag( uiCode ? true : false );
READ_FLAG( uiCode, "cabac_init_present_flag" ); pcPPS->setCabacInitPresentFlag( uiCode ? true : false );
READ_UVLC_CHK(uiCode, "num_ref_idx_l0_default_active_minus1", 0, 14);
assert(uiCode <= 14);
......
......@@ -413,6 +413,44 @@ Void SEIEncoder::initSEIKneeFunctionInfo(SEIKneeFunctionInfo *seiKneeFunctionInf
}
}
}
#if CCV_SEI_MESSAGE
Void SEIEncoder::initSEIContentColourVolume(SEIContentColourVolume *seiContentColourVolume)
{
assert(m_isInitialized);
assert(seiContentColourVolume != NULL);
seiContentColourVolume->m_ccvCancelFlag = m_pcCfg->getCcvSEICancelFlag();
seiContentColourVolume->m_ccvPersistenceFlag = m_pcCfg->getCcvSEIPersistenceFlag();
seiContentColourVolume->m_ccvPrimariesPresentFlag = m_pcCfg->getCcvSEIPrimariesPresentFlag();
seiContentColourVolume->m_ccvMinLuminanceValuePresentFlag = m_pcCfg->getCcvSEIMinLuminanceValuePresentFlag();
seiContentColourVolume->m_ccvMaxLuminanceValuePresentFlag = m_pcCfg->getCcvSEIMaxLuminanceValuePresentFlag();
seiContentColourVolume->m_ccvAvgLuminanceValuePresentFlag = m_pcCfg->getCcvSEIAvgLuminanceValuePresentFlag();
// Currently we are using a floor operation for setting up the "integer" values for this SEI.
// This applies to both primaries and luminance limits.
if (seiContentColourVolume->m_ccvPrimariesPresentFlag == true)
{
for (Int i = 0; i < MAX_NUM_COMPONENT; i++)
{
seiContentColourVolume->m_ccvPrimariesX[i] = (Int) (50000.0 * m_pcCfg->getCcvSEIPrimariesX(i));
seiContentColourVolume->m_ccvPrimariesY[i] = (Int) (50000.0 * m_pcCfg->getCcvSEIPrimariesY(i));
}
}
if (seiContentColourVolume->m_ccvMinLuminanceValuePresentFlag == true)
{
seiContentColourVolume->m_ccvMinLuminanceValue = (Int) (10000000 * m_pcCfg->getCcvSEIMinLuminanceValue());
}
if (seiContentColourVolume->m_ccvMaxLuminanceValuePresentFlag == true)
{
seiContentColourVolume->m_ccvMaxLuminanceValue = (Int) (10000000 * m_pcCfg->getCcvSEIMaxLuminanceValue());
}
if (seiContentColourVolume->m_ccvAvgLuminanceValuePresentFlag == true)
{
seiContentColourVolume->m_ccvAvgLuminanceValue = (Int) (10000000 * m_pcCfg->getCcvSEIAvgLuminanceValue());
}
}
#endif
#if ERP_SR_OV_SEI_MESSAGE
Void SEIEncoder::initSEIErp(SEIEquirectangularProjection* seiEquirectangularProjection)
......
......@@ -78,6 +78,9 @@ public:
Void initSEISegmentedRectFramePacking(SEISegmentedRectFramePacking *sei);
Void initSEITempMotionConstrainedTileSets (SEITempMotionConstrainedTileSets *sei, const TComPPS *pps);
Void initSEIKneeFunctionInfo(SEIKneeFunctionInfo *sei);
#if CCV_SEI_MESSAGE
Void initSEIContentColourVolume(SEIContentColourVolume *sei);
#endif
#if ERP_SR_OV_SEI_MESSAGE
Void initSEIErp(SEIEquirectangularProjection *sei);
Void initSEISphereRotation(SEISphereRotation *sei);
......
......@@ -171,6 +171,11 @@ Void SEIWriter::xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, const TComSP
case SEI::AMBIENT_VIEWING_ENVIRONMENT:
xWriteSEIAmbientViewingEnvironment(*static_cast<const SEIAmbientViewingEnvironment*>(&sei));
break;
#if CCV_SEI_MESSAGE
case SEI::CONTENT_COLOUR_VOLUME:
xWriteSEIContentColourVolume(*static_cast<const SEIContentColourVolume*>(&sei));
break;
#endif
#if ERP_SR_OV_SEI_MESSAGE
case SEI::EQUIRECTANGULAR_PROJECTION:
xWriteSEIEquirectangularProjection(*static_cast<const SEIEquirectangularProjection*>(&sei));
......@@ -987,6 +992,44 @@ Void SEIWriter::xWriteSEIKneeFunctionInfo(const SEIKneeFunctionInfo &sei)
}
}
}
#if CCV_SEI_MESSAGE
Void SEIWriter::xWriteSEIContentColourVolume(const SEIContentColourVolume &sei)
{
WRITE_FLAG(sei.m_ccvCancelFlag, "ccv_cancel_flag");
if (!sei.m_ccvCancelFlag)
{
WRITE_FLAG(sei.m_ccvPersistenceFlag, "ccv_persistence_flag");
WRITE_FLAG(sei.m_ccvPrimariesPresentFlag, "ccv_primaries_present_flag");
WRITE_FLAG(sei.m_ccvMinLuminanceValuePresentFlag, "ccv_min_luminance_value_present_flag");
WRITE_FLAG(sei.m_ccvMaxLuminanceValuePresentFlag, "ccv_max_luminance_value_present_flag");
WRITE_FLAG(sei.m_ccvAvgLuminanceValuePresentFlag, "ccv_avg_luminance_value_present_flag");
if (sei.m_ccvPrimariesPresentFlag == true)
{
for (Int i = 0; i < MAX_NUM_COMPONENT; i++)
{
WRITE_SCODE((Int) sei.m_ccvPrimariesX[i], 32, "ccv_primaries_x[i]");
WRITE_SCODE((Int) sei.m_ccvPrimariesY[i], 32, "ccv_primaries_y[i]");
}
}
if (sei.m_ccvMinLuminanceValuePresentFlag == true)
{
WRITE_CODE( (UInt)sei.m_ccvMinLuminanceValue, 32, "ccv_min_luminance_value" );
}
if (sei.m_ccvMinLuminanceValuePresentFlag == true)
{
WRITE_CODE( (UInt)sei.m_ccvMaxLuminanceValue, 32, "ccv_max_luminance_value" );
}
if (sei.m_ccvMinLuminanceValuePresentFlag == true)
{
WRITE_CODE( (UInt)sei.m_ccvAvgLuminanceValue, 32, "ccv_avg_luminance_value" );
}
}
}
#endif
#if ERP_SR_OV_SEI_MESSAGE
Void SEIWriter::xWriteSEIEquirectangularProjection(const SEIEquirectangularProjection &sei)
{
......
......@@ -83,16 +83,19 @@ protected:
Void xWriteSEITempMotionConstrainedTileSets (const SEITempMotionConstrainedTileSets& sei);
Void xWriteSEIChromaResamplingFilterHint (const SEIChromaResamplingFilterHint& sei);
Void xWriteSEIKneeFunctionInfo (const SEIKneeFunctionInfo &sei);
#if CCV_SEI_MESSAGE
Void xWriteSEIContentColourVolume (const SEIContentColourVolume &sei);
#endif
#if ERP_SR_OV_SEI_MESSAGE
Void xWriteSEIEquirectangularProjection (const SEIEquirectangularProjection &sei);
Void xWriteSEISphereRotation (const SEISphereRotation &sei);
Void xWriteSEIOmniViewport (const SEIOmniViewport& sei);
#endif
#if CMP_SEI_MESSAGE
Void xWriteSEICubemapProjection(const SEICubemapProjection &sei);
Void xWriteSEICubemapProjection (const SEICubemapProjection &sei);
#endif
#if RWP_SEI_MESSAGE
Void xWriteSEIRegionWisePacking(const SEIRegionWisePacking &sei);
Void xWriteSEIRegionWisePacking (const SEIRegionWisePacking &sei);
#endif
Void xWriteSEIColourRemappingInfo (const SEIColourRemappingInfo& sei);
Void xWriteSEIDeinterlaceFieldIdentification (const SEIDeinterlaceFieldIdentification& sei);
......
......@@ -43,6 +43,25 @@
#if ENC_DEC_TRACE
#if CCV_SEI_MESSAGE
Void SyntaxElementWriter::xWriteSCodeTr (Int value, UInt length, const TChar *pSymbolName)
{
xWriteSCode (value,length);
if( g_HLSTraceEnable )
{
fprintf( g_hTrace, "%8lld ", g_nSymbolCounter++ );
if( length<10 )
{
fprintf( g_hTrace, "%-50s u(%d) : %d\n", pSymbolName, length, value );
}
else
{
fprintf( g_hTrace, "%-50s u(%d) : %d\n", pSymbolName, length, value );
}
}
}