diff options
| author | Carl Hetherington <cth@carlh.net> | 2012-08-02 12:25:15 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2012-08-02 12:25:15 +0100 |
| commit | 8d94e57248b7957d62350083a93aa479457f9385 (patch) | |
| tree | a3e899ab0d007b540bf4ef9fc5d3650c7df925be /src/picture_asset.cc | |
| parent | 4f6b9809ed4c9291e2577ee8e0f3bebf15ca2629 (diff) | |
Tidy up equality options slightly.
Diffstat (limited to 'src/picture_asset.cc')
| -rw-r--r-- | src/picture_asset.cc | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/picture_asset.cc b/src/picture_asset.cc index 3386d6d4..f5c10ce3 100644 --- a/src/picture_asset.cc +++ b/src/picture_asset.cc @@ -143,11 +143,11 @@ PictureAsset::write_to_cpl (ostream& s) const } list<string> -PictureAsset::equals (shared_ptr<const Asset> other, EqualityFlags flags, double max_mean, double max_std_dev) const +PictureAsset::equals (shared_ptr<const Asset> other, EqualityOptions opt) const { - list<string> notes = Asset::equals (other, flags, max_mean, max_std_dev); + list<string> notes = Asset::equals (other, opt); - if (flags & MXF_INSPECT) { + if (opt.flags & MXF_INSPECT) { ASDCP::JP2K::MXFReader reader_A; if (ASDCP_FAILURE (reader_A.OpenRead (mxf_path().string().c_str()))) { throw FileError ("could not open MXF file for reading", mxf_path().string()); @@ -221,6 +221,11 @@ PictureAsset::equals (shared_ptr<const Asset> other, EqualityFlags flags, double } if (!j2k_same) { + + if (opt.verbose) { + cout << "J2K images for " << i << " differ; checking by pixel\n"; + } + /* Decompress the images to bitmaps */ opj_image_t* image_A = decompress_j2k (const_cast<uint8_t*> (buffer_A.RoData()), buffer_A.Size ()); opj_image_t* image_B = decompress_j2k (const_cast<uint8_t*> (buffer_B.RoData()), buffer_B.Size ()); @@ -260,10 +265,14 @@ PictureAsset::equals (shared_ptr<const Asset> other, EqualityFlags flags, double double const std_dev = sqrt (double (total_squared_deviation) / abs_diffs.size()); - if (mean > max_mean || std_dev > max_std_dev) { + if (mean > opt.max_mean_pixel_error || std_dev > opt.max_std_dev_pixel_error) { notes.push_back ("mean or standard deviation out of range for " + lexical_cast<string>(i)); } + if (opt.verbose) { + cout << "\tmean pixel error " << mean << ", standard deviation " << std_dev << "\n"; + } + opj_image_destroy (image_A); opj_image_destroy (image_B); } |
