From 7187b59857f84a5a94441f0873130cf0801e8ea6 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 24 Jan 2025 13:28:22 +0100 Subject: wip --- benchmark/j2k_transcode.cc | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'benchmark/j2k_transcode.cc') diff --git a/benchmark/j2k_transcode.cc b/benchmark/j2k_transcode.cc index 71602e0b..1e628079 100644 --- a/benchmark/j2k_transcode.cc +++ b/benchmark/j2k_transcode.cc @@ -37,6 +37,7 @@ #include "openjpeg_image.h" #include "util.h" #include "version.h" +#include #include #include #include @@ -86,8 +87,9 @@ main (int argc, char* argv[]) exit (EXIT_FAILURE); } - int const count = 100; + int const count = 128; int const j2k_bandwidth = 100000000; + int const threads = 16; dcp::ArrayData j2k (boost::filesystem::path (argv[1]) / "thx.j2c"); @@ -95,16 +97,20 @@ main (int argc, char* argv[]) Timer compress; dcp::ArrayData recomp; - for (int i = 0; i < count; ++i) { - decompress.start (); - shared_ptr xyz = dcp::decompress_j2k (j2k, 0); - decompress.stop (); - compress.start (); - recomp = dcp::compress_j2k (xyz, j2k_bandwidth, 24, false, false); - compress.stop (); - cout << (i + 1) << " "; - cout.flush (); + + auto body = [&]() { + for (int i = 0; i < (count / threads); ++i) { + auto xyz = dcp::decompress_j2k(j2k, 0); + } + }; + + boost::thread_group group; + decompress.start (); + for (int i = 0; i < threads; ++i) { + group.create_thread(body); } + group.join_all(); + decompress.stop (); cout << "\n"; cout << "Decompress: " << count / decompress.get() << " fps.\n"; -- cgit v1.2.3