[Scummvm-git-logs] scummvm-sites director-buildbot -> 158e29a9739c1325b1a3724162a45ee6dca46acd

sev- noreply at scummvm.org
Mon Jun 15 20:10:37 UTC 2026


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm-sites' repo located at https://api.github.com/repos/scummvm/scummvm-sites .

Summary:
158e29a973 IMAGEDIFF: Replace image comparison with file check


Commit: 158e29a9739c1325b1a3724162a45ee6dca46acd
    https://github.com/scummvm/scummvm-sites/commit/158e29a9739c1325b1a3724162a45ee6dca46acd
Author: ramyak-sharma (ramyaksharma1 at gmail.com)
Date: 2026-06-15T22:10:33+02:00

Commit Message:
IMAGEDIFF: Replace image comparison with file check

Changed paths:
    imagediff/imagediff.py
    imagediff/main.py


diff --git a/imagediff/imagediff.py b/imagediff/imagediff.py
index 40232c3..8931ec2 100644
--- a/imagediff/imagediff.py
+++ b/imagediff/imagediff.py
@@ -67,72 +67,23 @@ def find_baseline_build(screenshots_dir, target, current_build):
 
 def movie_diff(src_build, cmp_build, target, movie, screenshots_dir=None):
     """
-    Compare all frames of a movie between two builds and determine if there are any differences.
+    Determine if a movie differs between two builds by checking file presence.
 
-    Args:
-        src_build (str): The source build name
-        cmp_build (str): The comparison build name
-        target (str): The target name
-        movie (str): The movie name
-        screenshots_dir (str): Override for SCREENSHOTS_DIR from config
-
-    Returns:
-        bool: True if any frame has differences, False otherwise
+    The Director engine only saves a screenshot when it detects a change vs the
+    previous build (using pixel comparison with a threshold). So if a frame file
+    exists in a build, the engine already confirmed it differs. No PIL comparison
+    needed here, file presence IS the diff signal.
     """
     screenshots_dir = screenshots_dir or SCREENSHOTS_DIR
     src_build_path = os.path.join(screenshots_dir, target, src_build)
     cmp_build_path = os.path.join(screenshots_dir, target, cmp_build)
 
-    # Ensure both build paths exist
     if not os.path.exists(src_build_path) or not os.path.exists(cmp_build_path):
         return False
 
-    # Get all frames for this movie in both builds
-    src_frames = [f for f in os.listdir(src_build_path)
-                  if os.path.isfile(os.path.join(src_build_path, f)) and f.startswith(f"{movie}-")]
-
-    cmp_frames = [f for f in os.listdir(cmp_build_path)
-                  if os.path.isfile(os.path.join(cmp_build_path, f)) and f.startswith(f"{movie}-")]
-
-    # If frame counts differ, there's definitely a difference
-    if len(src_frames) != len(cmp_frames):
-        return True
-
-    # Helper function to extract frame number from filename
-    def get_frame_number(filename):
-        parts = filename.split('-')
-        if len(parts) > 1:
-            try:
-                return int(parts[1].split('.')[0])
-            except ValueError:
-                return 0
-        return 0
-
-    src_frame_map = {get_frame_number(f): f for f in src_frames}
-    cmp_frame_map = {get_frame_number(f): f for f in cmp_frames}
-
-    all_frame_numbers = sorted(set(list(src_frame_map.keys()) + list(cmp_frame_map.keys())))
-
-    if set(src_frame_map.keys()) != set(cmp_frame_map.keys()):
-        return True
-
-    for frame_num in all_frame_numbers:
-        src_frame = src_frame_map.get(frame_num)
-        cmp_frame = cmp_frame_map.get(frame_num)
-
-        if src_frame and cmp_frame:
-            src_img_path = os.path.join(src_build_path, src_frame)
-            cmp_img_path = os.path.join(cmp_build_path, cmp_frame)
-
-            try:
-                diff_result = image_diff(src_img_path, cmp_img_path)
+    cmp_frames = {f for f in os.listdir(cmp_build_path) if f.startswith(f"{movie}-")}
 
-                if diff_result.get('has_diff', False):
-                    return True
-            except Exception as e:
-                print(f"Error comparing frames {src_frame} and {cmp_frame}: {e}")
-                return True
-        else:
-            return True
+    # The engine only saves a screenshot file when it detects a change vs the previous build.
+    # So any file in cmp_build means cmp_build differs from src_build.
+    return len(cmp_frames) > 0
 
-    return False
\ No newline at end of file
diff --git a/imagediff/main.py b/imagediff/main.py
index 7e7f8ab..b3b85c7 100644
--- a/imagediff/main.py
+++ b/imagediff/main.py
@@ -328,24 +328,11 @@ def target_data_api(target):
                 movie_reference_builds[movie][current_build] = reference_data
 
     def get_image_diff(current_build, prev_build, movie, frame):
-        cache_key = make_cache_key(target, current_build, prev_build, movie, frame)
-        image_diff_cache = load_frame_cache(target)
-        if cache_key in image_diff_cache:
-            return image_diff_cache[cache_key]
-
         current_frame_path = os.path.join(target_path, current_build, f"{movie}-{frame}.png")
         prev_frame_path = os.path.join(target_path, prev_build, f"{movie}-{frame}.png")
-
-        if os.path.exists(current_frame_path) and os.path.exists(prev_frame_path):
-            try:
-                image_diff_cache[cache_key] = image_diff(current_frame_path, prev_frame_path)
-            except Exception as e:
-                print(f"Error comparing frames {movie}-{frame}: {e}")
-                image_diff_cache[cache_key] = {'has_diff': True}
-        else:
-            image_diff_cache[cache_key] = {'has_diff': True}
-        save_frame_cache(target, image_diff_cache)
-        return image_diff_cache[cache_key]
+        # File presence is the diff signal, engine only saves when it detects a change
+        has_diff = os.path.exists(current_frame_path) and os.path.exists(prev_frame_path)
+        return {'has_diff': has_diff}
 
     # Modified movie difference function to only compare specified frames
     def get_movie_diff_for_frames(current_build, reference_build, target, movie, frames_to_compare):
@@ -468,7 +455,8 @@ def target_data_api(target):
                             'is_partial': True
                         })
                     else:
-                        has_diff = movie_diff(current_build, prev_build, target, movie)
+                        has_diff = get_movie_diff_for_frames(
+                            current_build, prev_build, target, movie, list(common_frames))
 
                         continuous_bars[movie].append({
                             'build': current_build,




More information about the Scummvm-git-logs mailing list