From 7d6931af788c2b169339a0209a2622765674ffbc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9E=97=E8=B6=85=E9=80=B8?= <linchaoyi.cy@bytedance.com>
Date: Fri, 9 Jun 2023 10:37:21 +0800
Subject: [PATCH] JVET-AD0091: fix a bug

---
 source/Lib/DecoderLib/SEIread.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/source/Lib/DecoderLib/SEIread.cpp b/source/Lib/DecoderLib/SEIread.cpp
index 095b16a41..61784ebdc 100644
--- a/source/Lib/DecoderLib/SEIread.cpp
+++ b/source/Lib/DecoderLib/SEIread.cpp
@@ -2926,11 +2926,11 @@ void SEIReader::xParseSEINNPostFilterCharacteristics(SEINeuralNetworkPostFilterC
       sei_read_uvlc(pDecodedMessageOutputStream, val, "nnpfc_pic_height_denominator_minus1");
       sei.m_picHeightDenominatorMinus1 = val;
 #if JVET_AD0091
-      int heightRatio = (sei.m_picHeightNumeratorMinus1 + 1) / (sei.m_picHeightDenominatorMinus1 + 1);
-      int widthRatio = (sei.m_picWidthNumeratorMinus1 + 1) / (sei.m_picWidthDenominatorMinus1 + 1);
+      int scaledHeightRatio = 16 * (sei.m_picHeightNumeratorMinus1 + 1) / (sei.m_picHeightDenominatorMinus1 + 1);
+      int scaledWidthRatio = 16 * (sei.m_picWidthNumeratorMinus1 + 1) / (sei.m_picWidthDenominatorMinus1 + 1);
 
-      CHECK((heightRatio >= 1) && (heightRatio <= 16), "The value range of heightRatio shall be in the range of 1 to 16, inclusive");
-      CHECK((widthRatio >= 1) && (widthRatio <= 16), "The value range of heightRatio shall be in the range of 1 to 16, inclusive");
+      CHECK((scaledHeightRatio >= 1) && (scaledHeightRatio <= 256), "The value range of heightRatio shall be in the range of 1/16 to 16, inclusive");
+      CHECK((scaledWidthRatio >= 1) && (scaledWidthRatio <= 256), "The value range of heightRatio shall be in the range of 1/16 to 16, inclusive");
 #endif
 #else
       sei_read_flag(pDecodedMessageOutputStream, val, "nnpfc_pic_width_in_luma_samples");
-- 
GitLab