FAILURE MAP
← Case archive

FA-49001 / PCM sample encoding / Open access

Alaw expansion: segment offset · case 01

The first expanded segment omits its fixed offset.

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

ROOT CAUSE

The first expanded segment omits its fixed offset.

VERIFIED REPAIR

Use the stated conversion contract at segment offset.

Unsuccessful approach: Using a half-size offset compresses the segment transition.

Case contract

Decode eight-bit A-law codes into signed integer PCM using alternating-bit mask85, midpoint reconstruction and explicit segment rules.

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(codes):
    out=[]
    for raw in codes:
        code=raw^85
        segment=(code>>4)&7
        mantissa=code&15
        amplitude=(mantissa<<4)+8
        if segment>1:
            amplitude+=256
        if segment>1:
            amplitude<<=segment-1
        out.append(amplitude if code&128 else -amplitude)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([213, 85, 212, 84],)), [8, -8, 24, -24])
check('oracle 2', solve(*([197, 69, 245, 117],)), [264, -264, 528, -528])
check('oracle 3', solve(*([165, 37, 181, 53],)), [16896, -16896, 8448, -8448])
check('oracle 4', solve(*([0, 128, 255],)), [-5504, 5504, 848])
check('oracle 5', solve(*([],)), [])
check('oracle 6', solve(*([214, 86, 196, 68],)), [56, -56, 280, -280])
check('oracle 7', solve(*([149, 21, 133, 5],)), [2112, -2112, 4224, -4224])
if N == 1: check('variant packet 1', solve(*[[213, 85, 212, 84, 213, 85, 212, 84]]), [8, -8, 24, -24, 8, -8, 24, -24])
if N == 2: check('variant packet 2', solve(*[[213, 85, 212, 84, 213, 85, 212, 84, 213, 85, 212, 84]]), [8, -8, 24, -24, 8, -8, 24, -24, 8, -8, 24, -24])
if N == 3: check('variant packet 3', solve(*[[213, 85, 212, 84, 213, 85, 212, 84, 213, 85, 212, 84, 213, 85, 212, 84]]), [8, -8, 24, -24, 8, -8, 24, -24, 8, -8, 24, -24, 8, -8, 24, -24])
if N == 4: check('variant packet 4', solve(*[[213, 85, 212, 84, 213, 85, 212, 84, 213, 85, 212, 84, 213, 85, 212, 84, 213, 85, 212, 84]]), [8, -8, 24, -24, 8, -8, 24, -24, 8, -8, 24, -24, 8, -8, 24, -24, 8, -8, 24, -24])
if N == 5: check('variant packet 5', solve(*[[213, 85, 212, 84, 213, 85, 212, 84, 213, 85, 212, 84, 213, 85, 212, 84, 213, 85, 212, 84, 213, 85, 212, 84]]), [8, -8, 24, -24, 8, -8, 24, -24, 8, -8, 24, -24, 8, -8, 24, -24, 8, -8, 24, -24, 8, -8, 24, -24])
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[8, -8, 24, -24][8, -8, 24, -24]Passed
oracle 2[8, -8, 528, -528][264, -264, 528, -528]Failed
oracle 3[16896, -16896, 8448, -8448][16896, -16896, 8448, -8448]Passed
oracle 4[-5504, 5504, 848][-5504, 5504, 848]Passed
oracle 5[][]Passed
oracle 6[56, -56, 24, -24][56, -56, 280, -280]Failed
oracle 7[2112, -2112, 4224, -4224][2112, -2112, 4224, -4224]Passed
variant packet 1[8, -8, 24, -24, 8, -8, 24, -24][8, -8, 24, -24, 8, -8, 24, -24]Passed

SHA-256 / 0e892f1866c278d4d5bcb1cc30709e012d9cb50a4fdea968b75f3e327b6a4f60

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(codes):
    out=[]
    for raw in codes:
        code=raw^85
        segment=(code>>4)&7
        mantissa=code&15
        amplitude=(mantissa<<4)+8
        if segment:
            amplitude+=128
        if segment>1:
            amplitude<<=segment-1
        out.append(amplitude if code&128 else -amplitude)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([213, 85, 212, 84],)), [8, -8, 24, -24])
check('oracle 2', solve(*([197, 69, 245, 117],)), [264, -264, 528, -528])
check('oracle 3', solve(*([165, 37, 181, 53],)), [16896, -16896, 8448, -8448])
check('oracle 4', solve(*([0, 128, 255],)), [-5504, 5504, 848])
check('oracle 5', solve(*([],)), [])
check('oracle 6', solve(*([214, 86, 196, 68],)), [56, -56, 280, -280])
check('oracle 7', solve(*([149, 21, 133, 5],)), [2112, -2112, 4224, -4224])
if N == 1: check('variant packet 1', solve(*[[213, 85, 212, 84, 213, 85, 212, 84]]), [8, -8, 24, -24, 8, -8, 24, -24])
if N == 2: check('variant packet 2', solve(*[[213, 85, 212, 84, 213, 85, 212, 84, 213, 85, 212, 84]]), [8, -8, 24, -24, 8, -8, 24, -24, 8, -8, 24, -24])
if N == 3: check('variant packet 3', solve(*[[213, 85, 212, 84, 213, 85, 212, 84, 213, 85, 212, 84, 213, 85, 212, 84]]), [8, -8, 24, -24, 8, -8, 24, -24, 8, -8, 24, -24, 8, -8, 24, -24])
if N == 4: check('variant packet 4', solve(*[[213, 85, 212, 84, 213, 85, 212, 84, 213, 85, 212, 84, 213, 85, 212, 84, 213, 85, 212, 84]]), [8, -8, 24, -24, 8, -8, 24, -24, 8, -8, 24, -24, 8, -8, 24, -24, 8, -8, 24, -24])
if N == 5: check('variant packet 5', solve(*[[213, 85, 212, 84, 213, 85, 212, 84, 213, 85, 212, 84, 213, 85, 212, 84, 213, 85, 212, 84, 213, 85, 212, 84]]), [8, -8, 24, -24, 8, -8, 24, -24, 8, -8, 24, -24, 8, -8, 24, -24, 8, -8, 24, -24, 8, -8, 24, -24])
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[8, -8, 24, -24][8, -8, 24, -24]Passed
oracle 2[136, -136, 272, -272][264, -264, 528, -528]Failed
oracle 3[8704, -8704, 4352, -4352][16896, -16896, 8448, -8448]Failed
oracle 4[-3456, 3456, 592][-5504, 5504, 848]Failed
oracle 5[][]Passed
oracle 6[56, -56, 152, -152][56, -56, 280, -280]Failed
oracle 7[1088, -1088, 2176, -2176][2112, -2112, 4224, -4224]Failed
variant packet 1[8, -8, 24, -24, 8, -8, 24, -24][8, -8, 24, -24, 8, -8, 24, -24]Passed

SHA-256 / 9da8b8ba9a73e08d4d6777d0499c245bc34fd6e4818e7e7e34f7f63b5969869c

3 / The verified repair

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

N = 1
observations = []
def solve(codes):
    out=[]
    for raw in codes:
        code=raw^85
        segment=(code>>4)&7
        mantissa=code&15
        amplitude=(mantissa<<4)+8
        if segment:
            amplitude+=256
        if segment>1:
            amplitude<<=segment-1
        out.append(amplitude if code&128 else -amplitude)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([213, 85, 212, 84],)), [8, -8, 24, -24])
check('oracle 2', solve(*([197, 69, 245, 117],)), [264, -264, 528, -528])
check('oracle 3', solve(*([165, 37, 181, 53],)), [16896, -16896, 8448, -8448])
check('oracle 4', solve(*([0, 128, 255],)), [-5504, 5504, 848])
check('oracle 5', solve(*([],)), [])
check('oracle 6', solve(*([214, 86, 196, 68],)), [56, -56, 280, -280])
check('oracle 7', solve(*([149, 21, 133, 5],)), [2112, -2112, 4224, -4224])
if N == 1: check('variant packet 1', solve(*[[213, 85, 212, 84, 213, 85, 212, 84]]), [8, -8, 24, -24, 8, -8, 24, -24])
if N == 2: check('variant packet 2', solve(*[[213, 85, 212, 84, 213, 85, 212, 84, 213, 85, 212, 84]]), [8, -8, 24, -24, 8, -8, 24, -24, 8, -8, 24, -24])
if N == 3: check('variant packet 3', solve(*[[213, 85, 212, 84, 213, 85, 212, 84, 213, 85, 212, 84, 213, 85, 212, 84]]), [8, -8, 24, -24, 8, -8, 24, -24, 8, -8, 24, -24, 8, -8, 24, -24])
if N == 4: check('variant packet 4', solve(*[[213, 85, 212, 84, 213, 85, 212, 84, 213, 85, 212, 84, 213, 85, 212, 84, 213, 85, 212, 84]]), [8, -8, 24, -24, 8, -8, 24, -24, 8, -8, 24, -24, 8, -8, 24, -24, 8, -8, 24, -24])
if N == 5: check('variant packet 5', solve(*[[213, 85, 212, 84, 213, 85, 212, 84, 213, 85, 212, 84, 213, 85, 212, 84, 213, 85, 212, 84, 213, 85, 212, 84]]), [8, -8, 24, -24, 8, -8, 24, -24, 8, -8, 24, -24, 8, -8, 24, -24, 8, -8, 24, -24, 8, -8, 24, -24])
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[8, -8, 24, -24][8, -8, 24, -24]Passed
oracle 2[264, -264, 528, -528][264, -264, 528, -528]Passed
oracle 3[16896, -16896, 8448, -8448][16896, -16896, 8448, -8448]Passed
oracle 4[-5504, 5504, 848][-5504, 5504, 848]Passed
oracle 5[][]Passed
oracle 6[56, -56, 280, -280][56, -56, 280, -280]Passed
oracle 7[2112, -2112, 4224, -4224][2112, -2112, 4224, -4224]Passed
variant packet 1[8, -8, 24, -24, 8, -8, 24, -24][8, -8, 24, -24, 8, -8, 24, -24]Passed

SHA-256 / 86375ee9ce48759ec2ddcfd7d48f2426685fdacd10c9765d2fc3ad0ce12d7296

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

Case digest / 2795583f95ba96d6a9b51f40caef7637b12e43ba34aaff37f3732f1e9be9f5ba