Skip to content

Commit 14db0e7

Browse files
authored
Merge pull request #594 from micro-arm/filterXxY-unittest-loop-height
Rename filterXxY to filterWxH and make height a loop parameter in their unit tests
2 parents 5ad5094 + 470a6f3 commit 14db0e7

File tree

6 files changed

+119
-113
lines changed

6 files changed

+119
-113
lines changed

source/Lib/CommonLib/InterPrediction.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -849,11 +849,11 @@ void InterPredInterpolation::xPredInterBlk( const ComponentID compID, const Codi
849849
}
850850
else if( backupWidth == 16 )
851851
{
852-
m_if.filter16x16( compID, refBufPtr, refBufStride, dstBuf.buf, dstBuf.stride, 16, backupHeight, xFrac, yFrac, rndRes, chFmt, clpRng, useAltHpelIf );
852+
m_if.filter16xH( compID, refBufPtr, refBufStride, dstBuf.buf, dstBuf.stride, 16, backupHeight, xFrac, yFrac, rndRes, chFmt, clpRng, useAltHpelIf );
853853
}
854854
else if( backupWidth == 8 )
855855
{
856-
m_if.filter8x8( compID, refBufPtr, refBufStride, dstBuf.buf, dstBuf.stride, 8, backupHeight, xFrac, yFrac, rndRes, chFmt, clpRng, useAltHpelIf );
856+
m_if.filter8xH( compID, refBufPtr, refBufStride, dstBuf.buf, dstBuf.stride, 8, backupHeight, xFrac, yFrac, rndRes, chFmt, clpRng, useAltHpelIf );
857857
}
858858
else
859859
{

source/Lib/CommonLib/InterpolationFilter.cpp

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -213,20 +213,20 @@ InterpolationFilter::InterpolationFilter()
213213
m_filterCopy[1][0] = filterCopy<true, false>;
214214
m_filterCopy[1][1] = filterCopy<true, true>;
215215

216-
m_filter4x4[0][0] = filterXxY_N8<false, 4>;
217-
m_filter4x4[0][1] = filterXxY_N8<true , 4>;
218-
m_filter4x4[1][0] = filterXxY_N4<false, 4>;
219-
m_filter4x4[1][1] = filterXxY_N4<true , 4>;
216+
m_filter4x4[0][0] = filterWxH_N8<false, 4>;
217+
m_filter4x4[0][1] = filterWxH_N8<true , 4>;
218+
m_filter4x4[1][0] = filterWxH_N4<false, 4>;
219+
m_filter4x4[1][1] = filterWxH_N4<true , 4>;
220220

221-
m_filter8x8[0][0] = filterXxY_N8<false, 8>;
222-
m_filter8x8[0][1] = filterXxY_N8<true , 8>;
223-
m_filter8x8[1][0] = filterXxY_N4<false, 8>;
224-
m_filter8x8[1][1] = filterXxY_N4<true , 8>;
221+
m_filter8xH[0][0] = filterWxH_N8<false, 8>;
222+
m_filter8xH[0][1] = filterWxH_N8<true , 8>;
223+
m_filter8xH[1][0] = filterWxH_N4<false, 8>;
224+
m_filter8xH[1][1] = filterWxH_N4<true , 8>;
225225

226-
m_filter16x16[0][0] = filterXxY_N8<false, 16>;
227-
m_filter16x16[0][1] = filterXxY_N8<true , 16>;
228-
m_filter16x16[1][0] = filterXxY_N4<false, 16>;
229-
m_filter16x16[1][1] = filterXxY_N4<true , 16>;
226+
m_filter16xH[0][0] = filterWxH_N8<false, 16>;
227+
m_filter16xH[0][1] = filterWxH_N8<true , 16>;
228+
m_filter16xH[1][0] = filterWxH_N4<false, 16>;
229+
m_filter16xH[1][1] = filterWxH_N4<true , 16>;
230230

231231
m_filterN2_2D = scalarFilterN2_2D;
232232

@@ -705,7 +705,7 @@ void InterpolationFilter::filter4x4( const ComponentID compID, const Pel* src, i
705705
THROW( "4x4 interpolation filter does not support bilinear filtering!" );
706706
}
707707
}
708-
void InterpolationFilter::filter8x8( const ComponentID compID, const Pel* src, int srcStride, Pel* dst, int dstStride, int width, int height, int fracX, int fracY, bool isLast, const ChromaFormat fmt, const ClpRng& clpRng,bool useAltHpelIf,int nFilterIdx /*= 0*/ )
708+
void InterpolationFilter::filter8xH( const ComponentID compID, const Pel* src, int srcStride, Pel* dst, int dstStride, int width, int height, int fracX, int fracY, bool isLast, const ChromaFormat fmt, const ClpRng& clpRng,bool useAltHpelIf,int nFilterIdx /*= 0*/ )
709709
{
710710
const int vFilterSize = nFilterIdx == 1 ? 2 : ( isLuma( compID ) ? NTAPS_LUMA : NTAPS_CHROMA );
711711

@@ -716,7 +716,7 @@ void InterpolationFilter::filter8x8( const ComponentID compID, const Pel* src, i
716716
const TFilterCoeff* vCoeff = (useAltHpelIf && fracY==8) ? m_lumaAltHpelIFilter : m_lumaFilter[fracY];
717717
const TFilterCoeff* hCoeff = (useAltHpelIf && fracX==8) ? m_lumaAltHpelIFilter : m_lumaFilter[fracX];
718718

719-
m_filter8x8[0][isLast]( clpRng,src,srcStride, dst,dstStride, width, height, hCoeff, vCoeff);
719+
m_filter8xH[0][isLast]( clpRng,src,srcStride, dst,dstStride, width, height, hCoeff, vCoeff);
720720
}
721721
else if( vFilterSize == 4 )
722722
{
@@ -725,15 +725,15 @@ void InterpolationFilter::filter8x8( const ComponentID compID, const Pel* src, i
725725
const int csx = getComponentScaleX( compID, fmt );
726726
const int csy = getComponentScaleY( compID, fmt );
727727

728-
m_filter8x8[1][isLast]( clpRng, src,srcStride, dst,dstStride, width, height, m_chromaFilter[fracX << ( 1 - csx )], m_chromaFilter[fracY << ( 1 - csy )] );
728+
m_filter8xH[1][isLast]( clpRng, src,srcStride, dst,dstStride, width, height, m_chromaFilter[fracX << ( 1 - csx )], m_chromaFilter[fracY << ( 1 - csy )] );
729729
}
730730
else
731731
{
732732
THROW( "8x8 interpolation filter does not support bilinear filtering!" );
733733
}
734734
}
735735

736-
void InterpolationFilter::filter16x16( const ComponentID compID, const Pel* src, int srcStride, Pel* dst, int dstStride, int width, int height, int fracX, int fracY, bool isLast, const ChromaFormat fmt, const ClpRng& clpRng,bool useAltHpelIf, int nFilterIdx /*= 0*/ )
736+
void InterpolationFilter::filter16xH( const ComponentID compID, const Pel* src, int srcStride, Pel* dst, int dstStride, int width, int height, int fracX, int fracY, bool isLast, const ChromaFormat fmt, const ClpRng& clpRng,bool useAltHpelIf, int nFilterIdx /*= 0*/ )
737737
{
738738
const int vFilterSize = nFilterIdx == 1 ? 2 : ( isLuma( compID ) ? NTAPS_LUMA : NTAPS_CHROMA );
739739

@@ -744,7 +744,7 @@ void InterpolationFilter::filter16x16( const ComponentID compID, const Pel* src,
744744
const TFilterCoeff* vCoeff = (useAltHpelIf && fracY==8) ? m_lumaAltHpelIFilter : m_lumaFilter[fracY];
745745
const TFilterCoeff* hCoeff = (useAltHpelIf && fracX==8) ? m_lumaAltHpelIFilter : m_lumaFilter[fracX];
746746

747-
m_filter16x16[0][isLast]( clpRng, src, srcStride, dst,dstStride, width, height, hCoeff, vCoeff );
747+
m_filter16xH[0][isLast]( clpRng, src, srcStride, dst,dstStride, width, height, hCoeff, vCoeff );
748748
}
749749
else if( vFilterSize == 4 )
750750
{
@@ -753,7 +753,7 @@ void InterpolationFilter::filter16x16( const ComponentID compID, const Pel* src,
753753
const int csx = getComponentScaleX( compID, fmt );
754754
const int csy = getComponentScaleY( compID, fmt );
755755

756-
m_filter16x16[1][isLast]( clpRng, src,srcStride, dst,dstStride, width, height, m_chromaFilter[fracX << ( 1 - csx )], m_chromaFilter[fracY << ( 1 - csy )] );
756+
m_filter16xH[1][isLast]( clpRng, src,srcStride, dst,dstStride, width, height, m_chromaFilter[fracX << ( 1 - csx )], m_chromaFilter[fracY << ( 1 - csy )] );
757757
}
758758
else
759759
{
@@ -762,7 +762,7 @@ void InterpolationFilter::filter16x16( const ComponentID compID, const Pel* src,
762762
}
763763

764764
template<bool isLast, int w>
765-
void InterpolationFilter::filterXxY_N2( const ClpRng& clpRng, Pel const *src, int srcStride, Pel* _dst, int dstStride, int width, int h, TFilterCoeff const *coeffH, TFilterCoeff const *coeffV )
765+
void InterpolationFilter::filterWxH_N2( const ClpRng& clpRng, Pel const *src, int srcStride, Pel* _dst, int dstStride, int width, int h, TFilterCoeff const *coeffH, TFilterCoeff const *coeffV )
766766
{
767767
int row, col;
768768

@@ -829,7 +829,7 @@ void InterpolationFilter::filterXxY_N2( const ClpRng& clpRng, Pel const *src, in
829829
}
830830

831831
template<bool isLast, int w>
832-
void InterpolationFilter::filterXxY_N4( const ClpRng& clpRng, const Pel* src, int srcStride, Pel* _dst, int dstStride, int width, int height, const TFilterCoeff *coeffH, const TFilterCoeff *coeffV )
832+
void InterpolationFilter::filterWxH_N4( const ClpRng& clpRng, const Pel* src, int srcStride, Pel* _dst, int dstStride, int width, int height, const TFilterCoeff *coeffH, const TFilterCoeff *coeffV )
833833
{
834834
int row, col;
835835

@@ -905,7 +905,7 @@ void InterpolationFilter::filterXxY_N4( const ClpRng& clpRng, const Pel* src, in
905905

906906

907907
template<bool isLast, int w>
908-
void InterpolationFilter::filterXxY_N8( const ClpRng& clpRng, const Pel* src, int srcStride, Pel* _dst, int dstStride, int width, int h, const TFilterCoeff *coeffH, const TFilterCoeff *coeffV )
908+
void InterpolationFilter::filterWxH_N8( const ClpRng& clpRng, const Pel* src, int srcStride, Pel* _dst, int dstStride, int width, int h, const TFilterCoeff *coeffH, const TFilterCoeff *coeffV )
909909
{
910910
int row, col;
911911

source/Lib/CommonLib/InterpolationFilter.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,11 @@ class InterpolationFilter
8989
void filterVer (const ClpRng& clpRng, Pel const* src, int srcStride, Pel* dst, int dstStride, int width, int height, bool isFirst, bool isLast, TFilterCoeff const *coeff);
9090

9191
template<bool isLast, int w>
92-
static void filterXxY_N2 (const ClpRng& clpRng, Pel const *src, int srcStride, Pel* dst, int dstStride, int width, int height, TFilterCoeff const *coeffH, TFilterCoeff const *coeffV);
92+
static void filterWxH_N2 (const ClpRng& clpRng, Pel const *src, int srcStride, Pel* dst, int dstStride, int width, int height, TFilterCoeff const *coeffH, TFilterCoeff const *coeffV);
9393
template<bool isLast, int w>
94-
static void filterXxY_N4 (const ClpRng& clpRng, Pel const *src, int srcStride, Pel* dst, int dstStride, int width, int height, TFilterCoeff const *coeffH, TFilterCoeff const *coeffV);
94+
static void filterWxH_N4 (const ClpRng& clpRng, Pel const *src, int srcStride, Pel* dst, int dstStride, int width, int height, TFilterCoeff const *coeffH, TFilterCoeff const *coeffV);
9595
template<bool isLast, int w>
96-
static void filterXxY_N8 (const ClpRng& clpRng, Pel const *src, int srcStride, Pel* dst, int dstStride, int width, int height, TFilterCoeff const *coeffH, TFilterCoeff const *coeffV);
96+
static void filterWxH_N8 (const ClpRng& clpRng, Pel const *src, int srcStride, Pel* dst, int dstStride, int width, int height, TFilterCoeff const *coeffH, TFilterCoeff const *coeffV);
9797

9898
static void scalarFilterN2_2D(const ClpRng& clpRng, Pel const *src, int srcStride, Pel* dst, int dstStride, int width, int height, TFilterCoeff const *ch, TFilterCoeff const *cv);
9999

@@ -109,10 +109,10 @@ class InterpolationFilter
109109
void( *m_filterN2_2D )( const ClpRng& clpRng, Pel const *src, int srcStride, Pel* dst, int dstStride, int width, int height, TFilterCoeff const *ch, TFilterCoeff const *cv );
110110
void( *m_filterHor[4][2][2] )( const ClpRng& clpRng, Pel const *src, int srcStride, Pel* dst, int dstStride, int width, int height, TFilterCoeff const *coeff);
111111
void( *m_filterVer[4][2][2] )( const ClpRng& clpRng, Pel const *src, int srcStride, Pel* dst, int dstStride, int width, int height, TFilterCoeff const *coeff);
112-
void( *m_filterCopy[2][2] ) ( const ClpRng& clpRng, Pel const *src, int srcStride, Pel* dst, int dstStride, int width, int height, bool biMCForDMVR);
113-
void( *m_filter4x4 [2][2] ) ( const ClpRng& clpRng, Pel const *src, int srcStride, Pel* dst, int dstStride, int width, int height, TFilterCoeff const *coeffH, TFilterCoeff const *coeffV );
114-
void( *m_filter8x8 [3][2] ) ( const ClpRng& clpRng, Pel const *src, int srcStride, Pel* dst, int dstStride, int width, int height, TFilterCoeff const *coeffH, TFilterCoeff const *coeffV );
115-
void( *m_filter16x16[3][2] ) ( const ClpRng& clpRng, Pel const *src, int srcStride, Pel* dst, int dstStride, int width, int height, TFilterCoeff const *coeffH, TFilterCoeff const *coeffV );
112+
void( *m_filterCopy[2][2] )( const ClpRng& clpRng, Pel const *src, int srcStride, Pel* dst, int dstStride, int width, int height, bool biMCForDMVR);
113+
void( *m_filter4x4 [2][2] )( const ClpRng& clpRng, Pel const *src, int srcStride, Pel* dst, int dstStride, int width, int height, TFilterCoeff const *coeffH, TFilterCoeff const *coeffV );
114+
void( *m_filter8xH [3][2] )( const ClpRng& clpRng, Pel const *src, int srcStride, Pel* dst, int dstStride, int width, int height, TFilterCoeff const *coeffH, TFilterCoeff const *coeffV );
115+
void( *m_filter16xH[3][2] )( const ClpRng& clpRng, Pel const *src, int srcStride, Pel* dst, int dstStride, int width, int height, TFilterCoeff const *coeffH, TFilterCoeff const *coeffV );
116116
void (*m_weightedGeoBlk)(const ClpRngs &clpRngs, const CodingUnit& cu, const uint32_t width, const uint32_t height,
117117
const ComponentID compIdx, const uint8_t splitDir, PelUnitBuf &predDst, PelUnitBuf &predSrc0,
118118
PelUnitBuf &predSrc1);
@@ -132,8 +132,8 @@ class InterpolationFilter
132132

133133
void filterN2_2D(const ComponentID compID, Pel const *src, int srcStride, Pel* dst, int dstStride, int width, int height, int fracX, int fracY, const ClpRng& clpRng);
134134
void filter4x4 (const ComponentID compID, Pel const *src, int srcStride, Pel* dst, int dstStride, int width, int height, int fracX, int fracY, bool isLast, const ChromaFormat fmt, const ClpRng& clpRng, bool useAltHpelIf = false, int nFilterIdx = 0);
135-
void filter8x8 (const ComponentID compID, Pel const *src, int srcStride, Pel* dst, int dstStride, int width, int height, int fracX, int fracY, bool isLast, const ChromaFormat fmt, const ClpRng& clpRng, bool useAltHpelIf = false, int nFilterIdx = 0);
136-
void filter16x16(const ComponentID compID, Pel const *src, int srcStride, Pel* dst, int dstStride, int width, int height, int fracX, int fracY, bool isLast, const ChromaFormat fmt, const ClpRng& clpRng, bool useAltHpelIf = false, int nFilterIdx = 0);
135+
void filter8xH (const ComponentID compID, Pel const *src, int srcStride, Pel* dst, int dstStride, int width, int height, int fracX, int fracY, bool isLast, const ChromaFormat fmt, const ClpRng& clpRng, bool useAltHpelIf = false, int nFilterIdx = 0);
136+
void filter16xH (const ComponentID compID, Pel const *src, int srcStride, Pel* dst, int dstStride, int width, int height, int fracX, int fracY, bool isLast, const ChromaFormat fmt, const ClpRng& clpRng, bool useAltHpelIf = false, int nFilterIdx = 0);
137137
void filterHor (const ComponentID compID, Pel const* src, int srcStride, Pel* dst, int dstStride, int width, int height, int frac, bool isLast, const ChromaFormat fmt, const ClpRng& clpRng, bool useAltHpelIf = false, int nFilterIdx = 0, int reduceTap = 0);
138138
void filterVer (const ComponentID compID, Pel const* src, int srcStride, Pel* dst, int dstStride, int width, int height, int frac, bool isFirst, bool isLast, const ChromaFormat fmt, const ClpRng& clpRng, bool useAltHpelIf = false, int nFilterIdx = 0, int reduceTap = 0);
139139

0 commit comments

Comments
 (0)