FA-78561 / Broadcast timecode arithmetic / Open access
2:3 pulldown film frame placement: field parity · case 01
Frames starting on the second field of a video frame are reported as upper field first.
ROOT CAUSE
The field parity test is inverted.
VERIFIED REPAIR
Even field indexes are upper fields.
Unsuccessful approach: Testing the parity of the video frame index instead of the field index reports alternating frames.
Case contract
Film frames follow the A2 B3 C2 D3 field cadence (10 fields per 4 film frames). phase is the cadence position (0=A..3=D) of film frame 0, which starts at video field 0. Negative n returns None. For film frame n return [video frame of its first field, "upper" for an even field index else "lower", number of fields].
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(n, phase):
if n<0:
return None
def sf(a):
return 10*(a//4)+[0,2,5,7][a%4]
a=n+phase
start=sf(a)-sf(phase)
count=[2,3,2,3][a%4]
return [start//2,'upper' if start%2==1 else 'lower',count]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: field parity', [0, 0], [0, 'upper', 2]), ('regression variant: field parity', [2, 3], [2, 'lower', 3]), ('partial repair probe: field parity', [34, 2], [42, 'lower', 2]), ('partial repair variant: field parity', [20, 1], [25, 'upper', 3]), ('normal control', [-3, 2], None), ('normal control', [-2, 3], None), ('normal control', [-2, 1], None)], [('regression: field parity', [1, 0], [1, 'upper', 3]), ('regression variant: field parity', [8, 0], [10, 'upper', 2]), ('partial repair probe: field parity', [34, 2], [42, 'lower', 2]), ('partial repair variant: field parity', [18, 3], [22, 'lower', 3]), ('normal control', [-5, 1], None), ('normal control', [-1, 1], None), ('normal control', [-4, 1], None)], [('regression: field parity', [3, 0], [3, 'lower', 3]), ('regression variant: field parity', [9, 1], [11, 'lower', 2]), ('partial repair probe: field parity', [10, 1], [12, 'lower', 3]), ('partial repair variant: field parity', [20, 0], [25, 'upper', 2]), ('normal control', [-2, 2], None), ('normal control', [-1, 0], None), ('normal control', [-2, 0], None)], [('regression: field parity', [4, 0], [5, 'upper', 2]), ('regression variant: field parity', [35, 1], [44, 'upper', 2]), ('partial repair probe: field parity', [26, 2], [32, 'lower', 2]), ('partial repair variant: field parity', [18, 1], [22, 'lower', 3]), ('normal control', [-1, 2], None), ('normal control', [-4, 2], None), ('normal control', [-2, 3], None)], [('regression: field parity', [0, 1], [0, 'upper', 3]), ('regression variant: field parity', [34, 2], [42, 'lower', 2]), ('partial repair probe: field parity', [36, 1], [45, 'upper', 3]), ('partial repair variant: field parity', [7, 2], [8, 'lower', 3]), ('normal control', [-2, 1], None), ('normal control', [-3, 0], None), ('normal control', [-1, 1], 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: field parity | [0, 'lower', 2] | [0, 'upper', 2] | Failed |
| regression variant: field parity | [2, 'upper', 3] | [2, 'lower', 3] | Failed |
| partial repair probe: field parity | [42, 'upper', 2] | [42, 'lower', 2] | Failed |
| partial repair variant: field parity | [25, 'lower', 3] | [25, 'upper', 3] | Failed |
| normal control | None | None | Passed |
| normal control | None | None | Passed |
| normal control | None | None | Passed |
SHA-256 / e5e2d843a0d204583a8b826920a4d1cee16590a8626a8d06302052ce32f6e1a7
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(n, phase):
if n<0:
return None
def sf(a):
return 10*(a//4)+[0,2,5,7][a%4]
a=n+phase
start=sf(a)-sf(phase)
count=[2,3,2,3][a%4]
return [start//2,'upper' if (start//2)%2==0 else 'lower',count]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: field parity', [0, 0], [0, 'upper', 2]), ('regression variant: field parity', [2, 3], [2, 'lower', 3]), ('partial repair probe: field parity', [34, 2], [42, 'lower', 2]), ('partial repair variant: field parity', [20, 1], [25, 'upper', 3]), ('normal control', [-3, 2], None), ('normal control', [-2, 3], None), ('normal control', [-2, 1], None)], [('regression: field parity', [1, 0], [1, 'upper', 3]), ('regression variant: field parity', [8, 0], [10, 'upper', 2]), ('partial repair probe: field parity', [34, 2], [42, 'lower', 2]), ('partial repair variant: field parity', [18, 3], [22, 'lower', 3]), ('normal control', [-5, 1], None), ('normal control', [-1, 1], None), ('normal control', [-4, 1], None)], [('regression: field parity', [3, 0], [3, 'lower', 3]), ('regression variant: field parity', [9, 1], [11, 'lower', 2]), ('partial repair probe: field parity', [10, 1], [12, 'lower', 3]), ('partial repair variant: field parity', [20, 0], [25, 'upper', 2]), ('normal control', [-2, 2], None), ('normal control', [-1, 0], None), ('normal control', [-2, 0], None)], [('regression: field parity', [4, 0], [5, 'upper', 2]), ('regression variant: field parity', [35, 1], [44, 'upper', 2]), ('partial repair probe: field parity', [26, 2], [32, 'lower', 2]), ('partial repair variant: field parity', [18, 1], [22, 'lower', 3]), ('normal control', [-1, 2], None), ('normal control', [-4, 2], None), ('normal control', [-2, 3], None)], [('regression: field parity', [0, 1], [0, 'upper', 3]), ('regression variant: field parity', [34, 2], [42, 'lower', 2]), ('partial repair probe: field parity', [36, 1], [45, 'upper', 3]), ('partial repair variant: field parity', [7, 2], [8, 'lower', 3]), ('normal control', [-2, 1], None), ('normal control', [-3, 0], None), ('normal control', [-1, 1], 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: field parity | [0, 'upper', 2] | [0, 'upper', 2] | Passed |
| regression variant: field parity | [2, 'upper', 3] | [2, 'lower', 3] | Failed |
| partial repair probe: field parity | [42, 'upper', 2] | [42, 'lower', 2] | Failed |
| partial repair variant: field parity | [25, 'lower', 3] | [25, 'upper', 3] | Failed |
| normal control | None | None | Passed |
| normal control | None | None | Passed |
| normal control | None | None | Passed |
SHA-256 / 39b0e5c946edafe059514317fed966b597ea31e43ae8f57c897c4c8c45da3629
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(n, phase):
if n<0:
return None
def sf(a):
return 10*(a//4)+[0,2,5,7][a%4]
a=n+phase
start=sf(a)-sf(phase)
count=[2,3,2,3][a%4]
return [start//2,'upper' if start%2==0 else 'lower',count]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: field parity', [0, 0], [0, 'upper', 2]), ('regression variant: field parity', [2, 3], [2, 'lower', 3]), ('partial repair probe: field parity', [34, 2], [42, 'lower', 2]), ('partial repair variant: field parity', [20, 1], [25, 'upper', 3]), ('normal control', [-3, 2], None), ('normal control', [-2, 3], None), ('normal control', [-2, 1], None)], [('regression: field parity', [1, 0], [1, 'upper', 3]), ('regression variant: field parity', [8, 0], [10, 'upper', 2]), ('partial repair probe: field parity', [34, 2], [42, 'lower', 2]), ('partial repair variant: field parity', [18, 3], [22, 'lower', 3]), ('normal control', [-5, 1], None), ('normal control', [-1, 1], None), ('normal control', [-4, 1], None)], [('regression: field parity', [3, 0], [3, 'lower', 3]), ('regression variant: field parity', [9, 1], [11, 'lower', 2]), ('partial repair probe: field parity', [10, 1], [12, 'lower', 3]), ('partial repair variant: field parity', [20, 0], [25, 'upper', 2]), ('normal control', [-2, 2], None), ('normal control', [-1, 0], None), ('normal control', [-2, 0], None)], [('regression: field parity', [4, 0], [5, 'upper', 2]), ('regression variant: field parity', [35, 1], [44, 'upper', 2]), ('partial repair probe: field parity', [26, 2], [32, 'lower', 2]), ('partial repair variant: field parity', [18, 1], [22, 'lower', 3]), ('normal control', [-1, 2], None), ('normal control', [-4, 2], None), ('normal control', [-2, 3], None)], [('regression: field parity', [0, 1], [0, 'upper', 3]), ('regression variant: field parity', [34, 2], [42, 'lower', 2]), ('partial repair probe: field parity', [36, 1], [45, 'upper', 3]), ('partial repair variant: field parity', [7, 2], [8, 'lower', 3]), ('normal control', [-2, 1], None), ('normal control', [-3, 0], None), ('normal control', [-1, 1], 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: field parity | [0, 'upper', 2] | [0, 'upper', 2] | Passed |
| regression variant: field parity | [2, 'lower', 3] | [2, 'lower', 3] | Passed |
| partial repair probe: field parity | [42, 'lower', 2] | [42, 'lower', 2] | Passed |
| partial repair variant: field parity | [25, 'upper', 3] | [25, 'upper', 3] | Passed |
| normal control | None | None | Passed |
| normal control | None | None | Passed |
| normal control | None | None | Passed |
SHA-256 / b736acfeab02a172176620604a1295a272de071a886e6c1b14b09579733edfd4
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.595992+00:00.
Case digest / e7250a02e115e8de9c0ce992c5d4f5d677b75710c64058fb65d227e63dad3ad4