From c326de43c1a1453069fbb7e2ebf3d7def6a802d1 Mon Sep 17 00:00:00 2001 From: Andrey Kamaev Date: Mon, 16 Jan 2012 07:04:26 +0000 Subject: [PATCH] More natural sorting of MatType constants in performance reports. --- modules/core/perf/perf_stat.cpp | 2 +- modules/core/src/stat.cpp | 8 ++++---- modules/ts/misc/summary.py | 9 +++++++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/modules/core/perf/perf_stat.cpp b/modules/core/perf/perf_stat.cpp index 5a693f941f..418cb24d30 100644 --- a/modules/core/perf/perf_stat.cpp +++ b/modules/core/perf/perf_stat.cpp @@ -87,7 +87,7 @@ PERF_TEST_P(Size_MatType, meanStdDev_mask, TYPICAL_MATS) SANITY_CHECK(dev, 1e-6); } -PERF_TEST_P(Size_MatType, countNonZero, TYPICAL_MATS_C1) +PERF_TEST_P(Size_MatType, countNonZero, testing::Combine( testing::Values( TYPICAL_MAT_SIZES ), testing::Values( CV_8UC1, CV_8SC1, CV_16UC1, CV_16SC1, CV_32SC1, CV_32FC1, CV_64FC1 ) )) { Size sz = get<0>(GetParam()); int matType = get<1>(GetParam()); diff --git a/modules/core/src/stat.cpp b/modules/core/src/stat.cpp index b1f02a9645..48f8e5aba9 100644 --- a/modules/core/src/stat.cpp +++ b/modules/core/src/stat.cpp @@ -232,10 +232,10 @@ typedef int (*CountNonZeroFunc)(const uchar*, int); static CountNonZeroFunc countNonZeroTab[] = { - (CountNonZeroFunc)GET_OPTIMIZED(countNonZero8u), (CountNonZeroFunc)(countNonZero8u), - (CountNonZeroFunc)(countNonZero16u), (CountNonZeroFunc)(countNonZero16u), - (CountNonZeroFunc)(countNonZero32s), (CountNonZeroFunc)GET_OPTIMIZED(countNonZero32f), - (CountNonZeroFunc)countNonZero64f, 0 + (CountNonZeroFunc)GET_OPTIMIZED(countNonZero8u), (CountNonZeroFunc)GET_OPTIMIZED(countNonZero8u), + (CountNonZeroFunc)GET_OPTIMIZED(countNonZero16u), (CountNonZeroFunc)GET_OPTIMIZED(countNonZero16u), + (CountNonZeroFunc)GET_OPTIMIZED(countNonZero32s), (CountNonZeroFunc)GET_OPTIMIZED(countNonZero32f), + (CountNonZeroFunc)GET_OPTIMIZED(countNonZero64f), 0 }; diff --git a/modules/ts/misc/summary.py b/modules/ts/misc/summary.py index 661bf2ee89..3d83c92810 100644 --- a/modules/ts/misc/summary.py +++ b/modules/ts/misc/summary.py @@ -2,8 +2,13 @@ import testlog_parser, sys, os, xml, glob, re from table_formatter import * from optparse import OptionParser -convert = lambda text: int(text) if text.isdigit() else text -alphanum_keyselector = lambda key: [ convert(c) for c in re.split('([0-9]+)', key) ] +numeric_re = re.compile("(\d+)") +cvtype_re = re.compile("(8U|8S|16U|16S|32S|32F|64F)C(\d{1,3})") +cvtypes = { '8U': 0, '8S': 1, '16U': 2, '16S': 3, '32S': 4, '32F': 5, '64F': 6 } + +convert = lambda text: int(text) if text.isdigit() else text +keyselector = lambda a: cvtype_re.sub(lambda match: " " + str(cvtypes.get(match.group(1), 7) + (int(match.group(2))-1) * 8) + " ", a) +alphanum_keyselector = lambda key: [ convert(c) for c in numeric_re.split(keyselector(key)) ] def getSetName(tset, idx, columns, short = True): if columns and len(columns) > idx: