diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-12-02 12:49:00 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-12-02 12:49:00 +0000 |
| commit | 555ced5ed96828bd332623665c0565cd8b3a0df6 (patch) | |
| tree | dd1cc225304c3d20a69e134a897a19eca1dcf290 | |
| parent | 6e9b1b0ca5e839bda7b567b609cebb92a1cb95a7 (diff) | |
Use OpenMP when comparing picture assets.
| -rw-r--r-- | examples/wscript | 8 | ||||
| -rw-r--r-- | src/mono_picture_asset.cc | 26 | ||||
| -rw-r--r-- | test/wscript | 8 | ||||
| -rw-r--r-- | tools/dcpdiff.cc | 7 | ||||
| -rw-r--r-- | tools/wscript | 13 | ||||
| -rw-r--r-- | wscript | 5 |
6 files changed, 38 insertions, 29 deletions
diff --git a/examples/wscript b/examples/wscript index abb0885c..01dc9c8e 100644 --- a/examples/wscript +++ b/examples/wscript @@ -1,16 +1,16 @@ def build(bld): - obj = bld(features = 'cxx cxxprogram') + obj = bld(features='cxx cxxprogram') obj.name = 'make_dcp' obj.use = 'libdcp%s' % bld.env.API_VERSION - obj.uselib = 'OPENJPEG CXML' + obj.uselib = 'OPENJPEG CXML OPENMP' obj.source = 'make_dcp.cc' obj.target = 'make_dcp' obj.install_path = '' - obj = bld(features = 'cxx cxxprogram') + obj = bld(features='cxx cxxprogram') obj.name = 'read_dcp' obj.use = 'libdcp%s' % bld.env.API_VERSION - obj.uselib = 'OPENJPEG CXML MAGICK' + obj.uselib = 'OPENJPEG CXML MAGICK OPENMP' obj.source = 'read_dcp.cc' obj.target = 'read_dcp' obj.install_path = '' diff --git a/src/mono_picture_asset.cc b/src/mono_picture_asset.cc index f14e50c2..5ab12117 100644 --- a/src/mono_picture_asset.cc +++ b/src/mono_picture_asset.cc @@ -105,23 +105,23 @@ MonoPictureAsset::equals (shared_ptr<const Asset> other, EqualityOptions opt, No bool result = true; +#pragma omp parallel for for (int i = 0; i < _intrinsic_duration; ++i) { if (i >= other_picture->intrinsic_duration()) { - return false; + result = false; } - note (DCP_PROGRESS, String::compose ("Comparing video frame %1 of %2", i, _intrinsic_duration)); - shared_ptr<const MonoPictureFrame> frame_A = get_frame (i); - shared_ptr<const MonoPictureFrame> frame_B = other_picture->get_frame (i); - - if (!frame_buffer_equals ( - i, opt, note, - frame_A->j2k_data(), frame_A->j2k_size(), - frame_B->j2k_data(), frame_B->j2k_size() - )) { - result = false; - if (!opt.keep_going) { - return result; + if (result || opt.keep_going) { + note (DCP_PROGRESS, String::compose ("Comparing video frame %1 of %2", i, _intrinsic_duration)); + shared_ptr<const MonoPictureFrame> frame_A = get_frame (i); + shared_ptr<const MonoPictureFrame> frame_B = other_picture->get_frame (i); + + if (!frame_buffer_equals ( + i, opt, note, + frame_A->j2k_data(), frame_A->j2k_size(), + frame_B->j2k_data(), frame_B->j2k_size() + )) { + result = false; } } } diff --git a/test/wscript b/test/wscript index 84c21a93..7e6e48ed 100644 --- a/test/wscript +++ b/test/wscript @@ -18,7 +18,7 @@ def configure(conf): def build(bld): obj = bld(features='cxx cxxprogram') obj.name = 'tests' - obj.uselib = 'BOOST_TEST BOOST_FILESYSTEM OPENJPEG CXML XMLSEC1 SNDFILE' + obj.uselib = 'BOOST_TEST BOOST_FILESYSTEM OPENJPEG CXML XMLSEC1 SNDFILE OPENMP' obj.cppflags = ['-fno-inline', '-fno-default-inline', '-fno-elide-constructors', '-g', '-O0'] if bld.is_defined('HAVE_GCOV'): obj.use = 'libdcp%s_gcov' % bld.env.API_VERSION @@ -63,7 +63,7 @@ def build(bld): obj = bld(features='cxx cxxprogram') obj.name = 'subs_in_out' - obj.uselib = 'BOOST_TEST BOOST_FILESYSTEM OPENJPEG CXML' + obj.uselib = 'BOOST_TEST BOOST_FILESYSTEM OPENJPEG CXML OPENMP' obj.cppflags = ['-fno-inline', '-fno-default-inline', '-fno-elide-constructors', '-g', '-O0'] if bld.is_defined('HAVE_GCOV'): obj.use = 'libdcp%s_gcov' % bld.env.API_VERSION @@ -78,7 +78,7 @@ def build(bld): obj = bld(features='cxx cxxprogram') obj.name = 'rewrite_subs' - obj.uselib = 'BOOST_TEST BOOST_FILESYSTEM OPENJPEG CXML' + obj.uselib = 'BOOST_TEST BOOST_FILESYSTEM OPENJPEG CXML OPENMP' obj.cppflags = ['-fno-inline', '-fno-default-inline', '-fno-elide-constructors', '-g', '-O0'] if bld.is_defined('HAVE_GCOV'): obj.use = 'libdcp%s_gcov' % bld.env.API_VERSION @@ -93,7 +93,7 @@ def build(bld): obj = bld(features='cxx cxxprogram') obj.name = 'bench' - obj.uselib = 'BOOST_FILESYSTEM OPENJPEG CXML' + obj.uselib = 'BOOST_FILESYSTEM OPENJPEG CXML OPENMP' obj.use = 'libdcp%s' % bld.env.API_VERSION obj.source = 'bench.cc' obj.target = 'bench' diff --git a/tools/dcpdiff.cc b/tools/dcpdiff.cc index 473efa45..1085e289 100644 --- a/tools/dcpdiff.cc +++ b/tools/dcpdiff.cc @@ -48,6 +48,7 @@ help (string n) << " -v, --verbose be verbose\n" << " --cpl-annotation-texts allow differing CPL annotation texts\n" << " --reel-annotation-texts allow differing reel annotation texts\n" + << " -a, --annotation-texts allow different CPL and reel annotation texts\n" << " -m, --mean-pixel maximum allowed mean pixel error (default 5)\n" << " -s, --std-dev-pixel maximum allowed standard deviation of pixel error (default 5)\n" << " --key hexadecimal key to use to decrypt MXFs\n" @@ -119,6 +120,7 @@ main (int argc, char* argv[]) { "mean-pixel", required_argument, 0, 'm'}, { "std-dev-pixel", required_argument, 0, 's'}, { "keep-going", no_argument, 0, 'k'}, + { "annotation-texts", no_argument, 0, 'a'}, /* From here we're using random capital letters for the short option */ { "ignore-missing-assets", no_argument, 0, 'A'}, { "cpl-annotation-texts", no_argument, 0, 'C'}, @@ -127,7 +129,7 @@ main (int argc, char* argv[]) { 0, 0, 0, 0 } }; - int c = getopt_long (argc, argv, "Vhvm:s:kACD:E", long_options, &option_index); + int c = getopt_long (argc, argv, "Vhvm:s:kaACD:E", long_options, &option_index); if (c == -1) { break; @@ -152,6 +154,9 @@ main (int argc, char* argv[]) case 'k': options.keep_going = true; break; + case 'a': + options.cpl_annotation_texts_can_differ = options.reel_annotation_texts_can_differ = true; + break; case 'A': ignore_missing_assets = true; break; diff --git a/tools/wscript b/tools/wscript index 26474fc8..965d1c30 100644 --- a/tools/wscript +++ b/tools/wscript @@ -1,19 +1,18 @@ def build(bld): - obj = bld(features = 'cxx cxxprogram') + obj = bld(features='cxx cxxprogram') obj.use = ['libdcp%s' % bld.env.API_VERSION] - obj.uselib = 'OPENJPEG CXML' + obj.uselib = 'OPENJPEG CXML OPENMP' obj.source = 'dcpdiff.cc common.cc' obj.target = 'dcpdiff' - obj = bld(features = 'cxx cxxprogram') + obj = bld(features='cxx cxxprogram') obj.use = ['libdcp%s' % bld.env.API_VERSION] - obj.uselib = 'OPENJPEG CXML' + obj.uselib = 'OPENJPEG CXML OPENMP' obj.source = 'dcpinfo.cc common.cc' obj.target = 'dcpinfo' - obj = bld(features = 'cxx cxxprogram') + obj = bld(features='cxx cxxprogram') obj.use = ['libdcp%s' % bld.env.API_VERSION] - obj.uselib = 'OPENJPEG CXML' + obj.uselib = 'OPENJPEG CXML OPENMP' obj.source = 'dcpdumpsub.cc' obj.target = 'dcpdumpsub' - @@ -16,6 +16,7 @@ def options(opt): opt.add_option('--disable-tests', action='store_true', default=False, help='disable building of tests') opt.add_option('--disable-gcov', action='store_true', default=False, help='don''t use gcov in tests') opt.add_option('--disable-examples', action='store_true', default=False, help='disable building of examples') + opt.add_option('--enable-openmp', action='store_true', default=False, help='enable use of OpenMP') def configure(conf): conf.load('compiler_cxx') @@ -38,6 +39,10 @@ def configure(conf): if not conf.env.TARGET_OSX: conf.env.append_value('CXXFLAGS', ['-Wno-unused-result', '-Wno-unused-parameter']) + if conf.options.enable_openmp: + conf.env.append_value('CXXFLAGS', '-fopenmp') + conf.env.LIB_OPENMP = ['gomp'] + conf.check_cfg(package='openssl', args='--cflags --libs', uselib_store='OPENSSL', mandatory=True) conf.check_cfg(package='libxml++-2.6', args='--cflags --libs', uselib_store='LIBXML++', mandatory=True) conf.check_cfg(package='xmlsec1', args='--cflags --libs', uselib_store='XMLSEC1', mandatory=True) |
