From a24e06bf0d0bf7e1d498509219c8552983d7460c Mon Sep 17 00:00:00 2001 From: tpoirier Date: Fri, 19 Feb 2021 11:54:39 +0100 Subject: [PATCH 1/2] bugfix parcat: remove duplicate prefix sei for IDR --- source/App/Parcat/parcat.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/source/App/Parcat/parcat.cpp b/source/App/Parcat/parcat.cpp index 5f09f4a11..143afca62 100644 --- a/source/App/Parcat/parcat.cpp +++ b/source/App/Parcat/parcat.cpp @@ -214,6 +214,7 @@ std::vector filter_segment(const std::vector & v, int idx, int int off = 0; int cnt = 0; bool idr_found = false; + bool is_pre_sei_before_idr = true; std::vector out; out.reserve(v.size()); @@ -269,6 +270,11 @@ std::vector filter_segment(const std::vector & v, int idx, int parameterSetManager.storePPS( pps, inp_nalu.getBitstream().getFifo() ); } + if (nalu_type == NAL_UNIT_CODED_SLICE_IDR_W_RADL || nalu_type == NAL_UNIT_CODED_SLICE_IDR_N_LP) + { + is_pre_sei_before_idr = false; + } + if(nalu_type == NAL_UNIT_CODED_SLICE_IDR_W_RADL || nalu_type == NAL_UNIT_CODED_SLICE_IDR_N_LP) { poc = 0; @@ -331,7 +337,8 @@ std::vector filter_segment(const std::vector & v, int idx, int } if ((idx > 1 && (nalu_type == NAL_UNIT_CODED_SLICE_IDR_W_RADL || nalu_type == NAL_UNIT_CODED_SLICE_IDR_N_LP)) || ((idx > 1 && !idr_found) && (nalu_type == NAL_UNIT_OPI || nalu_type == NAL_UNIT_DCI || nalu_type == NAL_UNIT_VPS || nalu_type == NAL_UNIT_SPS || nalu_type == NAL_UNIT_PPS || nalu_type == NAL_UNIT_PREFIX_APS || nalu_type == NAL_UNIT_SUFFIX_APS || nalu_type == NAL_UNIT_PH || nalu_type == NAL_UNIT_ACCESS_UNIT_DELIMITER)) - || (nalu_type == NAL_UNIT_SUFFIX_SEI && skip_next_sei)) + || (nalu_type == NAL_UNIT_SUFFIX_SEI && skip_next_sei) + || (idx > 1 && nalu_type == NAL_UNIT_PREFIX_SEI && is_pre_sei_before_idr)) { } else -- GitLab From 891054f7268db8b1d4453bd685ff2ac88884d789 Mon Sep 17 00:00:00 2001 From: tpoirier Date: Fri, 19 Feb 2021 15:51:11 +0100 Subject: [PATCH 2/2] simplify code --- source/App/Parcat/parcat.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/source/App/Parcat/parcat.cpp b/source/App/Parcat/parcat.cpp index 143afca62..cf1318233 100644 --- a/source/App/Parcat/parcat.cpp +++ b/source/App/Parcat/parcat.cpp @@ -214,7 +214,6 @@ std::vector filter_segment(const std::vector & v, int idx, int int off = 0; int cnt = 0; bool idr_found = false; - bool is_pre_sei_before_idr = true; std::vector out; out.reserve(v.size()); @@ -270,11 +269,6 @@ std::vector filter_segment(const std::vector & v, int idx, int parameterSetManager.storePPS( pps, inp_nalu.getBitstream().getFifo() ); } - if (nalu_type == NAL_UNIT_CODED_SLICE_IDR_W_RADL || nalu_type == NAL_UNIT_CODED_SLICE_IDR_N_LP) - { - is_pre_sei_before_idr = false; - } - if(nalu_type == NAL_UNIT_CODED_SLICE_IDR_W_RADL || nalu_type == NAL_UNIT_CODED_SLICE_IDR_N_LP) { poc = 0; @@ -336,9 +330,8 @@ std::vector filter_segment(const std::vector & v, int idx, int idr_found = true; } if ((idx > 1 && (nalu_type == NAL_UNIT_CODED_SLICE_IDR_W_RADL || nalu_type == NAL_UNIT_CODED_SLICE_IDR_N_LP)) - || ((idx > 1 && !idr_found) && (nalu_type == NAL_UNIT_OPI || nalu_type == NAL_UNIT_DCI || nalu_type == NAL_UNIT_VPS || nalu_type == NAL_UNIT_SPS || nalu_type == NAL_UNIT_PPS || nalu_type == NAL_UNIT_PREFIX_APS || nalu_type == NAL_UNIT_SUFFIX_APS || nalu_type == NAL_UNIT_PH || nalu_type == NAL_UNIT_ACCESS_UNIT_DELIMITER)) - || (nalu_type == NAL_UNIT_SUFFIX_SEI && skip_next_sei) - || (idx > 1 && nalu_type == NAL_UNIT_PREFIX_SEI && is_pre_sei_before_idr)) + || ((idx > 1 && !idr_found) && (nalu_type == NAL_UNIT_OPI || nalu_type == NAL_UNIT_DCI || nalu_type == NAL_UNIT_VPS || nalu_type == NAL_UNIT_SPS || nalu_type == NAL_UNIT_PPS || nalu_type == NAL_UNIT_PREFIX_APS || nalu_type == NAL_UNIT_SUFFIX_APS || nalu_type == NAL_UNIT_PH || nalu_type == NAL_UNIT_ACCESS_UNIT_DELIMITER || nalu_type == NAL_UNIT_PREFIX_SEI)) + || (nalu_type == NAL_UNIT_SUFFIX_SEI && skip_next_sei)) { } else -- GitLab