FAILURE MAP
← Case archive

FA-49871 / PCM sample encoding / Open access

Pcm alaw code selection: input resolution · case 01

A-law input reduction keeps one extra precision bit.

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

ROOT CAUSE

A-law input reduction keeps one extra precision bit.

VERIFIED REPAIR

Use the stated conversion contract at input resolution.

Unsuccessful approach: Dropping one extra bit halves the companding input range.

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)>>2
        magnitude=min(magnitude,4095)
        segment=0
        while segment<7 and magnitude>=(32<<segment):
            segment+=1
        shift=1 if segment<2 else 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[245, 74, 245, 117][197, 90, 197, 69]Failed
oracle 3[170, 42, 170, 42][170, 42, 170, 42]Passed
oracle 4[][]Passed
oracle 5[149, 133, 165][229, 149, 181]Failed
oracle 6[213, 85, 218, 90][213, 85, 210, 82]Failed
oracle 7[229, 101, 181, 53][245, 117, 133, 5]Failed
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 / 0971e904459bb72b4df8293bb1e83306623deac9c2e9bc3bf27e20e50020a99b

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)>>4
        magnitude=min(magnitude,4095)
        segment=0
        while segment<7 and magnitude>=(32<<segment):
            segment+=1
        shift=1 if segment<2 else 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, 213, 85, 213, 85][213, 213, 85, 212, 85]Failed
oracle 2[221, 82, 221, 93][197, 90, 197, 69]Failed
oracle 3[186, 58, 166, 38][170, 42, 170, 42]Failed
oracle 4[][]Passed
oracle 5[245, 229, 133][229, 149, 181]Failed
oracle 6[213, 85, 214, 86][213, 85, 210, 82]Failed
oracle 7[197, 69, 149, 21][245, 117, 133, 5]Failed
variant packet 1[213, 213, 85, 213, 85, 213, 213, 85, 213, 85][213, 213, 85, 212, 85, 213, 213, 85, 212, 85]Failed

SHA-256 / 871db97ea98e1d3a0a5e49f3918d78e7e3e6f9bda0d55c15cd1e70165b093fc5

3 / The verified repair

Exit 0
"""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<2 else 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, 213, 85, 212, 85][213, 213, 85, 212, 85]Passed
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, 210, 82][213, 85, 210, 82]Passed
oracle 7[245, 117, 133, 5][245, 117, 133, 5]Passed
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 / df99ba847feb88c82ec2203b6e947d4ae1167b17d32ccde326bc8d136c175a7b

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

Case digest / e184c6ecdec3561b14dd18c4f8108efb1f9086157ebebf2a81b2e6b65b2c2ab2