FAILURE MAP
← Case archive

FA-79051 / Image orientation metadata / Open access

Displayed video size ignores quarter turns · case 01

Rotated videos are laid out in a landscape box and letterboxed.

Verified by executionVariant 1 · 8 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The width and height swap is keyed on the mirror flag rather than on quarter-turn rotations.

VERIFIED REPAIR

Swap the displayed width and height for 90 and 270 degree rotations.

Unsuccessful approach: Swapping only for 90 degrees leaves 270 degree tracks in the wrong box.

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 = det == -1
    if mirror:
        a, b = -a, -b
    deg = {(U, 0): 0, (0, U): 90, (-U, 0): 180, (0, -U): 270}[(a, b)]
    if mirror:
        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 = [[[[[65536, 0, 0, 4294901760], 3304, 252], {'rotate': 180, 'mirror': True, 'display': [3304, 252]}], [[[0, 65536, 65536, 0], 3950, 2395], {'rotate': 270, 'mirror': True, 'display': [2395, 3950]}], [[[0, 4294901760, 65536, 0], 307, 2589], {'rotate': 270, 'mirror': False, 'display': [2589, 307]}], [[[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'], [[[4294901760, 0, 0, 65536], 3623, 1679], {'rotate': 0, 'mirror': True, 'display': [3623, 1679]}]], [[[[4294901760, 0, 0, 65536], 2552, 3331], {'rotate': 0, 'mirror': True, 'display': [2552, 3331]}], [[[0, 65536, 65536, 0], 3389, 3534], {'rotate': 270, 'mirror': True, 'display': [3534, 3389]}], [[[0, 4294901760, 65536, 0], 1556, 1750], {'rotate': 270, 'mirror': False, 'display': [1750, 1556]}], [[[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'], [[[65536, 0, 0, 4294901760], 2680, 1583], {'rotate': 180, 'mirror': True, 'display': [2680, 1583]}]], [[[[0, 65536, 4294901760, 0], 3412, 3662], {'rotate': 90, 'mirror': False, 'display': [3662, 3412]}], [[[0, 4294901760, 65536, 0], 2441, 118], {'rotate': 270, 'mirror': False, 'display': [118, 2441]}], [[[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'], [[[4294901760, 0, 0, 65536], 3751, 979], {'rotate': 0, 'mirror': True, 'display': [3751, 979]}]], [[[[65536, 0, 0, 4294901760], 2538, 1637], {'rotate': 180, 'mirror': True, 'display': [2538, 1637]}], [[[0, 4294901760, 65536, 0], 1828, 292], {'rotate': 270, 'mirror': False, 'display': [292, 1828]}], [[[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, 4294901760, 0], 2560, 3677], {'rotate': 90, 'mirror': False, 'display': [3677, 2560]}]], [[[[0, 65536, 4294901760, 0], 1708, 2732], {'rotate': 90, 'mirror': False, 'display': [2732, 1708]}], [[[0, 65536, 65536, 0], 787, 2116], {'rotate': 270, 'mirror': True, 'display': [2116, 787]}], [[[0, 4294901760, 65536, 0], 3539, 3680], {'rotate': 270, 'mirror': False, 'display': [3680, 3539]}], [[[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: displayed size swap", "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 fixtureActualExpectedOutcome
regression: displayed size swap 0{'display': [252, 3304], 'mirror': True, 'rotate': 180}{'display': [3304, 252], 'mirror': True, 'rotate': 180}Failed
repair trap 1{'display': [2395, 3950], 'mirror': True, 'rotate': 270}{'display': [2395, 3950], 'mirror': True, 'rotate': 270}Passed
combined fault 2{'display': [307, 2589], 'mirror': False, 'rotate': 270}{'display': [2589, 307], 'mirror': False, 'rotate': 270}Failed
control 3unsupportedunsupportedPassed
control 4unsupportedunsupportedPassed
boundary 5unsupportedunsupportedPassed
boundary 6unsupportedunsupportedPassed
control 7{'display': [1679, 3623], 'mirror': True, 'rotate': 0}{'display': [3623, 1679], 'mirror': True, 'rotate': 0}Failed

SHA-256 / 26c36923b23057108e51f5d0c55e8fd10c59cf40a07801fe6d022576f736b4eb

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 == -1
    if mirror:
        a, b = -a, -b
    deg = {(U, 0): 0, (0, U): 90, (-U, 0): 180, (0, -U): 270}[(a, b)]
    if deg == 90:
        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 = [[[[[65536, 0, 0, 4294901760], 3304, 252], {'rotate': 180, 'mirror': True, 'display': [3304, 252]}], [[[0, 65536, 65536, 0], 3950, 2395], {'rotate': 270, 'mirror': True, 'display': [2395, 3950]}], [[[0, 4294901760, 65536, 0], 307, 2589], {'rotate': 270, 'mirror': False, 'display': [2589, 307]}], [[[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'], [[[4294901760, 0, 0, 65536], 3623, 1679], {'rotate': 0, 'mirror': True, 'display': [3623, 1679]}]], [[[[4294901760, 0, 0, 65536], 2552, 3331], {'rotate': 0, 'mirror': True, 'display': [2552, 3331]}], [[[0, 65536, 65536, 0], 3389, 3534], {'rotate': 270, 'mirror': True, 'display': [3534, 3389]}], [[[0, 4294901760, 65536, 0], 1556, 1750], {'rotate': 270, 'mirror': False, 'display': [1750, 1556]}], [[[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'], [[[65536, 0, 0, 4294901760], 2680, 1583], {'rotate': 180, 'mirror': True, 'display': [2680, 1583]}]], [[[[0, 65536, 4294901760, 0], 3412, 3662], {'rotate': 90, 'mirror': False, 'display': [3662, 3412]}], [[[0, 4294901760, 65536, 0], 2441, 118], {'rotate': 270, 'mirror': False, 'display': [118, 2441]}], [[[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'], [[[4294901760, 0, 0, 65536], 3751, 979], {'rotate': 0, 'mirror': True, 'display': [3751, 979]}]], [[[[65536, 0, 0, 4294901760], 2538, 1637], {'rotate': 180, 'mirror': True, 'display': [2538, 1637]}], [[[0, 4294901760, 65536, 0], 1828, 292], {'rotate': 270, 'mirror': False, 'display': [292, 1828]}], [[[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, 4294901760, 0], 2560, 3677], {'rotate': 90, 'mirror': False, 'display': [3677, 2560]}]], [[[[0, 65536, 4294901760, 0], 1708, 2732], {'rotate': 90, 'mirror': False, 'display': [2732, 1708]}], [[[0, 65536, 65536, 0], 787, 2116], {'rotate': 270, 'mirror': True, 'display': [2116, 787]}], [[[0, 4294901760, 65536, 0], 3539, 3680], {'rotate': 270, 'mirror': False, 'display': [3680, 3539]}], [[[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: displayed size swap", "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 fixtureActualExpectedOutcome
regression: displayed size swap 0{'display': [3304, 252], 'mirror': True, 'rotate': 180}{'display': [3304, 252], 'mirror': True, 'rotate': 180}Passed
repair trap 1{'display': [3950, 2395], 'mirror': True, 'rotate': 270}{'display': [2395, 3950], 'mirror': True, 'rotate': 270}Failed
combined fault 2{'display': [307, 2589], 'mirror': False, 'rotate': 270}{'display': [2589, 307], 'mirror': False, 'rotate': 270}Failed
control 3unsupportedunsupportedPassed
control 4unsupportedunsupportedPassed
boundary 5unsupportedunsupportedPassed
boundary 6unsupportedunsupportedPassed
control 7{'display': [3623, 1679], 'mirror': True, 'rotate': 0}{'display': [3623, 1679], 'mirror': True, 'rotate': 0}Passed

SHA-256 / ec22a7af5efadf3765cac173a07101b549a5e9fd783a8b414adcf77762378bb6

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 = [[[[[65536, 0, 0, 4294901760], 3304, 252], {'rotate': 180, 'mirror': True, 'display': [3304, 252]}], [[[0, 65536, 65536, 0], 3950, 2395], {'rotate': 270, 'mirror': True, 'display': [2395, 3950]}], [[[0, 4294901760, 65536, 0], 307, 2589], {'rotate': 270, 'mirror': False, 'display': [2589, 307]}], [[[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'], [[[4294901760, 0, 0, 65536], 3623, 1679], {'rotate': 0, 'mirror': True, 'display': [3623, 1679]}]], [[[[4294901760, 0, 0, 65536], 2552, 3331], {'rotate': 0, 'mirror': True, 'display': [2552, 3331]}], [[[0, 65536, 65536, 0], 3389, 3534], {'rotate': 270, 'mirror': True, 'display': [3534, 3389]}], [[[0, 4294901760, 65536, 0], 1556, 1750], {'rotate': 270, 'mirror': False, 'display': [1750, 1556]}], [[[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'], [[[65536, 0, 0, 4294901760], 2680, 1583], {'rotate': 180, 'mirror': True, 'display': [2680, 1583]}]], [[[[0, 65536, 4294901760, 0], 3412, 3662], {'rotate': 90, 'mirror': False, 'display': [3662, 3412]}], [[[0, 4294901760, 65536, 0], 2441, 118], {'rotate': 270, 'mirror': False, 'display': [118, 2441]}], [[[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'], [[[4294901760, 0, 0, 65536], 3751, 979], {'rotate': 0, 'mirror': True, 'display': [3751, 979]}]], [[[[65536, 0, 0, 4294901760], 2538, 1637], {'rotate': 180, 'mirror': True, 'display': [2538, 1637]}], [[[0, 4294901760, 65536, 0], 1828, 292], {'rotate': 270, 'mirror': False, 'display': [292, 1828]}], [[[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, 4294901760, 0], 2560, 3677], {'rotate': 90, 'mirror': False, 'display': [3677, 2560]}]], [[[[0, 65536, 4294901760, 0], 1708, 2732], {'rotate': 90, 'mirror': False, 'display': [2732, 1708]}], [[[0, 65536, 65536, 0], 787, 2116], {'rotate': 270, 'mirror': True, 'display': [2116, 787]}], [[[0, 4294901760, 65536, 0], 3539, 3680], {'rotate': 270, 'mirror': False, 'display': [3680, 3539]}], [[[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: displayed size swap", "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 fixtureActualExpectedOutcome
regression: displayed size swap 0{'display': [3304, 252], 'mirror': True, 'rotate': 180}{'display': [3304, 252], 'mirror': True, 'rotate': 180}Passed
repair trap 1{'display': [2395, 3950], 'mirror': True, 'rotate': 270}{'display': [2395, 3950], 'mirror': True, 'rotate': 270}Passed
combined fault 2{'display': [2589, 307], 'mirror': False, 'rotate': 270}{'display': [2589, 307], 'mirror': False, 'rotate': 270}Passed
control 3unsupportedunsupportedPassed
control 4unsupportedunsupportedPassed
boundary 5unsupportedunsupportedPassed
boundary 6unsupportedunsupportedPassed
control 7{'display': [3623, 1679], 'mirror': True, 'rotate': 0}{'display': [3623, 1679], 'mirror': True, 'rotate': 0}Passed

SHA-256 / 80fd3a18ef2af2ede223e853acf353cde799cf2d83d3891749706850dc7bbdcc

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.125789+00:00.

Case digest / c0c9c7cc2a5d045b434c7c24ca0e20588075f261e31087611b530e7b7265a99c