Check every picture frame when -k is passed to dcpdiff.
authorCarl Hetherington <cth@carlh.net>
Tue, 1 Dec 2015 14:55:54 +0000 (14:55 +0000)
committerCarl Hetherington <cth@carlh.net>
Tue, 1 Dec 2015 14:55:54 +0000 (14:55 +0000)
src/mono_picture_asset.cc
src/stereo_picture_asset.cc
src/types.h
tools/dcpdiff.cc

index 91ab0d8a21ac10f095447ee89a168e27b0f7476a..f14e50c2191e9f68843ffda2fb9761a18cc1085b 100644 (file)
@@ -103,6 +103,8 @@ MonoPictureAsset::equals (shared_ptr<const Asset> other, EqualityOptions opt, No
        shared_ptr<const MonoPictureAsset> other_picture = dynamic_pointer_cast<const MonoPictureAsset> (other);
        DCP_ASSERT (other_picture);
 
+       bool result = true;
+
        for (int i = 0; i < _intrinsic_duration; ++i) {
                if (i >= other_picture->intrinsic_duration()) {
                        return false;
@@ -117,11 +119,14 @@ MonoPictureAsset::equals (shared_ptr<const Asset> other, EqualityOptions opt, No
                            frame_A->j2k_data(), frame_A->j2k_size(),
                            frame_B->j2k_data(), frame_B->j2k_size()
                            )) {
-                       return false;
+                       result = false;
+                       if (!opt.keep_going) {
+                               return result;
+                       }
                }
        }
 
-       return true;
+       return result;
 }
 
 shared_ptr<PictureAssetWriter>
index 76c353f1732e0a4b272c62c61d05802943ade113..e2494be6f417649bd7581e17603aa9d922e7bcd0 100644 (file)
@@ -105,6 +105,8 @@ StereoPictureAsset::equals (shared_ptr<const Asset> other, EqualityOptions opt,
        shared_ptr<const StereoPictureAsset> other_picture = dynamic_pointer_cast<const StereoPictureAsset> (other);
        DCP_ASSERT (other_picture);
 
+       bool result = true;
+
        for (int i = 0; i < _intrinsic_duration; ++i) {
                shared_ptr<const StereoPictureFrame> frame_A;
                shared_ptr<const StereoPictureFrame> frame_B;
@@ -124,7 +126,10 @@ StereoPictureAsset::equals (shared_ptr<const Asset> other, EqualityOptions opt,
                            frame_A->left_j2k_data(), frame_A->left_j2k_size(),
                            frame_B->left_j2k_data(), frame_B->left_j2k_size()
                            )) {
-                       return false;
+                       result = false;
+                       if (!opt.keep_going) {
+                               return result;
+                       }
                }
 
                if (!frame_buffer_equals (
@@ -132,9 +137,12 @@ StereoPictureAsset::equals (shared_ptr<const Asset> other, EqualityOptions opt,
                            frame_A->right_j2k_data(), frame_A->right_j2k_size(),
                            frame_B->right_j2k_data(), frame_B->right_j2k_size()
                            )) {
-                       return false;
+                       result = false;
+                       if (!opt.keep_going) {
+                               return result;
+                       }
                }
        }
 
-       return true;
+       return result;
 }
index 1cd116c99633cd71ac2eae45e0caa63bdf01857b..16000daa809c8a58b342461e31e2bbd3169363c8 100644 (file)
@@ -166,6 +166,7 @@ struct EqualityOptions
                , reel_annotation_texts_can_differ (false)
                , reel_hashes_can_differ (false)
                , issue_dates_can_differ (false)
+               , keep_going (false)
        {}
 
        /** The maximum allowable mean difference in pixel value between two images */
@@ -182,6 +183,7 @@ struct EqualityOptions
        bool reel_hashes_can_differ;
        /** true if IssueDate nodes can differ */
        bool issue_dates_can_differ;
+       bool keep_going;
 };
 
 /* I've been unable to make mingw happy with ERROR as a symbol, so
index a820463f725e5e2aafd0e9a69e58aa790f28a2b4..473efa45f68ff84efe920b89d5f359aa1a7b4a2f 100644 (file)
@@ -106,7 +106,7 @@ main (int argc, char* argv[])
        options.max_std_dev_pixel_error = 5;
        options.reel_hashes_can_differ = true;
        options.reel_annotation_texts_can_differ = false;
-       bool keep_going = false;
+       options.keep_going = false;
        bool ignore_missing_assets = false;
        optional<string> key;
 
@@ -150,7 +150,7 @@ main (int argc, char* argv[])
                        options.max_std_dev_pixel_error = atof (optarg);
                        break;
                case 'k':
-                       keep_going = true;
+                       options.keep_going = true;
                        break;
                case 'A':
                        ignore_missing_assets = true;
@@ -183,8 +183,8 @@ main (int argc, char* argv[])
                exit (EXIT_FAILURE);
        }
 
-       DCP* a = load_dcp (argv[optind], keep_going, ignore_missing_assets, key);
-       DCP* b = load_dcp (argv[optind + 1], keep_going, ignore_missing_assets, key);
+       DCP* a = load_dcp (argv[optind], options.keep_going, ignore_missing_assets, key);
+       DCP* b = load_dcp (argv[optind + 1], options.keep_going, ignore_missing_assets, key);
 
        /* 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;