FA-49756 / PCM sample encoding / Open access
Pcm adaptive nibble selection: magnitude remainder · case 01
A selected magnitude bit does not reduce the remaining residual.
ROOT CAUSE
A selected magnitude bit does not reduce the remaining residual.
VERIFIED REPAIR
Use the stated conversion contract at magnitude remainder.
Unsuccessful approach: Subtracting bit code rather than amplitude weight changes later decisions.
Case contract
Bounded fixed-step adaptive-nibble PCM encoder: greedy magnitude bits, a half-bin base, and predictor feedback from reconstructed rather than original amplitudes.
Why this case matters
Offline PCM interchange uses these exact bounded packet and sample representation decisions.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(samples, predictor, step):
out=[]
for sample in samples:
difference=sample-predictor
sign=8 if difference<0 else 0
magnitude=abs(difference)
code=0
restored=step//8
for bit,part in [(4,step),(2,step//2),(1,step//4)]:
if magnitude>=part:
code|=bit
magnitude=magnitude
restored+=part
predictor+=-restored if sign else restored
out.append(sign|code)
return [out,predictor]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([2, 6, -4, 10], 0, 8)), [[1, 1, 13, 7], 10])
check('oracle 2', solve(*([10, 10, 10], 3, 12)), [[2, 0, 8], 10])
check('oracle 3', solve(*([-5, -10, 0], 0, 8)), [[10, 10, 5], 1])
check('oracle 4', solve(*([], 4, 8)), [[], 4])
check('oracle 5', solve(*([0, 1, 2, 3], 0, 16)), [[0, 8, 0, 0], 4])
check('oracle 6', solve(*([8, 16, 24], 0, 8)), [[4, 3, 4], 25])
check('oracle 7', solve(*([6, -6, 6], 1, 4)), [[5, 15, 7], 6])
if N == 1: check('variant packet 1', solve(*[[2, 6, -4, 10, 2, 6, -4, 10], 0, 8]), [[1, 1, 13, 7, 12, 2, 13, 7], 10])
if N == 2: check('variant packet 2', solve(*[[2, 6, -4, 10, 2, 6, -4, 10, 2, 6, -4, 10], 0, 8]), [[1, 1, 13, 7, 12, 2, 13, 7, 12, 2, 13, 7], 10])
if N == 3: check('variant packet 3', solve(*[[2, 6, -4, 10, 2, 6, -4, 10, 2, 6, -4, 10, 2, 6, -4, 10], 0, 8]), [[1, 1, 13, 7, 12, 2, 13, 7, 12, 2, 13, 7, 12, 2, 13, 7], 10])
if N == 4: check('variant packet 4', solve(*[[2, 6, -4, 10, 2, 6, -4, 10, 2, 6, -4, 10, 2, 6, -4, 10, 2, 6, -4, 10], 0, 8]), [[1, 1, 13, 7, 12, 2, 13, 7, 12, 2, 13, 7, 12, 2, 13, 7, 12, 2, 13, 7], 10])
if N == 5: check('variant packet 5', solve(*[[2, 6, -4, 10, 2, 6, -4, 10, 2, 6, -4, 10, 2, 6, -4, 10, 2, 6, -4, 10, 2, 6, -4, 10], 0, 8]), [[1, 1, 13, 7, 12, 2, 13, 7, 12, 2, 13, 7, 12, 2, 13, 7, 12, 2, 13, 7, 12, 2, 13, 7], 10])
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 |
|---|---|---|---|
| oracle 1 | [[1, 1, 15, 7], 6] | [[1, 1, 13, 7], 10] | Failed |
| oracle 2 | [[3, 9, 0], 10] | [[2, 0, 8], 10] | Failed |
| oracle 3 | [[11, 9, 7], 5] | [[10, 10, 5], 1] | Failed |
| oracle 4 | [[], 4] | [[], 4] | Passed |
| oracle 5 | [[0, 8, 0, 0], 4] | [[0, 8, 0, 0], 4] | Passed |
| oracle 6 | [[7, 0, 7], 31] | [[4, 3, 4], 25] | Failed |
| oracle 7 | [[7, 15, 7], 8] | [[5, 15, 7], 6] | Failed |
| variant packet 1 | [[1, 1, 15, 7, 11, 3, 15, 7], 6] | [[1, 1, 13, 7, 12, 2, 13, 7], 10] | Failed |
SHA-256 / 54e08c44a04800591c67c86823e92f7eb10904e7634d8f640eac0d91f2b7f04e
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(samples, predictor, step):
out=[]
for sample in samples:
difference=sample-predictor
sign=8 if difference<0 else 0
magnitude=abs(difference)
code=0
restored=step//8
for bit,part in [(4,step),(2,step//2),(1,step//4)]:
if magnitude>=part:
code|=bit
magnitude-=bit
restored+=part
predictor+=-restored if sign else restored
out.append(sign|code)
return [out,predictor]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([2, 6, -4, 10], 0, 8)), [[1, 1, 13, 7], 10])
check('oracle 2', solve(*([10, 10, 10], 3, 12)), [[2, 0, 8], 10])
check('oracle 3', solve(*([-5, -10, 0], 0, 8)), [[10, 10, 5], 1])
check('oracle 4', solve(*([], 4, 8)), [[], 4])
check('oracle 5', solve(*([0, 1, 2, 3], 0, 16)), [[0, 8, 0, 0], 4])
check('oracle 6', solve(*([8, 16, 24], 0, 8)), [[4, 3, 4], 25])
check('oracle 7', solve(*([6, -6, 6], 1, 4)), [[5, 15, 7], 6])
if N == 1: check('variant packet 1', solve(*[[2, 6, -4, 10, 2, 6, -4, 10], 0, 8]), [[1, 1, 13, 7, 12, 2, 13, 7], 10])
if N == 2: check('variant packet 2', solve(*[[2, 6, -4, 10, 2, 6, -4, 10, 2, 6, -4, 10], 0, 8]), [[1, 1, 13, 7, 12, 2, 13, 7, 12, 2, 13, 7], 10])
if N == 3: check('variant packet 3', solve(*[[2, 6, -4, 10, 2, 6, -4, 10, 2, 6, -4, 10, 2, 6, -4, 10], 0, 8]), [[1, 1, 13, 7, 12, 2, 13, 7, 12, 2, 13, 7, 12, 2, 13, 7], 10])
if N == 4: check('variant packet 4', solve(*[[2, 6, -4, 10, 2, 6, -4, 10, 2, 6, -4, 10, 2, 6, -4, 10, 2, 6, -4, 10], 0, 8]), [[1, 1, 13, 7, 12, 2, 13, 7, 12, 2, 13, 7, 12, 2, 13, 7, 12, 2, 13, 7], 10])
if N == 5: check('variant packet 5', solve(*[[2, 6, -4, 10, 2, 6, -4, 10, 2, 6, -4, 10, 2, 6, -4, 10, 2, 6, -4, 10, 2, 6, -4, 10], 0, 8]), [[1, 1, 13, 7, 12, 2, 13, 7, 12, 2, 13, 7, 12, 2, 13, 7, 12, 2, 13, 7, 12, 2, 13, 7], 10])
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 |
|---|---|---|---|
| oracle 1 | [[1, 1, 15, 7], 6] | [[1, 1, 13, 7], 10] | Failed |
| oracle 2 | [[3, 9, 0], 10] | [[2, 0, 8], 10] | Failed |
| oracle 3 | [[11, 9, 7], 5] | [[10, 10, 5], 1] | Failed |
| oracle 4 | [[], 4] | [[], 4] | Passed |
| oracle 5 | [[0, 8, 0, 0], 4] | [[0, 8, 0, 0], 4] | Passed |
| oracle 6 | [[7, 0, 7], 31] | [[4, 3, 4], 25] | Failed |
| oracle 7 | [[5, 15, 7], 6] | [[5, 15, 7], 6] | Passed |
| variant packet 1 | [[1, 1, 15, 7, 11, 3, 15, 7], 6] | [[1, 1, 13, 7, 12, 2, 13, 7], 10] | Failed |
SHA-256 / c57d03e6bdee434f2599d2884e25ea3144391112186fc6ed91cd96dc68e82b46
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(samples, predictor, step):
out=[]
for sample in samples:
difference=sample-predictor
sign=8 if difference<0 else 0
magnitude=abs(difference)
code=0
restored=step//8
for bit,part in [(4,step),(2,step//2),(1,step//4)]:
if magnitude>=part:
code|=bit
magnitude-=part
restored+=part
predictor+=-restored if sign else restored
out.append(sign|code)
return [out,predictor]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([2, 6, -4, 10], 0, 8)), [[1, 1, 13, 7], 10])
check('oracle 2', solve(*([10, 10, 10], 3, 12)), [[2, 0, 8], 10])
check('oracle 3', solve(*([-5, -10, 0], 0, 8)), [[10, 10, 5], 1])
check('oracle 4', solve(*([], 4, 8)), [[], 4])
check('oracle 5', solve(*([0, 1, 2, 3], 0, 16)), [[0, 8, 0, 0], 4])
check('oracle 6', solve(*([8, 16, 24], 0, 8)), [[4, 3, 4], 25])
check('oracle 7', solve(*([6, -6, 6], 1, 4)), [[5, 15, 7], 6])
if N == 1: check('variant packet 1', solve(*[[2, 6, -4, 10, 2, 6, -4, 10], 0, 8]), [[1, 1, 13, 7, 12, 2, 13, 7], 10])
if N == 2: check('variant packet 2', solve(*[[2, 6, -4, 10, 2, 6, -4, 10, 2, 6, -4, 10], 0, 8]), [[1, 1, 13, 7, 12, 2, 13, 7, 12, 2, 13, 7], 10])
if N == 3: check('variant packet 3', solve(*[[2, 6, -4, 10, 2, 6, -4, 10, 2, 6, -4, 10, 2, 6, -4, 10], 0, 8]), [[1, 1, 13, 7, 12, 2, 13, 7, 12, 2, 13, 7, 12, 2, 13, 7], 10])
if N == 4: check('variant packet 4', solve(*[[2, 6, -4, 10, 2, 6, -4, 10, 2, 6, -4, 10, 2, 6, -4, 10, 2, 6, -4, 10], 0, 8]), [[1, 1, 13, 7, 12, 2, 13, 7, 12, 2, 13, 7, 12, 2, 13, 7, 12, 2, 13, 7], 10])
if N == 5: check('variant packet 5', solve(*[[2, 6, -4, 10, 2, 6, -4, 10, 2, 6, -4, 10, 2, 6, -4, 10, 2, 6, -4, 10, 2, 6, -4, 10], 0, 8]), [[1, 1, 13, 7, 12, 2, 13, 7, 12, 2, 13, 7, 12, 2, 13, 7, 12, 2, 13, 7, 12, 2, 13, 7], 10])
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 |
|---|---|---|---|
| oracle 1 | [[1, 1, 13, 7], 10] | [[1, 1, 13, 7], 10] | Passed |
| oracle 2 | [[2, 0, 8], 10] | [[2, 0, 8], 10] | Passed |
| oracle 3 | [[10, 10, 5], 1] | [[10, 10, 5], 1] | Passed |
| oracle 4 | [[], 4] | [[], 4] | Passed |
| oracle 5 | [[0, 8, 0, 0], 4] | [[0, 8, 0, 0], 4] | Passed |
| oracle 6 | [[4, 3, 4], 25] | [[4, 3, 4], 25] | Passed |
| oracle 7 | [[5, 15, 7], 6] | [[5, 15, 7], 6] | Passed |
| variant packet 1 | [[1, 1, 13, 7, 12, 2, 13, 7], 10] | [[1, 1, 13, 7, 12, 2, 13, 7], 10] | Passed |
SHA-256 / 534d9e881616e3a48d8bf1858d3373a1afd0e6587667e3ba78af3402ed89fa60
Verification & scope
Stipulated finite model; no claim of hardware timing or full file-format conformance. 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:45:02.874735+00:00.
Case digest / 3f80dc3869657a12fd4b07058ba0f54cd77193084cfbc5d105d916e447f037ee