From 6322c72a13d7be2e991a8e0421414c0af8187b88 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 15 Apr 2013 13:38:14 +0100 Subject: Use boost::function for making notes during equals operations. --- tools/dcpdiff.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'tools/dcpdiff.cc') diff --git a/tools/dcpdiff.cc b/tools/dcpdiff.cc index 025308e6..6d55586d 100644 --- a/tools/dcpdiff.cc +++ b/tools/dcpdiff.cc @@ -20,6 +20,12 @@ help (string n) << "and differing UUIDs.\n"; } +void +note (string n) +{ + cout << " " << n << "\n"; +} + int main (int argc, char* argv[]) { @@ -87,12 +93,7 @@ main (int argc, char* argv[]) /* I think this is just below the LSB at 16-bits (ie the 8th most significant bit at 24-bit) */ options.max_audio_sample_error = 255; - list notes; - bool equals = a->equals (*b, options, notes); - - for (list::iterator i = notes.begin(); i != notes.end(); ++i) { - cout << " " << *i << "\n"; - } + bool const equals = a->equals (*b, options, boost::bind (note, _1)); if (equals) { exit (EXIT_SUCCESS); -- cgit v1.2.3 From 034abb6bb0f1d0382620bdcc43501ce0ba30b03a Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 15 Apr 2013 13:48:22 +0100 Subject: Try to give basic progress indication on dcpdiff. --- src/asset.h | 2 +- src/dcp.cc | 16 ++++++++-------- src/dcp.h | 4 ++-- src/mxf_asset.cc | 12 ++++++------ src/mxf_asset.h | 2 +- src/picture_asset.cc | 17 +++++++++-------- src/picture_asset.h | 8 ++++---- src/reel.cc | 8 ++++---- src/reel.h | 2 +- src/sound_asset.cc | 8 ++++---- src/sound_asset.h | 2 +- src/subtitle_asset.h | 4 ++-- src/types.h | 5 +++++ tools/dcpdiff.cc | 23 ++++++++++++++++------- 14 files changed, 64 insertions(+), 49 deletions(-) (limited to 'tools/dcpdiff.cc') diff --git a/src/asset.h b/src/asset.h index 527dea7a..1b1bf4c6 100644 --- a/src/asset.h +++ b/src/asset.h @@ -81,7 +81,7 @@ public: _file_name = f; } - virtual bool equals (boost::shared_ptr other, EqualityOptions opt, boost::function) const = 0; + virtual bool equals (boost::shared_ptr other, EqualityOptions opt, boost::function) const = 0; protected: diff --git a/src/dcp.cc b/src/dcp.cc index 49d41c70..bac266ab 100644 --- a/src/dcp.cc +++ b/src/dcp.cc @@ -248,10 +248,10 @@ DCP::read (bool require_mxfs) } bool -DCP::equals (DCP const & other, EqualityOptions opt, boost::function note) const +DCP::equals (DCP const & other, EqualityOptions opt, boost::function note) const { if (_cpls.size() != other._cpls.size()) { - note ("CPL counts differ"); + note (ERROR, "CPL counts differ"); return false; } @@ -516,30 +516,30 @@ CPL::write_to_assetmap (ostream& s) const bool -CPL::equals (CPL const & other, EqualityOptions opt, boost::function note) const +CPL::equals (CPL const & other, EqualityOptions opt, boost::function note) const { if (_name != other._name) { - note ("names differ"); + note (ERROR, "names differ"); return false; } if (_content_kind != other._content_kind) { - note ("content kinds differ"); + note (ERROR, "content kinds differ"); return false; } if (_fps != other._fps) { - note ("frames per second differ"); + note (ERROR, "frames per second differ"); return false; } if (_length != other._length) { - note ("lengths differ"); + note (ERROR, "lengths differ"); return false; } if (_reels.size() != other._reels.size()) { - note ("reel counts differ"); + note (ERROR, "reel counts differ"); return false; } diff --git a/src/dcp.h b/src/dcp.h index 7e9b4edc..9e2e8a02 100644 --- a/src/dcp.h +++ b/src/dcp.h @@ -84,7 +84,7 @@ public: std::list > assets () const; - bool equals (CPL const & other, EqualityOptions options, boost::function note) const; + bool equals (CPL const & other, EqualityOptions options, boost::function note) const; void write_xml () const; void write_to_assetmap (std::ostream& s) const; @@ -144,7 +144,7 @@ public: * @param options Options to define what "equality" means. * @return true if the DCPs are equal according to EqualityOptions, otherwise false. */ - bool equals (DCP const & other, EqualityOptions options, boost::function note) const; + bool equals (DCP const & other, EqualityOptions options, boost::function note) const; /** Add a CPL to this DCP. * @param cpl CPL to add. diff --git a/src/mxf_asset.cc b/src/mxf_asset.cc index cf265712..9b491dd7 100644 --- a/src/mxf_asset.cc +++ b/src/mxf_asset.cc @@ -71,31 +71,31 @@ MXFAsset::fill_writer_info (ASDCP::WriterInfo* writer_info, string uuid) } bool -MXFAsset::equals (shared_ptr other, EqualityOptions, boost::function note) const +MXFAsset::equals (shared_ptr other, EqualityOptions, boost::function note) const { shared_ptr other_mxf = dynamic_pointer_cast (other); if (!other_mxf) { - note ("comparing an MXF asset with a non-MXF asset"); + note (ERROR, "comparing an MXF asset with a non-MXF asset"); return false; } if (_file_name != other_mxf->_file_name) { - note ("MXF names differ"); + note (ERROR, "MXF names differ"); return false; } if (_edit_rate != other_mxf->_edit_rate) { - note ("MXF edit rates differ"); + note (ERROR, "MXF edit rates differ"); return false; } if (_intrinsic_duration != other_mxf->_intrinsic_duration) { - note ("MXF intrinsic durations differ"); + note (ERROR, "MXF intrinsic durations differ"); return false; } if (_duration != other_mxf->_duration) { - note ("MXF durations differ"); + note (ERROR, "MXF durations differ"); return false; } diff --git a/src/mxf_asset.h b/src/mxf_asset.h index 0c98f3c6..29b3c1b0 100644 --- a/src/mxf_asset.h +++ b/src/mxf_asset.h @@ -61,7 +61,7 @@ public: _intrinsic_duration = d; } - virtual bool equals (boost::shared_ptr other, EqualityOptions opt, boost::function note) const; + virtual bool equals (boost::shared_ptr other, EqualityOptions opt, boost::function note) const; int intrinsic_duration () const { return _intrinsic_duration; diff --git a/src/picture_asset.cc b/src/picture_asset.cc index 807564c5..4b775980 100644 --- a/src/picture_asset.cc +++ b/src/picture_asset.cc @@ -79,7 +79,7 @@ PictureAsset::write_to_cpl (ostream& s) const } bool -PictureAsset::equals (shared_ptr other, EqualityOptions opt, boost::function note) const +PictureAsset::equals (shared_ptr other, EqualityOptions opt, boost::function note) const { if (!MXFAsset::equals (other, opt, note)) { return false; @@ -125,7 +125,7 @@ PictureAsset::equals (shared_ptr other, EqualityOptions opt, boost: // desc_A.QuantizationDefault != desc_B.QuantizationDefault ) { - note ("video MXF picture descriptors differ"); + note (ERROR, "video MXF picture descriptors differ"); return false; } @@ -248,7 +248,7 @@ MonoPictureAsset::get_frame (int n) const bool -MonoPictureAsset::equals (shared_ptr other, EqualityOptions opt, boost::function note) const +MonoPictureAsset::equals (shared_ptr other, EqualityOptions opt, boost::function note) const { if (!PictureAsset::equals (other, opt, note)) { return false; @@ -258,6 +258,7 @@ MonoPictureAsset::equals (shared_ptr other, EqualityOptions opt, bo assert (other_picture); for (int i = 0; i < _intrinsic_duration; ++i) { + note (PROGRESS, "Comparing video frame " + lexical_cast (i) + " of " + lexical_cast (_intrinsic_duration)); shared_ptr frame_A = get_frame (i); shared_ptr frame_B = other_picture->get_frame (i); @@ -274,7 +275,7 @@ MonoPictureAsset::equals (shared_ptr other, EqualityOptions opt, bo } bool -StereoPictureAsset::equals (shared_ptr other, EqualityOptions opt, boost::function note) const +StereoPictureAsset::equals (shared_ptr other, EqualityOptions opt, boost::function note) const { if (!PictureAsset::equals (other, opt, note)) { return false; @@ -309,7 +310,7 @@ StereoPictureAsset::equals (shared_ptr other, EqualityOptions opt, bool PictureAsset::frame_buffer_equals ( - int frame, EqualityOptions opt, boost::function note, + int frame, EqualityOptions opt, boost::function note, uint8_t const * data_A, unsigned int size_A, uint8_t const * data_B, unsigned int size_B ) const { @@ -325,7 +326,7 @@ PictureAsset::frame_buffer_equals ( /* Compare them */ if (image_A->numcomps != image_B->numcomps) { - note ("image component counts for frame " + lexical_cast(frame) + " differ"); + note (ERROR, "image component counts for frame " + lexical_cast(frame) + " differ"); return false; } @@ -336,7 +337,7 @@ PictureAsset::frame_buffer_equals ( for (int c = 0; c < image_A->numcomps; ++c) { if (image_A->comps[c].w != image_B->comps[c].w || image_A->comps[c].h != image_B->comps[c].h) { - note ("image sizes for frame " + lexical_cast(frame) + " differ"); + note (ERROR, "image sizes for frame " + lexical_cast(frame) + " differ"); return false; } @@ -363,7 +364,7 @@ PictureAsset::frame_buffer_equals ( double const std_dev = sqrt (double (total_squared_deviation) / abs_diffs.size()); if (mean > opt.max_mean_pixel_error || std_dev > opt.max_std_dev_pixel_error) { - note ("mean or standard deviation out of range for " + lexical_cast(frame)); + note (ERROR, "mean or standard deviation out of range for " + lexical_cast(frame)); return false; } diff --git a/src/picture_asset.h b/src/picture_asset.h index f4d4d7a4..c9226b1f 100644 --- a/src/picture_asset.h +++ b/src/picture_asset.h @@ -63,7 +63,7 @@ public: */ void write_to_cpl (std::ostream& s) const; - bool equals (boost::shared_ptr other, EqualityOptions opt, boost::function note) const; + bool equals (boost::shared_ptr other, EqualityOptions opt, boost::function note) const; Size size () const { return _size; @@ -72,7 +72,7 @@ public: protected: bool frame_buffer_equals ( - int frame, EqualityOptions opt, boost::function note, + int frame, EqualityOptions opt, boost::function note, uint8_t const * data_A, unsigned int size_A, uint8_t const * data_B, unsigned int size_B ) const; @@ -210,7 +210,7 @@ public: boost::shared_ptr start_write (bool); boost::shared_ptr get_frame (int n) const; - bool equals (boost::shared_ptr other, EqualityOptions opt, boost::function note) const; + bool equals (boost::shared_ptr other, EqualityOptions opt, boost::function note) const; private: std::string path_from_list (int f, std::vector const & files) const; @@ -224,7 +224,7 @@ public: StereoPictureAsset (std::string directory, std::string mxf_name, int fps, int intrinsic_duration); boost::shared_ptr get_frame (int n) const; - bool equals (boost::shared_ptr other, EqualityOptions opt, boost::function note) const; + bool equals (boost::shared_ptr other, EqualityOptions opt, boost::function note) const; }; diff --git a/src/reel.cc b/src/reel.cc index 096acf19..86533ea2 100644 --- a/src/reel.cc +++ b/src/reel.cc @@ -50,10 +50,10 @@ Reel::write_to_cpl (ostream& s) const } bool -Reel::equals (boost::shared_ptr other, EqualityOptions opt, boost::function note) const +Reel::equals (boost::shared_ptr other, EqualityOptions opt, boost::function note) const { if ((_main_picture && !other->_main_picture) || (!_main_picture && other->_main_picture)) { - note ("reel has different assets"); + note (ERROR, "reel has different assets"); return false; } @@ -62,7 +62,7 @@ Reel::equals (boost::shared_ptr other, EqualityOptions opt, boost::f } if ((_main_sound && !other->_main_sound) || (!_main_sound && other->_main_sound)) { - note ("reel has different assets"); + note (ERROR, "reel has different assets"); return false; } @@ -71,7 +71,7 @@ Reel::equals (boost::shared_ptr other, EqualityOptions opt, boost::f } if ((_main_subtitle && !other->_main_subtitle) || (!_main_subtitle && other->_main_subtitle)) { - note ("reel has different assets"); + note (ERROR, "reel has different assets"); return false; } diff --git a/src/reel.h b/src/reel.h index b0dfc84d..93dc0920 100644 --- a/src/reel.h +++ b/src/reel.h @@ -56,7 +56,7 @@ public: void write_to_cpl (std::ostream & s) const; - bool equals (boost::shared_ptr other, EqualityOptions opt, boost::function notes) const; + bool equals (boost::shared_ptr other, EqualityOptions opt, boost::function notes) const; private: boost::shared_ptr _main_picture; diff --git a/src/sound_asset.cc b/src/sound_asset.cc index da6e72bc..6e29aadf 100644 --- a/src/sound_asset.cc +++ b/src/sound_asset.cc @@ -222,7 +222,7 @@ SoundAsset::write_to_cpl (ostream& s) const } bool -SoundAsset::equals (shared_ptr other, EqualityOptions opt, boost::function note) const +SoundAsset::equals (shared_ptr other, EqualityOptions opt, boost::function note) const { if (!MXFAsset::equals (other, opt, note)) { return false; @@ -260,7 +260,7 @@ SoundAsset::equals (shared_ptr other, EqualityOptions opt, boost::f // desc_A.ChannelFormat != desc_B.ChannelFormat || ) { - note ("audio MXF picture descriptors differ"); + note (ERROR, "audio MXF picture descriptors differ"); return false; } @@ -277,7 +277,7 @@ SoundAsset::equals (shared_ptr other, EqualityOptions opt, boost::f } if (buffer_A.Size() != buffer_B.Size()) { - note ("sizes of audio data for frame " + lexical_cast(i) + " differ"); + note (ERROR, "sizes of audio data for frame " + lexical_cast(i) + " differ"); return false; } @@ -285,7 +285,7 @@ SoundAsset::equals (shared_ptr other, EqualityOptions opt, boost::f for (uint32_t i = 0; i < buffer_A.Size(); ++i) { int const d = abs (buffer_A.RoData()[i] - buffer_B.RoData()[i]); if (d > opt.max_audio_sample_error) { - note ("PCM data difference of " + lexical_cast (d)); + note (ERROR, "PCM data difference of " + lexical_cast (d)); return false; } } diff --git a/src/sound_asset.h b/src/sound_asset.h index dedebac3..9e6e75cf 100644 --- a/src/sound_asset.h +++ b/src/sound_asset.h @@ -129,7 +129,7 @@ public: */ void write_to_cpl (std::ostream& s) const; - bool equals (boost::shared_ptr other, EqualityOptions opt, boost::function note) const; + bool equals (boost::shared_ptr other, EqualityOptions opt, boost::function note) const; boost::shared_ptr get_frame (int n) const; diff --git a/src/subtitle_asset.h b/src/subtitle_asset.h index b3936dc2..1e31df2b 100644 --- a/src/subtitle_asset.h +++ b/src/subtitle_asset.h @@ -184,9 +184,9 @@ public: SubtitleAsset (std::string directory, std::string movie_title, std::string language); void write_to_cpl (std::ostream&) const; - virtual bool equals (boost::shared_ptr, EqualityOptions, boost::function note) const { + virtual bool equals (boost::shared_ptr, EqualityOptions, boost::function note) const { /* XXX */ - note ("subtitle assets not compared yet"); + note (ERROR, "subtitle assets not compared yet"); return true; } diff --git a/src/types.h b/src/types.h index ebcfb838..4c824080 100644 --- a/src/types.h +++ b/src/types.h @@ -107,6 +107,11 @@ struct EqualityOptions { int max_audio_sample_error; }; +enum NoteType { + PROGRESS, + ERROR +}; + /** @class Color * @brief An RGB color (aka colour). */ diff --git a/tools/dcpdiff.cc b/tools/dcpdiff.cc index 6d55586d..7913c533 100644 --- a/tools/dcpdiff.cc +++ b/tools/dcpdiff.cc @@ -8,12 +8,15 @@ using namespace std; using namespace boost; using namespace libdcp; +static bool verbose = false; + static void help (string n) { cerr << "Syntax: " << n << " [OPTION] \n" - << " -v, --version show libdcp version\n" + << " -V, --version show libdcp version\n" << " -h, --help show this help\n" + << " -v, --verbose be verbose\n" << "\n" << "The s are the DCP directories to compare.\n" << "Comparison is of metadata and content, ignoring timestamps\n" @@ -21,9 +24,11 @@ help (string n) } void -note (string n) +note (NoteType t, string n) { - cout << " " << n << "\n"; + if (t == ERROR || (t == PROGRESS && verbose)) { + cout << " " << n << "\n"; + } } int @@ -34,24 +39,28 @@ main (int argc, char* argv[]) int option_index = 0; while (1) { static struct option long_options[] = { - { "version", no_argument, 0, 'v'}, + { "version", no_argument, 0, 'V'}, { "help", no_argument, 0, 'h'}, + { "verbose", no_argument, 0, 'v'}, { 0, 0, 0, 0 } }; - int c = getopt_long (argc, argv, "vh", long_options, &option_index); + int c = getopt_long (argc, argv, "Vhv", long_options, &option_index); if (c == -1) { break; } switch (c) { - case 'v': + case 'V': cout << "dcpdiff version " << LIBDCP_VERSION << "\n"; exit (EXIT_SUCCESS); case 'h': help (argv[0]); exit (EXIT_SUCCESS); + case 'v': + verbose = true; + break; } } @@ -93,7 +102,7 @@ main (int argc, char* argv[]) /* I think this is just below the LSB at 16-bits (ie the 8th most significant bit at 24-bit) */ options.max_audio_sample_error = 255; - bool const equals = a->equals (*b, options, boost::bind (note, _1)); + bool const equals = a->equals (*b, options, boost::bind (note, _1, _2)); if (equals) { exit (EXIT_SUCCESS); -- cgit v1.2.3 From 2ad4929f4b3fec0413633c00364f4a6fda3e6c0c Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 16 Apr 2013 09:54:23 +0100 Subject: Merge and add option to ignore differing MXF names. --- src/mxf_asset.cc | 6 ++++-- src/types.h | 2 ++ tools/dcpdiff.cc | 7 ++++++- 3 files changed, 12 insertions(+), 3 deletions(-) (limited to 'tools/dcpdiff.cc') diff --git a/src/mxf_asset.cc b/src/mxf_asset.cc index 9b491dd7..144532f8 100644 --- a/src/mxf_asset.cc +++ b/src/mxf_asset.cc @@ -71,7 +71,7 @@ MXFAsset::fill_writer_info (ASDCP::WriterInfo* writer_info, string uuid) } bool -MXFAsset::equals (shared_ptr other, EqualityOptions, boost::function note) const +MXFAsset::equals (shared_ptr other, EqualityOptions opt, boost::function note) const { shared_ptr other_mxf = dynamic_pointer_cast (other); if (!other_mxf) { @@ -81,7 +81,9 @@ MXFAsset::equals (shared_ptr other, EqualityOptions, boost::functio if (_file_name != other_mxf->_file_name) { note (ERROR, "MXF names differ"); - return false; + if (!opt.mxf_names_can_differ) { + return false; + } } if (_edit_rate != other_mxf->_edit_rate) { diff --git a/src/types.h b/src/types.h index 4c824080..b6372e9a 100644 --- a/src/types.h +++ b/src/types.h @@ -100,11 +100,13 @@ struct EqualityOptions { : max_mean_pixel_error (0) , max_std_dev_pixel_error (0) , max_audio_sample_error (0) + , mxf_names_can_differ (false) {} double max_mean_pixel_error; double max_std_dev_pixel_error; int max_audio_sample_error; + bool mxf_names_can_differ; }; enum NoteType { diff --git a/tools/dcpdiff.cc b/tools/dcpdiff.cc index 7913c533..6db45a1b 100644 --- a/tools/dcpdiff.cc +++ b/tools/dcpdiff.cc @@ -17,6 +17,7 @@ help (string n) << " -V, --version show libdcp version\n" << " -h, --help show this help\n" << " -v, --verbose be verbose\n" + << " -n, --names allow differing MXF names\n" << "\n" << "The s are the DCP directories to compare.\n" << "Comparison is of metadata and content, ignoring timestamps\n" @@ -42,10 +43,11 @@ main (int argc, char* argv[]) { "version", no_argument, 0, 'V'}, { "help", no_argument, 0, 'h'}, { "verbose", no_argument, 0, 'v'}, + { "names", no_argument, 0, 'n'}, { 0, 0, 0, 0 } }; - int c = getopt_long (argc, argv, "Vhv", long_options, &option_index); + int c = getopt_long (argc, argv, "Vhvn", long_options, &option_index); if (c == -1) { break; @@ -61,6 +63,9 @@ main (int argc, char* argv[]) case 'v': verbose = true; break; + case 'n': + options.mxf_names_can_differ = true; + break; } } -- cgit v1.2.3 From 9ce517d0c789e0e1ef98f25e3449a75945fc62ab Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 16 Apr 2013 13:36:20 +0100 Subject: Add a couple of notes. --- src/picture_asset.cc | 3 +++ src/types.h | 3 ++- tools/dcpdiff.cc | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) (limited to 'tools/dcpdiff.cc') diff --git a/src/picture_asset.cc b/src/picture_asset.cc index 4b775980..f2982b47 100644 --- a/src/picture_asset.cc +++ b/src/picture_asset.cc @@ -315,6 +315,7 @@ PictureAsset::frame_buffer_equals ( ) const { if (size_A == size_B && memcmp (data_A, data_B, size_A) == 0) { + note (NOTE, "J2K identical"); /* Easy result; the J2K data is identical */ return true; } @@ -367,6 +368,8 @@ PictureAsset::frame_buffer_equals ( note (ERROR, "mean or standard deviation out of range for " + lexical_cast(frame)); return false; } + + note (NOTE, "mean difference " + lexical_cast (mean) + ", deviation " + lexical_cast (std_dev)); opj_image_destroy (image_A); opj_image_destroy (image_B); diff --git a/src/types.h b/src/types.h index 4c824080..928e6a30 100644 --- a/src/types.h +++ b/src/types.h @@ -109,7 +109,8 @@ struct EqualityOptions { enum NoteType { PROGRESS, - ERROR + ERROR, + NOTE }; /** @class Color diff --git a/tools/dcpdiff.cc b/tools/dcpdiff.cc index 7913c533..b4c58b36 100644 --- a/tools/dcpdiff.cc +++ b/tools/dcpdiff.cc @@ -26,7 +26,7 @@ help (string n) void note (NoteType t, string n) { - if (t == ERROR || (t == PROGRESS && verbose)) { + if (t == ERROR || verbose) { cout << " " << n << "\n"; } } -- cgit v1.2.3 From 8c7829cd20778082a7a5ea612639c313f3006faa Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 3 May 2013 16:12:50 +0100 Subject: A few tweaks to dcpdiff. --- src/picture_asset.cc | 13 +++++++++---- tools/dcpdiff.cc | 24 +++++++++++++++++------- 2 files changed, 26 insertions(+), 11 deletions(-) (limited to 'tools/dcpdiff.cc') diff --git a/src/picture_asset.cc b/src/picture_asset.cc index f2982b47..a505dc63 100644 --- a/src/picture_asset.cc +++ b/src/picture_asset.cc @@ -364,13 +364,18 @@ PictureAsset::frame_buffer_equals ( double const std_dev = sqrt (double (total_squared_deviation) / abs_diffs.size()); - if (mean > opt.max_mean_pixel_error || std_dev > opt.max_std_dev_pixel_error) { - note (ERROR, "mean or standard deviation out of range for " + lexical_cast(frame)); + note (NOTE, "mean difference " + lexical_cast (mean) + ", deviation " + lexical_cast (std_dev)); + + if (mean > opt.max_mean_pixel_error) { + note (ERROR, "mean " + lexical_cast(mean) + " out of range " + lexical_cast(opt.max_mean_pixel_error) + " in frame " + lexical_cast(frame)); + return false; + } + + if (std_dev > opt.max_std_dev_pixel_error) { + note (ERROR, "standard deviation " + lexical_cast(std_dev) + " out of range " + lexical_cast(opt.max_std_dev_pixel_error) + " in frame " + lexical_cast(frame)); return false; } - note (NOTE, "mean difference " + lexical_cast (mean) + ", deviation " + lexical_cast (std_dev)); - opj_image_destroy (image_A); opj_image_destroy (image_B); diff --git a/tools/dcpdiff.cc b/tools/dcpdiff.cc index 490059aa..b361b93a 100644 --- a/tools/dcpdiff.cc +++ b/tools/dcpdiff.cc @@ -14,10 +14,12 @@ static void help (string n) { cerr << "Syntax: " << n << " [OPTION] \n" - << " -V, --version show libdcp version\n" - << " -h, --help show this help\n" - << " -v, --verbose be verbose\n" - << " -n, --names allow differing MXF names\n" + << " -V, --version show libdcp version\n" + << " -h, --help show this help\n" + << " -v, --verbose be verbose\n" + << " -n, --names allow differing MXF names\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" << "\n" << "The s are the DCP directories to compare.\n" << "Comparison is of metadata and content, ignoring timestamps\n" @@ -36,6 +38,8 @@ int main (int argc, char* argv[]) { EqualityOptions options; + options.max_mean_pixel_error = 5; + options.max_std_dev_pixel_error = 5; int option_index = 0; while (1) { @@ -44,10 +48,12 @@ main (int argc, char* argv[]) { "help", no_argument, 0, 'h'}, { "verbose", no_argument, 0, 'v'}, { "names", no_argument, 0, 'n'}, + { "mean-pixel", required_argument, 0, 'm'}, + { "std-dev-pixel", required_argument, 0, 's'}, { 0, 0, 0, 0 } }; - int c = getopt_long (argc, argv, "Vhvn", long_options, &option_index); + int c = getopt_long (argc, argv, "Vhvnm:s:", long_options, &option_index); if (c == -1) { break; @@ -66,6 +72,12 @@ main (int argc, char* argv[]) case 'n': options.mxf_names_can_differ = true; break; + case 'm': + options.max_mean_pixel_error = atof (optarg); + break; + case 's': + options.max_std_dev_pixel_error = atof (optarg); + break; } } @@ -102,8 +114,6 @@ main (int argc, char* argv[]) exit (EXIT_FAILURE); } - options.max_mean_pixel_error = 5; - options.max_std_dev_pixel_error = 5; /* I think this is just below the LSB at 16-bits (ie the 8th most significant bit at 24-bit) */ options.max_audio_sample_error = 255; -- cgit v1.2.3