FAILURE MAP
← Case archive

FA-49876 / PCM sample encoding / Open access

Pcm alaw code selection: small segment shift · case 01

The first segment uses the general exponent rule instead of its special mantissa shift.

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

ROOT CAUSE

The first segment uses the general exponent rule instead of its special mantissa shift.

THE FAILURE

The first segment uses the general exponent rule instead of its special mantissa shift.

Unsuccessful approach: Shifting every nonzero segment one extra bit loses mantissa resolution.

Case contract

Stipulated bounded A-law-style PCM encoder with negative complement offset, thirteen-bit working magnitude, segment-specific shifts and alternating wire mask.

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):
    out=[]
    for sample in samples:
        negative=sample<0
        magnitude=(-sample-1 if negative else sample)>>3
        magnitude=min(magnitude,4095)
        segment=0
        while segment<7 and magnitude>=(32<<segment):
            segment+=1
        shift=segment
        mantissa=(magnitude>>shift)&15
        code=(0 if negative else 128)|(segment<<4)|mantissa
        out.append(code^85)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([0, 8, -8, 16, -16],)), [213, 213, 85, 212, 85])
check('oracle 2', solve(*([256, -256, 264, -264],)), [197, 90, 197, 69])
check('oracle 3', solve(*([32767, -32768, 40000, -40000],)), [170, 42, 170, 42])
check('oracle 4', solve(*([],)), [])
check('oracle 5', solve(*([1024, 2048, 8192],)), [229, 149, 181])
check('oracle 6', solve(*([1, -1, 127, -128],)), [213, 85, 210, 82])
check('oracle 7', solve(*([512, -513, 4096, -4097],)), [245, 117, 133, 5])
if N == 1: check('variant packet 1', solve(*[[0, 8, -8, 16, -16, 0, 8, -8, 16, -16]]), [213, 213, 85, 212, 85, 213, 213, 85, 212, 85])
if N == 2: check('variant packet 2', solve(*[[0, 8, -8, 16, -16, 0, 8, -8, 16, -16, 0, 8, -8, 16, -16]]), [213, 213, 85, 212, 85, 213, 213, 85, 212, 85, 213, 213, 85, 212, 85])
if N == 3: check('variant packet 3', solve(*[[0, 8, -8, 16, -16, 0, 8, -8, 16, -16, 0, 8, -8, 16, -16, 0, 8, -8, 16, -16]]), [213, 213, 85, 212, 85, 213, 213, 85, 212, 85, 213, 213, 85, 212, 85, 213, 213, 85, 212, 85])
if N == 4: check('variant packet 4', solve(*[[0, 8, -8, 16, -16, 0, 8, -8, 16, -16, 0, 8, -8, 16, -16, 0, 8, -8, 16, -16, 0, 8, -8, 16, -16]]), [213, 213, 85, 212, 85, 213, 213, 85, 212, 85, 213, 213, 85, 212, 85, 213, 213, 85, 212, 85, 213, 213, 85, 212, 85])
if N == 5: check('variant packet 5', solve(*[[0, 8, -8, 16, -16, 0, 8, -8, 16, -16, 0, 8, -8, 16, -16, 0, 8, -8, 16, -16, 0, 8, -8, 16, -16, 0, 8, -8, 16, -16]]), [213, 213, 85, 212, 85, 213, 213, 85, 212, 85, 213, 213, 85, 212, 85, 213, 213, 85, 212, 85, 213, 213, 85, 212, 85, 213, 213, 85, 212, 85])
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[213, 212, 85, 215, 84][213, 213, 85, 212, 85]Failed
oracle 2[197, 90, 197, 69][197, 90, 197, 69]Passed
oracle 3[170, 42, 170, 42][170, 42, 170, 42]Passed
oracle 4[][]Passed
oracle 5[229, 149, 181][229, 149, 181]Passed
oracle 6[213, 85, 218, 90][213, 85, 210, 82]Failed
oracle 7[245, 117, 133, 5][245, 117, 133, 5]Passed
variant packet 1[213, 212, 85, 215, 84, 213, 212, 85, 215, 84][213, 213, 85, 212, 85, 213, 213, 85, 212, 85]Failed

SHA-256 / 10af32bd85fa99c1a7bd0de9510d10666889758f26d126f7c4edd3658fba5d47

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(samples):
    out=[]
    for sample in samples:
        negative=sample<0
        magnitude=(-sample-1 if negative else sample)>>3
        magnitude=min(magnitude,4095)
        segment=0
        while segment<7 and magnitude>=(32<<segment):
            segment+=1
        shift=1 if segment==0 else segment+1
        mantissa=(magnitude>>shift)&15
        code=(0 if negative else 128)|(segment<<4)|mantissa
        out.append(code^85)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([0, 8, -8, 16, -16],)), [213, 213, 85, 212, 85])
check('oracle 2', solve(*([256, -256, 264, -264],)), [197, 90, 197, 69])
check('oracle 3', solve(*([32767, -32768, 40000, -40000],)), [170, 42, 170, 42])
check('oracle 4', solve(*([],)), [])
check('oracle 5', solve(*([1024, 2048, 8192],)), [229, 149, 181])
check('oracle 6', solve(*([1, -1, 127, -128],)), [213, 85, 210, 82])
check('oracle 7', solve(*([512, -513, 4096, -4097],)), [245, 117, 133, 5])
if N == 1: check('variant packet 1', solve(*[[0, 8, -8, 16, -16, 0, 8, -8, 16, -16]]), [213, 213, 85, 212, 85, 213, 213, 85, 212, 85])
if N == 2: check('variant packet 2', solve(*[[0, 8, -8, 16, -16, 0, 8, -8, 16, -16, 0, 8, -8, 16, -16]]), [213, 213, 85, 212, 85, 213, 213, 85, 212, 85, 213, 213, 85, 212, 85])
if N == 3: check('variant packet 3', solve(*[[0, 8, -8, 16, -16, 0, 8, -8, 16, -16, 0, 8, -8, 16, -16, 0, 8, -8, 16, -16]]), [213, 213, 85, 212, 85, 213, 213, 85, 212, 85, 213, 213, 85, 212, 85, 213, 213, 85, 212, 85])
if N == 4: check('variant packet 4', solve(*[[0, 8, -8, 16, -16, 0, 8, -8, 16, -16, 0, 8, -8, 16, -16, 0, 8, -8, 16, -16, 0, 8, -8, 16, -16]]), [213, 213, 85, 212, 85, 213, 213, 85, 212, 85, 213, 213, 85, 212, 85, 213, 213, 85, 212, 85, 213, 213, 85, 212, 85])
if N == 5: check('variant packet 5', solve(*[[0, 8, -8, 16, -16, 0, 8, -8, 16, -16, 0, 8, -8, 16, -16, 0, 8, -8, 16, -16, 0, 8, -8, 16, -16, 0, 8, -8, 16, -16]]), [213, 213, 85, 212, 85, 213, 213, 85, 212, 85, 213, 213, 85, 212, 85, 213, 213, 85, 212, 85, 213, 213, 85, 212, 85, 213, 213, 85, 212, 85])
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[213, 213, 85, 212, 85][213, 213, 85, 212, 85]Passed
oracle 2[205, 90, 205, 77][197, 90, 197, 69]Failed
oracle 3[170, 42, 170, 42][170, 42, 170, 42]Passed
oracle 4[][]Passed
oracle 5[237, 157, 189][229, 149, 181]Failed
oracle 6[213, 85, 210, 82][213, 85, 210, 82]Passed
oracle 7[253, 125, 141, 13][245, 117, 133, 5]Failed
variant packet 1[213, 213, 85, 212, 85, 213, 213, 85, 212, 85][213, 213, 85, 212, 85, 213, 213, 85, 212, 85]Passed

SHA-256 / 423d64fa7074262276cfd2233551357b0ada6634f89fef2278fe68983e684e76

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

Case digest / f1a9825b18b4f625888f3479d306a9e4f23487862afcd49f006e6c7b98f2f83f