FA-78586 / Broadcast timecode arithmetic / Open access
Reverse telecine field attribution: phase frame rebasing · case 01
Film frame numbers are too high by the cadence phase.
ROOT CAUSE
The absolute cadence frame is not rebased to film frame 0.
VERIFIED REPAIR
Subtract the phase from the cadence frame number.
Unsuccessful approach: Subtracting the field offset instead of the frame offset over-corrects.
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,3,3,3][w]
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: phase frame rebasing', [0, 1, 'upper'], [0, 0, 'clean']), ('regression variant: phase frame rebasing', [12, 3, 'lower'], [10, 9, 'mixed']), ('partial repair probe: phase frame rebasing', [16, 3, 'upper'], [12, 13, 'mixed']), ('partial repair variant: phase frame rebasing', [15, 1, 'upper'], [12, 12, 'clean']), ('boundary control', [0, 0, 'upper'], [0, 0, 'clean']), ('boundary control', [2, 0, 'upper'], [1, 2, 'mixed']), ('normal control', [2, 0, 'lower'], [2, 1, 'mixed']), ('normal control', [24, 0, 'upper'], [19, 19, 'clean']), ('normal control', [23, 0, 'lower'], [19, 18, 'mixed'])], [('regression: phase frame rebasing', [4, 3, 'lower'], [3, 3, 'clean']), ('regression variant: phase frame rebasing', [26, 3, 'upper'], [20, 21, 'mixed']), ('partial repair probe: phase frame rebasing', [10, 2, 'upper'], [8, 8, 'clean']), ('partial repair variant: phase frame rebasing', [17, 1, 'upper'], [13, 14, 'mixed']), ('boundary control', [2, 0, 'upper'], [1, 2, 'mixed']), ('boundary control', [2, 0, 'lower'], [2, 1, 'mixed']), ('normal control', [1, 0, 'upper'], [1, 1, 'clean']), ('normal control', [-4, 0, 'upper'], None), ('normal control', [-5, 0, 'lower'], None)], [('regression: phase frame rebasing', [16, 3, 'upper'], [12, 13, 'mixed']), ('regression variant: phase frame rebasing', [20, 2, 'upper'], [16, 16, 'clean']), ('partial repair probe: phase frame rebasing', [30, 3, 'lower'], [24, 24, 'clean']), ('partial repair variant: phase frame rebasing', [28, 2, 'lower'], [23, 22, 'mixed']), ('boundary control', [2, 0, 'lower'], [2, 1, 'mixed']), ('boundary control', [0, 0, 'upper'], [0, 0, 'clean']), ('normal control', [4, 0, 'upper'], [3, 3, 'clean']), ('normal control', [6, 0, 'upper'], [5, 5, 'clean']), ('normal control', [25, 0, 'lower'], [20, 20, 'clean'])], [('regression: phase frame rebasing', [10, 2, 'upper'], [8, 8, 'clean']), ('regression variant: phase frame rebasing', [29, 1, 'lower'], [23, 23, 'clean']), ('partial repair probe: phase frame rebasing', [12, 3, 'lower'], [10, 9, 'mixed']), ('partial repair variant: phase frame rebasing', [28, 1, 'upper'], [22, 22, 'clean']), ('boundary control', [0, 0, 'upper'], [0, 0, 'clean']), ('boundary control', [2, 0, 'upper'], [1, 2, 'mixed']), ('normal control', [-5, 3, 'lower'], None), ('normal control', [28, 0, 'upper'], [22, 23, 'mixed']), ('normal control', [8, 0, 'upper'], [6, 7, 'mixed'])], [('regression: phase frame rebasing', [30, 3, 'lower'], [24, 24, 'clean']), ('regression variant: phase frame rebasing', [15, 1, 'upper'], [12, 12, 'clean']), ('partial repair probe: phase frame rebasing', [26, 3, 'upper'], [20, 21, 'mixed']), ('partial repair variant: phase frame rebasing', [12, 1, 'upper'], [9, 10, 'mixed']), ('boundary control', [2, 0, 'upper'], [1, 2, 'mixed']), ('boundary control', [2, 0, 'lower'], [2, 1, 'mixed']), ('normal control', [-2, 1, 'upper'], None), ('normal control', [19, 0, 'lower'], [15, 15, 'clean']), ('normal control', [22, 0, 'upper'], [17, 18, '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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: phase frame rebasing | [1, 1, 'clean'] | [0, 0, 'clean'] | Failed |
| regression variant: phase frame rebasing | [13, 12, 'mixed'] | [10, 9, 'mixed'] | Failed |
| partial repair probe: phase frame rebasing | [15, 16, 'mixed'] | [12, 13, 'mixed'] | Failed |
| partial repair variant: phase frame rebasing | [13, 13, 'clean'] | [12, 12, 'clean'] | Failed |
| boundary control | [0, 0, 'clean'] | [0, 0, 'clean'] | Passed |
| boundary control | [1, 2, 'mixed'] | [1, 2, 'mixed'] | Passed |
| normal control | [2, 1, 'mixed'] | [2, 1, 'mixed'] | Passed |
| normal control | [19, 19, 'clean'] | [19, 19, 'clean'] | Passed |
| normal control | [19, 18, 'mixed'] | [19, 18, 'mixed'] | Passed |
SHA-256 / 03b1ae9797bd3476611f3a8d4e9dabc834cc9f78276601dc0d312da8ae1349a9
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,1,1,1,2,2,3,3,3][w]-base
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: phase frame rebasing', [0, 1, 'upper'], [0, 0, 'clean']), ('regression variant: phase frame rebasing', [12, 3, 'lower'], [10, 9, 'mixed']), ('partial repair probe: phase frame rebasing', [16, 3, 'upper'], [12, 13, 'mixed']), ('partial repair variant: phase frame rebasing', [15, 1, 'upper'], [12, 12, 'clean']), ('boundary control', [0, 0, 'upper'], [0, 0, 'clean']), ('boundary control', [2, 0, 'upper'], [1, 2, 'mixed']), ('normal control', [2, 0, 'lower'], [2, 1, 'mixed']), ('normal control', [24, 0, 'upper'], [19, 19, 'clean']), ('normal control', [23, 0, 'lower'], [19, 18, 'mixed'])], [('regression: phase frame rebasing', [4, 3, 'lower'], [3, 3, 'clean']), ('regression variant: phase frame rebasing', [26, 3, 'upper'], [20, 21, 'mixed']), ('partial repair probe: phase frame rebasing', [10, 2, 'upper'], [8, 8, 'clean']), ('partial repair variant: phase frame rebasing', [17, 1, 'upper'], [13, 14, 'mixed']), ('boundary control', [2, 0, 'upper'], [1, 2, 'mixed']), ('boundary control', [2, 0, 'lower'], [2, 1, 'mixed']), ('normal control', [1, 0, 'upper'], [1, 1, 'clean']), ('normal control', [-4, 0, 'upper'], None), ('normal control', [-5, 0, 'lower'], None)], [('regression: phase frame rebasing', [16, 3, 'upper'], [12, 13, 'mixed']), ('regression variant: phase frame rebasing', [20, 2, 'upper'], [16, 16, 'clean']), ('partial repair probe: phase frame rebasing', [30, 3, 'lower'], [24, 24, 'clean']), ('partial repair variant: phase frame rebasing', [28, 2, 'lower'], [23, 22, 'mixed']), ('boundary control', [2, 0, 'lower'], [2, 1, 'mixed']), ('boundary control', [0, 0, 'upper'], [0, 0, 'clean']), ('normal control', [4, 0, 'upper'], [3, 3, 'clean']), ('normal control', [6, 0, 'upper'], [5, 5, 'clean']), ('normal control', [25, 0, 'lower'], [20, 20, 'clean'])], [('regression: phase frame rebasing', [10, 2, 'upper'], [8, 8, 'clean']), ('regression variant: phase frame rebasing', [29, 1, 'lower'], [23, 23, 'clean']), ('partial repair probe: phase frame rebasing', [12, 3, 'lower'], [10, 9, 'mixed']), ('partial repair variant: phase frame rebasing', [28, 1, 'upper'], [22, 22, 'clean']), ('boundary control', [0, 0, 'upper'], [0, 0, 'clean']), ('boundary control', [2, 0, 'upper'], [1, 2, 'mixed']), ('normal control', [-5, 3, 'lower'], None), ('normal control', [28, 0, 'upper'], [22, 23, 'mixed']), ('normal control', [8, 0, 'upper'], [6, 7, 'mixed'])], [('regression: phase frame rebasing', [30, 3, 'lower'], [24, 24, 'clean']), ('regression variant: phase frame rebasing', [15, 1, 'upper'], [12, 12, 'clean']), ('partial repair probe: phase frame rebasing', [26, 3, 'upper'], [20, 21, 'mixed']), ('partial repair variant: phase frame rebasing', [12, 1, 'upper'], [9, 10, 'mixed']), ('boundary control', [2, 0, 'upper'], [1, 2, 'mixed']), ('boundary control', [2, 0, 'lower'], [2, 1, 'mixed']), ('normal control', [-2, 1, 'upper'], None), ('normal control', [19, 0, 'lower'], [15, 15, 'clean']), ('normal control', [22, 0, 'upper'], [17, 18, '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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: phase frame rebasing | [-1, -1, 'clean'] | [0, 0, 'clean'] | Failed |
| regression variant: phase frame rebasing | [6, 5, 'mixed'] | [10, 9, 'mixed'] | Failed |
| partial repair probe: phase frame rebasing | [8, 9, 'mixed'] | [12, 13, 'mixed'] | Failed |
| partial repair variant: phase frame rebasing | [11, 11, 'clean'] | [12, 12, 'clean'] | Failed |
| boundary control | [0, 0, 'clean'] | [0, 0, 'clean'] | Passed |
| boundary control | [1, 2, 'mixed'] | [1, 2, 'mixed'] | Passed |
| normal control | [2, 1, 'mixed'] | [2, 1, 'mixed'] | Passed |
| normal control | [19, 19, 'clean'] | [19, 19, 'clean'] | Passed |
| normal control | [19, 18, 'mixed'] | [19, 18, 'mixed'] | Passed |
SHA-256 / 006d5e0c3449d54a834e1c518c47b558de31cdc4298736d1d18ca5e474286e15
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: phase frame rebasing', [0, 1, 'upper'], [0, 0, 'clean']), ('regression variant: phase frame rebasing', [12, 3, 'lower'], [10, 9, 'mixed']), ('partial repair probe: phase frame rebasing', [16, 3, 'upper'], [12, 13, 'mixed']), ('partial repair variant: phase frame rebasing', [15, 1, 'upper'], [12, 12, 'clean']), ('boundary control', [0, 0, 'upper'], [0, 0, 'clean']), ('boundary control', [2, 0, 'upper'], [1, 2, 'mixed']), ('normal control', [2, 0, 'lower'], [2, 1, 'mixed']), ('normal control', [24, 0, 'upper'], [19, 19, 'clean']), ('normal control', [23, 0, 'lower'], [19, 18, 'mixed'])], [('regression: phase frame rebasing', [4, 3, 'lower'], [3, 3, 'clean']), ('regression variant: phase frame rebasing', [26, 3, 'upper'], [20, 21, 'mixed']), ('partial repair probe: phase frame rebasing', [10, 2, 'upper'], [8, 8, 'clean']), ('partial repair variant: phase frame rebasing', [17, 1, 'upper'], [13, 14, 'mixed']), ('boundary control', [2, 0, 'upper'], [1, 2, 'mixed']), ('boundary control', [2, 0, 'lower'], [2, 1, 'mixed']), ('normal control', [1, 0, 'upper'], [1, 1, 'clean']), ('normal control', [-4, 0, 'upper'], None), ('normal control', [-5, 0, 'lower'], None)], [('regression: phase frame rebasing', [16, 3, 'upper'], [12, 13, 'mixed']), ('regression variant: phase frame rebasing', [20, 2, 'upper'], [16, 16, 'clean']), ('partial repair probe: phase frame rebasing', [30, 3, 'lower'], [24, 24, 'clean']), ('partial repair variant: phase frame rebasing', [28, 2, 'lower'], [23, 22, 'mixed']), ('boundary control', [2, 0, 'lower'], [2, 1, 'mixed']), ('boundary control', [0, 0, 'upper'], [0, 0, 'clean']), ('normal control', [4, 0, 'upper'], [3, 3, 'clean']), ('normal control', [6, 0, 'upper'], [5, 5, 'clean']), ('normal control', [25, 0, 'lower'], [20, 20, 'clean'])], [('regression: phase frame rebasing', [10, 2, 'upper'], [8, 8, 'clean']), ('regression variant: phase frame rebasing', [29, 1, 'lower'], [23, 23, 'clean']), ('partial repair probe: phase frame rebasing', [12, 3, 'lower'], [10, 9, 'mixed']), ('partial repair variant: phase frame rebasing', [28, 1, 'upper'], [22, 22, 'clean']), ('boundary control', [0, 0, 'upper'], [0, 0, 'clean']), ('boundary control', [2, 0, 'upper'], [1, 2, 'mixed']), ('normal control', [-5, 3, 'lower'], None), ('normal control', [28, 0, 'upper'], [22, 23, 'mixed']), ('normal control', [8, 0, 'upper'], [6, 7, 'mixed'])], [('regression: phase frame rebasing', [30, 3, 'lower'], [24, 24, 'clean']), ('regression variant: phase frame rebasing', [15, 1, 'upper'], [12, 12, 'clean']), ('partial repair probe: phase frame rebasing', [26, 3, 'upper'], [20, 21, 'mixed']), ('partial repair variant: phase frame rebasing', [12, 1, 'upper'], [9, 10, 'mixed']), ('boundary control', [2, 0, 'upper'], [1, 2, 'mixed']), ('boundary control', [2, 0, 'lower'], [2, 1, 'mixed']), ('normal control', [-2, 1, 'upper'], None), ('normal control', [19, 0, 'lower'], [15, 15, 'clean']), ('normal control', [22, 0, 'upper'], [17, 18, '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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: phase frame rebasing | [0, 0, 'clean'] | [0, 0, 'clean'] | Passed |
| regression variant: phase frame rebasing | [10, 9, 'mixed'] | [10, 9, 'mixed'] | Passed |
| partial repair probe: phase frame rebasing | [12, 13, 'mixed'] | [12, 13, 'mixed'] | Passed |
| partial repair variant: phase frame rebasing | [12, 12, 'clean'] | [12, 12, 'clean'] | Passed |
| boundary control | [0, 0, 'clean'] | [0, 0, 'clean'] | Passed |
| boundary control | [1, 2, 'mixed'] | [1, 2, 'mixed'] | Passed |
| normal control | [2, 1, 'mixed'] | [2, 1, 'mixed'] | Passed |
| normal control | [19, 19, 'clean'] | [19, 19, 'clean'] | Passed |
| normal control | [19, 18, 'mixed'] | [19, 18, 'mixed'] | Passed |
SHA-256 / 93309547b493242f62756cad8a8aed6bbb58599a20aa6fd03a40dac12b9334d4
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.645915+00:00.
Case digest / e7318e9c1811f09d351c0ec709dc62568183188d7ac4aa2fb82bf35b63218821