From 7a87e92ce08a97887123d56165107148e09b944c Mon Sep 17 00:00:00 2001
From: Remy Foray <remy.foray@allegrodvt.com>
Date: Wed, 5 Apr 2023 11:28:28 +0200
Subject: [PATCH] Fix subpictures compliance check on monochrome streams after
 !2541

getChannelTypeScaleX() is called in this case by getWinUnitX()
---
 source/Lib/CommonLib/SequenceParameterSet.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source/Lib/CommonLib/SequenceParameterSet.h b/source/Lib/CommonLib/SequenceParameterSet.h
index 0bd8ac72d..de81bd397 100644
--- a/source/Lib/CommonLib/SequenceParameterSet.h
+++ b/source/Lib/CommonLib/SequenceParameterSet.h
@@ -960,7 +960,7 @@ public:
   void      setScalingMatrixDesignatedColourSpaceFlag(bool b)             { m_scalingMatrixDesignatedColourSpaceFlag = b; }
   bool      getScalingMatrixDesignatedColourSpaceFlag() const             { return m_scalingMatrixDesignatedColourSpaceFlag; }
 
-  static int getWinUnitX(ChromaFormat cf) { return 1 << getChannelTypeScaleX(ChannelType::CHROMA, cf); }
+  static int getWinUnitX(ChromaFormat cf) { return isChromaEnabled(cf) ? 1 << getChannelTypeScaleX(ChannelType::CHROMA, cf) : 1; }
   static int getWinUnitY(ChromaFormat cf) { return 1 << getChannelTypeScaleY(ChannelType::CHROMA, cf); }
 };
 
-- 
GitLab