FA-79046 / Image orientation metadata / Open access
Mirrored quarter-turn videos are not detected as mirrored · case 01
A mirrored portrait clip shows the right rotation count only by chance and never flips.
ROOT CAUSE
Mirroring is inferred from the diagonal product, which is zero for quarter turns.
THE FAILURE
Mirroring is inferred from the diagonal product, which is zero for quarter turns.
Unsuccessful approach: Excluding a == 0 still misses every mirrored 90/270 matrix.
Case contract
Input [matrix, width, height] where matrix is the [a, b, c, d] part of a track display matrix stored as unsigned 32-bit 16.16 fixed-point words (x' = a*x + c*y, y' = b*x + d*y, screen y down). Only signed permutation matrices of unit entries are supported, otherwise "unsupported". A negative determinant means a left-right mirror applied before the rotation; the clockwise rotation is read from the image of the x axis after removing the mirror. Return rotate (0/90/180/270), mirror and the displayed [width, height].
Why this case matters
Camera, phone and scanner images carry an orientation hint separately from the stored pixels; galleries, thumbnailers, editors and upload pipelines must interpret it consistently or photos appear sideways, mirrored or doubly rotated.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
m, w, h = x
U = 65536
m = [v - (1 << 32) if v >= (1 << 31) else v for v in m]
a, b, c, d = m
if any(v not in (-U, 0, U) for v in m):
return 'unsupported'
if not ((b == 0 and c == 0 and a != 0 and d != 0) or (a == 0 and d == 0 and b != 0 and c != 0)):
return 'unsupported'
det = (a * d - b * c) // (U * U)
mirror = a * d < 0
if mirror:
a, b = -a, -b
deg = {(U, 0): 0, (0, U): 90, (-U, 0): 180, (0, -U): 270}[(a, b)]
if deg in (90, 270):
w, h = h, w
return {'rotate': deg, 'mirror': mirror, 'display': [w, h]}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[[[0, 4294901760, 4294901760, 0], 760, 3281], {'rotate': 90, 'mirror': True, 'display': [3281, 760]}], [[[0, 4294901760, 4294901760, 0], 1355, 3779], {'rotate': 90, 'mirror': True, 'display': [3779, 1355]}], [[[4294901760, 0, 65536, 4294901760], 3830, 2696], 'unsupported'], [[[0, 65536, 4294901760, 65536], 559, 2713], 'unsupported'], [[[0, 65536, 4294901760, 65536], 1463, 780], 'unsupported'], [[[65536, 4294901760, 65536, 65536], 2751, 608], 'unsupported'], [[[0, 0, 4294901760, 0], 1243, 3391], 'unsupported'], [[[0, 4294901760, 4294901760, 0], 3070, 241], {'rotate': 90, 'mirror': True, 'display': [241, 3070]}]], [[[[0, 65536, 65536, 0], 1609, 1135], {'rotate': 270, 'mirror': True, 'display': [1135, 1609]}], [[[0, 4294901760, 4294901760, 0], 2248, 3332], {'rotate': 90, 'mirror': True, 'display': [3332, 2248]}], [[[4294901760, 0, 4294901760, 4294901760], 2730, 1220], 'unsupported'], [[[65536, 4294901760, 0, 4294901760], 3622, 60], 'unsupported'], [[[0, 4294901760, 65536, 65536], 1290, 2847], 'unsupported'], [[[65536, 0, 4294901760, 65536], 1369, 1577], 'unsupported'], [[[0, 4294901760, 65536, 0], 1556, 1750], {'rotate': 270, 'mirror': False, 'display': [1750, 1556]}], [[[0, 65536, 65536, 0], 726, 1337], {'rotate': 270, 'mirror': True, 'display': [1337, 726]}]], [[[[0, 65536, 65536, 0], 1867, 158], {'rotate': 270, 'mirror': True, 'display': [158, 1867]}], [[[0, 65536, 65536, 0], 2157, 3750], {'rotate': 270, 'mirror': True, 'display': [3750, 2157]}], [[[4294901760, 0, 65536, 0], 3442, 2421], 'unsupported'], [[[4294901760, 65536, 4294901760, 0], 392, 1027], 'unsupported'], [[[4294901760, 0, 4294901760, 65536], 1363, 2590], 'unsupported'], [[[4294901760, 0, 65536, 0], 3783, 1537], 'unsupported'], [[[0, 0, 0, 65536], 714, 1938], 'unsupported'], [[[0, 4294901760, 4294901760, 0], 2252, 2590], {'rotate': 90, 'mirror': True, 'display': [2590, 2252]}]], [[[[0, 65536, 65536, 0], 918, 2181], {'rotate': 270, 'mirror': True, 'display': [2181, 918]}], [[[0, 65536, 65536, 0], 2244, 3320], {'rotate': 270, 'mirror': True, 'display': [3320, 2244]}], [[[0, 0, 46341, 0], 991, 438], 'unsupported'], [[[65536, 0, 65536, 65536], 1287, 3950], 'unsupported'], [[[0, 65536, 0, 0], 2790, 437], 'unsupported'], [[[0, 4294901760, 65536, 4294901760], 3527, 100], 'unsupported'], [[[65536, 4294901760, 65536, 4294901760], 2961, 612], 'unsupported'], [[[0, 65536, 65536, 0], 3426, 462], {'rotate': 270, 'mirror': True, 'display': [462, 3426]}]], [[[[0, 4294901760, 4294901760, 0], 1314, 1168], {'rotate': 90, 'mirror': True, 'display': [1168, 1314]}], [[[0, 65536, 65536, 0], 2027, 2132], {'rotate': 270, 'mirror': True, 'display': [2132, 2027]}], [[[4294901760, 65536, 65536, 65536], 1654, 584], 'unsupported'], [[[4294901760, 65536, 65536, 0], 1703, 3849], 'unsupported'], [[[65536, 4294901760, 4294901760, 4294901760], 132, 2157], 'unsupported'], [[[0, 4294901760, 0, 0], 3596, 3944], 'unsupported'], [[[4294901760, 32768, 32768, 4294901760], 1623, 1094], 'unsupported'], [[[0, 4294901760, 4294901760, 0], 1874, 407], {'rotate': 90, 'mirror': True, 'display': [407, 1874]}]]]
labels = ["regression: mirror detection by determinant", "repair trap", "combined fault", "control", "control", "boundary", "boundary", "control"]
for i, (args, expected) in enumerate(fixtures[N-1]):
check("%s %d" % (labels[i % len(labels)], i), solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: mirror detection by determinant 0 | {'display': [3281, 760], 'mirror': False, 'rotate': 270} | {'display': [3281, 760], 'mirror': True, 'rotate': 90} | Failed |
| repair trap 1 | {'display': [3779, 1355], 'mirror': False, 'rotate': 270} | {'display': [3779, 1355], 'mirror': True, 'rotate': 90} | Failed |
| combined fault 2 | unsupported | unsupported | Passed |
| control 3 | unsupported | unsupported | Passed |
| control 4 | unsupported | unsupported | Passed |
| boundary 5 | unsupported | unsupported | Passed |
| boundary 6 | unsupported | unsupported | Passed |
| control 7 | {'display': [241, 3070], 'mirror': False, 'rotate': 270} | {'display': [241, 3070], 'mirror': True, 'rotate': 90} | Failed |
SHA-256 / 1e5549d399aa9a608c7371ec7d98317a9c877582fb68c7e1bf2256b953a3247a
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
m, w, h = x
U = 65536
m = [v - (1 << 32) if v >= (1 << 31) else v for v in m]
a, b, c, d = m
if any(v not in (-U, 0, U) for v in m):
return 'unsupported'
if not ((b == 0 and c == 0 and a != 0 and d != 0) or (a == 0 and d == 0 and b != 0 and c != 0)):
return 'unsupported'
det = (a * d - b * c) // (U * U)
mirror = det < 0 and a != 0
if mirror:
a, b = -a, -b
deg = {(U, 0): 0, (0, U): 90, (-U, 0): 180, (0, -U): 270}[(a, b)]
if deg in (90, 270):
w, h = h, w
return {'rotate': deg, 'mirror': mirror, 'display': [w, h]}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[[[0, 4294901760, 4294901760, 0], 760, 3281], {'rotate': 90, 'mirror': True, 'display': [3281, 760]}], [[[0, 4294901760, 4294901760, 0], 1355, 3779], {'rotate': 90, 'mirror': True, 'display': [3779, 1355]}], [[[4294901760, 0, 65536, 4294901760], 3830, 2696], 'unsupported'], [[[0, 65536, 4294901760, 65536], 559, 2713], 'unsupported'], [[[0, 65536, 4294901760, 65536], 1463, 780], 'unsupported'], [[[65536, 4294901760, 65536, 65536], 2751, 608], 'unsupported'], [[[0, 0, 4294901760, 0], 1243, 3391], 'unsupported'], [[[0, 4294901760, 4294901760, 0], 3070, 241], {'rotate': 90, 'mirror': True, 'display': [241, 3070]}]], [[[[0, 65536, 65536, 0], 1609, 1135], {'rotate': 270, 'mirror': True, 'display': [1135, 1609]}], [[[0, 4294901760, 4294901760, 0], 2248, 3332], {'rotate': 90, 'mirror': True, 'display': [3332, 2248]}], [[[4294901760, 0, 4294901760, 4294901760], 2730, 1220], 'unsupported'], [[[65536, 4294901760, 0, 4294901760], 3622, 60], 'unsupported'], [[[0, 4294901760, 65536, 65536], 1290, 2847], 'unsupported'], [[[65536, 0, 4294901760, 65536], 1369, 1577], 'unsupported'], [[[0, 4294901760, 65536, 0], 1556, 1750], {'rotate': 270, 'mirror': False, 'display': [1750, 1556]}], [[[0, 65536, 65536, 0], 726, 1337], {'rotate': 270, 'mirror': True, 'display': [1337, 726]}]], [[[[0, 65536, 65536, 0], 1867, 158], {'rotate': 270, 'mirror': True, 'display': [158, 1867]}], [[[0, 65536, 65536, 0], 2157, 3750], {'rotate': 270, 'mirror': True, 'display': [3750, 2157]}], [[[4294901760, 0, 65536, 0], 3442, 2421], 'unsupported'], [[[4294901760, 65536, 4294901760, 0], 392, 1027], 'unsupported'], [[[4294901760, 0, 4294901760, 65536], 1363, 2590], 'unsupported'], [[[4294901760, 0, 65536, 0], 3783, 1537], 'unsupported'], [[[0, 0, 0, 65536], 714, 1938], 'unsupported'], [[[0, 4294901760, 4294901760, 0], 2252, 2590], {'rotate': 90, 'mirror': True, 'display': [2590, 2252]}]], [[[[0, 65536, 65536, 0], 918, 2181], {'rotate': 270, 'mirror': True, 'display': [2181, 918]}], [[[0, 65536, 65536, 0], 2244, 3320], {'rotate': 270, 'mirror': True, 'display': [3320, 2244]}], [[[0, 0, 46341, 0], 991, 438], 'unsupported'], [[[65536, 0, 65536, 65536], 1287, 3950], 'unsupported'], [[[0, 65536, 0, 0], 2790, 437], 'unsupported'], [[[0, 4294901760, 65536, 4294901760], 3527, 100], 'unsupported'], [[[65536, 4294901760, 65536, 4294901760], 2961, 612], 'unsupported'], [[[0, 65536, 65536, 0], 3426, 462], {'rotate': 270, 'mirror': True, 'display': [462, 3426]}]], [[[[0, 4294901760, 4294901760, 0], 1314, 1168], {'rotate': 90, 'mirror': True, 'display': [1168, 1314]}], [[[0, 65536, 65536, 0], 2027, 2132], {'rotate': 270, 'mirror': True, 'display': [2132, 2027]}], [[[4294901760, 65536, 65536, 65536], 1654, 584], 'unsupported'], [[[4294901760, 65536, 65536, 0], 1703, 3849], 'unsupported'], [[[65536, 4294901760, 4294901760, 4294901760], 132, 2157], 'unsupported'], [[[0, 4294901760, 0, 0], 3596, 3944], 'unsupported'], [[[4294901760, 32768, 32768, 4294901760], 1623, 1094], 'unsupported'], [[[0, 4294901760, 4294901760, 0], 1874, 407], {'rotate': 90, 'mirror': True, 'display': [407, 1874]}]]]
labels = ["regression: mirror detection by determinant", "repair trap", "combined fault", "control", "control", "boundary", "boundary", "control"]
for i, (args, expected) in enumerate(fixtures[N-1]):
check("%s %d" % (labels[i % len(labels)], i), solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: mirror detection by determinant 0 | {'display': [3281, 760], 'mirror': False, 'rotate': 270} | {'display': [3281, 760], 'mirror': True, 'rotate': 90} | Failed |
| repair trap 1 | {'display': [3779, 1355], 'mirror': False, 'rotate': 270} | {'display': [3779, 1355], 'mirror': True, 'rotate': 90} | Failed |
| combined fault 2 | unsupported | unsupported | Passed |
| control 3 | unsupported | unsupported | Passed |
| control 4 | unsupported | unsupported | Passed |
| boundary 5 | unsupported | unsupported | Passed |
| boundary 6 | unsupported | unsupported | Passed |
| control 7 | {'display': [241, 3070], 'mirror': False, 'rotate': 270} | {'display': [241, 3070], 'mirror': True, 'rotate': 90} | Failed |
SHA-256 / ee01b9ad06c40555d2f6cf5fbc9237a921ea524a19077d141d3ddf3398c1a044
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 8 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.
Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.
Member access is invitation-based. Sign in with your invited account to inspect the repair.
Sign in to the archive ↗Verification & scope
A deterministic bounded teaching model with a stipulated contract; it makes no claim of conformance to any published specification. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-29T14:49:41.126019+00:00.
Case digest / baa623d22261efbda443a3ee3bec6a49e3eff7cd870dcb6f5f82195a6ea14994