FA-49886 / PCM sample encoding / Open access
Pcm alaw code selection: alternating wire mask · case 01
A-law code omits alternating-bit transmission mask.
ROOT CAUSE
A-law code omits alternating-bit transmission mask.
VERIFIED REPAIR
Use the stated conversion contract at alternating wire mask.
Unsuccessful approach: The complementary alternating mask flips the wrong bit lanes.
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=1 if segment<2 else segment
mantissa=(magnitude>>shift)&15
code=(0 if negative else 128)|(segment<<4)|mantissa
out.append(code)
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| oracle 1 | [128, 128, 0, 129, 0] | [213, 213, 85, 212, 85] | Failed |
| oracle 2 | [144, 15, 144, 16] | [197, 90, 197, 69] | Failed |
| oracle 3 | [255, 127, 255, 127] | [170, 42, 170, 42] | Failed |
| oracle 4 | [] | [] | Passed |
| oracle 5 | [176, 192, 224] | [229, 149, 181] | Failed |
| oracle 6 | [128, 0, 135, 7] | [213, 85, 210, 82] | Failed |
| oracle 7 | [160, 32, 208, 80] | [245, 117, 133, 5] | Failed |
| variant packet 1 | [128, 128, 0, 129, 0, 128, 128, 0, 129, 0] | [213, 213, 85, 212, 85, 213, 213, 85, 212, 85] | Failed |
SHA-256 / 7bace6bc7da061c92713d12ffd7f47e5fe54484c5cc1635a68eee521ec75879d
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<2 else segment
mantissa=(magnitude>>shift)&15
code=(0 if negative else 128)|(segment<<4)|mantissa
out.append(code^170)
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| oracle 1 | [42, 42, 170, 43, 170] | [213, 213, 85, 212, 85] | Failed |
| oracle 2 | [58, 165, 58, 186] | [197, 90, 197, 69] | Failed |
| oracle 3 | [85, 213, 85, 213] | [170, 42, 170, 42] | Failed |
| oracle 4 | [] | [] | Passed |
| oracle 5 | [26, 106, 74] | [229, 149, 181] | Failed |
| oracle 6 | [42, 170, 45, 173] | [213, 85, 210, 82] | Failed |
| oracle 7 | [10, 138, 122, 250] | [245, 117, 133, 5] | Failed |
| variant packet 1 | [42, 42, 170, 43, 170, 42, 42, 170, 43, 170] | [213, 213, 85, 212, 85, 213, 213, 85, 212, 85] | Failed |
SHA-256 / 4576cb03a5e6bc6d5bd0a8dd7e0d3b53d1c252501bd38a0c16ed56b8bb56a405
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| 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.164617+00:00.
Case digest / 2bf7562f2b5b02819899422cac4fa34288db49f67ad574d39d4d980b418dad2b