diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-12-03 09:46:16 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-12-03 09:56:10 +0000 |
| commit | 51d024b730b0452553a0da2f533ade4807ca6c20 (patch) | |
| tree | 2d79f28f86daf276f1c04d12f1e09dcc40bd0661 | |
| parent | f00102197027aa0ea2fe357fa2c6acd45f08b949 (diff) | |
Tidy up notes when using OpenMP.
| -rw-r--r-- | src/mono_picture_asset.cc | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/mono_picture_asset.cc b/src/mono_picture_asset.cc index 5ab12117..b367a19d 100644 --- a/src/mono_picture_asset.cc +++ b/src/mono_picture_asset.cc @@ -28,6 +28,8 @@ using std::string; using std::vector; +using std::list; +using std::pair; using boost::shared_ptr; using boost::dynamic_pointer_cast; using namespace dcp; @@ -68,6 +70,12 @@ MonoPictureAsset::get_frame (int n) const return shared_ptr<const MonoPictureFrame> (new MonoPictureFrame (_file, n, _decryption_context)); } +static void +storing_note_handler (list<pair<NoteType, string> >& notes, NoteType t, string s) +{ + notes.push_back (make_pair (t, s)); +} + bool MonoPictureAsset::equals (shared_ptr<const Asset> other, EqualityOptions opt, NoteHandler note) const { @@ -112,17 +120,27 @@ MonoPictureAsset::equals (shared_ptr<const Asset> other, EqualityOptions opt, No } 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); + list<pair<NoteType, string> > notes; + if (!frame_buffer_equals ( - i, opt, note, + i, opt, bind (&storing_note_handler, boost::ref(notes), _1, _2), frame_A->j2k_data(), frame_A->j2k_size(), frame_B->j2k_data(), frame_B->j2k_size() )) { result = false; } + +#pragma omp critical + { + note (DCP_PROGRESS, String::compose ("Compared video frame %1 of %2", i, _intrinsic_duration)); + for (list<pair<NoteType, string> >::const_iterator i = notes.begin(); i != notes.end(); ++i) { + note (i->first, i->second); + } + } } } |
