From 213ec2a8c8deb3544e28ae520c8388d7eb935ae5 Mon Sep 17 00:00:00 2001
From: Nan Hu <nanh@qti.qualcomm.com>
Date: Sun, 21 Oct 2018 18:51:09 -0700
Subject: [PATCH] JVET_L0392_ALF_INIT_STATE: bug fix of initial context state
 for ALF ctb enable flag

---
 source/Lib/CommonLib/Contexts.cpp | 6 ++++++
 source/Lib/CommonLib/TypeDef.h    | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/source/Lib/CommonLib/Contexts.cpp b/source/Lib/CommonLib/Contexts.cpp
index c735ab2d9..05811af8e 100644
--- a/source/Lib/CommonLib/Contexts.cpp
+++ b/source/Lib/CommonLib/Contexts.cpp
@@ -652,9 +652,15 @@ const CtxSet ContextSetCfg::ctbAlfFlag =
 {
   ContextSetCfg::addCtxSet
   ( {
+#if JVET_L0392_ALF_INIT_STATE
+    { 100, 153, 200, 100, 153, 200, 100, 153, 200 },
+    { 100, 153, 200, 100, 153, 200, 100, 153, 200 },
+    { 100, 153, 200, 100, 153, 200, 100, 153, 200 },
+#else
     { 100, 100, 100, 100, 100, 100, 100, 100, 100 },
     { 153, 153, 153, 153, 153, 153, 153, 153, 153 },
     { 200, 200, 200, 200, 200, 200, 200, 200, 200 },
+#endif
     } )
 };
 
diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h
index e8336707e..40c4cacf9 100644
--- a/source/Lib/CommonLib/TypeDef.h
+++ b/source/Lib/CommonLib/TypeDef.h
@@ -50,6 +50,8 @@
 #include <assert.h>
 #include <cassert>
 
+#define JVET_L0392_ALF_INIT_STATE                         1
+
 #define JVET_L0664_ALF_REMOVE_LUMA_5x5                    1
 
 #define JVET_L0083_ALF_FRAC_BIT                           1 // Reduce number of ALF fractional bit to 7   
-- 
GitLab