@@ -52,6 +52,7 @@ POSSIBILITY OF SUCH DAMAGE.
5252#include < stdint.h>
5353#include < stdio.h>
5454#include < string.h>
55+ #include < string>
5556#include < time.h>
5657
5758#include " CommonLib/AffineGradientSearch.h"
@@ -1716,12 +1717,63 @@ static bool test_InterpolationFilter()
17161717}
17171718#endif // ENABLE_SIMD_OPT_MCIF
17181719
1720+ struct UnitTestEntry
1721+ {
1722+ std::string name;
1723+ bool ( *fn )();
1724+ };
1725+
1726+ static const UnitTestEntry test_suites[] = {
1727+ #if ENABLE_SIMD_OPT_INTRAPRED
1728+ { " IntraPred" , test_IntraPred },
1729+ #endif
1730+ #if ENABLE_SIMD_TRAFO
1731+ { " TCoeffOps" , test_TCoeffOps },
1732+ #endif
1733+ #if ENABLE_SIMD_OPT_MCTF
1734+ { " MCTF" , test_MCTF },
1735+ #endif
1736+ #if ENABLE_SIMD_OPT_BDOF
1737+ { " InterPred" , test_InterPred },
1738+ #endif
1739+ #if ENABLE_SIMD_OPT_DIST
1740+ { " RdCost" , test_RdCost },
1741+ #endif
1742+ #if ENABLE_SIMD_OPT_AFFINE_ME
1743+ { " AffineGradientSearch" , test_AffineGradientSearch },
1744+ #endif
1745+ #if ENABLE_SIMD_OPT_BUFFER
1746+ { " PelBufferOps" , test_PelBufferOps },
1747+ #endif
1748+ #if ENABLE_SIMD_OPT_MCIF
1749+ { " InterpolationFilter" , test_InterpolationFilter },
1750+ #endif
1751+ };
1752+
17191753struct UnitTestArgs
17201754{
17211755 bool show_help = false ;
17221756 int seed;
1757+ std::string filter;
17231758};
17241759
1760+ static inline std::string get_filter_help_text ()
1761+ {
1762+ std::ostringstream sstm;
1763+ sstm << " Run a single test suite. One of: " ;
1764+ bool first = true ;
1765+ for ( const auto & entry : test_suites )
1766+ {
1767+ if ( !first )
1768+ {
1769+ sstm << " , " ;
1770+ }
1771+ first = false ;
1772+ sstm << entry.name ;
1773+ }
1774+ return sstm.str ();
1775+ }
1776+
17251777UnitTestArgs parse_args ( int argc, char * argv[] )
17261778{
17271779 UnitTestArgs args;
@@ -1730,7 +1782,8 @@ UnitTestArgs parse_args( int argc, char* argv[] )
17301782 po::Options opts;
17311783 opts.addOptions ()
17321784 ( " help,h" , args.show_help , " Show help" , true )
1733- ( " seed" , args.seed , " Set random seed for running tests" );
1785+ ( " seed" , args.seed , " Set random seed for running tests" )
1786+ ( " filter" , args.filter , get_filter_help_text (), false );
17341787
17351788 po::SilentReporter err;
17361789 po::scanArgv ( opts, argc, ( const char ** )argv, err );
@@ -1755,30 +1808,14 @@ int main( int argc, char* argv[] )
17551808
17561809 bool passed = true ;
17571810
1758- #if ENABLE_SIMD_OPT_INTRAPRED
1759- passed = test_IntraPred () && passed;
1760- #endif
1761- #if ENABLE_SIMD_TRAFO
1762- passed = test_TCoeffOps () && passed;
1763- #endif
1764- #if ENABLE_SIMD_OPT_MCTF
1765- passed = test_MCTF () && passed;
1766- #endif
1767- #if ENABLE_SIMD_OPT_BDOF
1768- passed = test_InterPred () && passed;
1769- #endif
1770- #if ENABLE_SIMD_OPT_DIST
1771- passed = test_RdCost () && passed;
1772- #endif
1773- #if ENABLE_SIMD_OPT_AFFINE_ME
1774- passed = test_AffineGradientSearch () && passed;
1775- #endif
1776- #if ENABLE_SIMD_OPT_BUFFER
1777- passed = test_PelBufferOps () && passed;
1778- #endif
1779- #if ENABLE_SIMD_OPT_MCIF
1780- passed = test_InterpolationFilter () && passed;
1781- #endif
1811+ for ( const auto & entry : test_suites )
1812+ {
1813+ if ( args.filter == " " || args.filter == entry.name )
1814+ {
1815+ std::cout << " Running test suite: " << entry.name << " \n " ;
1816+ passed = entry.fn () && passed;
1817+ }
1818+ }
17821819
17831820 if ( !passed )
17841821 {
0 commit comments