From e41685f1059ed8036a12296b5a1955f4da99a34d Mon Sep 17 00:00:00 2001 From: Wei Jia <wei.jia@bytedance.com> Date: Fri, 1 Sep 2023 09:49:30 +0000 Subject: [PATCH] JVET-AE0134 item 2: add repeated inference of NNPF for creating pictures corresponding to input pictures at the end of a bitstream or a CLVS under some conditions --- .../SEINeuralNetworkPostFiltering.cpp | 31 +++++++++++++++++++ source/Lib/CommonLib/TypeDef.h | 2 ++ 2 files changed, 33 insertions(+) diff --git a/source/Lib/CommonLib/SEINeuralNetworkPostFiltering.cpp b/source/Lib/CommonLib/SEINeuralNetworkPostFiltering.cpp index 8af36a729..0993bf067 100644 --- a/source/Lib/CommonLib/SEINeuralNetworkPostFiltering.cpp +++ b/source/Lib/CommonLib/SEINeuralNetworkPostFiltering.cpp @@ -367,6 +367,37 @@ void SEINeuralNetworkPostFiltering::checkInputPics( { numInferences = 1 + numPostRoll; } +#if JVET_AE0134_END_REPEATED_INFERENCE + else if (!pictureRateUpsamplingFlag && numInputPics > 1 && nnpfa->m_persistenceFlag) + { + std::vector<int> inpIdx; + greaterThan0count = 0; + numPostRoll = 0; + for (int idx = 0; idx < numInputPics; idx++) + { + if (currNnpfc->m_inputPicOutputFlag[idx]) + { + inpIdx.push_back(idx); + } + } + for (int idx = 0; idx < inpIdx.size(); idx++) + { + if (nnpfa->m_outputFlag[idx]) + { + greaterThan0count++; + if (inpIdx[idx] > 0) + { + numPostRoll = inpIdx[idx]; + } + } + } + numInferences = 1; + if ( greaterThan0count == 1 && (isCurrPicLastInOutputOrder || (currCodedPic == lastPicInClvsInOutputOrder && nnpfa->m_noFollCLVSFlag)) ) + { + numInferences += numPostRoll; + } + } +#endif else { numInferences = 1; diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index 7cd0b9954..5d40cf3ce 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -93,6 +93,8 @@ #define JVET_AE0181_SCALING_WINDOW_ENABLED 1 // JVET-AE0181: Scaling window support +#define JVET_AE0134_END_REPEATED_INFERENCE 1 // JVET_AE0134 item 2: At the end of a bitstream or CLVS, add repeated inference of NNPF for creating pictures corresponding to input pictures + //########### place macros to be be kept below this line ############### #define GDR_ENABLED 1 -- GitLab