From 65bc40e7c765e35b5bf65002e5f1ecd1d1eae5f8 Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Fri, 17 Jul 2026 13:19:51 +0200 Subject: [PATCH] merge: deltaCChalf uses the deterministic HalfForImage split, not an RNG MergeOnTheFly::DeltaCChalfReject assigned its CC1/2 half-sets from a seeded std::mt19937 drawn in image (call) order, whereas the actual merge, the rotation merge, the GPU path and the R-free flags all split with the deterministic HalfForImage(image_id) splitmix64 hash. So the deltaCChalf was measured on a different half-partition than the reported CC1/2, and was order-dependent (a reordered outcomes vector gave different halves). Use HalfForImage(i) - i is the image's stable index, the same image_id AddImage merges with - so deltaCChalf now reflects the exact CC1/2 split the statistics report, order-independently. Co-Authored-By: Claude Opus 4.8 (1M context) --- image_analysis/scale_merge/Merge.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/image_analysis/scale_merge/Merge.cpp b/image_analysis/scale_merge/Merge.cpp index 7a196d05..dd5aae6d 100644 --- a/image_analysis/scale_merge/Merge.cpp +++ b/image_analysis/scale_merge/Merge.cpp @@ -474,9 +474,6 @@ std::vector MergeOnTheFly::DeltaCChalfReject(const std::vector acc; std::vector img_half(outcomes.size(), 0); - std::mt19937 lrng{2026061600u}; - std::bernoulli_distribution hd{0.5}; - // ---- pass 1: accumulate half-set sums, record each image's half ---- auto contribution = [&](const Reflection &r, uint64_t &key, double &wI, double &w) -> bool { if (generator.IsSystematicallyAbsent(r)) return false; @@ -493,7 +490,9 @@ std::vector MergeOnTheFly::DeltaCChalfReject(const std::vector(i)); img_half[i] = half; for (const auto &r : outcomes[i].reflections) { uint64_t key; double wI, w;