FAILURE MAP
← Case archive

FA-50286 / PCM sample encoding / Open access

Pcm common trailing zero shift: nonzero filter · case 01

Negative samples do not constrain common wasted-bit selection.

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

ROOT CAUSE

Negative samples do not constrain common wasted-bit selection.

VERIFIED REPAIR

Use the stated conversion contract at nonzero filter.

Unsuccessful approach: Considering only negative samples ignores positive precision requirements.

Case contract

Losslessly factor the largest capped common trailing-zero count from signed PCM samples; zero samples do not constrain the count and all-silence blocks canonically use zero.

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, maximum):
    shift=0
    nonzero=[abs(x) for x in samples if x>0]
    if nonzero:
        while shift<maximum and all((x&((1<<(shift+1))-1))==0 for x in nonzero):
            shift+=1
    coarse=[x>>shift for x in samples]
    return [shift,coarse]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([8, -12, 0], 5)), [2, [2, -3, 0]])
check('oracle 2', solve(*([0, 0], 4)), [0, [0, 0]])
check('oracle 3', solve(*([8, 6], 4)), [1, [4, 3]])
check('oracle 4', solve(*([], 3)), [0, []])
check('oracle 5', solve(*([-8, -4], 5)), [2, [-2, -1]])
check('oracle 6', solve(*([16, 32], 2)), [2, [4, 8]])
check('oracle 7', solve(*([3, -8], 4)), [0, [3, -8]])
if N == 1: check('variant packet 1', solve(*[[8, -12, 0, 8, -12, 0], 5]), [2, [2, -3, 0, 2, -3, 0]])
if N == 2: check('variant packet 2', solve(*[[8, -12, 0, 8, -12, 0, 8, -12, 0], 5]), [2, [2, -3, 0, 2, -3, 0, 2, -3, 0]])
if N == 3: check('variant packet 3', solve(*[[8, -12, 0, 8, -12, 0, 8, -12, 0, 8, -12, 0], 5]), [2, [2, -3, 0, 2, -3, 0, 2, -3, 0, 2, -3, 0]])
if N == 4: check('variant packet 4', solve(*[[8, -12, 0, 8, -12, 0, 8, -12, 0, 8, -12, 0, 8, -12, 0], 5]), [2, [2, -3, 0, 2, -3, 0, 2, -3, 0, 2, -3, 0, 2, -3, 0]])
if N == 5: check('variant packet 5', solve(*[[8, -12, 0, 8, -12, 0, 8, -12, 0, 8, -12, 0, 8, -12, 0, 8, -12, 0], 5]), [2, [2, -3, 0, 2, -3, 0, 2, -3, 0, 2, -3, 0, 2, -3, 0, 2, -3, 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 fixtureActualExpectedOutcome
oracle 1[3, [1, -2, 0]][2, [2, -3, 0]]Failed
oracle 2[0, [0, 0]][0, [0, 0]]Passed
oracle 3[1, [4, 3]][1, [4, 3]]Passed
oracle 4[0, []][0, []]Passed
oracle 5[0, [-8, -4]][2, [-2, -1]]Failed
oracle 6[2, [4, 8]][2, [4, 8]]Passed
oracle 7[0, [3, -8]][0, [3, -8]]Passed
variant packet 1[3, [1, -2, 0, 1, -2, 0]][2, [2, -3, 0, 2, -3, 0]]Failed

SHA-256 / 9eb50c82347ab3f67d41075cc5940eb5eba6b3e25cc54fa79683ccfcea5a6f7d

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(samples, maximum):
    shift=0
    nonzero=[abs(x) for x in samples if x<0]
    if nonzero:
        while shift<maximum and all((x&((1<<(shift+1))-1))==0 for x in nonzero):
            shift+=1
    coarse=[x>>shift for x in samples]
    return [shift,coarse]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([8, -12, 0], 5)), [2, [2, -3, 0]])
check('oracle 2', solve(*([0, 0], 4)), [0, [0, 0]])
check('oracle 3', solve(*([8, 6], 4)), [1, [4, 3]])
check('oracle 4', solve(*([], 3)), [0, []])
check('oracle 5', solve(*([-8, -4], 5)), [2, [-2, -1]])
check('oracle 6', solve(*([16, 32], 2)), [2, [4, 8]])
check('oracle 7', solve(*([3, -8], 4)), [0, [3, -8]])
if N == 1: check('variant packet 1', solve(*[[8, -12, 0, 8, -12, 0], 5]), [2, [2, -3, 0, 2, -3, 0]])
if N == 2: check('variant packet 2', solve(*[[8, -12, 0, 8, -12, 0, 8, -12, 0], 5]), [2, [2, -3, 0, 2, -3, 0, 2, -3, 0]])
if N == 3: check('variant packet 3', solve(*[[8, -12, 0, 8, -12, 0, 8, -12, 0, 8, -12, 0], 5]), [2, [2, -3, 0, 2, -3, 0, 2, -3, 0, 2, -3, 0]])
if N == 4: check('variant packet 4', solve(*[[8, -12, 0, 8, -12, 0, 8, -12, 0, 8, -12, 0, 8, -12, 0], 5]), [2, [2, -3, 0, 2, -3, 0, 2, -3, 0, 2, -3, 0, 2, -3, 0]])
if N == 5: check('variant packet 5', solve(*[[8, -12, 0, 8, -12, 0, 8, -12, 0, 8, -12, 0, 8, -12, 0, 8, -12, 0], 5]), [2, [2, -3, 0, 2, -3, 0, 2, -3, 0, 2, -3, 0, 2, -3, 0, 2, -3, 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 fixtureActualExpectedOutcome
oracle 1[2, [2, -3, 0]][2, [2, -3, 0]]Passed
oracle 2[0, [0, 0]][0, [0, 0]]Passed
oracle 3[0, [8, 6]][1, [4, 3]]Failed
oracle 4[0, []][0, []]Passed
oracle 5[2, [-2, -1]][2, [-2, -1]]Passed
oracle 6[0, [16, 32]][2, [4, 8]]Failed
oracle 7[3, [0, -1]][0, [3, -8]]Failed
variant packet 1[2, [2, -3, 0, 2, -3, 0]][2, [2, -3, 0, 2, -3, 0]]Passed

SHA-256 / b9ddcd5269bb2af94931f20801c463604cc0b9afa603f74b2577f5a5b29165bc

3 / The verified repair

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

N = 1
observations = []
def solve(samples, maximum):
    shift=0
    nonzero=[abs(x) for x in samples if x!=0]
    if nonzero:
        while shift<maximum and all((x&((1<<(shift+1))-1))==0 for x in nonzero):
            shift+=1
    coarse=[x>>shift for x in samples]
    return [shift,coarse]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([8, -12, 0], 5)), [2, [2, -3, 0]])
check('oracle 2', solve(*([0, 0], 4)), [0, [0, 0]])
check('oracle 3', solve(*([8, 6], 4)), [1, [4, 3]])
check('oracle 4', solve(*([], 3)), [0, []])
check('oracle 5', solve(*([-8, -4], 5)), [2, [-2, -1]])
check('oracle 6', solve(*([16, 32], 2)), [2, [4, 8]])
check('oracle 7', solve(*([3, -8], 4)), [0, [3, -8]])
if N == 1: check('variant packet 1', solve(*[[8, -12, 0, 8, -12, 0], 5]), [2, [2, -3, 0, 2, -3, 0]])
if N == 2: check('variant packet 2', solve(*[[8, -12, 0, 8, -12, 0, 8, -12, 0], 5]), [2, [2, -3, 0, 2, -3, 0, 2, -3, 0]])
if N == 3: check('variant packet 3', solve(*[[8, -12, 0, 8, -12, 0, 8, -12, 0, 8, -12, 0], 5]), [2, [2, -3, 0, 2, -3, 0, 2, -3, 0, 2, -3, 0]])
if N == 4: check('variant packet 4', solve(*[[8, -12, 0, 8, -12, 0, 8, -12, 0, 8, -12, 0, 8, -12, 0], 5]), [2, [2, -3, 0, 2, -3, 0, 2, -3, 0, 2, -3, 0, 2, -3, 0]])
if N == 5: check('variant packet 5', solve(*[[8, -12, 0, 8, -12, 0, 8, -12, 0, 8, -12, 0, 8, -12, 0, 8, -12, 0], 5]), [2, [2, -3, 0, 2, -3, 0, 2, -3, 0, 2, -3, 0, 2, -3, 0, 2, -3, 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 fixtureActualExpectedOutcome
oracle 1[2, [2, -3, 0]][2, [2, -3, 0]]Passed
oracle 2[0, [0, 0]][0, [0, 0]]Passed
oracle 3[1, [4, 3]][1, [4, 3]]Passed
oracle 4[0, []][0, []]Passed
oracle 5[2, [-2, -1]][2, [-2, -1]]Passed
oracle 6[2, [4, 8]][2, [4, 8]]Passed
oracle 7[0, [3, -8]][0, [3, -8]]Passed
variant packet 1[2, [2, -3, 0, 2, -3, 0]][2, [2, -3, 0, 2, -3, 0]]Passed

SHA-256 / 6685802ff7a99ffcc55132b69825144bf3bc94edfbe08b4d6e15a53c618d2c9d

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

Case digest / f89004cab4108c9228286d61dbab3acd56d1f8b199a98286549d734706186f11