FAILURE MAP
← Case archive

FA-49856 / PCM sample encoding / Open access

Pcm mulaw code selection: polarity code · case 01

Companded PCM polarity bit uses the inverse convention.

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

ROOT CAUSE

Companded PCM polarity bit uses the inverse convention.

VERIFIED REPAIR

Use the stated conversion contract at polarity code.

Unsuccessful approach: Only marking silence negative loses actual input sign.

Case contract

Bounded mu-law-style selection model: clamp magnitude32635, add bias132, select segment and mantissa then complement the full eight-bit code.

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
        amplitude=min(32635,abs(sample))+132
        exponent=0
        while exponent<7 and amplitude>=(256<<exponent):
            exponent+=1
        mantissa=(amplitude>>(exponent+3))&15
        code=(0 if negative else 128)|(exponent<<4)|mantissa
        out.append((~code)&255)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([0, 1, -1, 100, -100],)), [255, 255, 127, 242, 114])
check('oracle 2', solve(*([124, 125, -124],)), [239, 239, 111])
check('oracle 3', solve(*([32635, 40000, -40000],)), [128, 128, 0])
check('oracle 4', solve(*([],)), [])
check('oracle 5', solve(*([1000, 4000, 16000],)), [206, 175, 144])
check('oracle 6', solve(*([380, 892, 1916],)), [223, 207, 191])
check('oracle 7', solve(*([-1000, -4000, -16000],)), [78, 47, 16])
if N == 1: check('variant packet 1', solve(*[[0, 1, -1, 100, -100, 0, 1, -1, 100, -100]]), [255, 255, 127, 242, 114, 255, 255, 127, 242, 114])
if N == 2: check('variant packet 2', solve(*[[0, 1, -1, 100, -100, 0, 1, -1, 100, -100, 0, 1, -1, 100, -100]]), [255, 255, 127, 242, 114, 255, 255, 127, 242, 114, 255, 255, 127, 242, 114])
if N == 3: check('variant packet 3', solve(*[[0, 1, -1, 100, -100, 0, 1, -1, 100, -100, 0, 1, -1, 100, -100, 0, 1, -1, 100, -100]]), [255, 255, 127, 242, 114, 255, 255, 127, 242, 114, 255, 255, 127, 242, 114, 255, 255, 127, 242, 114])
if N == 4: check('variant packet 4', solve(*[[0, 1, -1, 100, -100, 0, 1, -1, 100, -100, 0, 1, -1, 100, -100, 0, 1, -1, 100, -100, 0, 1, -1, 100, -100]]), [255, 255, 127, 242, 114, 255, 255, 127, 242, 114, 255, 255, 127, 242, 114, 255, 255, 127, 242, 114, 255, 255, 127, 242, 114])
if N == 5: check('variant packet 5', solve(*[[0, 1, -1, 100, -100, 0, 1, -1, 100, -100, 0, 1, -1, 100, -100, 0, 1, -1, 100, -100, 0, 1, -1, 100, -100, 0, 1, -1, 100, -100]]), [255, 255, 127, 242, 114, 255, 255, 127, 242, 114, 255, 255, 127, 242, 114, 255, 255, 127, 242, 114, 255, 255, 127, 242, 114, 255, 255, 127, 242, 114])
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[127, 127, 255, 114, 242][255, 255, 127, 242, 114]Failed
oracle 2[111, 111, 239][239, 239, 111]Failed
oracle 3[0, 0, 128][128, 128, 0]Failed
oracle 4[][]Passed
oracle 5[78, 47, 16][206, 175, 144]Failed
oracle 6[95, 79, 63][223, 207, 191]Failed
oracle 7[206, 175, 144][78, 47, 16]Failed
variant packet 1[127, 127, 255, 114, 242, 127, 127, 255, 114, 242][255, 255, 127, 242, 114, 255, 255, 127, 242, 114]Failed

SHA-256 / 7f592b5ae8c2fe86b59e51be0fd49c11e3683641d7a362c903911743c91bd9f2

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
        amplitude=min(32635,abs(sample))+132
        exponent=0
        while exponent<7 and amplitude>=(256<<exponent):
            exponent+=1
        mantissa=(amplitude>>(exponent+3))&15
        code=(128 if sample==0 else 0)|(exponent<<4)|mantissa
        out.append((~code)&255)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([0, 1, -1, 100, -100],)), [255, 255, 127, 242, 114])
check('oracle 2', solve(*([124, 125, -124],)), [239, 239, 111])
check('oracle 3', solve(*([32635, 40000, -40000],)), [128, 128, 0])
check('oracle 4', solve(*([],)), [])
check('oracle 5', solve(*([1000, 4000, 16000],)), [206, 175, 144])
check('oracle 6', solve(*([380, 892, 1916],)), [223, 207, 191])
check('oracle 7', solve(*([-1000, -4000, -16000],)), [78, 47, 16])
if N == 1: check('variant packet 1', solve(*[[0, 1, -1, 100, -100, 0, 1, -1, 100, -100]]), [255, 255, 127, 242, 114, 255, 255, 127, 242, 114])
if N == 2: check('variant packet 2', solve(*[[0, 1, -1, 100, -100, 0, 1, -1, 100, -100, 0, 1, -1, 100, -100]]), [255, 255, 127, 242, 114, 255, 255, 127, 242, 114, 255, 255, 127, 242, 114])
if N == 3: check('variant packet 3', solve(*[[0, 1, -1, 100, -100, 0, 1, -1, 100, -100, 0, 1, -1, 100, -100, 0, 1, -1, 100, -100]]), [255, 255, 127, 242, 114, 255, 255, 127, 242, 114, 255, 255, 127, 242, 114, 255, 255, 127, 242, 114])
if N == 4: check('variant packet 4', solve(*[[0, 1, -1, 100, -100, 0, 1, -1, 100, -100, 0, 1, -1, 100, -100, 0, 1, -1, 100, -100, 0, 1, -1, 100, -100]]), [255, 255, 127, 242, 114, 255, 255, 127, 242, 114, 255, 255, 127, 242, 114, 255, 255, 127, 242, 114, 255, 255, 127, 242, 114])
if N == 5: check('variant packet 5', solve(*[[0, 1, -1, 100, -100, 0, 1, -1, 100, -100, 0, 1, -1, 100, -100, 0, 1, -1, 100, -100, 0, 1, -1, 100, -100, 0, 1, -1, 100, -100]]), [255, 255, 127, 242, 114, 255, 255, 127, 242, 114, 255, 255, 127, 242, 114, 255, 255, 127, 242, 114, 255, 255, 127, 242, 114, 255, 255, 127, 242, 114])
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[127, 255, 255, 242, 242][255, 255, 127, 242, 114]Failed
oracle 2[239, 239, 239][239, 239, 111]Failed
oracle 3[128, 128, 128][128, 128, 0]Failed
oracle 4[][]Passed
oracle 5[206, 175, 144][206, 175, 144]Passed
oracle 6[223, 207, 191][223, 207, 191]Passed
oracle 7[206, 175, 144][78, 47, 16]Failed
variant packet 1[127, 255, 255, 242, 242, 127, 255, 255, 242, 242][255, 255, 127, 242, 114, 255, 255, 127, 242, 114]Failed

SHA-256 / ecf6b2726dc59cea5f4be21a00e11cc16b66268054182a8558f363b2d6517594

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
        amplitude=min(32635,abs(sample))+132
        exponent=0
        while exponent<7 and amplitude>=(256<<exponent):
            exponent+=1
        mantissa=(amplitude>>(exponent+3))&15
        code=(128 if negative else 0)|(exponent<<4)|mantissa
        out.append((~code)&255)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([0, 1, -1, 100, -100],)), [255, 255, 127, 242, 114])
check('oracle 2', solve(*([124, 125, -124],)), [239, 239, 111])
check('oracle 3', solve(*([32635, 40000, -40000],)), [128, 128, 0])
check('oracle 4', solve(*([],)), [])
check('oracle 5', solve(*([1000, 4000, 16000],)), [206, 175, 144])
check('oracle 6', solve(*([380, 892, 1916],)), [223, 207, 191])
check('oracle 7', solve(*([-1000, -4000, -16000],)), [78, 47, 16])
if N == 1: check('variant packet 1', solve(*[[0, 1, -1, 100, -100, 0, 1, -1, 100, -100]]), [255, 255, 127, 242, 114, 255, 255, 127, 242, 114])
if N == 2: check('variant packet 2', solve(*[[0, 1, -1, 100, -100, 0, 1, -1, 100, -100, 0, 1, -1, 100, -100]]), [255, 255, 127, 242, 114, 255, 255, 127, 242, 114, 255, 255, 127, 242, 114])
if N == 3: check('variant packet 3', solve(*[[0, 1, -1, 100, -100, 0, 1, -1, 100, -100, 0, 1, -1, 100, -100, 0, 1, -1, 100, -100]]), [255, 255, 127, 242, 114, 255, 255, 127, 242, 114, 255, 255, 127, 242, 114, 255, 255, 127, 242, 114])
if N == 4: check('variant packet 4', solve(*[[0, 1, -1, 100, -100, 0, 1, -1, 100, -100, 0, 1, -1, 100, -100, 0, 1, -1, 100, -100, 0, 1, -1, 100, -100]]), [255, 255, 127, 242, 114, 255, 255, 127, 242, 114, 255, 255, 127, 242, 114, 255, 255, 127, 242, 114, 255, 255, 127, 242, 114])
if N == 5: check('variant packet 5', solve(*[[0, 1, -1, 100, -100, 0, 1, -1, 100, -100, 0, 1, -1, 100, -100, 0, 1, -1, 100, -100, 0, 1, -1, 100, -100, 0, 1, -1, 100, -100]]), [255, 255, 127, 242, 114, 255, 255, 127, 242, 114, 255, 255, 127, 242, 114, 255, 255, 127, 242, 114, 255, 255, 127, 242, 114, 255, 255, 127, 242, 114])
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[255, 255, 127, 242, 114][255, 255, 127, 242, 114]Passed
oracle 2[239, 239, 111][239, 239, 111]Passed
oracle 3[128, 128, 0][128, 128, 0]Passed
oracle 4[][]Passed
oracle 5[206, 175, 144][206, 175, 144]Passed
oracle 6[223, 207, 191][223, 207, 191]Passed
oracle 7[78, 47, 16][78, 47, 16]Passed
variant packet 1[255, 255, 127, 242, 114, 255, 255, 127, 242, 114][255, 255, 127, 242, 114, 255, 255, 127, 242, 114]Passed

SHA-256 / 9a61544a71b8062ad93686f3ed544e53c854273e6558ea0c346d7822c4809892

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

Case digest / 7750762fd5e3ed5ff36328cd3c23666fc94a9463a0328a07ce8fd5487444da40