FA-78571 / Broadcast timecode arithmetic / Open access
Reverse telecine field attribution: second field index · case 01
The second field is taken from the previous video frame.
ROOT CAUSE
The second field index is 2v-1.
VERIFIED REPAIR
The second field of video frame v is 2v+1.
Unsuccessful approach: Field 2v+2 belongs to the next video frame.
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]-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: second field index', [0, 0, 'upper'], [0, 0, 'clean']), ('regression variant: second field index', [16, 3, 'upper'], [12, 13, 'mixed']), ('partial repair probe: second field index', [10, 2, 'upper'], [8, 8, 'clean']), ('partial repair variant: second field index', [4, 1, 'upper'], [3, 3, 'clean']), ('normal control', [-3, 2, 'lower'], None), ('normal control', [-5, 0, 'lower'], None), ('normal control', [-4, 2, 'lower'], None)], [('regression: second field index', [2, 0, 'upper'], [1, 2, 'mixed']), ('regression variant: second field index', [10, 2, 'upper'], [8, 8, 'clean']), ('partial repair probe: second field index', [24, 0, 'upper'], [19, 19, 'clean']), ('partial repair variant: second field index', [19, 1, 'lower'], [15, 15, 'clean']), ('normal control', [-5, 3, 'lower'], None), ('normal control', [-3, 0, 'lower'], None), ('normal control', [-1, 2, 'upper'], None)], [('regression: second field index', [2, 0, 'lower'], [2, 1, 'mixed']), ('regression variant: second field index', [30, 3, 'lower'], [24, 24, 'clean']), ('partial repair probe: second field index', [0, 0, 'lower'], [0, 0, 'clean']), ('partial repair variant: second field index', [25, 2, 'lower'], [20, 20, 'clean']), ('normal control', [-3, 3, 'upper'], None), ('normal control', [-2, 2, 'upper'], None), ('normal control', [-4, 3, 'lower'], None)], [('regression: second field index', [0, 1, 'upper'], [0, 0, 'clean']), ('regression variant: second field index', [0, 0, 'lower'], [0, 0, 'clean']), ('partial repair probe: second field index', [20, 2, 'upper'], [16, 16, 'clean']), ('partial repair variant: second field index', [19, 2, 'upper'], [15, 15, 'clean']), ('normal control', [-2, 2, 'lower'], None), ('normal control', [-5, 1, 'upper'], None), ('normal control', [-2, 3, 'lower'], None)], [('regression: second field index', [4, 3, 'lower'], [3, 3, 'clean']), ('regression variant: second field index', [12, 3, 'lower'], [10, 9, 'mixed']), ('partial repair probe: second field index', [29, 1, 'lower'], [23, 23, 'clean']), ('partial repair variant: second field index', [4, 0, 'upper'], [3, 3, 'clean']), ('normal control', [-3, 3, 'lower'], None), ('normal control', [-1, 0, 'upper'], None), ('normal control', [-3, 0, 'upper'], None)]]
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: second field index | [0, -1, 'mixed'] | [0, 0, 'clean'] | Failed |
| regression variant: second field index | [12, 12, 'clean'] | [12, 13, 'mixed'] | Failed |
| partial repair probe: second field index | [8, 7, 'mixed'] | [8, 8, 'clean'] | Failed |
| partial repair variant: second field index | [3, 2, 'mixed'] | [3, 3, 'clean'] | Failed |
| normal control | None | None | Passed |
| normal control | None | None | Passed |
| normal control | None | None | Passed |
SHA-256 / d6f6dea6274d8ab71c478b16b7d75bfdcda3bbd37ef327b6fea31e1dcb66db5c
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]-phase
top,bottom=film(2*v),film(2*v+2)
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: second field index', [0, 0, 'upper'], [0, 0, 'clean']), ('regression variant: second field index', [16, 3, 'upper'], [12, 13, 'mixed']), ('partial repair probe: second field index', [10, 2, 'upper'], [8, 8, 'clean']), ('partial repair variant: second field index', [4, 1, 'upper'], [3, 3, 'clean']), ('normal control', [-3, 2, 'lower'], None), ('normal control', [-5, 0, 'lower'], None), ('normal control', [-4, 2, 'lower'], None)], [('regression: second field index', [2, 0, 'upper'], [1, 2, 'mixed']), ('regression variant: second field index', [10, 2, 'upper'], [8, 8, 'clean']), ('partial repair probe: second field index', [24, 0, 'upper'], [19, 19, 'clean']), ('partial repair variant: second field index', [19, 1, 'lower'], [15, 15, 'clean']), ('normal control', [-5, 3, 'lower'], None), ('normal control', [-3, 0, 'lower'], None), ('normal control', [-1, 2, 'upper'], None)], [('regression: second field index', [2, 0, 'lower'], [2, 1, 'mixed']), ('regression variant: second field index', [30, 3, 'lower'], [24, 24, 'clean']), ('partial repair probe: second field index', [0, 0, 'lower'], [0, 0, 'clean']), ('partial repair variant: second field index', [25, 2, 'lower'], [20, 20, 'clean']), ('normal control', [-3, 3, 'upper'], None), ('normal control', [-2, 2, 'upper'], None), ('normal control', [-4, 3, 'lower'], None)], [('regression: second field index', [0, 1, 'upper'], [0, 0, 'clean']), ('regression variant: second field index', [0, 0, 'lower'], [0, 0, 'clean']), ('partial repair probe: second field index', [20, 2, 'upper'], [16, 16, 'clean']), ('partial repair variant: second field index', [19, 2, 'upper'], [15, 15, 'clean']), ('normal control', [-2, 2, 'lower'], None), ('normal control', [-5, 1, 'upper'], None), ('normal control', [-2, 3, 'lower'], None)], [('regression: second field index', [4, 3, 'lower'], [3, 3, 'clean']), ('regression variant: second field index', [12, 3, 'lower'], [10, 9, 'mixed']), ('partial repair probe: second field index', [29, 1, 'lower'], [23, 23, 'clean']), ('partial repair variant: second field index', [4, 0, 'upper'], [3, 3, 'clean']), ('normal control', [-3, 3, 'lower'], None), ('normal control', [-1, 0, 'upper'], None), ('normal control', [-3, 0, 'upper'], None)]]
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: second field index | [0, 1, 'mixed'] | [0, 0, 'clean'] | Failed |
| regression variant: second field index | [12, 13, 'mixed'] | [12, 13, 'mixed'] | Passed |
| partial repair probe: second field index | [8, 9, 'mixed'] | [8, 8, 'clean'] | Failed |
| partial repair variant: second field index | [3, 4, 'mixed'] | [3, 3, 'clean'] | Failed |
| normal control | None | None | Passed |
| normal control | None | None | Passed |
| normal control | None | None | Passed |
SHA-256 / 800c3a2e1d91d35f11f51c33f040204e815efd25142260e23613b10b81ddbc18
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: second field index', [0, 0, 'upper'], [0, 0, 'clean']), ('regression variant: second field index', [16, 3, 'upper'], [12, 13, 'mixed']), ('partial repair probe: second field index', [10, 2, 'upper'], [8, 8, 'clean']), ('partial repair variant: second field index', [4, 1, 'upper'], [3, 3, 'clean']), ('normal control', [-3, 2, 'lower'], None), ('normal control', [-5, 0, 'lower'], None), ('normal control', [-4, 2, 'lower'], None)], [('regression: second field index', [2, 0, 'upper'], [1, 2, 'mixed']), ('regression variant: second field index', [10, 2, 'upper'], [8, 8, 'clean']), ('partial repair probe: second field index', [24, 0, 'upper'], [19, 19, 'clean']), ('partial repair variant: second field index', [19, 1, 'lower'], [15, 15, 'clean']), ('normal control', [-5, 3, 'lower'], None), ('normal control', [-3, 0, 'lower'], None), ('normal control', [-1, 2, 'upper'], None)], [('regression: second field index', [2, 0, 'lower'], [2, 1, 'mixed']), ('regression variant: second field index', [30, 3, 'lower'], [24, 24, 'clean']), ('partial repair probe: second field index', [0, 0, 'lower'], [0, 0, 'clean']), ('partial repair variant: second field index', [25, 2, 'lower'], [20, 20, 'clean']), ('normal control', [-3, 3, 'upper'], None), ('normal control', [-2, 2, 'upper'], None), ('normal control', [-4, 3, 'lower'], None)], [('regression: second field index', [0, 1, 'upper'], [0, 0, 'clean']), ('regression variant: second field index', [0, 0, 'lower'], [0, 0, 'clean']), ('partial repair probe: second field index', [20, 2, 'upper'], [16, 16, 'clean']), ('partial repair variant: second field index', [19, 2, 'upper'], [15, 15, 'clean']), ('normal control', [-2, 2, 'lower'], None), ('normal control', [-5, 1, 'upper'], None), ('normal control', [-2, 3, 'lower'], None)], [('regression: second field index', [4, 3, 'lower'], [3, 3, 'clean']), ('regression variant: second field index', [12, 3, 'lower'], [10, 9, 'mixed']), ('partial repair probe: second field index', [29, 1, 'lower'], [23, 23, 'clean']), ('partial repair variant: second field index', [4, 0, 'upper'], [3, 3, 'clean']), ('normal control', [-3, 3, 'lower'], None), ('normal control', [-1, 0, 'upper'], None), ('normal control', [-3, 0, 'upper'], None)]]
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: second field index | [0, 0, 'clean'] | [0, 0, 'clean'] | Passed |
| regression variant: second field index | [12, 13, 'mixed'] | [12, 13, 'mixed'] | Passed |
| partial repair probe: second field index | [8, 8, 'clean'] | [8, 8, 'clean'] | Passed |
| partial repair variant: second field index | [3, 3, 'clean'] | [3, 3, 'clean'] | Passed |
| normal control | None | None | Passed |
| normal control | None | None | Passed |
| normal control | None | None | Passed |
SHA-256 / 7d748ce29f45b5c6b762f84ec90391d11f3e8b905740a18835ab4504c5481882
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.631741+00:00.
Case digest / 23b3e85e726aa5d62e0a492db041c48a763dec11099c48678671c934cf096b85