broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(p):
    p = dict(p)
    chroma_width = (p["w"]+1)//2
    chroma_height = (p["h"]+1)//2
    u_pitch = chroma_width+p["ug"]
    v_pitch = chroma_width+p["vg"]
    u_origin = p["base"]+1+p["w"]*p["h"]+2
    v_origin = u_origin+u_pitch*chroma_height+3
    luma_address = p["base"]+1+p["y"]*p["w"]+p["x"]
    u_address = u_origin+p["y"]*u_pitch+p["x"]//2
    v_address = v_origin+(p["y"]//2)*v_pitch+p["x"]//2
    allocation_end = v_origin+v_pitch*chroma_height
    return {'chroma_width': chroma_width, 'chroma_height': chroma_height, 'u_pitch': u_pitch, 'v_pitch': v_pitch, 'u_origin': u_origin, 'v_origin': v_origin, 'luma_address': luma_address, 'u_address': u_address, 'v_address': v_address, 'allocation_end': allocation_end}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 2, 'base': 11, 'ug': 2, 'vg': 3}, {'chroma_width': 1, 'chroma_height': 1, 'u_pitch': 3, 'v_pitch': 4, 'u_origin': 15, 'v_origin': 21, 'luma_address': 12, 'u_address': 15, 'v_address': 21, 'allocation_end': 25}), ({'w': 6, 'h': 4, 'x': 1, 'y': 2, 'b': 2, 'base': 11, 'ug': 2, 'vg': 3}, {'chroma_width': 3, 'chroma_height': 2, 'u_pitch': 5, 'v_pitch': 6, 'u_origin': 38, 'v_origin': 51, 'luma_address': 25, 'u_address': 43, 'v_address': 57, 'allocation_end': 63}), ({'w': 10, 'h': 8, 'x': 8, 'y': 6, 'b': 2, 'base': 11, 'ug': 2, 'vg': 3}, {'chroma_width': 5, 'chroma_height': 4, 'u_pitch': 7, 'v_pitch': 8, 'u_origin': 94, 'v_origin': 125, 'luma_address': 80, 'u_address': 119, 'v_address': 153, 'allocation_end': 157}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 2, 'base': 11, 'ug': 2, 'vg': 3}, {'chroma_width': 8, 'chroma_height': 4, 'u_pitch': 10, 'v_pitch': 11, 'u_origin': 142, 'v_origin': 185, 'luma_address': 139, 'u_address': 179, 'v_address': 225, 'allocation_end': 229}), ({'w': 18, 'h': 10, 'x': 16, 'y': 8, 'b': 2, 'base': 11, 'ug': 2, 'vg': 3}, {'chroma_width': 9, 'chroma_height': 5, 'u_pitch': 11, 'v_pitch': 12, 'u_origin': 194, 'v_origin': 252, 'luma_address': 172, 'u_address': 246, 'v_address': 308, 'allocation_end': 312}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 2, 'base': 11, 'ug': 2, 'vg': 3}, {'chroma_width': 4, 'chroma_height': 7, 'u_pitch': 6, 'v_pitch': 7, 'u_origin': 105, 'v_origin': 150, 'luma_address': 99, 'u_address': 142, 'v_address': 193, 'allocation_end': 199})], 2: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 3, 'base': 22, 'ug': 3, 'vg': 4}, {'chroma_width': 1, 'chroma_height': 1, 'u_pitch': 4, 'v_pitch': 5, 'u_origin': 26, 'v_origin': 33, 'luma_address': 23, 'u_address': 26, 'v_address': 33, 'allocation_end': 38}), ({'w': 7, 'h': 5, 'x': 1, 'y': 2, 'b': 3, 'base': 22, 'ug': 3, 'vg': 4}, {'chroma_width': 4, 'chroma_height': 3, 'u_pitch': 7, 'v_pitch': 8, 'u_origin': 60, 'v_origin': 84, 'luma_address': 38, 'u_address': 67, 'v_address': 92, 'allocation_end': 108}), ({'w': 11, 'h': 9, 'x': 8, 'y': 6, 'b': 3, 'base': 22, 'ug': 3, 'vg': 4}, {'chroma_width': 6, 'chroma_height': 5, 'u_pitch': 9, 'v_pitch': 10, 'u_origin': 124, 'v_origin': 172, 'luma_address': 97, 'u_address': 155, 'v_address': 206, 'allocation_end': 222}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 3, 'base': 22, 'ug': 3, 'vg': 4}, {'chroma_width': 8, 'chroma_height': 4, 'u_pitch': 11, 'v_pitch': 12, 'u_origin': 153, 'v_origin': 200, 'luma_address': 150, 'u_address': 193, 'v_address': 243, 'allocation_end': 248}), ({'w': 19, 'h': 11, 'x': 16, 'y': 8, 'b': 3, 'base': 22, 'ug': 3, 'vg': 4}, {'chroma_width': 10, 'chroma_height': 6, 'u_pitch': 13, 'v_pitch': 14, 'u_origin': 234, 'v_origin': 315, 'luma_address': 191, 'u_address': 294, 'v_address': 379, 'allocation_end': 399}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 3, 'base': 22, 'ug': 3, 'vg': 4}, {'chroma_width': 4, 'chroma_height': 7, 'u_pitch': 7, 'v_pitch': 8, 'u_origin': 116, 'v_origin': 168, 'luma_address': 110, 'u_address': 159, 'v_address': 217, 'allocation_end': 224})], 3: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 4, 'base': 33, 'ug': 4, 'vg': 5}, {'chroma_width': 1, 'chroma_height': 1, 'u_pitch': 5, 'v_pitch': 6, 'u_origin': 37, 'v_origin': 45, 'luma_address': 34, 'u_address': 37, 'v_address': 45, 'allocation_end': 51}), ({'w': 8, 'h': 6, 'x': 1, 'y': 2, 'b': 4, 'base': 33, 'ug': 4, 'vg': 5}, {'chroma_width': 4, 'chroma_height': 3, 'u_pitch': 8, 'v_pitch': 9, 'u_origin': 84, 'v_origin': 111, 'luma_address': 51, 'u_address': 92, 'v_address': 120, 'allocation_end': 138}), ({'w': 12, 'h': 10, 'x': 8, 'y': 6, 'b': 4, 'base': 33, 'ug': 4, 'vg': 5}, {'chroma_width': 6, 'chroma_height': 5, 'u_pitch': 10, 'v_pitch': 11, 'u_origin': 156, 'v_origin': 209, 'luma_address': 114, 'u_address': 190, 'v_address': 246, 'allocation_end': 264}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 4, 'base': 33, 'ug': 4, 'vg': 5}, {'chroma_width': 8, 'chroma_height': 4, 'u_pitch': 12, 'v_pitch': 13, 'u_origin': 164, 'v_origin': 215, 'luma_address': 161, 'u_address': 207, 'v_address': 261, 'allocation_end': 267}), ({'w': 20, 'h': 12, 'x': 16, 'y': 8, 'b': 4, 'base': 33, 'ug': 4, 'vg': 5}, {'chroma_width': 10, 'chroma_height': 6, 'u_pitch': 14, 'v_pitch': 15, 'u_origin': 276, 'v_origin': 363, 'luma_address': 210, 'u_address': 340, 'v_address': 431, 'allocation_end': 453}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 4, 'base': 33, 'ug': 4, 'vg': 5}, {'chroma_width': 4, 'chroma_height': 7, 'u_pitch': 8, 'v_pitch': 9, 'u_origin': 127, 'v_origin': 186, 'luma_address': 121, 'u_address': 176, 'v_address': 241, 'allocation_end': 249})], 4: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 5, 'base': 44, 'ug': 5, 'vg': 6}, {'chroma_width': 1, 'chroma_height': 1, 'u_pitch': 6, 'v_pitch': 7, 'u_origin': 48, 'v_origin': 57, 'luma_address': 45, 'u_address': 48, 'v_address': 57, 'allocation_end': 64}), ({'w': 9, 'h': 7, 'x': 1, 'y': 2, 'b': 5, 'base': 44, 'ug': 5, 'vg': 6}, {'chroma_width': 5, 'chroma_height': 4, 'u_pitch': 10, 'v_pitch': 11, 'u_origin': 110, 'v_origin': 153, 'luma_address': 64, 'u_address': 120, 'v_address': 164, 'allocation_end': 197}), ({'w': 13, 'h': 11, 'x': 8, 'y': 6, 'b': 5, 'base': 44, 'ug': 5, 'vg': 6}, {'chroma_width': 7, 'chroma_height': 6, 'u_pitch': 12, 'v_pitch': 13, 'u_origin': 190, 'v_origin': 265, 'luma_address': 131, 'u_address': 230, 'v_address': 308, 'allocation_end': 343}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 5, 'base': 44, 'ug': 5, 'vg': 6}, {'chroma_width': 8, 'chroma_height': 4, 'u_pitch': 13, 'v_pitch': 14, 'u_origin': 175, 'v_origin': 230, 'luma_address': 172, 'u_address': 221, 'v_address': 279, 'allocation_end': 286}), ({'w': 21, 'h': 13, 'x': 16, 'y': 8, 'b': 5, 'base': 44, 'ug': 5, 'vg': 6}, {'chroma_width': 11, 'chroma_height': 7, 'u_pitch': 16, 'v_pitch': 17, 'u_origin': 320, 'v_origin': 435, 'luma_address': 229, 'u_address': 392, 'v_address': 511, 'allocation_end': 554}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 5, 'base': 44, 'ug': 5, 'vg': 6}, {'chroma_width': 4, 'chroma_height': 7, 'u_pitch': 9, 'v_pitch': 10, 'u_origin': 138, 'v_origin': 204, 'luma_address': 132, 'u_address': 193, 'v_address': 265, 'allocation_end': 274})], 5: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 6, 'base': 55, 'ug': 6, 'vg': 7}, {'chroma_width': 1, 'chroma_height': 1, 'u_pitch': 7, 'v_pitch': 8, 'u_origin': 59, 'v_origin': 69, 'luma_address': 56, 'u_address': 59, 'v_address': 69, 'allocation_end': 77}), ({'w': 10, 'h': 8, 'x': 1, 'y': 2, 'b': 6, 'base': 55, 'ug': 6, 'vg': 7}, {'chroma_width': 5, 'chroma_height': 4, 'u_pitch': 11, 'v_pitch': 12, 'u_origin': 138, 'v_origin': 185, 'luma_address': 77, 'u_address': 149, 'v_address': 197, 'allocation_end': 233}), ({'w': 14, 'h': 12, 'x': 8, 'y': 6, 'b': 6, 'base': 55, 'ug': 6, 'vg': 7}, {'chroma_width': 7, 'chroma_height': 6, 'u_pitch': 13, 'v_pitch': 14, 'u_origin': 226, 'v_origin': 307, 'luma_address': 148, 'u_address': 269, 'v_address': 353, 'allocation_end': 391}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 6, 'base': 55, 'ug': 6, 'vg': 7}, {'chroma_width': 8, 'chroma_height': 4, 'u_pitch': 14, 'v_pitch': 15, 'u_origin': 186, 'v_origin': 245, 'luma_address': 183, 'u_address': 235, 'v_address': 297, 'allocation_end': 305}), ({'w': 22, 'h': 14, 'x': 16, 'y': 8, 'b': 6, 'base': 55, 'ug': 6, 'vg': 7}, {'chroma_width': 11, 'chroma_height': 7, 'u_pitch': 17, 'v_pitch': 18, 'u_origin': 366, 'v_origin': 488, 'luma_address': 248, 'u_address': 442, 'v_address': 568, 'allocation_end': 614}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 6, 'base': 55, 'ug': 6, 'vg': 7}, {'chroma_width': 4, 'chroma_height': 7, 'u_pitch': 10, 'v_pitch': 11, 'u_origin': 149, 'v_origin': 222, 'luma_address': 143, 'u_address': 210, 'v_address': 289, 'allocation_end': 299})]}
for i, (p, expected) in enumerate(cases[N]):
    check("layout fixture " + str(i + 1), solve(p), expected)
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(p):
    p = dict(p)
    chroma_width = (p["w"]+1)//2
    chroma_height = (p["h"]+1)//2
    u_pitch = chroma_width+p["ug"]
    v_pitch = chroma_width+p["vg"]
    u_origin = p["base"]+1+p["w"]*p["h"]+2
    v_origin = u_origin+u_pitch*chroma_height+3
    luma_address = p["base"]+1+p["y"]*p["w"]+p["x"]
    u_address = u_origin+(p["y"]//2)*u_pitch+p["x"]
    v_address = v_origin+(p["y"]//2)*v_pitch+p["x"]//2
    allocation_end = v_origin+v_pitch*chroma_height
    return {'chroma_width': chroma_width, 'chroma_height': chroma_height, 'u_pitch': u_pitch, 'v_pitch': v_pitch, 'u_origin': u_origin, 'v_origin': v_origin, 'luma_address': luma_address, 'u_address': u_address, 'v_address': v_address, 'allocation_end': allocation_end}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 2, 'base': 11, 'ug': 2, 'vg': 3}, {'chroma_width': 1, 'chroma_height': 1, 'u_pitch': 3, 'v_pitch': 4, 'u_origin': 15, 'v_origin': 21, 'luma_address': 12, 'u_address': 15, 'v_address': 21, 'allocation_end': 25}), ({'w': 6, 'h': 4, 'x': 1, 'y': 2, 'b': 2, 'base': 11, 'ug': 2, 'vg': 3}, {'chroma_width': 3, 'chroma_height': 2, 'u_pitch': 5, 'v_pitch': 6, 'u_origin': 38, 'v_origin': 51, 'luma_address': 25, 'u_address': 43, 'v_address': 57, 'allocation_end': 63}), ({'w': 10, 'h': 8, 'x': 8, 'y': 6, 'b': 2, 'base': 11, 'ug': 2, 'vg': 3}, {'chroma_width': 5, 'chroma_height': 4, 'u_pitch': 7, 'v_pitch': 8, 'u_origin': 94, 'v_origin': 125, 'luma_address': 80, 'u_address': 119, 'v_address': 153, 'allocation_end': 157}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 2, 'base': 11, 'ug': 2, 'vg': 3}, {'chroma_width': 8, 'chroma_height': 4, 'u_pitch': 10, 'v_pitch': 11, 'u_origin': 142, 'v_origin': 185, 'luma_address': 139, 'u_address': 179, 'v_address': 225, 'allocation_end': 229}), ({'w': 18, 'h': 10, 'x': 16, 'y': 8, 'b': 2, 'base': 11, 'ug': 2, 'vg': 3}, {'chroma_width': 9, 'chroma_height': 5, 'u_pitch': 11, 'v_pitch': 12, 'u_origin': 194, 'v_origin': 252, 'luma_address': 172, 'u_address': 246, 'v_address': 308, 'allocation_end': 312}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 2, 'base': 11, 'ug': 2, 'vg': 3}, {'chroma_width': 4, 'chroma_height': 7, 'u_pitch': 6, 'v_pitch': 7, 'u_origin': 105, 'v_origin': 150, 'luma_address': 99, 'u_address': 142, 'v_address': 193, 'allocation_end': 199})], 2: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 3, 'base': 22, 'ug': 3, 'vg': 4}, {'chroma_width': 1, 'chroma_height': 1, 'u_pitch': 4, 'v_pitch': 5, 'u_origin': 26, 'v_origin': 33, 'luma_address': 23, 'u_address': 26, 'v_address': 33, 'allocation_end': 38}), ({'w': 7, 'h': 5, 'x': 1, 'y': 2, 'b': 3, 'base': 22, 'ug': 3, 'vg': 4}, {'chroma_width': 4, 'chroma_height': 3, 'u_pitch': 7, 'v_pitch': 8, 'u_origin': 60, 'v_origin': 84, 'luma_address': 38, 'u_address': 67, 'v_address': 92, 'allocation_end': 108}), ({'w': 11, 'h': 9, 'x': 8, 'y': 6, 'b': 3, 'base': 22, 'ug': 3, 'vg': 4}, {'chroma_width': 6, 'chroma_height': 5, 'u_pitch': 9, 'v_pitch': 10, 'u_origin': 124, 'v_origin': 172, 'luma_address': 97, 'u_address': 155, 'v_address': 206, 'allocation_end': 222}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 3, 'base': 22, 'ug': 3, 'vg': 4}, {'chroma_width': 8, 'chroma_height': 4, 'u_pitch': 11, 'v_pitch': 12, 'u_origin': 153, 'v_origin': 200, 'luma_address': 150, 'u_address': 193, 'v_address': 243, 'allocation_end': 248}), ({'w': 19, 'h': 11, 'x': 16, 'y': 8, 'b': 3, 'base': 22, 'ug': 3, 'vg': 4}, {'chroma_width': 10, 'chroma_height': 6, 'u_pitch': 13, 'v_pitch': 14, 'u_origin': 234, 'v_origin': 315, 'luma_address': 191, 'u_address': 294, 'v_address': 379, 'allocation_end': 399}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 3, 'base': 22, 'ug': 3, 'vg': 4}, {'chroma_width': 4, 'chroma_height': 7, 'u_pitch': 7, 'v_pitch': 8, 'u_origin': 116, 'v_origin': 168, 'luma_address': 110, 'u_address': 159, 'v_address': 217, 'allocation_end': 224})], 3: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 4, 'base': 33, 'ug': 4, 'vg': 5}, {'chroma_width': 1, 'chroma_height': 1, 'u_pitch': 5, 'v_pitch': 6, 'u_origin': 37, 'v_origin': 45, 'luma_address': 34, 'u_address': 37, 'v_address': 45, 'allocation_end': 51}), ({'w': 8, 'h': 6, 'x': 1, 'y': 2, 'b': 4, 'base': 33, 'ug': 4, 'vg': 5}, {'chroma_width': 4, 'chroma_height': 3, 'u_pitch': 8, 'v_pitch': 9, 'u_origin': 84, 'v_origin': 111, 'luma_address': 51, 'u_address': 92, 'v_address': 120, 'allocation_end': 138}), ({'w': 12, 'h': 10, 'x': 8, 'y': 6, 'b': 4, 'base': 33, 'ug': 4, 'vg': 5}, {'chroma_width': 6, 'chroma_height': 5, 'u_pitch': 10, 'v_pitch': 11, 'u_origin': 156, 'v_origin': 209, 'luma_address': 114, 'u_address': 190, 'v_address': 246, 'allocation_end': 264}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 4, 'base': 33, 'ug': 4, 'vg': 5}, {'chroma_width': 8, 'chroma_height': 4, 'u_pitch': 12, 'v_pitch': 13, 'u_origin': 164, 'v_origin': 215, 'luma_address': 161, 'u_address': 207, 'v_address': 261, 'allocation_end': 267}), ({'w': 20, 'h': 12, 'x': 16, 'y': 8, 'b': 4, 'base': 33, 'ug': 4, 'vg': 5}, {'chroma_width': 10, 'chroma_height': 6, 'u_pitch': 14, 'v_pitch': 15, 'u_origin': 276, 'v_origin': 363, 'luma_address': 210, 'u_address': 340, 'v_address': 431, 'allocation_end': 453}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 4, 'base': 33, 'ug': 4, 'vg': 5}, {'chroma_width': 4, 'chroma_height': 7, 'u_pitch': 8, 'v_pitch': 9, 'u_origin': 127, 'v_origin': 186, 'luma_address': 121, 'u_address': 176, 'v_address': 241, 'allocation_end': 249})], 4: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 5, 'base': 44, 'ug': 5, 'vg': 6}, {'chroma_width': 1, 'chroma_height': 1, 'u_pitch': 6, 'v_pitch': 7, 'u_origin': 48, 'v_origin': 57, 'luma_address': 45, 'u_address': 48, 'v_address': 57, 'allocation_end': 64}), ({'w': 9, 'h': 7, 'x': 1, 'y': 2, 'b': 5, 'base': 44, 'ug': 5, 'vg': 6}, {'chroma_width': 5, 'chroma_height': 4, 'u_pitch': 10, 'v_pitch': 11, 'u_origin': 110, 'v_origin': 153, 'luma_address': 64, 'u_address': 120, 'v_address': 164, 'allocation_end': 197}), ({'w': 13, 'h': 11, 'x': 8, 'y': 6, 'b': 5, 'base': 44, 'ug': 5, 'vg': 6}, {'chroma_width': 7, 'chroma_height': 6, 'u_pitch': 12, 'v_pitch': 13, 'u_origin': 190, 'v_origin': 265, 'luma_address': 131, 'u_address': 230, 'v_address': 308, 'allocation_end': 343}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 5, 'base': 44, 'ug': 5, 'vg': 6}, {'chroma_width': 8, 'chroma_height': 4, 'u_pitch': 13, 'v_pitch': 14, 'u_origin': 175, 'v_origin': 230, 'luma_address': 172, 'u_address': 221, 'v_address': 279, 'allocation_end': 286}), ({'w': 21, 'h': 13, 'x': 16, 'y': 8, 'b': 5, 'base': 44, 'ug': 5, 'vg': 6}, {'chroma_width': 11, 'chroma_height': 7, 'u_pitch': 16, 'v_pitch': 17, 'u_origin': 320, 'v_origin': 435, 'luma_address': 229, 'u_address': 392, 'v_address': 511, 'allocation_end': 554}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 5, 'base': 44, 'ug': 5, 'vg': 6}, {'chroma_width': 4, 'chroma_height': 7, 'u_pitch': 9, 'v_pitch': 10, 'u_origin': 138, 'v_origin': 204, 'luma_address': 132, 'u_address': 193, 'v_address': 265, 'allocation_end': 274})], 5: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 6, 'base': 55, 'ug': 6, 'vg': 7}, {'chroma_width': 1, 'chroma_height': 1, 'u_pitch': 7, 'v_pitch': 8, 'u_origin': 59, 'v_origin': 69, 'luma_address': 56, 'u_address': 59, 'v_address': 69, 'allocation_end': 77}), ({'w': 10, 'h': 8, 'x': 1, 'y': 2, 'b': 6, 'base': 55, 'ug': 6, 'vg': 7}, {'chroma_width': 5, 'chroma_height': 4, 'u_pitch': 11, 'v_pitch': 12, 'u_origin': 138, 'v_origin': 185, 'luma_address': 77, 'u_address': 149, 'v_address': 197, 'allocation_end': 233}), ({'w': 14, 'h': 12, 'x': 8, 'y': 6, 'b': 6, 'base': 55, 'ug': 6, 'vg': 7}, {'chroma_width': 7, 'chroma_height': 6, 'u_pitch': 13, 'v_pitch': 14, 'u_origin': 226, 'v_origin': 307, 'luma_address': 148, 'u_address': 269, 'v_address': 353, 'allocation_end': 391}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 6, 'base': 55, 'ug': 6, 'vg': 7}, {'chroma_width': 8, 'chroma_height': 4, 'u_pitch': 14, 'v_pitch': 15, 'u_origin': 186, 'v_origin': 245, 'luma_address': 183, 'u_address': 235, 'v_address': 297, 'allocation_end': 305}), ({'w': 22, 'h': 14, 'x': 16, 'y': 8, 'b': 6, 'base': 55, 'ug': 6, 'vg': 7}, {'chroma_width': 11, 'chroma_height': 7, 'u_pitch': 17, 'v_pitch': 18, 'u_origin': 366, 'v_origin': 488, 'luma_address': 248, 'u_address': 442, 'v_address': 568, 'allocation_end': 614}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 6, 'base': 55, 'ug': 6, 'vg': 7}, {'chroma_width': 4, 'chroma_height': 7, 'u_pitch': 10, 'v_pitch': 11, 'u_origin': 149, 'v_origin': 222, 'luma_address': 143, 'u_address': 210, 'v_address': 289, 'allocation_end': 299})]}
for i, (p, expected) in enumerate(cases[N]):
    check("layout fixture " + str(i + 1), solve(p), expected)
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)

prompt:
The returned physical layout descriptor disagrees with the declared buffer mapping at u_address.

A 4:2:0 toy image has a byte luma plane plus independent U and V planes with distinct row guards. Chroma rounds odd dimensions up; plane headers are [1,2,3] bytes. Return physical sample locations for in-bounds luma coordinate. Return the named intermediate layout descriptor and final address fields; all quantities are integer byte offsets unless explicitly stated.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(p):
    p = dict(p)
    chroma_width = (p["w"]+1)//2
    chroma_height = (p["h"]+1)//2
    u_pitch = chroma_width+p["ug"]
    v_pitch = chroma_width+p["vg"]
    u_origin = p["base"]+1+p["w"]*p["h"]+2
    v_origin = u_origin+u_pitch*chroma_height+3
    luma_address = p["base"]+1+p["y"]*p["w"]+p["x"]
    u_address = u_origin+(p["y"]//2)*u_pitch+p["x"]//2
    v_address = u_origin+(p["y"]//2)*v_pitch+p["x"]//2
    allocation_end = v_origin+v_pitch*chroma_height
    return {'chroma_width': chroma_width, 'chroma_height': chroma_height, 'u_pitch': u_pitch, 'v_pitch': v_pitch, 'u_origin': u_origin, 'v_origin': v_origin, 'luma_address': luma_address, 'u_address': u_address, 'v_address': v_address, 'allocation_end': allocation_end}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 2, 'base': 11, 'ug': 2, 'vg': 3}, {'chroma_width': 1, 'chroma_height': 1, 'u_pitch': 3, 'v_pitch': 4, 'u_origin': 15, 'v_origin': 21, 'luma_address': 12, 'u_address': 15, 'v_address': 21, 'allocation_end': 25}), ({'w': 6, 'h': 4, 'x': 1, 'y': 2, 'b': 2, 'base': 11, 'ug': 2, 'vg': 3}, {'chroma_width': 3, 'chroma_height': 2, 'u_pitch': 5, 'v_pitch': 6, 'u_origin': 38, 'v_origin': 51, 'luma_address': 25, 'u_address': 43, 'v_address': 57, 'allocation_end': 63}), ({'w': 10, 'h': 8, 'x': 8, 'y': 6, 'b': 2, 'base': 11, 'ug': 2, 'vg': 3}, {'chroma_width': 5, 'chroma_height': 4, 'u_pitch': 7, 'v_pitch': 8, 'u_origin': 94, 'v_origin': 125, 'luma_address': 80, 'u_address': 119, 'v_address': 153, 'allocation_end': 157}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 2, 'base': 11, 'ug': 2, 'vg': 3}, {'chroma_width': 8, 'chroma_height': 4, 'u_pitch': 10, 'v_pitch': 11, 'u_origin': 142, 'v_origin': 185, 'luma_address': 139, 'u_address': 179, 'v_address': 225, 'allocation_end': 229}), ({'w': 18, 'h': 10, 'x': 16, 'y': 8, 'b': 2, 'base': 11, 'ug': 2, 'vg': 3}, {'chroma_width': 9, 'chroma_height': 5, 'u_pitch': 11, 'v_pitch': 12, 'u_origin': 194, 'v_origin': 252, 'luma_address': 172, 'u_address': 246, 'v_address': 308, 'allocation_end': 312}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 2, 'base': 11, 'ug': 2, 'vg': 3}, {'chroma_width': 4, 'chroma_height': 7, 'u_pitch': 6, 'v_pitch': 7, 'u_origin': 105, 'v_origin': 150, 'luma_address': 99, 'u_address': 142, 'v_address': 193, 'allocation_end': 199})], 2: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 3, 'base': 22, 'ug': 3, 'vg': 4}, {'chroma_width': 1, 'chroma_height': 1, 'u_pitch': 4, 'v_pitch': 5, 'u_origin': 26, 'v_origin': 33, 'luma_address': 23, 'u_address': 26, 'v_address': 33, 'allocation_end': 38}), ({'w': 7, 'h': 5, 'x': 1, 'y': 2, 'b': 3, 'base': 22, 'ug': 3, 'vg': 4}, {'chroma_width': 4, 'chroma_height': 3, 'u_pitch': 7, 'v_pitch': 8, 'u_origin': 60, 'v_origin': 84, 'luma_address': 38, 'u_address': 67, 'v_address': 92, 'allocation_end': 108}), ({'w': 11, 'h': 9, 'x': 8, 'y': 6, 'b': 3, 'base': 22, 'ug': 3, 'vg': 4}, {'chroma_width': 6, 'chroma_height': 5, 'u_pitch': 9, 'v_pitch': 10, 'u_origin': 124, 'v_origin': 172, 'luma_address': 97, 'u_address': 155, 'v_address': 206, 'allocation_end': 222}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 3, 'base': 22, 'ug': 3, 'vg': 4}, {'chroma_width': 8, 'chroma_height': 4, 'u_pitch': 11, 'v_pitch': 12, 'u_origin': 153, 'v_origin': 200, 'luma_address': 150, 'u_address': 193, 'v_address': 243, 'allocation_end': 248}), ({'w': 19, 'h': 11, 'x': 16, 'y': 8, 'b': 3, 'base': 22, 'ug': 3, 'vg': 4}, {'chroma_width': 10, 'chroma_height': 6, 'u_pitch': 13, 'v_pitch': 14, 'u_origin': 234, 'v_origin': 315, 'luma_address': 191, 'u_address': 294, 'v_address': 379, 'allocation_end': 399}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 3, 'base': 22, 'ug': 3, 'vg': 4}, {'chroma_width': 4, 'chroma_height': 7, 'u_pitch': 7, 'v_pitch': 8, 'u_origin': 116, 'v_origin': 168, 'luma_address': 110, 'u_address': 159, 'v_address': 217, 'allocation_end': 224})], 3: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 4, 'base': 33, 'ug': 4, 'vg': 5}, {'chroma_width': 1, 'chroma_height': 1, 'u_pitch': 5, 'v_pitch': 6, 'u_origin': 37, 'v_origin': 45, 'luma_address': 34, 'u_address': 37, 'v_address': 45, 'allocation_end': 51}), ({'w': 8, 'h': 6, 'x': 1, 'y': 2, 'b': 4, 'base': 33, 'ug': 4, 'vg': 5}, {'chroma_width': 4, 'chroma_height': 3, 'u_pitch': 8, 'v_pitch': 9, 'u_origin': 84, 'v_origin': 111, 'luma_address': 51, 'u_address': 92, 'v_address': 120, 'allocation_end': 138}), ({'w': 12, 'h': 10, 'x': 8, 'y': 6, 'b': 4, 'base': 33, 'ug': 4, 'vg': 5}, {'chroma_width': 6, 'chroma_height': 5, 'u_pitch': 10, 'v_pitch': 11, 'u_origin': 156, 'v_origin': 209, 'luma_address': 114, 'u_address': 190, 'v_address': 246, 'allocation_end': 264}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 4, 'base': 33, 'ug': 4, 'vg': 5}, {'chroma_width': 8, 'chroma_height': 4, 'u_pitch': 12, 'v_pitch': 13, 'u_origin': 164, 'v_origin': 215, 'luma_address': 161, 'u_address': 207, 'v_address': 261, 'allocation_end': 267}), ({'w': 20, 'h': 12, 'x': 16, 'y': 8, 'b': 4, 'base': 33, 'ug': 4, 'vg': 5}, {'chroma_width': 10, 'chroma_height': 6, 'u_pitch': 14, 'v_pitch': 15, 'u_origin': 276, 'v_origin': 363, 'luma_address': 210, 'u_address': 340, 'v_address': 431, 'allocation_end': 453}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 4, 'base': 33, 'ug': 4, 'vg': 5}, {'chroma_width': 4, 'chroma_height': 7, 'u_pitch': 8, 'v_pitch': 9, 'u_origin': 127, 'v_origin': 186, 'luma_address': 121, 'u_address': 176, 'v_address': 241, 'allocation_end': 249})], 4: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 5, 'base': 44, 'ug': 5, 'vg': 6}, {'chroma_width': 1, 'chroma_height': 1, 'u_pitch': 6, 'v_pitch': 7, 'u_origin': 48, 'v_origin': 57, 'luma_address': 45, 'u_address': 48, 'v_address': 57, 'allocation_end': 64}), ({'w': 9, 'h': 7, 'x': 1, 'y': 2, 'b': 5, 'base': 44, 'ug': 5, 'vg': 6}, {'chroma_width': 5, 'chroma_height': 4, 'u_pitch': 10, 'v_pitch': 11, 'u_origin': 110, 'v_origin': 153, 'luma_address': 64, 'u_address': 120, 'v_address': 164, 'allocation_end': 197}), ({'w': 13, 'h': 11, 'x': 8, 'y': 6, 'b': 5, 'base': 44, 'ug': 5, 'vg': 6}, {'chroma_width': 7, 'chroma_height': 6, 'u_pitch': 12, 'v_pitch': 13, 'u_origin': 190, 'v_origin': 265, 'luma_address': 131, 'u_address': 230, 'v_address': 308, 'allocation_end': 343}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 5, 'base': 44, 'ug': 5, 'vg': 6}, {'chroma_width': 8, 'chroma_height': 4, 'u_pitch': 13, 'v_pitch': 14, 'u_origin': 175, 'v_origin': 230, 'luma_address': 172, 'u_address': 221, 'v_address': 279, 'allocation_end': 286}), ({'w': 21, 'h': 13, 'x': 16, 'y': 8, 'b': 5, 'base': 44, 'ug': 5, 'vg': 6}, {'chroma_width': 11, 'chroma_height': 7, 'u_pitch': 16, 'v_pitch': 17, 'u_origin': 320, 'v_origin': 435, 'luma_address': 229, 'u_address': 392, 'v_address': 511, 'allocation_end': 554}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 5, 'base': 44, 'ug': 5, 'vg': 6}, {'chroma_width': 4, 'chroma_height': 7, 'u_pitch': 9, 'v_pitch': 10, 'u_origin': 138, 'v_origin': 204, 'luma_address': 132, 'u_address': 193, 'v_address': 265, 'allocation_end': 274})], 5: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 6, 'base': 55, 'ug': 6, 'vg': 7}, {'chroma_width': 1, 'chroma_height': 1, 'u_pitch': 7, 'v_pitch': 8, 'u_origin': 59, 'v_origin': 69, 'luma_address': 56, 'u_address': 59, 'v_address': 69, 'allocation_end': 77}), ({'w': 10, 'h': 8, 'x': 1, 'y': 2, 'b': 6, 'base': 55, 'ug': 6, 'vg': 7}, {'chroma_width': 5, 'chroma_height': 4, 'u_pitch': 11, 'v_pitch': 12, 'u_origin': 138, 'v_origin': 185, 'luma_address': 77, 'u_address': 149, 'v_address': 197, 'allocation_end': 233}), ({'w': 14, 'h': 12, 'x': 8, 'y': 6, 'b': 6, 'base': 55, 'ug': 6, 'vg': 7}, {'chroma_width': 7, 'chroma_height': 6, 'u_pitch': 13, 'v_pitch': 14, 'u_origin': 226, 'v_origin': 307, 'luma_address': 148, 'u_address': 269, 'v_address': 353, 'allocation_end': 391}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 6, 'base': 55, 'ug': 6, 'vg': 7}, {'chroma_width': 8, 'chroma_height': 4, 'u_pitch': 14, 'v_pitch': 15, 'u_origin': 186, 'v_origin': 245, 'luma_address': 183, 'u_address': 235, 'v_address': 297, 'allocation_end': 305}), ({'w': 22, 'h': 14, 'x': 16, 'y': 8, 'b': 6, 'base': 55, 'ug': 6, 'vg': 7}, {'chroma_width': 11, 'chroma_height': 7, 'u_pitch': 17, 'v_pitch': 18, 'u_origin': 366, 'v_origin': 488, 'luma_address': 248, 'u_address': 442, 'v_address': 568, 'allocation_end': 614}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 6, 'base': 55, 'ug': 6, 'vg': 7}, {'chroma_width': 4, 'chroma_height': 7, 'u_pitch': 10, 'v_pitch': 11, 'u_origin': 149, 'v_origin': 222, 'luma_address': 143, 'u_address': 210, 'v_address': 289, 'allocation_end': 299})]}
for i, (p, expected) in enumerate(cases[N]):
    check("layout fixture " + str(i + 1), solve(p), expected)
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)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(p):
    p = dict(p)
    chroma_width = (p["w"]+1)//2
    chroma_height = (p["h"]+1)//2
    u_pitch = chroma_width+p["ug"]
    v_pitch = chroma_width+p["vg"]
    u_origin = p["base"]+1+p["w"]*p["h"]+2
    v_origin = u_origin+u_pitch*chroma_height+3
    luma_address = p["base"]+1+p["y"]*p["w"]+p["x"]
    u_address = u_origin+(p["y"]//2)*u_pitch+p["x"]//2
    v_address = v_origin+(p["y"]//2)*u_pitch+p["x"]//2
    allocation_end = v_origin+v_pitch*chroma_height
    return {'chroma_width': chroma_width, 'chroma_height': chroma_height, 'u_pitch': u_pitch, 'v_pitch': v_pitch, 'u_origin': u_origin, 'v_origin': v_origin, 'luma_address': luma_address, 'u_address': u_address, 'v_address': v_address, 'allocation_end': allocation_end}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 2, 'base': 11, 'ug': 2, 'vg': 3}, {'chroma_width': 1, 'chroma_height': 1, 'u_pitch': 3, 'v_pitch': 4, 'u_origin': 15, 'v_origin': 21, 'luma_address': 12, 'u_address': 15, 'v_address': 21, 'allocation_end': 25}), ({'w': 6, 'h': 4, 'x': 1, 'y': 2, 'b': 2, 'base': 11, 'ug': 2, 'vg': 3}, {'chroma_width': 3, 'chroma_height': 2, 'u_pitch': 5, 'v_pitch': 6, 'u_origin': 38, 'v_origin': 51, 'luma_address': 25, 'u_address': 43, 'v_address': 57, 'allocation_end': 63}), ({'w': 10, 'h': 8, 'x': 8, 'y': 6, 'b': 2, 'base': 11, 'ug': 2, 'vg': 3}, {'chroma_width': 5, 'chroma_height': 4, 'u_pitch': 7, 'v_pitch': 8, 'u_origin': 94, 'v_origin': 125, 'luma_address': 80, 'u_address': 119, 'v_address': 153, 'allocation_end': 157}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 2, 'base': 11, 'ug': 2, 'vg': 3}, {'chroma_width': 8, 'chroma_height': 4, 'u_pitch': 10, 'v_pitch': 11, 'u_origin': 142, 'v_origin': 185, 'luma_address': 139, 'u_address': 179, 'v_address': 225, 'allocation_end': 229}), ({'w': 18, 'h': 10, 'x': 16, 'y': 8, 'b': 2, 'base': 11, 'ug': 2, 'vg': 3}, {'chroma_width': 9, 'chroma_height': 5, 'u_pitch': 11, 'v_pitch': 12, 'u_origin': 194, 'v_origin': 252, 'luma_address': 172, 'u_address': 246, 'v_address': 308, 'allocation_end': 312}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 2, 'base': 11, 'ug': 2, 'vg': 3}, {'chroma_width': 4, 'chroma_height': 7, 'u_pitch': 6, 'v_pitch': 7, 'u_origin': 105, 'v_origin': 150, 'luma_address': 99, 'u_address': 142, 'v_address': 193, 'allocation_end': 199})], 2: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 3, 'base': 22, 'ug': 3, 'vg': 4}, {'chroma_width': 1, 'chroma_height': 1, 'u_pitch': 4, 'v_pitch': 5, 'u_origin': 26, 'v_origin': 33, 'luma_address': 23, 'u_address': 26, 'v_address': 33, 'allocation_end': 38}), ({'w': 7, 'h': 5, 'x': 1, 'y': 2, 'b': 3, 'base': 22, 'ug': 3, 'vg': 4}, {'chroma_width': 4, 'chroma_height': 3, 'u_pitch': 7, 'v_pitch': 8, 'u_origin': 60, 'v_origin': 84, 'luma_address': 38, 'u_address': 67, 'v_address': 92, 'allocation_end': 108}), ({'w': 11, 'h': 9, 'x': 8, 'y': 6, 'b': 3, 'base': 22, 'ug': 3, 'vg': 4}, {'chroma_width': 6, 'chroma_height': 5, 'u_pitch': 9, 'v_pitch': 10, 'u_origin': 124, 'v_origin': 172, 'luma_address': 97, 'u_address': 155, 'v_address': 206, 'allocation_end': 222}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 3, 'base': 22, 'ug': 3, 'vg': 4}, {'chroma_width': 8, 'chroma_height': 4, 'u_pitch': 11, 'v_pitch': 12, 'u_origin': 153, 'v_origin': 200, 'luma_address': 150, 'u_address': 193, 'v_address': 243, 'allocation_end': 248}), ({'w': 19, 'h': 11, 'x': 16, 'y': 8, 'b': 3, 'base': 22, 'ug': 3, 'vg': 4}, {'chroma_width': 10, 'chroma_height': 6, 'u_pitch': 13, 'v_pitch': 14, 'u_origin': 234, 'v_origin': 315, 'luma_address': 191, 'u_address': 294, 'v_address': 379, 'allocation_end': 399}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 3, 'base': 22, 'ug': 3, 'vg': 4}, {'chroma_width': 4, 'chroma_height': 7, 'u_pitch': 7, 'v_pitch': 8, 'u_origin': 116, 'v_origin': 168, 'luma_address': 110, 'u_address': 159, 'v_address': 217, 'allocation_end': 224})], 3: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 4, 'base': 33, 'ug': 4, 'vg': 5}, {'chroma_width': 1, 'chroma_height': 1, 'u_pitch': 5, 'v_pitch': 6, 'u_origin': 37, 'v_origin': 45, 'luma_address': 34, 'u_address': 37, 'v_address': 45, 'allocation_end': 51}), ({'w': 8, 'h': 6, 'x': 1, 'y': 2, 'b': 4, 'base': 33, 'ug': 4, 'vg': 5}, {'chroma_width': 4, 'chroma_height': 3, 'u_pitch': 8, 'v_pitch': 9, 'u_origin': 84, 'v_origin': 111, 'luma_address': 51, 'u_address': 92, 'v_address': 120, 'allocation_end': 138}), ({'w': 12, 'h': 10, 'x': 8, 'y': 6, 'b': 4, 'base': 33, 'ug': 4, 'vg': 5}, {'chroma_width': 6, 'chroma_height': 5, 'u_pitch': 10, 'v_pitch': 11, 'u_origin': 156, 'v_origin': 209, 'luma_address': 114, 'u_address': 190, 'v_address': 246, 'allocation_end': 264}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 4, 'base': 33, 'ug': 4, 'vg': 5}, {'chroma_width': 8, 'chroma_height': 4, 'u_pitch': 12, 'v_pitch': 13, 'u_origin': 164, 'v_origin': 215, 'luma_address': 161, 'u_address': 207, 'v_address': 261, 'allocation_end': 267}), ({'w': 20, 'h': 12, 'x': 16, 'y': 8, 'b': 4, 'base': 33, 'ug': 4, 'vg': 5}, {'chroma_width': 10, 'chroma_height': 6, 'u_pitch': 14, 'v_pitch': 15, 'u_origin': 276, 'v_origin': 363, 'luma_address': 210, 'u_address': 340, 'v_address': 431, 'allocation_end': 453}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 4, 'base': 33, 'ug': 4, 'vg': 5}, {'chroma_width': 4, 'chroma_height': 7, 'u_pitch': 8, 'v_pitch': 9, 'u_origin': 127, 'v_origin': 186, 'luma_address': 121, 'u_address': 176, 'v_address': 241, 'allocation_end': 249})], 4: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 5, 'base': 44, 'ug': 5, 'vg': 6}, {'chroma_width': 1, 'chroma_height': 1, 'u_pitch': 6, 'v_pitch': 7, 'u_origin': 48, 'v_origin': 57, 'luma_address': 45, 'u_address': 48, 'v_address': 57, 'allocation_end': 64}), ({'w': 9, 'h': 7, 'x': 1, 'y': 2, 'b': 5, 'base': 44, 'ug': 5, 'vg': 6}, {'chroma_width': 5, 'chroma_height': 4, 'u_pitch': 10, 'v_pitch': 11, 'u_origin': 110, 'v_origin': 153, 'luma_address': 64, 'u_address': 120, 'v_address': 164, 'allocation_end': 197}), ({'w': 13, 'h': 11, 'x': 8, 'y': 6, 'b': 5, 'base': 44, 'ug': 5, 'vg': 6}, {'chroma_width': 7, 'chroma_height': 6, 'u_pitch': 12, 'v_pitch': 13, 'u_origin': 190, 'v_origin': 265, 'luma_address': 131, 'u_address': 230, 'v_address': 308, 'allocation_end': 343}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 5, 'base': 44, 'ug': 5, 'vg': 6}, {'chroma_width': 8, 'chroma_height': 4, 'u_pitch': 13, 'v_pitch': 14, 'u_origin': 175, 'v_origin': 230, 'luma_address': 172, 'u_address': 221, 'v_address': 279, 'allocation_end': 286}), ({'w': 21, 'h': 13, 'x': 16, 'y': 8, 'b': 5, 'base': 44, 'ug': 5, 'vg': 6}, {'chroma_width': 11, 'chroma_height': 7, 'u_pitch': 16, 'v_pitch': 17, 'u_origin': 320, 'v_origin': 435, 'luma_address': 229, 'u_address': 392, 'v_address': 511, 'allocation_end': 554}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 5, 'base': 44, 'ug': 5, 'vg': 6}, {'chroma_width': 4, 'chroma_height': 7, 'u_pitch': 9, 'v_pitch': 10, 'u_origin': 138, 'v_origin': 204, 'luma_address': 132, 'u_address': 193, 'v_address': 265, 'allocation_end': 274})], 5: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 6, 'base': 55, 'ug': 6, 'vg': 7}, {'chroma_width': 1, 'chroma_height': 1, 'u_pitch': 7, 'v_pitch': 8, 'u_origin': 59, 'v_origin': 69, 'luma_address': 56, 'u_address': 59, 'v_address': 69, 'allocation_end': 77}), ({'w': 10, 'h': 8, 'x': 1, 'y': 2, 'b': 6, 'base': 55, 'ug': 6, 'vg': 7}, {'chroma_width': 5, 'chroma_height': 4, 'u_pitch': 11, 'v_pitch': 12, 'u_origin': 138, 'v_origin': 185, 'luma_address': 77, 'u_address': 149, 'v_address': 197, 'allocation_end': 233}), ({'w': 14, 'h': 12, 'x': 8, 'y': 6, 'b': 6, 'base': 55, 'ug': 6, 'vg': 7}, {'chroma_width': 7, 'chroma_height': 6, 'u_pitch': 13, 'v_pitch': 14, 'u_origin': 226, 'v_origin': 307, 'luma_address': 148, 'u_address': 269, 'v_address': 353, 'allocation_end': 391}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 6, 'base': 55, 'ug': 6, 'vg': 7}, {'chroma_width': 8, 'chroma_height': 4, 'u_pitch': 14, 'v_pitch': 15, 'u_origin': 186, 'v_origin': 245, 'luma_address': 183, 'u_address': 235, 'v_address': 297, 'allocation_end': 305}), ({'w': 22, 'h': 14, 'x': 16, 'y': 8, 'b': 6, 'base': 55, 'ug': 6, 'vg': 7}, {'chroma_width': 11, 'chroma_height': 7, 'u_pitch': 17, 'v_pitch': 18, 'u_origin': 366, 'v_origin': 488, 'luma_address': 248, 'u_address': 442, 'v_address': 568, 'allocation_end': 614}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 6, 'base': 55, 'ug': 6, 'vg': 7}, {'chroma_width': 4, 'chroma_height': 7, 'u_pitch': 10, 'v_pitch': 11, 'u_origin': 149, 'v_origin': 222, 'luma_address': 143, 'u_address': 210, 'v_address': 289, 'allocation_end': 299})]}
for i, (p, expected) in enumerate(cases[N]):
    check("layout fixture " + str(i + 1), solve(p), expected)
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)

prompt:
The returned physical layout descriptor disagrees with the declared buffer mapping at v_address.

A 4:2:0 toy image has a byte luma plane plus independent U and V planes with distinct row guards. Chroma rounds odd dimensions up; plane headers are [1,2,3] bytes. Return physical sample locations for in-bounds luma coordinate. Return the named intermediate layout descriptor and final address fields; all quantities are integer byte offsets unless explicitly stated.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(p):
    p = dict(p)
    chroma_width = (p["w"]+1)//2
    chroma_height = (p["h"]+1)//2
    u_pitch = chroma_width+p["ug"]
    v_pitch = chroma_width+p["vg"]
    u_origin = p["base"]+1+p["w"]*p["h"]+2
    v_origin = u_origin+u_pitch*chroma_height+3
    luma_address = p["base"]+1+p["y"]*p["w"]+p["x"]
    u_address = u_origin+(p["y"]//2)*u_pitch+p["x"]//2
    v_address = v_origin+(p["y"]//2)*v_pitch+p["x"]//2
    allocation_end = v_origin+u_pitch*chroma_height
    return {'chroma_width': chroma_width, 'chroma_height': chroma_height, 'u_pitch': u_pitch, 'v_pitch': v_pitch, 'u_origin': u_origin, 'v_origin': v_origin, 'luma_address': luma_address, 'u_address': u_address, 'v_address': v_address, 'allocation_end': allocation_end}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 2, 'base': 11, 'ug': 2, 'vg': 3}, {'chroma_width': 1, 'chroma_height': 1, 'u_pitch': 3, 'v_pitch': 4, 'u_origin': 15, 'v_origin': 21, 'luma_address': 12, 'u_address': 15, 'v_address': 21, 'allocation_end': 25}), ({'w': 6, 'h': 4, 'x': 1, 'y': 2, 'b': 2, 'base': 11, 'ug': 2, 'vg': 3}, {'chroma_width': 3, 'chroma_height': 2, 'u_pitch': 5, 'v_pitch': 6, 'u_origin': 38, 'v_origin': 51, 'luma_address': 25, 'u_address': 43, 'v_address': 57, 'allocation_end': 63}), ({'w': 10, 'h': 8, 'x': 8, 'y': 6, 'b': 2, 'base': 11, 'ug': 2, 'vg': 3}, {'chroma_width': 5, 'chroma_height': 4, 'u_pitch': 7, 'v_pitch': 8, 'u_origin': 94, 'v_origin': 125, 'luma_address': 80, 'u_address': 119, 'v_address': 153, 'allocation_end': 157}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 2, 'base': 11, 'ug': 2, 'vg': 3}, {'chroma_width': 8, 'chroma_height': 4, 'u_pitch': 10, 'v_pitch': 11, 'u_origin': 142, 'v_origin': 185, 'luma_address': 139, 'u_address': 179, 'v_address': 225, 'allocation_end': 229}), ({'w': 18, 'h': 10, 'x': 16, 'y': 8, 'b': 2, 'base': 11, 'ug': 2, 'vg': 3}, {'chroma_width': 9, 'chroma_height': 5, 'u_pitch': 11, 'v_pitch': 12, 'u_origin': 194, 'v_origin': 252, 'luma_address': 172, 'u_address': 246, 'v_address': 308, 'allocation_end': 312}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 2, 'base': 11, 'ug': 2, 'vg': 3}, {'chroma_width': 4, 'chroma_height': 7, 'u_pitch': 6, 'v_pitch': 7, 'u_origin': 105, 'v_origin': 150, 'luma_address': 99, 'u_address': 142, 'v_address': 193, 'allocation_end': 199})], 2: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 3, 'base': 22, 'ug': 3, 'vg': 4}, {'chroma_width': 1, 'chroma_height': 1, 'u_pitch': 4, 'v_pitch': 5, 'u_origin': 26, 'v_origin': 33, 'luma_address': 23, 'u_address': 26, 'v_address': 33, 'allocation_end': 38}), ({'w': 7, 'h': 5, 'x': 1, 'y': 2, 'b': 3, 'base': 22, 'ug': 3, 'vg': 4}, {'chroma_width': 4, 'chroma_height': 3, 'u_pitch': 7, 'v_pitch': 8, 'u_origin': 60, 'v_origin': 84, 'luma_address': 38, 'u_address': 67, 'v_address': 92, 'allocation_end': 108}), ({'w': 11, 'h': 9, 'x': 8, 'y': 6, 'b': 3, 'base': 22, 'ug': 3, 'vg': 4}, {'chroma_width': 6, 'chroma_height': 5, 'u_pitch': 9, 'v_pitch': 10, 'u_origin': 124, 'v_origin': 172, 'luma_address': 97, 'u_address': 155, 'v_address': 206, 'allocation_end': 222}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 3, 'base': 22, 'ug': 3, 'vg': 4}, {'chroma_width': 8, 'chroma_height': 4, 'u_pitch': 11, 'v_pitch': 12, 'u_origin': 153, 'v_origin': 200, 'luma_address': 150, 'u_address': 193, 'v_address': 243, 'allocation_end': 248}), ({'w': 19, 'h': 11, 'x': 16, 'y': 8, 'b': 3, 'base': 22, 'ug': 3, 'vg': 4}, {'chroma_width': 10, 'chroma_height': 6, 'u_pitch': 13, 'v_pitch': 14, 'u_origin': 234, 'v_origin': 315, 'luma_address': 191, 'u_address': 294, 'v_address': 379, 'allocation_end': 399}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 3, 'base': 22, 'ug': 3, 'vg': 4}, {'chroma_width': 4, 'chroma_height': 7, 'u_pitch': 7, 'v_pitch': 8, 'u_origin': 116, 'v_origin': 168, 'luma_address': 110, 'u_address': 159, 'v_address': 217, 'allocation_end': 224})], 3: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 4, 'base': 33, 'ug': 4, 'vg': 5}, {'chroma_width': 1, 'chroma_height': 1, 'u_pitch': 5, 'v_pitch': 6, 'u_origin': 37, 'v_origin': 45, 'luma_address': 34, 'u_address': 37, 'v_address': 45, 'allocation_end': 51}), ({'w': 8, 'h': 6, 'x': 1, 'y': 2, 'b': 4, 'base': 33, 'ug': 4, 'vg': 5}, {'chroma_width': 4, 'chroma_height': 3, 'u_pitch': 8, 'v_pitch': 9, 'u_origin': 84, 'v_origin': 111, 'luma_address': 51, 'u_address': 92, 'v_address': 120, 'allocation_end': 138}), ({'w': 12, 'h': 10, 'x': 8, 'y': 6, 'b': 4, 'base': 33, 'ug': 4, 'vg': 5}, {'chroma_width': 6, 'chroma_height': 5, 'u_pitch': 10, 'v_pitch': 11, 'u_origin': 156, 'v_origin': 209, 'luma_address': 114, 'u_address': 190, 'v_address': 246, 'allocation_end': 264}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 4, 'base': 33, 'ug': 4, 'vg': 5}, {'chroma_width': 8, 'chroma_height': 4, 'u_pitch': 12, 'v_pitch': 13, 'u_origin': 164, 'v_origin': 215, 'luma_address': 161, 'u_address': 207, 'v_address': 261, 'allocation_end': 267}), ({'w': 20, 'h': 12, 'x': 16, 'y': 8, 'b': 4, 'base': 33, 'ug': 4, 'vg': 5}, {'chroma_width': 10, 'chroma_height': 6, 'u_pitch': 14, 'v_pitch': 15, 'u_origin': 276, 'v_origin': 363, 'luma_address': 210, 'u_address': 340, 'v_address': 431, 'allocation_end': 453}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 4, 'base': 33, 'ug': 4, 'vg': 5}, {'chroma_width': 4, 'chroma_height': 7, 'u_pitch': 8, 'v_pitch': 9, 'u_origin': 127, 'v_origin': 186, 'luma_address': 121, 'u_address': 176, 'v_address': 241, 'allocation_end': 249})], 4: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 5, 'base': 44, 'ug': 5, 'vg': 6}, {'chroma_width': 1, 'chroma_height': 1, 'u_pitch': 6, 'v_pitch': 7, 'u_origin': 48, 'v_origin': 57, 'luma_address': 45, 'u_address': 48, 'v_address': 57, 'allocation_end': 64}), ({'w': 9, 'h': 7, 'x': 1, 'y': 2, 'b': 5, 'base': 44, 'ug': 5, 'vg': 6}, {'chroma_width': 5, 'chroma_height': 4, 'u_pitch': 10, 'v_pitch': 11, 'u_origin': 110, 'v_origin': 153, 'luma_address': 64, 'u_address': 120, 'v_address': 164, 'allocation_end': 197}), ({'w': 13, 'h': 11, 'x': 8, 'y': 6, 'b': 5, 'base': 44, 'ug': 5, 'vg': 6}, {'chroma_width': 7, 'chroma_height': 6, 'u_pitch': 12, 'v_pitch': 13, 'u_origin': 190, 'v_origin': 265, 'luma_address': 131, 'u_address': 230, 'v_address': 308, 'allocation_end': 343}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 5, 'base': 44, 'ug': 5, 'vg': 6}, {'chroma_width': 8, 'chroma_height': 4, 'u_pitch': 13, 'v_pitch': 14, 'u_origin': 175, 'v_origin': 230, 'luma_address': 172, 'u_address': 221, 'v_address': 279, 'allocation_end': 286}), ({'w': 21, 'h': 13, 'x': 16, 'y': 8, 'b': 5, 'base': 44, 'ug': 5, 'vg': 6}, {'chroma_width': 11, 'chroma_height': 7, 'u_pitch': 16, 'v_pitch': 17, 'u_origin': 320, 'v_origin': 435, 'luma_address': 229, 'u_address': 392, 'v_address': 511, 'allocation_end': 554}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 5, 'base': 44, 'ug': 5, 'vg': 6}, {'chroma_width': 4, 'chroma_height': 7, 'u_pitch': 9, 'v_pitch': 10, 'u_origin': 138, 'v_origin': 204, 'luma_address': 132, 'u_address': 193, 'v_address': 265, 'allocation_end': 274})], 5: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 6, 'base': 55, 'ug': 6, 'vg': 7}, {'chroma_width': 1, 'chroma_height': 1, 'u_pitch': 7, 'v_pitch': 8, 'u_origin': 59, 'v_origin': 69, 'luma_address': 56, 'u_address': 59, 'v_address': 69, 'allocation_end': 77}), ({'w': 10, 'h': 8, 'x': 1, 'y': 2, 'b': 6, 'base': 55, 'ug': 6, 'vg': 7}, {'chroma_width': 5, 'chroma_height': 4, 'u_pitch': 11, 'v_pitch': 12, 'u_origin': 138, 'v_origin': 185, 'luma_address': 77, 'u_address': 149, 'v_address': 197, 'allocation_end': 233}), ({'w': 14, 'h': 12, 'x': 8, 'y': 6, 'b': 6, 'base': 55, 'ug': 6, 'vg': 7}, {'chroma_width': 7, 'chroma_height': 6, 'u_pitch': 13, 'v_pitch': 14, 'u_origin': 226, 'v_origin': 307, 'luma_address': 148, 'u_address': 269, 'v_address': 353, 'allocation_end': 391}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 6, 'base': 55, 'ug': 6, 'vg': 7}, {'chroma_width': 8, 'chroma_height': 4, 'u_pitch': 14, 'v_pitch': 15, 'u_origin': 186, 'v_origin': 245, 'luma_address': 183, 'u_address': 235, 'v_address': 297, 'allocation_end': 305}), ({'w': 22, 'h': 14, 'x': 16, 'y': 8, 'b': 6, 'base': 55, 'ug': 6, 'vg': 7}, {'chroma_width': 11, 'chroma_height': 7, 'u_pitch': 17, 'v_pitch': 18, 'u_origin': 366, 'v_origin': 488, 'luma_address': 248, 'u_address': 442, 'v_address': 568, 'allocation_end': 614}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 6, 'base': 55, 'ug': 6, 'vg': 7}, {'chroma_width': 4, 'chroma_height': 7, 'u_pitch': 10, 'v_pitch': 11, 'u_origin': 149, 'v_origin': 222, 'luma_address': 143, 'u_address': 210, 'v_address': 289, 'allocation_end': 299})]}
for i, (p, expected) in enumerate(cases[N]):
    check("layout fixture " + str(i + 1), solve(p), expected)
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(p):
    p = dict(p)
    chroma_width = (p["w"]+1)//2
    chroma_height = (p["h"]+1)//2
    u_pitch = chroma_width+p["ug"]
    v_pitch = chroma_width+p["vg"]
    u_origin = p["base"]+1+p["w"]*p["h"]+2
    v_origin = u_origin+u_pitch*chroma_height+3
    luma_address = p["base"]+1+p["y"]*p["w"]+p["x"]
    u_address = u_origin+(p["y"]//2)*u_pitch+p["x"]//2
    v_address = v_origin+(p["y"]//2)*v_pitch+p["x"]//2
    allocation_end = v_origin+v_pitch*p["h"]
    return {'chroma_width': chroma_width, 'chroma_height': chroma_height, 'u_pitch': u_pitch, 'v_pitch': v_pitch, 'u_origin': u_origin, 'v_origin': v_origin, 'luma_address': luma_address, 'u_address': u_address, 'v_address': v_address, 'allocation_end': allocation_end}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 2, 'base': 11, 'ug': 2, 'vg': 3}, {'chroma_width': 1, 'chroma_height': 1, 'u_pitch': 3, 'v_pitch': 4, 'u_origin': 15, 'v_origin': 21, 'luma_address': 12, 'u_address': 15, 'v_address': 21, 'allocation_end': 25}), ({'w': 6, 'h': 4, 'x': 1, 'y': 2, 'b': 2, 'base': 11, 'ug': 2, 'vg': 3}, {'chroma_width': 3, 'chroma_height': 2, 'u_pitch': 5, 'v_pitch': 6, 'u_origin': 38, 'v_origin': 51, 'luma_address': 25, 'u_address': 43, 'v_address': 57, 'allocation_end': 63}), ({'w': 10, 'h': 8, 'x': 8, 'y': 6, 'b': 2, 'base': 11, 'ug': 2, 'vg': 3}, {'chroma_width': 5, 'chroma_height': 4, 'u_pitch': 7, 'v_pitch': 8, 'u_origin': 94, 'v_origin': 125, 'luma_address': 80, 'u_address': 119, 'v_address': 153, 'allocation_end': 157}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 2, 'base': 11, 'ug': 2, 'vg': 3}, {'chroma_width': 8, 'chroma_height': 4, 'u_pitch': 10, 'v_pitch': 11, 'u_origin': 142, 'v_origin': 185, 'luma_address': 139, 'u_address': 179, 'v_address': 225, 'allocation_end': 229}), ({'w': 18, 'h': 10, 'x': 16, 'y': 8, 'b': 2, 'base': 11, 'ug': 2, 'vg': 3}, {'chroma_width': 9, 'chroma_height': 5, 'u_pitch': 11, 'v_pitch': 12, 'u_origin': 194, 'v_origin': 252, 'luma_address': 172, 'u_address': 246, 'v_address': 308, 'allocation_end': 312}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 2, 'base': 11, 'ug': 2, 'vg': 3}, {'chroma_width': 4, 'chroma_height': 7, 'u_pitch': 6, 'v_pitch': 7, 'u_origin': 105, 'v_origin': 150, 'luma_address': 99, 'u_address': 142, 'v_address': 193, 'allocation_end': 199})], 2: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 3, 'base': 22, 'ug': 3, 'vg': 4}, {'chroma_width': 1, 'chroma_height': 1, 'u_pitch': 4, 'v_pitch': 5, 'u_origin': 26, 'v_origin': 33, 'luma_address': 23, 'u_address': 26, 'v_address': 33, 'allocation_end': 38}), ({'w': 7, 'h': 5, 'x': 1, 'y': 2, 'b': 3, 'base': 22, 'ug': 3, 'vg': 4}, {'chroma_width': 4, 'chroma_height': 3, 'u_pitch': 7, 'v_pitch': 8, 'u_origin': 60, 'v_origin': 84, 'luma_address': 38, 'u_address': 67, 'v_address': 92, 'allocation_end': 108}), ({'w': 11, 'h': 9, 'x': 8, 'y': 6, 'b': 3, 'base': 22, 'ug': 3, 'vg': 4}, {'chroma_width': 6, 'chroma_height': 5, 'u_pitch': 9, 'v_pitch': 10, 'u_origin': 124, 'v_origin': 172, 'luma_address': 97, 'u_address': 155, 'v_address': 206, 'allocation_end': 222}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 3, 'base': 22, 'ug': 3, 'vg': 4}, {'chroma_width': 8, 'chroma_height': 4, 'u_pitch': 11, 'v_pitch': 12, 'u_origin': 153, 'v_origin': 200, 'luma_address': 150, 'u_address': 193, 'v_address': 243, 'allocation_end': 248}), ({'w': 19, 'h': 11, 'x': 16, 'y': 8, 'b': 3, 'base': 22, 'ug': 3, 'vg': 4}, {'chroma_width': 10, 'chroma_height': 6, 'u_pitch': 13, 'v_pitch': 14, 'u_origin': 234, 'v_origin': 315, 'luma_address': 191, 'u_address': 294, 'v_address': 379, 'allocation_end': 399}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 3, 'base': 22, 'ug': 3, 'vg': 4}, {'chroma_width': 4, 'chroma_height': 7, 'u_pitch': 7, 'v_pitch': 8, 'u_origin': 116, 'v_origin': 168, 'luma_address': 110, 'u_address': 159, 'v_address': 217, 'allocation_end': 224})], 3: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 4, 'base': 33, 'ug': 4, 'vg': 5}, {'chroma_width': 1, 'chroma_height': 1, 'u_pitch': 5, 'v_pitch': 6, 'u_origin': 37, 'v_origin': 45, 'luma_address': 34, 'u_address': 37, 'v_address': 45, 'allocation_end': 51}), ({'w': 8, 'h': 6, 'x': 1, 'y': 2, 'b': 4, 'base': 33, 'ug': 4, 'vg': 5}, {'chroma_width': 4, 'chroma_height': 3, 'u_pitch': 8, 'v_pitch': 9, 'u_origin': 84, 'v_origin': 111, 'luma_address': 51, 'u_address': 92, 'v_address': 120, 'allocation_end': 138}), ({'w': 12, 'h': 10, 'x': 8, 'y': 6, 'b': 4, 'base': 33, 'ug': 4, 'vg': 5}, {'chroma_width': 6, 'chroma_height': 5, 'u_pitch': 10, 'v_pitch': 11, 'u_origin': 156, 'v_origin': 209, 'luma_address': 114, 'u_address': 190, 'v_address': 246, 'allocation_end': 264}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 4, 'base': 33, 'ug': 4, 'vg': 5}, {'chroma_width': 8, 'chroma_height': 4, 'u_pitch': 12, 'v_pitch': 13, 'u_origin': 164, 'v_origin': 215, 'luma_address': 161, 'u_address': 207, 'v_address': 261, 'allocation_end': 267}), ({'w': 20, 'h': 12, 'x': 16, 'y': 8, 'b': 4, 'base': 33, 'ug': 4, 'vg': 5}, {'chroma_width': 10, 'chroma_height': 6, 'u_pitch': 14, 'v_pitch': 15, 'u_origin': 276, 'v_origin': 363, 'luma_address': 210, 'u_address': 340, 'v_address': 431, 'allocation_end': 453}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 4, 'base': 33, 'ug': 4, 'vg': 5}, {'chroma_width': 4, 'chroma_height': 7, 'u_pitch': 8, 'v_pitch': 9, 'u_origin': 127, 'v_origin': 186, 'luma_address': 121, 'u_address': 176, 'v_address': 241, 'allocation_end': 249})], 4: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 5, 'base': 44, 'ug': 5, 'vg': 6}, {'chroma_width': 1, 'chroma_height': 1, 'u_pitch': 6, 'v_pitch': 7, 'u_origin': 48, 'v_origin': 57, 'luma_address': 45, 'u_address': 48, 'v_address': 57, 'allocation_end': 64}), ({'w': 9, 'h': 7, 'x': 1, 'y': 2, 'b': 5, 'base': 44, 'ug': 5, 'vg': 6}, {'chroma_width': 5, 'chroma_height': 4, 'u_pitch': 10, 'v_pitch': 11, 'u_origin': 110, 'v_origin': 153, 'luma_address': 64, 'u_address': 120, 'v_address': 164, 'allocation_end': 197}), ({'w': 13, 'h': 11, 'x': 8, 'y': 6, 'b': 5, 'base': 44, 'ug': 5, 'vg': 6}, {'chroma_width': 7, 'chroma_height': 6, 'u_pitch': 12, 'v_pitch': 13, 'u_origin': 190, 'v_origin': 265, 'luma_address': 131, 'u_address': 230, 'v_address': 308, 'allocation_end': 343}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 5, 'base': 44, 'ug': 5, 'vg': 6}, {'chroma_width': 8, 'chroma_height': 4, 'u_pitch': 13, 'v_pitch': 14, 'u_origin': 175, 'v_origin': 230, 'luma_address': 172, 'u_address': 221, 'v_address': 279, 'allocation_end': 286}), ({'w': 21, 'h': 13, 'x': 16, 'y': 8, 'b': 5, 'base': 44, 'ug': 5, 'vg': 6}, {'chroma_width': 11, 'chroma_height': 7, 'u_pitch': 16, 'v_pitch': 17, 'u_origin': 320, 'v_origin': 435, 'luma_address': 229, 'u_address': 392, 'v_address': 511, 'allocation_end': 554}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 5, 'base': 44, 'ug': 5, 'vg': 6}, {'chroma_width': 4, 'chroma_height': 7, 'u_pitch': 9, 'v_pitch': 10, 'u_origin': 138, 'v_origin': 204, 'luma_address': 132, 'u_address': 193, 'v_address': 265, 'allocation_end': 274})], 5: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 6, 'base': 55, 'ug': 6, 'vg': 7}, {'chroma_width': 1, 'chroma_height': 1, 'u_pitch': 7, 'v_pitch': 8, 'u_origin': 59, 'v_origin': 69, 'luma_address': 56, 'u_address': 59, 'v_address': 69, 'allocation_end': 77}), ({'w': 10, 'h': 8, 'x': 1, 'y': 2, 'b': 6, 'base': 55, 'ug': 6, 'vg': 7}, {'chroma_width': 5, 'chroma_height': 4, 'u_pitch': 11, 'v_pitch': 12, 'u_origin': 138, 'v_origin': 185, 'luma_address': 77, 'u_address': 149, 'v_address': 197, 'allocation_end': 233}), ({'w': 14, 'h': 12, 'x': 8, 'y': 6, 'b': 6, 'base': 55, 'ug': 6, 'vg': 7}, {'chroma_width': 7, 'chroma_height': 6, 'u_pitch': 13, 'v_pitch': 14, 'u_origin': 226, 'v_origin': 307, 'luma_address': 148, 'u_address': 269, 'v_address': 353, 'allocation_end': 391}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 6, 'base': 55, 'ug': 6, 'vg': 7}, {'chroma_width': 8, 'chroma_height': 4, 'u_pitch': 14, 'v_pitch': 15, 'u_origin': 186, 'v_origin': 245, 'luma_address': 183, 'u_address': 235, 'v_address': 297, 'allocation_end': 305}), ({'w': 22, 'h': 14, 'x': 16, 'y': 8, 'b': 6, 'base': 55, 'ug': 6, 'vg': 7}, {'chroma_width': 11, 'chroma_height': 7, 'u_pitch': 17, 'v_pitch': 18, 'u_origin': 366, 'v_origin': 488, 'luma_address': 248, 'u_address': 442, 'v_address': 568, 'allocation_end': 614}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 6, 'base': 55, 'ug': 6, 'vg': 7}, {'chroma_width': 4, 'chroma_height': 7, 'u_pitch': 10, 'v_pitch': 11, 'u_origin': 149, 'v_origin': 222, 'luma_address': 143, 'u_address': 210, 'v_address': 289, 'allocation_end': 299})]}
for i, (p, expected) in enumerate(cases[N]):
    check("layout fixture " + str(i + 1), solve(p), expected)
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)

prompt:
The returned physical layout descriptor disagrees with the declared buffer mapping at allocation_end.

A 4:2:0 toy image has a byte luma plane plus independent U and V planes with distinct row guards. Chroma rounds odd dimensions up; plane headers are [1,2,3] bytes. Return physical sample locations for in-bounds luma coordinate. Return the named intermediate layout descriptor and final address fields; all quantities are integer byte offsets unless explicitly stated.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(p):
    p = dict(p)
    luma_pitch = p["w"]+4
    chroma_pairs = (p["w"]+1)//2
    chroma_rows = (p["h"]+1)//2
    chroma_pitch = chroma_pairs*4+8
    chroma_base = p["base"]+luma_pitch*p["h"]+6
    pair_offset = (p["y"]//2)*chroma_pitch+(p["x"]//2)*4
    component_offset = p["component"]*2
    sample_address = chroma_base+pair_offset+component_offset
    luma_address = p["base"]+p["y"]*luma_pitch+p["x"]*2
    allocation_end = chroma_base+chroma_rows*chroma_pitch
    return {'luma_pitch': luma_pitch, 'chroma_pairs': chroma_pairs, 'chroma_rows': chroma_rows, 'chroma_pitch': chroma_pitch, 'chroma_base': chroma_base, 'pair_offset': pair_offset, 'component_offset': component_offset, 'sample_address': sample_address, 'luma_address': luma_address, 'allocation_end': allocation_end}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 2, 'base': 11, 'component': 0}, {'luma_pitch': 6, 'chroma_pairs': 1, 'chroma_rows': 1, 'chroma_pitch': 12, 'chroma_base': 23, 'pair_offset': 0, 'component_offset': 0, 'sample_address': 23, 'luma_address': 11, 'allocation_end': 35}), ({'w': 6, 'h': 4, 'x': 1, 'y': 2, 'b': 2, 'base': 11, 'component': 1}, {'luma_pitch': 16, 'chroma_pairs': 3, 'chroma_rows': 2, 'chroma_pitch': 20, 'chroma_base': 81, 'pair_offset': 20, 'component_offset': 2, 'sample_address': 103, 'luma_address': 45, 'allocation_end': 121}), ({'w': 10, 'h': 8, 'x': 8, 'y': 6, 'b': 2, 'base': 11, 'component': 0}, {'luma_pitch': 24, 'chroma_pairs': 5, 'chroma_rows': 4, 'chroma_pitch': 28, 'chroma_base': 209, 'pair_offset': 100, 'component_offset': 0, 'sample_address': 309, 'luma_address': 171, 'allocation_end': 321}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 2, 'base': 11, 'component': 1}, {'luma_pitch': 36, 'chroma_pairs': 8, 'chroma_rows': 4, 'chroma_pitch': 40, 'chroma_base': 305, 'pair_offset': 148, 'component_offset': 2, 'sample_address': 455, 'luma_address': 293, 'allocation_end': 465}), ({'w': 18, 'h': 10, 'x': 16, 'y': 8, 'b': 2, 'base': 11, 'component': 0}, {'luma_pitch': 40, 'chroma_pairs': 9, 'chroma_rows': 5, 'chroma_pitch': 44, 'chroma_base': 417, 'pair_offset': 208, 'component_offset': 0, 'sample_address': 625, 'luma_address': 363, 'allocation_end': 637}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 2, 'base': 11, 'component': 1}, {'luma_pitch': 18, 'chroma_pairs': 4, 'chroma_rows': 7, 'chroma_pitch': 24, 'chroma_base': 251, 'pair_offset': 148, 'component_offset': 2, 'sample_address': 401, 'luma_address': 233, 'allocation_end': 419})], 2: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 3, 'base': 22, 'component': 0}, {'luma_pitch': 6, 'chroma_pairs': 1, 'chroma_rows': 1, 'chroma_pitch': 12, 'chroma_base': 34, 'pair_offset': 0, 'component_offset': 0, 'sample_address': 34, 'luma_address': 22, 'allocation_end': 46}), ({'w': 7, 'h': 5, 'x': 1, 'y': 2, 'b': 3, 'base': 22, 'component': 1}, {'luma_pitch': 18, 'chroma_pairs': 4, 'chroma_rows': 3, 'chroma_pitch': 24, 'chroma_base': 118, 'pair_offset': 24, 'component_offset': 2, 'sample_address': 144, 'luma_address': 60, 'allocation_end': 190}), ({'w': 11, 'h': 9, 'x': 8, 'y': 6, 'b': 3, 'base': 22, 'component': 0}, {'luma_pitch': 26, 'chroma_pairs': 6, 'chroma_rows': 5, 'chroma_pitch': 32, 'chroma_base': 262, 'pair_offset': 112, 'component_offset': 0, 'sample_address': 374, 'luma_address': 194, 'allocation_end': 422}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 3, 'base': 22, 'component': 1}, {'luma_pitch': 36, 'chroma_pairs': 8, 'chroma_rows': 4, 'chroma_pitch': 40, 'chroma_base': 316, 'pair_offset': 148, 'component_offset': 2, 'sample_address': 466, 'luma_address': 304, 'allocation_end': 476}), ({'w': 19, 'h': 11, 'x': 16, 'y': 8, 'b': 3, 'base': 22, 'component': 0}, {'luma_pitch': 42, 'chroma_pairs': 10, 'chroma_rows': 6, 'chroma_pitch': 48, 'chroma_base': 490, 'pair_offset': 224, 'component_offset': 0, 'sample_address': 714, 'luma_address': 390, 'allocation_end': 778}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 3, 'base': 22, 'component': 1}, {'luma_pitch': 18, 'chroma_pairs': 4, 'chroma_rows': 7, 'chroma_pitch': 24, 'chroma_base': 262, 'pair_offset': 148, 'component_offset': 2, 'sample_address': 412, 'luma_address': 244, 'allocation_end': 430})], 3: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 4, 'base': 33, 'component': 0}, {'luma_pitch': 6, 'chroma_pairs': 1, 'chroma_rows': 1, 'chroma_pitch': 12, 'chroma_base': 45, 'pair_offset': 0, 'component_offset': 0, 'sample_address': 45, 'luma_address': 33, 'allocation_end': 57}), ({'w': 8, 'h': 6, 'x': 1, 'y': 2, 'b': 4, 'base': 33, 'component': 1}, {'luma_pitch': 20, 'chroma_pairs': 4, 'chroma_rows': 3, 'chroma_pitch': 24, 'chroma_base': 159, 'pair_offset': 24, 'component_offset': 2, 'sample_address': 185, 'luma_address': 75, 'allocation_end': 231}), ({'w': 12, 'h': 10, 'x': 8, 'y': 6, 'b': 4, 'base': 33, 'component': 0}, {'luma_pitch': 28, 'chroma_pairs': 6, 'chroma_rows': 5, 'chroma_pitch': 32, 'chroma_base': 319, 'pair_offset': 112, 'component_offset': 0, 'sample_address': 431, 'luma_address': 217, 'allocation_end': 479}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 4, 'base': 33, 'component': 1}, {'luma_pitch': 36, 'chroma_pairs': 8, 'chroma_rows': 4, 'chroma_pitch': 40, 'chroma_base': 327, 'pair_offset': 148, 'component_offset': 2, 'sample_address': 477, 'luma_address': 315, 'allocation_end': 487}), ({'w': 20, 'h': 12, 'x': 16, 'y': 8, 'b': 4, 'base': 33, 'component': 0}, {'luma_pitch': 44, 'chroma_pairs': 10, 'chroma_rows': 6, 'chroma_pitch': 48, 'chroma_base': 567, 'pair_offset': 224, 'component_offset': 0, 'sample_address': 791, 'luma_address': 417, 'allocation_end': 855}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 4, 'base': 33, 'component': 1}, {'luma_pitch': 18, 'chroma_pairs': 4, 'chroma_rows': 7, 'chroma_pitch': 24, 'chroma_base': 273, 'pair_offset': 148, 'component_offset': 2, 'sample_address': 423, 'luma_address': 255, 'allocation_end': 441})], 4: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 5, 'base': 44, 'component': 0}, {'luma_pitch': 6, 'chroma_pairs': 1, 'chroma_rows': 1, 'chroma_pitch': 12, 'chroma_base': 56, 'pair_offset': 0, 'component_offset': 0, 'sample_address': 56, 'luma_address': 44, 'allocation_end': 68}), ({'w': 9, 'h': 7, 'x': 1, 'y': 2, 'b': 5, 'base': 44, 'component': 1}, {'luma_pitch': 22, 'chroma_pairs': 5, 'chroma_rows': 4, 'chroma_pitch': 28, 'chroma_base': 204, 'pair_offset': 28, 'component_offset': 2, 'sample_address': 234, 'luma_address': 90, 'allocation_end': 316}), ({'w': 13, 'h': 11, 'x': 8, 'y': 6, 'b': 5, 'base': 44, 'component': 0}, {'luma_pitch': 30, 'chroma_pairs': 7, 'chroma_rows': 6, 'chroma_pitch': 36, 'chroma_base': 380, 'pair_offset': 124, 'component_offset': 0, 'sample_address': 504, 'luma_address': 240, 'allocation_end': 596}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 5, 'base': 44, 'component': 1}, {'luma_pitch': 36, 'chroma_pairs': 8, 'chroma_rows': 4, 'chroma_pitch': 40, 'chroma_base': 338, 'pair_offset': 148, 'component_offset': 2, 'sample_address': 488, 'luma_address': 326, 'allocation_end': 498}), ({'w': 21, 'h': 13, 'x': 16, 'y': 8, 'b': 5, 'base': 44, 'component': 0}, {'luma_pitch': 46, 'chroma_pairs': 11, 'chroma_rows': 7, 'chroma_pitch': 52, 'chroma_base': 648, 'pair_offset': 240, 'component_offset': 0, 'sample_address': 888, 'luma_address': 444, 'allocation_end': 1012}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 5, 'base': 44, 'component': 1}, {'luma_pitch': 18, 'chroma_pairs': 4, 'chroma_rows': 7, 'chroma_pitch': 24, 'chroma_base': 284, 'pair_offset': 148, 'component_offset': 2, 'sample_address': 434, 'luma_address': 266, 'allocation_end': 452})], 5: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 6, 'base': 55, 'component': 0}, {'luma_pitch': 6, 'chroma_pairs': 1, 'chroma_rows': 1, 'chroma_pitch': 12, 'chroma_base': 67, 'pair_offset': 0, 'component_offset': 0, 'sample_address': 67, 'luma_address': 55, 'allocation_end': 79}), ({'w': 10, 'h': 8, 'x': 1, 'y': 2, 'b': 6, 'base': 55, 'component': 1}, {'luma_pitch': 24, 'chroma_pairs': 5, 'chroma_rows': 4, 'chroma_pitch': 28, 'chroma_base': 253, 'pair_offset': 28, 'component_offset': 2, 'sample_address': 283, 'luma_address': 105, 'allocation_end': 365}), ({'w': 14, 'h': 12, 'x': 8, 'y': 6, 'b': 6, 'base': 55, 'component': 0}, {'luma_pitch': 32, 'chroma_pairs': 7, 'chroma_rows': 6, 'chroma_pitch': 36, 'chroma_base': 445, 'pair_offset': 124, 'component_offset': 0, 'sample_address': 569, 'luma_address': 263, 'allocation_end': 661}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 6, 'base': 55, 'component': 1}, {'luma_pitch': 36, 'chroma_pairs': 8, 'chroma_rows': 4, 'chroma_pitch': 40, 'chroma_base': 349, 'pair_offset': 148, 'component_offset': 2, 'sample_address': 499, 'luma_address': 337, 'allocation_end': 509}), ({'w': 22, 'h': 14, 'x': 16, 'y': 8, 'b': 6, 'base': 55, 'component': 0}, {'luma_pitch': 48, 'chroma_pairs': 11, 'chroma_rows': 7, 'chroma_pitch': 52, 'chroma_base': 733, 'pair_offset': 240, 'component_offset': 0, 'sample_address': 973, 'luma_address': 471, 'allocation_end': 1097}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 6, 'base': 55, 'component': 1}, {'luma_pitch': 18, 'chroma_pairs': 4, 'chroma_rows': 7, 'chroma_pitch': 24, 'chroma_base': 295, 'pair_offset': 148, 'component_offset': 2, 'sample_address': 445, 'luma_address': 277, 'allocation_end': 463})]}
for i, (p, expected) in enumerate(cases[N]):
    check("layout fixture " + str(i + 1), solve(p), expected)
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(p):
    p = dict(p)
    luma_pitch = p["w"]*2
    chroma_pairs = (p["w"]+1)//2
    chroma_rows = (p["h"]+1)//2
    chroma_pitch = chroma_pairs*4+8
    chroma_base = p["base"]+luma_pitch*p["h"]+6
    pair_offset = (p["y"]//2)*chroma_pitch+(p["x"]//2)*4
    component_offset = p["component"]*2
    sample_address = chroma_base+pair_offset+component_offset
    luma_address = p["base"]+p["y"]*luma_pitch+p["x"]*2
    allocation_end = chroma_base+chroma_rows*chroma_pitch
    return {'luma_pitch': luma_pitch, 'chroma_pairs': chroma_pairs, 'chroma_rows': chroma_rows, 'chroma_pitch': chroma_pitch, 'chroma_base': chroma_base, 'pair_offset': pair_offset, 'component_offset': component_offset, 'sample_address': sample_address, 'luma_address': luma_address, 'allocation_end': allocation_end}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 2, 'base': 11, 'component': 0}, {'luma_pitch': 6, 'chroma_pairs': 1, 'chroma_rows': 1, 'chroma_pitch': 12, 'chroma_base': 23, 'pair_offset': 0, 'component_offset': 0, 'sample_address': 23, 'luma_address': 11, 'allocation_end': 35}), ({'w': 6, 'h': 4, 'x': 1, 'y': 2, 'b': 2, 'base': 11, 'component': 1}, {'luma_pitch': 16, 'chroma_pairs': 3, 'chroma_rows': 2, 'chroma_pitch': 20, 'chroma_base': 81, 'pair_offset': 20, 'component_offset': 2, 'sample_address': 103, 'luma_address': 45, 'allocation_end': 121}), ({'w': 10, 'h': 8, 'x': 8, 'y': 6, 'b': 2, 'base': 11, 'component': 0}, {'luma_pitch': 24, 'chroma_pairs': 5, 'chroma_rows': 4, 'chroma_pitch': 28, 'chroma_base': 209, 'pair_offset': 100, 'component_offset': 0, 'sample_address': 309, 'luma_address': 171, 'allocation_end': 321}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 2, 'base': 11, 'component': 1}, {'luma_pitch': 36, 'chroma_pairs': 8, 'chroma_rows': 4, 'chroma_pitch': 40, 'chroma_base': 305, 'pair_offset': 148, 'component_offset': 2, 'sample_address': 455, 'luma_address': 293, 'allocation_end': 465}), ({'w': 18, 'h': 10, 'x': 16, 'y': 8, 'b': 2, 'base': 11, 'component': 0}, {'luma_pitch': 40, 'chroma_pairs': 9, 'chroma_rows': 5, 'chroma_pitch': 44, 'chroma_base': 417, 'pair_offset': 208, 'component_offset': 0, 'sample_address': 625, 'luma_address': 363, 'allocation_end': 637}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 2, 'base': 11, 'component': 1}, {'luma_pitch': 18, 'chroma_pairs': 4, 'chroma_rows': 7, 'chroma_pitch': 24, 'chroma_base': 251, 'pair_offset': 148, 'component_offset': 2, 'sample_address': 401, 'luma_address': 233, 'allocation_end': 419})], 2: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 3, 'base': 22, 'component': 0}, {'luma_pitch': 6, 'chroma_pairs': 1, 'chroma_rows': 1, 'chroma_pitch': 12, 'chroma_base': 34, 'pair_offset': 0, 'component_offset': 0, 'sample_address': 34, 'luma_address': 22, 'allocation_end': 46}), ({'w': 7, 'h': 5, 'x': 1, 'y': 2, 'b': 3, 'base': 22, 'component': 1}, {'luma_pitch': 18, 'chroma_pairs': 4, 'chroma_rows': 3, 'chroma_pitch': 24, 'chroma_base': 118, 'pair_offset': 24, 'component_offset': 2, 'sample_address': 144, 'luma_address': 60, 'allocation_end': 190}), ({'w': 11, 'h': 9, 'x': 8, 'y': 6, 'b': 3, 'base': 22, 'component': 0}, {'luma_pitch': 26, 'chroma_pairs': 6, 'chroma_rows': 5, 'chroma_pitch': 32, 'chroma_base': 262, 'pair_offset': 112, 'component_offset': 0, 'sample_address': 374, 'luma_address': 194, 'allocation_end': 422}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 3, 'base': 22, 'component': 1}, {'luma_pitch': 36, 'chroma_pairs': 8, 'chroma_rows': 4, 'chroma_pitch': 40, 'chroma_base': 316, 'pair_offset': 148, 'component_offset': 2, 'sample_address': 466, 'luma_address': 304, 'allocation_end': 476}), ({'w': 19, 'h': 11, 'x': 16, 'y': 8, 'b': 3, 'base': 22, 'component': 0}, {'luma_pitch': 42, 'chroma_pairs': 10, 'chroma_rows': 6, 'chroma_pitch': 48, 'chroma_base': 490, 'pair_offset': 224, 'component_offset': 0, 'sample_address': 714, 'luma_address': 390, 'allocation_end': 778}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 3, 'base': 22, 'component': 1}, {'luma_pitch': 18, 'chroma_pairs': 4, 'chroma_rows': 7, 'chroma_pitch': 24, 'chroma_base': 262, 'pair_offset': 148, 'component_offset': 2, 'sample_address': 412, 'luma_address': 244, 'allocation_end': 430})], 3: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 4, 'base': 33, 'component': 0}, {'luma_pitch': 6, 'chroma_pairs': 1, 'chroma_rows': 1, 'chroma_pitch': 12, 'chroma_base': 45, 'pair_offset': 0, 'component_offset': 0, 'sample_address': 45, 'luma_address': 33, 'allocation_end': 57}), ({'w': 8, 'h': 6, 'x': 1, 'y': 2, 'b': 4, 'base': 33, 'component': 1}, {'luma_pitch': 20, 'chroma_pairs': 4, 'chroma_rows': 3, 'chroma_pitch': 24, 'chroma_base': 159, 'pair_offset': 24, 'component_offset': 2, 'sample_address': 185, 'luma_address': 75, 'allocation_end': 231}), ({'w': 12, 'h': 10, 'x': 8, 'y': 6, 'b': 4, 'base': 33, 'component': 0}, {'luma_pitch': 28, 'chroma_pairs': 6, 'chroma_rows': 5, 'chroma_pitch': 32, 'chroma_base': 319, 'pair_offset': 112, 'component_offset': 0, 'sample_address': 431, 'luma_address': 217, 'allocation_end': 479}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 4, 'base': 33, 'component': 1}, {'luma_pitch': 36, 'chroma_pairs': 8, 'chroma_rows': 4, 'chroma_pitch': 40, 'chroma_base': 327, 'pair_offset': 148, 'component_offset': 2, 'sample_address': 477, 'luma_address': 315, 'allocation_end': 487}), ({'w': 20, 'h': 12, 'x': 16, 'y': 8, 'b': 4, 'base': 33, 'component': 0}, {'luma_pitch': 44, 'chroma_pairs': 10, 'chroma_rows': 6, 'chroma_pitch': 48, 'chroma_base': 567, 'pair_offset': 224, 'component_offset': 0, 'sample_address': 791, 'luma_address': 417, 'allocation_end': 855}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 4, 'base': 33, 'component': 1}, {'luma_pitch': 18, 'chroma_pairs': 4, 'chroma_rows': 7, 'chroma_pitch': 24, 'chroma_base': 273, 'pair_offset': 148, 'component_offset': 2, 'sample_address': 423, 'luma_address': 255, 'allocation_end': 441})], 4: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 5, 'base': 44, 'component': 0}, {'luma_pitch': 6, 'chroma_pairs': 1, 'chroma_rows': 1, 'chroma_pitch': 12, 'chroma_base': 56, 'pair_offset': 0, 'component_offset': 0, 'sample_address': 56, 'luma_address': 44, 'allocation_end': 68}), ({'w': 9, 'h': 7, 'x': 1, 'y': 2, 'b': 5, 'base': 44, 'component': 1}, {'luma_pitch': 22, 'chroma_pairs': 5, 'chroma_rows': 4, 'chroma_pitch': 28, 'chroma_base': 204, 'pair_offset': 28, 'component_offset': 2, 'sample_address': 234, 'luma_address': 90, 'allocation_end': 316}), ({'w': 13, 'h': 11, 'x': 8, 'y': 6, 'b': 5, 'base': 44, 'component': 0}, {'luma_pitch': 30, 'chroma_pairs': 7, 'chroma_rows': 6, 'chroma_pitch': 36, 'chroma_base': 380, 'pair_offset': 124, 'component_offset': 0, 'sample_address': 504, 'luma_address': 240, 'allocation_end': 596}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 5, 'base': 44, 'component': 1}, {'luma_pitch': 36, 'chroma_pairs': 8, 'chroma_rows': 4, 'chroma_pitch': 40, 'chroma_base': 338, 'pair_offset': 148, 'component_offset': 2, 'sample_address': 488, 'luma_address': 326, 'allocation_end': 498}), ({'w': 21, 'h': 13, 'x': 16, 'y': 8, 'b': 5, 'base': 44, 'component': 0}, {'luma_pitch': 46, 'chroma_pairs': 11, 'chroma_rows': 7, 'chroma_pitch': 52, 'chroma_base': 648, 'pair_offset': 240, 'component_offset': 0, 'sample_address': 888, 'luma_address': 444, 'allocation_end': 1012}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 5, 'base': 44, 'component': 1}, {'luma_pitch': 18, 'chroma_pairs': 4, 'chroma_rows': 7, 'chroma_pitch': 24, 'chroma_base': 284, 'pair_offset': 148, 'component_offset': 2, 'sample_address': 434, 'luma_address': 266, 'allocation_end': 452})], 5: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 6, 'base': 55, 'component': 0}, {'luma_pitch': 6, 'chroma_pairs': 1, 'chroma_rows': 1, 'chroma_pitch': 12, 'chroma_base': 67, 'pair_offset': 0, 'component_offset': 0, 'sample_address': 67, 'luma_address': 55, 'allocation_end': 79}), ({'w': 10, 'h': 8, 'x': 1, 'y': 2, 'b': 6, 'base': 55, 'component': 1}, {'luma_pitch': 24, 'chroma_pairs': 5, 'chroma_rows': 4, 'chroma_pitch': 28, 'chroma_base': 253, 'pair_offset': 28, 'component_offset': 2, 'sample_address': 283, 'luma_address': 105, 'allocation_end': 365}), ({'w': 14, 'h': 12, 'x': 8, 'y': 6, 'b': 6, 'base': 55, 'component': 0}, {'luma_pitch': 32, 'chroma_pairs': 7, 'chroma_rows': 6, 'chroma_pitch': 36, 'chroma_base': 445, 'pair_offset': 124, 'component_offset': 0, 'sample_address': 569, 'luma_address': 263, 'allocation_end': 661}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 6, 'base': 55, 'component': 1}, {'luma_pitch': 36, 'chroma_pairs': 8, 'chroma_rows': 4, 'chroma_pitch': 40, 'chroma_base': 349, 'pair_offset': 148, 'component_offset': 2, 'sample_address': 499, 'luma_address': 337, 'allocation_end': 509}), ({'w': 22, 'h': 14, 'x': 16, 'y': 8, 'b': 6, 'base': 55, 'component': 0}, {'luma_pitch': 48, 'chroma_pairs': 11, 'chroma_rows': 7, 'chroma_pitch': 52, 'chroma_base': 733, 'pair_offset': 240, 'component_offset': 0, 'sample_address': 973, 'luma_address': 471, 'allocation_end': 1097}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 6, 'base': 55, 'component': 1}, {'luma_pitch': 18, 'chroma_pairs': 4, 'chroma_rows': 7, 'chroma_pitch': 24, 'chroma_base': 295, 'pair_offset': 148, 'component_offset': 2, 'sample_address': 445, 'luma_address': 277, 'allocation_end': 463})]}
for i, (p, expected) in enumerate(cases[N]):
    check("layout fixture " + str(i + 1), solve(p), expected)
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)

prompt:
The returned physical layout descriptor disagrees with the declared buffer mapping at luma_pitch.

A stipulated semiplanar image stores two-byte luma samples and UV pairs of two-byte components. Luma rows have a four-byte guard; chroma rows have an eight-byte guard, and a six-byte separator precedes chroma. Return the named intermediate layout descriptor and final address fields; all quantities are integer byte offsets unless explicitly stated.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(p):
    p = dict(p)
    luma_pitch = p["w"]*2+4
    chroma_pairs = p["w"]//2
    chroma_rows = (p["h"]+1)//2
    chroma_pitch = chroma_pairs*4+8
    chroma_base = p["base"]+luma_pitch*p["h"]+6
    pair_offset = (p["y"]//2)*chroma_pitch+(p["x"]//2)*4
    component_offset = p["component"]*2
    sample_address = chroma_base+pair_offset+component_offset
    luma_address = p["base"]+p["y"]*luma_pitch+p["x"]*2
    allocation_end = chroma_base+chroma_rows*chroma_pitch
    return {'luma_pitch': luma_pitch, 'chroma_pairs': chroma_pairs, 'chroma_rows': chroma_rows, 'chroma_pitch': chroma_pitch, 'chroma_base': chroma_base, 'pair_offset': pair_offset, 'component_offset': component_offset, 'sample_address': sample_address, 'luma_address': luma_address, 'allocation_end': allocation_end}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 2, 'base': 11, 'component': 0}, {'luma_pitch': 6, 'chroma_pairs': 1, 'chroma_rows': 1, 'chroma_pitch': 12, 'chroma_base': 23, 'pair_offset': 0, 'component_offset': 0, 'sample_address': 23, 'luma_address': 11, 'allocation_end': 35}), ({'w': 6, 'h': 4, 'x': 1, 'y': 2, 'b': 2, 'base': 11, 'component': 1}, {'luma_pitch': 16, 'chroma_pairs': 3, 'chroma_rows': 2, 'chroma_pitch': 20, 'chroma_base': 81, 'pair_offset': 20, 'component_offset': 2, 'sample_address': 103, 'luma_address': 45, 'allocation_end': 121}), ({'w': 10, 'h': 8, 'x': 8, 'y': 6, 'b': 2, 'base': 11, 'component': 0}, {'luma_pitch': 24, 'chroma_pairs': 5, 'chroma_rows': 4, 'chroma_pitch': 28, 'chroma_base': 209, 'pair_offset': 100, 'component_offset': 0, 'sample_address': 309, 'luma_address': 171, 'allocation_end': 321}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 2, 'base': 11, 'component': 1}, {'luma_pitch': 36, 'chroma_pairs': 8, 'chroma_rows': 4, 'chroma_pitch': 40, 'chroma_base': 305, 'pair_offset': 148, 'component_offset': 2, 'sample_address': 455, 'luma_address': 293, 'allocation_end': 465}), ({'w': 18, 'h': 10, 'x': 16, 'y': 8, 'b': 2, 'base': 11, 'component': 0}, {'luma_pitch': 40, 'chroma_pairs': 9, 'chroma_rows': 5, 'chroma_pitch': 44, 'chroma_base': 417, 'pair_offset': 208, 'component_offset': 0, 'sample_address': 625, 'luma_address': 363, 'allocation_end': 637}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 2, 'base': 11, 'component': 1}, {'luma_pitch': 18, 'chroma_pairs': 4, 'chroma_rows': 7, 'chroma_pitch': 24, 'chroma_base': 251, 'pair_offset': 148, 'component_offset': 2, 'sample_address': 401, 'luma_address': 233, 'allocation_end': 419})], 2: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 3, 'base': 22, 'component': 0}, {'luma_pitch': 6, 'chroma_pairs': 1, 'chroma_rows': 1, 'chroma_pitch': 12, 'chroma_base': 34, 'pair_offset': 0, 'component_offset': 0, 'sample_address': 34, 'luma_address': 22, 'allocation_end': 46}), ({'w': 7, 'h': 5, 'x': 1, 'y': 2, 'b': 3, 'base': 22, 'component': 1}, {'luma_pitch': 18, 'chroma_pairs': 4, 'chroma_rows': 3, 'chroma_pitch': 24, 'chroma_base': 118, 'pair_offset': 24, 'component_offset': 2, 'sample_address': 144, 'luma_address': 60, 'allocation_end': 190}), ({'w': 11, 'h': 9, 'x': 8, 'y': 6, 'b': 3, 'base': 22, 'component': 0}, {'luma_pitch': 26, 'chroma_pairs': 6, 'chroma_rows': 5, 'chroma_pitch': 32, 'chroma_base': 262, 'pair_offset': 112, 'component_offset': 0, 'sample_address': 374, 'luma_address': 194, 'allocation_end': 422}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 3, 'base': 22, 'component': 1}, {'luma_pitch': 36, 'chroma_pairs': 8, 'chroma_rows': 4, 'chroma_pitch': 40, 'chroma_base': 316, 'pair_offset': 148, 'component_offset': 2, 'sample_address': 466, 'luma_address': 304, 'allocation_end': 476}), ({'w': 19, 'h': 11, 'x': 16, 'y': 8, 'b': 3, 'base': 22, 'component': 0}, {'luma_pitch': 42, 'chroma_pairs': 10, 'chroma_rows': 6, 'chroma_pitch': 48, 'chroma_base': 490, 'pair_offset': 224, 'component_offset': 0, 'sample_address': 714, 'luma_address': 390, 'allocation_end': 778}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 3, 'base': 22, 'component': 1}, {'luma_pitch': 18, 'chroma_pairs': 4, 'chroma_rows': 7, 'chroma_pitch': 24, 'chroma_base': 262, 'pair_offset': 148, 'component_offset': 2, 'sample_address': 412, 'luma_address': 244, 'allocation_end': 430})], 3: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 4, 'base': 33, 'component': 0}, {'luma_pitch': 6, 'chroma_pairs': 1, 'chroma_rows': 1, 'chroma_pitch': 12, 'chroma_base': 45, 'pair_offset': 0, 'component_offset': 0, 'sample_address': 45, 'luma_address': 33, 'allocation_end': 57}), ({'w': 8, 'h': 6, 'x': 1, 'y': 2, 'b': 4, 'base': 33, 'component': 1}, {'luma_pitch': 20, 'chroma_pairs': 4, 'chroma_rows': 3, 'chroma_pitch': 24, 'chroma_base': 159, 'pair_offset': 24, 'component_offset': 2, 'sample_address': 185, 'luma_address': 75, 'allocation_end': 231}), ({'w': 12, 'h': 10, 'x': 8, 'y': 6, 'b': 4, 'base': 33, 'component': 0}, {'luma_pitch': 28, 'chroma_pairs': 6, 'chroma_rows': 5, 'chroma_pitch': 32, 'chroma_base': 319, 'pair_offset': 112, 'component_offset': 0, 'sample_address': 431, 'luma_address': 217, 'allocation_end': 479}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 4, 'base': 33, 'component': 1}, {'luma_pitch': 36, 'chroma_pairs': 8, 'chroma_rows': 4, 'chroma_pitch': 40, 'chroma_base': 327, 'pair_offset': 148, 'component_offset': 2, 'sample_address': 477, 'luma_address': 315, 'allocation_end': 487}), ({'w': 20, 'h': 12, 'x': 16, 'y': 8, 'b': 4, 'base': 33, 'component': 0}, {'luma_pitch': 44, 'chroma_pairs': 10, 'chroma_rows': 6, 'chroma_pitch': 48, 'chroma_base': 567, 'pair_offset': 224, 'component_offset': 0, 'sample_address': 791, 'luma_address': 417, 'allocation_end': 855}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 4, 'base': 33, 'component': 1}, {'luma_pitch': 18, 'chroma_pairs': 4, 'chroma_rows': 7, 'chroma_pitch': 24, 'chroma_base': 273, 'pair_offset': 148, 'component_offset': 2, 'sample_address': 423, 'luma_address': 255, 'allocation_end': 441})], 4: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 5, 'base': 44, 'component': 0}, {'luma_pitch': 6, 'chroma_pairs': 1, 'chroma_rows': 1, 'chroma_pitch': 12, 'chroma_base': 56, 'pair_offset': 0, 'component_offset': 0, 'sample_address': 56, 'luma_address': 44, 'allocation_end': 68}), ({'w': 9, 'h': 7, 'x': 1, 'y': 2, 'b': 5, 'base': 44, 'component': 1}, {'luma_pitch': 22, 'chroma_pairs': 5, 'chroma_rows': 4, 'chroma_pitch': 28, 'chroma_base': 204, 'pair_offset': 28, 'component_offset': 2, 'sample_address': 234, 'luma_address': 90, 'allocation_end': 316}), ({'w': 13, 'h': 11, 'x': 8, 'y': 6, 'b': 5, 'base': 44, 'component': 0}, {'luma_pitch': 30, 'chroma_pairs': 7, 'chroma_rows': 6, 'chroma_pitch': 36, 'chroma_base': 380, 'pair_offset': 124, 'component_offset': 0, 'sample_address': 504, 'luma_address': 240, 'allocation_end': 596}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 5, 'base': 44, 'component': 1}, {'luma_pitch': 36, 'chroma_pairs': 8, 'chroma_rows': 4, 'chroma_pitch': 40, 'chroma_base': 338, 'pair_offset': 148, 'component_offset': 2, 'sample_address': 488, 'luma_address': 326, 'allocation_end': 498}), ({'w': 21, 'h': 13, 'x': 16, 'y': 8, 'b': 5, 'base': 44, 'component': 0}, {'luma_pitch': 46, 'chroma_pairs': 11, 'chroma_rows': 7, 'chroma_pitch': 52, 'chroma_base': 648, 'pair_offset': 240, 'component_offset': 0, 'sample_address': 888, 'luma_address': 444, 'allocation_end': 1012}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 5, 'base': 44, 'component': 1}, {'luma_pitch': 18, 'chroma_pairs': 4, 'chroma_rows': 7, 'chroma_pitch': 24, 'chroma_base': 284, 'pair_offset': 148, 'component_offset': 2, 'sample_address': 434, 'luma_address': 266, 'allocation_end': 452})], 5: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 6, 'base': 55, 'component': 0}, {'luma_pitch': 6, 'chroma_pairs': 1, 'chroma_rows': 1, 'chroma_pitch': 12, 'chroma_base': 67, 'pair_offset': 0, 'component_offset': 0, 'sample_address': 67, 'luma_address': 55, 'allocation_end': 79}), ({'w': 10, 'h': 8, 'x': 1, 'y': 2, 'b': 6, 'base': 55, 'component': 1}, {'luma_pitch': 24, 'chroma_pairs': 5, 'chroma_rows': 4, 'chroma_pitch': 28, 'chroma_base': 253, 'pair_offset': 28, 'component_offset': 2, 'sample_address': 283, 'luma_address': 105, 'allocation_end': 365}), ({'w': 14, 'h': 12, 'x': 8, 'y': 6, 'b': 6, 'base': 55, 'component': 0}, {'luma_pitch': 32, 'chroma_pairs': 7, 'chroma_rows': 6, 'chroma_pitch': 36, 'chroma_base': 445, 'pair_offset': 124, 'component_offset': 0, 'sample_address': 569, 'luma_address': 263, 'allocation_end': 661}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 6, 'base': 55, 'component': 1}, {'luma_pitch': 36, 'chroma_pairs': 8, 'chroma_rows': 4, 'chroma_pitch': 40, 'chroma_base': 349, 'pair_offset': 148, 'component_offset': 2, 'sample_address': 499, 'luma_address': 337, 'allocation_end': 509}), ({'w': 22, 'h': 14, 'x': 16, 'y': 8, 'b': 6, 'base': 55, 'component': 0}, {'luma_pitch': 48, 'chroma_pairs': 11, 'chroma_rows': 7, 'chroma_pitch': 52, 'chroma_base': 733, 'pair_offset': 240, 'component_offset': 0, 'sample_address': 973, 'luma_address': 471, 'allocation_end': 1097}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 6, 'base': 55, 'component': 1}, {'luma_pitch': 18, 'chroma_pairs': 4, 'chroma_rows': 7, 'chroma_pitch': 24, 'chroma_base': 295, 'pair_offset': 148, 'component_offset': 2, 'sample_address': 445, 'luma_address': 277, 'allocation_end': 463})]}
for i, (p, expected) in enumerate(cases[N]):
    check("layout fixture " + str(i + 1), solve(p), expected)
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(p):
    p = dict(p)
    luma_pitch = p["w"]*2+4
    chroma_pairs = p["w"]
    chroma_rows = (p["h"]+1)//2
    chroma_pitch = chroma_pairs*4+8
    chroma_base = p["base"]+luma_pitch*p["h"]+6
    pair_offset = (p["y"]//2)*chroma_pitch+(p["x"]//2)*4
    component_offset = p["component"]*2
    sample_address = chroma_base+pair_offset+component_offset
    luma_address = p["base"]+p["y"]*luma_pitch+p["x"]*2
    allocation_end = chroma_base+chroma_rows*chroma_pitch
    return {'luma_pitch': luma_pitch, 'chroma_pairs': chroma_pairs, 'chroma_rows': chroma_rows, 'chroma_pitch': chroma_pitch, 'chroma_base': chroma_base, 'pair_offset': pair_offset, 'component_offset': component_offset, 'sample_address': sample_address, 'luma_address': luma_address, 'allocation_end': allocation_end}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 2, 'base': 11, 'component': 0}, {'luma_pitch': 6, 'chroma_pairs': 1, 'chroma_rows': 1, 'chroma_pitch': 12, 'chroma_base': 23, 'pair_offset': 0, 'component_offset': 0, 'sample_address': 23, 'luma_address': 11, 'allocation_end': 35}), ({'w': 6, 'h': 4, 'x': 1, 'y': 2, 'b': 2, 'base': 11, 'component': 1}, {'luma_pitch': 16, 'chroma_pairs': 3, 'chroma_rows': 2, 'chroma_pitch': 20, 'chroma_base': 81, 'pair_offset': 20, 'component_offset': 2, 'sample_address': 103, 'luma_address': 45, 'allocation_end': 121}), ({'w': 10, 'h': 8, 'x': 8, 'y': 6, 'b': 2, 'base': 11, 'component': 0}, {'luma_pitch': 24, 'chroma_pairs': 5, 'chroma_rows': 4, 'chroma_pitch': 28, 'chroma_base': 209, 'pair_offset': 100, 'component_offset': 0, 'sample_address': 309, 'luma_address': 171, 'allocation_end': 321}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 2, 'base': 11, 'component': 1}, {'luma_pitch': 36, 'chroma_pairs': 8, 'chroma_rows': 4, 'chroma_pitch': 40, 'chroma_base': 305, 'pair_offset': 148, 'component_offset': 2, 'sample_address': 455, 'luma_address': 293, 'allocation_end': 465}), ({'w': 18, 'h': 10, 'x': 16, 'y': 8, 'b': 2, 'base': 11, 'component': 0}, {'luma_pitch': 40, 'chroma_pairs': 9, 'chroma_rows': 5, 'chroma_pitch': 44, 'chroma_base': 417, 'pair_offset': 208, 'component_offset': 0, 'sample_address': 625, 'luma_address': 363, 'allocation_end': 637}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 2, 'base': 11, 'component': 1}, {'luma_pitch': 18, 'chroma_pairs': 4, 'chroma_rows': 7, 'chroma_pitch': 24, 'chroma_base': 251, 'pair_offset': 148, 'component_offset': 2, 'sample_address': 401, 'luma_address': 233, 'allocation_end': 419})], 2: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 3, 'base': 22, 'component': 0}, {'luma_pitch': 6, 'chroma_pairs': 1, 'chroma_rows': 1, 'chroma_pitch': 12, 'chroma_base': 34, 'pair_offset': 0, 'component_offset': 0, 'sample_address': 34, 'luma_address': 22, 'allocation_end': 46}), ({'w': 7, 'h': 5, 'x': 1, 'y': 2, 'b': 3, 'base': 22, 'component': 1}, {'luma_pitch': 18, 'chroma_pairs': 4, 'chroma_rows': 3, 'chroma_pitch': 24, 'chroma_base': 118, 'pair_offset': 24, 'component_offset': 2, 'sample_address': 144, 'luma_address': 60, 'allocation_end': 190}), ({'w': 11, 'h': 9, 'x': 8, 'y': 6, 'b': 3, 'base': 22, 'component': 0}, {'luma_pitch': 26, 'chroma_pairs': 6, 'chroma_rows': 5, 'chroma_pitch': 32, 'chroma_base': 262, 'pair_offset': 112, 'component_offset': 0, 'sample_address': 374, 'luma_address': 194, 'allocation_end': 422}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 3, 'base': 22, 'component': 1}, {'luma_pitch': 36, 'chroma_pairs': 8, 'chroma_rows': 4, 'chroma_pitch': 40, 'chroma_base': 316, 'pair_offset': 148, 'component_offset': 2, 'sample_address': 466, 'luma_address': 304, 'allocation_end': 476}), ({'w': 19, 'h': 11, 'x': 16, 'y': 8, 'b': 3, 'base': 22, 'component': 0}, {'luma_pitch': 42, 'chroma_pairs': 10, 'chroma_rows': 6, 'chroma_pitch': 48, 'chroma_base': 490, 'pair_offset': 224, 'component_offset': 0, 'sample_address': 714, 'luma_address': 390, 'allocation_end': 778}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 3, 'base': 22, 'component': 1}, {'luma_pitch': 18, 'chroma_pairs': 4, 'chroma_rows': 7, 'chroma_pitch': 24, 'chroma_base': 262, 'pair_offset': 148, 'component_offset': 2, 'sample_address': 412, 'luma_address': 244, 'allocation_end': 430})], 3: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 4, 'base': 33, 'component': 0}, {'luma_pitch': 6, 'chroma_pairs': 1, 'chroma_rows': 1, 'chroma_pitch': 12, 'chroma_base': 45, 'pair_offset': 0, 'component_offset': 0, 'sample_address': 45, 'luma_address': 33, 'allocation_end': 57}), ({'w': 8, 'h': 6, 'x': 1, 'y': 2, 'b': 4, 'base': 33, 'component': 1}, {'luma_pitch': 20, 'chroma_pairs': 4, 'chroma_rows': 3, 'chroma_pitch': 24, 'chroma_base': 159, 'pair_offset': 24, 'component_offset': 2, 'sample_address': 185, 'luma_address': 75, 'allocation_end': 231}), ({'w': 12, 'h': 10, 'x': 8, 'y': 6, 'b': 4, 'base': 33, 'component': 0}, {'luma_pitch': 28, 'chroma_pairs': 6, 'chroma_rows': 5, 'chroma_pitch': 32, 'chroma_base': 319, 'pair_offset': 112, 'component_offset': 0, 'sample_address': 431, 'luma_address': 217, 'allocation_end': 479}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 4, 'base': 33, 'component': 1}, {'luma_pitch': 36, 'chroma_pairs': 8, 'chroma_rows': 4, 'chroma_pitch': 40, 'chroma_base': 327, 'pair_offset': 148, 'component_offset': 2, 'sample_address': 477, 'luma_address': 315, 'allocation_end': 487}), ({'w': 20, 'h': 12, 'x': 16, 'y': 8, 'b': 4, 'base': 33, 'component': 0}, {'luma_pitch': 44, 'chroma_pairs': 10, 'chroma_rows': 6, 'chroma_pitch': 48, 'chroma_base': 567, 'pair_offset': 224, 'component_offset': 0, 'sample_address': 791, 'luma_address': 417, 'allocation_end': 855}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 4, 'base': 33, 'component': 1}, {'luma_pitch': 18, 'chroma_pairs': 4, 'chroma_rows': 7, 'chroma_pitch': 24, 'chroma_base': 273, 'pair_offset': 148, 'component_offset': 2, 'sample_address': 423, 'luma_address': 255, 'allocation_end': 441})], 4: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 5, 'base': 44, 'component': 0}, {'luma_pitch': 6, 'chroma_pairs': 1, 'chroma_rows': 1, 'chroma_pitch': 12, 'chroma_base': 56, 'pair_offset': 0, 'component_offset': 0, 'sample_address': 56, 'luma_address': 44, 'allocation_end': 68}), ({'w': 9, 'h': 7, 'x': 1, 'y': 2, 'b': 5, 'base': 44, 'component': 1}, {'luma_pitch': 22, 'chroma_pairs': 5, 'chroma_rows': 4, 'chroma_pitch': 28, 'chroma_base': 204, 'pair_offset': 28, 'component_offset': 2, 'sample_address': 234, 'luma_address': 90, 'allocation_end': 316}), ({'w': 13, 'h': 11, 'x': 8, 'y': 6, 'b': 5, 'base': 44, 'component': 0}, {'luma_pitch': 30, 'chroma_pairs': 7, 'chroma_rows': 6, 'chroma_pitch': 36, 'chroma_base': 380, 'pair_offset': 124, 'component_offset': 0, 'sample_address': 504, 'luma_address': 240, 'allocation_end': 596}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 5, 'base': 44, 'component': 1}, {'luma_pitch': 36, 'chroma_pairs': 8, 'chroma_rows': 4, 'chroma_pitch': 40, 'chroma_base': 338, 'pair_offset': 148, 'component_offset': 2, 'sample_address': 488, 'luma_address': 326, 'allocation_end': 498}), ({'w': 21, 'h': 13, 'x': 16, 'y': 8, 'b': 5, 'base': 44, 'component': 0}, {'luma_pitch': 46, 'chroma_pairs': 11, 'chroma_rows': 7, 'chroma_pitch': 52, 'chroma_base': 648, 'pair_offset': 240, 'component_offset': 0, 'sample_address': 888, 'luma_address': 444, 'allocation_end': 1012}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 5, 'base': 44, 'component': 1}, {'luma_pitch': 18, 'chroma_pairs': 4, 'chroma_rows': 7, 'chroma_pitch': 24, 'chroma_base': 284, 'pair_offset': 148, 'component_offset': 2, 'sample_address': 434, 'luma_address': 266, 'allocation_end': 452})], 5: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 6, 'base': 55, 'component': 0}, {'luma_pitch': 6, 'chroma_pairs': 1, 'chroma_rows': 1, 'chroma_pitch': 12, 'chroma_base': 67, 'pair_offset': 0, 'component_offset': 0, 'sample_address': 67, 'luma_address': 55, 'allocation_end': 79}), ({'w': 10, 'h': 8, 'x': 1, 'y': 2, 'b': 6, 'base': 55, 'component': 1}, {'luma_pitch': 24, 'chroma_pairs': 5, 'chroma_rows': 4, 'chroma_pitch': 28, 'chroma_base': 253, 'pair_offset': 28, 'component_offset': 2, 'sample_address': 283, 'luma_address': 105, 'allocation_end': 365}), ({'w': 14, 'h': 12, 'x': 8, 'y': 6, 'b': 6, 'base': 55, 'component': 0}, {'luma_pitch': 32, 'chroma_pairs': 7, 'chroma_rows': 6, 'chroma_pitch': 36, 'chroma_base': 445, 'pair_offset': 124, 'component_offset': 0, 'sample_address': 569, 'luma_address': 263, 'allocation_end': 661}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 6, 'base': 55, 'component': 1}, {'luma_pitch': 36, 'chroma_pairs': 8, 'chroma_rows': 4, 'chroma_pitch': 40, 'chroma_base': 349, 'pair_offset': 148, 'component_offset': 2, 'sample_address': 499, 'luma_address': 337, 'allocation_end': 509}), ({'w': 22, 'h': 14, 'x': 16, 'y': 8, 'b': 6, 'base': 55, 'component': 0}, {'luma_pitch': 48, 'chroma_pairs': 11, 'chroma_rows': 7, 'chroma_pitch': 52, 'chroma_base': 733, 'pair_offset': 240, 'component_offset': 0, 'sample_address': 973, 'luma_address': 471, 'allocation_end': 1097}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 6, 'base': 55, 'component': 1}, {'luma_pitch': 18, 'chroma_pairs': 4, 'chroma_rows': 7, 'chroma_pitch': 24, 'chroma_base': 295, 'pair_offset': 148, 'component_offset': 2, 'sample_address': 445, 'luma_address': 277, 'allocation_end': 463})]}
for i, (p, expected) in enumerate(cases[N]):
    check("layout fixture " + str(i + 1), solve(p), expected)
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)

prompt:
The returned physical layout descriptor disagrees with the declared buffer mapping at chroma_pairs.

A stipulated semiplanar image stores two-byte luma samples and UV pairs of two-byte components. Luma rows have a four-byte guard; chroma rows have an eight-byte guard, and a six-byte separator precedes chroma. Return the named intermediate layout descriptor and final address fields; all quantities are integer byte offsets unless explicitly stated.

split: open-access