FAILURE MAP
← Case archive

FA-49746 / PCM sample encoding / Open access

Pcm adaptive nibble selection: sign magnitude · case 01

Negative residuals are not converted to magnitude before bit decisions.

Verified by executionVariant 1 · 8 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

Negative residuals are not converted to magnitude before bit decisions.

VERIFIED REPAIR

Use the stated conversion contract at sign magnitude.

Unsuccessful approach: Taking input magnitude ignores the current predictor level.

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=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 fixtureActualExpectedOutcome
oracle 1[[1, 1, 8, 2], 10][[1, 1, 13, 7], 10]Failed
oracle 2[[2, 0, 8], 10][[2, 0, 8], 10]Passed
oracle 3[[8, 8, 1], 1][[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[[4, 3, 4], 25][[4, 3, 4], 25]Passed
oracle 7[[5, 8, 0], 6][[5, 15, 7], 6]Failed
variant packet 1[[1, 1, 8, 2, 8, 8, 8, 1], 10][[1, 1, 13, 7, 12, 2, 13, 7], 10]Failed

SHA-256 / 8db5dbcaf3391212d16e90ecb669727fc360e1f3cfa8c6613fe497a719164765

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(sample)
        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 fixtureActualExpectedOutcome
oracle 1[[1, 3, 10, 5], 16][[1, 1, 13, 7], 10]Failed
oracle 2[[3, 11, 3], 13][[2, 0, 8], 10]Failed
oracle 3[[10, 13, 0], -15][[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[[4, 7, 7], 39][[4, 3, 4], 25]Failed
oracle 7[[6, 14, 6], 7][[5, 15, 7], 6]Failed
variant packet 1[[1, 3, 10, 5, 9, 11, 10, 5], 12][[1, 1, 13, 7, 12, 2, 13, 7], 10]Failed

SHA-256 / 6b0ba1513b38a675a95a3a33cf51f250944989ce5ae350ebae72bc8c482da6b6

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 fixtureActualExpectedOutcome
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.870547+00:00.

Case digest / 6c0d813bd1a1d5ef279c487ccc1067758f6216e284ab181eaa37e720e8322800