FAILURE MAP
← Case archive

FA-48991 / PCM sample encoding / Open access

Alaw expansion: alternating mask · case 01

Alternating transmission bits are left toggled in A-law decode.

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

ROOT CAUSE

Alternating transmission bits are left toggled in A-law decode.

VERIFIED REPAIR

Use the stated conversion contract at alternating mask.

Unsuccessful approach: Complementing all bits also flips untouched bits and polarity.

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
        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[5504, -5504, 5248, -5248][8, -8, 24, -24]Failed
oracle 2[2752, -2752, 22016, -22016][264, -264, 528, -528]Failed
oracle 3[688, -688, 1376, -1376][16896, -16896, 8448, -8448]Failed
oracle 4[-8, 8, 32256][-5504, 5504, 848]Failed
oracle 5[][]Passed
oracle 6[5760, -5760, 2624, -2624][56, -56, 280, -280]Failed
oracle 7[344, -344, 88, -88][2112, -2112, 4224, -4224]Failed
variant packet 1[5504, -5504, 5248, -5248, 5504, -5504, 5248, -5248][8, -8, 24, -24, 8, -8, 24, -24]Failed

SHA-256 / 2ba35ce0a25ce487e6b87f7c7cf8bfae7b2079115de41124815898a147af9477

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^255
        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[-848, 848, -880, 880][8, -8, 24, -24]Failed
oracle 2[-1696, 1696, -168, 168][264, -264, 528, -528]Failed
oracle 3[-6784, 6784, -3392, 3392][16896, -16896, 8448, -8448]Failed
oracle 4[32256, -32256, -8][-5504, 5504, 848]Failed
oracle 5[][]Passed
oracle 6[-816, 816, -1760, 1760][56, -56, 280, -280]Failed
oracle 7[-13568, 13568, -27136, 27136][2112, -2112, 4224, -4224]Failed
variant packet 1[-848, 848, -880, 880, -848, 848, -880, 880][8, -8, 24, -24, 8, -8, 24, -24]Failed

SHA-256 / 370b3dbf97e373960dee5095816ea8535168a2d8998a1a8e2a9ac384b3aba544

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

Case digest / 44dd060cee983317966b09accd0db62ac2fd710edd9a5b8bd93e5678e1e18cea