From 3d54dcbefbc2a10ea7cdf3b85fe910b99cbf1334 Mon Sep 17 00:00:00 2001 From: renjiechang <renjiechang@tencent.com> Date: Mon, 29 May 2023 19:51:23 +0800 Subject: [PATCH] move logic to decide the granularity --- source/Lib/DecoderLib/DecLib.cpp | 20 ++++++++++++++++++++ source/Lib/DecoderLib/VLCReader.cpp | 20 -------------------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/source/Lib/DecoderLib/DecLib.cpp b/source/Lib/DecoderLib/DecLib.cpp index c3af03c82b..c9fb454ebd 100644 --- a/source/Lib/DecoderLib/DecLib.cpp +++ b/source/Lib/DecoderLib/DecLib.cpp @@ -1821,6 +1821,26 @@ void DecLib::xActivateParameterSets( const InputNALUnit nalu ) if (sps->getNnlfHopEnabledFlag()) { m_nnfilterHOP.init(m_nnlfHopModelName, pps->getPicWidthInLumaSamples(), pps->getPicHeightInLumaSamples(), sps->getChromaFormatIdc(), sps->getNnlfHopMaxNumPrms()); + + NnlfHopInferGranularity hopInferGranularity = NNLF_HOP_INFER_GRANULARITY_BASE; + if (pSlice->getSliceType() == I_SLICE) + { + hopInferGranularity = NNLF_HOP_INFER_GRANULARITY_LARGE; + } + else if (pSlice->getSliceQp() < 23) + { + hopInferGranularity = NNLF_HOP_INFER_GRANULARITY_BASE; + } + else if (pSlice->getSliceQp() < 29) + { + hopInferGranularity = NNLF_HOP_INFER_GRANULARITY_BASE; + } + else + { + hopInferGranularity = pps->getPicWidthInLumaSamples() <= 832 ? NNLF_HOP_INFER_GRANULARITY_BASE : NNLF_HOP_INFER_GRANULARITY_LARGE; + } + pSlice->setNnlfHopInferGranularity(hopInferGranularity); + m_pcPic->initPicprms(*pSlice); } #endif diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp index 609d494b8c..91fea3b161 100644 --- a/source/Lib/DecoderLib/VLCReader.cpp +++ b/source/Lib/DecoderLib/VLCReader.cpp @@ -4274,26 +4274,6 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par } } pcSlice->setNnlfHopParameters(prm); - - NnlfHopInferGranularity hopInferGranularity = NNLF_HOP_INFER_GRANULARITY_BASE; - if (pcSlice->getSliceType() == I_SLICE) - { - hopInferGranularity = NNLF_HOP_INFER_GRANULARITY_LARGE; - } - else if (pcSlice->getSliceQp() < 23) - { - hopInferGranularity = NNLF_HOP_INFER_GRANULARITY_BASE; - } - else if (pcSlice->getSliceQp() < 29) - { - hopInferGranularity = NNLF_HOP_INFER_GRANULARITY_BASE; - } - else - { - hopInferGranularity = - pps->getPicWidthInLumaSamples() <= 832 ? NNLF_HOP_INFER_GRANULARITY_BASE : NNLF_HOP_INFER_GRANULARITY_LARGE; - } - pcSlice->setNnlfHopInferGranularity(hopInferGranularity); } #endif -- GitLab