FAILURE MAP
← Case archive

FA-49921 / PCM sample encoding / Open access

Pcm calibrated nearest code: nearest objective · case 01

Encoder chooses the farthest calibrated level.

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

ROOT CAUSE

Encoder chooses the farthest calibrated level.

VERIFIED REPAIR

Use the stated conversion contract at nearest objective.

Unsuccessful approach: Always accepting first-table distance ignores closer codes.

Case contract

Encode PCM amplitudes to nearest entries of an explicit possibly repeated calibration table, with a declared lowest/highest code-index tie policy.

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, table, tie_high):
    out=[]
    for sample in samples:
        distances=[abs(value-sample) for value in table]
        best=max(distances)
        candidates=[i for i,d in enumerate(distances) if d==best]
        out.append(candidates[-1] if tie_high else candidates[0])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([-8, -2, 0, 5, 12], [-10, 0, 10], False)), [0, 1, 1, 1, 2])
check('oracle 2', solve(*([5, -5], [-10, 0, 10], True)), [2, 1])
check('oracle 3', solve(*([2, 3], [0, 4, 4, 8], True)), [2, 2])
check('oracle 4', solve(*([], [-1, 1], False)), [])
check('oracle 5', solve(*([0, 4], [2], False)), [0, 0])
check('oracle 6', solve(*([1, 4, 8], [0, 3, 10], False)), [0, 1, 2])
check('oracle 7', solve(*([-3, 3], [-6, 0, 6], True)), [1, 2])
if N == 1: check('variant packet 1', solve(*[[-8, -2, 0, 5, 12, -8, -2, 0, 5, 12], [-10, 0, 10], False]), [0, 1, 1, 1, 2, 0, 1, 1, 1, 2])
if N == 2: check('variant packet 2', solve(*[[-8, -2, 0, 5, 12, -8, -2, 0, 5, 12, -8, -2, 0, 5, 12], [-10, 0, 10], False]), [0, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 2])
if N == 3: check('variant packet 3', solve(*[[-8, -2, 0, 5, 12, -8, -2, 0, 5, 12, -8, -2, 0, 5, 12, -8, -2, 0, 5, 12], [-10, 0, 10], False]), [0, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 2])
if N == 4: check('variant packet 4', solve(*[[-8, -2, 0, 5, 12, -8, -2, 0, 5, 12, -8, -2, 0, 5, 12, -8, -2, 0, 5, 12, -8, -2, 0, 5, 12], [-10, 0, 10], False]), [0, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 2])
if N == 5: check('variant packet 5', solve(*[[-8, -2, 0, 5, 12, -8, -2, 0, 5, 12, -8, -2, 0, 5, 12, -8, -2, 0, 5, 12, -8, -2, 0, 5, 12, -8, -2, 0, 5, 12], [-10, 0, 10], False]), [0, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 2])
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, 0, 0, 0][0, 1, 1, 1, 2]Failed
oracle 2[0, 2][2, 1]Failed
oracle 3[3, 3][2, 2]Failed
oracle 4[][]Passed
oracle 5[0, 0][0, 0]Passed
oracle 6[2, 2, 0][0, 1, 2]Failed
oracle 7[2, 0][1, 2]Failed
variant packet 1[2, 2, 0, 0, 0, 2, 2, 0, 0, 0][0, 1, 1, 1, 2, 0, 1, 1, 1, 2]Failed

SHA-256 / 6631c51e2e04ec0f222ddbd7d797bc424b1b811ead67982ab9d27f142546c323

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(samples, table, tie_high):
    out=[]
    for sample in samples:
        distances=[abs(value-sample) for value in table]
        best=distances[0]
        candidates=[i for i,d in enumerate(distances) if d==best]
        out.append(candidates[-1] if tie_high else candidates[0])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([-8, -2, 0, 5, 12], [-10, 0, 10], False)), [0, 1, 1, 1, 2])
check('oracle 2', solve(*([5, -5], [-10, 0, 10], True)), [2, 1])
check('oracle 3', solve(*([2, 3], [0, 4, 4, 8], True)), [2, 2])
check('oracle 4', solve(*([], [-1, 1], False)), [])
check('oracle 5', solve(*([0, 4], [2], False)), [0, 0])
check('oracle 6', solve(*([1, 4, 8], [0, 3, 10], False)), [0, 1, 2])
check('oracle 7', solve(*([-3, 3], [-6, 0, 6], True)), [1, 2])
if N == 1: check('variant packet 1', solve(*[[-8, -2, 0, 5, 12, -8, -2, 0, 5, 12], [-10, 0, 10], False]), [0, 1, 1, 1, 2, 0, 1, 1, 1, 2])
if N == 2: check('variant packet 2', solve(*[[-8, -2, 0, 5, 12, -8, -2, 0, 5, 12, -8, -2, 0, 5, 12], [-10, 0, 10], False]), [0, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 2])
if N == 3: check('variant packet 3', solve(*[[-8, -2, 0, 5, 12, -8, -2, 0, 5, 12, -8, -2, 0, 5, 12, -8, -2, 0, 5, 12], [-10, 0, 10], False]), [0, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 2])
if N == 4: check('variant packet 4', solve(*[[-8, -2, 0, 5, 12, -8, -2, 0, 5, 12, -8, -2, 0, 5, 12, -8, -2, 0, 5, 12, -8, -2, 0, 5, 12], [-10, 0, 10], False]), [0, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 2])
if N == 5: check('variant packet 5', solve(*[[-8, -2, 0, 5, 12, -8, -2, 0, 5, 12, -8, -2, 0, 5, 12, -8, -2, 0, 5, 12, -8, -2, 0, 5, 12, -8, -2, 0, 5, 12], [-10, 0, 10], False]), [0, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 2])
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[0, 0, 0, 0, 0][0, 1, 1, 1, 2]Failed
oracle 2[0, 1][2, 1]Failed
oracle 3[2, 0][2, 2]Failed
oracle 4[][]Passed
oracle 5[0, 0][0, 0]Passed
oracle 6[0, 0, 0][0, 1, 2]Failed
oracle 7[1, 0][1, 2]Failed
variant packet 1[0, 0, 0, 0, 0, 0, 0, 0, 0, 0][0, 1, 1, 1, 2, 0, 1, 1, 1, 2]Failed

SHA-256 / 08ff90138969b644d144224c101600e1a0bf5666a5cb22aed8502b9639141c48

3 / The verified repair

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

N = 1
observations = []
def solve(samples, table, tie_high):
    out=[]
    for sample in samples:
        distances=[abs(value-sample) for value in table]
        best=min(distances)
        candidates=[i for i,d in enumerate(distances) if d==best]
        out.append(candidates[-1] if tie_high else candidates[0])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([-8, -2, 0, 5, 12], [-10, 0, 10], False)), [0, 1, 1, 1, 2])
check('oracle 2', solve(*([5, -5], [-10, 0, 10], True)), [2, 1])
check('oracle 3', solve(*([2, 3], [0, 4, 4, 8], True)), [2, 2])
check('oracle 4', solve(*([], [-1, 1], False)), [])
check('oracle 5', solve(*([0, 4], [2], False)), [0, 0])
check('oracle 6', solve(*([1, 4, 8], [0, 3, 10], False)), [0, 1, 2])
check('oracle 7', solve(*([-3, 3], [-6, 0, 6], True)), [1, 2])
if N == 1: check('variant packet 1', solve(*[[-8, -2, 0, 5, 12, -8, -2, 0, 5, 12], [-10, 0, 10], False]), [0, 1, 1, 1, 2, 0, 1, 1, 1, 2])
if N == 2: check('variant packet 2', solve(*[[-8, -2, 0, 5, 12, -8, -2, 0, 5, 12, -8, -2, 0, 5, 12], [-10, 0, 10], False]), [0, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 2])
if N == 3: check('variant packet 3', solve(*[[-8, -2, 0, 5, 12, -8, -2, 0, 5, 12, -8, -2, 0, 5, 12, -8, -2, 0, 5, 12], [-10, 0, 10], False]), [0, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 2])
if N == 4: check('variant packet 4', solve(*[[-8, -2, 0, 5, 12, -8, -2, 0, 5, 12, -8, -2, 0, 5, 12, -8, -2, 0, 5, 12, -8, -2, 0, 5, 12], [-10, 0, 10], False]), [0, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 2])
if N == 5: check('variant packet 5', solve(*[[-8, -2, 0, 5, 12, -8, -2, 0, 5, 12, -8, -2, 0, 5, 12, -8, -2, 0, 5, 12, -8, -2, 0, 5, 12, -8, -2, 0, 5, 12], [-10, 0, 10], False]), [0, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 2])
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[0, 1, 1, 1, 2][0, 1, 1, 1, 2]Passed
oracle 2[2, 1][2, 1]Passed
oracle 3[2, 2][2, 2]Passed
oracle 4[][]Passed
oracle 5[0, 0][0, 0]Passed
oracle 6[0, 1, 2][0, 1, 2]Passed
oracle 7[1, 2][1, 2]Passed
variant packet 1[0, 1, 1, 1, 2, 0, 1, 1, 1, 2][0, 1, 1, 1, 2, 0, 1, 1, 1, 2]Passed

SHA-256 / 81757ee4aaa3ddfa7604faabfc9967e7902d7e0fc892a5b707f5184ea769f1eb

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

Case digest / c8d13da84c5c5176efa2e710771d54a69fb6e1300454fce14f894a6d489eccdf