diff options
| author | Carl Hetherington <cth@carlh.net> | 2025-01-24 13:28:22 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-01-24 13:28:22 +0100 |
| commit | 7187b59857f84a5a94441f0873130cf0801e8ea6 (patch) | |
| tree | 8ba431dbf60d2b6458de051d19be084242f1e675 /benchmark/j2k_transcode.cc | |
| parent | 744eae9a14f834088289d10d7158ad89857565ad (diff) | |
wipcancel
Diffstat (limited to 'benchmark/j2k_transcode.cc')
| -rw-r--r-- | benchmark/j2k_transcode.cc | 26 |
1 files changed, 16 insertions, 10 deletions
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 <boost/thread/thread.hpp> #include <sys/time.h> #include <iostream> #include <cstdio> @@ -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<dcp::OpenJPEGImage> 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"; |
