FAILURE MAP
← Case archive

FA-49961 / PCM sample encoding / Open access

Pcm companding segment code: magnitude selection · case 01

Negative amplitudes cannot advance through magnitude segments.

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

ROOT CAUSE

Negative amplitudes cannot advance through magnitude segments.

THE FAILURE

Negative amplitudes cannot advance through magnitude segments.

Unsuccessful approach: The first amplitude selects the segment of every later sample.

Case contract

Encode bounded PCM magnitude into an explicitly stipulated piecewise companding table: sign sideband, selected lower-bound segment and shifted residual mantissa.

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, edges, shifts):
    out=[]
    for sample in samples:
        negative=sample<0
        magnitude=sample
        segment=0
        while segment+1<len(edges) and magnitude>=edges[segment+1]:
            segment+=1
        residual=max(0,magnitude-edges[segment])
        mantissa=residual>>shifts[segment]
        out.append([negative,segment,mantissa])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([-15, -4, 0, 4, 15], [0, 4, 12], [0, 1, 3])), [[True, 2, 0], [True, 1, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0]])
check('oracle 2', solve(*([0, 2, 3, 8], [0, 3, 8], [0, 2, 2])), [[False, 0, 0], [False, 0, 2], [False, 1, 0], [False, 2, 0]])
check('oracle 3', solve(*([1, 2, 3], [0], [1])), [[False, 0, 0], [False, 0, 1], [False, 0, 1]])
check('oracle 4', solve(*([], [0, 8], [1, 3])), [])
check('oracle 5', solve(*([-8, 8, 9], [0, 8], [0, 3])), [[True, 1, 0], [False, 1, 0], [False, 1, 0]])
check('oracle 6', solve(*([0, 1, 16], [0, 1, 16], [0, 0, 2])), [[False, 0, 0], [False, 1, 0], [False, 2, 0]])
check('oracle 7', solve(*([7, -7], [0, 4], [1, 0])), [[False, 1, 3], [True, 1, 3]])
if N == 1: check('variant packet 1', solve(*[[-15, -4, 0, 4, 15, -15, -4, 0, 4, 15], [0, 4, 12], [0, 1, 3]]), [[True, 2, 0], [True, 1, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0], [True, 2, 0], [True, 1, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0]])
if N == 2: check('variant packet 2', solve(*[[-15, -4, 0, 4, 15, -15, -4, 0, 4, 15, -15, -4, 0, 4, 15], [0, 4, 12], [0, 1, 3]]), [[True, 2, 0], [True, 1, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0], [True, 2, 0], [True, 1, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0], [True, 2, 0], [True, 1, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0]])
if N == 3: check('variant packet 3', solve(*[[-15, -4, 0, 4, 15, -15, -4, 0, 4, 15, -15, -4, 0, 4, 15, -15, -4, 0, 4, 15], [0, 4, 12], [0, 1, 3]]), [[True, 2, 0], [True, 1, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0], [True, 2, 0], [True, 1, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0], [True, 2, 0], [True, 1, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0], [True, 2, 0], [True, 1, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0]])
if N == 4: check('variant packet 4', solve(*[[-15, -4, 0, 4, 15, -15, -4, 0, 4, 15, -15, -4, 0, 4, 15, -15, -4, 0, 4, 15, -15, -4, 0, 4, 15], [0, 4, 12], [0, 1, 3]]), [[True, 2, 0], [True, 1, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0], [True, 2, 0], [True, 1, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0], [True, 2, 0], [True, 1, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0], [True, 2, 0], [True, 1, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0], [True, 2, 0], [True, 1, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0]])
if N == 5: check('variant packet 5', solve(*[[-15, -4, 0, 4, 15, -15, -4, 0, 4, 15, -15, -4, 0, 4, 15, -15, -4, 0, 4, 15, -15, -4, 0, 4, 15, -15, -4, 0, 4, 15], [0, 4, 12], [0, 1, 3]]), [[True, 2, 0], [True, 1, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0], [True, 2, 0], [True, 1, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0], [True, 2, 0], [True, 1, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0], [True, 2, 0], [True, 1, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0], [True, 2, 0], [True, 1, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0], [True, 2, 0], [True, 1, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0]])
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[[True, 0, 0], [True, 0, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0]][[True, 2, 0], [True, 1, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0]]Failed
oracle 2[[False, 0, 0], [False, 0, 2], [False, 1, 0], [False, 2, 0]][[False, 0, 0], [False, 0, 2], [False, 1, 0], [False, 2, 0]]Passed
oracle 3[[False, 0, 0], [False, 0, 1], [False, 0, 1]][[False, 0, 0], [False, 0, 1], [False, 0, 1]]Passed
oracle 4[][]Passed
oracle 5[[True, 0, 0], [False, 1, 0], [False, 1, 0]][[True, 1, 0], [False, 1, 0], [False, 1, 0]]Failed
oracle 6[[False, 0, 0], [False, 1, 0], [False, 2, 0]][[False, 0, 0], [False, 1, 0], [False, 2, 0]]Passed
oracle 7[[False, 1, 3], [True, 0, 0]][[False, 1, 3], [True, 1, 3]]Failed
variant packet 1[[True, 0, 0], [True, 0, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0], [True, 0, 0], [True, 0, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0]][[True, 2, 0], [True, 1, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0], [True, 2, 0], [True, 1, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0]]Failed

SHA-256 / 43d7687a8698a80eac25192f7dca415be66adf4b2fc001f70eb7332af02c0d95

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(samples, edges, shifts):
    out=[]
    for sample in samples:
        negative=sample<0
        magnitude=abs(samples[0])
        segment=0
        while segment+1<len(edges) and magnitude>=edges[segment+1]:
            segment+=1
        residual=max(0,magnitude-edges[segment])
        mantissa=residual>>shifts[segment]
        out.append([negative,segment,mantissa])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([-15, -4, 0, 4, 15], [0, 4, 12], [0, 1, 3])), [[True, 2, 0], [True, 1, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0]])
check('oracle 2', solve(*([0, 2, 3, 8], [0, 3, 8], [0, 2, 2])), [[False, 0, 0], [False, 0, 2], [False, 1, 0], [False, 2, 0]])
check('oracle 3', solve(*([1, 2, 3], [0], [1])), [[False, 0, 0], [False, 0, 1], [False, 0, 1]])
check('oracle 4', solve(*([], [0, 8], [1, 3])), [])
check('oracle 5', solve(*([-8, 8, 9], [0, 8], [0, 3])), [[True, 1, 0], [False, 1, 0], [False, 1, 0]])
check('oracle 6', solve(*([0, 1, 16], [0, 1, 16], [0, 0, 2])), [[False, 0, 0], [False, 1, 0], [False, 2, 0]])
check('oracle 7', solve(*([7, -7], [0, 4], [1, 0])), [[False, 1, 3], [True, 1, 3]])
if N == 1: check('variant packet 1', solve(*[[-15, -4, 0, 4, 15, -15, -4, 0, 4, 15], [0, 4, 12], [0, 1, 3]]), [[True, 2, 0], [True, 1, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0], [True, 2, 0], [True, 1, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0]])
if N == 2: check('variant packet 2', solve(*[[-15, -4, 0, 4, 15, -15, -4, 0, 4, 15, -15, -4, 0, 4, 15], [0, 4, 12], [0, 1, 3]]), [[True, 2, 0], [True, 1, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0], [True, 2, 0], [True, 1, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0], [True, 2, 0], [True, 1, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0]])
if N == 3: check('variant packet 3', solve(*[[-15, -4, 0, 4, 15, -15, -4, 0, 4, 15, -15, -4, 0, 4, 15, -15, -4, 0, 4, 15], [0, 4, 12], [0, 1, 3]]), [[True, 2, 0], [True, 1, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0], [True, 2, 0], [True, 1, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0], [True, 2, 0], [True, 1, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0], [True, 2, 0], [True, 1, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0]])
if N == 4: check('variant packet 4', solve(*[[-15, -4, 0, 4, 15, -15, -4, 0, 4, 15, -15, -4, 0, 4, 15, -15, -4, 0, 4, 15, -15, -4, 0, 4, 15], [0, 4, 12], [0, 1, 3]]), [[True, 2, 0], [True, 1, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0], [True, 2, 0], [True, 1, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0], [True, 2, 0], [True, 1, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0], [True, 2, 0], [True, 1, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0], [True, 2, 0], [True, 1, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0]])
if N == 5: check('variant packet 5', solve(*[[-15, -4, 0, 4, 15, -15, -4, 0, 4, 15, -15, -4, 0, 4, 15, -15, -4, 0, 4, 15, -15, -4, 0, 4, 15, -15, -4, 0, 4, 15], [0, 4, 12], [0, 1, 3]]), [[True, 2, 0], [True, 1, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0], [True, 2, 0], [True, 1, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0], [True, 2, 0], [True, 1, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0], [True, 2, 0], [True, 1, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0], [True, 2, 0], [True, 1, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0], [True, 2, 0], [True, 1, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0]])
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[[True, 2, 0], [True, 2, 0], [False, 2, 0], [False, 2, 0], [False, 2, 0]][[True, 2, 0], [True, 1, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0]]Failed
oracle 2[[False, 0, 0], [False, 0, 0], [False, 0, 0], [False, 0, 0]][[False, 0, 0], [False, 0, 2], [False, 1, 0], [False, 2, 0]]Failed
oracle 3[[False, 0, 0], [False, 0, 0], [False, 0, 0]][[False, 0, 0], [False, 0, 1], [False, 0, 1]]Failed
oracle 4[][]Passed
oracle 5[[True, 1, 0], [False, 1, 0], [False, 1, 0]][[True, 1, 0], [False, 1, 0], [False, 1, 0]]Passed
oracle 6[[False, 0, 0], [False, 0, 0], [False, 0, 0]][[False, 0, 0], [False, 1, 0], [False, 2, 0]]Failed
oracle 7[[False, 1, 3], [True, 1, 3]][[False, 1, 3], [True, 1, 3]]Passed
variant packet 1[[True, 2, 0], [True, 2, 0], [False, 2, 0], [False, 2, 0], [False, 2, 0], [True, 2, 0], [True, 2, 0], [False, 2, 0], [False, 2, 0], [False, 2, 0]][[True, 2, 0], [True, 1, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0], [True, 2, 0], [True, 1, 0], [False, 0, 0], [False, 1, 0], [False, 2, 0]]Failed

SHA-256 / 2099fd3dd047d9504d818856be90720ce02ea05e58bcb05fa6b193b962b12b8b

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 8 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

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

Case digest / 44c978b8662d8121dacdd5246856f3dc8528450b0f34be84cc61048c018616ac