From 01e4d1b43223a1755b2513e6d271cc3e0ccc839a Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Thu, 26 Sep 2024 14:16:01 +0200 Subject: [PATCH] tools/convert benchmark: convert per-line The measured performance should more representative because it approximates more closely how it is done in UltraGrid. --- tools/convert.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/convert.cpp b/tools/convert.cpp index 2db4b6cf2e..a0fbb3cb04 100644 --- a/tools/convert.cpp +++ b/tools/convert.cpp @@ -37,7 +37,14 @@ static void benchmark() { continue; } auto t0 = high_resolution_clock::now(); - conv(out.data(), in.data(), vc_get_linesize(width, outc) * height, DEFAULT_R_SHIFT, DEFAULT_G_SHIFT, DEFAULT_B_SHIFT); + const size_t src_linesize = vc_get_linesize(width, inc); + const size_t dst_linesize = vc_get_linesize(width, outc); + for (int i = 0; i < height; ++i) { + conv(out.data() + i * src_linesize, + in.data() + i * dst_linesize, + (int) dst_linesize, DEFAULT_R_SHIFT, + DEFAULT_G_SHIFT, DEFAULT_B_SHIFT); + } auto t1 = high_resolution_clock::now(); cout << get_codec_name(inc) << "->" << get_codec_name(outc) << ": " << duration_cast(t1 - t0).count() / 1000.0 << " ms\n"; }