diff --git a/source/Lib/CommonLib/IntraPrediction.cpp b/source/Lib/CommonLib/IntraPrediction.cpp
index 1bdcb6d727d55c323d3a13dcb7a0bebb4ae2d1fe..70f6f85a4c3f61c24267aeb74998334d3e1f0d21 100644
--- a/source/Lib/CommonLib/IntraPrediction.cpp
+++ b/source/Lib/CommonLib/IntraPrediction.cpp
@@ -11847,10 +11847,15 @@ void IntraPrediction::deriveDimdMode(const CPelBuf &recoBuf, const CompArea &are
       {
         for (int i = lastFilled; i >= 1; i--)
         {
+          CHECK( i < 0, "Wrong index" );
+          CHECK( i >= DIMD_FUSION_NUM - 1, "Wrong index" );
+
           iRatio[i] -=1;
-          cu.dimdRelWeight[Clip3(0, DIMD_FUSION_NUM - 1, i+1)] = iRatio[i];
+          cu.dimdRelWeight[i+1] = iRatio[i];
+
           if (cu.dimdRelWeight[i+1] == 0)
           {
+            CHECK( i < 1, "Wrong index" );
             cu.dimdBlendMode[i-1] = 0;
             countBlendMode--;
           }
@@ -12387,10 +12392,15 @@ void IntraPrediction::deriveDimdModeAdaptive(const CPelBuf &recoBuf, const CompA
       {
         for (int i = lastFilled; i >= 1; i--)
         {
+          CHECK( i < 0, "Wrong index" );
+          CHECK( i >= DIMD_FUSION_NUM - 1, "Wrong index" );
+
           iRatio[i] -=1;
-          cu.dimdRelWeight[Clip3(0, DIMD_FUSION_NUM - 1, i+1)] = iRatio[i];
+          cu.dimdRelWeight[i+1] = iRatio[i];
+
           if (cu.dimdRelWeight[i+1] == 0)
           {
+            CHECK( i < 1, "Wrong index" );
             cu.dimdBlendMode[i-1] = 0;
             countBlendMode--;
           }
diff --git a/source/Lib/CommonLib/IntraPrediction.h b/source/Lib/CommonLib/IntraPrediction.h
index 631ad6dfaa98c17bd5f9a8d4d6f4e353daf58b30..c8d27734cc4ef3dd1ca99257304cbe1e6e7652d9 100644
--- a/source/Lib/CommonLib/IntraPrediction.h
+++ b/source/Lib/CommonLib/IntraPrediction.h
@@ -912,11 +912,11 @@ public:
 #endif
 #if JVET_AH0076_OBIC
   void deriveObicMode             ( const CPelBuf &recoBuf, const CompArea &area, CodingUnit &cu );
-  void generateObicBlending(PelBuf &piPred, const PredictionUnit &pu, PelBuf predFusion[OBIC_FUSION_NUM - 1], bool blendModes[OBIC_FUSION_NUM - 1], int planarIdx);
+  void generateObicBlending       ( PelBuf &piPred, const PredictionUnit &pu, PelBuf predFusion[OBIC_FUSION_NUM - 1], bool blendModes[OBIC_FUSION_NUM - 1], int planarIdx );
 #if JVET_AJ0267_ADAPTIVE_HOG
-  void generateDimdBlending(PelBuf &piPred, const PredictionUnit &pu, PelBuf predFusion[DIMD_FUSION_NUM - 2], PelBuf &plnBlock);
+  void generateDimdBlending       ( PelBuf &piPred, const PredictionUnit &pu, PelBuf predFusion[DIMD_FUSION_NUM - 2], PelBuf &plnBlock );
 #else
-  void generateDimdBlending(PelBuf &piPred, const PredictionUnit &pu, PelBuf &piBlock0, PelBuf &piBlock1, PelBuf &piBlock2, PelBuf &piBlock3, PelBuf &plnBlock);
+  void generateDimdBlending       ( PelBuf &piPred, const PredictionUnit &pu, PelBuf &piBlock0, PelBuf &piBlock1, PelBuf &piBlock2, PelBuf &piBlock3, PelBuf &plnBlock );
 #endif
 #endif
 #if JVET_AB0155_SGPM
diff --git a/source/Lib/EncoderLib/IntraSearch.cpp b/source/Lib/EncoderLib/IntraSearch.cpp
index 2b44a86d836c6cd4dd42b11eff96306314ec6566..7ee0cfdd307946bacde84452335d8e2b1bc7ccba 100644
--- a/source/Lib/EncoderLib/IntraSearch.cpp
+++ b/source/Lib/EncoderLib/IntraSearch.cpp
@@ -2684,6 +2684,23 @@ bool IntraSearch::estIntraPredLumaQT(CodingUnit &cu, Partitioner &partitioner, c
                  PelBuf predBuf(m_intraPredBuf[dimdMode], tmpArea);
 #endif
                   piPred.copyFrom(predBuf);
+#if JVET_AJ0267_ADAPTIVE_HOG
+                  PelBuf predFusion[ DIMD_FUSION_NUM - 2 ];
+                  const UnitArea localUnitArea( pu.chromaFormat, Area( 0, 0, iWidth, iHeight ) );
+                  for( int i = 0; i < DIMD_FUSION_NUM - 2; i++ )
+                  {
+                    predFusion[ i ] = m_tempBuffer[ i + 1 ].getBuf( localUnitArea.Y() );
+#if JVET_AH0209_PDP
+                    dimdMode = cu.dimdBlendMode[ i ] > 0 ? cu.dimdBlendMode[ i ] : PLANAR_IDX;
+                    PelBuf predBufTmp( dimdMode && m_pdpIntraPredReady[ dimdMode ] ? m_pdpIntraPredBuf[ dimdMode ] : m_intraPredBuf[ dimdMode ], tmpArea );
+#else
+                    PelBuf predBufTmp( ( m_intraPredBuf[ cu.dimdBlendMode[ i ] > 0 ? cu.dimdBlendMode[ i ] : PLANAR_IDX ] ), tmpArea );
+#endif
+                    predFusion[ i ].copyFrom( predBufTmp );
+                  }
+                  PelBuf planarBuf( m_intraPredBuf[ PLANAR_IDX ], tmpArea );
+                  generateDimdBlending( piPred, pu, predFusion, planarBuf );
+#else
 #if JVET_AH0209_PDP
                   dimdMode = cu.dimdBlendMode[0] > 0 ? cu.dimdBlendMode[0] : PLANAR_IDX;
                   PelBuf blendBuf0(dimdMode && m_pdpIntraPredReady[dimdMode] ? m_pdpIntraPredBuf[dimdMode] : m_intraPredBuf[dimdMode], tmpArea);
@@ -2702,6 +2719,7 @@ bool IntraSearch::estIntraPredLumaQT(CodingUnit &cu, Partitioner &partitioner, c
                   PelBuf planarBuf(m_intraPredBuf[PLANAR_IDX], tmpArea);
   #endif
                   generateDimdBlending(piPred, pu, blendBuf0, blendBuf1, blendBuf2, blendBuf3, planarBuf);
+#endif
                 }
                 else
                 {