FAILURE MAP
← Case archive

FA-78566 / Broadcast timecode arithmetic / Open access

Reverse telecine field attribution: field to frame table · case 01

Mixed frames are reported at the wrong video frames.

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

ROOT CAUSE

The field-to-film table gives C three fields and D two.

VERIFIED REPAIR

Use the 2-3-2-3 field table.

Unsuccessful approach: The 3-2-3-2 table describes the opposite cadence.

Case contract

Fields carry film frames in A2 B3 C2 D3 cadence; film frame 0 has cadence position phase and starts at field 0. Video frame v consists of fields 2v and 2v+1. For order "upper" field 2v is the top field; for "lower" field 2v is the bottom field. Return [film frame in top field, film frame in bottom field, "clean" or "mixed"]; a negative v returns None.

Why this case matters

Timecode arithmetic errors misplace edits, commercial breaks and captions against the broadcast clock.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(v, phase, order):
    if v<0:
        return None
    base=[0,2,5,7][phase]
    def film(f):
        g,w=divmod(f+base,10)
        return 4*g+[0,0,1,1,1,2,2,2,3,3][w]-phase
    top,bottom=film(2*v),film(2*v+1)
    if order=='lower':
        top,bottom=bottom,top
    return [top,bottom,'clean' if top==bottom else 'mixed']
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: field to frame table', [30, 3, 'lower'], [24, 24, 'clean']), ('regression variant: field to frame table', [11, 2, 'upper'], [9, 9, 'clean']), ('partial repair probe: field to frame table', [15, 1, 'upper'], [12, 12, 'clean']), ('partial repair variant: field to frame table', [6, 0, 'upper'], [5, 5, 'clean']), ('boundary control', [0, 0, 'upper'], [0, 0, 'clean']), ('boundary control', [4, 3, 'lower'], [3, 3, 'clean']), ('normal control', [2, 0, 'upper'], [1, 2, 'mixed']), ('normal control', [16, 3, 'upper'], [12, 13, 'mixed']), ('normal control', [10, 2, 'upper'], [8, 8, 'clean'])], [('regression: field to frame table', [23, 0, 'lower'], [19, 18, 'mixed']), ('regression variant: field to frame table', [6, 2, 'upper'], [5, 5, 'clean']), ('partial repair probe: field to frame table', [1, 0, 'upper'], [1, 1, 'clean']), ('partial repair variant: field to frame table', [2, 3, 'lower'], [2, 1, 'mixed']), ('boundary control', [2, 0, 'upper'], [1, 2, 'mixed']), ('boundary control', [0, 0, 'upper'], [0, 0, 'clean']), ('normal control', [0, 0, 'lower'], [0, 0, 'clean']), ('normal control', [-3, 2, 'lower'], None), ('normal control', [28, 1, 'upper'], [22, 22, 'clean'])], [('regression: field to frame table', [17, 1, 'upper'], [13, 14, 'mixed']), ('regression variant: field to frame table', [13, 0, 'lower'], [11, 10, 'mixed']), ('partial repair probe: field to frame table', [28, 2, 'lower'], [23, 22, 'mixed']), ('partial repair variant: field to frame table', [16, 0, 'upper'], [13, 13, 'clean']), ('boundary control', [2, 0, 'lower'], [2, 1, 'mixed']), ('boundary control', [2, 0, 'upper'], [1, 2, 'mixed']), ('normal control', [-4, 3, 'upper'], None), ('normal control', [19, 1, 'lower'], [15, 15, 'clean']), ('normal control', [17, 2, 'upper'], [13, 14, 'mixed'])], [('regression: field to frame table', [12, 1, 'upper'], [9, 10, 'mixed']), ('regression variant: field to frame table', [21, 2, 'lower'], [17, 17, 'clean']), ('partial repair probe: field to frame table', [22, 3, 'upper'], [17, 18, 'mixed']), ('partial repair variant: field to frame table', [21, 0, 'lower'], [17, 17, 'clean']), ('boundary control', [4, 3, 'lower'], [3, 3, 'clean']), ('boundary control', [2, 0, 'lower'], [2, 1, 'mixed']), ('normal control', [-5, 0, 'lower'], None), ('normal control', [4, 0, 'upper'], [3, 3, 'clean']), ('normal control', [9, 3, 'lower'], [7, 7, 'clean'])], [('regression: field to frame table', [16, 2, 'lower'], [13, 13, 'clean']), ('regression variant: field to frame table', [5, 3, 'upper'], [4, 4, 'clean']), ('partial repair probe: field to frame table', [11, 0, 'upper'], [9, 9, 'clean']), ('partial repair variant: field to frame table', [17, 3, 'upper'], [13, 14, 'mixed']), ('boundary control', [0, 0, 'upper'], [0, 0, 'clean']), ('boundary control', [4, 3, 'lower'], [3, 3, 'clean']), ('normal control', [-5, 1, 'lower'], None), ('normal control', [21, 3, 'upper'], [16, 17, 'mixed']), ('normal control', [22, 2, 'lower'], [18, 17, 'mixed'])]]
for label, args, expected in fixtures[N-1]:
    check(label, 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: field to frame table[24, 23, 'mixed'][24, 24, 'clean']Failed
regression variant: field to frame table[8, 9, 'mixed'][9, 9, 'clean']Failed
partial repair probe: field to frame table[12, 12, 'clean'][12, 12, 'clean']Passed
partial repair variant: field to frame table[5, 5, 'clean'][5, 5, 'clean']Passed
boundary control[0, 0, 'clean'][0, 0, 'clean']Passed
boundary control[3, 3, 'clean'][3, 3, 'clean']Passed
normal control[1, 2, 'mixed'][1, 2, 'mixed']Passed
normal control[12, 13, 'mixed'][12, 13, 'mixed']Passed
normal control[8, 8, 'clean'][8, 8, 'clean']Passed

SHA-256 / 8119219f3348a90753f098f7e34d1d8a59439b7e6b31a26c6e0af43b68e6111d

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(v, phase, order):
    if v<0:
        return None
    base=[0,2,5,7][phase]
    def film(f):
        g,w=divmod(f+base,10)
        return 4*g+[0,0,0,1,1,2,2,3,3,3][w]-phase
    top,bottom=film(2*v),film(2*v+1)
    if order=='lower':
        top,bottom=bottom,top
    return [top,bottom,'clean' if top==bottom else 'mixed']
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: field to frame table', [30, 3, 'lower'], [24, 24, 'clean']), ('regression variant: field to frame table', [11, 2, 'upper'], [9, 9, 'clean']), ('partial repair probe: field to frame table', [15, 1, 'upper'], [12, 12, 'clean']), ('partial repair variant: field to frame table', [6, 0, 'upper'], [5, 5, 'clean']), ('boundary control', [0, 0, 'upper'], [0, 0, 'clean']), ('boundary control', [4, 3, 'lower'], [3, 3, 'clean']), ('normal control', [2, 0, 'upper'], [1, 2, 'mixed']), ('normal control', [16, 3, 'upper'], [12, 13, 'mixed']), ('normal control', [10, 2, 'upper'], [8, 8, 'clean'])], [('regression: field to frame table', [23, 0, 'lower'], [19, 18, 'mixed']), ('regression variant: field to frame table', [6, 2, 'upper'], [5, 5, 'clean']), ('partial repair probe: field to frame table', [1, 0, 'upper'], [1, 1, 'clean']), ('partial repair variant: field to frame table', [2, 3, 'lower'], [2, 1, 'mixed']), ('boundary control', [2, 0, 'upper'], [1, 2, 'mixed']), ('boundary control', [0, 0, 'upper'], [0, 0, 'clean']), ('normal control', [0, 0, 'lower'], [0, 0, 'clean']), ('normal control', [-3, 2, 'lower'], None), ('normal control', [28, 1, 'upper'], [22, 22, 'clean'])], [('regression: field to frame table', [17, 1, 'upper'], [13, 14, 'mixed']), ('regression variant: field to frame table', [13, 0, 'lower'], [11, 10, 'mixed']), ('partial repair probe: field to frame table', [28, 2, 'lower'], [23, 22, 'mixed']), ('partial repair variant: field to frame table', [16, 0, 'upper'], [13, 13, 'clean']), ('boundary control', [2, 0, 'lower'], [2, 1, 'mixed']), ('boundary control', [2, 0, 'upper'], [1, 2, 'mixed']), ('normal control', [-4, 3, 'upper'], None), ('normal control', [19, 1, 'lower'], [15, 15, 'clean']), ('normal control', [17, 2, 'upper'], [13, 14, 'mixed'])], [('regression: field to frame table', [12, 1, 'upper'], [9, 10, 'mixed']), ('regression variant: field to frame table', [21, 2, 'lower'], [17, 17, 'clean']), ('partial repair probe: field to frame table', [22, 3, 'upper'], [17, 18, 'mixed']), ('partial repair variant: field to frame table', [21, 0, 'lower'], [17, 17, 'clean']), ('boundary control', [4, 3, 'lower'], [3, 3, 'clean']), ('boundary control', [2, 0, 'lower'], [2, 1, 'mixed']), ('normal control', [-5, 0, 'lower'], None), ('normal control', [4, 0, 'upper'], [3, 3, 'clean']), ('normal control', [9, 3, 'lower'], [7, 7, 'clean'])], [('regression: field to frame table', [16, 2, 'lower'], [13, 13, 'clean']), ('regression variant: field to frame table', [5, 3, 'upper'], [4, 4, 'clean']), ('partial repair probe: field to frame table', [11, 0, 'upper'], [9, 9, 'clean']), ('partial repair variant: field to frame table', [17, 3, 'upper'], [13, 14, 'mixed']), ('boundary control', [0, 0, 'upper'], [0, 0, 'clean']), ('boundary control', [4, 3, 'lower'], [3, 3, 'clean']), ('normal control', [-5, 1, 'lower'], None), ('normal control', [21, 3, 'upper'], [16, 17, 'mixed']), ('normal control', [22, 2, 'lower'], [18, 17, 'mixed'])]]
for label, args, expected in fixtures[N-1]:
    check(label, 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: field to frame table[24, 24, 'clean'][24, 24, 'clean']Passed
regression variant: field to frame table[9, 9, 'clean'][9, 9, 'clean']Passed
partial repair probe: field to frame table[11, 12, 'mixed'][12, 12, 'clean']Failed
partial repair variant: field to frame table[4, 5, 'mixed'][5, 5, 'clean']Failed
boundary control[0, 0, 'clean'][0, 0, 'clean']Passed
boundary control[3, 3, 'clean'][3, 3, 'clean']Passed
normal control[1, 2, 'mixed'][1, 2, 'mixed']Passed
normal control[12, 13, 'mixed'][12, 13, 'mixed']Passed
normal control[8, 8, 'clean'][8, 8, 'clean']Passed

SHA-256 / 92c12b0ca1dd1cd6a27fd024b43ccf0413ed185845d40dc528fad60a4ff854cb

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(v, phase, order):
    if v<0:
        return None
    base=[0,2,5,7][phase]
    def film(f):
        g,w=divmod(f+base,10)
        return 4*g+[0,0,1,1,1,2,2,3,3,3][w]-phase
    top,bottom=film(2*v),film(2*v+1)
    if order=='lower':
        top,bottom=bottom,top
    return [top,bottom,'clean' if top==bottom else 'mixed']
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: field to frame table', [30, 3, 'lower'], [24, 24, 'clean']), ('regression variant: field to frame table', [11, 2, 'upper'], [9, 9, 'clean']), ('partial repair probe: field to frame table', [15, 1, 'upper'], [12, 12, 'clean']), ('partial repair variant: field to frame table', [6, 0, 'upper'], [5, 5, 'clean']), ('boundary control', [0, 0, 'upper'], [0, 0, 'clean']), ('boundary control', [4, 3, 'lower'], [3, 3, 'clean']), ('normal control', [2, 0, 'upper'], [1, 2, 'mixed']), ('normal control', [16, 3, 'upper'], [12, 13, 'mixed']), ('normal control', [10, 2, 'upper'], [8, 8, 'clean'])], [('regression: field to frame table', [23, 0, 'lower'], [19, 18, 'mixed']), ('regression variant: field to frame table', [6, 2, 'upper'], [5, 5, 'clean']), ('partial repair probe: field to frame table', [1, 0, 'upper'], [1, 1, 'clean']), ('partial repair variant: field to frame table', [2, 3, 'lower'], [2, 1, 'mixed']), ('boundary control', [2, 0, 'upper'], [1, 2, 'mixed']), ('boundary control', [0, 0, 'upper'], [0, 0, 'clean']), ('normal control', [0, 0, 'lower'], [0, 0, 'clean']), ('normal control', [-3, 2, 'lower'], None), ('normal control', [28, 1, 'upper'], [22, 22, 'clean'])], [('regression: field to frame table', [17, 1, 'upper'], [13, 14, 'mixed']), ('regression variant: field to frame table', [13, 0, 'lower'], [11, 10, 'mixed']), ('partial repair probe: field to frame table', [28, 2, 'lower'], [23, 22, 'mixed']), ('partial repair variant: field to frame table', [16, 0, 'upper'], [13, 13, 'clean']), ('boundary control', [2, 0, 'lower'], [2, 1, 'mixed']), ('boundary control', [2, 0, 'upper'], [1, 2, 'mixed']), ('normal control', [-4, 3, 'upper'], None), ('normal control', [19, 1, 'lower'], [15, 15, 'clean']), ('normal control', [17, 2, 'upper'], [13, 14, 'mixed'])], [('regression: field to frame table', [12, 1, 'upper'], [9, 10, 'mixed']), ('regression variant: field to frame table', [21, 2, 'lower'], [17, 17, 'clean']), ('partial repair probe: field to frame table', [22, 3, 'upper'], [17, 18, 'mixed']), ('partial repair variant: field to frame table', [21, 0, 'lower'], [17, 17, 'clean']), ('boundary control', [4, 3, 'lower'], [3, 3, 'clean']), ('boundary control', [2, 0, 'lower'], [2, 1, 'mixed']), ('normal control', [-5, 0, 'lower'], None), ('normal control', [4, 0, 'upper'], [3, 3, 'clean']), ('normal control', [9, 3, 'lower'], [7, 7, 'clean'])], [('regression: field to frame table', [16, 2, 'lower'], [13, 13, 'clean']), ('regression variant: field to frame table', [5, 3, 'upper'], [4, 4, 'clean']), ('partial repair probe: field to frame table', [11, 0, 'upper'], [9, 9, 'clean']), ('partial repair variant: field to frame table', [17, 3, 'upper'], [13, 14, 'mixed']), ('boundary control', [0, 0, 'upper'], [0, 0, 'clean']), ('boundary control', [4, 3, 'lower'], [3, 3, 'clean']), ('normal control', [-5, 1, 'lower'], None), ('normal control', [21, 3, 'upper'], [16, 17, 'mixed']), ('normal control', [22, 2, 'lower'], [18, 17, 'mixed'])]]
for label, args, expected in fixtures[N-1]:
    check(label, 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: field to frame table[24, 24, 'clean'][24, 24, 'clean']Passed
regression variant: field to frame table[9, 9, 'clean'][9, 9, 'clean']Passed
partial repair probe: field to frame table[12, 12, 'clean'][12, 12, 'clean']Passed
partial repair variant: field to frame table[5, 5, 'clean'][5, 5, 'clean']Passed
boundary control[0, 0, 'clean'][0, 0, 'clean']Passed
boundary control[3, 3, 'clean'][3, 3, 'clean']Passed
normal control[1, 2, 'mixed'][1, 2, 'mixed']Passed
normal control[12, 13, 'mixed'][12, 13, 'mixed']Passed
normal control[8, 8, 'clean'][8, 8, 'clean']Passed

SHA-256 / 9920a63935b3dbe2c26fb20663215ab2979749a53f43bf647c293da66bd3db5b

Verification & scope

A deterministic bounded teaching model with a stipulated toy contract; it does not claim conformance to SMPTE or any broadcast standard. 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:36.603858+00:00.

Case digest / f70fdce398d32d10d884c738dccbbbf024ed06ea0460303e759918fe8fe63f4e