{"abstract":"Rotated 4:2:2 JPEGs lose the wrong number of edge pixels or keep a partial block that shifts the image.","category":"Image orientation metadata","checks":8,"contract":"Input [w, h, tag, sampling]. A lossless JPEG transform that bakes the orientation can only move whole MCUs (444: 8x8, 422: 16 wide x 8 high, 420: 16x16, 440: 8 wide x 16 high), so any partial MCU column or row that would move to the leading edge is trimmed. The tag decomposes into stored-space flips (fx, fy) followed by an optional transpose; fx trims the width and fy trims the height to a multiple of the MCU size. Invalid tags are treated as 1. Return the displayed [width, height], \"refuse\" when a trimmed side becomes 0, or \"unknown-sampling\".","evaluation_group":"w2-image-orientation-metadata-lossless-mcu-trim","failed_approach":"A 16x16 MCU over-trims the height of 4:2:2 images.","family":"w2-image-orientation-metadata-lossless-mcu-trim-422-mcu-shape","id":"FA-79056","implementations":{"attempt":{"sha256":"1ed0167d5623b57c3947eb41924ba304b3ec31c9a1ba3cf2213d2fde8b423334","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    w, h, tag, sampling = x\n    mcu = {'444': (8, 8), '422': (16, 16), '420': (16, 16), '440': (8, 16)}\n    if sampling not in mcu:\n        return 'unknown-sampling'\n    mw, mh = mcu[sampling]\n    flips = {1: (0, 0, 0), 2: (1, 0, 0), 3: (1, 1, 0), 4: (0, 1, 0), 5: (0, 0, 1), 6: (0, 1, 1), 7: (1, 1, 1), 8: (1, 0, 1)}\n    fx, fy, tr = flips.get(tag, (0, 0, 0))\n    tw = w - w % mw if fx else w\n    th = h - h % mh if fy else h\n    if tw == 0 or th == 0:\n        return 'refuse'\n    if tr:\n        tw, th = th, tw\n    return [tw, th]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[[[8, 24, 3, '422'], 'refuse'], [[22, 12, 7, '422'], [8, 16]], [[81, 1275, 6, '422'], [1272, 81]], [[24, 12, 0, '440'], [24, 12]], [[2969, 96, 1, '422'], [2969, 96]], [[24, 16, 5, '422'], [16, 24]], [[40, 2600, 0, '440'], [40, 2600]], [[12, 8, 8, '422'], 'refuse']], [[[12, 8, 6, '422'], [8, 12]], [[86, 2621, 4, '422'], [86, 2616]], [[25, 40, 4, '422'], [25, 40]], [[12, 1946, 4, '420'], [12, 1936]], [[8, 12, 1, '411'], 'unknown-sampling'], [[25, 8, 8, '420'], [8, 16]], [[24, 24, 2, '440'], [24, 24]], [[12, 24, 8, '422'], 'refuse']], [[[8, 8, 8, '422'], 'refuse'], [[16, 24, 7, '422'], [24, 16]], [[36, 24, 3, '422'], [32, 24]], [[24, 8, 4, '444'], [24, 8]], [[12, 12, 3, '420'], 'refuse'], [[24, 24, 0, '420'], [24, 24]], [[8, 20, 6, '420'], [16, 8]], [[24, 12, 6, '422'], [8, 24]]], [[[8, 60, 6, '422'], [56, 8]], [[40, 8, 3, '422'], [32, 8]], [[2427, 12, 6, '422'], [8, 2427]], [[24, 12, 6, '420'], 'refuse'], [[40, 8, 5, '440'], [8, 40]], [[16, 272, 4, '422'], [16, 272]], [[24, 16, 6, '440'], [16, 24]], [[61, 12, 2, '422'], [48, 12]]], [[[8, 16, 8, '422'], 'refuse'], [[24, 12, 7, '422'], [8, 16]], [[12, 8, 6, '422'], [8, 12]], [[8, 67, 7, '444'], [64, 8]], [[16, 24, 2, '411'], 'unknown-sampling'], [[40, 18, 1, '420'], [40, 18]], [[79, 24, 7, '440'], [16, 72]], [[24, 8, 6, '422'], [8, 24]]]]\nlabels = [\"regression: 4:2:2 MCU geometry\", \"repair trap\", \"combined fault\", \"control\", \"control\", \"boundary\", \"boundary\", \"control\"]\nfor i, (args, expected) in enumerate(fixtures[N-1]):\n    check(\"%s %d\" % (labels[i % len(labels)], i), solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"bc9c2adf4e39d74372f64a18254acb6e09c6045c2151669566d046df7be56543","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    w, h, tag, sampling = x\n    mcu = {'444': (8, 8), '422': (8, 16), '420': (16, 16), '440': (8, 16)}\n    if sampling not in mcu:\n        return 'unknown-sampling'\n    mw, mh = mcu[sampling]\n    flips = {1: (0, 0, 0), 2: (1, 0, 0), 3: (1, 1, 0), 4: (0, 1, 0), 5: (0, 0, 1), 6: (0, 1, 1), 7: (1, 1, 1), 8: (1, 0, 1)}\n    fx, fy, tr = flips.get(tag, (0, 0, 0))\n    tw = w - w % mw if fx else w\n    th = h - h % mh if fy else h\n    if tw == 0 or th == 0:\n        return 'refuse'\n    if tr:\n        tw, th = th, tw\n    return [tw, th]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[[[8, 24, 3, '422'], 'refuse'], [[22, 12, 7, '422'], [8, 16]], [[81, 1275, 6, '422'], [1272, 81]], [[24, 12, 0, '440'], [24, 12]], [[2969, 96, 1, '422'], [2969, 96]], [[24, 16, 5, '422'], [16, 24]], [[40, 2600, 0, '440'], [40, 2600]], [[12, 8, 8, '422'], 'refuse']], [[[12, 8, 6, '422'], [8, 12]], [[86, 2621, 4, '422'], [86, 2616]], [[25, 40, 4, '422'], [25, 40]], [[12, 1946, 4, '420'], [12, 1936]], [[8, 12, 1, '411'], 'unknown-sampling'], [[25, 8, 8, '420'], [8, 16]], [[24, 24, 2, '440'], [24, 24]], [[12, 24, 8, '422'], 'refuse']], [[[8, 8, 8, '422'], 'refuse'], [[16, 24, 7, '422'], [24, 16]], [[36, 24, 3, '422'], [32, 24]], [[24, 8, 4, '444'], [24, 8]], [[12, 12, 3, '420'], 'refuse'], [[24, 24, 0, '420'], [24, 24]], [[8, 20, 6, '420'], [16, 8]], [[24, 12, 6, '422'], [8, 24]]], [[[8, 60, 6, '422'], [56, 8]], [[40, 8, 3, '422'], [32, 8]], [[2427, 12, 6, '422'], [8, 2427]], [[24, 12, 6, '420'], 'refuse'], [[40, 8, 5, '440'], [8, 40]], [[16, 272, 4, '422'], [16, 272]], [[24, 16, 6, '440'], [16, 24]], [[61, 12, 2, '422'], [48, 12]]], [[[8, 16, 8, '422'], 'refuse'], [[24, 12, 7, '422'], [8, 16]], [[12, 8, 6, '422'], [8, 12]], [[8, 67, 7, '444'], [64, 8]], [[16, 24, 2, '411'], 'unknown-sampling'], [[40, 18, 1, '420'], [40, 18]], [[79, 24, 7, '440'], [16, 72]], [[24, 8, 6, '422'], [8, 24]]]]\nlabels = [\"regression: 4:2:2 MCU geometry\", \"repair trap\", \"combined fault\", \"control\", \"control\", \"boundary\", \"boundary\", \"control\"]\nfor i, (args, expected) in enumerate(fixtures[N-1]):\n    check(\"%s %d\" % (labels[i % len(labels)], i), solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"fixed":{"sha256":"30813bba52f6d0c008ef35fde62c0947b4e6a3dfe45ebe6418a3539a6f9ba7cd","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    w, h, tag, sampling = x\n    mcu = {'444': (8, 8), '422': (16, 8), '420': (16, 16), '440': (8, 16)}\n    if sampling not in mcu:\n        return 'unknown-sampling'\n    mw, mh = mcu[sampling]\n    flips = {1: (0, 0, 0), 2: (1, 0, 0), 3: (1, 1, 0), 4: (0, 1, 0), 5: (0, 0, 1), 6: (0, 1, 1), 7: (1, 1, 1), 8: (1, 0, 1)}\n    fx, fy, tr = flips.get(tag, (0, 0, 0))\n    tw = w - w % mw if fx else w\n    th = h - h % mh if fy else h\n    if tw == 0 or th == 0:\n        return 'refuse'\n    if tr:\n        tw, th = th, tw\n    return [tw, th]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[[[8, 24, 3, '422'], 'refuse'], [[22, 12, 7, '422'], [8, 16]], [[81, 1275, 6, '422'], [1272, 81]], [[24, 12, 0, '440'], [24, 12]], [[2969, 96, 1, '422'], [2969, 96]], [[24, 16, 5, '422'], [16, 24]], [[40, 2600, 0, '440'], [40, 2600]], [[12, 8, 8, '422'], 'refuse']], [[[12, 8, 6, '422'], [8, 12]], [[86, 2621, 4, '422'], [86, 2616]], [[25, 40, 4, '422'], [25, 40]], [[12, 1946, 4, '420'], [12, 1936]], [[8, 12, 1, '411'], 'unknown-sampling'], [[25, 8, 8, '420'], [8, 16]], [[24, 24, 2, '440'], [24, 24]], [[12, 24, 8, '422'], 'refuse']], [[[8, 8, 8, '422'], 'refuse'], [[16, 24, 7, '422'], [24, 16]], [[36, 24, 3, '422'], [32, 24]], [[24, 8, 4, '444'], [24, 8]], [[12, 12, 3, '420'], 'refuse'], [[24, 24, 0, '420'], [24, 24]], [[8, 20, 6, '420'], [16, 8]], [[24, 12, 6, '422'], [8, 24]]], [[[8, 60, 6, '422'], [56, 8]], [[40, 8, 3, '422'], [32, 8]], [[2427, 12, 6, '422'], [8, 2427]], [[24, 12, 6, '420'], 'refuse'], [[40, 8, 5, '440'], [8, 40]], [[16, 272, 4, '422'], [16, 272]], [[24, 16, 6, '440'], [16, 24]], [[61, 12, 2, '422'], [48, 12]]], [[[8, 16, 8, '422'], 'refuse'], [[24, 12, 7, '422'], [8, 16]], [[12, 8, 6, '422'], [8, 12]], [[8, 67, 7, '444'], [64, 8]], [[16, 24, 2, '411'], 'unknown-sampling'], [[40, 18, 1, '420'], [40, 18]], [[79, 24, 7, '440'], [16, 72]], [[24, 8, 6, '422'], [8, 24]]]]\nlabels = [\"regression: 4:2:2 MCU geometry\", \"repair trap\", \"combined fault\", \"control\", \"control\", \"boundary\", \"boundary\", \"control\"]\nfor i, (args, expected) in enumerate(fixtures[N-1]):\n    check(\"%s %d\" % (labels[i % len(labels)], i), solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"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.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"w2-image-orientation-metadata-lossless-mcu-trim-422-mcu-shape","generated_at":"2026-09-29T14:49:41.126025+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"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.","repair":"Use a 16x8 MCU for 4:2:2.","root_cause":"The 4:2:2 MCU is recorded as 8 wide by 16 high, but horizontal chroma subsampling makes it 16 wide by 8 high.","sha256":"36c236c5ce38724d5df626d1d7a2aad548734a202b7f1327c934f02efd99b569","title":"Lossless rotate trims 4:2:2 images along the wrong MCU axis · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":38.243,"exit_code":1,"observations":[{"actual":"refuse","check":"regression: 4:2:2 MCU geometry 0","expected":"refuse","passed":true},{"actual":"refuse","check":"repair trap 1","expected":[8,16],"passed":false},{"actual":[1264,81],"check":"combined fault 2","expected":[1272,81],"passed":false},{"actual":[24,12],"check":"control 3","expected":[24,12],"passed":true},{"actual":[2969,96],"check":"control 4","expected":[2969,96],"passed":true},{"actual":[16,24],"check":"boundary 5","expected":[16,24],"passed":true},{"actual":[40,2600],"check":"boundary 6","expected":[40,2600],"passed":true},{"actual":"refuse","check":"control 7","expected":"refuse","passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: 4:2:2 MCU geometry 0\", \"actual\": \"refuse\", \"expected\": \"refuse\", \"passed\": true}, {\"check\": \"repair trap 1\", \"actual\": \"refuse\", \"expected\": [8, 16], \"passed\": false}, {\"check\": \"combined fault 2\", \"actual\": [1264, 81], \"expected\": [1272, 81], \"passed\": false}, {\"check\": \"control 3\", \"actual\": [24, 12], \"expected\": [24, 12], \"passed\": true}, {\"check\": \"control 4\", \"actual\": [2969, 96], \"expected\": [2969, 96], \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": [16, 24], \"expected\": [16, 24], \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": [40, 2600], \"expected\": [40, 2600], \"passed\": true}, {\"check\": \"control 7\", \"actual\": \"refuse\", \"expected\": \"refuse\", \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":38.351,"exit_code":1,"observations":[{"actual":[8,16],"check":"regression: 4:2:2 MCU geometry 0","expected":"refuse","passed":false},{"actual":"refuse","check":"repair trap 1","expected":[8,16],"passed":false},{"actual":[1264,81],"check":"combined fault 2","expected":[1272,81],"passed":false},{"actual":[24,12],"check":"control 3","expected":[24,12],"passed":true},{"actual":[2969,96],"check":"control 4","expected":[2969,96],"passed":true},{"actual":[16,24],"check":"boundary 5","expected":[16,24],"passed":true},{"actual":[40,2600],"check":"boundary 6","expected":[40,2600],"passed":true},{"actual":[8,8],"check":"control 7","expected":"refuse","passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: 4:2:2 MCU geometry 0\", \"actual\": [8, 16], \"expected\": \"refuse\", \"passed\": false}, {\"check\": \"repair trap 1\", \"actual\": \"refuse\", \"expected\": [8, 16], \"passed\": false}, {\"check\": \"combined fault 2\", \"actual\": [1264, 81], \"expected\": [1272, 81], \"passed\": false}, {\"check\": \"control 3\", \"actual\": [24, 12], \"expected\": [24, 12], \"passed\": true}, {\"check\": \"control 4\", \"actual\": [2969, 96], \"expected\": [2969, 96], \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": [16, 24], \"expected\": [16, 24], \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": [40, 2600], \"expected\": [40, 2600], \"passed\": true}, {\"check\": \"control 7\", \"actual\": [8, 8], \"expected\": \"refuse\", \"passed\": false}], \"passed\": false}\n"},"fixed":{"elapsed_ms":40.185,"exit_code":0,"observations":[{"actual":"refuse","check":"regression: 4:2:2 MCU geometry 0","expected":"refuse","passed":true},{"actual":[8,16],"check":"repair trap 1","expected":[8,16],"passed":true},{"actual":[1272,81],"check":"combined fault 2","expected":[1272,81],"passed":true},{"actual":[24,12],"check":"control 3","expected":[24,12],"passed":true},{"actual":[2969,96],"check":"control 4","expected":[2969,96],"passed":true},{"actual":[16,24],"check":"boundary 5","expected":[16,24],"passed":true},{"actual":[40,2600],"check":"boundary 6","expected":[40,2600],"passed":true},{"actual":"refuse","check":"control 7","expected":"refuse","passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: 4:2:2 MCU geometry 0\", \"actual\": \"refuse\", \"expected\": \"refuse\", \"passed\": true}, {\"check\": \"repair trap 1\", \"actual\": [8, 16], \"expected\": [8, 16], \"passed\": true}, {\"check\": \"combined fault 2\", \"actual\": [1272, 81], \"expected\": [1272, 81], \"passed\": true}, {\"check\": \"control 3\", \"actual\": [24, 12], \"expected\": [24, 12], \"passed\": true}, {\"check\": \"control 4\", \"actual\": [2969, 96], \"expected\": [2969, 96], \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": [16, 24], \"expected\": [16, 24], \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": [40, 2600], \"expected\": [40, 2600], \"passed\": true}, {\"check\": \"control 7\", \"actual\": \"refuse\", \"expected\": \"refuse\", \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}