From 4fb6695f3dc03cbcfc84e9a165f85f577368eb5a Mon Sep 17 00:00:00 2001
From: Frank Bossen <fbossen@gmail.com>
Date: Thu, 25 Aug 2022 22:24:53 -0400
Subject: [PATCH] Use strong enum type for filter index

---
 source/Lib/CommonLib/InterPrediction.cpp     | 66 ++++++++++++--------
 source/Lib/CommonLib/InterPrediction.h       |  5 +-
 source/Lib/CommonLib/InterpolationFilter.cpp | 48 +++++++-------
 source/Lib/CommonLib/InterpolationFilter.h   | 23 ++++---
 source/Lib/EncoderLib/InterSearch.cpp        | 42 +++++++------
 5 files changed, 102 insertions(+), 82 deletions(-)

diff --git a/source/Lib/CommonLib/InterPrediction.cpp b/source/Lib/CommonLib/InterPrediction.cpp
index 31faa3fc7..f288c4991 100644
--- a/source/Lib/CommonLib/InterPrediction.cpp
+++ b/source/Lib/CommonLib/InterPrediction.cpp
@@ -693,7 +693,10 @@ void InterPrediction::xPredInterBlk(const ComponentID &compID, const PredictionU
 
   bool useAltHpelIf = pu.cu->imv == IMV_HPEL;
 
-  if( !isIBC && xPredInterBlkRPR( scalingRatio, *pu.cs->pps, CompArea( compID, chFmt, pu.blocks[compID], Size( dstPic.bufs[compID].width, dstPic.bufs[compID].height ) ), refPic, mv, dstPic.bufs[compID].buf, dstPic.bufs[compID].stride, bi, wrapRef, clpRng, 0, useAltHpelIf ) )
+  if (!isIBC
+      && xPredInterBlkRPR(scalingRatio, *pu.cs->pps, CompArea(compID, chFmt, pu.blocks[compID], dstPic.bufs[compID]),
+                          refPic, mv, dstPic.bufs[compID].buf, dstPic.bufs[compID].stride, bi, wrapRef, clpRng,
+                          InterpolationFilter::Filter::DEFAULT, useAltHpelIf))
   {
     CHECK( bilinearMC, "DMVR should be disabled with RPR" );
     CHECK( bioApplied, "BDOF should be disabled with RPR" );
@@ -760,17 +763,19 @@ void InterPrediction::xPredInterBlk(const ComponentID &compID, const PredictionU
       dstBuf.buf    = m_filteredBlockTmp[2 + m_iRefListIdx][compID] + 2 * dstBuf.stride + 2;
     }
 
-    const int filterIdx = bilinearMC ? InterpolationFilter::FILTER_DMVR : InterpolationFilter::FILTER_DEFAULT;
+    const auto filterIdx =
+      bilinearMC ? InterpolationFilter::Filter::DMVR
+                 : (useAltHpelIf ? InterpolationFilter::Filter::HALFPEL_ALT : InterpolationFilter::Filter::DEFAULT);
 
     if (yFrac == 0)
     {
       m_if.filterHor(compID, (Pel *) refBuf.buf, refBuf.stride, dstBuf.buf, dstBuf.stride, backupWidth, backupHeight,
-                     xFrac, rndRes, clpRng, filterIdx, useAltHpelIf);
+                     xFrac, rndRes, clpRng, filterIdx);
     }
     else if (xFrac == 0)
     {
       m_if.filterVer(compID, (Pel *) refBuf.buf, refBuf.stride, dstBuf.buf, dstBuf.stride, backupWidth, backupHeight,
-                     yFrac, true, rndRes, clpRng, filterIdx, useAltHpelIf);
+                     yFrac, true, rndRes, clpRng, filterIdx);
     }
     else
     {
@@ -787,11 +792,10 @@ void InterPrediction::xPredInterBlk(const ComponentID &compID, const PredictionU
         vFilterSize = NTAPS_BILINEAR;
       }
       m_if.filterHor(compID, (Pel *) refBuf.buf - ((vFilterSize >> 1) - 1) * refBuf.stride, refBuf.stride, tmpBuf.buf,
-                     tmpBuf.stride, backupWidth, backupHeight + vFilterSize - 1, xFrac, false, clpRng, filterIdx,
-                     useAltHpelIf);
+                     tmpBuf.stride, backupWidth, backupHeight + vFilterSize - 1, xFrac, false, clpRng, filterIdx);
       JVET_J0090_SET_CACHE_ENABLE(false);
       m_if.filterVer(compID, (Pel *) tmpBuf.buf + ((vFilterSize >> 1) - 1) * tmpBuf.stride, tmpBuf.stride, dstBuf.buf,
-                     dstBuf.stride, backupWidth, backupHeight, yFrac, false, rndRes, clpRng, filterIdx, useAltHpelIf);
+                     dstBuf.stride, backupWidth, backupHeight, yFrac, false, rndRes, clpRng, filterIdx);
     }
     JVET_J0090_SET_CACHE_ENABLE(
       (srcPadStride == 0)
@@ -1101,7 +1105,7 @@ void InterPrediction::xPredAffineBlk(const ComponentID &compID, const Prediction
       }
 #endif
 
-      const int filterIdx = InterpolationFilter::FILTER_AFFINE;
+      const auto filterIdx = InterpolationFilter::Filter::AFFINE;
 
       if( isRefScaled )
       {
@@ -2280,7 +2284,10 @@ bool InterPrediction::isLumaBvValid(const int ctuSize, const int xCb, const int
   return true;
 }
 
-bool InterPrediction::xPredInterBlkRPR( const std::pair<int, int>& scalingRatio, const PPS& pps, const CompArea &blk, const Picture* refPic, const Mv& mv, Pel* dst, const int dstStride, const bool bi, const bool wrapRef, const ClpRng& clpRng, const int filterIndex, const bool useAltHpelIf )
+bool InterPrediction::xPredInterBlkRPR(const std::pair<int, int> &scalingRatio, const PPS &pps, const CompArea &blk,
+                                       const Picture *refPic, const Mv &mv, Pel *dst, const int dstStride,
+                                       const bool bi, const bool wrapRef, const ClpRng &clpRng,
+                                       const InterpolationFilter::Filter filterIndex, const bool useAltHpelIf)
 {
   const ChromaFormat  chFmt = blk.chromaFormat;
   const ComponentID compID = blk.compID;
@@ -2301,51 +2308,62 @@ bool InterPrediction::xPredInterBlkRPR( const std::pair<int, int>& scalingRatio,
     int refPicWidth = refPic->getPicWidthInLumaSamples();
     int refPicHeight = refPic->getPicHeightInLumaSamples();
 
-    int xFilter = filterIndex;
-    int yFilter = filterIndex;
+    InterpolationFilter::Filter xFilter       = filterIndex;
+    InterpolationFilter::Filter yFilter       = filterIndex;
     const int rprThreshold1 = ( 1 << SCALE_RATIO_BITS ) * 5 / 4;
     const int rprThreshold2 = ( 1 << SCALE_RATIO_BITS ) * 7 / 4;
-    if (filterIndex == InterpolationFilter::FILTER_DEFAULT || !isLuma(compID))
+    if (filterIndex == InterpolationFilter::Filter::DEFAULT || !isLuma(compID))
     {
       if( scalingRatio.first > rprThreshold2 )
       {
-        xFilter = InterpolationFilter::FILTER_RPR2;
+        xFilter = InterpolationFilter::Filter::RPR2;
       }
       else if( scalingRatio.first > rprThreshold1 )
       {
-        xFilter = InterpolationFilter::FILTER_RPR1;
+        xFilter = InterpolationFilter::Filter::RPR1;
       }
 
       if( scalingRatio.second > rprThreshold2 )
       {
-        yFilter = InterpolationFilter::FILTER_RPR2;
+        yFilter = InterpolationFilter::Filter::RPR2;
       }
       else if( scalingRatio.second > rprThreshold1 )
       {
-        yFilter = InterpolationFilter::FILTER_RPR1;
+        yFilter = InterpolationFilter::Filter::RPR1;
       }
     }
-    else if (filterIndex == InterpolationFilter::FILTER_AFFINE)
+    else if (filterIndex == InterpolationFilter::Filter::AFFINE)
     {
       if (scalingRatio.first > rprThreshold2)
       {
-        xFilter = InterpolationFilter::FILTER_AFFINE_RPR2;
+        xFilter = InterpolationFilter::Filter::AFFINE_RPR2;
       }
       else if (scalingRatio.first > rprThreshold1)
       {
-        xFilter = InterpolationFilter::FILTER_AFFINE_RPR1;
+        xFilter = InterpolationFilter::Filter::AFFINE_RPR1;
       }
 
       if (scalingRatio.second > rprThreshold2)
       {
-        yFilter = InterpolationFilter::FILTER_AFFINE_RPR2;
+        yFilter = InterpolationFilter::Filter::AFFINE_RPR2;
       }
       else if (scalingRatio.second > rprThreshold1)
       {
-        yFilter = InterpolationFilter::FILTER_AFFINE_RPR1;
+        yFilter = InterpolationFilter::Filter::AFFINE_RPR1;
       }
     }
 
+    if (useAltHpelIf)
+    {
+      if (xFilter == InterpolationFilter::Filter::DEFAULT && scalingRatio.first == 1 << SCALE_RATIO_BITS)
+      {
+        xFilter = InterpolationFilter::Filter::HALFPEL_ALT;
+      }
+      if (yFilter == InterpolationFilter::Filter::DEFAULT && scalingRatio.second == 1 << SCALE_RATIO_BITS)
+      {
+        yFilter = InterpolationFilter::Filter::HALFPEL_ALT;
+      }
+    }
     const int posShift = SCALE_RATIO_BITS - 4;
     int stepX = ( scalingRatio.first + 8 ) >> 4;
     int stepY = ( scalingRatio.second + 8 ) >> 4;
@@ -2415,8 +2433,7 @@ bool InterPrediction::xPredInterBlkRPR( const std::pair<int, int>& scalingRatio,
       Pel *const tempBuf = m_filteredBlockTmpRPR + col;
 
       m_if.filterHor(compID, (Pel *) refBuf.buf - ((vFilterSize >> 1) - 1) * refBuf.stride, refBuf.stride, tempBuf,
-                     tmpStride, 1, refHeight + vFilterSize - 1 + extSize, xFrac, false, clpRng, xFilter,
-                     useAltHpelIf && scalingRatio.first == 1 << SCALE_RATIO_BITS);
+                     tmpStride, 1, refHeight + vFilterSize - 1 + extSize, xFrac, false, clpRng, xFilter);
     }
 
     for( row = 0; row < height; row++ )
@@ -2432,8 +2449,7 @@ bool InterPrediction::xPredInterBlkRPR( const std::pair<int, int>& scalingRatio,
 
       JVET_J0090_SET_CACHE_ENABLE( false );
       m_if.filterVer(compID, tempBuf + ((vFilterSize >> 1) - 1) * tmpStride, tmpStride, dst + row * dstStride,
-                     dstStride, width, 1, yFrac, false, rndRes, clpRng, yFilter,
-                     useAltHpelIf && scalingRatio.second == 1 << SCALE_RATIO_BITS);
+                     dstStride, width, 1, yFrac, false, rndRes, clpRng, yFilter);
       JVET_J0090_SET_CACHE_ENABLE( true );
     }
   }
diff --git a/source/Lib/CommonLib/InterPrediction.h b/source/Lib/CommonLib/InterPrediction.h
index 75ee7d1f0..62934e191 100644
--- a/source/Lib/CommonLib/InterPrediction.h
+++ b/source/Lib/CommonLib/InterPrediction.h
@@ -206,7 +206,10 @@ public:
   void resetVPDUforIBC(const ChromaFormat chromaFormatIDC, const int ctuSize, const int vSize, const int xPos, const int yPos);
   bool isLumaBvValid(const int ctuSize, const int xCb, const int yCb, const int width, const int height, const int xBv, const int yBv);
 
-  bool xPredInterBlkRPR( const std::pair<int, int>& scalingRatio, const PPS& pps, const CompArea &blk, const Picture* refPic, const Mv& mv, Pel* dst, const int dstStride, const bool bi, const bool wrapRef, const ClpRng& clpRng, const int filterIndex, const bool useAltHpelIf = false );
+  bool xPredInterBlkRPR(const std::pair<int, int> &scalingRatio, const PPS &pps, const CompArea &blk,
+                        const Picture *refPic, const Mv &mv, Pel *dst, const int dstStride, const bool bi,
+                        const bool wrapRef, const ClpRng &clpRng, const InterpolationFilter::Filter filterIndex,
+                        const bool useAltHpelIf = false);
 };
 
 //! \}
diff --git a/source/Lib/CommonLib/InterpolationFilter.cpp b/source/Lib/CommonLib/InterpolationFilter.cpp
index 9b604a288..036325fe5 100644
--- a/source/Lib/CommonLib/InterpolationFilter.cpp
+++ b/source/Lib/CommonLib/InterpolationFilter.cpp
@@ -674,43 +674,43 @@ void InterpolationFilter::filterVer(const ClpRng &clpRng, Pel const *src, const
 
 void InterpolationFilter::filterHor(const ComponentID compID, Pel const *src, const ptrdiff_t srcStride, Pel *dst,
                                     const ptrdiff_t dstStride, int width, int height, int frac, bool isLast,
-                                    const ClpRng &clpRng, int nFilterIdx, bool useAltHpelIf)
+                                    const ClpRng &clpRng, Filter nFilterIdx)
 {
-  const bool biMCForDMVR = nFilterIdx == FILTER_DMVR;
+  const bool biMCForDMVR = nFilterIdx == Filter::DMVR;
 
-  if (frac == 0 && nFilterIdx <= FILTER_AFFINE)
+  if (frac == 0 && nFilterIdx <= Filter::AFFINE)
   {
     m_filterCopy[true][isLast]( clpRng, src, srcStride, dst, dstStride, width, height, biMCForDMVR );
   }
   else if( isLuma( compID ) )
   {
     CHECK( frac < 0 || frac >= LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS, "Invalid fraction" );
-    if (nFilterIdx == FILTER_DMVR)
+    if (nFilterIdx == Filter::DMVR)
     {
       filterHor<NTAPS_BILINEAR>( clpRng, src, srcStride, dst, dstStride, width, height, isLast, m_bilinearFilterPrec4[frac], biMCForDMVR );
     }
-    else if (nFilterIdx == FILTER_AFFINE)
+    else if (nFilterIdx == Filter::AFFINE)
     {
       filterHor<NTAPS_LUMA_AFFINE>(clpRng, src, srcStride, dst, dstStride, width, height, isLast,
                                    m_affineLumaFilter[frac], biMCForDMVR);
     }
-    else if (nFilterIdx == FILTER_RPR1)
+    else if (nFilterIdx == Filter::RPR1)
     {
       filterHor<NTAPS_LUMA>( clpRng, src, srcStride, dst, dstStride, width, height, isLast, m_lumaFilterRPR1[frac], biMCForDMVR );
     }
-    else if (nFilterIdx == FILTER_RPR2)
+    else if (nFilterIdx == Filter::RPR2)
     {
       filterHor<NTAPS_LUMA>( clpRng, src, srcStride, dst, dstStride, width, height, isLast, m_lumaFilterRPR2[frac], biMCForDMVR );
     }
-    else if (nFilterIdx == FILTER_AFFINE_RPR1)
+    else if (nFilterIdx == Filter::AFFINE_RPR1)
     {
       filterHor<NTAPS_LUMA>(clpRng, src, srcStride, dst, dstStride, width, height, isLast, m_affineLumaFilterRPR1[frac], biMCForDMVR);
     }
-    else if (nFilterIdx == FILTER_AFFINE_RPR2)
+    else if (nFilterIdx == Filter::AFFINE_RPR2)
     {
       filterHor<NTAPS_LUMA>(clpRng, src, srcStride, dst, dstStride, width, height, isLast, m_affineLumaFilterRPR2[frac], biMCForDMVR);
     }
-    else if( frac == 8 && useAltHpelIf )
+    else if (frac == 8 && nFilterIdx == Filter::HALFPEL_ALT)
     {
       filterHor<NTAPS_LUMA>( clpRng, src, srcStride, dst, dstStride, width, height, isLast, m_lumaAltHpelIFilter, biMCForDMVR );
     }
@@ -722,12 +722,12 @@ void InterpolationFilter::filterHor(const ComponentID compID, Pel const *src, co
   else
   {
     CHECK(frac < 0 || frac >= CHROMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS, "Invalid fraction");
-    if (nFilterIdx == FILTER_RPR1)
+    if (nFilterIdx == Filter::RPR1)
     {
       filterHor<NTAPS_CHROMA>(clpRng, src, srcStride, dst, dstStride, width, height, isLast, m_chromaFilterRPR1[frac],
                               biMCForDMVR);
     }
-    else if (nFilterIdx == FILTER_RPR2)
+    else if (nFilterIdx == Filter::RPR2)
     {
       filterHor<NTAPS_CHROMA>(clpRng, src, srcStride, dst, dstStride, width, height, isLast, m_chromaFilterRPR2[frac],
                               biMCForDMVR);
@@ -742,43 +742,43 @@ void InterpolationFilter::filterHor(const ComponentID compID, Pel const *src, co
 
 void InterpolationFilter::filterVer(const ComponentID compID, Pel const *src, const ptrdiff_t srcStride, Pel *dst,
                                     const ptrdiff_t dstStride, int width, int height, int frac, bool isFirst,
-                                    bool isLast, const ClpRng &clpRng, int nFilterIdx, bool useAltHpelIf)
+                                    bool isLast, const ClpRng &clpRng, Filter nFilterIdx)
 {
-  const bool biMCForDMVR = nFilterIdx == FILTER_DMVR;
+  const bool biMCForDMVR = nFilterIdx == Filter::DMVR;
 
-  if (frac == 0 && nFilterIdx <= FILTER_AFFINE)
+  if (frac == 0 && nFilterIdx <= Filter::AFFINE)
   {
     m_filterCopy[isFirst][isLast]( clpRng, src, srcStride, dst, dstStride, width, height, biMCForDMVR );
   }
   else if( isLuma( compID ) )
   {
     CHECK( frac < 0 || frac >= LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS, "Invalid fraction" );
-    if (nFilterIdx == FILTER_DMVR)
+    if (nFilterIdx == Filter::DMVR)
     {
       filterVer<NTAPS_BILINEAR>( clpRng, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_bilinearFilterPrec4[frac], biMCForDMVR );
     }
-    else if (nFilterIdx == FILTER_AFFINE)
+    else if (nFilterIdx == Filter::AFFINE)
     {
       filterVer<NTAPS_LUMA_AFFINE>(clpRng, src, srcStride, dst, dstStride, width, height, isFirst, isLast,
                                    m_affineLumaFilter[frac], biMCForDMVR);
     }
-    else if (nFilterIdx == FILTER_RPR1)
+    else if (nFilterIdx == Filter::RPR1)
     {
       filterVer<NTAPS_LUMA>( clpRng, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_lumaFilterRPR1[frac], biMCForDMVR );
     }
-    else if (nFilterIdx == FILTER_RPR2)
+    else if (nFilterIdx == Filter::RPR2)
     {
       filterVer<NTAPS_LUMA>( clpRng, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_lumaFilterRPR2[frac], biMCForDMVR );
     }
-    else if (nFilterIdx == FILTER_AFFINE_RPR1)
+    else if (nFilterIdx == Filter::AFFINE_RPR1)
     {
       filterVer<NTAPS_LUMA>(clpRng, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_affineLumaFilterRPR1[frac], biMCForDMVR);
     }
-    else if (nFilterIdx == FILTER_AFFINE_RPR2)
+    else if (nFilterIdx == Filter::AFFINE_RPR2)
     {
       filterVer<NTAPS_LUMA>(clpRng, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_affineLumaFilterRPR2[frac], biMCForDMVR);
     }
-    else if( frac == 8 && useAltHpelIf )
+    else if (frac == 8 && nFilterIdx == Filter::HALFPEL_ALT)
     {
       filterVer<NTAPS_LUMA>( clpRng, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_lumaAltHpelIFilter, biMCForDMVR );
     }
@@ -790,12 +790,12 @@ void InterpolationFilter::filterVer(const ComponentID compID, Pel const *src, co
   else
   {
     CHECK(frac < 0 || frac >= CHROMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS, "Invalid fraction");
-    if (nFilterIdx == FILTER_RPR1)
+    if (nFilterIdx == Filter::RPR1)
     {
       filterVer<NTAPS_CHROMA>(clpRng, src, srcStride, dst, dstStride, width, height, isFirst, isLast,
                               m_chromaFilterRPR1[frac], biMCForDMVR);
     }
-    else if (nFilterIdx == FILTER_RPR2)
+    else if (nFilterIdx == Filter::RPR2)
     {
       filterVer<NTAPS_CHROMA>(clpRng, src, srcStride, dst, dstStride, width, height, isFirst, isLast,
                               m_chromaFilterRPR2[frac], biMCForDMVR);
diff --git a/source/Lib/CommonLib/InterpolationFilter.h b/source/Lib/CommonLib/InterpolationFilter.h
index 747feddac..49274268c 100644
--- a/source/Lib/CommonLib/InterpolationFilter.h
+++ b/source/Lib/CommonLib/InterpolationFilter.h
@@ -93,15 +93,16 @@ protected:
   static CacheModel* m_cacheModel;
 #endif
 public:
-  enum
+  enum class Filter
   {
-    FILTER_DEFAULT = 0,
-    FILTER_DMVR,
-    FILTER_AFFINE,
-    FILTER_RPR1,
-    FILTER_RPR2,
-    FILTER_AFFINE_RPR1,
-    FILTER_AFFINE_RPR2,
+    DEFAULT = 0,
+    DMVR,
+    AFFINE,
+    RPR1,
+    RPR2,
+    AFFINE_RPR1,
+    AFFINE_RPR2,
+    HALFPEL_ALT
   };
 
   InterpolationFilter();
@@ -121,11 +122,9 @@ public:
   void _initInterpolationFilterX86();
 #endif
   void filterHor(const ComponentID compID, Pel const *src, ptrdiff_t srcStride, Pel *dst, ptrdiff_t dstStride,
-                 int width, int height, int frac, bool isLast, const ClpRng &clpRng, int nFilterIdx = FILTER_DEFAULT,
-                 bool useAltHpelIf = false);
+                 int width, int height, int frac, bool isLast, const ClpRng &clpRng, Filter nFilterIdx);
   void filterVer(const ComponentID compID, Pel const *src, ptrdiff_t srcStride, Pel *dst, ptrdiff_t dstStride,
-                 int width, int height, int frac, bool isFirst, bool isLast, const ClpRng &clpRng,
-                 int nFilterIdx = FILTER_DEFAULT, bool useAltHpelIf = false);
+                 int width, int height, int frac, bool isFirst, bool isLast, const ClpRng &clpRng, Filter nFilterIdx);
 #if JVET_J0090_MEMORY_BANDWITH_MEASURE
   void cacheAssign( CacheModel *cache ) { m_cacheModel = cache; }
 #endif
diff --git a/source/Lib/EncoderLib/InterSearch.cpp b/source/Lib/EncoderLib/InterSearch.cpp
index 8d268226d..92ecc6961 100644
--- a/source/Lib/EncoderLib/InterSearch.cpp
+++ b/source/Lib/EncoderLib/InterSearch.cpp
@@ -9046,18 +9046,20 @@ void InterSearch::xExtDIFUpSamplingH(CPelBuf* pattern, bool useAltHpelIf)
   int halfFilterSize = (filterSize>>1);
   const Pel *srcPtr = pattern->buf - halfFilterSize*srcStride - 1;
 
+  const auto filterIdx = useAltHpelIf ? InterpolationFilter::Filter::HALFPEL_ALT : InterpolationFilter::Filter::DEFAULT;
+
   m_if.filterHor(COMPONENT_Y, srcPtr, srcStride, m_filteredBlockTmp[0][0], intStride, width + 1, height + filterSize,
-                 0 << MV_FRACTIONAL_BITS_DIFF, false, clpRng, InterpolationFilter::FILTER_DEFAULT, useAltHpelIf);
+                 0 << MV_FRACTIONAL_BITS_DIFF, false, clpRng, filterIdx);
   if (!m_skipFracME)
   {
     m_if.filterHor(COMPONENT_Y, srcPtr, srcStride, m_filteredBlockTmp[2][0], intStride, width + 1, height + filterSize,
-                   2 << MV_FRACTIONAL_BITS_DIFF, false, clpRng, InterpolationFilter::FILTER_DEFAULT, useAltHpelIf);
+                   2 << MV_FRACTIONAL_BITS_DIFF, false, clpRng, filterIdx);
   }
 
   intPtr = m_filteredBlockTmp[0][0] + halfFilterSize * intStride + 1;
   dstPtr = m_filteredBlock[0][0][0];
   m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width + 0, height + 0, 0 << MV_FRACTIONAL_BITS_DIFF,
-                 false, true, clpRng, InterpolationFilter::FILTER_DEFAULT, useAltHpelIf);
+                 false, true, clpRng, filterIdx);
   if (m_skipFracME)
   {
     return;
@@ -9066,17 +9068,17 @@ void InterSearch::xExtDIFUpSamplingH(CPelBuf* pattern, bool useAltHpelIf)
   intPtr = m_filteredBlockTmp[0][0] + (halfFilterSize - 1) * intStride + 1;
   dstPtr = m_filteredBlock[2][0][0];
   m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width + 0, height + 1, 2 << MV_FRACTIONAL_BITS_DIFF,
-                 false, true, clpRng, InterpolationFilter::FILTER_DEFAULT, useAltHpelIf);
+                 false, true, clpRng, filterIdx);
 
   intPtr = m_filteredBlockTmp[2][0] + halfFilterSize * intStride;
   dstPtr = m_filteredBlock[0][2][0];
   m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width + 1, height + 0, 0 << MV_FRACTIONAL_BITS_DIFF,
-                 false, true, clpRng, InterpolationFilter::FILTER_DEFAULT, useAltHpelIf);
+                 false, true, clpRng, filterIdx);
 
   intPtr = m_filteredBlockTmp[2][0] + (halfFilterSize - 1) * intStride;
   dstPtr = m_filteredBlock[2][2][0];
   m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width + 1, height + 1, 2 << MV_FRACTIONAL_BITS_DIFF,
-                 false, true, clpRng, InterpolationFilter::FILTER_DEFAULT, useAltHpelIf);
+                 false, true, clpRng, filterIdx);
 }
 
 
@@ -9117,7 +9119,7 @@ void InterSearch::xExtDIFUpSamplingQ( CPelBuf* pattern, Mv halfPelRef )
     srcPtr += 1;
   }
   m_if.filterHor(COMPONENT_Y, srcPtr, srcStride, intPtr, intStride, width, extHeight, 1 << MV_FRACTIONAL_BITS_DIFF,
-                 false, clpRng);
+                 false, clpRng, InterpolationFilter::Filter::DEFAULT);
 
   // Horizontal filter 3/4
   srcPtr = pattern->buf - halfFilterSize*srcStride - 1;
@@ -9131,7 +9133,7 @@ void InterSearch::xExtDIFUpSamplingQ( CPelBuf* pattern, Mv halfPelRef )
     srcPtr += 1;
   }
   m_if.filterHor(COMPONENT_Y, srcPtr, srcStride, intPtr, intStride, width, extHeight, 3 << MV_FRACTIONAL_BITS_DIFF,
-                 false, clpRng);
+                 false, clpRng, InterpolationFilter::Filter::DEFAULT);
 
   // Generate @ 1,1
   intPtr = m_filteredBlockTmp[1][0] + (halfFilterSize-1) * intStride;
@@ -9141,13 +9143,13 @@ void InterSearch::xExtDIFUpSamplingQ( CPelBuf* pattern, Mv halfPelRef )
     intPtr += intStride;
   }
   m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width, height, 1 << MV_FRACTIONAL_BITS_DIFF, false,
-                 true, clpRng);
+                 true, clpRng, InterpolationFilter::Filter::DEFAULT);
 
   // Generate @ 3,1
   intPtr = m_filteredBlockTmp[1][0] + (halfFilterSize-1) * intStride;
   dstPtr = m_filteredBlock[3][1][0];
   m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width, height, 3 << MV_FRACTIONAL_BITS_DIFF, false,
-                 true, clpRng);
+                 true, clpRng, InterpolationFilter::Filter::DEFAULT);
 
   if (halfPelRef.getVer() != 0)
   {
@@ -9159,7 +9161,7 @@ void InterSearch::xExtDIFUpSamplingQ( CPelBuf* pattern, Mv halfPelRef )
       intPtr += intStride;
     }
     m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width, height, 2 << MV_FRACTIONAL_BITS_DIFF,
-                   false, true, clpRng);
+                   false, true, clpRng, InterpolationFilter::Filter::DEFAULT);
 
     // Generate @ 2,3
     intPtr = m_filteredBlockTmp[3][0] + (halfFilterSize - 1) * intStride;
@@ -9169,7 +9171,7 @@ void InterSearch::xExtDIFUpSamplingQ( CPelBuf* pattern, Mv halfPelRef )
       intPtr += intStride;
     }
     m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width, height, 2 << MV_FRACTIONAL_BITS_DIFF,
-                   false, true, clpRng);
+                   false, true, clpRng, InterpolationFilter::Filter::DEFAULT);
   }
   else
   {
@@ -9177,13 +9179,13 @@ void InterSearch::xExtDIFUpSamplingQ( CPelBuf* pattern, Mv halfPelRef )
     intPtr = m_filteredBlockTmp[1][0] + halfFilterSize * intStride;
     dstPtr = m_filteredBlock[0][1][0];
     m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width, height, 0 << MV_FRACTIONAL_BITS_DIFF,
-                   false, true, clpRng);
+                   false, true, clpRng, InterpolationFilter::Filter::DEFAULT);
 
     // Generate @ 0,3
     intPtr = m_filteredBlockTmp[3][0] + halfFilterSize * intStride;
     dstPtr = m_filteredBlock[0][3][0];
     m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width, height, 0 << MV_FRACTIONAL_BITS_DIFF,
-                   false, true, clpRng);
+                   false, true, clpRng, InterpolationFilter::Filter::DEFAULT);
   }
 
   if (halfPelRef.getHor() != 0)
@@ -9200,7 +9202,7 @@ void InterSearch::xExtDIFUpSamplingQ( CPelBuf* pattern, Mv halfPelRef )
       intPtr += intStride;
     }
     m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width, height, 1 << MV_FRACTIONAL_BITS_DIFF,
-                   false, true, clpRng);
+                   false, true, clpRng, InterpolationFilter::Filter::DEFAULT);
 
     // Generate @ 3,2
     intPtr = m_filteredBlockTmp[2][0] + (halfFilterSize - 1) * intStride;
@@ -9214,7 +9216,7 @@ void InterSearch::xExtDIFUpSamplingQ( CPelBuf* pattern, Mv halfPelRef )
       intPtr += intStride;
     }
     m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width, height, 3 << MV_FRACTIONAL_BITS_DIFF,
-                   false, true, clpRng);
+                   false, true, clpRng, InterpolationFilter::Filter::DEFAULT);
   }
   else
   {
@@ -9226,7 +9228,7 @@ void InterSearch::xExtDIFUpSamplingQ( CPelBuf* pattern, Mv halfPelRef )
       intPtr += intStride;
     }
     m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width, height, 1 << MV_FRACTIONAL_BITS_DIFF,
-                   false, true, clpRng);
+                   false, true, clpRng, InterpolationFilter::Filter::DEFAULT);
 
     // Generate @ 3,0
     intPtr = m_filteredBlockTmp[0][0] + (halfFilterSize - 1) * intStride + 1;
@@ -9236,7 +9238,7 @@ void InterSearch::xExtDIFUpSamplingQ( CPelBuf* pattern, Mv halfPelRef )
       intPtr += intStride;
     }
     m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width, height, 3 << MV_FRACTIONAL_BITS_DIFF,
-                   false, true, clpRng);
+                   false, true, clpRng, InterpolationFilter::Filter::DEFAULT);
   }
 
   // Generate @ 1,3
@@ -9247,13 +9249,13 @@ void InterSearch::xExtDIFUpSamplingQ( CPelBuf* pattern, Mv halfPelRef )
     intPtr += intStride;
   }
   m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width, height, 1 << MV_FRACTIONAL_BITS_DIFF, false,
-                 true, clpRng);
+                 true, clpRng, InterpolationFilter::Filter::DEFAULT);
 
   // Generate @ 3,3
   intPtr = m_filteredBlockTmp[3][0] + (halfFilterSize - 1) * intStride;
   dstPtr = m_filteredBlock[3][3][0];
   m_if.filterVer(COMPONENT_Y, intPtr, intStride, dstPtr, dstStride, width, height, 3 << MV_FRACTIONAL_BITS_DIFF, false,
-                 true, clpRng);
+                 true, clpRng, InterpolationFilter::Filter::DEFAULT);
 }
 
 //! set wp tables
-- 
GitLab