diff --git a/source/Lib/CommonLib/ContextModelling.h b/source/Lib/CommonLib/ContextModelling.h
index 494efd08c1ea03ce9a0d56e048b12c80bd76c571..73ffe3e91727f16dec98ba7784c6e22a83d87de3 100644
--- a/source/Lib/CommonLib/ContextModelling.h
+++ b/source/Lib/CommonLib/ContextModelling.h
@@ -176,11 +176,24 @@ public:
       {
         sum += abs(pData[2]);
       }
+      else
+      {
+        sum += m_histValue;
+      }
       if (posY < m_height - 1)
       {
         sum += abs(pData[m_width + 1]);
       }
+      else
+      {
+        sum += m_histValue;
+      }
     }
+    else
+    {
+      sum += 2 * m_histValue;
+    }
+
     if (posY < m_height - 1)
     {
       sum += abs(pData[m_width]);
@@ -188,6 +201,14 @@ public:
       {
         sum += abs(pData[m_width << 1]);
       }
+      else
+      {
+        sum += m_histValue;
+      }
+    }
+    else
+    {
+      sum += m_histValue;
     }
     return unsigned(std::max<TCoeff>(std::min<TCoeff>(sum - 5 * baseLevel, 31), 0));
   }