FAILURE MAP
← Case archive

FA-10616 / Color encoding / Open access

Rgb565 green width · case 01

Green is quantized to five bits in a six-bit field.

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

ROOT CAUSE

Green is quantized to five bits in a six-bit field.

VERIFIED REPAIR

Use the stage contract: Quantize three RGB bytes into RGB565 using high five red bits, high six green bits and high five blue bits.

Unsuccessful approach: Changing the red shift implements RGB555 rather than the requested layout.

Case contract

Quantize three RGB bytes into RGB565 using high five red bits, high six green bits and high five blue bits.

Why this case matters

A deterministic software graphics stage with explicit channel and coordinate conventions; no hardware, device profile or API behavior is inferred.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(r, g, b):
    return ((r>>3)<<11)|((g>>3)<<5)|(b>>3)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve(*(255, 255, 255)), 65535)
check('fixture 2', solve(*(0, 255, 0)), 2016)
check('fixture 3', solve(*(255, 0, 0)), 63488)
check('fixture 4', solve(*(0, 0, 255)), 31)
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
fixture 16451165535Failed
fixture 29922016Failed
fixture 36348863488Passed
fixture 43131Passed

SHA-256 / 6ce2a3067d9231150505a82459b7c9098f138385896b157fba111c572c7bd805

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(r, g, b):
    return ((r>>3)<<10)|((g>>3)<<5)|(b>>3)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve(*(255, 255, 255)), 65535)
check('fixture 2', solve(*(0, 255, 0)), 2016)
check('fixture 3', solve(*(255, 0, 0)), 63488)
check('fixture 4', solve(*(0, 0, 255)), 31)
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
fixture 13276765535Failed
fixture 29922016Failed
fixture 33174463488Failed
fixture 43131Passed

SHA-256 / 2189d97ec9e849b1885cdf50f089c8fc98e773b5848795551b6f5967ff77fd06

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(r, g, b):
    return ((r>>3)<<11)|((g>>2)<<5)|(b>>3)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve(*(255, 255, 255)), 65535)
check('fixture 2', solve(*(0, 255, 0)), 2016)
check('fixture 3', solve(*(255, 0, 0)), 63488)
check('fixture 4', solve(*(0, 0, 255)), 31)
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
fixture 16553565535Passed
fixture 220162016Passed
fixture 36348863488Passed
fixture 43131Passed

SHA-256 / 31170b9aae4d573f4c0ffe4423e221039251bd26a5fbe7f0fe370617f7e6de1f

Verification & scope

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

Case digest / 9cd6e99c05b0a2357124c00e3c9c485812539ae4c125be38def5e958a0e768c2