← Documentation / SQL Reference
View DOI 1.18 on Zenodo: https://doi.org/10.5281/zenodo.22230202
New DBBuilt on the current, join-free pipeline (build_notta_tta_comp_db.py), one independent database per model.
SSIM's structure term S
and contrast term C have each been shown to lock to exactly 1
under an identifiable condition regardless of content (DOI
1.11, and 1.15/1.16).
This report completes the picture with SSIM's third and final
multiplicative term, luminance L: a proof mirroring the
contrast-term derivation exactly shows L=1 if and only if
μgt=μnotta.
Like DOI 1.15/1.16, every query is single-database, so all four
models are covered by one script that changes the
.open target between sections, in a single
continuous recording.
nonzero_mu_gt_eq_notta_discovery.sqlWITH candidates AS (
SELECT mu_gt
FROM blocks
WHERE mu_gt > 1e-6 AND ssim_l_notta = 1.0
),
total AS (
SELECT COUNT(*) AS n_total_blocks FROM blocks WHERE mu_gt > 1e-6
)
SELECT 'n_found' AS metric, CAST(COUNT(*) AS VARCHAR) AS value FROM candidates
UNION ALL SELECT 'pct_of_blocks', CAST(ROUND(100.0*COUNT(*)/(SELECT n_total_blocks FROM total),4) AS VARCHAR) FROM candidates
UNION ALL SELECT 'max_mu_gt', CAST(MAX(mu_gt) AS VARCHAR) FROM candidates
UNION ALL SELECT 'min_mu_gt', CAST(MIN(mu_gt) AS VARCHAR) FROM candidates;
-- Repeats identically for SwinIR, High-Fidelity, and Digital-Art.
This is only searchable because L=1 turns out to be
mathematically equivalent to
μgt=μnotta, not merely correlated
with it — the same substitution used for DOI 1.15's
contrast-term theorem, with C1 in place of
C2. That makes ssim_l_notta = 1.0 a
safe, exact search key even though μnotta itself
isn't a stored column. μgt>0 here means
excluding only completely black blocks (every pixel exactly
zero) — not every flat block, the way
σgt>0 does in DOI
1.16. Real ties turn up at a wider spread than the
contrast-term case: 0.218%–6.512% of blocks depending on
the model, topping out at SwinIR.
nonzero_mu_gt_eq_notta_discovery.sql (continued)WITH candidates AS (
SELECT ssim_c_notta, ssim_s_notta, (ssim_l_notta * ssim_c_notta * ssim_s_notta) AS ssim
FROM blocks
WHERE mu_gt > 1e-6 AND ssim_l_notta = 1.0
)
SELECT 'pct_trivial_ssim_eq_1' AS metric, CAST(ROUND(100.0*SUM(CASE WHEN ssim=1.0 THEN 1 ELSE 0 END)/COUNT(*),4) AS VARCHAR) AS value FROM candidates
UNION ALL SELECT 'pct_different_content_ssim_lt_1', CAST(ROUND(100.0*SUM(CASE WHEN ssim<1.0 THEN 1 ELSE 0 END)/COUNT(*),4) AS VARCHAR) FROM candidates
UNION ALL SELECT 'min_ssim_different_content', CAST(MIN(CASE WHEN ssim<1.0 THEN ssim END) AS VARCHAR) FROM candidates;
As in DOI 1.16, most of Part 1's ties aren't pixel-identical blocks (where SSIM=1 would follow trivially from SSIM's own formula): the majority, 77.64%–99.97% of found ties depending on the model, involve genuinely different content that merely happens to share the same mean brightness. Upscayl High-Fidelity is a sharp outlier here — 99.97% different content, meaning pixel-identical reconstruction is nearly absent for that model.
Unlike DOI 1.16, two models (Standard and SwinIR) contain
concrete blocks where L=1 exactly yet the aggregate SSIM score
is negative — as low as −0.0854 for
Standard. In the worst case
(image_id=00000099_012, row 113, col 127,
μgt=0.7397), C=0.9539 and S=−0.0896 combine
to pull the aggregate score negative despite the luminance term
being pinned at exactly 1. High-Fidelity and Digital-Art's
different-content populations never fall below 0.20 and 0.12
respectively — the same coincidental tie in L has a
materially different effect on the aggregate score depending on
the model. As with DOI 1.16's contrast-term case, this
coincidence doesn't fool SSIM as a whole on its own; only L is
mathematically guaranteed to tie here, and C and S stay free to
reflect how different the content really is — it's Part 4
below that asks whether all three can tie at once.
mu_gt_discreteness_check.sqlThe same 8-bit quantization mechanism from DOI 1.16 applies to μgt too (see 8-bit pixel quantization and its worked example in the Glossary) — only here it's even sharper. Measuring across the shared, model-independent GT population directly:
WITH pop AS (
SELECT mu_gt FROM blocks WHERE mu_gt > 1e-6
)
SELECT 'n_total_blocks' AS metric, CAST(COUNT(*) AS VARCHAR) AS value FROM pop
UNION ALL SELECT 'n_distinct_mu_gt_values', CAST(COUNT(DISTINCT mu_gt) AS VARCHAR) FROM pop
UNION ALL SELECT 'avg_blocks_per_distinct_value', CAST(ROUND(COUNT(*)*1.0/COUNT(DISTINCT mu_gt),2) AS VARCHAR) FROM pop;
μgt depends only on the shared ground-truth image, not the model, so this query runs once and the result is identical across all four — confirmed directly here, rather than by assumption, by independently re-running it against both Standard's and SwinIR's databases and finding byte-for-byte identical results. Of 80,457,746 blocks, only 68,649 distinct μgt values exist — an average of 1,172.02 blocks sharing each exact value, over 30 times more concentrated than σgt's 34.36. The most frequent values are exact multiples of 1/255 (uniform, near-black blocks) — the same structurally-guaranteed source of ties that Part 1 excludes at μgt=0 exactly.
joint_term_identity_check_4model.sqlParts 1–2 showed that L alone can tie coincidentally without protecting the aggregate score. That raises a sharper question: could L, C, and S all tie to exactly 1 at once, for content that isn't pixel-identical — which would fool the complete SSIM=1.0 verdict, not just one term? L, C, and S are each mathematically bounded above by exactly 1 (equality iff μgt=μnotta, σgt=σnotta, and ρ=1 respectively) and all three are strictly positive by construction — so three positive numbers, each at most 1, whose product equals exactly 1 must each individually equal exactly 1. That makes the L=C=S=1 population identical to the Pixel Identity Theorem's SSIM=1.0 population, already shown to force pixel-identical reconstruction. A coincidental joint alignment for different content should therefore be algebraically impossible, not merely unobserved.
ρ is worth pausing on, since it's easy to conflate with σgt given both use σ somewhere in their formula — they measure completely different things. σgt (used throughout DOI 1.16) is about how spread out one block's own values are. ρ is about whether two blocks' values rise and fall in the same proportion, regardless of either block's actual brightness or spread:
A worked example: the reconstruction is brighter overall (μ) and less spread out (σ) than the ground truth — so L and C would both be well below 1 here — but each step rises in exactly the same proportion (a perfect straight-line relationship, reconstruction = 0.5×ground truth + 130), so ρ=1 and S is unaffected by the brightness/spread mismatch that drags down L and C.
ρ=1 above is only a boundary case, not a special value that ρ is somehow restricted to — like μgt or σgt, ρ is a continuous quantity that takes whatever value the actual pixels produce, anywhere from −1 to 1. A small worked example makes that concrete, and also shows the flip side of the diagram above: matching μ and σ exactly doesn't guarantee ρ=1.
Same worked example as above, but with the reconstruction's second and third pixels swapped instead of rescaled. The mean and spread are now identical to the ground truth's (so L=1 and C=1 exactly) — but the swap alone is enough to drop ρ (and with it, S) from 1 to 0.8, since the two blocks no longer rise and fall in step position-by-position. This is a concrete, hand-checkable instance of Part 2's finding above: L and C tying doesn't protect the score, because S is free to catch a mismatch neither of them can see.
WITH candidates AS (
SELECT
(ssim_l_notta * ssim_c_notta * ssim_s_notta) AS ssim,
(ssim_l_notta = 1.0 AND ssim_c_notta = 1.0 AND ssim_s_notta = 1.0) AS all_three_eq_1
FROM blocks
)
SELECT 'n_all_three_eq_1' AS metric, CAST(SUM(CASE WHEN all_three_eq_1 THEN 1 ELSE 0 END) AS VARCHAR) AS value FROM candidates
UNION ALL SELECT 'n_product_eq_1', CAST(SUM(CASE WHEN ssim = 1.0 THEN 1 ELSE 0 END) AS VARCHAR) FROM candidates
UNION ALL SELECT 'n_product_eq_1_but_not_all_three', CAST(SUM(CASE WHEN ssim = 1.0 AND NOT all_three_eq_1 THEN 1 ELSE 0 END) AS VARCHAR) FROM candidates
UNION ALL SELECT 'n_all_three_but_product_not_1', CAST(SUM(CASE WHEN all_three_eq_1 AND ssim <> 1.0 THEN 1 ELSE 0 END) AS VARCHAR) FROM candidates;
-- Repeats identically for SwinIR, High-Fidelity, and Digital-Art.
Real results confirm it: of 4,734,946 blocks with SSIM=1.0 exactly across all four models, all but 1,442 (SwinIR only, 0.030% of that model's SSIM=1.0 population) also had all three terms bit-exact at 1.0. Standard, High-Fidelity, and Digital-Art had zero exceptions in either direction.
joint_term_identity_swinir_exception_diagnostic.sqlInspecting those 1,442 cases directly shows L exactly 1.0 in every case, with C and S each off from 1.0 by exactly one double-precision machine-epsilon step (±2.220446049250313×10−16) in opposite, compensating directions — floating-point rounding in the product, not a violation of any bound. No case in any model had any term actually exceed 1.0 by more than this single-ULP margin, confirming the algebra rather than contradicting it.