FA-79041 / Image orientation metadata / Open access
Display matrix words are read as unsigned · case 01
Any rotated or mirrored video is reported as unsupported.
ROOT CAUSE
Negative 16.16 entries such as 0xFFFF0000 are not converted from two's complement.
VERIFIED REPAIR
Subtract 2^32 from words with the sign bit set.
Unsuccessful approach: Subtracting 2^16 confuses the fixed-point scale with the word width.
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 = list(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 == -1
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]}], [[[4294901760, 0, 0, 4294901760], 3685, 2612], {'rotate': 180, 'mirror': False, 'display': [3685, 2612]}], [[[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'], [[[4294901760, 0, 0, 4294901760], 2923, 1514], {'rotate': 180, 'mirror': False, 'display': [2923, 1514]}]], [[[[4294901760, 0, 0, 65536], 2552, 3331], {'rotate': 0, 'mirror': True, 'display': [2552, 3331]}], [[[4294901760, 0, 0, 4294901760], 66, 3419], {'rotate': 180, 'mirror': False, 'display': [66, 3419]}], [[[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'], [[[4294920955, 0, 131072, 65536], 2355, 1488], 'unsupported'], [[[65536, 0, 0, 4294901760], 2680, 1583], {'rotate': 180, 'mirror': True, 'display': [2680, 1583]}]], [[[[4294901760, 0, 0, 65536], 3751, 979], {'rotate': 0, 'mirror': True, 'display': [3751, 979]}], [[[0, 4294901760, 4294901760, 0], 2252, 2590], {'rotate': 90, 'mirror': True, 'display': [2590, 2252]}], [[[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'], [[[65536, 0, 0, 4294901760], 358, 2532], {'rotate': 180, 'mirror': True, 'display': [358, 2532]}]], [[[[0, 65536, 4294901760, 0], 2560, 3677], {'rotate': 90, 'mirror': False, 'display': [3677, 2560]}], [[[0, 4294901760, 4294901760, 0], 2907, 2127], {'rotate': 90, 'mirror': True, 'display': [2127, 2907]}], [[[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'], [[[65536, 0, 0, 4294901760], 2895, 2725], {'rotate': 180, 'mirror': True, 'display': [2895, 2725]}]], [[[[4294901760, 0, 0, 65536], 543, 1291], {'rotate': 0, 'mirror': True, 'display': [543, 1291]}], [[[0, 65536, 4294901760, 0], 1878, 1731], {'rotate': 90, 'mirror': False, 'display': [1731, 1878]}], [[[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'], [[[65536, 0, 0, 4294901760], 1985, 3076], {'rotate': 180, 'mirror': True, 'display': [1985, 3076]}]]]
labels = ["regression: signed fixed-point conversion", "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: signed fixed-point conversion 0 | unsupported | {'display': [3281, 760], 'mirror': True, 'rotate': 90} | Failed |
| repair trap 1 | unsupported | {'display': [3685, 2612], 'mirror': False, 'rotate': 180} | 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 | unsupported | {'display': [2923, 1514], 'mirror': False, 'rotate': 180} | Failed |
SHA-256 / acb116a8a9cbc44c5cb352d7e20be5056087be7b27d1acf99450db60ff1e9951
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 << 16) 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 == -1
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]}], [[[4294901760, 0, 0, 4294901760], 3685, 2612], {'rotate': 180, 'mirror': False, 'display': [3685, 2612]}], [[[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'], [[[4294901760, 0, 0, 4294901760], 2923, 1514], {'rotate': 180, 'mirror': False, 'display': [2923, 1514]}]], [[[[4294901760, 0, 0, 65536], 2552, 3331], {'rotate': 0, 'mirror': True, 'display': [2552, 3331]}], [[[4294901760, 0, 0, 4294901760], 66, 3419], {'rotate': 180, 'mirror': False, 'display': [66, 3419]}], [[[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'], [[[4294920955, 0, 131072, 65536], 2355, 1488], 'unsupported'], [[[65536, 0, 0, 4294901760], 2680, 1583], {'rotate': 180, 'mirror': True, 'display': [2680, 1583]}]], [[[[4294901760, 0, 0, 65536], 3751, 979], {'rotate': 0, 'mirror': True, 'display': [3751, 979]}], [[[0, 4294901760, 4294901760, 0], 2252, 2590], {'rotate': 90, 'mirror': True, 'display': [2590, 2252]}], [[[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'], [[[65536, 0, 0, 4294901760], 358, 2532], {'rotate': 180, 'mirror': True, 'display': [358, 2532]}]], [[[[0, 65536, 4294901760, 0], 2560, 3677], {'rotate': 90, 'mirror': False, 'display': [3677, 2560]}], [[[0, 4294901760, 4294901760, 0], 2907, 2127], {'rotate': 90, 'mirror': True, 'display': [2127, 2907]}], [[[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'], [[[65536, 0, 0, 4294901760], 2895, 2725], {'rotate': 180, 'mirror': True, 'display': [2895, 2725]}]], [[[[4294901760, 0, 0, 65536], 543, 1291], {'rotate': 0, 'mirror': True, 'display': [543, 1291]}], [[[0, 65536, 4294901760, 0], 1878, 1731], {'rotate': 90, 'mirror': False, 'display': [1731, 1878]}], [[[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'], [[[65536, 0, 0, 4294901760], 1985, 3076], {'rotate': 180, 'mirror': True, 'display': [1985, 3076]}]]]
labels = ["regression: signed fixed-point conversion", "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: signed fixed-point conversion 0 | unsupported | {'display': [3281, 760], 'mirror': True, 'rotate': 90} | Failed |
| repair trap 1 | unsupported | {'display': [3685, 2612], 'mirror': False, 'rotate': 180} | 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 | unsupported | {'display': [2923, 1514], 'mirror': False, 'rotate': 180} | Failed |
SHA-256 / e8eb7f8b064a39c5604ddf88d5c3b71621eae972cfcfb516cff69d3d95920835
3 / The verified repair
Exit 0"""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 == -1
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]}], [[[4294901760, 0, 0, 4294901760], 3685, 2612], {'rotate': 180, 'mirror': False, 'display': [3685, 2612]}], [[[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'], [[[4294901760, 0, 0, 4294901760], 2923, 1514], {'rotate': 180, 'mirror': False, 'display': [2923, 1514]}]], [[[[4294901760, 0, 0, 65536], 2552, 3331], {'rotate': 0, 'mirror': True, 'display': [2552, 3331]}], [[[4294901760, 0, 0, 4294901760], 66, 3419], {'rotate': 180, 'mirror': False, 'display': [66, 3419]}], [[[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'], [[[4294920955, 0, 131072, 65536], 2355, 1488], 'unsupported'], [[[65536, 0, 0, 4294901760], 2680, 1583], {'rotate': 180, 'mirror': True, 'display': [2680, 1583]}]], [[[[4294901760, 0, 0, 65536], 3751, 979], {'rotate': 0, 'mirror': True, 'display': [3751, 979]}], [[[0, 4294901760, 4294901760, 0], 2252, 2590], {'rotate': 90, 'mirror': True, 'display': [2590, 2252]}], [[[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'], [[[65536, 0, 0, 4294901760], 358, 2532], {'rotate': 180, 'mirror': True, 'display': [358, 2532]}]], [[[[0, 65536, 4294901760, 0], 2560, 3677], {'rotate': 90, 'mirror': False, 'display': [3677, 2560]}], [[[0, 4294901760, 4294901760, 0], 2907, 2127], {'rotate': 90, 'mirror': True, 'display': [2127, 2907]}], [[[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'], [[[65536, 0, 0, 4294901760], 2895, 2725], {'rotate': 180, 'mirror': True, 'display': [2895, 2725]}]], [[[[4294901760, 0, 0, 65536], 543, 1291], {'rotate': 0, 'mirror': True, 'display': [543, 1291]}], [[[0, 65536, 4294901760, 0], 1878, 1731], {'rotate': 90, 'mirror': False, 'display': [1731, 1878]}], [[[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'], [[[65536, 0, 0, 4294901760], 1985, 3076], {'rotate': 180, 'mirror': True, 'display': [1985, 3076]}]]]
labels = ["regression: signed fixed-point conversion", "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: signed fixed-point conversion 0 | {'display': [3281, 760], 'mirror': True, 'rotate': 90} | {'display': [3281, 760], 'mirror': True, 'rotate': 90} | Passed |
| repair trap 1 | {'display': [3685, 2612], 'mirror': False, 'rotate': 180} | {'display': [3685, 2612], 'mirror': False, 'rotate': 180} | Passed |
| 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': [2923, 1514], 'mirror': False, 'rotate': 180} | {'display': [2923, 1514], 'mirror': False, 'rotate': 180} | Passed |
SHA-256 / 033d8713819e1f61091e922d911fe5337aacb81950aa8a994950f4510c6a97ab
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:40.911969+00:00.
Case digest / f94538ce2949707cca349c3e3de0203e482bd33587b8e26cf82cd189408ad10f