FA-48851 / PCM sample encoding / Open access
Subbyte code packer: padding modulo · case 01
Already aligned packets receive a whole spurious padding octet.
ROOT CAUSE
Already aligned packets receive a whole spurious padding octet.
VERIFIED REPAIR
Use the stated conversion contract at padding modulo.
Unsuccessful approach: Rounding an unaligned packet up twice adds an extra pad octet.
Case contract
Pack unsigned codes fitting width 1..7 most-significant bit first after an explicit bit prefix; return octets, significant-bit count and zero tail padding count.
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, width, prefix):
bits = list(prefix)
for code in codes:
bits.extend((code >> shift) & 1 for shift in range(width-1,-1,-1))
padding = 8-len(bits)%8
bits += [0] * padding
out = []
for start in range(0,len(bits),8):
out.append(sum(bits[start+j] << (7-j) for j in range(8)))
return [out, len(prefix)+len(codes)*width, padding]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([0, 1, 7], 3, [1, 0])), [[129, 224], 11, 5])
check('oracle 2', solve(*([5, 2], 3, [])), [[168], 6, 2])
check('oracle 3', solve(*([], 3, [])), [[], 0, 0])
check('oracle 4', solve(*([15, 0], 4, [])), [[240], 8, 0])
check('oracle 5', solve(*([1], 1, [1, 1, 0])), [[208], 4, 4])
check('oracle 6', solve(*([0, 3, 2, 1], 2, [0])), [[28, 128], 9, 7])
check('oracle 7', solve(*([17, 3], 5, [1, 0, 1])), [[177, 24], 13, 3])
if N == 1: check('variant packet 1', solve(*[[0, 1, 7, 0, 1, 7], 3, [1, 0]]), [[129, 224, 240], 20, 4])
if N == 2: check('variant packet 2', solve(*[[0, 1, 7, 0, 1, 7, 0, 1, 7], 3, [1, 0]]), [[129, 224, 240, 120], 29, 3])
if N == 3: check('variant packet 3', solve(*[[0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7], 3, [1, 0]]), [[129, 224, 240, 120, 60], 38, 2])
if N == 4: check('variant packet 4', solve(*[[0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7], 3, [1, 0]]), [[129, 224, 240, 120, 60, 30], 47, 1])
if N == 5: check('variant packet 5', solve(*[[0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7], 3, [1, 0]]), [[129, 224, 240, 120, 60, 30, 15], 56, 0])
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 | [[129, 224], 11, 5] | [[129, 224], 11, 5] | Passed |
| oracle 2 | [[168], 6, 2] | [[168], 6, 2] | Passed |
| oracle 3 | [[0], 0, 8] | [[], 0, 0] | Failed |
| oracle 4 | [[240, 0], 8, 8] | [[240], 8, 0] | Failed |
| oracle 5 | [[208], 4, 4] | [[208], 4, 4] | Passed |
| oracle 6 | [[28, 128], 9, 7] | [[28, 128], 9, 7] | Passed |
| oracle 7 | [[177, 24], 13, 3] | [[177, 24], 13, 3] | Passed |
| variant packet 1 | [[129, 224, 240], 20, 4] | [[129, 224, 240], 20, 4] | Passed |
SHA-256 / 1d09c2b8a4cb0957f3ecabc91ef38a90576273781850d86bd1053afccf5ab01b
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(codes, width, prefix):
bits = list(prefix)
for code in codes:
bits.extend((code >> shift) & 1 for shift in range(width-1,-1,-1))
padding = ((-len(bits))%8)+8 if len(bits)%8 else 0
bits += [0] * padding
out = []
for start in range(0,len(bits),8):
out.append(sum(bits[start+j] << (7-j) for j in range(8)))
return [out, len(prefix)+len(codes)*width, padding]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([0, 1, 7], 3, [1, 0])), [[129, 224], 11, 5])
check('oracle 2', solve(*([5, 2], 3, [])), [[168], 6, 2])
check('oracle 3', solve(*([], 3, [])), [[], 0, 0])
check('oracle 4', solve(*([15, 0], 4, [])), [[240], 8, 0])
check('oracle 5', solve(*([1], 1, [1, 1, 0])), [[208], 4, 4])
check('oracle 6', solve(*([0, 3, 2, 1], 2, [0])), [[28, 128], 9, 7])
check('oracle 7', solve(*([17, 3], 5, [1, 0, 1])), [[177, 24], 13, 3])
if N == 1: check('variant packet 1', solve(*[[0, 1, 7, 0, 1, 7], 3, [1, 0]]), [[129, 224, 240], 20, 4])
if N == 2: check('variant packet 2', solve(*[[0, 1, 7, 0, 1, 7, 0, 1, 7], 3, [1, 0]]), [[129, 224, 240, 120], 29, 3])
if N == 3: check('variant packet 3', solve(*[[0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7], 3, [1, 0]]), [[129, 224, 240, 120, 60], 38, 2])
if N == 4: check('variant packet 4', solve(*[[0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7], 3, [1, 0]]), [[129, 224, 240, 120, 60, 30], 47, 1])
if N == 5: check('variant packet 5', solve(*[[0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7], 3, [1, 0]]), [[129, 224, 240, 120, 60, 30, 15], 56, 0])
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 | [[129, 224, 0], 11, 13] | [[129, 224], 11, 5] | Failed |
| oracle 2 | [[168, 0], 6, 10] | [[168], 6, 2] | Failed |
| oracle 3 | [[], 0, 0] | [[], 0, 0] | Passed |
| oracle 4 | [[240], 8, 0] | [[240], 8, 0] | Passed |
| oracle 5 | [[208, 0], 4, 12] | [[208], 4, 4] | Failed |
| oracle 6 | [[28, 128, 0], 9, 15] | [[28, 128], 9, 7] | Failed |
| oracle 7 | [[177, 24, 0], 13, 11] | [[177, 24], 13, 3] | Failed |
| variant packet 1 | [[129, 224, 240, 0], 20, 12] | [[129, 224, 240], 20, 4] | Failed |
SHA-256 / f87003bbec560c5f82583324ab24e9572b43631ec75e0ca48172cd6d164ce852
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(codes, width, prefix):
bits = list(prefix)
for code in codes:
bits.extend((code >> shift) & 1 for shift in range(width-1,-1,-1))
padding = (-len(bits)) % 8
bits += [0] * padding
out = []
for start in range(0,len(bits),8):
out.append(sum(bits[start+j] << (7-j) for j in range(8)))
return [out, len(prefix)+len(codes)*width, padding]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([0, 1, 7], 3, [1, 0])), [[129, 224], 11, 5])
check('oracle 2', solve(*([5, 2], 3, [])), [[168], 6, 2])
check('oracle 3', solve(*([], 3, [])), [[], 0, 0])
check('oracle 4', solve(*([15, 0], 4, [])), [[240], 8, 0])
check('oracle 5', solve(*([1], 1, [1, 1, 0])), [[208], 4, 4])
check('oracle 6', solve(*([0, 3, 2, 1], 2, [0])), [[28, 128], 9, 7])
check('oracle 7', solve(*([17, 3], 5, [1, 0, 1])), [[177, 24], 13, 3])
if N == 1: check('variant packet 1', solve(*[[0, 1, 7, 0, 1, 7], 3, [1, 0]]), [[129, 224, 240], 20, 4])
if N == 2: check('variant packet 2', solve(*[[0, 1, 7, 0, 1, 7, 0, 1, 7], 3, [1, 0]]), [[129, 224, 240, 120], 29, 3])
if N == 3: check('variant packet 3', solve(*[[0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7], 3, [1, 0]]), [[129, 224, 240, 120, 60], 38, 2])
if N == 4: check('variant packet 4', solve(*[[0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7], 3, [1, 0]]), [[129, 224, 240, 120, 60, 30], 47, 1])
if N == 5: check('variant packet 5', solve(*[[0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7], 3, [1, 0]]), [[129, 224, 240, 120, 60, 30, 15], 56, 0])
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 | [[129, 224], 11, 5] | [[129, 224], 11, 5] | Passed |
| oracle 2 | [[168], 6, 2] | [[168], 6, 2] | Passed |
| oracle 3 | [[], 0, 0] | [[], 0, 0] | Passed |
| oracle 4 | [[240], 8, 0] | [[240], 8, 0] | Passed |
| oracle 5 | [[208], 4, 4] | [[208], 4, 4] | Passed |
| oracle 6 | [[28, 128], 9, 7] | [[28, 128], 9, 7] | Passed |
| oracle 7 | [[177, 24], 13, 3] | [[177, 24], 13, 3] | Passed |
| variant packet 1 | [[129, 224, 240], 20, 4] | [[129, 224, 240], 20, 4] | Passed |
SHA-256 / 1a6bacfd1831f882754c5a37ea36bf06a700319d8b5d2e8b37722f9b529e9506
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:54.488507+00:00.
Case digest / 55706535e14a113a407205a806ffeb47a34df6c5cb7df1455b091a658d0b57d9