diff --git a/source/Lib/CommonLib/AdaptiveLoopFilter.cpp b/source/Lib/CommonLib/AdaptiveLoopFilter.cpp
index 8dfc27f0..3bef8af1 100644
--- a/source/Lib/CommonLib/AdaptiveLoopFilter.cpp
+++ b/source/Lib/CommonLib/AdaptiveLoopFilter.cpp
@@ -84,6 +84,9 @@ AdaptiveLoopFilter::AdaptiveLoopFilter()
     m_ctuEnableFlag[compIdx] = nullptr;
     m_ctuAlternative[compIdx] = nullptr;
   }
+#if JVET_AA_EE2_5_1
+  m_ctuEnableOnlineLumaFlag = nullptr;
+#endif
   m_filterCcAlf = filterBlkCcAlf<CC_ALF>;
   m_filter5x5Blk = filterBlk<ALF_FILTER_5>;
   m_filter7x7Blk = filterBlk<ALF_FILTER_7>;
@@ -489,6 +492,10 @@ void AdaptiveLoopFilter::ALFProcess(CodingStructure& cs)
 #if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF
   PelUnitBuf tmpYuvBeforeDb = m_tempBufBeforeDb.getBuf(cs.area);
   tmpYuvBeforeDb.extendBorderPel(NUM_DB_PAD);
+#endif
+#if JVET_AA_EE2_5_1
+  m_isFixedFilterPaddedPerCtu = cs.picHeader->getVirtualBoundariesPresentFlag() || cs.slice->getCuQpDeltaSubdiv();
+  memset(m_ctuEnableOnlineLumaFlag, 0, sizeof(uint8_t) * m_numCTUsInPic);
 #endif
   const PreCalcValues& pcv = *cs.pcv;
 
@@ -608,6 +615,13 @@ void AdaptiveLoopFilter::ALFProcess(CodingStructure& cs)
                 coeff = m_coeffApsLuma[filterSetIndex - NUM_FIXED_FILTER_SETS][alt_num];
                 clip = m_clippApsLuma[filterSetIndex - NUM_FIXED_FILTER_SETS][alt_num];
                 AlfFilterType filterTypeCtb = m_filterTypeApsLuma[filterSetIndex - NUM_FIXED_FILTER_SETS];
+#if JVET_AA_EE2_5_1
+                if( m_isFixedFilterPaddedPerCtu )
+                {
+                  paddingFixedFilterResultsCtu(m_fixFilterResult, m_fixedFilterResultPerCtu, fixedFilterSetIdx, blkDst);
+                }
+                m_ctuEnableOnlineLumaFlag[ctuIdx] = numFixedFilters(filterTypeCtb) > 1 ? true : false;
+#endif
 #if JVET_X0071_ALF_BAND_CLASSIFIER
                 int classifierIdx = m_classifierIdxApsLuma[filterSetIndex - NUM_FIXED_FILTER_SETS][alt_num];
 #if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF
@@ -632,16 +646,32 @@ void AdaptiveLoopFilter::ALFProcess(CodingStructure& cs)
                   bufDb.extendBorderPel( NUM_DB_PAD );
                   bufDb = bufDb.subBuf( UnitArea( CHROMA_400, Area( clipL ? 0 : NUM_DB_PAD, clipT ? 0 : NUM_DB_PAD, w, h ) ) );
                 }
+#if JVET_AA_EE2_5_1
+                alfFiltering( m_classifier[classifierIdx], recYuv, bufDb, buf, blkDst, blkSrc, COMPONENT_Y, coeff, clip, m_clpRngs.comp[COMPONENT_Y], cs, filterTypeCtb, m_fixFilterResult, fixedFilterSetIdx, m_fixedFilterResultPerCtu, m_isFixedFilterPaddedPerCtu );
+#else
                 alfFiltering( m_classifier[classifierIdx], recYuv, bufDb, buf, blkDst, blkSrc, COMPONENT_Y, coeff, clip, m_clpRngs.comp[COMPONENT_Y], cs, filterTypeCtb, m_fixFilterResult, fixedFilterSetIdx );
+#endif
+#else
+#if JVET_AA_EE2_5_1
+                alfFiltering( m_classifier[classifierIdx], recYuv, buf, blkDst, blkSrc, COMPONENT_Y, coeff, clip, m_clpRngs.comp[COMPONENT_Y], cs, filterTypeCtb, m_fixFilterResult, fixedFilterSetIdx, m_fixedFilterResultPerCtu, m_isFixedFilterPaddedPerCtu );
 #else
                 alfFiltering( m_classifier[classifierIdx], recYuv, buf, blkDst, blkSrc, COMPONENT_Y, coeff, clip, m_clpRngs.comp[COMPONENT_Y], cs, filterTypeCtb, m_fixFilterResult, fixedFilterSetIdx );
 #endif
+#endif
 #else
 #if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF
+#if JVET_AA_EE2_5_1
+                alfFiltering( m_classifier, recYuv, bufDb, buf, blkDst, blkSrc, COMPONENT_Y, coeff, clip, m_clpRngs.comp[COMPONENT_Y], cs, filterTypeCtb, m_fixFilterResult, fixedFilterSetIdx, m_fixedFilterResultPerCtu, m_isFixedFilterPaddedPerCtu );
+#else
                 alfFiltering( m_classifier, recYuv, bufDb, buf, blkDst, blkSrc, COMPONENT_Y, coeff, clip, m_clpRngs.comp[COMPONENT_Y], cs, filterTypeCtb, m_fixFilterResult, fixedFilterSetIdx );
+#endif
+#else
+#if JVET_AA_EE2_5_1
+                alfFiltering( m_classifier, recYuv, buf, blkDst, blkSrc, COMPONENT_Y, coeff, clip, m_clpRngs.comp[COMPONENT_Y], cs, filterTypeCtb, m_fixFilterResult, fixedFilterSetIdx, m_fixedFilterResultPerCtu, m_isFixedFilterPaddedPerCtu );
 #else
                 alfFiltering( m_classifier, recYuv, buf, blkDst, blkSrc, COMPONENT_Y, coeff, clip, m_clpRngs.comp[COMPONENT_Y], cs, filterTypeCtb, m_fixFilterResult, fixedFilterSetIdx );
 #endif
+#endif
 #endif
               }
 #else
@@ -673,17 +703,33 @@ void AdaptiveLoopFilter::ALFProcess(CodingStructure& cs)
 #if ALF_IMPROVEMENT
 #if JVET_X0071_ALF_BAND_CLASSIFIER
 #if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF
+#if JVET_AA_EE2_5_1
+                alfFiltering( m_classifier[0], recYuv, tmpYuvBeforeDb, buf, blkDst, blkSrc, compID, m_chromaCoeffFinal[alt_num], m_chromaClippFinal[alt_num], m_clpRngs.comp[compIdx], cs, m_filterTypeApsChroma, nullptr, -1, nullptr, false );
+#else
                 alfFiltering( m_classifier[0], recYuv, tmpYuvBeforeDb, buf, blkDst, blkSrc, compID, m_chromaCoeffFinal[alt_num], m_chromaClippFinal[alt_num], m_clpRngs.comp[compIdx], cs, m_filterTypeApsChroma, nullptr, -1 );
+#endif
+#else
+#if JVET_AA_EE2_5_1
+                alfFiltering( m_classifier[0], recYuv, buf, blkDst, blkSrc, compID, m_chromaCoeffFinal[alt_num], m_chromaClippFinal[alt_num], m_clpRngs.comp[compIdx], cs, m_filterTypeApsChroma, nullptr, -1, nullptr, false );
 #else
                 alfFiltering( m_classifier[0], recYuv, buf, blkDst, blkSrc, compID, m_chromaCoeffFinal[alt_num], m_chromaClippFinal[alt_num], m_clpRngs.comp[compIdx], cs, m_filterTypeApsChroma, nullptr, -1 );
 #endif
+#endif
 #else
 #if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF
+#if JVET_AA_EE2_5_1
+                alfFiltering( m_classifier, recYuv, tmpYuvBeforeDb, buf, blkDst, blkSrc, compID, m_chromaCoeffFinal[alt_num], m_chromaClippFinal[alt_num], m_clpRngs.comp[compIdx], cs, m_filterTypeApsChroma, nullptr, -1, nullptr, false );
+#else
                 alfFiltering( m_classifier, recYuv, tmpYuvBeforeDb, buf, blkDst, blkSrc, compID, m_chromaCoeffFinal[alt_num], m_chromaClippFinal[alt_num], m_clpRngs.comp[compIdx], cs, m_filterTypeApsChroma, nullptr, -1 );
+#endif
+#else
+#if JVET_AA_EE2_5_1
+                alfFiltering( m_classifier, recYuv, buf, blkDst, blkSrc, compID, m_chromaCoeffFinal[alt_num], m_chromaClippFinal[alt_num], m_clpRngs.comp[compIdx], cs, m_filterTypeApsChroma, nullptr, -1, nullptr, false );
 #else
                 alfFiltering( m_classifier, recYuv, buf, blkDst, blkSrc, compID, m_chromaCoeffFinal[alt_num], m_chromaClippFinal[alt_num], m_clpRngs.comp[compIdx], cs, m_filterTypeApsChroma, nullptr, -1 );
 #endif
 #endif
+#endif
 #else
                 m_filter5x5Blk(m_classifier, recYuv, buf, blkDst, blkSrc, compID, m_chromaCoeffFinal[alt_num], m_chromaClippFinal[alt_num], m_clpRngs.comp[compIdx], cs, m_alfVBChmaCTUHeight, m_alfVBChmaPos );
 #endif
@@ -746,19 +792,50 @@ void AdaptiveLoopFilter::ALFProcess(CodingStructure& cs)
             coeff = m_coeffApsLuma[filterSetIndex - NUM_FIXED_FILTER_SETS][alt_num];
             clip = m_clippApsLuma[filterSetIndex - NUM_FIXED_FILTER_SETS][alt_num];
             AlfFilterType filterTypeCtb = m_filterTypeApsLuma[filterSetIndex - NUM_FIXED_FILTER_SETS];
+#if JVET_AA_EE2_5_1
+            if( m_isFixedFilterPaddedPerCtu )
+            {
+              paddingFixedFilterResultsCtu(m_fixFilterResult, m_fixedFilterResultPerCtu, fixedFilterSetIdx, blk);
+            }
+            else
+            {
+#if JVET_X0071_ALF_BAND_CLASSIFIER
+              deriveFixedFilterResultsCtuBoundary(m_classifier[0], m_fixFilterResult, tmpYuv.get(COMPONENT_Y), blk, m_inputBitDepth[CHANNEL_TYPE_LUMA], cs, m_clpRngs.comp[COMPONENT_Y], m_alfClippingValues[CHANNEL_TYPE_LUMA], cs.slice->getSliceQp(), fixedFilterSetIdx, m_mappingDir, m_laplacian, m_ctuEnableFlag[COMPONENT_Y], m_ctuEnableOnlineLumaFlag, ctuIdx);
+#else
+              deriveFixedFilterResultsCtuBoundary(m_classifier, m_fixFilterResult, tmpYuv.get(COMPONENT_Y), blk, m_inputBitDepth[CHANNEL_TYPE_LUMA], cs, m_clpRngs.comp[COMPONENT_Y], m_alfClippingValues[CHANNEL_TYPE_LUMA], cs.slice->getSliceQp(), fixedFilterSetIdx, m_mappingDir, m_laplacian, m_ctuEnableFlag[COMPONENT_Y], m_ctuEnableOnlineLumaFlag, ctuIdx);
+#endif
+            }
+            m_ctuEnableOnlineLumaFlag[ctuIdx] = numFixedFilters(filterTypeCtb) > 1 ? true : false;
+#endif
 #if JVET_X0071_ALF_BAND_CLASSIFIER
             int classifierIdx = m_classifierIdxApsLuma[filterSetIndex - NUM_FIXED_FILTER_SETS][alt_num];
 #if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF
+#if JVET_AA_EE2_5_1
+            alfFiltering( m_classifier[classifierIdx], recYuv, tmpYuvBeforeDb, tmpYuv, blk, blk, COMPONENT_Y, coeff, clip, m_clpRngs.comp[COMPONENT_Y], cs, filterTypeCtb, m_fixFilterResult, fixedFilterSetIdx, m_fixedFilterResultPerCtu, m_isFixedFilterPaddedPerCtu );
+#else
             alfFiltering( m_classifier[classifierIdx], recYuv, tmpYuvBeforeDb, tmpYuv, blk, blk, COMPONENT_Y, coeff, clip, m_clpRngs.comp[COMPONENT_Y], cs, filterTypeCtb, m_fixFilterResult, fixedFilterSetIdx );
+#endif
+#else
+#if JVET_AA_EE2_5_1
+            alfFiltering( m_classifier[classifierIdx], recYuv, tmpYuv, blk, blk, COMPONENT_Y, coeff, clip, m_clpRngs.comp[COMPONENT_Y], cs, filterTypeCtb, m_fixFilterResult, fixedFilterSetIdx, m_fixedFilterResultPerCtu, m_isFixedFilterPaddedPerCtu );
 #else
             alfFiltering( m_classifier[classifierIdx], recYuv, tmpYuv, blk, blk, COMPONENT_Y, coeff, clip, m_clpRngs.comp[COMPONENT_Y], cs, filterTypeCtb, m_fixFilterResult, fixedFilterSetIdx );
 #endif
+#endif
 #else
 #if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF
+#if JVET_AA_EE2_5_1
+            alfFiltering( m_classifier, recYuv, tmpYuvBeforeDb, tmpYuv, blk, blk, COMPONENT_Y, coeff, clip, m_clpRngs.comp[COMPONENT_Y], cs, filterTypeCtb, m_fixFilterResult, fixedFilterSetIdx, m_fixedFilterResultPerCtu, m_isFixedFilterPaddedPerCtu );
+#else
             alfFiltering( m_classifier, recYuv, tmpYuvBeforeDb, tmpYuv, blk, blk, COMPONENT_Y, coeff, clip, m_clpRngs.comp[COMPONENT_Y], cs, filterTypeCtb, m_fixFilterResult, fixedFilterSetIdx );
+#endif
+#else
+#if JVET_AA_EE2_5_1
+            alfFiltering( m_classifier, recYuv, tmpYuv, blk, blk, COMPONENT_Y, coeff, clip, m_clpRngs.comp[COMPONENT_Y], cs, filterTypeCtb, m_fixFilterResult, fixedFilterSetIdx, m_fixedFilterResultPerCtu, m_isFixedFilterPaddedPerCtu );
 #else
             alfFiltering( m_classifier, recYuv, tmpYuv, blk, blk, COMPONENT_Y, coeff, clip, m_clpRngs.comp[COMPONENT_Y], cs, filterTypeCtb, m_fixFilterResult, fixedFilterSetIdx );
 #endif
+#endif
 #endif
           }
 #else
@@ -790,17 +867,33 @@ void AdaptiveLoopFilter::ALFProcess(CodingStructure& cs)
 #if ALF_IMPROVEMENT
 #if JVET_X0071_ALF_BAND_CLASSIFIER
 #if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF
+#if JVET_AA_EE2_5_1
+            alfFiltering( m_classifier[0], recYuv, tmpYuvBeforeDb, tmpYuv, blk, blk, compID, m_chromaCoeffFinal[alt_num], m_chromaClippFinal[alt_num], m_clpRngs.comp[compIdx], cs, m_filterTypeApsChroma  , nullptr, -1, nullptr, false );
+#else
             alfFiltering( m_classifier[0], recYuv, tmpYuvBeforeDb, tmpYuv, blk, blk, compID, m_chromaCoeffFinal[alt_num], m_chromaClippFinal[alt_num], m_clpRngs.comp[compIdx], cs, m_filterTypeApsChroma  , nullptr, -1 );
+#endif
+#else
+#if JVET_AA_EE2_5_1
+            alfFiltering( m_classifier[0], recYuv, tmpYuv, blk, blk, compID, m_chromaCoeffFinal[alt_num], m_chromaClippFinal[alt_num], m_clpRngs.comp[compIdx], cs, m_filterTypeApsChroma  , nullptr, -1, nullptr, false );
 #else
             alfFiltering( m_classifier[0], recYuv, tmpYuv, blk, blk, compID, m_chromaCoeffFinal[alt_num], m_chromaClippFinal[alt_num], m_clpRngs.comp[compIdx], cs, m_filterTypeApsChroma  , nullptr, -1 );
 #endif
+#endif
 #else
 #if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF
+#if JVET_AA_EE2_5_1
+            alfFiltering( m_classifier, recYuv, tmpYuvBeforeDb, tmpYuv, blk, blk, compID, m_chromaCoeffFinal[alt_num], m_chromaClippFinal[alt_num], m_clpRngs.comp[compIdx], cs, m_filterTypeApsChroma  , nullptr, -1, nullptr, false );
+#else
             alfFiltering( m_classifier, recYuv, tmpYuvBeforeDb, tmpYuv, blk, blk, compID, m_chromaCoeffFinal[alt_num], m_chromaClippFinal[alt_num], m_clpRngs.comp[compIdx], cs, m_filterTypeApsChroma  , nullptr, -1 );
+#endif
+#else
+#if JVET_AA_EE2_5_1
+            alfFiltering( m_classifier, recYuv, tmpYuv, blk, blk, compID, m_chromaCoeffFinal[alt_num], m_chromaClippFinal[alt_num], m_clpRngs.comp[compIdx], cs, m_filterTypeApsChroma  , nullptr, -1, nullptr, false );
 #else
             alfFiltering( m_classifier, recYuv, tmpYuv, blk, blk, compID, m_chromaCoeffFinal[alt_num], m_chromaClippFinal[alt_num], m_clpRngs.comp[compIdx], cs, m_filterTypeApsChroma  , nullptr, -1 );
 #endif
 #endif
+#endif
 #else
             m_filter5x5Blk( m_classifier, recYuv, tmpYuv, blk, blk, compID, m_chromaCoeffFinal[alt_num], m_chromaClippFinal[alt_num], m_clpRngs.comp[compIdx], cs, m_alfVBChmaCTUHeight, m_alfVBChmaPos );
 #endif
@@ -1091,6 +1184,10 @@ void AdaptiveLoopFilter::create(const int picWidth, const int picHeight, const C
 
 #if ALF_IMPROVEMENT
   int numFixedFilters = EXT_LENGTH << 1;
+#if JVET_AA_EE2_5_1
+  m_isFixedFilterPaddedPerCtu = true;
+  int padSize = ALF_PADDING_SIZE_FIXED_RESULTS << 1;
+#endif
   //destroy
   if (m_fixFilterResult)
   {
@@ -1098,8 +1195,11 @@ void AdaptiveLoopFilter::create(const int picWidth, const int picHeight, const C
     {
       if (m_fixFilterResult[i])
       {
-        //for( int j = 0; j < m_picWidth; j++ )
+#if JVET_AA_EE2_5_1
+        for (int j = 0; j < m_picHeight + padSize; j++)
+#else
         for (int j = 0; j < m_picHeight; j++)
+#endif
         {
           if (m_fixFilterResult[i][j])
           {
@@ -1118,12 +1218,63 @@ void AdaptiveLoopFilter::create(const int picWidth, const int picHeight, const C
   m_fixFilterResult = new Pel**[numFixedFilters];
   for (int i = 0; i < numFixedFilters; i++)
   {
+#if JVET_AA_EE2_5_1
+    m_fixFilterResult[i] = new Pel*[picHeight + padSize];
+    for (int j = 0; j < picHeight + padSize; j++)
+    {
+      m_fixFilterResult[i][j] = new Pel[picWidth + padSize];
+    }
+#else
     m_fixFilterResult[i] = new Pel*[picHeight];
     for (int j = 0; j < picHeight; j++)
     {
       m_fixFilterResult[i][j] = new Pel[picWidth];
     }
+#endif
+  }
+#if JVET_AA_EE2_5_1
+  //destroy
+  if (m_fixedFilterResultPerCtu)
+  {
+    for (int i = 0; i < numFixedFilters; i++)
+    {
+      if (m_fixedFilterResultPerCtu[i])
+      {
+        for (int j = 0; j < m_maxCUHeight + padSize; j++)
+        {
+          if (m_fixedFilterResultPerCtu[i][j])
+          {
+            delete[] m_fixedFilterResultPerCtu[i][j];
+            m_fixedFilterResultPerCtu[i][j] = nullptr;
+          }
+        }
+        delete[] m_fixedFilterResultPerCtu[i];
+        m_fixedFilterResultPerCtu[i] = nullptr;
+      }
+    }
+    delete[] m_fixedFilterResultPerCtu;
+    m_fixedFilterResultPerCtu = nullptr;
+  }
+    //create
+  m_fixedFilterResultPerCtu = new Pel**[numFixedFilters];
+  for (int i = 0; i < numFixedFilters; i++)
+  {
+    m_fixedFilterResultPerCtu[i] = new Pel*[m_maxCUHeight + padSize];
+    for (int j = 0; j < m_maxCUHeight + padSize; j++)
+    {
+      m_fixedFilterResultPerCtu[i][j] = new Pel[m_maxCUWidth + padSize];
+    }
+  }
+  //destory
+  if( m_ctuEnableOnlineLumaFlag )
+  {
+    delete[] m_ctuEnableOnlineLumaFlag;
+    m_ctuEnableOnlineLumaFlag = nullptr;
   }
+  //create
+  m_ctuEnableOnlineLumaFlag = new uint8_t[m_numCTUsInPic];
+  memset(m_ctuEnableOnlineLumaFlag, 0, sizeof(uint8_t) * m_numCTUsInPic);
+#endif
 #endif
 
   // Classification
@@ -1204,6 +1355,9 @@ void AdaptiveLoopFilter::destroy()
 #endif
 
 #if ALF_IMPROVEMENT
+#if JVET_AA_EE2_5_1
+  int padSize = ALF_PADDING_SIZE_FIXED_RESULTS << 1;
+#endif
   if( m_fixFilterResult )
   {
     int numFixedFilters = EXT_LENGTH << 1;
@@ -1212,8 +1366,11 @@ void AdaptiveLoopFilter::destroy()
     {
       if( m_fixFilterResult[i] )
       {
-        //for( int j = 0; j < m_picWidth; j++ )
+#if JVET_AA_EE2_5_1
+        for( int j = 0; j < m_picHeight + padSize; j++ )
+#else
         for( int j = 0; j < m_picHeight; j++ )
+#endif
         {
           if( m_fixFilterResult[i][j] )
           {
@@ -1228,6 +1385,36 @@ void AdaptiveLoopFilter::destroy()
     delete[] m_fixFilterResult;
     m_fixFilterResult = nullptr;
   }
+#if JVET_AA_EE2_5_1
+  if( m_fixedFilterResultPerCtu )
+  {
+    int numFixedFilters = EXT_LENGTH << 1;
+    for( int i = 0; i < numFixedFilters; i++ )
+    {
+      if( m_fixedFilterResultPerCtu[i] )
+      {
+        for( int j = 0; j < m_maxCUHeight + padSize; j++ )
+        {
+          if( m_fixedFilterResultPerCtu[i][j] )
+          {
+            delete[] m_fixedFilterResultPerCtu[i][j];
+            m_fixedFilterResultPerCtu[i][j] = nullptr;
+          }
+        }
+        delete[] m_fixedFilterResultPerCtu[i];
+        m_fixedFilterResultPerCtu[i] = nullptr;
+      }
+    }
+    delete[] m_fixedFilterResultPerCtu;
+    m_fixedFilterResultPerCtu = nullptr;
+  }
+
+  if( m_ctuEnableOnlineLumaFlag )
+  {
+    delete[] m_ctuEnableOnlineLumaFlag;
+    m_ctuEnableOnlineLumaFlag = nullptr;
+  }
+#endif
 #endif
 
   m_tempBuf.destroy();
@@ -1262,11 +1449,18 @@ void  AdaptiveLoopFilter::copyFixedFilterResults( const PelUnitBuf &recDst, cons
   const int dstStride = dstLuma.stride;
   Pel* dst = dstLuma.buf + blkDst.y * dstStride + blkDst.x;
   int filterIndex = classifierIdx * NUM_FIXED_FILTER_SETS + fixedFilterSetIdx;
+#if JVET_AA_EE2_5_1
+  int padSize = ALF_PADDING_SIZE_FIXED_RESULTS;
+#endif
   for( int y = 0; y < blkDst.height; y++ )
   {
     for( int x = 0; x < blkDst.width; x++ )
     {
+#if JVET_AA_EE2_5_1
+      dst[x] = fixedFilterResults[filterIndex][y + blkDst.y + padSize][x + blkDst.x + padSize];
+#else
       dst[x] = fixedFilterResults[filterIndex][y + blkDst.y][x + blkDst.x];
+#endif
     }
     dst += dstStride;
   }
@@ -1282,68 +1476,128 @@ void  AdaptiveLoopFilter::alfFiltering( AlfClassifier **classifier, const PelUni
 #else
   const short *fClipSet, 
 #endif
-  const ClpRng &clpRng, CodingStructure &cs, AlfFilterType filterType, Pel*** fixedFilterResults, int fixedFilterSetIdx )
+  const ClpRng &clpRng, CodingStructure &cs, AlfFilterType filterType, Pel*** fixedFilterResults, int fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+  , Pel*** fixedFilterResultsPerCtu, bool isFixedFilterPaddedPerCtu
+#endif
+    )
 {
 #if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF
   if (filterType == ALF_FILTER_9)
   {
-    m_filter9x9Blk( classifier, recDst, recBeforeDb, recSrc, blkDst, blk, compId, filterSet, fClipSet, clpRng, cs, nullptr, fixedFilterSetIdx );
+    m_filter9x9Blk( classifier, recDst, recBeforeDb, recSrc, blkDst, blk, compId, filterSet, fClipSet, clpRng, cs, nullptr, fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+    , fixedFilterResultsPerCtu, isFixedFilterPaddedPerCtu
+#endif
+    );
   }
   else if (filterType == ALF_FILTER_7)
   {
-    m_filter7x7Blk( classifier, recDst, recBeforeDb, recSrc, blkDst, blk, compId, filterSet, fClipSet, clpRng, cs, nullptr, fixedFilterSetIdx );
+    m_filter7x7Blk( classifier, recDst, recBeforeDb, recSrc, blkDst, blk, compId, filterSet, fClipSet, clpRng, cs, nullptr, fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+    , fixedFilterResultsPerCtu, isFixedFilterPaddedPerCtu
+#endif
+    );
   }
   else if (filterType == ALF_FILTER_5)
   {
-    m_filter5x5Blk( classifier, recDst, recBeforeDb, recSrc, blkDst, blk, compId, filterSet, fClipSet, clpRng, cs, nullptr, fixedFilterSetIdx );
+    m_filter5x5Blk( classifier, recDst, recBeforeDb, recSrc, blkDst, blk, compId, filterSet, fClipSet, clpRng, cs, nullptr, fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+    , fixedFilterResultsPerCtu, isFixedFilterPaddedPerCtu
+#endif
+    );
   }
   else if (filterType == ALF_FILTER_9_EXT)
   {
-    m_filter9x9BlkExt( classifier, recDst, recBeforeDb, recSrc, blkDst, blk, compId, filterSet, fClipSet, clpRng, cs, fixedFilterResults, fixedFilterSetIdx );
+    m_filter9x9BlkExt( classifier, recDst, recBeforeDb, recSrc, blkDst, blk, compId, filterSet, fClipSet, clpRng, cs, fixedFilterResults, fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+    , fixedFilterResultsPerCtu, isFixedFilterPaddedPerCtu
+#endif
+    );
   }
   else if (filterType == ALF_FILTER_EXT)
   {
-    m_filterBlkExt( classifier, recDst, recBeforeDb, recSrc, blkDst, blk, compId, filterSet, fClipSet, clpRng, cs, fixedFilterResults, fixedFilterSetIdx );
+    m_filterBlkExt( classifier, recDst, recBeforeDb, recSrc, blkDst, blk, compId, filterSet, fClipSet, clpRng, cs, fixedFilterResults, fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+    , fixedFilterResultsPerCtu, isFixedFilterPaddedPerCtu
+#endif
+    );
   }
   else if (filterType == ALF_FILTER_9_EXT_DB)
   {
-    m_filter9x9BlkExtDb( classifier, recDst, recBeforeDb, recSrc, blkDst, blk, compId, filterSet, fClipSet, clpRng, cs, fixedFilterResults, fixedFilterSetIdx );
+    m_filter9x9BlkExtDb( classifier, recDst, recBeforeDb, recSrc, blkDst, blk, compId, filterSet, fClipSet, clpRng, cs, fixedFilterResults, fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+    , fixedFilterResultsPerCtu, isFixedFilterPaddedPerCtu
+#endif
+    );
   }
 #if JVET_AA0095_ALF_LONGER_FILTER
   else if (filterType == ALF_FILTER_13_EXT)
   {
-    m_filter13x13BlkExt( classifier, recDst, recBeforeDb, recSrc, blkDst, blk, compId, filterSet, fClipSet, clpRng, cs, fixedFilterResults, fixedFilterSetIdx );
+    m_filter13x13BlkExt( classifier, recDst, recBeforeDb, recSrc, blkDst, blk, compId, filterSet, fClipSet, clpRng, cs, fixedFilterResults, fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+    , fixedFilterResultsPerCtu, isFixedFilterPaddedPerCtu
+#endif
+    );
   }
   else if (filterType == ALF_FILTER_13_EXT_DB)
   {
-    m_filter13x13BlkExtDb( classifier, recDst, recBeforeDb, recSrc, blkDst, blk, compId, filterSet, fClipSet, clpRng, cs, fixedFilterResults, fixedFilterSetIdx );
+    m_filter13x13BlkExtDb( classifier, recDst, recBeforeDb, recSrc, blkDst, blk, compId, filterSet, fClipSet, clpRng, cs, fixedFilterResults, fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+    , fixedFilterResultsPerCtu, isFixedFilterPaddedPerCtu
+#endif
+    );
   }
 #endif
 #else
   if (filterType == ALF_FILTER_9)
   {
-    m_filter9x9Blk( classifier, recDst, recSrc, blkDst, blk, compId, filterSet, fClipSet, clpRng, cs, nullptr, fixedFilterSetIdx );
+    m_filter9x9Blk( classifier, recDst, recSrc, blkDst, blk, compId, filterSet, fClipSet, clpRng, cs, nullptr, fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+    , fixedFilterResultsPerCtu, isFixedFilterPaddedPerCtu
+#endif
+    );
   }
   else if (filterType == ALF_FILTER_7)
   {
-    m_filter7x7Blk( classifier, recDst, recSrc, blkDst, blk, compId, filterSet, fClipSet, clpRng, cs, nullptr, fixedFilterSetIdx );
+    m_filter7x7Blk( classifier, recDst, recSrc, blkDst, blk, compId, filterSet, fClipSet, clpRng, cs, nullptr, fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+    , fixedFilterResultsPerCtu, isFixedFilterPaddedPerCtu
+#endif
+    );
   }
   else if (filterType == ALF_FILTER_5)
   {
-    m_filter5x5Blk( classifier, recDst, recSrc, blkDst, blk, compId, filterSet, fClipSet, clpRng, cs, nullptr, fixedFilterSetIdx );
+    m_filter5x5Blk( classifier, recDst, recSrc, blkDst, blk, compId, filterSet, fClipSet, clpRng, cs, nullptr, fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+    , fixedFilterResultsPerCtu, isFixedFilterPaddedPerCtu
+#endif
+    );
   }
   else if (filterType == ALF_FILTER_9_EXT)
   {
-    m_filter9x9BlkExt( classifier, recDst, recSrc, blkDst, blk, compId, filterSet, fClipSet, clpRng, cs, fixedFilterResults, fixedFilterSetIdx );
+    m_filter9x9BlkExt( classifier, recDst, recSrc, blkDst, blk, compId, filterSet, fClipSet, clpRng, cs, fixedFilterResults, fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+    , fixedFilterResultsPerCtu, isFixedFilterPaddedPerCtu
+#endif
+    );
   }
   else if (filterType == ALF_FILTER_EXT)
   {
-    m_filterBlkExt( classifier, recDst, recSrc, blkDst, blk, compId, filterSet, fClipSet, clpRng, cs, fixedFilterResults, fixedFilterSetIdx );
+    m_filterBlkExt( classifier, recDst, recSrc, blkDst, blk, compId, filterSet, fClipSet, clpRng, cs, fixedFilterResults, fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+    , fixedFilterResultsPerCtu, isFixedFilterPaddedPerCtu
+#endif
+    );
   }
 #if JVET_AA0095_ALF_LONGER_FILTER
   else if (filterType == ALF_FILTER_13_EXT)
   {
-    m_filter13x13BlkExt( classifier, recDst, recSrc, blkDst, blk, compId, filterSet, fClipSet, clpRng, cs, fixedFilterResults, fixedFilterSetIdx );
+    m_filter13x13BlkExt( classifier, recDst, recSrc, blkDst, blk, compId, filterSet, fClipSet, clpRng, cs, fixedFilterResults, fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+    , fixedFilterResultsPerCtu, isFixedFilterPaddedPerCtu
+#endif
+    );
   }
 #endif
 #endif
@@ -1682,6 +1936,9 @@ void AdaptiveLoopFilter::fixedFiltering(AlfClassifier **classifier, const CPelBu
   int posYDst = blkDst.y;
   int posXDst = blkDst.x;
 #endif
+#if JVET_AA_EE2_5_1
+  int padSize = ALF_PADDING_SIZE_FIXED_RESULTS;
+#endif
 
   int posY = curBlk.y;
   int posX = curBlk.x;
@@ -1810,9 +2067,17 @@ void AdaptiveLoopFilter::fixedFiltering(AlfClassifier **classifier, const CPelBu
           sum += curr;
 
 #if JVET_Z0105_LOOP_FILTER_VIRTUAL_BOUNDARY
+#if JVET_AA_EE2_5_1
+          fixedFilterResults[fixedFiltInd][posYDst + ii + i + padSize][posXDst + jj + j + padSize] = ClipPel(sum, clpRng);
+#else
           fixedFilterResults[fixedFiltInd][posYDst + ii + i][posXDst + jj + j] = ClipPel(sum, clpRng);
+#endif
+#else
+#if JVET_AA_EE2_5_1
+          fixedFilterResults[fixedFiltInd][posY + ii + i + padSize][posX + jj + j + padSize] = ClipPel(sum, clpRng);
 #else
           fixedFilterResults[fixedFiltInd][posY + ii + i][posX + jj + j] = ClipPel(sum, clpRng);
+#endif
 #endif 
 
           pImg0++;
@@ -2265,7 +2530,11 @@ void AdaptiveLoopFilter::filterBlk(AlfClassifier **classifier, const PelUnitBuf
 #endif
                                    CodingStructure &cs, 
 #if ALF_IMPROVEMENT
-                                   Pel ***fixedFilterResults, int fixedFilterSetIdx)
+                                   Pel ***fixedFilterResults, int fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+                                 , Pel ***fixedFilterResultsPerCtu, bool isFixedFilterPaddedPerCtu
+#endif
+   )
 #else
                                    const int vbCTUHeight, int vbPos)
 #endif
@@ -2300,6 +2569,9 @@ void AdaptiveLoopFilter::filterBlk(AlfClassifier **classifier, const PelUnitBuf
   const int recDbStride = isLuma( compId ) ? recBeforeDb.get( compId ).stride : 0;
   Pel* recDb = isLuma( compId ) ? recBeforeDb.get( compId ).buf + blk.y * recDbStride : nullptr;
 #endif
+#if JVET_AA_EE2_5_1
+  int padSize = ALF_PADDING_SIZE_FIXED_RESULTS;
+#endif
 
 #if ALF_IMPROVEMENT
   const Pel *pImgYPad0, *pImgYPad1, *pImgYPad2, *pImgYPad3, *pImgYPad4, *pImgYPad5, *pImgYPad6, *pImgYPad7, *pImgYPad8;
@@ -2659,16 +2931,82 @@ void AdaptiveLoopFilter::filterBlk(AlfClassifier **classifier, const PelUnitBuf
             sum += filterCoeff[5] * ( clipALF(filterClipp[5], curr, pImg0[+1], pImg0[-1]) );
           }
 #if ALF_IMPROVEMENT
+#if JVET_AA_EE2_5_1
+          if( filtType >= ALF_FILTER_9_EXT && filtType != ALF_FILTER_EXT )
+          {
+            int filterSetIdx = 0 + fixedFilterSetIdx;
+            Pel *pImg0FixedBased, *pImg1FixedBased, *pImg2FixedBased, *pImg3FixedBased, *pImg4FixedBased;
+
+            if( isFixedFilterPaddedPerCtu )
+            {
+              pImg0FixedBased = &fixedFilterResultsPerCtu[filterSetIdx][i + ii + padSize + 0][j + jj + padSize];
+              pImg1FixedBased = &fixedFilterResultsPerCtu[filterSetIdx][i + ii + padSize + 1][j + jj + padSize];
+              pImg2FixedBased = &fixedFilterResultsPerCtu[filterSetIdx][i + ii + padSize - 1][j + jj + padSize];
+              pImg3FixedBased = &fixedFilterResultsPerCtu[filterSetIdx][i + ii + padSize + 2][j + jj + padSize];
+              pImg4FixedBased = &fixedFilterResultsPerCtu[filterSetIdx][i + ii + padSize - 2][j + jj + padSize];
+            }
+            else
+            {
+              pImg0FixedBased = &fixedFilterResults[filterSetIdx][blkDst.y + i + ii + padSize + 0][blkDst.x + j + jj + padSize];
+              pImg1FixedBased = &fixedFilterResults[filterSetIdx][blkDst.y + i + ii + padSize + 1][blkDst.x + j + jj + padSize];
+              pImg2FixedBased = &fixedFilterResults[filterSetIdx][blkDst.y + i + ii + padSize - 1][blkDst.x + j + jj + padSize];
+              pImg3FixedBased = &fixedFilterResults[filterSetIdx][blkDst.y + i + ii + padSize + 2][blkDst.x + j + jj + padSize];
+              pImg4FixedBased = &fixedFilterResults[filterSetIdx][blkDst.y + i + ii + padSize - 2][blkDst.x + j + jj + padSize];
+            }
+
+            if ( transposeIdx == 1 )
+            {
+              sum += coef[24] * ( clipALF(clip[24], curr, pImg4FixedBased[+0], pImg3FixedBased[+0]) );
+              sum += coef[21] * ( clipALF(clip[21], curr, pImg2FixedBased[-1], pImg1FixedBased[+1]) );
+              sum += coef[25] * ( clipALF(clip[25], curr, pImg2FixedBased[+0], pImg1FixedBased[+0]) );
+              sum += coef[23] * ( clipALF(clip[23], curr, pImg2FixedBased[+1], pImg1FixedBased[-1]) );
+              sum += coef[20] * ( clipALF(clip[20], curr, pImg0FixedBased[-2], pImg0FixedBased[+2]) );
+              sum += coef[22] * ( clipALF(clip[22], curr, pImg0FixedBased[-1], pImg0FixedBased[+1]) );
+            }
+            else if ( transposeIdx == 2 )
+            {
+              sum += coef[20] * ( clipALF(clip[20], curr, pImg4FixedBased[+0], pImg3FixedBased[+0]) );
+              sum += coef[23] * ( clipALF(clip[23], curr, pImg2FixedBased[-1], pImg1FixedBased[+1]) );
+              sum += coef[22] * ( clipALF(clip[22], curr, pImg2FixedBased[+0], pImg1FixedBased[+0]) );
+              sum += coef[21] * ( clipALF(clip[21], curr, pImg2FixedBased[+1], pImg1FixedBased[-1]) );
+              sum += coef[24] * ( clipALF(clip[24], curr, pImg0FixedBased[-2], pImg0FixedBased[+2]) );
+              sum += coef[25] * ( clipALF(clip[25], curr, pImg0FixedBased[-1], pImg0FixedBased[+1]) );
+            }
+            else if ( transposeIdx == 3 )
+            {
+              sum += coef[24] * ( clipALF(clip[24], curr, pImg4FixedBased[+0], pImg3FixedBased[+0]) );
+              sum += coef[23] * ( clipALF(clip[23], curr, pImg2FixedBased[-1], pImg1FixedBased[+1]) );
+              sum += coef[25] * ( clipALF(clip[25], curr, pImg2FixedBased[+0], pImg1FixedBased[+0]) );
+              sum += coef[21] * ( clipALF(clip[21], curr, pImg2FixedBased[+1], pImg1FixedBased[-1]) );
+              sum += coef[20] * ( clipALF(clip[20], curr, pImg0FixedBased[-2], pImg0FixedBased[+2]) );
+              sum += coef[22] * ( clipALF(clip[22], curr, pImg0FixedBased[-1], pImg0FixedBased[+1]) );
+            }
+            else
+            {
+              sum += coef[20] * ( clipALF(clip[20], curr, pImg4FixedBased[+0], pImg3FixedBased[+0]) );
+              sum += coef[21] * ( clipALF(clip[21], curr, pImg2FixedBased[-1], pImg1FixedBased[+1]) );
+              sum += coef[22] * ( clipALF(clip[22], curr, pImg2FixedBased[+0], pImg1FixedBased[+0]) );
+              sum += coef[23] * ( clipALF(clip[23], curr, pImg2FixedBased[+1], pImg1FixedBased[-1]) );
+              sum += coef[24] * ( clipALF(clip[24], curr, pImg0FixedBased[-2], pImg0FixedBased[+2]) );
+              sum += coef[25] * ( clipALF(clip[25], curr, pImg0FixedBased[-1], pImg0FixedBased[+1]) );
+            }
+          }
+#endif
 #if JVET_AA0095_ALF_LONGER_FILTER
           if( filtType == ALF_FILTER_9_EXT || filtType == ALF_FILTER_13_EXT )
 #else
           if( filtType == ALF_FILTER_9_EXT )
 #endif
           {
+#if JVET_AA_EE2_5_1
+            sum += coef[26] * ( clipALF(clip[26], curr, fixedFilterResults[0 + fixedFilterSetIdx][blkDst.y + i + ii + padSize][blkDst.x + j + jj + padSize]));
+            sum += coef[27] * ( clipALF(clip[27], curr, fixedFilterResults[2 + fixedFilterSetIdx][blkDst.y + i + ii + padSize][blkDst.x + j + jj + padSize]));
+#else
             for( int k = 0; k < EXT_LENGTH; k++ )
             {
               sum += coef[k + 20] * ( clipALF(clip[k + 20], curr, fixedFilterResults[k * EXT_LENGTH + fixedFilterSetIdx][blkDst.y + i + ii][blkDst.x + j + jj]) );
             }
+#endif
           }
 #if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF
 #if JVET_AA0095_ALF_LONGER_FILTER
@@ -2680,6 +3018,14 @@ void AdaptiveLoopFilter::filterBlk(AlfClassifier **classifier, const PelUnitBuf
             Pel* pRecDbTmp0 = pRecDb1 + jj;
             Pel* pRecDbTmp1 = pRecDbTmp0 + recDbStride;
             Pel* pRecDbTmp2 = pRecDbTmp0 - recDbStride;
+#if JVET_AA_EE2_5_1
+            sum += coef[26] * ( clipALF(clip[26], curr, pRecDbTmp2[+0], pRecDbTmp1[-0]));
+            sum += coef[27] * ( clipALF(clip[27], curr, pRecDbTmp0[-1], pRecDbTmp0[+1]));
+
+            sum += coef[28] * ( clipALF(clip[28], curr, fixedFilterResults[0 + fixedFilterSetIdx][blkDst.y + i + ii + padSize][blkDst.x + j + jj + padSize]));
+            sum += coef[29] * ( clipALF(clip[29], curr, fixedFilterResults[2 + fixedFilterSetIdx][blkDst.y + i + ii + padSize][blkDst.x + j + jj + padSize]));
+            sum += coef[30] * ( clipALF(clip[30], curr, pRecDbTmp0[+0] ));
+#else
             sum += coef[20] * ( clipALF(clip[20], curr, pRecDbTmp2[+0]) + clipALF(clip[20], curr, pRecDbTmp1[+0]) );
             sum += coef[21] * ( clipALF(clip[21], curr, pRecDbTmp0[-1]) + clipALF(clip[21], curr, pRecDbTmp0[+1]) );
             sum += coef[22] *   clipALF(clip[22], curr, pRecDbTmp0[+0]);
@@ -2687,13 +3033,18 @@ void AdaptiveLoopFilter::filterBlk(AlfClassifier **classifier, const PelUnitBuf
             {
               sum += coef[k + 20 + NUM_DB] * (clipALF(clip[k + 20 + NUM_DB], curr, fixedFilterResults[k * EXT_LENGTH + fixedFilterSetIdx][blkDst.y + i + ii][blkDst.x + j + jj]));
             }
+#endif
           }
 #endif
           else if( filtType == ALF_FILTER_EXT )
           {
             for( int k = 0; k < EXT_LENGTH; k++ )
             {
+#if JVET_AA_EE2_5_1
+              sum += coef[k] * ( clipALF(clip[k], curr, fixedFilterResults[k * EXT_LENGTH + fixedFilterSetIdx][blkDst.y + i + ii + padSize][blkDst.x + j + jj + padSize] ) );
+#else
               sum += coef[k] * ( clipALF(clip[k], curr, fixedFilterResults[k * EXT_LENGTH + fixedFilterSetIdx][blkDst.y + i + ii][blkDst.x + j + jj] ) );
+#endif
             }
           }
           sum = ( sum + offset ) >> shift;
@@ -2987,3 +3338,297 @@ void AdaptiveLoopFilter::mirroredPaddingForAlf(CodingStructure &cs, const PelUni
   }
 }
 #endif
+#if JVET_AA_EE2_5_1
+void AdaptiveLoopFilter::paddingFixedFilterResultsPic(Pel*** fixedFilterResults, const int fixedFilterSetIdx)
+{
+  int classifierIdx = 0;
+  int filterIndex = classifierIdx * NUM_FIXED_FILTER_SETS + fixedFilterSetIdx;
+  CHECK(ALF_PADDING_SIZE_FIXED_RESULTS != 2, "Wrong Padding Size in FixedFilterResults");
+  int padSize = ALF_PADDING_SIZE_FIXED_RESULTS;
+  int padSizeDou = padSize << 1;
+  int lineWidth = padSizeDou + m_picWidth;
+
+  for(int row = padSize; row < padSize + m_picHeight; row++)
+  {
+    fixedFilterResults[filterIndex][row][0] = fixedFilterResults[filterIndex][row][3];
+    fixedFilterResults[filterIndex][row][1] = fixedFilterResults[filterIndex][row][2];
+
+    fixedFilterResults[filterIndex][row][padSize + m_picWidth + 0] = fixedFilterResults[filterIndex][row][padSize + m_picWidth - 1];
+    fixedFilterResults[filterIndex][row][padSize + m_picWidth + 1] = fixedFilterResults[filterIndex][row][padSize + m_picWidth - 2];
+  }
+
+  memcpy(fixedFilterResults[filterIndex][0], fixedFilterResults[filterIndex][3], sizeof(Pel) * lineWidth );
+  memcpy(fixedFilterResults[filterIndex][1], fixedFilterResults[filterIndex][2], sizeof(Pel) * lineWidth );
+
+  memcpy(fixedFilterResults[filterIndex][padSize + m_picHeight + 0], fixedFilterResults[filterIndex][padSize + m_picHeight - 1], sizeof(Pel) * lineWidth );
+  memcpy(fixedFilterResults[filterIndex][padSize + m_picHeight + 1], fixedFilterResults[filterIndex][padSize + m_picHeight - 2], sizeof(Pel) * lineWidth );
+}
+
+void AdaptiveLoopFilter::paddingFixedFilterResultsCtu(Pel*** fixedFilterResultsPic, Pel*** fixedFilterResultsCtu, const int fixedFilterSetIdx, const Area &blk)
+{
+  int xPos = blk.pos().x;
+  int yPos = blk.pos().y;
+  int width = blk.size().width;
+  int height = blk.size().height;
+
+  int classifierIdx = 0;
+  int filterIndex = classifierIdx * NUM_FIXED_FILTER_SETS + fixedFilterSetIdx;
+  CHECK(ALF_PADDING_SIZE_FIXED_RESULTS != 2, "Wrong Padding Size in FixedFilterResults");
+  int padSize = ALF_PADDING_SIZE_FIXED_RESULTS;
+  int padSizeDou = padSize << 1;
+  int lineWidth = padSizeDou + width;
+
+  for(int row = padSize; row < height + padSize; row++)
+  {
+    memcpy(&fixedFilterResultsCtu[filterIndex][row][padSize], &fixedFilterResultsPic[filterIndex][row + yPos][padSize + xPos], sizeof(Pel) * width );
+
+    fixedFilterResultsCtu[filterIndex][row][0] = fixedFilterResultsCtu[filterIndex][row][3];
+    fixedFilterResultsCtu[filterIndex][row][1] = fixedFilterResultsCtu[filterIndex][row][2];
+
+    fixedFilterResultsCtu[filterIndex][row][padSize + width + 0] = fixedFilterResultsCtu[filterIndex][row][padSize + width - 1];
+    fixedFilterResultsCtu[filterIndex][row][padSize + width + 1] = fixedFilterResultsCtu[filterIndex][row][padSize + width - 2];
+  }
+
+  memcpy(fixedFilterResultsCtu[filterIndex][0], fixedFilterResultsCtu[filterIndex][3], sizeof(Pel) * lineWidth );
+  memcpy(fixedFilterResultsCtu[filterIndex][1], fixedFilterResultsCtu[filterIndex][2], sizeof(Pel) * lineWidth );
+
+  memcpy(fixedFilterResultsCtu[filterIndex][padSize + height + 0], fixedFilterResultsCtu[filterIndex][padSize + height - 1], sizeof(Pel) * lineWidth );
+  memcpy(fixedFilterResultsCtu[filterIndex][padSize + height + 1], fixedFilterResultsCtu[filterIndex][padSize + height - 2], sizeof(Pel) * lineWidth );
+}
+
+void AdaptiveLoopFilter::deriveFixedFilterResultsCtuBoundary(AlfClassifier **classifier, Pel ***fixedFilterResults, const CPelBuf &srcLuma, const Area &blkDst, const int bits, CodingStructure& cs, const ClpRng &clpRng, const Pel clippingValues[4], int qp, int fixedFilterSetIdx, int mappingDir[NUM_DIR_FIX][NUM_DIR_FIX], uint32_t **laplacian[NUM_DIRECTIONS], uint8_t* ctuEnableFlagLuma, uint8_t* ctuEnableOnlineLuma, int ctuIdx )
+{
+  CHECK(ALF_PADDING_SIZE_FIXED_RESULTS != 2, "Wrong Padding Size in FixedFilterResults");
+  //Ctu Info
+  int yPos = blkDst.pos().y;
+  int xPos = blkDst.pos().x;
+  int width = blkDst.size().width;
+  int height = blkDst.size().height;
+  int padSize = ALF_PADDING_SIZE_FIXED_RESULTS;
+
+  int maxBoundaryNum = 8;
+  int numSampleForSIMD = 8;
+  int ctuStride = m_numCTUsInWidth;
+  Area blkCur[8];
+  bool isBoundaryValid[8] = {false}; //left, right, top, bottom, topleft, topright, bottomleft, bottomright
+  bool isNeighborAvai[8] = {false}; //left, right, top, bottom, topleft, topright, bottomleft, bottomright
+
+  isBoundaryValid[0] = xPos > 0 ? true : false;
+  isBoundaryValid[1] = xPos + width < m_picWidth ? true : false;
+  isBoundaryValid[2] = yPos > 0 ? true : false;
+  isBoundaryValid[3] = yPos + height < m_picHeight ? true : false;
+  isBoundaryValid[4] = isBoundaryValid[0] && isBoundaryValid[2];
+  isBoundaryValid[5] = isBoundaryValid[1] && isBoundaryValid[2];
+  isBoundaryValid[6] = isBoundaryValid[0] && isBoundaryValid[3];
+  isBoundaryValid[7] = isBoundaryValid[1] && isBoundaryValid[3];
+
+  Area blkZero = Area(xPos, yPos, 0, 0);
+  int extraSize = padSize;
+
+  bool isLeftExtraAvai = isBoundaryValid[0] ? (xPos - numSampleForSIMD >= 0 ? true : false) : false;
+  bool isRightExtraAvai = isBoundaryValid[1] ? (xPos + width + numSampleForSIMD - 1 < m_picWidth ? true : false) : false;
+  extraSize = (isLeftExtraAvai && isRightExtraAvai) ? numSampleForSIMD : padSize;
+
+  blkCur[0] = isBoundaryValid[0] ? Area(xPos - extraSize, yPos, extraSize, height) : blkZero;
+  blkCur[1] = isBoundaryValid[1] ? Area(xPos + width    , yPos, extraSize, height) : blkZero;
+  blkCur[2] = isBoundaryValid[2] ? Area(xPos, yPos - padSize, width, padSize) : blkZero;
+  blkCur[3] = isBoundaryValid[3] ? Area(xPos, yPos + height,  width, padSize) : blkZero;
+  blkCur[4] = isBoundaryValid[4] ? Area(xPos - extraSize, yPos - padSize, extraSize, padSize) : blkZero;
+  blkCur[5] = isBoundaryValid[5] ? Area(xPos + width    , yPos - padSize, extraSize, padSize) : blkZero;
+  blkCur[6] = isBoundaryValid[6] ? Area(xPos - extraSize, yPos + height, extraSize, padSize) : blkZero;
+  blkCur[7] = isBoundaryValid[7] ? Area(xPos + width    , yPos + height, extraSize, padSize) : blkZero;
+
+  isNeighborAvai[0] = isBoundaryValid[0] ? ctuEnableFlagLuma[ctuIdx - 1] && ctuEnableOnlineLuma[ctuIdx - 1] : false;
+  isNeighborAvai[1] = isBoundaryValid[1] ? ctuEnableFlagLuma[ctuIdx + 1] && ctuEnableOnlineLuma[ctuIdx + 1] : false;
+  isNeighborAvai[2] = isBoundaryValid[2] ? ctuEnableFlagLuma[ctuIdx - ctuStride] && ctuEnableOnlineLuma[ctuIdx - ctuStride] : false;
+  isNeighborAvai[3] = isBoundaryValid[3] ? ctuEnableFlagLuma[ctuIdx + ctuStride] && ctuEnableOnlineLuma[ctuIdx + ctuStride] : false;
+  isNeighborAvai[4] = isBoundaryValid[4] ? ctuEnableFlagLuma[ctuIdx - ctuStride - 1] && ctuEnableOnlineLuma[ctuIdx - ctuStride - 1] : false;
+  isNeighborAvai[5] = isBoundaryValid[5] ? ctuEnableFlagLuma[ctuIdx - ctuStride + 1] && ctuEnableOnlineLuma[ctuIdx - ctuStride + 1] : false;
+  isNeighborAvai[6] = isBoundaryValid[6] ? ctuEnableFlagLuma[ctuIdx + ctuStride - 1] && ctuEnableOnlineLuma[ctuIdx + ctuStride - 1] : false;
+  isNeighborAvai[7] = isBoundaryValid[7] ? ctuEnableFlagLuma[ctuIdx + ctuStride + 1] && ctuEnableOnlineLuma[ctuIdx + ctuStride + 1] : false;
+
+  int classifierIdx = 0;
+  for(int boundaryIdx = 0; boundaryIdx < maxBoundaryNum; boundaryIdx++)
+  {
+    if(isBoundaryValid[boundaryIdx] && !isNeighborAvai[boundaryIdx])
+    {
+      deriveFixedFilterResultsPerBlk(classifier, fixedFilterResults, srcLuma, blkCur[boundaryIdx], bits, cs, clpRng, clippingValues, qp, fixedFilterSetIdx, m_mappingDir, laplacian, classifierIdx);
+    }
+  }
+
+  int xPosTmp = xPos;
+  int yPosTmp = yPos;
+  int filterSetIdx = classifierIdx * NUM_FIXED_FILTER_SETS + fixedFilterSetIdx;
+
+  if( !isBoundaryValid[0] )
+  {
+    for(int y = yPos + padSize; y < yPos + padSize + height; y++)
+    {
+      fixedFilterResults[filterSetIdx][y][0] = fixedFilterResults[filterSetIdx][y][3];
+      fixedFilterResults[filterSetIdx][y][1] = fixedFilterResults[filterSetIdx][y][2];
+    }
+  }
+
+  if( !isBoundaryValid[1] )
+  {
+    for(int y = yPos + padSize; y < yPos + padSize + height; y++)
+    {
+      fixedFilterResults[filterSetIdx][y][padSize + m_picWidth + 0] = fixedFilterResults[filterSetIdx][y][padSize + m_picWidth - 1];
+      fixedFilterResults[filterSetIdx][y][padSize + m_picWidth + 1] = fixedFilterResults[filterSetIdx][y][padSize + m_picWidth - 2];
+    }
+  }
+
+  if( !isBoundaryValid[2] )
+  {
+    xPosTmp = padSize + xPos + 0;
+    memcpy(&fixedFilterResults[filterSetIdx][0][xPosTmp], &fixedFilterResults[filterSetIdx][3][xPosTmp], sizeof(Pel) * width );
+    memcpy(&fixedFilterResults[filterSetIdx][1][xPosTmp], &fixedFilterResults[filterSetIdx][2][xPosTmp], sizeof(Pel) * width );
+  }
+
+  if( !isBoundaryValid[3] )
+  {
+    xPosTmp = padSize + xPos + 0;
+    memcpy(&fixedFilterResults[filterSetIdx][padSize + m_picHeight + 0][xPosTmp], &fixedFilterResults[filterSetIdx][padSize + m_picHeight - 1][xPosTmp], sizeof(Pel) * width );
+    memcpy(&fixedFilterResults[filterSetIdx][padSize + m_picHeight + 1][xPosTmp], &fixedFilterResults[filterSetIdx][padSize + m_picHeight - 2][xPosTmp], sizeof(Pel) * width );
+  }
+
+  if( !isBoundaryValid[4] )
+  {
+    if( isBoundaryValid[2] )
+    {
+      yPosTmp = yPos + padSize - 1;
+      fixedFilterResults[filterSetIdx][yPosTmp][0] = fixedFilterResults[filterSetIdx][yPosTmp][3];
+      fixedFilterResults[filterSetIdx][yPosTmp][1] = fixedFilterResults[filterSetIdx][yPosTmp][2];
+      yPosTmp = yPos + padSize - 2;
+      fixedFilterResults[filterSetIdx][yPosTmp][0] = fixedFilterResults[filterSetIdx][yPosTmp][3];
+      fixedFilterResults[filterSetIdx][yPosTmp][1] = fixedFilterResults[filterSetIdx][yPosTmp][2];
+    }
+    else
+    {
+      xPosTmp = xPos + padSize - 1;
+      fixedFilterResults[filterSetIdx][yPos + padSize - 1][xPosTmp] = fixedFilterResults[filterSetIdx][yPos + padSize + 0][xPosTmp];
+      fixedFilterResults[filterSetIdx][yPos + padSize - 2][xPosTmp] = fixedFilterResults[filterSetIdx][yPos + padSize + 1][xPosTmp];
+      xPosTmp = xPos + padSize - 2;
+      fixedFilterResults[filterSetIdx][yPos + padSize - 1][xPosTmp] = fixedFilterResults[filterSetIdx][yPos + padSize + 0][xPosTmp];
+      fixedFilterResults[filterSetIdx][yPos + padSize - 2][xPosTmp] = fixedFilterResults[filterSetIdx][yPos + padSize + 1][xPosTmp];
+    }
+  }
+
+  if( !isBoundaryValid[5] )
+  {
+    if( isBoundaryValid[2] )
+    {
+      yPosTmp = yPos + padSize - 1;
+      fixedFilterResults[filterSetIdx][yPosTmp][xPos + padSize + width + 0] = fixedFilterResults[filterSetIdx][yPosTmp][xPos + padSize + width - 1];
+      fixedFilterResults[filterSetIdx][yPosTmp][xPos + padSize + width + 1] = fixedFilterResults[filterSetIdx][yPosTmp][xPos + padSize + width - 2];
+      yPosTmp = yPos + padSize - 2;
+      fixedFilterResults[filterSetIdx][yPosTmp][xPos + padSize + width + 0] = fixedFilterResults[filterSetIdx][yPosTmp][xPos + padSize + width - 1];
+      fixedFilterResults[filterSetIdx][yPosTmp][xPos + padSize + width + 1] = fixedFilterResults[filterSetIdx][yPosTmp][xPos + padSize + width - 2];
+    }
+    else
+    {
+      xPosTmp = xPos + padSize + width + 0;
+      fixedFilterResults[filterSetIdx][yPos + padSize - 1][xPosTmp] = fixedFilterResults[filterSetIdx][yPos + padSize + 0][xPosTmp];
+      fixedFilterResults[filterSetIdx][yPos + padSize - 2][xPosTmp] = fixedFilterResults[filterSetIdx][yPos + padSize + 1][xPosTmp];
+      xPosTmp = xPos + padSize + width + 1;
+      fixedFilterResults[filterSetIdx][yPos + padSize - 1][xPosTmp] = fixedFilterResults[filterSetIdx][yPos + padSize + 0][xPosTmp];
+      fixedFilterResults[filterSetIdx][yPos + padSize - 2][xPosTmp] = fixedFilterResults[filterSetIdx][yPos + padSize + 1][xPosTmp];
+    }
+  }
+
+  if( !isBoundaryValid[6] )
+  {
+    if( isBoundaryValid[3] )
+    {
+      yPosTmp = yPos + padSize + height + 0;
+      fixedFilterResults[filterSetIdx][yPosTmp][0] = fixedFilterResults[filterSetIdx][yPosTmp][3];
+      fixedFilterResults[filterSetIdx][yPosTmp][1] = fixedFilterResults[filterSetIdx][yPosTmp][2];
+      yPosTmp = yPos + padSize + height + 1;
+      fixedFilterResults[filterSetIdx][yPosTmp][0] = fixedFilterResults[filterSetIdx][yPosTmp][3];
+      fixedFilterResults[filterSetIdx][yPosTmp][1] = fixedFilterResults[filterSetIdx][yPosTmp][2];
+    }
+    else
+    {
+
+      xPosTmp = xPos + padSize - 1;
+      fixedFilterResults[filterSetIdx][yPos + padSize + height + 0][xPosTmp] = fixedFilterResults[filterSetIdx][yPos + padSize + height - 1][xPosTmp];
+      fixedFilterResults[filterSetIdx][yPos + padSize + height + 1][xPosTmp] = fixedFilterResults[filterSetIdx][yPos + padSize + height - 2][xPosTmp];
+      xPosTmp = xPos + padSize - 2;
+      fixedFilterResults[filterSetIdx][yPos + padSize + height + 0][xPosTmp] = fixedFilterResults[filterSetIdx][yPos + padSize + height - 1][xPosTmp];
+      fixedFilterResults[filterSetIdx][yPos + padSize + height + 1][xPosTmp] = fixedFilterResults[filterSetIdx][yPos + padSize + height - 2][xPosTmp];
+    }
+  }
+
+  if( !isBoundaryValid[7] )
+  {
+    if( isBoundaryValid[3] )
+    {
+      yPosTmp = yPos + padSize + height + 0;
+      fixedFilterResults[filterSetIdx][yPosTmp][xPos + padSize + width + 0] = fixedFilterResults[filterSetIdx][yPosTmp][xPos + padSize + width - 1];
+      fixedFilterResults[filterSetIdx][yPosTmp][xPos + padSize + width + 1] = fixedFilterResults[filterSetIdx][yPosTmp][xPos + padSize + width - 2];
+      yPosTmp = yPos + padSize + height + 1;
+      fixedFilterResults[filterSetIdx][yPosTmp][xPos + padSize + width + 0] = fixedFilterResults[filterSetIdx][yPosTmp][xPos + padSize + width - 1];
+      fixedFilterResults[filterSetIdx][yPosTmp][xPos + padSize + width + 1] = fixedFilterResults[filterSetIdx][yPosTmp][xPos + padSize + width - 2];
+    }
+    else
+    {
+      xPosTmp = xPos + padSize + width + 0;
+      fixedFilterResults[filterSetIdx][yPos + padSize + height + 0][xPosTmp] = fixedFilterResults[filterSetIdx][yPos + padSize + height - 1][xPosTmp];
+      fixedFilterResults[filterSetIdx][yPos + padSize + height + 1][xPosTmp] = fixedFilterResults[filterSetIdx][yPos + padSize + height - 2][xPosTmp];
+      xPosTmp = xPos + padSize + width + 1;
+      fixedFilterResults[filterSetIdx][yPos + padSize + height + 0][xPosTmp] = fixedFilterResults[filterSetIdx][yPos + padSize + height - 1][xPosTmp];
+      fixedFilterResults[filterSetIdx][yPos + padSize + height + 1][xPosTmp] = fixedFilterResults[filterSetIdx][yPos + padSize + height - 2][xPosTmp];
+    }
+  }
+}
+
+void AdaptiveLoopFilter::deriveFixedFilterResultsPerBlk(AlfClassifier **classifier, Pel ***fixedFilterResults, const CPelBuf &srcLuma, const Area &blkCur, const int bits, CodingStructure& cs, const ClpRng &clpRng, const Pel clippingValues[4], int qp, int fixedFilterSetIdx, int mappingDir[NUM_DIR_FIX][NUM_DIR_FIX], uint32_t **laplacian[NUM_DIRECTIONS], const int classifierIdx   )
+{
+  bool useSimd = (blkCur.size().width % 8 == 0) && (blkCur.size().height % ALF_PADDING_SIZE_FIXED_RESULTS == 0) ? true : false;
+
+  int fixedFiltSetIndMin = (qp - 22) / 4;
+  int fixedFiltSetIndMax = (qp - 18) / 4;
+  if (fixedFiltSetIndMin <= 0)
+  {
+    fixedFiltSetIndMin = 0;
+    fixedFiltSetIndMax = 1;
+  }
+
+  if (fixedFiltSetIndMax > (NUM_SETS_FIXED_FILTERS - 1))
+  {
+    fixedFiltSetIndMin = NUM_SETS_FIXED_FILTERS - 2;
+    fixedFiltSetIndMax = NUM_SETS_FIXED_FILTERS - 1;
+  }
+
+  int targetFixedFilterSetInd = fixedFilterSetIdx == 0 ? fixedFiltSetIndMin :  fixedFiltSetIndMax;
+  if(useSimd)
+  {
+    m_deriveClassificationLaplacian(srcLuma,blkCur, blkCur, laplacian);
+  }
+  else
+  {
+    deriveClassificationLaplacian(srcLuma,blkCur, blkCur, laplacian);
+  }
+  if( classifierIdx > 0 )
+  {
+    if(useSimd)
+    {
+      m_deriveClassificationLaplacianBig(blkCur, laplacian);
+    }
+    else
+    {
+      deriveClassificationLaplacianBig(blkCur, laplacian);
+    }
+  }
+  if(useSimd )
+  {
+    m_calcClass0(classifier, blkCur, blkCur, usedWindowIdx[classifierIdx], 1, NUM_DIR_FIX, NUM_ACT_FIX, bits, 2, mappingDir, laplacian);
+    m_filter13x13Blk(classifier, srcLuma, blkCur, blkCur, fixedFilterResults, m_picWidth, classifierIdx * NUM_FIXED_FILTER_SETS + fixedFilterSetIdx, m_classIdnFixedFilter[targetFixedFilterSetInd][classifierIdx], targetFixedFilterSetInd, classifierIdx, clpRng, clippingValues);
+  }
+  else
+  {
+    calcClass(classifier, blkCur, blkCur, usedWindowIdx[classifierIdx], 1, NUM_DIR_FIX, NUM_ACT_FIX, bits, 2, mappingDir, laplacian);
+    fixedFiltering(classifier, srcLuma, blkCur, blkCur, fixedFilterResults, m_picWidth, classifierIdx * NUM_FIXED_FILTER_SETS + fixedFilterSetIdx, m_classIdnFixedFilter[targetFixedFilterSetInd][classifierIdx], targetFixedFilterSetInd, classifierIdx, clpRng, clippingValues);
+  }
+}
+#endif
diff --git a/source/Lib/CommonLib/AdaptiveLoopFilter.h b/source/Lib/CommonLib/AdaptiveLoopFilter.h
index 447d392a..a8210ddf 100644
--- a/source/Lib/CommonLib/AdaptiveLoopFilter.h
+++ b/source/Lib/CommonLib/AdaptiveLoopFilter.h
@@ -87,7 +87,7 @@ public:
     return Clip3<int>( -clip, +clip, val - ref );
   }
 #endif
-#if JVET_AA0095_ALF_LONGER_FILTER || JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF
+#if JVET_AA0095_ALF_LONGER_FILTER || JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF || JVET_AA_EE2_5_1
   static inline int numFixedFilters( AlfFilterType filterType )
   {
     return ( filterType >= ALF_FILTER_9_EXT ) ? 2 : 1 ;
@@ -134,6 +134,12 @@ public:
                              Pel ***fixedFilterResults, int picWidth, const int fixedFiltInd,
                              const short classIndFixed[NUM_CLASSES_FIX], int fixedFiltQpInd, int dirWindSize,
                              const ClpRng &clpRng, const Pel clippingValues[4]);
+#if JVET_AA_EE2_5_1
+  void paddingFixedFilterResultsPic(Pel*** fixedFilterResultsPic, const int fixedFilterSetIdx);
+  void paddingFixedFilterResultsCtu(Pel*** fixedFilterResultsPic, Pel*** fixedFilterResultsCtu, const int fixedFilterSetIdx, const Area &blk);
+  void deriveFixedFilterResultsCtuBoundary(AlfClassifier **classifier, Pel ***fixedFilterResults, const CPelBuf &srcLuma, const Area &blkDst, const int bits, CodingStructure& cs, const ClpRng &clpRng, const Pel clippingValues[4], int qp, int fixedFilterSetIdx, int mappingDir[NUM_DIR_FIX][NUM_DIR_FIX], uint32_t **laplacian[NUM_DIRECTIONS], uint8_t* ctuEnableFlagLuma, uint8_t* ctuEnableOnlineLuma, int ctuIdx);
+  void deriveFixedFilterResultsPerBlk(AlfClassifier **classifier, Pel ***fixedFilterResults, const CPelBuf &srcLuma, const Area &blkCur, const int bits, CodingStructure& cs, const ClpRng &clpRng, const Pel clippingValues[4], int qp, int fixedFilterSetIdx, int mappingDir[NUM_DIR_FIX][NUM_DIR_FIX], uint32_t **laplacian[NUM_DIRECTIONS], const int classifierIdx );
+#endif
 
   int assignAct(int avg_varPrec, int shift, int noAct);
   static void calcClass(AlfClassifier **classifier, const Area &blkDst, const Area &cu, int dirWindSize, int classDir, int noDir, int noAct, int bitDepth, int subBlkSize, int mappingDir[NUM_DIR_FIX][NUM_DIR_FIX], uint32_t **laplacian[NUM_DIRECTIONS]);
@@ -189,7 +195,11 @@ public:
 #else
     const short *fClipSet, const ClpRng &clpRng, CodingStructure &cs
 #endif
-                        , Pel ***fixedFilterResults, int fixedFilterSetIdx);   
+                        , Pel ***fixedFilterResults, int fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+    , Pel ***fixedFilterResultsPerCtu, bool isFixedFilterPaddedPerCtu
+#endif
+   );
 #else
   void(*m_filterCcAlf)(const PelBuf &dstBuf, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blkSrc, const ComponentID compId, const int16_t *filterCoeff, const ClpRngs &clpRngs, CodingStructure &cs, int vbCTUHeight, int vbPos);
   template<AlfFilterType filtType>
@@ -204,26 +214,90 @@ public:
 #if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT
 #if ALF_IMPROVEMENT
 #if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF
-  void(*m_filter5x5Blk)(AlfClassifier **classifier, const PelUnitBuf &recDst, const PelUnitBuf &recBeforeDb, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const Pel *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx);
-  void(*m_filter7x7Blk)(AlfClassifier **classifier, const PelUnitBuf &recDst, const PelUnitBuf &recBeforeDb, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const Pel *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx);
-  void  alfFiltering(AlfClassifier **classifier, const PelUnitBuf &recDst, const PelUnitBuf &recBeforeDb, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const Pel *fClipSet, const ClpRng &clpRng, CodingStructure &cs, AlfFilterType filterType, Pel ***fixedFilterResults, int fixedFilterSetIdx);
-  void(*m_filter9x9Blk)(AlfClassifier **classifier, const PelUnitBuf &recDst, const PelUnitBuf &recBeforeDb, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const Pel *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx);
-  void(*m_filter9x9BlkExt)(AlfClassifier **classifier, const PelUnitBuf &recDst, const PelUnitBuf &recBeforeDb, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const Pel *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx);
-  void(*m_filterBlkExt)(AlfClassifier **classifier, const PelUnitBuf &recDst, const PelUnitBuf &recBeforeDb, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const Pel *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx);
-  void(*m_filter9x9BlkExtDb)(AlfClassifier **classifier, const PelUnitBuf &recDst, const PelUnitBuf &recBeforeDb, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const Pel *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx);
+  void(*m_filter5x5Blk)(AlfClassifier **classifier, const PelUnitBuf &recDst, const PelUnitBuf &recBeforeDb, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const Pel *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+    , Pel ***fixedFilterResultsPerCtu, bool isFixedFilterPaddedPerCtu
+#endif
+    );
+  void(*m_filter7x7Blk)(AlfClassifier **classifier, const PelUnitBuf &recDst, const PelUnitBuf &recBeforeDb, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const Pel *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+    , Pel ***fixedFilterResultsPerCtu, bool isFixedFilterPaddedPerCtu
+#endif
+    );
+  void  alfFiltering(AlfClassifier **classifier, const PelUnitBuf &recDst, const PelUnitBuf &recBeforeDb, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const Pel *fClipSet, const ClpRng &clpRng, CodingStructure &cs, AlfFilterType filterType, Pel ***fixedFilterResults, int fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+    , Pel ***fixedFilterResultsPerCtu, bool isFixedFilterPaddedPerCtu
+#endif
+    );
+  void(*m_filter9x9Blk)(AlfClassifier **classifier, const PelUnitBuf &recDst, const PelUnitBuf &recBeforeDb, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const Pel *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+    , Pel ***fixedFilterResultsPerCtu, bool isFixedFilterPaddedPerCtu
+#endif
+    );
+  void(*m_filter9x9BlkExt)(AlfClassifier **classifier, const PelUnitBuf &recDst, const PelUnitBuf &recBeforeDb, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const Pel *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+    , Pel ***fixedFilterResultsPerCtu, bool isFixedFilterPaddedPerCtu
+#endif
+    );
+  void(*m_filterBlkExt)(AlfClassifier **classifier, const PelUnitBuf &recDst, const PelUnitBuf &recBeforeDb, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const Pel *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+    , Pel ***fixedFilterResultsPerCtu, bool isFixedFilterPaddedPerCtu
+#endif
+    );
+  void(*m_filter9x9BlkExtDb)(AlfClassifier **classifier, const PelUnitBuf &recDst, const PelUnitBuf &recBeforeDb, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const Pel *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+    , Pel ***fixedFilterResultsPerCtu, bool isFixedFilterPaddedPerCtu
+#endif
+    );
 #if JVET_AA0095_ALF_LONGER_FILTER
-  void(*m_filter13x13BlkExtDb)(AlfClassifier **classifier, const PelUnitBuf &recDst, const PelUnitBuf &recBeforeDb, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const Pel *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx);
-  void(*m_filter13x13BlkExt)(AlfClassifier **classifier, const PelUnitBuf &recDst, const PelUnitBuf &recBeforeDb, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const Pel *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx);
+  void(*m_filter13x13BlkExtDb)(AlfClassifier **classifier, const PelUnitBuf &recDst, const PelUnitBuf &recBeforeDb, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const Pel *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+     , Pel ***fixedFilterResultsPerCtu, bool isFixedFilterPaddedPerCtu
+#endif
+    );
+  void(*m_filter13x13BlkExt)(AlfClassifier **classifier, const PelUnitBuf &recDst, const PelUnitBuf &recBeforeDb, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const Pel *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+     , Pel ***fixedFilterResultsPerCtu, bool isFixedFilterPaddedPerCtu
+#endif
+    );
 #endif
 #else
-  void(*m_filter5x5Blk)(AlfClassifier **classifier, const PelUnitBuf &recDst, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const Pel *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx);
-  void(*m_filter7x7Blk)(AlfClassifier **classifier, const PelUnitBuf &recDst, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const Pel *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx);
-  void  alfFiltering(AlfClassifier **classifier, const PelUnitBuf &recDst, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const Pel *fClipSet, const ClpRng &clpRng, CodingStructure &cs, AlfFilterType filterType, Pel ***fixedFilterResults, int fixedFilterSetIdx);
-  void(*m_filter9x9Blk)(AlfClassifier **classifier, const PelUnitBuf &recDst, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const Pel *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx);
-  void(*m_filter9x9BlkExt)(AlfClassifier **classifier, const PelUnitBuf &recDst, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const Pel *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx);
-  void(*m_filterBlkExt)(AlfClassifier **classifier, const PelUnitBuf &recDst, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const Pel *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx);
+  void(*m_filter5x5Blk)(AlfClassifier **classifier, const PelUnitBuf &recDst, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const Pel *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+    , Pel ***fixedFilterResultsPerCtu, bool isFixedFilterPaddedPerCtu
+#endif
+    );
+  void(*m_filter7x7Blk)(AlfClassifier **classifier, const PelUnitBuf &recDst, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const Pel *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+     , Pel ***fixedFilterResultsPerCtu, bool isFixedFilterPaddedPerCtu
+#endif
+    );
+  void  alfFiltering(AlfClassifier **classifier, const PelUnitBuf &recDst, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const Pel *fClipSet, const ClpRng &clpRng, CodingStructure &cs, AlfFilterType filterType, Pel ***fixedFilterResults, int fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+     , Pel ***fixedFilterResultsPerCtu, bool isFixedFilterPaddedPerCtu
+#endif
+    );
+  void(*m_filter9x9Blk)(AlfClassifier **classifier, const PelUnitBuf &recDst, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const Pel *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+     , Pel ***fixedFilterResultsPerCtu, bool isFixedFilterPaddedPerCtu
+#endif
+    );
+  void(*m_filter9x9BlkExt)(AlfClassifier **classifier, const PelUnitBuf &recDst, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const Pel *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+     , Pel ***fixedFilterResultsPerCtu, bool isFixedFilterPaddedPerCtu
+#endif
+    );
+  void(*m_filterBlkExt)(AlfClassifier **classifier, const PelUnitBuf &recDst, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const Pel *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+    , Pel ***fixedFilterResultsPerCtu, bool isFixedFilterPaddedPerCtu
+#endif
+    );
 #if JVET_AA0095_ALF_LONGER_FILTER
-  void(*m_filter13x13BlkExt)(AlfClassifier **classifier, const PelUnitBuf &recDst, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const Pel *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx);
+  void(*m_filter13x13BlkExt)(AlfClassifier **classifier, const PelUnitBuf &recDst, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const Pel *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+    , Pel ***fixedFilterResultsPerCtu, bool isFixedFilterPaddedPerCtu
+#endif
+    );
 #endif
 #endif
 #else
@@ -234,26 +308,90 @@ public:
 #else
 #if ALF_IMPROVEMENT
 #if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF
-  void(*m_filter5x5Blk)(AlfClassifier **classifier, const PelUnitBuf &recDst, const PelUnitBuf &recBeforeDb, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const short *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx);
-  void(*m_filter7x7Blk)(AlfClassifier **classifier, const PelUnitBuf &recDst, const PelUnitBuf &recBeforeDb, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const short *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx);
-  void  alfFiltering(AlfClassifier **classifier, const PelUnitBuf &recDst, const PelUnitBuf &recBeforeDb, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const short *fClipSet, const ClpRng &clpRng, CodingStructure &cs, AlfFilterType filterType, Pel ***fixedFilterResults, int fixedFilterSetIdx);
-  void(*m_filter9x9Blk)(AlfClassifier **classifier, const PelUnitBuf &recDst, const PelUnitBuf &recBeforeDb, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const short *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx);
-  void(*m_filter9x9BlkExt)(AlfClassifier **classifier, const PelUnitBuf &recDst, const PelUnitBuf &recBeforeDb, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const short *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults);
-  void(*m_filterBlkExt)(AlfClassifier **classifier, const PelUnitBuf &recDst, const PelUnitBuf &recBeforeDb, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const short *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults);
-  void(*m_filter9x9BlkExtDb)(AlfClassifier **classifier, const PelUnitBuf &recDst, const PelUnitBuf &recBeforeDb, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const short *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults);
+  void(*m_filter5x5Blk)(AlfClassifier **classifier, const PelUnitBuf &recDst, const PelUnitBuf &recBeforeDb, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const short *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+    , Pel ***fixedFilterResultsPerCtu, bool isFixedFilterPaddedPerCtu
+#endif
+    );
+  void(*m_filter7x7Blk)(AlfClassifier **classifier, const PelUnitBuf &recDst, const PelUnitBuf &recBeforeDb, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const short *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+    , Pel ***fixedFilterResultsPerCtu, bool isFixedFilterPaddedPerCtu
+#endif
+    );
+  void  alfFiltering(AlfClassifier **classifier, const PelUnitBuf &recDst, const PelUnitBuf &recBeforeDb, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const short *fClipSet, const ClpRng &clpRng, CodingStructure &cs, AlfFilterType filterType, Pel ***fixedFilterResults, int fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+    , Pel ***fixedFilterResultsPerCtu, bool isFixedFilterPaddedPerCtu
+#endif
+    );
+  void(*m_filter9x9Blk)(AlfClassifier **classifier, const PelUnitBuf &recDst, const PelUnitBuf &recBeforeDb, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const short *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+    , Pel ***fixedFilterResultsPerCtu, bool isFixedFilterPaddedPerCtu
+#endif
+    );
+  void(*m_filter9x9BlkExt)(AlfClassifier **classifier, const PelUnitBuf &recDst, const PelUnitBuf &recBeforeDb, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const short *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+    , Pel ***fixedFilterResultsPerCtu, bool isFixedFilterPaddedPerCtu
+#endif
+    );
+  void(*m_filterBlkExt)(AlfClassifier **classifier, const PelUnitBuf &recDst, const PelUnitBuf &recBeforeDb, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const short *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+    , Pel ***fixedFilterResultsPerCtu, bool isFixedFilterPaddedPerCtu
+#endif
+    );
+  void(*m_filter9x9BlkExtDb)(AlfClassifier **classifier, const PelUnitBuf &recDst, const PelUnitBuf &recBeforeDb, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const short *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+    , Pel ***fixedFilterResultsPerCtu, bool isFixedFilterPaddedPerCtu
+#endif
+    );
 #if JVET_AA0095_ALF_LONGER_FILTER
-  void(*m_filter13x13BlkExtDb)(AlfClassifier **classifier, const PelUnitBuf &recDst, const PelUnitBuf &recBeforeDb, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const short *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults);
-  void(*m_filter13x13BlkExt)(AlfClassifier **classifier, const PelUnitBuf &recDst, const PelUnitBuf &recBeforeDb, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const short *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults);
+  void(*m_filter13x13BlkExtDb)(AlfClassifier **classifier, const PelUnitBuf &recDst, const PelUnitBuf &recBeforeDb, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const short *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+    , Pel ***fixedFilterResultsPerCtu, bool isFixedFilterPaddedPerCtu
+#endif
+    );
+  void(*m_filter13x13BlkExt)(AlfClassifier **classifier, const PelUnitBuf &recDst, const PelUnitBuf &recBeforeDb, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const short *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+    , Pel ***fixedFilterResultsPerCtu, bool isFixedFilterPaddedPerCtu
+#endif
+    );
 #endif
 #else
-  void(*m_filter5x5Blk)(AlfClassifier **classifier, const PelUnitBuf &recDst, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const short *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx);
-  void(*m_filter7x7Blk)(AlfClassifier **classifier, const PelUnitBuf &recDst, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const short *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx);
-  void  alfFiltering(AlfClassifier **classifier, const PelUnitBuf &recDst, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const short *fClipSet, const ClpRng &clpRng, CodingStructure &cs, AlfFilterType filterType, Pel ***fixedFilterResults, int fixedFilterSetIdx);
-  void(*m_filter9x9Blk)(AlfClassifier **classifier, const PelUnitBuf &recDst, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const short *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx);
-  void(*m_filter9x9BlkExt)(AlfClassifier **classifier, const PelUnitBuf &recDst, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const short *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults);
-  void(*m_filterBlkExt)(AlfClassifier **classifier, const PelUnitBuf &recDst, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const short *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults);
+  void(*m_filter5x5Blk)(AlfClassifier **classifier, const PelUnitBuf &recDst, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const short *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+    , Pel ***fixedFilterResultsPerCtu, bool isFixedFilterPaddedPerCtu
+#endif
+    );
+  void(*m_filter7x7Blk)(AlfClassifier **classifier, const PelUnitBuf &recDst, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const short *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+    , Pel ***fixedFilterResultsPerCtu, bool isFixedFilterPaddedPerCtu
+#endif
+    );
+  void  alfFiltering(AlfClassifier **classifier, const PelUnitBuf &recDst, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const short *fClipSet, const ClpRng &clpRng, CodingStructure &cs, AlfFilterType filterType, Pel ***fixedFilterResults, int fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+    , Pel ***fixedFilterResultsPerCtu, bool isFixedFilterPaddedPerCtu
+#endif
+    );
+  void(*m_filter9x9Blk)(AlfClassifier **classifier, const PelUnitBuf &recDst, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const short *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+    , Pel ***fixedFilterResultsPerCtu, bool isFixedFilterPaddedPerCtu
+#endif
+    );
+  void(*m_filter9x9BlkExt)(AlfClassifier **classifier, const PelUnitBuf &recDst, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const short *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+    , Pel ***fixedFilterResultsPerCtu, bool isFixedFilterPaddedPerCtu
+#endif
+    );
+  void(*m_filterBlkExt)(AlfClassifier **classifier, const PelUnitBuf &recDst, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const short *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+    , Pel ***fixedFilterResultsPerCtu, bool isFixedFilterPaddedPerCtu
+#endif
+    );
 #if JVET_AA0095_ALF_LONGER_FILTER
-  void(*m_filter13x13BlkExt)(AlfClassifier **classifier, const PelUnitBuf &recDst, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const short *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults);
+  void(*m_filter13x13BlkExt)(AlfClassifier **classifier, const PelUnitBuf &recDst, const CPelUnitBuf &recSrc, const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet, const short *fClipSet, const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+    , Pel ***fixedFilterResultsPerCtu, bool isFixedFilterPaddedPerCtu
+#endif
+    );
 #endif
 #endif
 #else
@@ -334,6 +472,11 @@ protected:
   short                        m_chromaClippFinal[MAX_NUM_ALF_ALTERNATIVES_CHROMA][MAX_NUM_ALF_CHROMA_COEFF];
 #if ALF_IMPROVEMENT
   Pel***                       m_fixFilterResult;
+#if JVET_AA_EE2_5_1
+  Pel***                       m_fixedFilterResultPerCtu;
+  bool                         m_isFixedFilterPaddedPerCtu;
+  uint8_t*                     m_ctuEnableOnlineLumaFlag;
+#endif
   const int                    usedWindowIdx[NUM_CLASSIFIER] = { 1, 5 };
   int                          m_mappingDir[NUM_DIR_FIX][NUM_DIR_FIX];
   uint32_t**                   m_laplacian[NUM_DIRECTIONS];
diff --git a/source/Lib/CommonLib/AlfParameters.h b/source/Lib/CommonLib/AlfParameters.h
index 0587584c..2f149827 100644
--- a/source/Lib/CommonLib/AlfParameters.h
+++ b/source/Lib/CommonLib/AlfParameters.h
@@ -83,6 +83,8 @@ const int alfTypeToSize[ALF_NUM_OF_FILTER_TYPES] = { 5, 7, size_CC_ALF, 9, size_
 #elif JVET_AA0095_ALF_LONGER_FILTER
 static const int size_ALF_FILTER_13_EXT = -4;
 const int alfTypeToSize[ALF_NUM_OF_FILTER_TYPES] = { 5, 7, size_CC_ALF, 9, size_ALF_FILTER_9_EXT, size_ALF_FILTER_EXT, size_ALF_FILTER_13_EXT };
+#elif JVET_AA_EE2_5_1
+const int alfTypeToSize[ALF_NUM_OF_FILTER_TYPES] = { 5, 7, size_CC_ALF, 9, size_ALF_FILTER_9_EXT, size_ALF_FILTER_EXT };
 #endif
 #endif
 
@@ -191,12 +193,17 @@ struct AlfFilterShape
     else if( size == size_ALF_FILTER_9_EXT )
     {
       size = 9;
+#if JVET_AA_EE2_5_1
+      numCoeff = 21 + EXT_LENGTH + NUM_FIXED_BASED_COEFF - 1;
+      filterSize = 21 + EXT_LENGTH + NUM_FIXED_BASED_COEFF - 1;
+#else
 #if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF
       numCoeff = 21 + EXT_LENGTH;
       filterSize = 21 + EXT_LENGTH;
 #else
       numCoeff = MAX_NUM_ALF_LUMA_COEFF;
       filterSize = MAX_NUM_ALF_LUMA_COEFF;
+#endif
 #endif
       filterLength = 9;
       filterType = ALF_FILTER_9_EXT;
@@ -213,7 +220,11 @@ struct AlfFilterShape
       };
 #if ALF_IMPROVEMENT
       numOrder = 2;
+#if JVET_AA_EE2_5_1
+      indexSecOrder = 20 + NUM_FIXED_BASED_COEFF - 1;
+#else
       indexSecOrder = 20;
+#endif
       offset0 = 0;
 #endif
     }
@@ -221,8 +232,13 @@ struct AlfFilterShape
     else if( size == size_ALF_FILTER_9_EXT_DB )
     {
       size = 9;
+#if JVET_AA_EE2_5_1
+      numCoeff = 21 + EXT_LENGTH + NUM_DB + NUM_FIXED_BASED_COEFF - 1;
+      filterSize = 21 + EXT_LENGTH + NUM_DB + NUM_FIXED_BASED_COEFF - 1;
+#else
       numCoeff = 21 + EXT_LENGTH + NUM_DB;
       filterSize = 21 + EXT_LENGTH + NUM_DB;
+#endif
       filterLength = 9;
       filterType = ALF_FILTER_9_EXT_DB;
       pattern = {
@@ -237,7 +253,11 @@ struct AlfFilterShape
                      0
       };
       numOrder = 2;
+#if JVET_AA_EE2_5_1
+      indexSecOrder = 19 + NUM_DB + NUM_FIXED_BASED_COEFF - 1;
+#else
       indexSecOrder = 19 + NUM_DB;
+#endif
       offset0 = 0;
     }
 #endif
@@ -245,8 +265,13 @@ struct AlfFilterShape
     else if( size == size_ALF_FILTER_13_EXT )
     {
       size = 13;
+#if JVET_AA_EE2_5_1
+      numCoeff = 21 + EXT_LENGTH + NUM_FIXED_BASED_COEFF - 1;
+      filterSize = 21 + EXT_LENGTH + NUM_FIXED_BASED_COEFF - 1;
+#else
       numCoeff = 21 + EXT_LENGTH;
       filterSize = 21 + EXT_LENGTH;
+#endif
       filterLength = 13;
       filterType = ALF_FILTER_13_EXT;
       pattern = {
@@ -265,7 +290,11 @@ struct AlfFilterShape
                             0
       };
       numOrder = 2;
+#if JVET_AA_EE2_5_1
+      indexSecOrder = 20 + NUM_FIXED_BASED_COEFF - 1;
+#else
       indexSecOrder = 20;
+#endif
       offset0 = 0;
     }
 #endif
@@ -273,8 +302,13 @@ struct AlfFilterShape
     else if( size == size_ALF_FILTER_13_EXT_DB )
     {
       size = 13;
+#if JVET_AA_EE2_5_1
+      numCoeff = 21 + EXT_LENGTH + NUM_DB + NUM_FIXED_BASED_COEFF - 1;
+      filterSize = 21 + EXT_LENGTH + NUM_DB + NUM_FIXED_BASED_COEFF - 1;
+#else
       numCoeff = 21 + EXT_LENGTH + NUM_DB;
       filterSize = 21 + EXT_LENGTH + NUM_DB;
+#endif
       filterLength = 13;
       filterType = ALF_FILTER_13_EXT_DB;
       pattern = {
@@ -293,7 +327,11 @@ struct AlfFilterShape
                             0
       };
       numOrder = 2;
+#if JVET_AA_EE2_5_1
+      indexSecOrder = 19 + NUM_DB + NUM_FIXED_BASED_COEFF - 1;
+#else
       indexSecOrder = 19 + NUM_DB;
+#endif
       offset0 = 0;
     }
 #endif
diff --git a/source/Lib/CommonLib/CommonDef.h b/source/Lib/CommonLib/CommonDef.h
index 898abd3b..e3196b24 100644
--- a/source/Lib/CommonLib/CommonDef.h
+++ b/source/Lib/CommonLib/CommonDef.h
@@ -300,18 +300,30 @@ static const int MAX_NUM_ALF_CLASSES         =                     25;
 #if ALF_IMPROVEMENT
 static const int MAX_NUM_ALF_ALTERNATIVES_LUMA = 4;
 static const int EXT_LENGTH = 2;
+#if JVET_AA_EE2_5_1
+static const int ALF_PADDING_SIZE_FIXED_RESULTS  =                  2;
+static const int NUM_FIXED_BASED_COEFF       =                      7;
+#endif
 #if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF
 static const int NUM_DB                      =                      3;
 static const int NUM_DB_SAMPLE               =                      5;
 static const int NUM_DB_PAD                  =                      1;
+#if JVET_AA_EE2_5_1
+static const int MAX_NUM_ALF_LUMA_COEFF      =                     21 + EXT_LENGTH + NUM_DB + NUM_FIXED_BASED_COEFF;
+#else
 static const int MAX_NUM_ALF_LUMA_COEFF      =                     21 + EXT_LENGTH + NUM_DB;
+#endif
 #if JVET_AA0095_ALF_LONGER_FILTER
 static const int MAX_ALF_FILTER_LENGTH       =                     13;
 #else
 static const int MAX_ALF_FILTER_LENGTH       =                      9;
 #endif
 #else
+#if JVET_AA_EE2_5_1
+static const int MAX_NUM_ALF_LUMA_COEFF      =                     21 + EXT_LENGTH + NUM_FIXED_BASED_COEFF;
+#else
 static const int MAX_NUM_ALF_LUMA_COEFF      =                     21 + EXT_LENGTH;
+#endif
 static const int MAX_ALF_FILTER_LENGTH       =                      9;
 #endif
 static const int MAX_NUM_ALF_CHROMA_COEFF    =                     21;
diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h
index 60430c6f..681510bb 100644
--- a/source/Lib/CommonLib/TypeDef.h
+++ b/source/Lib/CommonLib/TypeDef.h
@@ -50,6 +50,7 @@
 #include <assert.h>
 #include <cassert>
 
+#define JVET_AA_EE2_5_1                                   1 //extension of fixed-filter-output based taps
 
 #define BASE_ENCODER                                      1
 #define BASE_NORMATIVE                                    1
diff --git a/source/Lib/CommonLib/x86/AdaptiveLoopFilterX86.h b/source/Lib/CommonLib/x86/AdaptiveLoopFilterX86.h
index 5e29f96a..99081e0c 100644
--- a/source/Lib/CommonLib/x86/AdaptiveLoopFilterX86.h
+++ b/source/Lib/CommonLib/x86/AdaptiveLoopFilterX86.h
@@ -344,6 +344,9 @@ static void simdFilter5x5Blk(AlfClassifier **classifier, const PelUnitBuf &recDs
 #endif
 #if ALF_IMPROVEMENT
   , Pel ***fixedFilterResults, int fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+  , Pel ***fixedFilterResultsPerCtu, bool isFixedFilterPaddedPerCtu
+#endif
 #else
   , const int vbCTUHeight, int vbPos
 #endif
@@ -611,6 +614,9 @@ static void simdFilter7x7Blk(AlfClassifier **classifier, const PelUnitBuf &recDs
 #endif
 #if ALF_IMPROVEMENT
   , Pel ***fixedFilterResults, int fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+  , Pel ***fixedFilterResultsPerCtu, bool isFixedFilterPaddedPerCtu
+#endif
 #else
   , const int vbCTUHeight, int vbPos
 #endif
@@ -866,6 +872,111 @@ static void simdFilter7x7Blk(AlfClassifier **classifier, const PelUnitBuf &recDs
 }
 
 #if ALF_IMPROVEMENT
+#if JVET_AA_EE2_5_1
+static const uint16_t shuffleTime9FixedBasedDiamond[4] = { 0, 4, 2, 4 };
+static const uint16_t shuffleOp9FixedBasedDiamond[4][4][2] =
+{
+  {
+    { 0, 1 },
+    { 0, 1 },
+    { 0, 1 },
+    { 0, 1 },
+  }, //0
+  {
+    { 0, 1 },
+    { 0, 2 },
+    { 1, 2 },
+    { 2, 3 },
+  }, //1
+  {
+    { 0, 1 },
+    { 2, 3 },
+    { 0, 1 },
+    { 0, 1 },
+  }, //2
+  {
+    { 0, 1 },
+    { 0, 2 },
+    { 1, 2 },
+    { 2, 3 },
+  }, //3
+};
+static const uint16_t shuffleTab9FixedBasedDiamond[4][4][2][8] =
+{
+  {
+    {
+      { sh(0) , sh(1) , sh(2) , sh(3) , sh(4) , sh(5) , sh(6) , sh(7) },
+      { sh(8) , sh(9) , sh(10), sh(11), sh(12), sh(13), sh(14), sh(15) },
+    },
+    {
+      { sh(0) , sh(1) , sh(2) , sh(3) , sh(4) , sh(5) , sh(6) , sh(7) },
+      { sh(8) , sh(9) , sh(10), sh(11), sh(12), sh(13), sh(14), sh(15) },
+    },
+    {
+      { sh(0) , sh(1) , sh(2) , sh(3) , sh(4) , sh(5) , sh(6) , sh(7) },
+      { sh(8) , sh(9) , sh(10), sh(11), sh(12), sh(13), sh(14), sh(15) },
+    },
+    {
+      { sh(0) , sh(1) , sh(2) , sh(3) , sh(4) , sh(5) , sh(6) , sh(7) },
+      { sh(8) , sh(9) , sh(10), sh(11), sh(12), sh(13), sh(14), sh(15) },
+    },
+  }, //0
+  {
+    {
+      { sh(0) , sh(9) , sh(2) , sh(15), sh(4) , sh(10), sh(6) , sh(14) },
+      { sh(8) , sh(1) , sh(5) , sh(11), sh(12), sh(13), sh(7) , sh(3) },
+    },
+    {
+      { sh(8) , sh(1) , sh(9), sh(3) , sh(4) , sh(5) , sh(10) , sh(7) },
+      { sh(0) , sh(2) , sh(6), sh(11), sh(12), sh(13), sh(14), sh(15) },
+    },
+    {
+      { sh(0) , sh(1) , sh(2) , sh(3), sh(11), sh(5) , sh(6) , sh(7) },
+      { sh(8) , sh(9) , sh(10), sh(4), sh(12), sh(13), sh(14), sh(15) },
+    },
+    {
+      { sh(0) , sh(1) , sh(2) , sh(3) , sh(8) , sh(5) , sh(9) , sh(7) },
+      { sh(4) , sh(6) , sh(10), sh(11), sh(12), sh(13), sh(14), sh(15) },
+    },
+  }, //1
+  {
+    {
+      { sh(0) , sh(3) , sh(2) , sh(1) , sh(8) , sh(7) , sh(6) , sh(5) },
+      { sh(4) , sh(15), sh(14), sh(13), sh(12), sh(11), sh(10), sh(9) },
+    },
+    {
+      { sh(0) , sh(1) , sh(2) , sh(3) , sh(4) , sh(7) , sh(6) , sh(5) },
+      { sh(8) , sh(9) , sh(10), sh(11), sh(12), sh(13), sh(14), sh(15) },
+    },
+    {
+      { sh(0) , sh(1) , sh(2) , sh(3) , sh(4) , sh(5) , sh(6) , sh(7) },
+      { sh(8) , sh(9) , sh(10), sh(11), sh(12), sh(13), sh(14), sh(15) },
+    },
+    {
+      { sh(0) , sh(1) , sh(2) , sh(3) , sh(4) , sh(5) , sh(6) , sh(7) },
+      { sh(8) , sh(9) , sh(10), sh(11), sh(12), sh(13), sh(14), sh(15) },
+    },
+  }, //2
+  {
+    {
+      { sh(0) , sh(15), sh(2), sh(9), sh(8) , sh(14), sh(6), sh(10) },
+      { sh(4) , sh(3) , sh(7), sh(13), sh(1), sh(11), sh(5), sh(12) },
+    },
+    {
+      { sh(8) , sh(1) , sh(9), sh(3) , sh(4) , sh(5) , sh(10), sh(7) },
+      { sh(0) , sh(2) , sh(6), sh(11), sh(12), sh(13), sh(14), sh(15) },
+    },
+    {
+      { sh(0) , sh(1) , sh(2) , sh(3), sh(11), sh(5) , sh(6) , sh(4) },
+      { sh(8) , sh(9) , sh(10), sh(7), sh(12), sh(13), sh(14), sh(15) },
+    },
+    {
+      { sh(0) , sh(1) , sh(2) , sh(3) , sh(8) , sh(7) , sh(9) , sh(5) },
+      { sh(4) , sh(6) , sh(10), sh(11), sh(12), sh(13), sh(14), sh(15) },
+    },
+  }, //3
+};
+#endif
 static const uint16_t shuffleTime9[4] = { 0, 3, 1, 3 };
 static const uint16_t shuffleOp9[4][3][2] =
 {
@@ -963,7 +1074,11 @@ static void simdFilter9x9Blk(AlfClassifier **classifier, const PelUnitBuf &recDs
 #else
   const short *fClipSet
 #endif
-  , const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx)
+  , const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+  , Pel ***fixedFilterResultsPerCtu, bool isFixedFilterPaddedPerCtu
+#endif
+  )
 {
   const CPelBuf srcBuffer = recSrc.get(compId);
   PelBuf        dstBuffer = recDst.get(compId);
@@ -1163,7 +1278,11 @@ static void simdFilter9x9BlkExt(AlfClassifier **classifier, const PelUnitBuf &re
 #else
   const short *fClipSet
 #endif
-  , const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx)
+  , const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+  , Pel ***fixedFilterResultsPerCtu, bool isFixedFilterPaddedPerCtu
+#endif
+  )
 {
   const CPelBuf srcBuffer = recSrc.get(compId);
   PelBuf        dstBuffer = recDst.get(compId);
@@ -1189,16 +1308,27 @@ static void simdFilter9x9BlkExt(AlfClassifier **classifier, const PelUnitBuf &re
 
   const Pel *src = srcBuffer.buf + blk.y * srcStride + blk.x;
   Pel *      dst = dstBuffer.buf + blkDst.y * dstStride + blkDst.x;
+#if JVET_AA_EE2_5_1
+  const int padSize = ALF_PADDING_SIZE_FIXED_RESULTS;
+#endif
 
   for (size_t i = 0; i < height; i += STEP_Y)
   {
     const AlfClassifier *pClass = classifier[blkDst.y + i] + blkDst.x;
     for (size_t j = 0; j < width; j += STEP_X)
     {
+#if JVET_AA_EE2_5_1
+      __m128i params[2][2][14];
+#else
       __m128i params[2][2][11];
+#endif
       for (int k = 0; k < 2; k++)
       {
+#if JVET_AA_EE2_5_1
+        __m128i rawCoef[4][4], rawClip[4][4], s0, s1, s2, s3, rawTmp0, rawTmp1;
+#else
         __m128i rawCoef[4][3], rawClip[4][3], s0, s1, s2, s3, rawTmp0, rawTmp1;
+#endif
         for (int l = 0; l < 4; l++)
         {
           const int transposeIdx = pClass[j + 4 * k + l] & 0x3;
@@ -1207,19 +1337,40 @@ static void simdFilter9x9BlkExt(AlfClassifier **classifier, const PelUnitBuf &re
           rawCoef[l][0] = _mm_loadu_si128((const __m128i *) (filterSet + classIdx * MAX_NUM_ALF_LUMA_COEFF));
           rawCoef[l][1] = _mm_loadu_si128((const __m128i *) (filterSet + classIdx * MAX_NUM_ALF_LUMA_COEFF + 8));
           rawCoef[l][2] = _mm_loadu_si128((const __m128i *) (filterSet + classIdx * MAX_NUM_ALF_LUMA_COEFF + 16));
+#if JVET_AA_EE2_5_1
+          rawCoef[l][3] = _mm_loadu_si128((const __m128i *) (filterSet + classIdx * MAX_NUM_ALF_LUMA_COEFF + 24));
+#endif
           rawClip[l][0] = _mm_loadu_si128((const __m128i *) (fClipSet + classIdx * MAX_NUM_ALF_LUMA_COEFF));
           rawClip[l][1] = _mm_loadu_si128((const __m128i *) (fClipSet + classIdx * MAX_NUM_ALF_LUMA_COEFF + 8));
           rawClip[l][2] = _mm_loadu_si128((const __m128i *) (fClipSet + classIdx * MAX_NUM_ALF_LUMA_COEFF + 16));
+#if JVET_AA_EE2_5_1
+          rawClip[l][3] = _mm_loadu_si128((const __m128i *) (fClipSet + classIdx * MAX_NUM_ALF_LUMA_COEFF + 24));
+#endif
 
+#if JVET_AA_EE2_5_1
+          for (int m = 0; m < shuffleTime9FixedBasedDiamond[transposeIdx]; m++)
+#else
           for (int m = 0; m < shuffleTime9[transposeIdx]; m++)
+#endif
           {
+#if JVET_AA_EE2_5_1
+            int op0 = shuffleOp9FixedBasedDiamond[transposeIdx][m][0];
+            int op1 = shuffleOp9FixedBasedDiamond[transposeIdx][m][1];
+#else
             int op0 = shuffleOp9[transposeIdx][m][0];
             int op1 = shuffleOp9[transposeIdx][m][1];
-
+#endif
+#if JVET_AA_EE2_5_1
+            s0 = _mm_loadu_si128((const __m128i *) shuffleTab9FixedBasedDiamond[transposeIdx][m][0]);
+            s1 = _mm_xor_si128(s0, _mm_set1_epi8((char)0x80));
+            s2 = _mm_loadu_si128((const __m128i *) shuffleTab9FixedBasedDiamond[transposeIdx][m][1]);
+            s3 = _mm_xor_si128(s2, _mm_set1_epi8((char)0x80));
+#else
             s0 = _mm_loadu_si128((const __m128i *) shuffleTab9[transposeIdx][m][0]);
             s1 = _mm_xor_si128(s0, _mm_set1_epi8((char)0x80));
             s2 = _mm_loadu_si128((const __m128i *) shuffleTab9[transposeIdx][m][1]);
             s3 = _mm_xor_si128(s2, _mm_set1_epi8((char)0x80));
+#endif
 
             rawTmp0 = _mm_or_si128(_mm_shuffle_epi8(rawCoef[l][op0], s0), _mm_shuffle_epi8(rawCoef[l][op1], s1));
             rawTmp1 = _mm_or_si128(_mm_shuffle_epi8(rawCoef[l][op0], s2), _mm_shuffle_epi8(rawCoef[l][op1], s3));
@@ -1233,7 +1384,11 @@ static void simdFilter9x9BlkExt(AlfClassifier **classifier, const PelUnitBuf &re
           }            
         }//for l
 
+#if JVET_AA_EE2_5_1
+        for (unsigned char l = 0; l < 4; l++)
+#else
         for (unsigned char l = 0; l < 3; l++)
+#endif
         {
           int m = l << 2;
 
@@ -1250,16 +1405,20 @@ static void simdFilter9x9BlkExt(AlfClassifier **classifier, const PelUnitBuf &re
           s0 = _mm_unpacklo_epi64(_mm_shuffle_epi32(rawClip[0][l], 0x55), _mm_shuffle_epi32(rawClip[1][l], 0x55));
           s1 = _mm_unpacklo_epi64(_mm_shuffle_epi32(rawClip[2][l], 0x55), _mm_shuffle_epi32(rawClip[3][l], 0x55));
           params[k][1][1 + m] = _mm_blend_epi16(_mm_shuffle_epi32(s0, 0x88), _mm_shuffle_epi32(s1, 0x88), 0xf0);
-
+#if JVET_AA_EE2_5_1
+          if (l < 3)
+          {
+#endif
           s0 = _mm_unpacklo_epi64(_mm_shuffle_epi32(rawCoef[0][l], 0xaa), _mm_shuffle_epi32(rawCoef[1][l], 0xaa));
           s1 = _mm_unpacklo_epi64(_mm_shuffle_epi32(rawCoef[2][l], 0xaa), _mm_shuffle_epi32(rawCoef[3][l], 0xaa));
           params[k][0][2 + m] = _mm_blend_epi16(_mm_shuffle_epi32(s0, 0x88), _mm_shuffle_epi32(s1, 0x88), 0xf0);
           s0 = _mm_unpacklo_epi64(_mm_shuffle_epi32(rawClip[0][l], 0xaa), _mm_shuffle_epi32(rawClip[1][l], 0xaa));
           s1 = _mm_unpacklo_epi64(_mm_shuffle_epi32(rawClip[2][l], 0xaa), _mm_shuffle_epi32(rawClip[3][l], 0xaa));
           params[k][1][2 + m] = _mm_blend_epi16(_mm_shuffle_epi32(s0, 0x88), _mm_shuffle_epi32(s1, 0x88), 0xf0);
-
+#if !JVET_AA_EE2_5_1
           if (l < 2)
           {
+#endif
             s0 = _mm_unpacklo_epi64(_mm_shuffle_epi32(rawCoef[0][l], 0xff), _mm_shuffle_epi32(rawCoef[1][l], 0xff));
             s1 = _mm_unpacklo_epi64(_mm_shuffle_epi32(rawCoef[2][l], 0xff), _mm_shuffle_epi32(rawCoef[3][l], 0xff));
             params[k][0][3 + m] = _mm_blend_epi16(_mm_shuffle_epi32(s0, 0x88), _mm_shuffle_epi32(s1, 0x88), 0xf0);
@@ -1281,6 +1440,28 @@ static void simdFilter9x9BlkExt(AlfClassifier **classifier, const PelUnitBuf &re
       pImg7 = pImg5 + srcStride;
       pImg8 = pImg6 - srcStride;
 
+#if JVET_AA_EE2_5_1
+        int filterSetIdx = 0 + fixedFilterSetIdx;
+        const Pel *pImg0FixedBased, *pImg1FixedBased, *pImg2FixedBased, *pImg3FixedBased, *pImg4FixedBased;
+
+        if(isFixedFilterPaddedPerCtu )
+        {
+          pImg0FixedBased = fixedFilterResultsPerCtu[filterSetIdx][i + padSize + 0] + j + padSize;
+          pImg1FixedBased = fixedFilterResultsPerCtu[filterSetIdx][i + padSize + 1] + j + padSize;
+          pImg2FixedBased = fixedFilterResultsPerCtu[filterSetIdx][i + padSize - 1] + j + padSize;
+          pImg3FixedBased = fixedFilterResultsPerCtu[filterSetIdx][i + padSize + 2] + j + padSize;
+          pImg4FixedBased = fixedFilterResultsPerCtu[filterSetIdx][i + padSize - 2] + j + padSize;
+        }
+        else
+        {
+          pImg0FixedBased = fixedFilterResults[filterSetIdx][blkDst.y + i + padSize + 0] + blkDst.x + j + padSize;
+          pImg1FixedBased = fixedFilterResults[filterSetIdx][blkDst.y + i + padSize + 1] + blkDst.x + j + padSize;
+          pImg2FixedBased = fixedFilterResults[filterSetIdx][blkDst.y + i + padSize - 1] + blkDst.x + j + padSize;
+          pImg3FixedBased = fixedFilterResults[filterSetIdx][blkDst.y + i + padSize + 2] + blkDst.x + j + padSize;
+          pImg4FixedBased = fixedFilterResults[filterSetIdx][blkDst.y + i + padSize - 2] + blkDst.x + j + padSize;
+        }
+#endif
+
       __m128i cur = _mm_loadu_si128((const __m128i *) pImg0);
       __m128i accumA = mmOffset;
       __m128i accumB = mmOffset;
@@ -1332,20 +1513,38 @@ static void simdFilter9x9BlkExt(AlfClassifier **classifier, const PelUnitBuf &re
       process2coeffs(7, pImg1 - 2, pImg2 + 2, pImg1 - 3, pImg2 + 3);
       process2coeffs(8, pImg0 + 4, pImg0 - 4, pImg0 + 3, pImg0 - 3);
       process2coeffs(9, pImg0 + 2, pImg0 - 2, pImg0 + 1, pImg0 - 1);
+#if JVET_AA_EE2_5_1
+      process2coeffs(10, pImg4FixedBased - 0, pImg3FixedBased + 0, pImg2FixedBased - 1, pImg1FixedBased + 1);
+      process2coeffs(11, pImg2FixedBased - 0, pImg1FixedBased + 0, pImg2FixedBased + 1, pImg1FixedBased - 1);
+      process2coeffs(12, pImg0FixedBased - 2, pImg0FixedBased + 2, pImg0FixedBased - 1, pImg0FixedBased + 1);
+      const __m128i val00 = _mm_sub_epi16(_mm_loadu_si128((const __m128i *) (fixedFilterResults[0 + fixedFilterSetIdx][blkDst.y + i + padSize] + blkDst.x + j + padSize )), cur);
+      const __m128i val10 = _mm_sub_epi16(_mm_loadu_si128((const __m128i *) (fixedFilterResults[2 + fixedFilterSetIdx][blkDst.y + i + padSize] + blkDst.x + j + padSize )), cur);
+#else
       const __m128i val00 = _mm_sub_epi16(_mm_loadu_si128((const __m128i *) (fixedFilterResults[fixedFilterSetIdx][blkDst.y + i] + blkDst.x + j)), cur);
       const __m128i val10 = _mm_sub_epi16(_mm_loadu_si128((const __m128i *) (fixedFilterResults[EXT_LENGTH + fixedFilterSetIdx][blkDst.y + i] + blkDst.x + j)), cur);
+#endif
       __m128i val01A = _mm_unpacklo_epi16(val00, val10);
       __m128i val01B = _mm_unpackhi_epi16(val00, val10);
+#if JVET_AA_EE2_5_1
+      __m128i limit01A = params[0][1][13];
+      __m128i limit01B = params[1][1][13];
+#else
       __m128i limit01A = params[0][1][10];
       __m128i limit01B = params[1][1][10];
+#endif
       val01A = _mm_min_epi16(val01A, limit01A);
       val01B = _mm_min_epi16(val01B, limit01B);
       limit01A = _mm_sub_epi16(_mm_setzero_si128(), limit01A);
       limit01B = _mm_sub_epi16(_mm_setzero_si128(), limit01B);
       val01A = _mm_max_epi16(val01A, limit01A);
       val01B = _mm_max_epi16(val01B, limit01B);
+#if JVET_AA_EE2_5_1
+      const __m128i coeff01A = params[0][0][13];
+      const __m128i coeff01B = params[1][0][13];
+#else
       const __m128i coeff01A = params[0][0][10];
       const __m128i coeff01B = params[1][0][10];
+#endif
       accumA = _mm_add_epi32(accumA, _mm_madd_epi16(val01A, coeff01A));
       accumB = _mm_add_epi32(accumB, _mm_madd_epi16(val01B, coeff01B));
 
@@ -1447,6 +1646,111 @@ static const uint16_t shuffleTab13LongLength[4][3][2][8] =
     },
   }, //IDX = 3
 };
+#if JVET_AA_EE2_5_1
+static const uint16_t shuffleTime13FixedBasedLongLength[4] = { 0, 4, 2, 4 };
+static const uint16_t shuffleOp13FixedBasedLongLength[4][4][2] =
+{
+  {
+    { 0, 1 },
+    { 0, 1 },
+    { 0, 1 },
+    { 0, 1 },
+  }, //0
+  {
+    { 0, 1 },
+    { 0, 2 },
+    { 1, 2 },
+    { 2, 3 },
+  }, //1
+  {
+    { 0, 1 },
+    { 2, 3 },
+    { 0, 1 },
+    { 0, 1 },
+  }, //2
+  {
+    { 0, 1 },
+    { 0, 2 },
+    { 1, 2 },
+    { 2, 3 },
+  }, //3
+};
+static const uint16_t shuffleTab13FixedBasedLongLength[4][4][2][8] =
+{
+  {
+    {
+      { sh(0) , sh(1) , sh(2) , sh(3) , sh(4) , sh(5) , sh(6) , sh(7) },
+      { sh(8) , sh(9) , sh(10), sh(11), sh(12), sh(13), sh(14), sh(15) },
+    },
+    {
+      { sh(0) , sh(1) , sh(2) , sh(3) , sh(4) , sh(5) , sh(6) , sh(7) },
+      { sh(8) , sh(9) , sh(10), sh(11), sh(12), sh(13), sh(14), sh(15) },
+    },
+    {
+      { sh(0) , sh(1) , sh(2) , sh(3) , sh(4) , sh(5) , sh(6) , sh(7) },
+      { sh(8) , sh(9) , sh(10), sh(11), sh(12), sh(13), sh(14), sh(15) },
+    },
+    {
+      { sh(0) , sh(1) , sh(2) , sh(3) , sh(4) , sh(5) , sh(6) , sh(7) },
+      { sh(8) , sh(9) , sh(10), sh(11), sh(12), sh(13), sh(14), sh(15) },
+    },
+  }, //IDX = 0
+  {
+    {
+      { sh(14), sh(15), sh(2) , sh(3) , sh(4) , sh(9) , sh(6) , sh(13) },
+      { sh(8) , sh(5) , sh(10), sh(11), sh(12), sh(7) , sh(0) , sh(1)  },
+    },
+    {
+      { sh(0) , sh(1) , sh(8), sh(9) , sh(4) , sh(5) , sh(10), sh(7) },
+      { sh(2) , sh(3) , sh(6), sh(11), sh(12), sh(13), sh(14), sh(15) },
+    },
+    {
+      { sh(0) , sh(1) , sh(2), sh(11) , sh(4) , sh(5) , sh(6) , sh(7)  },
+      { sh(8) , sh(9) , sh(10), sh(3) , sh(12), sh(13), sh(14), sh(15) },
+    },
+    {
+      { sh(0) , sh(1) , sh(2) , sh(3) , sh(8) , sh(5) , sh(9) , sh(7) },
+      { sh(4) , sh(6) , sh(10), sh(11), sh(12), sh(13), sh(14), sh(15) },
+    },
+  }, //IDX = 1
+  {
+    {
+      { sh(0) , sh(1) , sh(2) , sh(3) , sh(8) , sh(7) , sh(6) , sh(5)  },
+      { sh(4) , sh(13), sh(12), sh(11), sh(10), sh(9) , sh(14), sh(15) },
+    },
+    {
+      { sh(0) , sh(1) , sh(2) , sh(3) , sh(4) , sh(7) , sh(6) , sh(5)  },
+      { sh(8) , sh(9) , sh(10), sh(11), sh(12), sh(13), sh(14), sh(15) },
+    },
+    {
+      { sh(0) , sh(1) , sh(2) , sh(3) , sh(4) , sh(5) , sh(6) , sh(7)  },
+      { sh(8) , sh(9) , sh(10), sh(11), sh(12), sh(13), sh(14), sh(15) },
+    },
+    {
+      { sh(0) , sh(1) , sh(2) , sh(3) , sh(4) , sh(5) , sh(6) , sh(7) },
+      { sh(8) , sh(9) , sh(10), sh(11), sh(12), sh(13), sh(14), sh(15) },
+    },
+  }, //IDX = 2
+  {
+    {
+      { sh(14), sh(15), sh(2) , sh(3) , sh(8) , sh(13), sh(6) , sh(9) },
+      { sh(4) , sh(7) , sh(12), sh(11), sh(10), sh(5) , sh(0) , sh(1) },
+    },
+    {
+      { sh(0) , sh(1) , sh(8) , sh(9) , sh(4) , sh(5) , sh(10), sh(7)  },
+      { sh(2) , sh(3) , sh(6) , sh(11), sh(12), sh(13), sh(14), sh(15) },
+    },
+    {
+      { sh(0) , sh(1) , sh(2) , sh(11), sh(4) , sh(5) , sh(6) , sh(7)  },
+      { sh(8) , sh(9) , sh(10), sh(3) , sh(12), sh(13), sh(14), sh(15) },
+    },
+    {
+      { sh(0) , sh(1) , sh(2) , sh(3) , sh(8) , sh(7) , sh(9) , sh(5) },
+      { sh(4) , sh(6) , sh(10), sh(11), sh(12), sh(13), sh(14), sh(15) },
+    },
+  }, //IDX = 3
+};
+#endif
 #endif
 #if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF
 template<X86_VEXT vext>
@@ -1456,7 +1760,11 @@ static void simdFilter9x9BlkExtDb(AlfClassifier **classifier, const PelUnitBuf &
 #else
   const short *fClipSet
 #endif
-  , const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx)
+  , const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+  , Pel ***fixedFilterResultsPerCtu, bool isFixedFilterPaddedPerCtu
+#endif
+  )
 {
   const CPelBuf srcBuffer = recSrc.get(compId);
   PelBuf        dstBuffer = recDst.get(compId);
@@ -1485,13 +1793,20 @@ static void simdFilter9x9BlkExtDb(AlfClassifier **classifier, const PelUnitBuf &
   const Pel *src = srcBuffer.buf + blk.y * srcStride + blk.x;
   Pel *      dst = dstBuffer.buf + blkDst.y * dstStride + blkDst.x;
   const Pel *srcBeforeDb = scrBufferBeforeDb.buf + blk.y * srcBeforeDbStride + blk.x;
+#if JVET_AA_EE2_5_1
+  const int padSize = ALF_PADDING_SIZE_FIXED_RESULTS;
+#endif
 
   for (size_t i = 0; i < height; i += STEP_Y)
   {
     const AlfClassifier *pClass = classifier[blkDst.y + i] + blkDst.x;
     for (size_t j = 0; j < width; j += STEP_X)
     {
+#if JVET_AA_EE2_5_1
+      __m128i params[2][2][16];
+#else
       __m128i params[2][2][13];
+#endif
       for (int k = 0; k < 2; k++)
       {
         __m128i rawCoef[4][4], rawClip[4][4], s0, s1, s2, s3, rawTmp0, rawTmp1;
@@ -1509,15 +1824,30 @@ static void simdFilter9x9BlkExtDb(AlfClassifier **classifier, const PelUnitBuf &
           rawClip[l][2] = _mm_loadu_si128((const __m128i *) (fClipSet + classIdx * MAX_NUM_ALF_LUMA_COEFF + 16));
           rawClip[l][3] = _mm_loadu_si128((const __m128i *) (fClipSet + classIdx * MAX_NUM_ALF_LUMA_COEFF + 24));
 
+#if JVET_AA_EE2_5_1
+          for (int m = 0; m < shuffleTime9FixedBasedDiamond[transposeIdx]; m++)
+#else
           for (int m = 0; m < shuffleTime9[transposeIdx]; m++)
+#endif
           {
+#if JVET_AA_EE2_5_1
+            int op0 = shuffleOp9FixedBasedDiamond[transposeIdx][m][0];
+            int op1 = shuffleOp9FixedBasedDiamond[transposeIdx][m][1];
+#else
             int op0 = shuffleOp9[transposeIdx][m][0];
             int op1 = shuffleOp9[transposeIdx][m][1];
-
+#endif
+#if JVET_AA_EE2_5_1
+            s0 = _mm_loadu_si128((const __m128i *) shuffleTab9FixedBasedDiamond[transposeIdx][m][0]);
+            s1 = _mm_xor_si128(s0, _mm_set1_epi8((char)0x80));
+            s2 = _mm_loadu_si128((const __m128i *) shuffleTab9FixedBasedDiamond[transposeIdx][m][1]);
+            s3 = _mm_xor_si128(s2, _mm_set1_epi8((char)0x80));
+#else
             s0 = _mm_loadu_si128((const __m128i *) shuffleTab9[transposeIdx][m][0]);
             s1 = _mm_xor_si128(s0, _mm_set1_epi8((char)0x80));
             s2 = _mm_loadu_si128((const __m128i *) shuffleTab9[transposeIdx][m][1]);
             s3 = _mm_xor_si128(s2, _mm_set1_epi8((char)0x80));
+#endif
 
             rawTmp0 = _mm_or_si128(_mm_shuffle_epi8(rawCoef[l][op0], s0), _mm_shuffle_epi8(rawCoef[l][op1], s1));
             rawTmp1 = _mm_or_si128(_mm_shuffle_epi8(rawCoef[l][op0], s2), _mm_shuffle_epi8(rawCoef[l][op1], s3));
@@ -1541,9 +1871,10 @@ static void simdFilter9x9BlkExtDb(AlfClassifier **classifier, const PelUnitBuf &
           s0 = _mm_unpacklo_epi64(_mm_shuffle_epi32(rawClip[0][l], 0x00), _mm_shuffle_epi32(rawClip[1][l], 0x00));
           s1 = _mm_unpacklo_epi64(_mm_shuffle_epi32(rawClip[2][l], 0x00), _mm_shuffle_epi32(rawClip[3][l], 0x00));
           params[k][1][0 + m] = _mm_blend_epi16(_mm_shuffle_epi32(s0, 0x88), _mm_shuffle_epi32(s1, 0x88), 0xf0);
-
+#if !JVET_AA_EE2_5_1
           if (l < 3)
           {
+#endif
             s0 = _mm_unpacklo_epi64(_mm_shuffle_epi32(rawCoef[0][l], 0x55), _mm_shuffle_epi32(rawCoef[1][l], 0x55));
             s1 = _mm_unpacklo_epi64(_mm_shuffle_epi32(rawCoef[2][l], 0x55), _mm_shuffle_epi32(rawCoef[3][l], 0x55));
             params[k][0][1 + m] = _mm_blend_epi16(_mm_shuffle_epi32(s0, 0x88), _mm_shuffle_epi32(s1, 0x88), 0xf0);
@@ -1564,7 +1895,9 @@ static void simdFilter9x9BlkExtDb(AlfClassifier **classifier, const PelUnitBuf &
             s0 = _mm_unpacklo_epi64(_mm_shuffle_epi32(rawClip[0][l], 0xff), _mm_shuffle_epi32(rawClip[1][l], 0xff));
             s1 = _mm_unpacklo_epi64(_mm_shuffle_epi32(rawClip[2][l], 0xff), _mm_shuffle_epi32(rawClip[3][l], 0xff));
             params[k][1][3 + m] = _mm_blend_epi16(_mm_shuffle_epi32(s0, 0x88), _mm_shuffle_epi32(s1, 0x88), 0xf0);
+#if !JVET_AA_EE2_5_1
           }
+#endif
         }//for l
       }//for k
 
@@ -1578,6 +1911,27 @@ static void simdFilter9x9BlkExtDb(AlfClassifier **classifier, const PelUnitBuf &
       pImg6 = pImg4 - srcStride;
       pImg7 = pImg5 + srcStride;
       pImg8 = pImg6 - srcStride;
+#if JVET_AA_EE2_5_1
+      int filterSetIdx = 0 + fixedFilterSetIdx;
+      const Pel *pImg0FixedBased, *pImg1FixedBased, *pImg2FixedBased, *pImg3FixedBased, *pImg4FixedBased;
+
+      if(isFixedFilterPaddedPerCtu )
+      {
+        pImg0FixedBased = fixedFilterResultsPerCtu[filterSetIdx][i + padSize + 0] + j + padSize;
+        pImg1FixedBased = fixedFilterResultsPerCtu[filterSetIdx][i + padSize + 1] + j + padSize;
+        pImg2FixedBased = fixedFilterResultsPerCtu[filterSetIdx][i + padSize - 1] + j + padSize;
+        pImg3FixedBased = fixedFilterResultsPerCtu[filterSetIdx][i + padSize + 2] + j + padSize;
+        pImg4FixedBased = fixedFilterResultsPerCtu[filterSetIdx][i + padSize - 2] + j + padSize;
+      }
+      else
+      {
+        pImg0FixedBased = fixedFilterResults[filterSetIdx][blkDst.y + i + padSize + 0] + blkDst.x + j + padSize;
+        pImg1FixedBased = fixedFilterResults[filterSetIdx][blkDst.y + i + padSize + 1] + blkDst.x + j + padSize;
+        pImg2FixedBased = fixedFilterResults[filterSetIdx][blkDst.y + i + padSize - 1] + blkDst.x + j + padSize;
+        pImg3FixedBased = fixedFilterResults[filterSetIdx][blkDst.y + i + padSize + 2] + blkDst.x + j + padSize;
+        pImg4FixedBased = fixedFilterResults[filterSetIdx][blkDst.y + i + padSize - 2] + blkDst.x + j + padSize;
+      }
+#endif
 
       __m128i cur = _mm_loadu_si128((const __m128i *) pImg0);
       __m128i accumA = mmOffset;
@@ -1630,41 +1984,83 @@ static void simdFilter9x9BlkExtDb(AlfClassifier **classifier, const PelUnitBuf &
       process2coeffs(7, pImg1 - 2, pImg2 + 2, pImg1 - 3, pImg2 + 3);
       process2coeffs(8, pImg0 + 4, pImg0 - 4, pImg0 + 3, pImg0 - 3);
       process2coeffs(9, pImg0 + 2, pImg0 - 2, pImg0 + 1, pImg0 - 1);
+#if JVET_AA_EE2_5_1
+      process2coeffs(10, pImg4FixedBased - 0, pImg3FixedBased + 0, pImg2FixedBased - 1, pImg1FixedBased + 1);
+      process2coeffs(11, pImg2FixedBased - 0, pImg1FixedBased + 0, pImg2FixedBased + 1, pImg1FixedBased - 1);
+      process2coeffs(12, pImg0FixedBased - 2, pImg0FixedBased + 2, pImg0FixedBased - 1, pImg0FixedBased + 1);
+#endif
 
       pImg0 = srcBeforeDb + j;
       pImg1 = pImg0 + srcBeforeDbStride;
       pImg2 = pImg0 - srcBeforeDbStride;
+#if JVET_AA_EE2_5_1
+      process2coeffs(13, pImg1 + 0, pImg2 + 0, pImg0 + 1, pImg0 - 1);
+#else
       process2coeffs(10, pImg1 + 0, pImg2 + 0, pImg0 + 1, pImg0 - 1);
+#endif
+#if JVET_AA_EE2_5_1
+      __m128i val00 = _mm_sub_epi16(_mm_loadu_si128((const __m128i *) (fixedFilterResults[0 + fixedFilterSetIdx][blkDst.y + i + padSize] + blkDst.x + j + padSize)), cur);
+      __m128i val10 = _mm_sub_epi16(_mm_loadu_si128((const __m128i *) (fixedFilterResults[2 + fixedFilterSetIdx][blkDst.y + i + padSize] + blkDst.x + j + padSize)), cur);
+#else
       __m128i val00 = _mm_sub_epi16(_mm_loadu_si128((const __m128i *) pImg0), cur);
       __m128i val10 = _mm_sub_epi16(_mm_loadu_si128((const __m128i *) (fixedFilterResults[fixedFilterSetIdx][blkDst.y + i] + blkDst.x + j)), cur);
+#endif
       __m128i val01A = _mm_unpacklo_epi16(val00, val10);
       __m128i val01B = _mm_unpackhi_epi16(val00, val10);
+#if JVET_AA_EE2_5_1
+      __m128i limit01A = params[0][1][14];
+      __m128i limit01B = params[1][1][14];
+#else
       __m128i limit01A = params[0][1][11];
       __m128i limit01B = params[1][1][11];
+#endif
       val01A = _mm_min_epi16(val01A, limit01A);
       val01B = _mm_min_epi16(val01B, limit01B);
       limit01A = _mm_sub_epi16(_mm_setzero_si128(), limit01A);
       limit01B = _mm_sub_epi16(_mm_setzero_si128(), limit01B);
       val01A = _mm_max_epi16(val01A, limit01A);
       val01B = _mm_max_epi16(val01B, limit01B);
+#if JVET_AA_EE2_5_1
+      __m128i coeff01A = params[0][0][14];
+      __m128i coeff01B = params[1][0][14];
+#else
       __m128i coeff01A = params[0][0][11];
       __m128i coeff01B = params[1][0][11];
+#endif
       accumA = _mm_add_epi32(accumA, _mm_madd_epi16(val01A, coeff01A));
       accumB = _mm_add_epi32(accumB, _mm_madd_epi16(val01B, coeff01B));
 
+#if JVET_AA_EE2_5_1
+      val00 = _mm_sub_epi16(_mm_loadu_si128((const __m128i *) (pImg0)), cur);
+      val10 = _mm_sub_epi16(cur, cur);
+
+      val01A = _mm_unpacklo_epi16(val00, val10);
+      val01B = _mm_unpackhi_epi16(val00, val10);
+#else
       __m128i val = _mm_sub_epi16(_mm_loadu_si128((const __m128i *) (fixedFilterResults[EXT_LENGTH + fixedFilterSetIdx][blkDst.y + i] + blkDst.x + j)), cur);
       val01A = _mm_shuffle_epi8(val, _mm_setr_epi8(0, 1, 0, 1, 2, 3, 2, 3, 4, 5, 4, 5, 6, 7, 6, 7));
       val01B = _mm_shuffle_epi8(val, _mm_setr_epi8(8, 9, 8, 9, 10, 11, 10, 11, 12, 13, 12, 13, 14, 15, 14, 15));
+#endif
+#if JVET_AA_EE2_5_1
+      limit01A = params[0][1][15];
+      limit01B = params[1][1][15];
+#else
       limit01A = params[0][1][12];
       limit01B = params[1][1][12];
+#endif
       val01A = _mm_min_epi16(val01A, limit01A);
       val01B = _mm_min_epi16(val01B, limit01B);
       limit01A = _mm_sub_epi16(_mm_setzero_si128(), limit01A);
       limit01B = _mm_sub_epi16(_mm_setzero_si128(), limit01B);
       val01A = _mm_max_epi16(val01A, limit01A);
       val01B = _mm_max_epi16(val01B, limit01B);
+#if JVET_AA_EE2_5_1
+      coeff01A = params[0][0][15];
+      coeff01B = params[1][0][15];
+#else
       coeff01A = params[0][0][12];
       coeff01B = params[1][0][12];
+#endif
       accumA = _mm_add_epi32(accumA, _mm_madd_epi16(val01A, coeff01A));
       accumB = _mm_add_epi32(accumB, _mm_madd_epi16(val01B, coeff01B));
 
@@ -1695,7 +2091,11 @@ static void simdFilter13x13BlkExt(AlfClassifier **classifier, const PelUnitBuf &
 #else
   const short *fClipSet
 #endif
-  , const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx)
+  , const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+  , Pel ***fixedFilterResultsPerCtu, bool isFixedFilterPaddedPerCtu
+#endif
+  )
 {
   const CPelBuf srcBuffer = recSrc.get(compId);
   PelBuf        dstBuffer = recDst.get(compId);
@@ -1721,16 +2121,27 @@ static void simdFilter13x13BlkExt(AlfClassifier **classifier, const PelUnitBuf &
 
   const Pel *src = srcBuffer.buf + blk.y * srcStride + blk.x;
   Pel *      dst = dstBuffer.buf + blkDst.y * dstStride + blkDst.x;
+#if JVET_AA_EE2_5_1
+  const int padSize = ALF_PADDING_SIZE_FIXED_RESULTS;
+#endif
 
   for (size_t i = 0; i < height; i += STEP_Y)
   {
     const AlfClassifier *pClass = classifier[blkDst.y + i] + blkDst.x;
     for (size_t j = 0; j < width; j += STEP_X)
     {
+#if JVET_AA_EE2_5_1
+      __m128i params[2][2][14];
+#else
       __m128i params[2][2][11];
+#endif
       for (int k = 0; k < 2; k++)
       {
+#if JVET_AA_EE2_5_1
+        __m128i rawCoef[4][4], rawClip[4][4], s0, s1, s2, s3, rawTmp0, rawTmp1;
+#else
         __m128i rawCoef[4][3], rawClip[4][3], s0, s1, s2, s3, rawTmp0, rawTmp1;
+#endif
         for (int l = 0; l < 4; l++)
         {
           const int transposeIdx = pClass[j + 4 * k + l] & 0x3;
@@ -1739,20 +2150,42 @@ static void simdFilter13x13BlkExt(AlfClassifier **classifier, const PelUnitBuf &
           rawCoef[l][0] = _mm_loadu_si128((const __m128i *) (filterSet + classIdx * MAX_NUM_ALF_LUMA_COEFF));
           rawCoef[l][1] = _mm_loadu_si128((const __m128i *) (filterSet + classIdx * MAX_NUM_ALF_LUMA_COEFF + 8));
           rawCoef[l][2] = _mm_loadu_si128((const __m128i *) (filterSet + classIdx * MAX_NUM_ALF_LUMA_COEFF + 16));
+#if JVET_AA_EE2_5_1
+          rawCoef[l][3] = _mm_loadu_si128((const __m128i *) (filterSet + classIdx * MAX_NUM_ALF_LUMA_COEFF + 24));
+#endif
           rawClip[l][0] = _mm_loadu_si128((const __m128i *) (fClipSet + classIdx * MAX_NUM_ALF_LUMA_COEFF));
           rawClip[l][1] = _mm_loadu_si128((const __m128i *) (fClipSet + classIdx * MAX_NUM_ALF_LUMA_COEFF + 8));
           rawClip[l][2] = _mm_loadu_si128((const __m128i *) (fClipSet + classIdx * MAX_NUM_ALF_LUMA_COEFF + 16));
+#if JVET_AA_EE2_5_1
+          rawClip[l][3] = _mm_loadu_si128((const __m128i *) (fClipSet + classIdx * MAX_NUM_ALF_LUMA_COEFF + 24));
+#endif
 
+#if JVET_AA_EE2_5_1
+          for (int m = 0; m < shuffleTime13FixedBasedLongLength[transposeIdx]; m++)
+#else
           for (int m = 0; m < shuffleTime13LongLength[transposeIdx]; m++)
+#endif
           {
+#if JVET_AA_EE2_5_1
+            int op0 = shuffleOp13FixedBasedLongLength[transposeIdx][m][0];
+            int op1 = shuffleOp13FixedBasedLongLength[transposeIdx][m][1];
+#else
             int op0 = shuffleOp13LongLength[transposeIdx][m][0];
             int op1 = shuffleOp13LongLength[transposeIdx][m][1];
+#endif
+#if JVET_AA_EE2_5_1
+            s0 = _mm_loadu_si128((const __m128i *) shuffleTab13FixedBasedLongLength[transposeIdx][m][0]);
+            s1 = _mm_xor_si128(s0, _mm_set1_epi8((char)0x80));
 
+            s2 = _mm_loadu_si128((const __m128i *) shuffleTab13FixedBasedLongLength[transposeIdx][m][1]);
+            s3 = _mm_xor_si128(s2, _mm_set1_epi8((char)0x80));
+#else
             s0 = _mm_loadu_si128((const __m128i *) shuffleTab13LongLength[transposeIdx][m][0]);
             s1 = _mm_xor_si128(s0, _mm_set1_epi8((char)0x80));
 
             s2 = _mm_loadu_si128((const __m128i *) shuffleTab13LongLength[transposeIdx][m][1]);
             s3 = _mm_xor_si128(s2, _mm_set1_epi8((char)0x80));
+#endif
 
             rawTmp0 = _mm_or_si128(_mm_shuffle_epi8(rawCoef[l][op0], s0), _mm_shuffle_epi8(rawCoef[l][op1], s1));
             rawTmp1 = _mm_or_si128(_mm_shuffle_epi8(rawCoef[l][op0], s2), _mm_shuffle_epi8(rawCoef[l][op1], s3));
@@ -1766,7 +2199,11 @@ static void simdFilter13x13BlkExt(AlfClassifier **classifier, const PelUnitBuf &
           }
         }//for l
 
+#if JVET_AA_EE2_5_1
+        for (unsigned char l = 0; l < 4; l++)
+#else
         for (unsigned char l = 0; l < 3; l++)
+#endif
         {
           int m = l << 2;
 
@@ -1783,16 +2220,20 @@ static void simdFilter13x13BlkExt(AlfClassifier **classifier, const PelUnitBuf &
           s0 = _mm_unpacklo_epi64(_mm_shuffle_epi32(rawClip[0][l], 0x55), _mm_shuffle_epi32(rawClip[1][l], 0x55));
           s1 = _mm_unpacklo_epi64(_mm_shuffle_epi32(rawClip[2][l], 0x55), _mm_shuffle_epi32(rawClip[3][l], 0x55));
           params[k][1][1 + m] = _mm_blend_epi16(_mm_shuffle_epi32(s0, 0x88), _mm_shuffle_epi32(s1, 0x88), 0xf0);
-
+#if JVET_AA_EE2_5_1
+          if( l < 3 )
+          {
+#endif
           s0 = _mm_unpacklo_epi64(_mm_shuffle_epi32(rawCoef[0][l], 0xaa), _mm_shuffle_epi32(rawCoef[1][l], 0xaa));
           s1 = _mm_unpacklo_epi64(_mm_shuffle_epi32(rawCoef[2][l], 0xaa), _mm_shuffle_epi32(rawCoef[3][l], 0xaa));
           params[k][0][2 + m] = _mm_blend_epi16(_mm_shuffle_epi32(s0, 0x88), _mm_shuffle_epi32(s1, 0x88), 0xf0);
           s0 = _mm_unpacklo_epi64(_mm_shuffle_epi32(rawClip[0][l], 0xaa), _mm_shuffle_epi32(rawClip[1][l], 0xaa));
           s1 = _mm_unpacklo_epi64(_mm_shuffle_epi32(rawClip[2][l], 0xaa), _mm_shuffle_epi32(rawClip[3][l], 0xaa));
           params[k][1][2 + m] = _mm_blend_epi16(_mm_shuffle_epi32(s0, 0x88), _mm_shuffle_epi32(s1, 0x88), 0xf0);
-
+#if !JVET_AA_EE2_5_1
           if (l < 2)
           {
+#endif
             s0 = _mm_unpacklo_epi64(_mm_shuffle_epi32(rawCoef[0][l], 0xff), _mm_shuffle_epi32(rawCoef[1][l], 0xff));
             s1 = _mm_unpacklo_epi64(_mm_shuffle_epi32(rawCoef[2][l], 0xff), _mm_shuffle_epi32(rawCoef[3][l], 0xff));
             params[k][0][3 + m] = _mm_blend_epi16(_mm_shuffle_epi32(s0, 0x88), _mm_shuffle_epi32(s1, 0x88), 0xf0);
@@ -1820,6 +2261,28 @@ static void simdFilter13x13BlkExt(AlfClassifier **classifier, const PelUnitBuf &
       pImg11 = pImg9 + srcStride;
       pImg12 = pImg10 - srcStride;
 
+#if JVET_AA_EE2_5_1
+      int filterSetIdx = 0 + fixedFilterSetIdx;
+      const Pel *pImg0FixedBased, *pImg1FixedBased, *pImg2FixedBased, *pImg3FixedBased, *pImg4FixedBased;
+
+      if(isFixedFilterPaddedPerCtu )
+      {
+        pImg0FixedBased = fixedFilterResultsPerCtu[filterSetIdx][i + padSize + 0] + j + padSize;
+        pImg1FixedBased = fixedFilterResultsPerCtu[filterSetIdx][i + padSize + 1] + j + padSize;
+        pImg2FixedBased = fixedFilterResultsPerCtu[filterSetIdx][i + padSize - 1] + j + padSize;
+        pImg3FixedBased = fixedFilterResultsPerCtu[filterSetIdx][i + padSize + 2] + j + padSize;
+        pImg4FixedBased = fixedFilterResultsPerCtu[filterSetIdx][i + padSize - 2] + j + padSize;
+      }
+      else
+      {
+        pImg0FixedBased = fixedFilterResults[filterSetIdx][blkDst.y + i + padSize + 0] + blkDst.x + j + padSize;
+        pImg1FixedBased = fixedFilterResults[filterSetIdx][blkDst.y + i + padSize + 1] + blkDst.x + j + padSize;
+        pImg2FixedBased = fixedFilterResults[filterSetIdx][blkDst.y + i + padSize - 1] + blkDst.x + j + padSize;
+        pImg3FixedBased = fixedFilterResults[filterSetIdx][blkDst.y + i + padSize + 2] + blkDst.x + j + padSize;
+        pImg4FixedBased = fixedFilterResults[filterSetIdx][blkDst.y + i + padSize - 2] + blkDst.x + j + padSize;
+      }
+#endif
+
       __m128i cur = _mm_loadu_si128((const __m128i *) pImg0);
       __m128i accumA = mmOffset;
       __m128i accumB = mmOffset;
@@ -1871,21 +2334,39 @@ static void simdFilter13x13BlkExt(AlfClassifier **classifier, const PelUnitBuf &
       process2coeffs(7, pImg0 + 6, pImg0 - 6, pImg0 + 5, pImg0 - 5);
       process2coeffs(8, pImg0 + 4, pImg0 - 4, pImg0 + 3, pImg0 - 3);
       process2coeffs(9, pImg0 + 2, pImg0 - 2, pImg0 + 1, pImg0 - 1);
+#if JVET_AA_EE2_5_1
+      process2coeffs(10, pImg4FixedBased - 0, pImg3FixedBased + 0, pImg2FixedBased - 1, pImg1FixedBased + 1);
+      process2coeffs(11, pImg2FixedBased - 0, pImg1FixedBased + 0, pImg2FixedBased + 1, pImg1FixedBased - 1);
+      process2coeffs(12, pImg0FixedBased - 2, pImg0FixedBased + 2, pImg0FixedBased - 1, pImg0FixedBased + 1);
+      const __m128i val00 = _mm_sub_epi16(_mm_loadu_si128((const __m128i *) (fixedFilterResults[0 + fixedFilterSetIdx][blkDst.y + i + padSize] + blkDst.x + j + padSize)), cur);
+      const __m128i val10 = _mm_sub_epi16(_mm_loadu_si128((const __m128i *) (fixedFilterResults[2 + fixedFilterSetIdx][blkDst.y + i + padSize] + blkDst.x + j + padSize)), cur);
+#else
 
       const __m128i val00 = _mm_sub_epi16(_mm_loadu_si128((const __m128i *) (fixedFilterResults[fixedFilterSetIdx][blkDst.y + i] + blkDst.x + j)), cur);
       const __m128i val10 = _mm_sub_epi16(_mm_loadu_si128((const __m128i *) (fixedFilterResults[EXT_LENGTH + fixedFilterSetIdx][blkDst.y + i] + blkDst.x + j)), cur);
+#endif
       __m128i val01A = _mm_unpacklo_epi16(val00, val10);
       __m128i val01B = _mm_unpackhi_epi16(val00, val10);
+#if JVET_AA_EE2_5_1
+      __m128i limit01A = params[0][1][13];
+      __m128i limit01B = params[1][1][13];
+#else
       __m128i limit01A = params[0][1][10];
       __m128i limit01B = params[1][1][10];
+#endif
       val01A = _mm_min_epi16(val01A, limit01A);
       val01B = _mm_min_epi16(val01B, limit01B);
       limit01A = _mm_sub_epi16(_mm_setzero_si128(), limit01A);
       limit01B = _mm_sub_epi16(_mm_setzero_si128(), limit01B);
       val01A = _mm_max_epi16(val01A, limit01A);
       val01B = _mm_max_epi16(val01B, limit01B);
+#if JVET_AA_EE2_5_1
+      const __m128i coeff01A = params[0][0][13];
+      const __m128i coeff01B = params[1][0][13];
+#else
       const __m128i coeff01A = params[0][0][10];
       const __m128i coeff01B = params[1][0][10];
+#endif
       accumA = _mm_add_epi32(accumA, _mm_madd_epi16(val01A, coeff01A));
       accumB = _mm_add_epi32(accumB, _mm_madd_epi16(val01B, coeff01B));
 
@@ -1911,7 +2392,11 @@ static void simdFilter13x13BlkExtDb(AlfClassifier **classifier, const PelUnitBuf
 #else
     const short *fClipSet
 #endif
-  , const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx)
+  , const ClpRng &clpRng, CodingStructure &cs, Pel ***fixedFilterResults, int fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+  , Pel ***fixedFilterResultsPerCtu, bool isFixedFilterPaddedPerCtu
+#endif
+  )
 {
   const CPelBuf srcBuffer = recSrc.get(compId);
   PelBuf        dstBuffer = recDst.get(compId);
@@ -1940,13 +2425,20 @@ static void simdFilter13x13BlkExtDb(AlfClassifier **classifier, const PelUnitBuf
   const Pel *src = srcBuffer.buf + blk.y * srcStride + blk.x;
   Pel *      dst = dstBuffer.buf + blkDst.y * dstStride + blkDst.x;
   const Pel *srcBeforeDb = scrBufferBeforeDb.buf + blk.y * srcBeforeDbStride + blk.x;
+#if JVET_AA_EE2_5_1
+  const int padSize = ALF_PADDING_SIZE_FIXED_RESULTS;
+#endif
 
   for (size_t i = 0; i < height; i += STEP_Y)
   {
     const AlfClassifier *pClass = classifier[blkDst.y + i] + blkDst.x;
     for (size_t j = 0; j < width; j += STEP_X)
     {
+#if JVET_AA_EE2_5_1
+      __m128i params[2][2][16];
+#else
       __m128i params[2][2][13];
+#endif
       for (int k = 0; k < 2; k++)
       {
         __m128i rawCoef[4][4], rawClip[4][4], s0, s1, s2, s3, rawTmp0, rawTmp1;
@@ -1964,15 +2456,30 @@ static void simdFilter13x13BlkExtDb(AlfClassifier **classifier, const PelUnitBuf
           rawClip[l][2] = _mm_loadu_si128((const __m128i *) (fClipSet + classIdx * MAX_NUM_ALF_LUMA_COEFF + 16));
           rawClip[l][3] = _mm_loadu_si128((const __m128i *) (fClipSet + classIdx * MAX_NUM_ALF_LUMA_COEFF + 24));
 
+#if JVET_AA_EE2_5_1
+          for (int m = 0; m < shuffleTime13FixedBasedLongLength[transposeIdx]; m++)
+#else
           for (int m = 0; m < shuffleTime13LongLength[transposeIdx]; m++)
+#endif
           {
+#if JVET_AA_EE2_5_1
+            int op0 = shuffleOp13FixedBasedLongLength[transposeIdx][m][0];
+            int op1 = shuffleOp13FixedBasedLongLength[transposeIdx][m][1];
+#else
             int op0 = shuffleOp13LongLength[transposeIdx][m][0];
             int op1 = shuffleOp13LongLength[transposeIdx][m][1];
-
+#endif
+#if JVET_AA_EE2_5_1
+            s0 = _mm_loadu_si128((const __m128i *) shuffleTab13FixedBasedLongLength[transposeIdx][m][0]);
+            s1 = _mm_xor_si128(s0, _mm_set1_epi8((char)0x80));
+            s2 = _mm_loadu_si128((const __m128i *) shuffleTab13FixedBasedLongLength[transposeIdx][m][1]);
+            s3 = _mm_xor_si128(s2, _mm_set1_epi8((char)0x80));
+#else
             s0 = _mm_loadu_si128((const __m128i *) shuffleTab13LongLength[transposeIdx][m][0]);
             s1 = _mm_xor_si128(s0, _mm_set1_epi8((char)0x80));
             s2 = _mm_loadu_si128((const __m128i *) shuffleTab13LongLength[transposeIdx][m][1]);
             s3 = _mm_xor_si128(s2, _mm_set1_epi8((char)0x80));
+#endif
 
             rawTmp0 = _mm_or_si128(_mm_shuffle_epi8(rawCoef[l][op0], s0), _mm_shuffle_epi8(rawCoef[l][op1], s1));
             rawTmp1 = _mm_or_si128(_mm_shuffle_epi8(rawCoef[l][op0], s2), _mm_shuffle_epi8(rawCoef[l][op1], s3));
@@ -1996,8 +2503,10 @@ static void simdFilter13x13BlkExtDb(AlfClassifier **classifier, const PelUnitBuf
           s0 = _mm_unpacklo_epi64(_mm_shuffle_epi32(rawClip[0][l], 0x00), _mm_shuffle_epi32(rawClip[1][l], 0x00));
           s1 = _mm_unpacklo_epi64(_mm_shuffle_epi32(rawClip[2][l], 0x00), _mm_shuffle_epi32(rawClip[3][l], 0x00));
           params[k][1][0 + m] = _mm_blend_epi16(_mm_shuffle_epi32(s0, 0x88), _mm_shuffle_epi32(s1, 0x88), 0xf0);
+#if !JVET_AA_EE2_5_1
           if (l < 3)
           {
+#endif
             s0 = _mm_unpacklo_epi64(_mm_shuffle_epi32(rawCoef[0][l], 0x55), _mm_shuffle_epi32(rawCoef[1][l], 0x55));
             s1 = _mm_unpacklo_epi64(_mm_shuffle_epi32(rawCoef[2][l], 0x55), _mm_shuffle_epi32(rawCoef[3][l], 0x55));
             params[k][0][1 + m] = _mm_blend_epi16(_mm_shuffle_epi32(s0, 0x88), _mm_shuffle_epi32(s1, 0x88), 0xf0);
@@ -2018,7 +2527,9 @@ static void simdFilter13x13BlkExtDb(AlfClassifier **classifier, const PelUnitBuf
             s0 = _mm_unpacklo_epi64(_mm_shuffle_epi32(rawClip[0][l], 0xff), _mm_shuffle_epi32(rawClip[1][l], 0xff));
             s1 = _mm_unpacklo_epi64(_mm_shuffle_epi32(rawClip[2][l], 0xff), _mm_shuffle_epi32(rawClip[3][l], 0xff));
             params[k][1][3 + m] = _mm_blend_epi16(_mm_shuffle_epi32(s0, 0x88), _mm_shuffle_epi32(s1, 0x88), 0xf0);
+#if !JVET_AA_EE2_5_1
           }
+#endif
         }//for l
       }//for k
 
@@ -2037,6 +2548,27 @@ static void simdFilter13x13BlkExtDb(AlfClassifier **classifier, const PelUnitBuf
       pImg10 = pImg8 - srcStride;
       pImg11 = pImg9 + srcStride;
       pImg12 = pImg10 - srcStride;
+#if JVET_AA_EE2_5_1
+      int filterSetIdx = 0 + fixedFilterSetIdx;
+      const Pel *pImg0FixedBased, *pImg1FixedBased, *pImg2FixedBased, *pImg3FixedBased, *pImg4FixedBased;
+
+      if(isFixedFilterPaddedPerCtu )
+      {
+        pImg0FixedBased = fixedFilterResultsPerCtu[filterSetIdx][i + padSize + 0] + j + padSize;
+        pImg1FixedBased = fixedFilterResultsPerCtu[filterSetIdx][i + padSize + 1] + j + padSize;
+        pImg2FixedBased = fixedFilterResultsPerCtu[filterSetIdx][i + padSize - 1] + j + padSize;
+        pImg3FixedBased = fixedFilterResultsPerCtu[filterSetIdx][i + padSize + 2] + j + padSize;
+        pImg4FixedBased = fixedFilterResultsPerCtu[filterSetIdx][i + padSize - 2] + j + padSize;
+      }
+      else
+      {
+        pImg0FixedBased = fixedFilterResults[filterSetIdx][blkDst.y + i + padSize + 0] + blkDst.x + j + padSize;
+        pImg1FixedBased = fixedFilterResults[filterSetIdx][blkDst.y + i + padSize + 1] + blkDst.x + j + padSize;
+        pImg2FixedBased = fixedFilterResults[filterSetIdx][blkDst.y + i + padSize - 1] + blkDst.x + j + padSize;
+        pImg3FixedBased = fixedFilterResults[filterSetIdx][blkDst.y + i + padSize + 2] + blkDst.x + j + padSize;
+        pImg4FixedBased = fixedFilterResults[filterSetIdx][blkDst.y + i + padSize - 2] + blkDst.x + j + padSize;
+      }
+#endif
 
       __m128i cur = _mm_loadu_si128((const __m128i *) pImg0);
       __m128i accumA = mmOffset;
@@ -2089,42 +2621,83 @@ static void simdFilter13x13BlkExtDb(AlfClassifier **classifier, const PelUnitBuf
       process2coeffs(7, pImg0 + 6, pImg0 - 6, pImg0 + 5, pImg0 - 5);
       process2coeffs(8, pImg0 + 4, pImg0 - 4, pImg0 + 3, pImg0 - 3);
       process2coeffs(9, pImg0 + 2, pImg0 - 2, pImg0 + 1, pImg0 - 1);
+#if JVET_AA_EE2_5_1
+      process2coeffs(10, pImg4FixedBased - 0, pImg3FixedBased + 0, pImg2FixedBased - 1, pImg1FixedBased + 1);
+      process2coeffs(11, pImg2FixedBased - 0, pImg1FixedBased + 0, pImg2FixedBased + 1, pImg1FixedBased - 1);
+      process2coeffs(12, pImg0FixedBased - 2, pImg0FixedBased + 2, pImg0FixedBased - 1, pImg0FixedBased + 1);
+#endif
 
       pImg0 = srcBeforeDb + j;
       pImg1 = pImg0 + srcBeforeDbStride;
       pImg2 = pImg0 - srcBeforeDbStride;
+#if JVET_AA_EE2_5_1
+      process2coeffs(13, pImg1 + 0, pImg2 + 0, pImg0 + 1, pImg0 - 1);
+#else
       process2coeffs(10, pImg1 + 0, pImg2 + 0, pImg0 + 1, pImg0 - 1);
+#endif
 
+#if JVET_AA_EE2_5_1
+      __m128i val00 = _mm_sub_epi16(_mm_loadu_si128((const __m128i *) (fixedFilterResults[0 + fixedFilterSetIdx][blkDst.y + i + padSize] + blkDst.x + j + padSize)), cur);
+      __m128i val10 = _mm_sub_epi16(_mm_loadu_si128((const __m128i *) (fixedFilterResults[2 + fixedFilterSetIdx][blkDst.y + i + padSize] + blkDst.x + j + padSize)), cur);
+#else
       __m128i val00 = _mm_sub_epi16(_mm_loadu_si128((const __m128i *) pImg0), cur);
       __m128i val10 = _mm_sub_epi16(_mm_loadu_si128((const __m128i *) (fixedFilterResults[fixedFilterSetIdx][blkDst.y + i] + blkDst.x + j)), cur);
+#endif
       __m128i val01A = _mm_unpacklo_epi16(val00, val10);
       __m128i val01B = _mm_unpackhi_epi16(val00, val10);
+#if JVET_AA_EE2_5_1
+      __m128i limit01A = params[0][1][14];
+      __m128i limit01B = params[1][1][14];
+#else
       __m128i limit01A = params[0][1][11];
       __m128i limit01B = params[1][1][11];
+#endif
       val01A = _mm_min_epi16(val01A, limit01A);
       val01B = _mm_min_epi16(val01B, limit01B);
       limit01A = _mm_sub_epi16(_mm_setzero_si128(), limit01A);
       limit01B = _mm_sub_epi16(_mm_setzero_si128(), limit01B);
       val01A = _mm_max_epi16(val01A, limit01A);
       val01B = _mm_max_epi16(val01B, limit01B);
+#if JVET_AA_EE2_5_1
+      __m128i coeff01A = params[0][0][14];
+      __m128i coeff01B = params[1][0][14];
+#else
       __m128i coeff01A = params[0][0][11];
       __m128i coeff01B = params[1][0][11];
+#endif
       accumA = _mm_add_epi32(accumA, _mm_madd_epi16(val01A, coeff01A));
       accumB = _mm_add_epi32(accumB, _mm_madd_epi16(val01B, coeff01B));
 
+#if JVET_AA_EE2_5_1
+      val00 = _mm_sub_epi16(_mm_loadu_si128((const __m128i *) (pImg0)), cur);
+      val10 = _mm_sub_epi16(cur, cur);
+      val01A = _mm_unpacklo_epi16(val00, val10);
+      val01B = _mm_unpackhi_epi16(val00, val10);
+#else
       __m128i val = _mm_sub_epi16(_mm_loadu_si128((const __m128i *) (fixedFilterResults[EXT_LENGTH + fixedFilterSetIdx][blkDst.y + i] + blkDst.x + j)), cur);
       val01A = _mm_shuffle_epi8(val, _mm_setr_epi8(0, 1, 0, 1, 2, 3, 2, 3, 4, 5, 4, 5, 6, 7, 6, 7));
       val01B = _mm_shuffle_epi8(val, _mm_setr_epi8(8, 9, 8, 9, 10, 11, 10, 11, 12, 13, 12, 13, 14, 15, 14, 15));
+#endif
+#if JVET_AA_EE2_5_1
+      limit01A = params[0][1][15];
+      limit01B = params[1][1][15];
+#else
       limit01A = params[0][1][12];
       limit01B = params[1][1][12];
+#endif
       val01A = _mm_min_epi16(val01A, limit01A);
       val01B = _mm_min_epi16(val01B, limit01B);
       limit01A = _mm_sub_epi16(_mm_setzero_si128(), limit01A);
       limit01B = _mm_sub_epi16(_mm_setzero_si128(), limit01B);
       val01A = _mm_max_epi16(val01A, limit01A);
       val01B = _mm_max_epi16(val01B, limit01B);
+#if JVET_AA_EE2_5_1
+      coeff01A = params[0][0][15];
+      coeff01B = params[1][0][15];
+#else
       coeff01A = params[0][0][12];
       coeff01B = params[1][0][12];
+#endif
       accumA = _mm_add_epi32(accumA, _mm_madd_epi16(val01A, coeff01A));
       accumB = _mm_add_epi32(accumB, _mm_madd_epi16(val01B, coeff01B));
 
@@ -2198,7 +2771,9 @@ static void simdFilter13x13Blk( AlfClassifier **classifier, const CPelBuf &srcLu
   constexpr int STEP_Y = 2;
 
   const Pel *src = srcLuma.buf + curBlk.y * srcStride + curBlk.x;
-
+#if JVET_AA_EE2_5_1
+  const int padSize = ALF_PADDING_SIZE_FIXED_RESULTS;
+#endif
 
   const __m128i mmOffset = _mm_set1_epi32(ROUND);
   const __m128i mmMin = _mm_set1_epi16(clpRng.min);
@@ -2384,9 +2959,17 @@ static void simdFilter13x13Blk( AlfClassifier **classifier, const CPelBuf &srcLu
         accumA = _mm_min_epi16(mmMax, _mm_max_epi16(accumA, mmMin));
 
 #if JVET_Z0105_LOOP_FILTER_VIRTUAL_BOUNDARY
+#if JVET_AA_EE2_5_1
+        _mm_storeu_si128((__m128i *) (&(fixedFilterResults[fixedFiltInd][blkDst.y + i + ii + padSize][blkDst.x + j + padSize])), accumA);
+#else
         _mm_storeu_si128((__m128i *) (&(fixedFilterResults[fixedFiltInd][blkDst.y + i + ii][blkDst.x + j])), accumA);
+#endif
+#else
+#if JVET_AA_EE2_5_1
+        _mm_storeu_si128((__m128i *) (&(fixedFilterResults[fixedFiltInd][curBlk.y + i + ii + padSize][curBlk.x + j + padSize])), accumA);
 #else
         _mm_storeu_si128((__m128i *) (&(fixedFilterResults[fixedFiltInd][curBlk.y + i + ii][curBlk.x + j])), accumA);
+#endif
 #endif
       } //for (size_t ii = 0; ii < STEP_Y; ii++)
     }//for (size_t j = 0; j < width; j += STEP_X)
diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp
index eaa5b292..ff613e4e 100644
--- a/source/Lib/DecoderLib/VLCReader.cpp
+++ b/source/Lib/DecoderLib/VLCReader.cpp
@@ -1128,7 +1128,7 @@ void HLSyntaxReader::parseAlfAps( APS* aps )
       {
         memset(param.filterCoeffDeltaIdx[altIdx], 0, MAX_NUM_ALF_CLASSES * sizeof(short));
       }
-#if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF || JVET_AA0095_ALF_LONGER_FILTER
+#if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF || JVET_AA0095_ALF_LONGER_FILTER || JVET_AA_EE2_5_1
       AlfFilterShape alfShape(alfTypeToSize[param.filterType[CHANNEL_TYPE_LUMA]]);
 #else
       AlfFilterShape alfShape(param.filterType[CHANNEL_TYPE_LUMA] == ALF_FILTER_5 ? 5 : (param.filterType[CHANNEL_TYPE_LUMA] == ALF_FILTER_9_EXT ? size_ALF_FILTER_9_EXT : ((param.filterType[CHANNEL_TYPE_LUMA] == ALF_FILTER_7 ? 7 : (param.filterType[CHANNEL_TYPE_LUMA] == ALF_FILTER_EXT ? size_ALF_FILTER_EXT : 9)))));
@@ -1186,7 +1186,7 @@ void HLSyntaxReader::parseAlfAps( APS* aps )
 #if ALF_IMPROVEMENT
       READ_FLAG(code, "alf_nonlinear_enable_flag_chroma");
       param.nonLinearFlag[CHANNEL_TYPE_CHROMA][altIdx] = code ? true : false;
-#if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF || JVET_AA0095_ALF_LONGER_FILTER
+#if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF || JVET_AA0095_ALF_LONGER_FILTER || JVET_AA_EE2_5_1
       AlfFilterShape alfShape(alfTypeToSize[param.filterType[CHANNEL_TYPE_CHROMA]]);
 #else
       AlfFilterShape alfShape(param.filterType[CHANNEL_TYPE_CHROMA] == ALF_FILTER_5 ? 5 : (param.filterType[CHANNEL_TYPE_CHROMA] == ALF_FILTER_9_EXT ? size_ALF_FILTER_9_EXT : ((param.filterType[CHANNEL_TYPE_CHROMA] == ALF_FILTER_7 ? 7 : (param.filterType[CHANNEL_TYPE_CHROMA] == ALF_FILTER_EXT ? size_ALF_FILTER_EXT : 9)))));
@@ -6343,7 +6343,7 @@ void HLSyntaxReader::alfFilter( AlfParam& alfParam, const bool isChroma, const i
   // derive maxGolombIdx
 #if ALF_IMPROVEMENT
   AlfFilterType alfFilterType = isChroma ? alfParam.filterType[CHANNEL_TYPE_CHROMA] : alfParam.filterType[CHANNEL_TYPE_LUMA];
-#if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF || JVET_AA0095_ALF_LONGER_FILTER
+#if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF || JVET_AA0095_ALF_LONGER_FILTER || JVET_AA_EE2_5_1
   AlfFilterShape  alfShape(alfTypeToSize[alfFilterType]);
 #else
   AlfFilterShape alfShape(alfFilterType == ALF_FILTER_5 ? 5 : ( alfFilterType == ALF_FILTER_9_EXT ? size_ALF_FILTER_9_EXT : ((alfFilterType == ALF_FILTER_7 ? 7 : (alfFilterType == ALF_FILTER_EXT ? size_ALF_FILTER_EXT :9 )))));
diff --git a/source/Lib/EncoderLib/EncAdaptiveLoopFilter.cpp b/source/Lib/EncoderLib/EncAdaptiveLoopFilter.cpp
index 4f0dd5c8..511e1f21 100644
--- a/source/Lib/EncoderLib/EncAdaptiveLoopFilter.cpp
+++ b/source/Lib/EncoderLib/EncAdaptiveLoopFilter.cpp
@@ -524,7 +524,7 @@ void EncAdaptiveLoopFilter::create( const EncCfg* encCfg, const int picWidth, co
         continue;
       }
       m_alfCovariance[compIdx][i] = new AlfCovariance***[m_numCTUsInPic];
-#if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF || JVET_AA0095_ALF_LONGER_FILTER
+#if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF || JVET_AA0095_ALF_LONGER_FILTER || JVET_AA_EE2_5_1
       int numFixedFilterSets = numFixedFilters( m_filterShapes[chType][i].filterType );
 #else
       int numFixedFilterSets = ( m_filterShapes[chType][i].filterType == ALF_FILTER_EXT || m_filterShapes[chType][i].filterType == ALF_FILTER_9_EXT ) ? 2 : 1;
@@ -557,7 +557,7 @@ void EncAdaptiveLoopFilter::create( const EncCfg* encCfg, const int picWidth, co
         continue;
       }
       m_alfCovariance[compIdx][i] = new AlfCovariance**[m_numCTUsInPic];
-#if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF || JVET_AA0095_ALF_LONGER_FILTER
+#if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF || JVET_AA0095_ALF_LONGER_FILTER || JVET_AA_EE2_5_1
       int numFixedFilterSets = numFixedFilters( m_filterShapes[chType][i].filterType );
 #else
       int numFixedFilterSets = ( m_filterShapes[chType][i].filterType == ALF_FILTER_EXT || m_filterShapes[chType][i].filterType == ALF_FILTER_9_EXT ) ? 2 : 1;
@@ -779,7 +779,7 @@ void EncAdaptiveLoopFilter::destroy()
         {
           continue;
         }
-#if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF || JVET_AA0095_ALF_LONGER_FILTER
+#if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF || JVET_AA0095_ALF_LONGER_FILTER || JVET_AA_EE2_5_1
         int numFixedFilterSet = numFixedFilters( m_filterShapes[chType][i].filterType );
 #else
         int numFixedFilterSet = ( m_filterShapes[chType][i].filterType == ALF_FILTER_9_EXT || m_filterShapes[chType][i].filterType == ALF_FILTER_EXT ) ? 2 : 1;
@@ -1196,17 +1196,20 @@ void EncAdaptiveLoopFilter::ALFProcess( CodingStructure& cs, const double *lambd
   PelUnitBuf recYuv = m_tempBuf.getBuf( cs.area );
 #if ALF_IMPROVEMENT
 #if JVET_AA0095_ALF_LONGER_FILTER 
-  mirroredPaddingForAlf(cs, recYuv, MAX_FILTER_LENGTH_FIXED, true, true);
+  mirroredPaddingForAlf(cs, recYuv, MAX_FILTER_LENGTH_FIXED >> 1, true, true);
 #else
   recYuv.extendBorderPel( MAX_FILTER_LENGTH_FIXED >> 1 );
 #endif
 #else
 #if JVET_AA0095_ALF_LONGER_FILTER 
-  mirroredPaddingForAlf(cs, recYuv, MAX_ALF_FILTER_LENGTH, true, true);
+  mirroredPaddingForAlf(cs, recYuv, MAX_ALF_FILTER_LENGTH >> 1, true, true);
 #else
   recYuv.extendBorderPel( MAX_ALF_FILTER_LENGTH >> 1 );
 #endif
 #endif
+#if JVET_AA_EE2_5_1
+  m_isFixedFilterPaddedPerCtu = cs.picHeader->getVirtualBoundariesPresentFlag() || cs.slice->getCuQpDeltaSubdiv();
+#endif
 
 #if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF
   m_tempBufBeforeDb.getBuf( UnitArea( CHROMA_400, cs.area.blocks[COMPONENT_Y] ) ).extendBorderPel( NUM_DB_PAD );
@@ -1297,6 +1300,12 @@ void EncAdaptiveLoopFilter::ALFProcess( CodingStructure& cs, const double *lambd
       }
     }
   }
+#if JVET_AA_EE2_5_1
+  for(int fixedFilterSetIdx = 0; fixedFilterSetIdx < NUM_FIXED_FILTER_SETS; fixedFilterSetIdx++)
+  {
+    paddingFixedFilterResultsPic(m_fixFilterResult, fixedFilterSetIdx);
+  }
+#endif
 
   // get CTB stats for filtering
   if( m_alfWSSD )
@@ -1390,7 +1399,7 @@ void EncAdaptiveLoopFilter::ALFProcess( CodingStructure& cs, const double *lambd
   m_tempBuf.get(COMPONENT_Cr).copyFrom(cs.getRecoBuf().get(COMPONENT_Cr));
   recYuv = m_tempBuf.getBuf(cs.area);
 #if JVET_AA0095_ALF_LONGER_FILTER 
-  mirroredPaddingForAlf(cs, recYuv, MAX_ALF_FILTER_LENGTH, false, true);
+  mirroredPaddingForAlf(cs, recYuv, MAX_ALF_FILTER_LENGTH >> 1, false, true);
 #else
   recYuv.extendBorderPel(MAX_ALF_FILTER_LENGTH >> 1);
 #endif
@@ -1632,7 +1641,7 @@ void EncAdaptiveLoopFilter::alfEncoder( CodingStructure& cs, AlfParam& alfParam,
     {
       continue;
     }
-#if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF || JVET_AA0095_ALF_LONGER_FILTER
+#if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF || JVET_AA0095_ALF_LONGER_FILTER || JVET_AA_EE2_5_1
     int numFixedFilterSet = numFixedFilters( alfFilterShape[iShapeIdx].filterType );
 #else
     int numFixedFilterSet = ( alfFilterShape[iShapeIdx].filterType == ALF_FILTER_EXT || alfFilterShape[iShapeIdx].filterType == ALF_FILTER_9_EXT ) ? 2 : 1;
@@ -3198,7 +3207,7 @@ void EncAdaptiveLoopFilter::deriveStatsForFiltering( PelUnitBuf& orgYuv, PelUnit
       {
         continue;
       }
-#if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF || JVET_AA0095_ALF_LONGER_FILTER
+#if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF || JVET_AA0095_ALF_LONGER_FILTER || JVET_AA_EE2_5_1
       if( m_filterTypeTest[toChannelType(compID)][m_filterShapes[toChannelType(compID)][shape].filterType] == false )
       {
         continue;
@@ -3246,7 +3255,7 @@ void EncAdaptiveLoopFilter::deriveStatsForFiltering( PelUnitBuf& orgYuv, PelUnit
       {
         continue;
       }
-#if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF || JVET_AA0095_ALF_LONGER_FILTER
+#if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF || JVET_AA0095_ALF_LONGER_FILTER || JVET_AA_EE2_5_1
       if( m_filterTypeTest[channelIdx][m_filterShapes[channelIdx][shape].filterType] == false )
       {
         continue;
@@ -3318,6 +3327,15 @@ void EncAdaptiveLoopFilter::deriveStatsForFiltering( PelUnitBuf& orgYuv, PelUnit
 
             const UnitArea area( m_chromaFormat, Area( 0, 0, w, h ) );
             const UnitArea areaDst( m_chromaFormat, Area( xStart, yStart, w, h ) );
+#if JVET_AA_EE2_5_1
+            if ( m_isFixedFilterPaddedPerCtu )
+            {
+              for(int fixedFilterSetIdx = 0; fixedFilterSetIdx < NUM_FIXED_FILTER_SETS; fixedFilterSetIdx++ )
+              {
+                paddingFixedFilterResultsCtu(m_fixFilterResult, m_fixedFilterResultPerCtu, fixedFilterSetIdx, Area(xStart, yStart, w, h));
+              }
+            }
+#endif
             for( int compIdx = 0; compIdx < numberOfComponents; compIdx++ )
             {
               const ComponentID compID = ComponentID( compIdx );
@@ -3361,7 +3379,7 @@ void EncAdaptiveLoopFilter::deriveStatsForFiltering( PelUnitBuf& orgYuv, PelUnit
                   continue;
                 }
 #endif
-#if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF || JVET_AA0095_ALF_LONGER_FILTER
+#if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF || JVET_AA0095_ALF_LONGER_FILTER || JVET_AA_EE2_5_1
               for (int fixedFilterSetIdx = 0; fixedFilterSetIdx < numFixedFilters( m_filterShapes[chType][shape].filterType ); fixedFilterSetIdx++)
 #else
               for (int fixedFilterSetIdx = 0; fixedFilterSetIdx < ((m_filterShapes[chType][shape].filterType == ALF_FILTER_EXT || m_filterShapes[chType][shape].filterType == ALF_FILTER_9_EXT) ? 2 : 1); fixedFilterSetIdx++)
@@ -3391,7 +3409,7 @@ void EncAdaptiveLoopFilter::deriveStatsForFiltering( PelUnitBuf& orgYuv, PelUnit
               for (int classIdx = 0; classIdx < numClasses; classIdx++)
               {
 #if ALF_IMPROVEMENT
-#if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF || JVET_AA0095_ALF_LONGER_FILTER
+#if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF || JVET_AA0095_ALF_LONGER_FILTER || JVET_AA_EE2_5_1
                 if(isLuma(compID))
                 {
                   continue;
@@ -3422,7 +3440,7 @@ void EncAdaptiveLoopFilter::deriveStatsForFiltering( PelUnitBuf& orgYuv, PelUnit
         for( int compIdx = 0; compIdx < numberOfComponents; compIdx++ )
         {
           const ComponentID compID = ComponentID( compIdx );
-#if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF || JVET_AA0095_ALF_LONGER_FILTER
+#if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF || JVET_AA0095_ALF_LONGER_FILTER || JVET_AA_EE2_5_1
           if(isLuma(compID))
           {
             continue;
@@ -3433,7 +3451,7 @@ void EncAdaptiveLoopFilter::deriveStatsForFiltering( PelUnitBuf& orgYuv, PelUnit
 
           for( int shape = 0; shape != m_filterShapes[chType].size(); shape++ )
           {
-#if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF || JVET_AA0095_ALF_LONGER_FILTER
+#if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF || JVET_AA0095_ALF_LONGER_FILTER || JVET_AA_EE2_5_1
             if( m_filterTypeTest[chType][m_filterShapes[chType][shape].filterType] == false )
             {
               continue;
@@ -3460,6 +3478,15 @@ void EncAdaptiveLoopFilter::deriveStatsForFiltering( PelUnitBuf& orgYuv, PelUnit
       else
       {
         const UnitArea area( m_chromaFormat, Area( xPos, yPos, width, height ) );
+#if JVET_AA_EE2_5_1
+        if ( m_isFixedFilterPaddedPerCtu )
+        {
+          for(int fixedFilterSetIdx = 0; fixedFilterSetIdx < NUM_FIXED_FILTER_SETS; fixedFilterSetIdx++ )
+          {
+            paddingFixedFilterResultsCtu(m_fixFilterResult, m_fixedFilterResultPerCtu, fixedFilterSetIdx, Area( xPos, yPos, width, height ));
+          }
+        }
+#endif
 
         for( int compIdx = 0; compIdx < numberOfComponents; compIdx++ )
         {
@@ -3487,7 +3514,7 @@ void EncAdaptiveLoopFilter::deriveStatsForFiltering( PelUnitBuf& orgYuv, PelUnit
             {
               continue;
             }
-#if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF || JVET_AA0095_ALF_LONGER_FILTER
+#if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF || JVET_AA0095_ALF_LONGER_FILTER || JVET_AA_EE2_5_1
             for (int fixedFilterSetIdx = 0; fixedFilterSetIdx < numFixedFilters(m_filterShapes[chType][shape].filterType); fixedFilterSetIdx++)
 #else
             for( int fixedFilterSetIdx = 0; fixedFilterSetIdx < ((m_filterShapes[chType][shape].filterType == ALF_FILTER_EXT || m_filterShapes[chType][shape].filterType == ALF_FILTER_9_EXT) ? 2 : 1); fixedFilterSetIdx++ )
@@ -3518,7 +3545,7 @@ void EncAdaptiveLoopFilter::deriveStatsForFiltering( PelUnitBuf& orgYuv, PelUnit
           for( int classIdx = 0; classIdx < numClasses; classIdx++ )
           {
 #if ALF_IMPROVEMENT
-#if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF || JVET_AA0095_ALF_LONGER_FILTER
+#if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF || JVET_AA0095_ALF_LONGER_FILTER || JVET_AA_EE2_5_1
             if(isLuma(compID))
             {
               continue;
@@ -3582,6 +3609,13 @@ void EncAdaptiveLoopFilter::getBlkStats( AlfCovariance* alfCovariance, const Alf
 #else
   int ELocal[MAX_NUM_ALF_LUMA_COEFF][MaxAlfNumClippingValues];
 #endif
+#if JVET_AA_EE2_5_1
+  int numCoeff = shape.numCoeff;
+  if( shape.filterType == ALF_FILTER_9_EXT_DB || shape.filterType == ALF_FILTER_13_EXT_DB )
+  {
+    numCoeff = shape.numCoeff + 1;
+  }
+#endif
 
   const int numBins = AlfNumClippingValues[channel];
   int transposeIdx = 0;
@@ -3627,21 +3661,43 @@ void EncAdaptiveLoopFilter::getBlkStats( AlfCovariance* alfCovariance, const Alf
 #endif
 
 #if ALF_IMPROVEMENT
+#if JVET_AA_EE2_5_1
+      Position posInCtu = Position( j, i);
+#endif
 #if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF
+#if JVET_AA_EE2_5_1
+      calcCovariance( ELocal, rec + j, recStride, recBeforeDb + j, recBeforeDbStride, shape, transposeIdx, channel, shape.filterType >= ALF_FILTER_9_EXT ? m_fixFilterResult : nullptr, Position(area.x + j ,area.y + i), fixedFilterSetIdx, posInCtu );
+#else
       calcCovariance( ELocal, rec + j, recStride, recBeforeDb + j, recBeforeDbStride, shape, transposeIdx, channel, shape.filterType >= ALF_FILTER_9_EXT ? m_fixFilterResult : nullptr, Position(area.x + j ,area.y + i), fixedFilterSetIdx );
+#endif
 #elif JVET_AA0095_ALF_LONGER_FILTER
+#if JVET_AA_EE2_5_1
+      calcCovariance( ELocal, rec + j, recStride, shape, transposeIdx, channel, shape.filterType >= ALF_FILTER_9_EXT ? m_fixFilterResult : nullptr, Position(area.x + j, area.y + i), fixedFilterSetIdx, posInCtu);
+#else
       calcCovariance( ELocal, rec + j, recStride, shape, transposeIdx, channel, shape.filterType >= ALF_FILTER_9_EXT ? m_fixFilterResult : nullptr, Position(area.x + j, area.y + i), fixedFilterSetIdx);
+#endif
+#else
+#if JVET_AA_EE2_5_1
+      calcCovariance( ELocal, rec + j, recStride, shape, transposeIdx, channel, ( shape.filterType == ALF_FILTER_9_EXT || shape.filterType == ALF_FILTER_EXT ) ? m_fixFilterResult : nullptr, Position(area.x + j ,area.y + i), fixedFilterSetIdx, posInCtu );
 #else
       calcCovariance( ELocal, rec + j, recStride, shape, transposeIdx, channel, ( shape.filterType == ALF_FILTER_9_EXT || shape.filterType == ALF_FILTER_EXT ) ? m_fixFilterResult : nullptr, Position(area.x + j ,area.y + i), fixedFilterSetIdx );
 #endif
+#endif
 #else
       calcCovariance( ELocal, rec + j, recStride, shape, transposeIdx, channel, vbDistance );
 #endif
 
+#if JVET_AA_EE2_5_1
+      for( int k = 0; k < numCoeff; k++ )
+      {
+        for( int l = k; l < numCoeff; l++ )
+        {
+#else
       for( int k = 0; k < shape.numCoeff; k++ )
       {
         for( int l = k; l < shape.numCoeff; l++ )
         {
+#endif
           for( int b0 = 0; b0 < numBins; b0++ )
           {
             for( int b1 = 0; b1 < numBins; b1++ )
@@ -3716,7 +3772,11 @@ void EncAdaptiveLoopFilter::getBlkStats( AlfCovariance* alfCovariance, const Alf
 #endif
   for( classIdx = 0; classIdx < numClasses; classIdx++ )
   {
+#if JVET_AA_EE2_5_1
+    for( int k = 1; k < numCoeff; k++ )
+#else
     for( int k = 1; k < shape.numCoeff; k++ )
+#endif
     {
       for( int l = 0; l < k; l++ )
       {
@@ -3738,7 +3798,11 @@ void EncAdaptiveLoopFilter::calcCovariance( Pel ELocal[MAX_NUM_ALF_LUMA_COEFF][M
 #if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF
   const Pel* recBeforeDb, const int recBeforeDbStride,
 #endif
-  const AlfFilterShape& shape, const int transposeIdx, const ChannelType channel, Pel ***fixedFitlerResults, Position pos, int fixedFilterSetIdx )
+  const AlfFilterShape& shape, const int transposeIdx, const ChannelType channel, Pel ***fixedFitlerResults, Position pos, int fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+  , Position posInCtu
+#endif
+  )
 #else
 void EncAdaptiveLoopFilter::calcCovariance( Pel ELocal[MAX_NUM_ALF_LUMA_COEFF][MaxAlfNumClippingValues], const Pel *rec, const int stride, const AlfFilterShape& shape, const int transposeIdx, const ChannelType channel, int vbDistance )
 #endif
@@ -3748,7 +3812,11 @@ void EncAdaptiveLoopFilter::calcCovariance( int ELocal[MAX_NUM_ALF_LUMA_COEFF][M
 #if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF
      const Pel* recBeforeDb, const int recBeforeDbStride,
 #endif
-     const AlfFilterShape& shape, const int transposeIdx, const ChannelType channel, Pel *fixedFitlerResults, int fixedFilterSetIdx )
+     const AlfFilterShape& shape, const int transposeIdx, const ChannelType channel, Pel *fixedFitlerResults, int fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+     , Position posInCtu
+#endif
+     )
 #else
 void EncAdaptiveLoopFilter::calcCovariance( int ELocal[MAX_NUM_ALF_LUMA_COEFF][MaxAlfNumClippingValues], const Pel *rec, const int stride, const AlfFilterShape& shape, const int transposeIdx, const ChannelType channel, int vbDistance )
 #endif
@@ -3780,6 +3848,9 @@ void EncAdaptiveLoopFilter::calcCovariance( int ELocal[MAX_NUM_ALF_LUMA_COEFF][M
 #else
   const short curr = rec[0];
 #endif
+#if JVET_AA_EE2_5_1
+  int padSize = ALF_PADDING_SIZE_FIXED_RESULTS;
+#endif
 #if JVET_AA0095_ALF_LONGER_FILTER
 #if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF
   if( shape.filterType == ALF_FILTER_13_EXT || shape.filterType == ALF_FILTER_13_EXT_DB )
@@ -4044,12 +4115,92 @@ void EncAdaptiveLoopFilter::calcCovariance( int ELocal[MAX_NUM_ALF_LUMA_COEFF][M
   } //data collection for new shape
 #endif
 #if ALF_IMPROVEMENT
+#if JVET_AA_EE2_5_1
+  if( shape.filterType >= ALF_FILTER_9_EXT && shape.filterType != ALF_FILTER_EXT )
+  {
+    int filterSetIdx = 0 + fixedFilterSetIdx;
+    Pel *pImg0FixedBased, *pImg1FixedBased, *pImg2FixedBased, *pImg3FixedBased, *pImg4FixedBased;
+
+    if( m_isFixedFilterPaddedPerCtu )
+    {
+      pImg0FixedBased = &m_fixedFilterResultPerCtu[filterSetIdx][posInCtu.y + padSize + 0][posInCtu.x + padSize];
+      pImg1FixedBased = &m_fixedFilterResultPerCtu[filterSetIdx][posInCtu.y + padSize + 1][posInCtu.x + padSize];
+      pImg2FixedBased = &m_fixedFilterResultPerCtu[filterSetIdx][posInCtu.y + padSize - 1][posInCtu.x + padSize];
+      pImg3FixedBased = &m_fixedFilterResultPerCtu[filterSetIdx][posInCtu.y + padSize + 2][posInCtu.x + padSize];
+      pImg4FixedBased = &m_fixedFilterResultPerCtu[filterSetIdx][posInCtu.y + padSize - 2][posInCtu.x + padSize];
+    }
+    else
+    {
+      pImg0FixedBased = &fixedFitlerResults[filterSetIdx][pos.y + padSize + 0][pos.x + padSize];
+      pImg1FixedBased = &fixedFitlerResults[filterSetIdx][pos.y + padSize + 1][pos.x + padSize];
+      pImg2FixedBased = &fixedFitlerResults[filterSetIdx][pos.y + padSize - 1][pos.x + padSize];
+      pImg3FixedBased = &fixedFitlerResults[filterSetIdx][pos.y + padSize + 2][pos.x + padSize];
+      pImg4FixedBased = &fixedFitlerResults[filterSetIdx][pos.y + padSize - 2][pos.x + padSize];
+    }
+
+    if( transposeIdx == 1 )
+    {
+      for(int b = 0; b < numBins; b++)
+      {
+        ELocal[24][b] += clipALF(clip[b], curr, pImg3FixedBased[+0], pImg4FixedBased[+0]);
+        ELocal[21][b] += clipALF(clip[b], curr, pImg1FixedBased[+1], pImg2FixedBased[-1]);
+        ELocal[25][b] += clipALF(clip[b], curr, pImg1FixedBased[+0], pImg2FixedBased[-0]);
+        ELocal[23][b] += clipALF(clip[b], curr, pImg1FixedBased[-1], pImg2FixedBased[+1]);
+        ELocal[20][b] += clipALF(clip[b], curr, pImg0FixedBased[+2], pImg0FixedBased[-2]);
+        ELocal[22][b] += clipALF(clip[b], curr, pImg0FixedBased[+1], pImg0FixedBased[-1]);
+      }
+    }
+    else if (transposeIdx == 2 )
+    {
+      for(int b = 0; b < numBins; b++)
+      {
+        ELocal[20][b] += clipALF(clip[b], curr, pImg3FixedBased[+0], pImg4FixedBased[+0]);
+        ELocal[23][b] += clipALF(clip[b], curr, pImg1FixedBased[+1], pImg2FixedBased[-1]);
+        ELocal[22][b] += clipALF(clip[b], curr, pImg1FixedBased[+0], pImg2FixedBased[-0]);
+        ELocal[21][b] += clipALF(clip[b], curr, pImg1FixedBased[-1], pImg2FixedBased[+1]);
+        ELocal[24][b] += clipALF(clip[b], curr, pImg0FixedBased[+2], pImg0FixedBased[-2]);
+        ELocal[25][b] += clipALF(clip[b], curr, pImg0FixedBased[+1], pImg0FixedBased[-1]);
+      }
+    }
+    else if (transposeIdx == 3 )
+    {
+      for(int b = 0; b < numBins; b++)
+      {
+        ELocal[24][b] += clipALF(clip[b], curr, pImg3FixedBased[+0], pImg4FixedBased[+0]);
+        ELocal[23][b] += clipALF(clip[b], curr, pImg1FixedBased[+1], pImg2FixedBased[-1]);
+        ELocal[25][b] += clipALF(clip[b], curr, pImg1FixedBased[+0], pImg2FixedBased[-0]);
+        ELocal[21][b] += clipALF(clip[b], curr, pImg1FixedBased[-1], pImg2FixedBased[+1]);
+        ELocal[20][b] += clipALF(clip[b], curr, pImg0FixedBased[+2], pImg0FixedBased[-2]);
+        ELocal[22][b] += clipALF(clip[b], curr, pImg0FixedBased[+1], pImg0FixedBased[-1]);
+      }
+    }
+    else
+    {
+      for(int b = 0; b < numBins; b++)
+      {
+        ELocal[20][b] += clipALF(clip[b], curr, pImg3FixedBased[+0], pImg4FixedBased[+0]);
+        ELocal[21][b] += clipALF(clip[b], curr, pImg1FixedBased[+1], pImg2FixedBased[-1]);
+        ELocal[22][b] += clipALF(clip[b], curr, pImg1FixedBased[+0], pImg2FixedBased[-0]);
+        ELocal[23][b] += clipALF(clip[b], curr, pImg1FixedBased[-1], pImg2FixedBased[+1]);
+        ELocal[24][b] += clipALF(clip[b], curr, pImg0FixedBased[+2], pImg0FixedBased[-2]);
+        ELocal[25][b] += clipALF(clip[b], curr, pImg0FixedBased[+1], pImg0FixedBased[-1]);
+      }
+    }
+  }
+#endif
 #if JVET_AA0095_ALF_LONGER_FILTER
   if( shape.filterType == ALF_FILTER_9_EXT || shape.filterType == ALF_FILTER_13_EXT )
 #else
   if( shape.filterType == ALF_FILTER_9_EXT )
 #endif
   {
+#if JVET_AA_EE2_5_1
+    for ( int b = 0; b < numBins; b++ )
+    {
+      ELocal[26][b] += clipALF(clip[b], curr, fixedFitlerResults[0 + fixedFilterSetIdx][pos.y + padSize][pos.x + padSize]);
+      ELocal[27][b] += clipALF(clip[b], curr, fixedFitlerResults[2 + fixedFilterSetIdx][pos.y + padSize][pos.x + padSize]);
+    }
+#else
     for( int i = filterPattern[k]; i < filterPattern[k] + EXT_LENGTH; i++ )
     {
       for ( int b = 0; b < numBins; b++ )
@@ -4057,6 +4208,7 @@ void EncAdaptiveLoopFilter::calcCovariance( int ELocal[MAX_NUM_ALF_LUMA_COEFF][M
         ELocal[i][b] += clipALF(clip[b], curr, fixedFitlerResults[(i - filterPattern[k]) * EXT_LENGTH + fixedFilterSetIdx][pos.y][pos.x]);
       }
     }
+#endif
     for( int b = 0; b < numBins; b++ )
     {
       ELocal[shape.numCoeff - 1][b] += curr;
@@ -4072,6 +4224,17 @@ void EncAdaptiveLoopFilter::calcCovariance( int ELocal[MAX_NUM_ALF_LUMA_COEFF][M
     const Pel* pRecDbTmp0 = recBeforeDb;
     const Pel* pRecDbTmp1 = recBeforeDb + recBeforeDbStride;
     const Pel* pRecDbTmp2 = recBeforeDb - recBeforeDbStride;
+#if JVET_AA_EE2_5_1
+    for ( int b = 0; b < numBins; b++ )
+    {
+      ELocal[26][b] += clipALF(clip[b], curr, pRecDbTmp2[+0], pRecDbTmp1[+0]);
+      ELocal[27][b] += clipALF(clip[b], curr, pRecDbTmp0[-1], pRecDbTmp0[+1]);
+
+      ELocal[28][b] += clipALF(clip[b], curr, fixedFitlerResults[0 + fixedFilterSetIdx][pos.y + padSize][pos.x + padSize]);
+      ELocal[29][b] += clipALF(clip[b], curr, fixedFitlerResults[2 + fixedFilterSetIdx][pos.y + padSize][pos.x + padSize]);
+      ELocal[30][b] += clipALF(clip[b], curr, pRecDbTmp0[+0]);
+    }
+#else
     for (int b = 0; b < numBins; b++)
     {
       ELocal[filterPattern[k]][b]     += clipALF(clip[b], curr, pRecDbTmp1[+0]) + clipALF(clip[b], curr, pRecDbTmp2[+0]);
@@ -4085,6 +4248,7 @@ void EncAdaptiveLoopFilter::calcCovariance( int ELocal[MAX_NUM_ALF_LUMA_COEFF][M
         ELocal[i][b] += clipALF(clip[b], curr, fixedFitlerResults[(i - filterPattern[k] - NUM_DB) * EXT_LENGTH + fixedFilterSetIdx][pos.y][pos.x]);
       }
     }
+#endif
     for( int b = 0; b < numBins; b++ )
     {
       ELocal[shape.numCoeff - 1][b] += curr;
@@ -4097,7 +4261,11 @@ void EncAdaptiveLoopFilter::calcCovariance( int ELocal[MAX_NUM_ALF_LUMA_COEFF][M
     {
       for( int b = 0; b < numBins; b++ )
       {
+#if JVET_AA_EE2_5_1
+        ELocal[i][b] += clipALF(clip[b], curr, fixedFitlerResults[i * EXT_LENGTH + fixedFilterSetIdx][pos.y + padSize][pos.x + padSize]);
+#else
         ELocal[i][b] += clipALF(clip[b], curr, fixedFitlerResults[i * EXT_LENGTH + fixedFilterSetIdx][pos.y][pos.x]);
+#endif
       }
     }
 
@@ -4244,6 +4412,9 @@ void  EncAdaptiveLoopFilter::initDistortion(
   PelUnitBuf orgYuv = cs.getTrueOrgBuf();
 #else
   PelUnitBuf orgYuv = cs.getOrgBuf();
+#endif
+#if JVET_AA_EE2_5_1
+  int padSize = ALF_PADDING_SIZE_FIXED_RESULTS;
 #endif
   int orgStride = orgYuv.get(COMPONENT_Y).stride;
   int ctbIdx = 0;
@@ -4268,11 +4439,19 @@ void  EncAdaptiveLoopFilter::initDistortion(
               if (alfWSSD)
               {
                 double weight = m_lumaLevelToWeightPLUT[org[x]];
+#if JVET_AA_EE2_5_1
+                m_ctbDistortionFixedFilter[classifierIdx][filterSetIdx][ctbIdx] += weight * (org[x] - m_fixFilterResult[fixedFilter][y + yPos + padSize][x + xPos + padSize]) *  (org[x] - m_fixFilterResult[fixedFilter][y + yPos + padSize][x + xPos + padSize]);
+#else
                 m_ctbDistortionFixedFilter[classifierIdx][filterSetIdx][ctbIdx] += weight * (org[x] - m_fixFilterResult[fixedFilter][y + yPos][x + xPos]) *  (org[x] - m_fixFilterResult[fixedFilter][y + yPos][x + xPos]);
+#endif
               }
               else
               {
+#if JVET_AA_EE2_5_1
+                m_ctbDistortionFixedFilter[classifierIdx][filterSetIdx][ctbIdx] += (org[x] - m_fixFilterResult[fixedFilter][y + yPos + padSize][x + xPos + padSize]) *  (org[x] - m_fixFilterResult[fixedFilter][y + yPos + padSize][x + xPos + padSize]);
+#else
                 m_ctbDistortionFixedFilter[classifierIdx][filterSetIdx][ctbIdx] += (org[x] - m_fixFilterResult[fixedFilter][y + yPos][x + xPos]) *  (org[x] - m_fixFilterResult[fixedFilter][y + yPos][x + xPos]);
+#endif
               }
             }
             org += orgStride;
@@ -4314,7 +4493,7 @@ void  EncAdaptiveLoopFilter::getDistNewFilter( AlfParam& alfParam )
   reconstructCoeff( alfParam, CHANNEL_TYPE_LUMA, true, true );
 #if ALF_IMPROVEMENT
   AlfFilterType filterTypeCtb = alfParam.filterType[CHANNEL_TYPE_LUMA];
-#if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF || JVET_AA0095_ALF_LONGER_FILTER
+#if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF || JVET_AA0095_ALF_LONGER_FILTER || JVET_AA_EE2_5_1
   int numFixedFilterSet = numFixedFilters( filterTypeCtb );
 #else
   int numFixedFilterSet = (filterTypeCtb == ALF_FILTER_EXT || filterTypeCtb == ALF_FILTER_9_EXT) ? 2 : 1;
@@ -4384,7 +4563,7 @@ void  EncAdaptiveLoopFilter::getDistApsFilter( CodingStructure& cs, std::vector<
     m_numLumaAltAps[apsIdx] = alfParamTmp.numAlternativesLuma;
     AlfFilterType filterTypeCtb = alfParamTmp.filterType[CHANNEL_TYPE_LUMA];
     m_filterTypeApsLuma[apsIdx] = filterTypeCtb;
-#if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF || JVET_AA0095_ALF_LONGER_FILTER
+#if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF || JVET_AA0095_ALF_LONGER_FILTER || JVET_AA_EE2_5_1
     int numFixedFilterSet = numFixedFilters( filterTypeCtb );
 #else
     int numFixedFilterSet = ( filterTypeCtb == ALF_FILTER_EXT || filterTypeCtb == ALF_FILTER_9_EXT ) ? 2 : 1;
@@ -5186,6 +5365,12 @@ void EncAdaptiveLoopFilter::alfReconstructor(CodingStructure& cs, const PelUnitB
                 coeff = m_coeffApsLuma[filterSetIndex - NUM_FIXED_FILTER_SETS][alt_num];
                 clip = m_clippApsLuma[filterSetIndex - NUM_FIXED_FILTER_SETS][alt_num];
                 AlfFilterType filterTypeCtb = m_filterTypeApsLuma[filterSetIndex - NUM_FIXED_FILTER_SETS];
+#if JVET_AA_EE2_5_1
+                if( m_isFixedFilterPaddedPerCtu )
+                {
+                  paddingFixedFilterResultsCtu(m_fixFilterResult, m_fixedFilterResultPerCtu, fixedFilterSetIdx, blkDst);
+                }
+#endif
 #if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF
                 PelUnitBuf bufDb = m_tempBufBeforeDb2.subBuf( UnitArea ( CHROMA_400, Area( 0, 0, wBuf, hBuf ) ) );
 #if JVET_AA0095_ALF_LONGER_FILTER
@@ -5212,16 +5397,32 @@ void EncAdaptiveLoopFilter::alfReconstructor(CodingStructure& cs, const PelUnitB
 #if JVET_X0071_ALF_BAND_CLASSIFIER
                 int classifierIdx = m_classifierIdxApsLuma[filterSetIndex - NUM_FIXED_FILTER_SETS][alt_num];
 #if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF
+#if JVET_AA_EE2_5_1
+                alfFiltering( m_classifier[classifierIdx], recBuf, bufDb, buf, blkDst, blkSrc, COMPONENT_Y, coeff, clip, m_clpRngs.comp[COMPONENT_Y], cs, filterTypeCtb, m_fixFilterResult, fixedFilterSetIdx, m_fixedFilterResultPerCtu, m_isFixedFilterPaddedPerCtu );
+#else
                 alfFiltering( m_classifier[classifierIdx], recBuf, bufDb, buf, blkDst, blkSrc, COMPONENT_Y, coeff, clip, m_clpRngs.comp[COMPONENT_Y], cs, filterTypeCtb, m_fixFilterResult, fixedFilterSetIdx );
+#endif
+#else
+#if JVET_AA_EE2_5_1
+                alfFiltering( m_classifier[classifierIdx], recBuf, buf, blkDst, blkSrc, COMPONENT_Y, coeff, clip, m_clpRngs.comp[COMPONENT_Y], cs, filterTypeCtb, m_fixFilterResult, fixedFilterSetIdx, m_fixedFilterResultPerCtu, m_isFixedFilterPaddedPerCtu );
 #else
                 alfFiltering( m_classifier[classifierIdx], recBuf, buf, blkDst, blkSrc, COMPONENT_Y, coeff, clip, m_clpRngs.comp[COMPONENT_Y], cs, filterTypeCtb, m_fixFilterResult, fixedFilterSetIdx );
 #endif
+#endif
 #else
 #if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF
+#if JVET_AA_EE2_5_1
+                alfFiltering( m_classifier, recBuf, bufDb, buf, blkDst, blkSrc, COMPONENT_Y, coeff, clip, m_clpRngs.comp[COMPONENT_Y], cs, filterTypeCtb, m_fixFilterResult, fixedFilterSetIdx, m_fixedFilterResultPerCtu, m_isFixedFilterPaddedPerCtu );
+#else
                 alfFiltering( m_classifier, recBuf, bufDb, buf, blkDst, blkSrc, COMPONENT_Y, coeff, clip, m_clpRngs.comp[COMPONENT_Y], cs, filterTypeCtb, m_fixFilterResult, fixedFilterSetIdx );
+#endif
+#else
+#if JVET_AA_EE2_5_1
+                alfFiltering( m_classifier, recBuf, buf, blkDst, blkSrc, COMPONENT_Y, coeff, clip, m_clpRngs.comp[COMPONENT_Y], cs, filterTypeCtb, m_fixFilterResult, fixedFilterSetIdx, m_fixedFilterResultPerCtu, m_isFixedFilterPaddedPerCtu );
 #else
                 alfFiltering( m_classifier, recBuf, buf, blkDst, blkSrc, COMPONENT_Y, coeff, clip, m_clpRngs.comp[COMPONENT_Y], cs, filterTypeCtb, m_fixFilterResult, fixedFilterSetIdx );
 #endif
+#endif
 #endif
               }
 #else
@@ -5252,17 +5453,33 @@ void EncAdaptiveLoopFilter::alfReconstructor(CodingStructure& cs, const PelUnitB
 #if ALF_IMPROVEMENT
 #if JVET_X0071_ALF_BAND_CLASSIFIER
 #if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF
+#if JVET_AA_EE2_5_1
+                alfFiltering( m_classifier[0], recBuf, tmpYuvBeforeDb, buf, blkDst, blkSrc, compID, m_chromaCoeffFinal[alt_num], m_chromaClippFinal[alt_num], m_clpRngs.comp[compIdx], cs, m_filterTypeApsChroma, nullptr, -1, nullptr, false );
+#else
                 alfFiltering( m_classifier[0], recBuf, tmpYuvBeforeDb, buf, blkDst, blkSrc, compID, m_chromaCoeffFinal[alt_num], m_chromaClippFinal[alt_num], m_clpRngs.comp[compIdx], cs, m_filterTypeApsChroma, nullptr, -1 );
+#endif
+#else
+#if JVET_AA_EE2_5_1
+                alfFiltering( m_classifier[0], recBuf, buf, blkDst, blkSrc, compID, m_chromaCoeffFinal[alt_num], m_chromaClippFinal[alt_num], m_clpRngs.comp[compIdx], cs, m_filterTypeApsChroma, nullptr, -1, nullptr, false );
 #else
                 alfFiltering( m_classifier[0], recBuf, buf, blkDst, blkSrc, compID, m_chromaCoeffFinal[alt_num], m_chromaClippFinal[alt_num], m_clpRngs.comp[compIdx], cs, m_filterTypeApsChroma, nullptr, -1 );
 #endif
+#endif
 #else
 #if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF
+#if JVET_AA_EE2_5_1
+                alfFiltering( m_classifier, recBuf, tmpYuvBeforeDb, buf, blkDst, blkSrc, compID, m_chromaCoeffFinal[alt_num], m_chromaClippFinal[alt_num], m_clpRngs.comp[compIdx], cs, m_filterTypeApsChroma, nullptr, -1, nullptr, false );
+#else
                 alfFiltering( m_classifier, recBuf, tmpYuvBeforeDb, buf, blkDst, blkSrc, compID, m_chromaCoeffFinal[alt_num], m_chromaClippFinal[alt_num], m_clpRngs.comp[compIdx], cs, m_filterTypeApsChroma, nullptr, -1 );
+#endif
+#else
+#if JVET_AA_EE2_5_1
+                alfFiltering( m_classifier, recBuf, buf, blkDst, blkSrc, compID, m_chromaCoeffFinal[alt_num], m_chromaClippFinal[alt_num], m_clpRngs.comp[compIdx], cs, m_filterTypeApsChroma, nullptr, -1, nullptr, false );
 #else
                 alfFiltering( m_classifier, recBuf, buf, blkDst, blkSrc, compID, m_chromaCoeffFinal[alt_num], m_chromaClippFinal[alt_num], m_clpRngs.comp[compIdx], cs, m_filterTypeApsChroma, nullptr, -1 );
 #endif
 #endif
+#endif
 #else
                 m_filter5x5Blk( m_classifier, recBuf, buf, blkDst, blkSrc, compID, m_chromaCoeffFinal[alt_num], m_chromaClippFinal[alt_num], m_clpRngs.comp[compIdx], cs, m_alfVBChmaCTUHeight, m_alfVBChmaPos );
 #endif
@@ -5300,19 +5517,41 @@ void EncAdaptiveLoopFilter::alfReconstructor(CodingStructure& cs, const PelUnitB
           coeff = m_coeffApsLuma[filterSetIndex - NUM_FIXED_FILTER_SETS][alt_num];
           clip = m_clippApsLuma[filterSetIndex - NUM_FIXED_FILTER_SETS][alt_num];
           AlfFilterType filterTypeCtb = m_filterTypeApsLuma[filterSetIndex - NUM_FIXED_FILTER_SETS];
+#if JVET_AA_EE2_5_1
+          if( m_isFixedFilterPaddedPerCtu )
+          {
+            paddingFixedFilterResultsCtu(m_fixFilterResult, m_fixedFilterResultPerCtu, fixedFilterSetIdx, blk);
+          }
+#endif
 #if JVET_X0071_ALF_BAND_CLASSIFIER
           int classifierIdx = m_classifierIdxApsLuma[filterSetIndex - NUM_FIXED_FILTER_SETS][alt_num];
 #if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF
+#if JVET_AA_EE2_5_1
+          alfFiltering(m_classifier[classifierIdx], recBuf, tmpYuvBeforeDb, recExtBuf, blk, blk, COMPONENT_Y, coeff, clip, m_clpRngs.comp[COMPONENT_Y], cs, filterTypeCtb, m_fixFilterResult, fixedFilterSetIdx, m_fixedFilterResultPerCtu, m_isFixedFilterPaddedPerCtu);
+#else
           alfFiltering(m_classifier[classifierIdx], recBuf, tmpYuvBeforeDb, recExtBuf, blk, blk, COMPONENT_Y, coeff, clip, m_clpRngs.comp[COMPONENT_Y], cs, filterTypeCtb, m_fixFilterResult, fixedFilterSetIdx);
+#endif
+#else
+#if JVET_AA_EE2_5_1
+          alfFiltering(m_classifier[classifierIdx], recBuf, recExtBuf, blk, blk, COMPONENT_Y, coeff, clip, m_clpRngs.comp[COMPONENT_Y], cs, filterTypeCtb, m_fixFilterResult, fixedFilterSetIdx, m_fixedFilterResultPerCtu, m_isFixedFilterPaddedPerCtu);
 #else
           alfFiltering(m_classifier[classifierIdx], recBuf, recExtBuf, blk, blk, COMPONENT_Y, coeff, clip, m_clpRngs.comp[COMPONENT_Y], cs, filterTypeCtb, m_fixFilterResult, fixedFilterSetIdx);
 #endif
+#endif
 #else
 #if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF
+#if JVET_AA_EE2_5_1
+          alfFiltering(m_classifier, recBuf, tmpYuvBeforeDb, recExtBuf, blk, blk, COMPONENT_Y, coeff, clip, m_clpRngs.comp[COMPONENT_Y], cs, filterTypeCtb, m_fixFilterResult, fixedFilterSetIdx, m_fixedFilterResultPerCtu, m_isFixedFilterPaddedPerCtu);
+#else
           alfFiltering(m_classifier, recBuf, tmpYuvBeforeDb, recExtBuf, blk, blk, COMPONENT_Y, coeff, clip, m_clpRngs.comp[COMPONENT_Y], cs, filterTypeCtb, m_fixFilterResult, fixedFilterSetIdx);
+#endif
+#else
+#if JVET_AA_EE2_5_1
+          alfFiltering(m_classifier, recBuf, recExtBuf, blk, blk, COMPONENT_Y, coeff, clip, m_clpRngs.comp[COMPONENT_Y], cs, filterTypeCtb, m_fixFilterResult, fixedFilterSetIdx, m_fixedFilterResultPerCtu, m_isFixedFilterPaddedPerCtu );
 #else
           alfFiltering(m_classifier, recBuf, recExtBuf, blk, blk, COMPONENT_Y, coeff, clip, m_clpRngs.comp[COMPONENT_Y], cs, filterTypeCtb, m_fixFilterResult, fixedFilterSetIdx);
 #endif
+#endif
 #endif
         }
 #else
@@ -5343,17 +5582,33 @@ void EncAdaptiveLoopFilter::alfReconstructor(CodingStructure& cs, const PelUnitB
 #if ALF_IMPROVEMENT
 #if JVET_X0071_ALF_BAND_CLASSIFIER
 #if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF
+#if JVET_AA_EE2_5_1
+          alfFiltering( m_classifier[0], recBuf, tmpYuvBeforeDb, recExtBuf, blk, blk, compID, m_chromaCoeffFinal[altNum], m_chromaClippFinal[altNum], m_clpRngs.comp[compIdx], cs, m_filterTypeApsChroma, nullptr, -1, nullptr, false );
+#else
           alfFiltering( m_classifier[0], recBuf, tmpYuvBeforeDb, recExtBuf, blk, blk, compID, m_chromaCoeffFinal[altNum], m_chromaClippFinal[altNum], m_clpRngs.comp[compIdx], cs, m_filterTypeApsChroma, nullptr, -1 );
+#endif
+#else
+#if JVET_AA_EE2_5_1
+          alfFiltering( m_classifier[0], recBuf, recExtBuf, blk, blk, compID, m_chromaCoeffFinal[altNum], m_chromaClippFinal[altNum], m_clpRngs.comp[compIdx], cs, m_filterTypeApsChroma, nullptr, -1, nullptr, false );
 #else
           alfFiltering( m_classifier[0], recBuf, recExtBuf, blk, blk, compID, m_chromaCoeffFinal[altNum], m_chromaClippFinal[altNum], m_clpRngs.comp[compIdx], cs, m_filterTypeApsChroma, nullptr, -1 );
 #endif
+#endif
 #else
 #if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF
+#if JVET_AA_EE2_5_1
+          alfFiltering( m_classifier, recBuf, tmpYuvBeforeDb, recExtBuf, blk, blk, compID, m_chromaCoeffFinal[altNum], m_chromaClippFinal[altNum], m_clpRngs.comp[compIdx], cs, m_filterTypeApsChroma, nullptr, -1, nullptr, false );
+#else
           alfFiltering( m_classifier, recBuf, tmpYuvBeforeDb, recExtBuf, blk, blk, compID, m_chromaCoeffFinal[altNum], m_chromaClippFinal[altNum], m_clpRngs.comp[compIdx], cs, m_filterTypeApsChroma, nullptr, -1 );
+#endif
+#else
+#if JVET_AA_EE2_5_1
+          alfFiltering( m_classifier, recBuf, recExtBuf, blk, blk, compID, m_chromaCoeffFinal[altNum], m_chromaClippFinal[altNum], m_clpRngs.comp[compIdx], cs, m_filterTypeApsChroma, nullptr, -1, nullptr, false );
 #else
           alfFiltering( m_classifier, recBuf, recExtBuf, blk, blk, compID, m_chromaCoeffFinal[altNum], m_chromaClippFinal[altNum], m_clpRngs.comp[compIdx], cs, m_filterTypeApsChroma, nullptr, -1 );
 #endif
 #endif
+#endif
 #else
           m_filter5x5Blk( m_classifier, recBuf, recExtBuf, blk, blk, compID, m_chromaCoeffFinal[altNum], m_chromaClippFinal[altNum], m_clpRngs.comp[compIdx], cs, m_alfVBChmaCTUHeight, m_alfVBChmaPos );
 #endif
@@ -5450,7 +5705,7 @@ void EncAdaptiveLoopFilter::deriveCcAlfFilterCoeff( ComponentID compID, const Pe
     forward_tab[CCALF_CANDS_COEFF_NR - 1 - i] = (-1) * CCALF_SMALL_TAB[i];
   }
 
-#if JVET_X0071_LONGER_CCALF && !JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF
+#if JVET_X0071_LONGER_CCALF && !JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF && !JVET_AA_EE2_5_1
   using TE = double[MAX_NUM_CC_ALF_CHROMA_COEFF][MAX_NUM_CC_ALF_CHROMA_COEFF];
   using Ty = double[MAX_NUM_CC_ALF_CHROMA_COEFF];
 #else
diff --git a/source/Lib/EncoderLib/EncAdaptiveLoopFilter.h b/source/Lib/EncoderLib/EncAdaptiveLoopFilter.h
index 04e2d761..f16fb7a1 100644
--- a/source/Lib/EncoderLib/EncAdaptiveLoopFilter.h
+++ b/source/Lib/EncoderLib/EncAdaptiveLoopFilter.h
@@ -48,7 +48,7 @@ struct AlfCovariance
 {
   static constexpr int MaxAlfNumClippingValues = AdaptiveLoopFilter::MaxAlfNumClippingValues;
 
-#if JVET_X0071_LONGER_CCALF && !JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF
+#if JVET_X0071_LONGER_CCALF && !JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF && !JVET_AA_EE2_5_1
   using TE = double[MAX_NUM_CC_ALF_CHROMA_COEFF][MAX_NUM_CC_ALF_CHROMA_COEFF];
   using Ty = double[MAX_NUM_CC_ALF_CHROMA_COEFF];
 #else
@@ -398,13 +398,21 @@ private:
 #if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF
     const Pel* recBeforeDb, const int recBeforeDbStride,
 #endif
-    const AlfFilterShape& shape, const int transposeIdx, const ChannelType channel, Pel ***fixedFitlerResults, Position pos, int fixedFilterSetIdx);
+    const AlfFilterShape& shape, const int transposeIdx, const ChannelType channel, Pel ***fixedFitlerResults, Position pos, int fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+    , Position posInCtu
+#endif
+    );
 #else  
   void   calcCovariance(int ELocal[MAX_NUM_ALF_LUMA_COEFF][MaxAlfNumClippingValues], const Pel *rec, const int stride,
 #if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF
     const Pel* recBeforeDb, const int recBeforeDbStride,
 #endif
-    const AlfFilterShape& shape, const int transposeIdx, const ChannelType channel, Pel ***fixedFitlerResults, Position pos, int fixedFilterSetIdx);
+    const AlfFilterShape& shape, const int transposeIdx, const ChannelType channel, Pel ***fixedFitlerResults, Position pos, int fixedFilterSetIdx
+#if JVET_AA_EE2_5_1
+    , Position posInCtu
+#endif
+    );
 #endif
 #else
   void   getBlkStats(AlfCovariance* alfCovariace, const AlfFilterShape& shape, AlfClassifier** classifier, Pel* org, const int orgStride, Pel* rec, const int recStride, const CompArea& areaDst, const CompArea& area, const ChannelType channel, int vbCTUHeight, int vbPos);
diff --git a/source/Lib/EncoderLib/VLCWriter.cpp b/source/Lib/EncoderLib/VLCWriter.cpp
index 6f5d798b..60483411 100644
--- a/source/Lib/EncoderLib/VLCWriter.cpp
+++ b/source/Lib/EncoderLib/VLCWriter.cpp
@@ -651,7 +651,7 @@ void HLSWriter::codeAlfAps( APS* pcAPS )
         }
       }
       AlfFilterType alfFilterType = param.filterType[CHANNEL_TYPE_LUMA];
-#if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF || JVET_AA0095_ALF_LONGER_FILTER
+#if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF || JVET_AA0095_ALF_LONGER_FILTER || JVET_AA_EE2_5_1
       AlfFilterShape  filterShape( alfTypeToSize[alfFilterType] );
 #else
       AlfFilterShape filterShape(alfFilterType == ALF_FILTER_5 ? 5 : (alfFilterType == ALF_FILTER_9_EXT ? size_ALF_FILTER_9_EXT : ((alfFilterType == ALF_FILTER_7 ? 7 : (alfFilterType == ALF_FILTER_EXT ? size_ALF_FILTER_EXT : 9)))));
@@ -712,7 +712,7 @@ void HLSWriter::codeAlfAps( APS* pcAPS )
 #if ALF_IMPROVEMENT
       WRITE_FLAG( param.nonLinearFlag[CHANNEL_TYPE_CHROMA][altIdx], "alf_nonlinear_enable_flag_chroma" );
       AlfFilterType alfFilterType = param.filterType[CHANNEL_TYPE_CHROMA];
-#if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF || JVET_AA0095_ALF_LONGER_FILTER
+#if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF || JVET_AA0095_ALF_LONGER_FILTER || JVET_AA_EE2_5_1
       AlfFilterShape  filterShape( alfTypeToSize[alfFilterType] );
 #else
       AlfFilterShape filterShape(alfFilterType == ALF_FILTER_5 ? 5 : (alfFilterType == ALF_FILTER_9_EXT ? size_ALF_FILTER_9_EXT : ((alfFilterType == ALF_FILTER_7 ? 7 : (alfFilterType == ALF_FILTER_EXT ? size_ALF_FILTER_EXT : 9)))));
@@ -3964,7 +3964,7 @@ void HLSWriter::alfFilter( const AlfParam& alfParam, const bool isChroma, const
 {
 #if ALF_IMPROVEMENT
   AlfFilterType alfFilterType = isChroma ? alfParam.filterType[CHANNEL_TYPE_CHROMA] : alfParam.filterType[CHANNEL_TYPE_LUMA];
-#if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF || JVET_AA0095_ALF_LONGER_FILTER
+#if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF || JVET_AA0095_ALF_LONGER_FILTER || JVET_AA_EE2_5_1
   AlfFilterShape alfShape( alfTypeToSize[alfFilterType] );
 #else
   AlfFilterShape alfShape(alfFilterType == ALF_FILTER_5 ? 5 : (alfFilterType == ALF_FILTER_9_EXT ? size_ALF_FILTER_9_EXT : ((alfFilterType == ALF_FILTER_7 ? 7 : (alfFilterType == ALF_FILTER_EXT ? size_ALF_FILTER_EXT :9)))));
