FA-78531 / Broadcast timecode arithmetic / Open access
Film feet and frames conversion: magnitude composition · case 01
Negative footage with frames converts to a count several frames too small.
ROOT CAUSE
The frames are added to the signed feet before the sign is applied.
VERIFIED REPAIR
Combine the absolute feet with the frames, then apply the sign.
Unsuccessful approach: Taking the absolute value after combining still subtracts the frames inside the foot.
Case contract
Frames per foot: 35mm4 16, 35mm2 32, 16mm 40. An int frame count converts to "[-]F+ff" (feet, two-digit frames, sign in front for negatives); a string "[-]F+ff" converts to a signed frame count, with ff below frames per foot (else None). "-0+05" means -5.
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(value, gauge):
per={'35mm4':16,'35mm2':32,'16mm':40}[gauge]
if isinstance(value,int):
sign='-' if value<0 else ''
v=abs(value)
return '%s%d+%02d'%(sign,v//per,v%per)
ft,fr=value.split('+')
if int(fr)>=per:
return None
n=int(ft)*per+int(fr)
return -n if ft.startswith('-') else n
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: magnitude composition', ['-3+20', '35mm2'], -116), ('regression variant: magnitude composition', ['-1+20', '16mm'], -60), ('partial repair probe: magnitude composition', ['-3+16', '16mm'], -136), ('partial repair variant: magnitude composition', ['-3+01', '35mm4'], -49), ('boundary control', [16, '35mm4'], '1+00'), ('boundary control', ['1+15', '35mm4'], 31), ('normal control', [-1, '35mm4'], '-0+01'), ('normal control', ['0+16', '35mm4'], None), ('normal control', ['2+39', '16mm'], 119)], [('regression: magnitude composition', ['-3+00', '35mm2'], -96), ('regression variant: magnitude composition', ['-1+32', '16mm'], -72), ('partial repair probe: magnitude composition', ['-3+15', '16mm'], -135), ('partial repair variant: magnitude composition', ['-1+31', '35mm2'], -63), ('boundary control', [-1, '35mm4'], '-0+01'), ('boundary control', ['0+16', '35mm4'], None), ('normal control', [-1, '35mm2'], '-0+01'), ('normal control', [1, '16mm'], '0+01'), ('normal control', ['100+16', '16mm'], 4016)], [('regression: magnitude composition', ['-3+01', '35mm2'], -97), ('regression variant: magnitude composition', ['-3+15', '35mm2'], -111), ('partial repair probe: magnitude composition', ['-1+20', '16mm'], -60), ('partial repair variant: magnitude composition', ['-1+20', '35mm2'], -52), ('boundary control', ['-0+05', '35mm4'], -5), ('boundary control', ['2+39', '16mm'], 119), ('normal control', [0, '16mm'], '0+00'), ('normal control', ['100+16', '35mm2'], 3216), ('normal control', [-5, '16mm'], '-0+05')], [('regression: magnitude composition', ['-3+16', '16mm'], -136), ('regression variant: magnitude composition', ['-1+15', '35mm4'], -31), ('partial repair probe: magnitude composition', ['-1+32', '16mm'], -72), ('partial repair variant: magnitude composition', ['-3+31', '16mm'], -151), ('boundary control', ['1+15', '35mm4'], 31), ('boundary control', [16, '35mm4'], '1+00'), ('normal control', [-40, '16mm'], '-1+00'), ('normal control', ['-3+32', '35mm2'], None), ('normal control', ['-0+16', '35mm4'], None)], [('regression: magnitude composition', ['-3+15', '16mm'], -135), ('regression variant: magnitude composition', ['-3+00', '35mm4'], -48), ('partial repair probe: magnitude composition', ['-3+15', '35mm2'], -111), ('partial repair variant: magnitude composition', ['-3+20', '16mm'], -140), ('boundary control', ['0+16', '35mm4'], None), ('boundary control', [-1, '35mm4'], '-0+01'), ('normal control', [39, '16mm'], '0+39'), ('normal control', ['0+00', '35mm2'], 0), ('normal control', [-5, '35mm2'], '-0+05')]]
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: magnitude composition | 76 | -116 | Failed |
| regression variant: magnitude composition | 20 | -60 | Failed |
| partial repair probe: magnitude composition | 104 | -136 | Failed |
| partial repair variant: magnitude composition | 47 | -49 | Failed |
| boundary control | 1+00 | 1+00 | Passed |
| boundary control | 31 | 31 | Passed |
| normal control | -0+01 | -0+01 | Passed |
| normal control | None | None | Passed |
| normal control | 119 | 119 | Passed |
SHA-256 / 92005760dd39638f0f473482c35f6b0603b5c5d5bff4dd4b9a7fe0174f10ffca
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(value, gauge):
per={'35mm4':16,'35mm2':32,'16mm':40}[gauge]
if isinstance(value,int):
sign='-' if value<0 else ''
v=abs(value)
return '%s%d+%02d'%(sign,v//per,v%per)
ft,fr=value.split('+')
if int(fr)>=per:
return None
n=abs(int(ft)*per+int(fr))
return -n if ft.startswith('-') else n
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: magnitude composition', ['-3+20', '35mm2'], -116), ('regression variant: magnitude composition', ['-1+20', '16mm'], -60), ('partial repair probe: magnitude composition', ['-3+16', '16mm'], -136), ('partial repair variant: magnitude composition', ['-3+01', '35mm4'], -49), ('boundary control', [16, '35mm4'], '1+00'), ('boundary control', ['1+15', '35mm4'], 31), ('normal control', [-1, '35mm4'], '-0+01'), ('normal control', ['0+16', '35mm4'], None), ('normal control', ['2+39', '16mm'], 119)], [('regression: magnitude composition', ['-3+00', '35mm2'], -96), ('regression variant: magnitude composition', ['-1+32', '16mm'], -72), ('partial repair probe: magnitude composition', ['-3+15', '16mm'], -135), ('partial repair variant: magnitude composition', ['-1+31', '35mm2'], -63), ('boundary control', [-1, '35mm4'], '-0+01'), ('boundary control', ['0+16', '35mm4'], None), ('normal control', [-1, '35mm2'], '-0+01'), ('normal control', [1, '16mm'], '0+01'), ('normal control', ['100+16', '16mm'], 4016)], [('regression: magnitude composition', ['-3+01', '35mm2'], -97), ('regression variant: magnitude composition', ['-3+15', '35mm2'], -111), ('partial repair probe: magnitude composition', ['-1+20', '16mm'], -60), ('partial repair variant: magnitude composition', ['-1+20', '35mm2'], -52), ('boundary control', ['-0+05', '35mm4'], -5), ('boundary control', ['2+39', '16mm'], 119), ('normal control', [0, '16mm'], '0+00'), ('normal control', ['100+16', '35mm2'], 3216), ('normal control', [-5, '16mm'], '-0+05')], [('regression: magnitude composition', ['-3+16', '16mm'], -136), ('regression variant: magnitude composition', ['-1+15', '35mm4'], -31), ('partial repair probe: magnitude composition', ['-1+32', '16mm'], -72), ('partial repair variant: magnitude composition', ['-3+31', '16mm'], -151), ('boundary control', ['1+15', '35mm4'], 31), ('boundary control', [16, '35mm4'], '1+00'), ('normal control', [-40, '16mm'], '-1+00'), ('normal control', ['-3+32', '35mm2'], None), ('normal control', ['-0+16', '35mm4'], None)], [('regression: magnitude composition', ['-3+15', '16mm'], -135), ('regression variant: magnitude composition', ['-3+00', '35mm4'], -48), ('partial repair probe: magnitude composition', ['-3+15', '35mm2'], -111), ('partial repair variant: magnitude composition', ['-3+20', '16mm'], -140), ('boundary control', ['0+16', '35mm4'], None), ('boundary control', [-1, '35mm4'], '-0+01'), ('normal control', [39, '16mm'], '0+39'), ('normal control', ['0+00', '35mm2'], 0), ('normal control', [-5, '35mm2'], '-0+05')]]
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: magnitude composition | -76 | -116 | Failed |
| regression variant: magnitude composition | -20 | -60 | Failed |
| partial repair probe: magnitude composition | -104 | -136 | Failed |
| partial repair variant: magnitude composition | -47 | -49 | Failed |
| boundary control | 1+00 | 1+00 | Passed |
| boundary control | 31 | 31 | Passed |
| normal control | -0+01 | -0+01 | Passed |
| normal control | None | None | Passed |
| normal control | 119 | 119 | Passed |
SHA-256 / ea7574f831e8ea2d7b2a73ac394d8785a7293b52fe574c59b610c50f9ded5adc
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(value, gauge):
per={'35mm4':16,'35mm2':32,'16mm':40}[gauge]
if isinstance(value,int):
sign='-' if value<0 else ''
v=abs(value)
return '%s%d+%02d'%(sign,v//per,v%per)
ft,fr=value.split('+')
if int(fr)>=per:
return None
n=abs(int(ft))*per+int(fr)
return -n if ft.startswith('-') else n
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: magnitude composition', ['-3+20', '35mm2'], -116), ('regression variant: magnitude composition', ['-1+20', '16mm'], -60), ('partial repair probe: magnitude composition', ['-3+16', '16mm'], -136), ('partial repair variant: magnitude composition', ['-3+01', '35mm4'], -49), ('boundary control', [16, '35mm4'], '1+00'), ('boundary control', ['1+15', '35mm4'], 31), ('normal control', [-1, '35mm4'], '-0+01'), ('normal control', ['0+16', '35mm4'], None), ('normal control', ['2+39', '16mm'], 119)], [('regression: magnitude composition', ['-3+00', '35mm2'], -96), ('regression variant: magnitude composition', ['-1+32', '16mm'], -72), ('partial repair probe: magnitude composition', ['-3+15', '16mm'], -135), ('partial repair variant: magnitude composition', ['-1+31', '35mm2'], -63), ('boundary control', [-1, '35mm4'], '-0+01'), ('boundary control', ['0+16', '35mm4'], None), ('normal control', [-1, '35mm2'], '-0+01'), ('normal control', [1, '16mm'], '0+01'), ('normal control', ['100+16', '16mm'], 4016)], [('regression: magnitude composition', ['-3+01', '35mm2'], -97), ('regression variant: magnitude composition', ['-3+15', '35mm2'], -111), ('partial repair probe: magnitude composition', ['-1+20', '16mm'], -60), ('partial repair variant: magnitude composition', ['-1+20', '35mm2'], -52), ('boundary control', ['-0+05', '35mm4'], -5), ('boundary control', ['2+39', '16mm'], 119), ('normal control', [0, '16mm'], '0+00'), ('normal control', ['100+16', '35mm2'], 3216), ('normal control', [-5, '16mm'], '-0+05')], [('regression: magnitude composition', ['-3+16', '16mm'], -136), ('regression variant: magnitude composition', ['-1+15', '35mm4'], -31), ('partial repair probe: magnitude composition', ['-1+32', '16mm'], -72), ('partial repair variant: magnitude composition', ['-3+31', '16mm'], -151), ('boundary control', ['1+15', '35mm4'], 31), ('boundary control', [16, '35mm4'], '1+00'), ('normal control', [-40, '16mm'], '-1+00'), ('normal control', ['-3+32', '35mm2'], None), ('normal control', ['-0+16', '35mm4'], None)], [('regression: magnitude composition', ['-3+15', '16mm'], -135), ('regression variant: magnitude composition', ['-3+00', '35mm4'], -48), ('partial repair probe: magnitude composition', ['-3+15', '35mm2'], -111), ('partial repair variant: magnitude composition', ['-3+20', '16mm'], -140), ('boundary control', ['0+16', '35mm4'], None), ('boundary control', [-1, '35mm4'], '-0+01'), ('normal control', [39, '16mm'], '0+39'), ('normal control', ['0+00', '35mm2'], 0), ('normal control', [-5, '35mm2'], '-0+05')]]
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: magnitude composition | -116 | -116 | Passed |
| regression variant: magnitude composition | -60 | -60 | Passed |
| partial repair probe: magnitude composition | -136 | -136 | Passed |
| partial repair variant: magnitude composition | -49 | -49 | Passed |
| boundary control | 1+00 | 1+00 | Passed |
| boundary control | 31 | 31 | Passed |
| normal control | -0+01 | -0+01 | Passed |
| normal control | None | None | Passed |
| normal control | 119 | 119 | Passed |
SHA-256 / 7e4480cce81027ea9445329977cbde79e101b96619e7337f12c9e0cbf1d701d7
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:35.983696+00:00.
Case digest / c151fbcf8041422779ff204b3877d8d91c6fd96410a600dad0cc7ecec521f598