From d8cac14b957e40849027fc3c9ab9e25de941502f Mon Sep 17 00:00:00 2001 From: Karsten Suehring <karsten.suehring@hhi.fraunhofer.de> Date: Wed, 13 May 2020 22:38:10 +0200 Subject: [PATCH] Refactor: rename syntax elements in scalable nesting SEI as in JVET-R2001-v10 - fixes other style issues as well --- .../BitstreamExtractorApp.cpp | 6 +-- source/Lib/CommonLib/SEI.h | 14 +++--- source/Lib/CommonLib/TypeDef.h | 10 ++-- source/Lib/DecoderLib/SEIread.cpp | 47 +++++++++---------- source/Lib/DecoderLib/SEIread.h | 2 +- source/Lib/EncoderLib/SEIEncoder.cpp | 20 ++++---- source/Lib/EncoderLib/SEIwrite.cpp | 22 ++++----- 7 files changed, 59 insertions(+), 62 deletions(-) diff --git a/source/App/BitstreamExtractorApp/BitstreamExtractorApp.cpp b/source/App/BitstreamExtractorApp/BitstreamExtractorApp.cpp index 20df20f47..7f1313ab3 100644 --- a/source/App/BitstreamExtractorApp/BitstreamExtractorApp.cpp +++ b/source/App/BitstreamExtractorApp/BitstreamExtractorApp.cpp @@ -589,12 +589,12 @@ uint32_t BitstreamExtractorApp::decode() if (sei->payloadType() == SEI::SCALABLE_NESTING) { SEIScalableNesting *seiNesting = (SEIScalableNesting *)sei; - if (seiNesting->m_nestingOlsFlag == 1) + if (seiNesting->m_snOlsFlag == 1) { bool targetOlsIdxInNestingAppliedOls = false; - for (uint32_t i = 0; i <= seiNesting->m_nestingNumOlssMinus1; i++) + for (uint32_t i = 0; i <= seiNesting->m_snNumOlssMinus1; i++) { - if (seiNesting->m_nestingOlsIdx[i] == m_targetOlsIdx) + if (seiNesting->m_snOlsIdx[i] == m_targetOlsIdx) { targetOlsIdxInNestingAppliedOls = true; break; diff --git a/source/Lib/CommonLib/SEI.h b/source/Lib/CommonLib/SEI.h index 90451739b..cf110acd3 100644 --- a/source/Lib/CommonLib/SEI.h +++ b/source/Lib/CommonLib/SEI.h @@ -498,13 +498,13 @@ public: deleteSEIs(m_nestedSEIs); } - bool m_nestingOlsFlag; - uint32_t m_nestingNumOlssMinus1; - uint32_t m_nestingOlsIdxDeltaMinus1[MAX_NESTING_NUM_LAYER]; - uint32_t m_nestingOlsIdx[MAX_NESTING_NUM_LAYER]; - bool m_nestingAllLayersFlag; //value valid if m_nestingOlsFlag == 0 - uint32_t m_nestingNumLayersMinus1; //value valid if m_nestingOlsFlag == 0 and m_nestingAllLayersFlag == 0 - uint8_t m_nestingLayerId[MAX_NESTING_NUM_LAYER]; //value valid if m_nestingOlsFlag == 0 and m_nestingAllLayersFlag == 0. This can e.g. be a static array of 64 uint8_t values + bool m_snOlsFlag; + uint32_t m_snNumOlssMinus1; + uint32_t m_snOlsIdxDeltaMinus1[MAX_NESTING_NUM_LAYER]; + uint32_t m_snOlsIdx[MAX_NESTING_NUM_LAYER]; + bool m_snAllLayersFlag; //value valid if m_nestingOlsFlag == 0 + uint32_t m_snNumLayersMinus1; //value valid if m_nestingOlsFlag == 0 and m_nestingAllLayersFlag == 0 + uint8_t m_snLayerId[MAX_NESTING_NUM_LAYER]; //value valid if m_nestingOlsFlag == 0 and m_nestingAllLayersFlag == 0. This can e.g. be a static array of 64 uint8_t values SEIMessages m_nestedSEIs; }; diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index fb6323fe4..8b8ac5ceb 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -144,19 +144,17 @@ #define JVET_R0233_CCALF_LINE_BUFFER_REDUCTION 1 // JVET-R0233 method 2: Line buffer reduction for CCALF #define JVET_Q0471_CHROMA_QT_SPLIT 0 // JVET-Q0471: Chroma QT split, reverted by JVET-R0131 -#define JVET_R0208_ALF_VB_ROUNDING_FIX 1 // JVET-R0208: Rounding offset fix for ALF virtual boundary processing -#define JVET_R0232_CCALF_APS_CONSTRAINT 1 // JVET-R0232 section 3.2: APS contraint for CCALF -#define JVET_R0210_NUMTILESINSLICE_SIGNALLING 1 // JVET-R0210 section 3.3: Don't signal NumTilesInSlice syntax element when numTilesInPic - slice_address is 1. - +#define JVET_R0208_ALF_VB_ROUNDING_FIX 1 // JVET-R0208: Rounding offset fix for ALF virtual boundary processing +#define JVET_R0232_CCALF_APS_CONSTRAINT 1 // JVET-R0232 section 3.2: APS contraint for CCALF +#define JVET_R0210_NUMTILESINSLICE_SIGNALLING 1 // JVET-R0210 section 3.3: Don't signal NumTilesInSlice syntax element when numTilesInPic - slice_address is 1. #define JVET_R0156_ASPECT4_SPS_CLEANUP 1 // JVET-R0071 #1, R0156 #4, R0284 #1: Condition sps_independent_subpics_flag on "sps_num_subpics_minus1 > 0" #define JVET_R0156_ASPECT3_SPS_CLEANUP 1 // Condition sps_sublayer_dpb_params_flag on sps_ptl_dpb_hrd_params_present_flag, in addition to sps_max_sublayer_minus1, JVET-R0156 proposal 3, JVET-R0170, JVET-R0222 proposal 2 - #define JVET_R0350_MIP_CHROMA_444_SINGLETREE 1 // JVET-R0350: MIP for chroma in case of 4:4:4 format and single tree #define JVET_R0347_MTT_SIZE_CONSTRAIN 1 // JVET-R0347: Set upper limit of minQtSize and maxTtSize to 64, set upper limit of maxBtSize to 64 in chroma-tree @@ -167,7 +165,7 @@ #define JVET_R0100 1 // JVET-R0100: Proposal 1 DUI Signalling and inference -#define JVET_R0413_HRD_TIMING_INFORMATION 1 // JVET-R0413: HRD timing parameters signalling +#define JVET_R0413_HRD_TIMING_INFORMATION 1 // JVET-R0413: HRD timing parameters signalling #define JVET_R0214_MMVD_SYNTAX_MODIFICATION 1 // JVET-R0214: MMVD syntax modifications diff --git a/source/Lib/DecoderLib/SEIread.cpp b/source/Lib/DecoderLib/SEIread.cpp index 65056ae9f..91cd67d1a 100644 --- a/source/Lib/DecoderLib/SEIread.cpp +++ b/source/Lib/DecoderLib/SEIread.cpp @@ -457,37 +457,37 @@ void SEIReader::xParseSEIDecodedPictureHash(SEIDecodedPictureHash& sei, uint32_t } -void SEIReader::xParseSEIScalableNesting(SEIScalableNesting& sei, const NalUnitType nalUnitType, const uint32_t nuh_layer_id, uint32_t payloadSize, const VPS *vps, const SPS *sps, std::ostream *pDecodedMessageOutputStream) +void SEIReader::xParseSEIScalableNesting(SEIScalableNesting& sei, const NalUnitType nalUnitType, const uint32_t nuhLayerId, uint32_t payloadSize, const VPS *vps, const SPS *sps, std::ostream *decodedMessageOutputStream) { - uint32_t uiCode; + uint32_t symbol; SEIMessages seis; - output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); + output_sei_message_header(sei, decodedMessageOutputStream, payloadSize); - sei_read_flag(pDecodedMessageOutputStream, uiCode, "nesting_ols_flag"); sei.m_nestingOlsFlag = uiCode; - if (sei.m_nestingOlsFlag) + sei_read_flag(decodedMessageOutputStream, symbol, "sn_ols_flag"); sei.m_snOlsFlag = symbol; + if (sei.m_snOlsFlag) { - sei_read_uvlc(pDecodedMessageOutputStream, uiCode, "nesting_num_olss_minus1"); sei.m_nestingNumOlssMinus1 = uiCode; - for (uint32_t i = 0; i <= sei.m_nestingNumOlssMinus1; i++) + sei_read_uvlc(decodedMessageOutputStream, symbol, "sn_num_olss_minus1"); sei.m_snNumOlssMinus1 = symbol; + for (uint32_t i = 0; i <= sei.m_snNumOlssMinus1; i++) { - sei_read_uvlc(pDecodedMessageOutputStream, uiCode, "nesting_ols_idx_delta_minus1[i]"); sei.m_nestingOlsIdxDeltaMinus1[i] = uiCode; + sei_read_uvlc(decodedMessageOutputStream, symbol, "sn_ols_idx_delta_minus1[i]"); sei.m_snOlsIdxDeltaMinus1[i] = symbol; } - for (uint32_t i = 0; i <= sei.m_nestingNumOlssMinus1; i++) + for (uint32_t i = 0; i <= sei.m_snNumOlssMinus1; i++) { if (i == 0) { - sei.m_nestingOlsIdx[i] = sei.m_nestingOlsIdxDeltaMinus1[i]; + sei.m_snOlsIdx[i] = sei.m_snOlsIdxDeltaMinus1[i]; } else { - sei.m_nestingOlsIdx[i] = sei.m_nestingOlsIdxDeltaMinus1[i] + sei.m_nestingOlsIdxDeltaMinus1[i - 1] + 1; + sei.m_snOlsIdx[i] = sei.m_snOlsIdxDeltaMinus1[i] + sei.m_snOlsIdxDeltaMinus1[i - 1] + 1; } } if (vps && vps->getVPSId() != 0) { uint32_t lowestLayerId = MAX_UINT; - for (uint32_t olsIdxForSEI = 0; olsIdxForSEI <= sei.m_nestingNumOlssMinus1; olsIdxForSEI++) + for (uint32_t olsIdxForSEI = 0; olsIdxForSEI <= sei.m_snNumOlssMinus1; olsIdxForSEI++) { - int olsIdx = sei.m_nestingOlsIdx[olsIdxForSEI]; + int olsIdx = sei.m_snOlsIdx[olsIdxForSEI]; for (int layerIdx = 0; layerIdx < vps->getNumLayersInOls(olsIdx); layerIdx++) { if (lowestLayerId > vps->getLayerIdInOls(olsIdx, layerIdx)) @@ -496,18 +496,18 @@ void SEIReader::xParseSEIScalableNesting(SEIScalableNesting& sei, const NalUnitT } } } - CHECK(lowestLayerId!= nuh_layer_id, "nuh_layer_id is not equal to the lowest layer among Olss that the scalable SEI applies"); + CHECK(lowestLayerId!= nuhLayerId, "nuh_layer_id is not equal to the lowest layer among Olss that the scalable SEI applies"); } } else { - sei_read_flag(pDecodedMessageOutputStream, uiCode, "nesting_all_layers_flag"); sei.m_nestingAllLayersFlag = uiCode; - if (!sei.m_nestingAllLayersFlag) + sei_read_flag(decodedMessageOutputStream, symbol, "sn_all_layers_flag"); sei.m_snAllLayersFlag = symbol; + if (!sei.m_snAllLayersFlag) { - sei_read_uvlc(pDecodedMessageOutputStream, uiCode, "nesting_num_layers_minus1"); sei.m_nestingNumLayersMinus1 = uiCode; - for (uint32_t i = 0; i <= sei.m_nestingNumLayersMinus1; i++) + sei_read_uvlc(decodedMessageOutputStream, symbol, "sn_num_layers_minus1"); sei.m_snNumLayersMinus1 = symbol; + for (uint32_t i = 0; i <= sei.m_snNumLayersMinus1; i++) { - sei_read_code(pDecodedMessageOutputStream, 6, uiCode, "nesting_layer_id[i]"); sei.m_nestingLayerId[i] = uiCode; + sei_read_code(decodedMessageOutputStream, 6, symbol, "sn_layer_id[i]"); sei.m_snLayerId[i] = symbol; } } } @@ -515,8 +515,7 @@ void SEIReader::xParseSEIScalableNesting(SEIScalableNesting& sei, const NalUnitT // byte alignment while (m_pcBitstream->getNumBitsRead() % 8 != 0) { - uint32_t code; - sei_read_flag(pDecodedMessageOutputStream, code, "nesting_zero_bit"); + sei_read_flag(decodedMessageOutputStream, symbol, "sn_zero_bit"); } bool containBPorPTorDUI = false; @@ -537,12 +536,12 @@ void SEIReader::xParseSEIScalableNesting(SEIScalableNesting& sei, const NalUnitT do { HRD hrd; - xReadSEImessage(sei.m_nestedSEIs, nalUnitType, nuh_layer_id, 0, vps, sps, hrd, pDecodedMessageOutputStream); + xReadSEImessage(sei.m_nestedSEIs, nalUnitType, nuhLayerId, 0, vps, sps, hrd, decodedMessageOutputStream); } while (m_pcBitstream->getNumBitsLeft() > 8); - if (pDecodedMessageOutputStream) + if (decodedMessageOutputStream) { - (*pDecodedMessageOutputStream) << "End of scalable nesting SEI message\n"; + (*decodedMessageOutputStream) << "End of scalable nesting SEI message\n"; } } diff --git a/source/Lib/DecoderLib/SEIread.h b/source/Lib/DecoderLib/SEIread.h index 00ca7647c..c02c65b97 100644 --- a/source/Lib/DecoderLib/SEIread.h +++ b/source/Lib/DecoderLib/SEIread.h @@ -64,7 +64,7 @@ protected: void xParseSEIDecodedPictureHash (SEIDecodedPictureHash& sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream); void xParseSEIBufferingPeriod (SEIBufferingPeriod& sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream); void xParseSEIPictureTiming (SEIPictureTiming& sei, uint32_t payloadSize, const uint32_t temporalId, const SEIBufferingPeriod& bp, std::ostream *pDecodedMessageOutputStream); - void xParseSEIScalableNesting (SEIScalableNesting& sei, const NalUnitType nalUnitType, const uint32_t nuh_layer_id, uint32_t payloadSize, const VPS *vps, const SPS *sps, std::ostream *pDecodedMessageOutputStream); + void xParseSEIScalableNesting (SEIScalableNesting& sei, const NalUnitType nalUnitType, const uint32_t nuhLayerId, uint32_t payloadSize, const VPS *vps, const SPS *sps, std::ostream *decodedMessageOutputStream); void xParseSEIFrameFieldinfo (SEIFrameFieldInfo& sei, const SEIPictureTiming& pt, 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); diff --git a/source/Lib/EncoderLib/SEIEncoder.cpp b/source/Lib/EncoderLib/SEIEncoder.cpp index cd9d01806..07013ea25 100644 --- a/source/Lib/EncoderLib/SEIEncoder.cpp +++ b/source/Lib/EncoderLib/SEIEncoder.cpp @@ -393,27 +393,27 @@ void SEIEncoder::initSEIScalableNesting(SEIScalableNesting *scalableNestingSEI, { CHECK(!(m_isInitialized), "Unspecified error"); CHECK(!(scalableNestingSEI != NULL), "Unspecified error"); - scalableNestingSEI->m_nestingOlsFlag = 1; // by If the nested SEI messages are picture buffering SEI messages, picture timing SEI messages or sub-picture timing SEI messages, nesting_ols_flag shall be equal to 1, by default case - scalableNestingSEI->m_nestingNumOlssMinus1 = 1; // by default the nesting scalable SEI message applies to two OLSs. - for (int i = 0; i <= scalableNestingSEI->m_nestingNumOlssMinus1; i++) + scalableNestingSEI->m_snOlsFlag = 1; // by If the nested SEI messages are picture buffering SEI messages, picture timing SEI messages or sub-picture timing SEI messages, nesting_ols_flag shall be equal to 1, by default case + scalableNestingSEI->m_snNumOlssMinus1 = 1; // by default the nesting scalable SEI message applies to two OLSs. + for (int i = 0; i <= scalableNestingSEI->m_snNumOlssMinus1; i++) { - scalableNestingSEI->m_nestingOlsIdxDeltaMinus1[i] = 0; // first ols to which nesting SEI applies is + scalableNestingSEI->m_snOlsIdxDeltaMinus1[i] = 0; // first ols to which nesting SEI applies is } - for (int i = 0; i <= scalableNestingSEI->m_nestingNumOlssMinus1; i++) + for (int i = 0; i <= scalableNestingSEI->m_snNumOlssMinus1; i++) { if (i == 0) { - scalableNestingSEI->m_nestingOlsIdx[i] = scalableNestingSEI->m_nestingOlsIdxDeltaMinus1[i]; + scalableNestingSEI->m_snOlsIdx[i] = scalableNestingSEI->m_snOlsIdxDeltaMinus1[i]; } else { - scalableNestingSEI->m_nestingOlsIdx[i] = scalableNestingSEI->m_nestingOlsIdxDeltaMinus1[i] + scalableNestingSEI->m_nestingOlsIdxDeltaMinus1[i - 1] + 1; + scalableNestingSEI->m_snOlsIdx[i] = scalableNestingSEI->m_snOlsIdxDeltaMinus1[i] + scalableNestingSEI->m_snOlsIdxDeltaMinus1[i - 1] + 1; } } - scalableNestingSEI->m_nestingAllLayersFlag = 1; // nesting is not applied to all layers - scalableNestingSEI->m_nestingNumLayersMinus1 = 2 - 1; //nesting_num_layers_minus1 - scalableNestingSEI->m_nestingLayerId[0] = 0; + scalableNestingSEI->m_snAllLayersFlag = 1; // nesting is not applied to all layers + scalableNestingSEI->m_snNumLayersMinus1 = 2 - 1; //nesting_num_layers_minus1 + scalableNestingSEI->m_snLayerId[0] = 0; scalableNestingSEI->m_nestedSEIs.clear(); for (SEIMessages::iterator it = nestedSEIs.begin(); it != nestedSEIs.end(); it++) diff --git a/source/Lib/EncoderLib/SEIwrite.cpp b/source/Lib/EncoderLib/SEIwrite.cpp index 09ae4a769..8059c317f 100644 --- a/source/Lib/EncoderLib/SEIwrite.cpp +++ b/source/Lib/EncoderLib/SEIwrite.cpp @@ -492,24 +492,24 @@ void SEIWriter::xWriteSEIDependentRAPIndication(const SEIDependentRAPIndication& void SEIWriter::xWriteSEIScalableNesting(OutputBitstream& bs, const SEIScalableNesting& sei, const SPS *sps) { - WRITE_FLAG(sei.m_nestingOlsFlag, "nesting_ols_flag"); - if (sei.m_nestingOlsFlag) + WRITE_FLAG(sei.m_snOlsFlag, "sn_ols_flag"); + if (sei.m_snOlsFlag) { - WRITE_UVLC(sei.m_nestingNumOlssMinus1, "nesting_num_olss_minus1"); - for (uint32_t i = 0; i <= sei.m_nestingNumOlssMinus1; i++) + WRITE_UVLC(sei.m_snNumOlssMinus1, "sn_num_olss_minus1"); + for (uint32_t i = 0; i <= sei.m_snNumOlssMinus1; i++) { - WRITE_UVLC(sei.m_nestingOlsIdxDeltaMinus1[i], "nesting_ols_idx_delta_minus1[i]"); + WRITE_UVLC(sei.m_snOlsIdxDeltaMinus1[i], "sn_ols_idx_delta_minus1[i]"); } } else { - WRITE_FLAG(sei.m_nestingAllLayersFlag, "nesting_all_layers_flag"); - if (!sei.m_nestingAllLayersFlag) + WRITE_FLAG(sei.m_snAllLayersFlag, "sn_all_layers_flag"); + if (!sei.m_snAllLayersFlag) { - WRITE_UVLC(sei.m_nestingNumLayersMinus1, "nesting_num_layers"); - for (uint32_t i = 0; i <= sei.m_nestingNumLayersMinus1; i++) + WRITE_UVLC(sei.m_snNumLayersMinus1, "sn_num_layers"); + for (uint32_t i = 0; i <= sei.m_snNumLayersMinus1; i++) { - WRITE_CODE(sei.m_nestingLayerId[i], 6, "nesting_layer_id"); + WRITE_CODE(sei.m_snLayerId[i], 6, "sn_layer_id"); } } } @@ -517,7 +517,7 @@ void SEIWriter::xWriteSEIScalableNesting(OutputBitstream& bs, const SEIScalableN // byte alignment while (m_pcBitIf->getNumberOfWrittenBits() % 8 != 0) { - WRITE_FLAG(0, "nesting_zero_bit"); + WRITE_FLAG(0, "sn_zero_bit"); } // write nested SEI messages -- GitLab