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

N = 1
observations = []
def solve(p):
    p = dict(p)
    cell_size = p["size"]+2
    atlas_width = 4*cell_size
    atlas_height = 3*cell_size
    face_cell = [(2,1),(0,1),(1,0),(1,2),(1,1),(3,1)][p["face"]]
    cell_origin = [face_cell[0]*cell_size,face_cell[1]*cell_size]
    pixel_position = [cell_origin[0]+1+p["u"],cell_origin[1]+1+p["v"]]
    row_pitch = atlas_width*p["b"]+3
    address = p["base"]+pixel_position[0]*row_pitch+pixel_position[1]*p["b"]
    face_row_end = p["base"]+(cell_origin[1]+1+p["v"])*row_pitch+(cell_origin[0]+1+p["size"])*p["b"]
    allocation_end = p["base"]+atlas_height*row_pitch
    return {'cell_size': cell_size, 'atlas_width': atlas_width, 'atlas_height': atlas_height, 'face_cell': face_cell, 'cell_origin': cell_origin, 'pixel_position': pixel_position, 'row_pitch': row_pitch, 'address': address, 'face_row_end': face_row_end, 'allocation_end': allocation_end}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'size': 2, 'face': 0, 'u': 0, 'v': 1, 'b': 2, 'base': 7}, {'cell_size': 4, 'atlas_width': 16, 'atlas_height': 12, 'face_cell': (2, 1), 'cell_origin': [8, 4], 'pixel_position': [9, 6], 'row_pitch': 35, 'address': 235, 'face_row_end': 239, 'allocation_end': 427}), ({'size': 3, 'face': 1, 'u': 1, 'v': 2, 'b': 2, 'base': 7}, {'cell_size': 5, 'atlas_width': 20, 'atlas_height': 15, 'face_cell': (0, 1), 'cell_origin': [0, 5], 'pixel_position': [2, 8], 'row_pitch': 43, 'address': 355, 'face_row_end': 359, 'allocation_end': 652}), ({'size': 4, 'face': 2, 'u': 2, 'v': 3, 'b': 2, 'base': 7}, {'cell_size': 6, 'atlas_width': 24, 'atlas_height': 18, 'face_cell': (1, 0), 'cell_origin': [6, 0], 'pixel_position': [9, 4], 'row_pitch': 51, 'address': 229, 'face_row_end': 233, 'allocation_end': 925}), ({'size': 5, 'face': 3, 'u': 3, 'v': 4, 'b': 2, 'base': 7}, {'cell_size': 7, 'atlas_width': 28, 'atlas_height': 21, 'face_cell': (1, 2), 'cell_origin': [7, 14], 'pixel_position': [11, 19], 'row_pitch': 59, 'address': 1150, 'face_row_end': 1154, 'allocation_end': 1246}), ({'size': 6, 'face': 4, 'u': 4, 'v': 5, 'b': 2, 'base': 7}, {'cell_size': 8, 'atlas_width': 32, 'atlas_height': 24, 'face_cell': (1, 1), 'cell_origin': [8, 8], 'pixel_position': [13, 14], 'row_pitch': 67, 'address': 971, 'face_row_end': 975, 'allocation_end': 1615}), ({'size': 7, 'face': 5, 'u': 5, 'v': 6, 'b': 2, 'base': 7}, {'cell_size': 9, 'atlas_width': 36, 'atlas_height': 27, 'face_cell': (3, 1), 'cell_origin': [27, 9], 'pixel_position': [33, 16], 'row_pitch': 75, 'address': 1273, 'face_row_end': 1277, 'allocation_end': 2032})], 2: [({'size': 3, 'face': 0, 'u': 0, 'v': 1, 'b': 3, 'base': 14}, {'cell_size': 5, 'atlas_width': 20, 'atlas_height': 15, 'face_cell': (2, 1), 'cell_origin': [10, 5], 'pixel_position': [11, 7], 'row_pitch': 63, 'address': 488, 'face_row_end': 497, 'allocation_end': 959}), ({'size': 4, 'face': 1, 'u': 1, 'v': 2, 'b': 3, 'base': 14}, {'cell_size': 6, 'atlas_width': 24, 'atlas_height': 18, 'face_cell': (0, 1), 'cell_origin': [0, 6], 'pixel_position': [2, 9], 'row_pitch': 75, 'address': 695, 'face_row_end': 704, 'allocation_end': 1364}), ({'size': 5, 'face': 2, 'u': 2, 'v': 3, 'b': 3, 'base': 14}, {'cell_size': 7, 'atlas_width': 28, 'atlas_height': 21, 'face_cell': (1, 0), 'cell_origin': [7, 0], 'pixel_position': [10, 4], 'row_pitch': 87, 'address': 392, 'face_row_end': 401, 'allocation_end': 1841}), ({'size': 6, 'face': 3, 'u': 3, 'v': 4, 'b': 3, 'base': 14}, {'cell_size': 8, 'atlas_width': 32, 'atlas_height': 24, 'face_cell': (1, 2), 'cell_origin': [8, 16], 'pixel_position': [12, 21], 'row_pitch': 99, 'address': 2129, 'face_row_end': 2138, 'allocation_end': 2390}), ({'size': 7, 'face': 4, 'u': 4, 'v': 5, 'b': 3, 'base': 14}, {'cell_size': 9, 'atlas_width': 36, 'atlas_height': 27, 'face_cell': (1, 1), 'cell_origin': [9, 9], 'pixel_position': [14, 15], 'row_pitch': 111, 'address': 1721, 'face_row_end': 1730, 'allocation_end': 3011}), ({'size': 8, 'face': 5, 'u': 5, 'v': 6, 'b': 3, 'base': 14}, {'cell_size': 10, 'atlas_width': 40, 'atlas_height': 30, 'face_cell': (3, 1), 'cell_origin': [30, 10], 'pixel_position': [36, 17], 'row_pitch': 123, 'address': 2213, 'face_row_end': 2222, 'allocation_end': 3704})], 3: [({'size': 4, 'face': 0, 'u': 0, 'v': 1, 'b': 4, 'base': 21}, {'cell_size': 6, 'atlas_width': 24, 'atlas_height': 18, 'face_cell': (2, 1), 'cell_origin': [12, 6], 'pixel_position': [13, 8], 'row_pitch': 99, 'address': 865, 'face_row_end': 881, 'allocation_end': 1803}), ({'size': 5, 'face': 1, 'u': 1, 'v': 2, 'b': 4, 'base': 21}, {'cell_size': 7, 'atlas_width': 28, 'atlas_height': 21, 'face_cell': (0, 1), 'cell_origin': [0, 7], 'pixel_position': [2, 10], 'row_pitch': 115, 'address': 1179, 'face_row_end': 1195, 'allocation_end': 2436}), ({'size': 6, 'face': 2, 'u': 2, 'v': 3, 'b': 4, 'base': 21}, {'cell_size': 8, 'atlas_width': 32, 'atlas_height': 24, 'face_cell': (1, 0), 'cell_origin': [8, 0], 'pixel_position': [11, 4], 'row_pitch': 131, 'address': 589, 'face_row_end': 605, 'allocation_end': 3165}), ({'size': 7, 'face': 3, 'u': 3, 'v': 4, 'b': 4, 'base': 21}, {'cell_size': 9, 'atlas_width': 36, 'atlas_height': 27, 'face_cell': (1, 2), 'cell_origin': [9, 18], 'pixel_position': [13, 23], 'row_pitch': 147, 'address': 3454, 'face_row_end': 3470, 'allocation_end': 3990}), ({'size': 8, 'face': 4, 'u': 4, 'v': 5, 'b': 4, 'base': 21}, {'cell_size': 10, 'atlas_width': 40, 'atlas_height': 30, 'face_cell': (1, 1), 'cell_origin': [10, 10], 'pixel_position': [15, 16], 'row_pitch': 163, 'address': 2689, 'face_row_end': 2705, 'allocation_end': 4911}), ({'size': 9, 'face': 5, 'u': 5, 'v': 6, 'b': 4, 'base': 21}, {'cell_size': 11, 'atlas_width': 44, 'atlas_height': 33, 'face_cell': (3, 1), 'cell_origin': [33, 11], 'pixel_position': [39, 18], 'row_pitch': 179, 'address': 3399, 'face_row_end': 3415, 'allocation_end': 5928})], 4: [({'size': 5, 'face': 0, 'u': 0, 'v': 1, 'b': 5, 'base': 28}, {'cell_size': 7, 'atlas_width': 28, 'atlas_height': 21, 'face_cell': (2, 1), 'cell_origin': [14, 7], 'pixel_position': [15, 9], 'row_pitch': 143, 'address': 1390, 'face_row_end': 1415, 'allocation_end': 3031}), ({'size': 6, 'face': 1, 'u': 1, 'v': 2, 'b': 5, 'base': 28}, {'cell_size': 8, 'atlas_width': 32, 'atlas_height': 24, 'face_cell': (0, 1), 'cell_origin': [0, 8], 'pixel_position': [2, 11], 'row_pitch': 163, 'address': 1831, 'face_row_end': 1856, 'allocation_end': 3940}), ({'size': 7, 'face': 2, 'u': 2, 'v': 3, 'b': 5, 'base': 28}, {'cell_size': 9, 'atlas_width': 36, 'atlas_height': 27, 'face_cell': (1, 0), 'cell_origin': [9, 0], 'pixel_position': [12, 4], 'row_pitch': 183, 'address': 820, 'face_row_end': 845, 'allocation_end': 4969}), ({'size': 8, 'face': 3, 'u': 3, 'v': 4, 'b': 5, 'base': 28}, {'cell_size': 10, 'atlas_width': 40, 'atlas_height': 30, 'face_cell': (1, 2), 'cell_origin': [10, 20], 'pixel_position': [14, 25], 'row_pitch': 203, 'address': 5173, 'face_row_end': 5198, 'allocation_end': 6118}), ({'size': 9, 'face': 4, 'u': 4, 'v': 5, 'b': 5, 'base': 28}, {'cell_size': 11, 'atlas_width': 44, 'atlas_height': 33, 'face_cell': (1, 1), 'cell_origin': [11, 11], 'pixel_position': [16, 17], 'row_pitch': 223, 'address': 3899, 'face_row_end': 3924, 'allocation_end': 7387}), ({'size': 10, 'face': 5, 'u': 5, 'v': 6, 'b': 5, 'base': 28}, {'cell_size': 12, 'atlas_width': 48, 'atlas_height': 36, 'face_cell': (3, 1), 'cell_origin': [36, 12], 'pixel_position': [42, 19], 'row_pitch': 243, 'address': 4855, 'face_row_end': 4880, 'allocation_end': 8776})], 5: [({'size': 6, 'face': 0, 'u': 0, 'v': 1, 'b': 6, 'base': 35}, {'cell_size': 8, 'atlas_width': 32, 'atlas_height': 24, 'face_cell': (2, 1), 'cell_origin': [16, 8], 'pixel_position': [17, 10], 'row_pitch': 195, 'address': 2087, 'face_row_end': 2123, 'allocation_end': 4715}), ({'size': 7, 'face': 1, 'u': 1, 'v': 2, 'b': 6, 'base': 35}, {'cell_size': 9, 'atlas_width': 36, 'atlas_height': 27, 'face_cell': (0, 1), 'cell_origin': [0, 9], 'pixel_position': [2, 12], 'row_pitch': 219, 'address': 2675, 'face_row_end': 2711, 'allocation_end': 5948}), ({'size': 8, 'face': 2, 'u': 2, 'v': 3, 'b': 6, 'base': 35}, {'cell_size': 10, 'atlas_width': 40, 'atlas_height': 30, 'face_cell': (1, 0), 'cell_origin': [10, 0], 'pixel_position': [13, 4], 'row_pitch': 243, 'address': 1085, 'face_row_end': 1121, 'allocation_end': 7325}), ({'size': 9, 'face': 3, 'u': 3, 'v': 4, 'b': 6, 'base': 35}, {'cell_size': 11, 'atlas_width': 44, 'atlas_height': 33, 'face_cell': (1, 2), 'cell_origin': [11, 22], 'pixel_position': [15, 27], 'row_pitch': 267, 'address': 7334, 'face_row_end': 7370, 'allocation_end': 8846}), ({'size': 10, 'face': 4, 'u': 4, 'v': 5, 'b': 6, 'base': 35}, {'cell_size': 12, 'atlas_width': 48, 'atlas_height': 36, 'face_cell': (1, 1), 'cell_origin': [12, 12], 'pixel_position': [17, 18], 'row_pitch': 291, 'address': 5375, 'face_row_end': 5411, 'allocation_end': 10511}), ({'size': 11, 'face': 5, 'u': 5, 'v': 6, 'b': 6, 'base': 35}, {'cell_size': 13, 'atlas_width': 52, 'atlas_height': 39, 'face_cell': (3, 1), 'cell_origin': [39, 13], 'pixel_position': [45, 20], 'row_pitch': 315, 'address': 6605, 'face_row_end': 6641, 'allocation_end': 12320})]}
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)
    cell_size = p["size"]+2
    atlas_width = 4*cell_size
    atlas_height = 3*cell_size
    face_cell = [(2,1),(0,1),(1,0),(1,2),(1,1),(3,1)][p["face"]]
    cell_origin = [face_cell[0]*cell_size,face_cell[1]*cell_size]
    pixel_position = [cell_origin[0]+1+p["u"],cell_origin[1]+1+p["v"]]
    row_pitch = atlas_width*p["b"]+3
    address = p["base"]+pixel_position[1]*row_pitch+pixel_position[0]
    face_row_end = p["base"]+(cell_origin[1]+1+p["v"])*row_pitch+(cell_origin[0]+1+p["size"])*p["b"]
    allocation_end = p["base"]+atlas_height*row_pitch
    return {'cell_size': cell_size, 'atlas_width': atlas_width, 'atlas_height': atlas_height, 'face_cell': face_cell, 'cell_origin': cell_origin, 'pixel_position': pixel_position, 'row_pitch': row_pitch, 'address': address, 'face_row_end': face_row_end, 'allocation_end': allocation_end}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'size': 2, 'face': 0, 'u': 0, 'v': 1, 'b': 2, 'base': 7}, {'cell_size': 4, 'atlas_width': 16, 'atlas_height': 12, 'face_cell': (2, 1), 'cell_origin': [8, 4], 'pixel_position': [9, 6], 'row_pitch': 35, 'address': 235, 'face_row_end': 239, 'allocation_end': 427}), ({'size': 3, 'face': 1, 'u': 1, 'v': 2, 'b': 2, 'base': 7}, {'cell_size': 5, 'atlas_width': 20, 'atlas_height': 15, 'face_cell': (0, 1), 'cell_origin': [0, 5], 'pixel_position': [2, 8], 'row_pitch': 43, 'address': 355, 'face_row_end': 359, 'allocation_end': 652}), ({'size': 4, 'face': 2, 'u': 2, 'v': 3, 'b': 2, 'base': 7}, {'cell_size': 6, 'atlas_width': 24, 'atlas_height': 18, 'face_cell': (1, 0), 'cell_origin': [6, 0], 'pixel_position': [9, 4], 'row_pitch': 51, 'address': 229, 'face_row_end': 233, 'allocation_end': 925}), ({'size': 5, 'face': 3, 'u': 3, 'v': 4, 'b': 2, 'base': 7}, {'cell_size': 7, 'atlas_width': 28, 'atlas_height': 21, 'face_cell': (1, 2), 'cell_origin': [7, 14], 'pixel_position': [11, 19], 'row_pitch': 59, 'address': 1150, 'face_row_end': 1154, 'allocation_end': 1246}), ({'size': 6, 'face': 4, 'u': 4, 'v': 5, 'b': 2, 'base': 7}, {'cell_size': 8, 'atlas_width': 32, 'atlas_height': 24, 'face_cell': (1, 1), 'cell_origin': [8, 8], 'pixel_position': [13, 14], 'row_pitch': 67, 'address': 971, 'face_row_end': 975, 'allocation_end': 1615}), ({'size': 7, 'face': 5, 'u': 5, 'v': 6, 'b': 2, 'base': 7}, {'cell_size': 9, 'atlas_width': 36, 'atlas_height': 27, 'face_cell': (3, 1), 'cell_origin': [27, 9], 'pixel_position': [33, 16], 'row_pitch': 75, 'address': 1273, 'face_row_end': 1277, 'allocation_end': 2032})], 2: [({'size': 3, 'face': 0, 'u': 0, 'v': 1, 'b': 3, 'base': 14}, {'cell_size': 5, 'atlas_width': 20, 'atlas_height': 15, 'face_cell': (2, 1), 'cell_origin': [10, 5], 'pixel_position': [11, 7], 'row_pitch': 63, 'address': 488, 'face_row_end': 497, 'allocation_end': 959}), ({'size': 4, 'face': 1, 'u': 1, 'v': 2, 'b': 3, 'base': 14}, {'cell_size': 6, 'atlas_width': 24, 'atlas_height': 18, 'face_cell': (0, 1), 'cell_origin': [0, 6], 'pixel_position': [2, 9], 'row_pitch': 75, 'address': 695, 'face_row_end': 704, 'allocation_end': 1364}), ({'size': 5, 'face': 2, 'u': 2, 'v': 3, 'b': 3, 'base': 14}, {'cell_size': 7, 'atlas_width': 28, 'atlas_height': 21, 'face_cell': (1, 0), 'cell_origin': [7, 0], 'pixel_position': [10, 4], 'row_pitch': 87, 'address': 392, 'face_row_end': 401, 'allocation_end': 1841}), ({'size': 6, 'face': 3, 'u': 3, 'v': 4, 'b': 3, 'base': 14}, {'cell_size': 8, 'atlas_width': 32, 'atlas_height': 24, 'face_cell': (1, 2), 'cell_origin': [8, 16], 'pixel_position': [12, 21], 'row_pitch': 99, 'address': 2129, 'face_row_end': 2138, 'allocation_end': 2390}), ({'size': 7, 'face': 4, 'u': 4, 'v': 5, 'b': 3, 'base': 14}, {'cell_size': 9, 'atlas_width': 36, 'atlas_height': 27, 'face_cell': (1, 1), 'cell_origin': [9, 9], 'pixel_position': [14, 15], 'row_pitch': 111, 'address': 1721, 'face_row_end': 1730, 'allocation_end': 3011}), ({'size': 8, 'face': 5, 'u': 5, 'v': 6, 'b': 3, 'base': 14}, {'cell_size': 10, 'atlas_width': 40, 'atlas_height': 30, 'face_cell': (3, 1), 'cell_origin': [30, 10], 'pixel_position': [36, 17], 'row_pitch': 123, 'address': 2213, 'face_row_end': 2222, 'allocation_end': 3704})], 3: [({'size': 4, 'face': 0, 'u': 0, 'v': 1, 'b': 4, 'base': 21}, {'cell_size': 6, 'atlas_width': 24, 'atlas_height': 18, 'face_cell': (2, 1), 'cell_origin': [12, 6], 'pixel_position': [13, 8], 'row_pitch': 99, 'address': 865, 'face_row_end': 881, 'allocation_end': 1803}), ({'size': 5, 'face': 1, 'u': 1, 'v': 2, 'b': 4, 'base': 21}, {'cell_size': 7, 'atlas_width': 28, 'atlas_height': 21, 'face_cell': (0, 1), 'cell_origin': [0, 7], 'pixel_position': [2, 10], 'row_pitch': 115, 'address': 1179, 'face_row_end': 1195, 'allocation_end': 2436}), ({'size': 6, 'face': 2, 'u': 2, 'v': 3, 'b': 4, 'base': 21}, {'cell_size': 8, 'atlas_width': 32, 'atlas_height': 24, 'face_cell': (1, 0), 'cell_origin': [8, 0], 'pixel_position': [11, 4], 'row_pitch': 131, 'address': 589, 'face_row_end': 605, 'allocation_end': 3165}), ({'size': 7, 'face': 3, 'u': 3, 'v': 4, 'b': 4, 'base': 21}, {'cell_size': 9, 'atlas_width': 36, 'atlas_height': 27, 'face_cell': (1, 2), 'cell_origin': [9, 18], 'pixel_position': [13, 23], 'row_pitch': 147, 'address': 3454, 'face_row_end': 3470, 'allocation_end': 3990}), ({'size': 8, 'face': 4, 'u': 4, 'v': 5, 'b': 4, 'base': 21}, {'cell_size': 10, 'atlas_width': 40, 'atlas_height': 30, 'face_cell': (1, 1), 'cell_origin': [10, 10], 'pixel_position': [15, 16], 'row_pitch': 163, 'address': 2689, 'face_row_end': 2705, 'allocation_end': 4911}), ({'size': 9, 'face': 5, 'u': 5, 'v': 6, 'b': 4, 'base': 21}, {'cell_size': 11, 'atlas_width': 44, 'atlas_height': 33, 'face_cell': (3, 1), 'cell_origin': [33, 11], 'pixel_position': [39, 18], 'row_pitch': 179, 'address': 3399, 'face_row_end': 3415, 'allocation_end': 5928})], 4: [({'size': 5, 'face': 0, 'u': 0, 'v': 1, 'b': 5, 'base': 28}, {'cell_size': 7, 'atlas_width': 28, 'atlas_height': 21, 'face_cell': (2, 1), 'cell_origin': [14, 7], 'pixel_position': [15, 9], 'row_pitch': 143, 'address': 1390, 'face_row_end': 1415, 'allocation_end': 3031}), ({'size': 6, 'face': 1, 'u': 1, 'v': 2, 'b': 5, 'base': 28}, {'cell_size': 8, 'atlas_width': 32, 'atlas_height': 24, 'face_cell': (0, 1), 'cell_origin': [0, 8], 'pixel_position': [2, 11], 'row_pitch': 163, 'address': 1831, 'face_row_end': 1856, 'allocation_end': 3940}), ({'size': 7, 'face': 2, 'u': 2, 'v': 3, 'b': 5, 'base': 28}, {'cell_size': 9, 'atlas_width': 36, 'atlas_height': 27, 'face_cell': (1, 0), 'cell_origin': [9, 0], 'pixel_position': [12, 4], 'row_pitch': 183, 'address': 820, 'face_row_end': 845, 'allocation_end': 4969}), ({'size': 8, 'face': 3, 'u': 3, 'v': 4, 'b': 5, 'base': 28}, {'cell_size': 10, 'atlas_width': 40, 'atlas_height': 30, 'face_cell': (1, 2), 'cell_origin': [10, 20], 'pixel_position': [14, 25], 'row_pitch': 203, 'address': 5173, 'face_row_end': 5198, 'allocation_end': 6118}), ({'size': 9, 'face': 4, 'u': 4, 'v': 5, 'b': 5, 'base': 28}, {'cell_size': 11, 'atlas_width': 44, 'atlas_height': 33, 'face_cell': (1, 1), 'cell_origin': [11, 11], 'pixel_position': [16, 17], 'row_pitch': 223, 'address': 3899, 'face_row_end': 3924, 'allocation_end': 7387}), ({'size': 10, 'face': 5, 'u': 5, 'v': 6, 'b': 5, 'base': 28}, {'cell_size': 12, 'atlas_width': 48, 'atlas_height': 36, 'face_cell': (3, 1), 'cell_origin': [36, 12], 'pixel_position': [42, 19], 'row_pitch': 243, 'address': 4855, 'face_row_end': 4880, 'allocation_end': 8776})], 5: [({'size': 6, 'face': 0, 'u': 0, 'v': 1, 'b': 6, 'base': 35}, {'cell_size': 8, 'atlas_width': 32, 'atlas_height': 24, 'face_cell': (2, 1), 'cell_origin': [16, 8], 'pixel_position': [17, 10], 'row_pitch': 195, 'address': 2087, 'face_row_end': 2123, 'allocation_end': 4715}), ({'size': 7, 'face': 1, 'u': 1, 'v': 2, 'b': 6, 'base': 35}, {'cell_size': 9, 'atlas_width': 36, 'atlas_height': 27, 'face_cell': (0, 1), 'cell_origin': [0, 9], 'pixel_position': [2, 12], 'row_pitch': 219, 'address': 2675, 'face_row_end': 2711, 'allocation_end': 5948}), ({'size': 8, 'face': 2, 'u': 2, 'v': 3, 'b': 6, 'base': 35}, {'cell_size': 10, 'atlas_width': 40, 'atlas_height': 30, 'face_cell': (1, 0), 'cell_origin': [10, 0], 'pixel_position': [13, 4], 'row_pitch': 243, 'address': 1085, 'face_row_end': 1121, 'allocation_end': 7325}), ({'size': 9, 'face': 3, 'u': 3, 'v': 4, 'b': 6, 'base': 35}, {'cell_size': 11, 'atlas_width': 44, 'atlas_height': 33, 'face_cell': (1, 2), 'cell_origin': [11, 22], 'pixel_position': [15, 27], 'row_pitch': 267, 'address': 7334, 'face_row_end': 7370, 'allocation_end': 8846}), ({'size': 10, 'face': 4, 'u': 4, 'v': 5, 'b': 6, 'base': 35}, {'cell_size': 12, 'atlas_width': 48, 'atlas_height': 36, 'face_cell': (1, 1), 'cell_origin': [12, 12], 'pixel_position': [17, 18], 'row_pitch': 291, 'address': 5375, 'face_row_end': 5411, 'allocation_end': 10511}), ({'size': 11, 'face': 5, 'u': 5, 'v': 6, 'b': 6, 'base': 35}, {'cell_size': 13, 'atlas_width': 52, 'atlas_height': 39, 'face_cell': (3, 1), 'cell_origin': [39, 13], 'pixel_position': [45, 20], 'row_pitch': 315, 'address': 6605, 'face_row_end': 6641, 'allocation_end': 12320})]}
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 address.

Six square cube faces occupy stipulated cells of a 4x3 atlas cross: [(2,1),(0,1),(1,0),(1,2),(1,1),(3,1)]. Every cell has a one-texel gutter and atlas rows end with a three-byte guard. Face sampling is storage addressing only. 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)
    cell_size = p["size"]+2
    atlas_width = 4*cell_size
    atlas_height = 3*cell_size
    face_cell = [(2,1),(0,1),(1,0),(1,2),(1,1),(3,1)][p["face"]]
    cell_origin = [face_cell[0]*cell_size,face_cell[1]*cell_size]
    pixel_position = [cell_origin[0]+1+p["u"],cell_origin[1]+1+p["v"]]
    row_pitch = atlas_width*p["b"]+3
    address = p["base"]+pixel_position[1]*row_pitch+pixel_position[0]*p["b"]
    face_row_end = p["base"]+(cell_origin[1]+1+p["v"])*row_pitch+(cell_origin[0]+cell_size)*p["b"]
    allocation_end = p["base"]+atlas_height*row_pitch
    return {'cell_size': cell_size, 'atlas_width': atlas_width, 'atlas_height': atlas_height, 'face_cell': face_cell, 'cell_origin': cell_origin, 'pixel_position': pixel_position, 'row_pitch': row_pitch, 'address': address, 'face_row_end': face_row_end, 'allocation_end': allocation_end}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'size': 2, 'face': 0, 'u': 0, 'v': 1, 'b': 2, 'base': 7}, {'cell_size': 4, 'atlas_width': 16, 'atlas_height': 12, 'face_cell': (2, 1), 'cell_origin': [8, 4], 'pixel_position': [9, 6], 'row_pitch': 35, 'address': 235, 'face_row_end': 239, 'allocation_end': 427}), ({'size': 3, 'face': 1, 'u': 1, 'v': 2, 'b': 2, 'base': 7}, {'cell_size': 5, 'atlas_width': 20, 'atlas_height': 15, 'face_cell': (0, 1), 'cell_origin': [0, 5], 'pixel_position': [2, 8], 'row_pitch': 43, 'address': 355, 'face_row_end': 359, 'allocation_end': 652}), ({'size': 4, 'face': 2, 'u': 2, 'v': 3, 'b': 2, 'base': 7}, {'cell_size': 6, 'atlas_width': 24, 'atlas_height': 18, 'face_cell': (1, 0), 'cell_origin': [6, 0], 'pixel_position': [9, 4], 'row_pitch': 51, 'address': 229, 'face_row_end': 233, 'allocation_end': 925}), ({'size': 5, 'face': 3, 'u': 3, 'v': 4, 'b': 2, 'base': 7}, {'cell_size': 7, 'atlas_width': 28, 'atlas_height': 21, 'face_cell': (1, 2), 'cell_origin': [7, 14], 'pixel_position': [11, 19], 'row_pitch': 59, 'address': 1150, 'face_row_end': 1154, 'allocation_end': 1246}), ({'size': 6, 'face': 4, 'u': 4, 'v': 5, 'b': 2, 'base': 7}, {'cell_size': 8, 'atlas_width': 32, 'atlas_height': 24, 'face_cell': (1, 1), 'cell_origin': [8, 8], 'pixel_position': [13, 14], 'row_pitch': 67, 'address': 971, 'face_row_end': 975, 'allocation_end': 1615}), ({'size': 7, 'face': 5, 'u': 5, 'v': 6, 'b': 2, 'base': 7}, {'cell_size': 9, 'atlas_width': 36, 'atlas_height': 27, 'face_cell': (3, 1), 'cell_origin': [27, 9], 'pixel_position': [33, 16], 'row_pitch': 75, 'address': 1273, 'face_row_end': 1277, 'allocation_end': 2032})], 2: [({'size': 3, 'face': 0, 'u': 0, 'v': 1, 'b': 3, 'base': 14}, {'cell_size': 5, 'atlas_width': 20, 'atlas_height': 15, 'face_cell': (2, 1), 'cell_origin': [10, 5], 'pixel_position': [11, 7], 'row_pitch': 63, 'address': 488, 'face_row_end': 497, 'allocation_end': 959}), ({'size': 4, 'face': 1, 'u': 1, 'v': 2, 'b': 3, 'base': 14}, {'cell_size': 6, 'atlas_width': 24, 'atlas_height': 18, 'face_cell': (0, 1), 'cell_origin': [0, 6], 'pixel_position': [2, 9], 'row_pitch': 75, 'address': 695, 'face_row_end': 704, 'allocation_end': 1364}), ({'size': 5, 'face': 2, 'u': 2, 'v': 3, 'b': 3, 'base': 14}, {'cell_size': 7, 'atlas_width': 28, 'atlas_height': 21, 'face_cell': (1, 0), 'cell_origin': [7, 0], 'pixel_position': [10, 4], 'row_pitch': 87, 'address': 392, 'face_row_end': 401, 'allocation_end': 1841}), ({'size': 6, 'face': 3, 'u': 3, 'v': 4, 'b': 3, 'base': 14}, {'cell_size': 8, 'atlas_width': 32, 'atlas_height': 24, 'face_cell': (1, 2), 'cell_origin': [8, 16], 'pixel_position': [12, 21], 'row_pitch': 99, 'address': 2129, 'face_row_end': 2138, 'allocation_end': 2390}), ({'size': 7, 'face': 4, 'u': 4, 'v': 5, 'b': 3, 'base': 14}, {'cell_size': 9, 'atlas_width': 36, 'atlas_height': 27, 'face_cell': (1, 1), 'cell_origin': [9, 9], 'pixel_position': [14, 15], 'row_pitch': 111, 'address': 1721, 'face_row_end': 1730, 'allocation_end': 3011}), ({'size': 8, 'face': 5, 'u': 5, 'v': 6, 'b': 3, 'base': 14}, {'cell_size': 10, 'atlas_width': 40, 'atlas_height': 30, 'face_cell': (3, 1), 'cell_origin': [30, 10], 'pixel_position': [36, 17], 'row_pitch': 123, 'address': 2213, 'face_row_end': 2222, 'allocation_end': 3704})], 3: [({'size': 4, 'face': 0, 'u': 0, 'v': 1, 'b': 4, 'base': 21}, {'cell_size': 6, 'atlas_width': 24, 'atlas_height': 18, 'face_cell': (2, 1), 'cell_origin': [12, 6], 'pixel_position': [13, 8], 'row_pitch': 99, 'address': 865, 'face_row_end': 881, 'allocation_end': 1803}), ({'size': 5, 'face': 1, 'u': 1, 'v': 2, 'b': 4, 'base': 21}, {'cell_size': 7, 'atlas_width': 28, 'atlas_height': 21, 'face_cell': (0, 1), 'cell_origin': [0, 7], 'pixel_position': [2, 10], 'row_pitch': 115, 'address': 1179, 'face_row_end': 1195, 'allocation_end': 2436}), ({'size': 6, 'face': 2, 'u': 2, 'v': 3, 'b': 4, 'base': 21}, {'cell_size': 8, 'atlas_width': 32, 'atlas_height': 24, 'face_cell': (1, 0), 'cell_origin': [8, 0], 'pixel_position': [11, 4], 'row_pitch': 131, 'address': 589, 'face_row_end': 605, 'allocation_end': 3165}), ({'size': 7, 'face': 3, 'u': 3, 'v': 4, 'b': 4, 'base': 21}, {'cell_size': 9, 'atlas_width': 36, 'atlas_height': 27, 'face_cell': (1, 2), 'cell_origin': [9, 18], 'pixel_position': [13, 23], 'row_pitch': 147, 'address': 3454, 'face_row_end': 3470, 'allocation_end': 3990}), ({'size': 8, 'face': 4, 'u': 4, 'v': 5, 'b': 4, 'base': 21}, {'cell_size': 10, 'atlas_width': 40, 'atlas_height': 30, 'face_cell': (1, 1), 'cell_origin': [10, 10], 'pixel_position': [15, 16], 'row_pitch': 163, 'address': 2689, 'face_row_end': 2705, 'allocation_end': 4911}), ({'size': 9, 'face': 5, 'u': 5, 'v': 6, 'b': 4, 'base': 21}, {'cell_size': 11, 'atlas_width': 44, 'atlas_height': 33, 'face_cell': (3, 1), 'cell_origin': [33, 11], 'pixel_position': [39, 18], 'row_pitch': 179, 'address': 3399, 'face_row_end': 3415, 'allocation_end': 5928})], 4: [({'size': 5, 'face': 0, 'u': 0, 'v': 1, 'b': 5, 'base': 28}, {'cell_size': 7, 'atlas_width': 28, 'atlas_height': 21, 'face_cell': (2, 1), 'cell_origin': [14, 7], 'pixel_position': [15, 9], 'row_pitch': 143, 'address': 1390, 'face_row_end': 1415, 'allocation_end': 3031}), ({'size': 6, 'face': 1, 'u': 1, 'v': 2, 'b': 5, 'base': 28}, {'cell_size': 8, 'atlas_width': 32, 'atlas_height': 24, 'face_cell': (0, 1), 'cell_origin': [0, 8], 'pixel_position': [2, 11], 'row_pitch': 163, 'address': 1831, 'face_row_end': 1856, 'allocation_end': 3940}), ({'size': 7, 'face': 2, 'u': 2, 'v': 3, 'b': 5, 'base': 28}, {'cell_size': 9, 'atlas_width': 36, 'atlas_height': 27, 'face_cell': (1, 0), 'cell_origin': [9, 0], 'pixel_position': [12, 4], 'row_pitch': 183, 'address': 820, 'face_row_end': 845, 'allocation_end': 4969}), ({'size': 8, 'face': 3, 'u': 3, 'v': 4, 'b': 5, 'base': 28}, {'cell_size': 10, 'atlas_width': 40, 'atlas_height': 30, 'face_cell': (1, 2), 'cell_origin': [10, 20], 'pixel_position': [14, 25], 'row_pitch': 203, 'address': 5173, 'face_row_end': 5198, 'allocation_end': 6118}), ({'size': 9, 'face': 4, 'u': 4, 'v': 5, 'b': 5, 'base': 28}, {'cell_size': 11, 'atlas_width': 44, 'atlas_height': 33, 'face_cell': (1, 1), 'cell_origin': [11, 11], 'pixel_position': [16, 17], 'row_pitch': 223, 'address': 3899, 'face_row_end': 3924, 'allocation_end': 7387}), ({'size': 10, 'face': 5, 'u': 5, 'v': 6, 'b': 5, 'base': 28}, {'cell_size': 12, 'atlas_width': 48, 'atlas_height': 36, 'face_cell': (3, 1), 'cell_origin': [36, 12], 'pixel_position': [42, 19], 'row_pitch': 243, 'address': 4855, 'face_row_end': 4880, 'allocation_end': 8776})], 5: [({'size': 6, 'face': 0, 'u': 0, 'v': 1, 'b': 6, 'base': 35}, {'cell_size': 8, 'atlas_width': 32, 'atlas_height': 24, 'face_cell': (2, 1), 'cell_origin': [16, 8], 'pixel_position': [17, 10], 'row_pitch': 195, 'address': 2087, 'face_row_end': 2123, 'allocation_end': 4715}), ({'size': 7, 'face': 1, 'u': 1, 'v': 2, 'b': 6, 'base': 35}, {'cell_size': 9, 'atlas_width': 36, 'atlas_height': 27, 'face_cell': (0, 1), 'cell_origin': [0, 9], 'pixel_position': [2, 12], 'row_pitch': 219, 'address': 2675, 'face_row_end': 2711, 'allocation_end': 5948}), ({'size': 8, 'face': 2, 'u': 2, 'v': 3, 'b': 6, 'base': 35}, {'cell_size': 10, 'atlas_width': 40, 'atlas_height': 30, 'face_cell': (1, 0), 'cell_origin': [10, 0], 'pixel_position': [13, 4], 'row_pitch': 243, 'address': 1085, 'face_row_end': 1121, 'allocation_end': 7325}), ({'size': 9, 'face': 3, 'u': 3, 'v': 4, 'b': 6, 'base': 35}, {'cell_size': 11, 'atlas_width': 44, 'atlas_height': 33, 'face_cell': (1, 2), 'cell_origin': [11, 22], 'pixel_position': [15, 27], 'row_pitch': 267, 'address': 7334, 'face_row_end': 7370, 'allocation_end': 8846}), ({'size': 10, 'face': 4, 'u': 4, 'v': 5, 'b': 6, 'base': 35}, {'cell_size': 12, 'atlas_width': 48, 'atlas_height': 36, 'face_cell': (1, 1), 'cell_origin': [12, 12], 'pixel_position': [17, 18], 'row_pitch': 291, 'address': 5375, 'face_row_end': 5411, 'allocation_end': 10511}), ({'size': 11, 'face': 5, 'u': 5, 'v': 6, 'b': 6, 'base': 35}, {'cell_size': 13, 'atlas_width': 52, 'atlas_height': 39, 'face_cell': (3, 1), 'cell_origin': [39, 13], 'pixel_position': [45, 20], 'row_pitch': 315, 'address': 6605, 'face_row_end': 6641, 'allocation_end': 12320})]}
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)
    cell_size = p["size"]+2
    atlas_width = 4*cell_size
    atlas_height = 3*cell_size
    face_cell = [(2,1),(0,1),(1,0),(1,2),(1,1),(3,1)][p["face"]]
    cell_origin = [face_cell[0]*cell_size,face_cell[1]*cell_size]
    pixel_position = [cell_origin[0]+1+p["u"],cell_origin[1]+1+p["v"]]
    row_pitch = atlas_width*p["b"]+3
    address = p["base"]+pixel_position[1]*row_pitch+pixel_position[0]*p["b"]
    face_row_end = p["base"]+(cell_origin[1]+1+p["v"])*row_pitch+p["size"]*p["b"]
    allocation_end = p["base"]+atlas_height*row_pitch
    return {'cell_size': cell_size, 'atlas_width': atlas_width, 'atlas_height': atlas_height, 'face_cell': face_cell, 'cell_origin': cell_origin, 'pixel_position': pixel_position, 'row_pitch': row_pitch, 'address': address, 'face_row_end': face_row_end, 'allocation_end': allocation_end}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'size': 2, 'face': 0, 'u': 0, 'v': 1, 'b': 2, 'base': 7}, {'cell_size': 4, 'atlas_width': 16, 'atlas_height': 12, 'face_cell': (2, 1), 'cell_origin': [8, 4], 'pixel_position': [9, 6], 'row_pitch': 35, 'address': 235, 'face_row_end': 239, 'allocation_end': 427}), ({'size': 3, 'face': 1, 'u': 1, 'v': 2, 'b': 2, 'base': 7}, {'cell_size': 5, 'atlas_width': 20, 'atlas_height': 15, 'face_cell': (0, 1), 'cell_origin': [0, 5], 'pixel_position': [2, 8], 'row_pitch': 43, 'address': 355, 'face_row_end': 359, 'allocation_end': 652}), ({'size': 4, 'face': 2, 'u': 2, 'v': 3, 'b': 2, 'base': 7}, {'cell_size': 6, 'atlas_width': 24, 'atlas_height': 18, 'face_cell': (1, 0), 'cell_origin': [6, 0], 'pixel_position': [9, 4], 'row_pitch': 51, 'address': 229, 'face_row_end': 233, 'allocation_end': 925}), ({'size': 5, 'face': 3, 'u': 3, 'v': 4, 'b': 2, 'base': 7}, {'cell_size': 7, 'atlas_width': 28, 'atlas_height': 21, 'face_cell': (1, 2), 'cell_origin': [7, 14], 'pixel_position': [11, 19], 'row_pitch': 59, 'address': 1150, 'face_row_end': 1154, 'allocation_end': 1246}), ({'size': 6, 'face': 4, 'u': 4, 'v': 5, 'b': 2, 'base': 7}, {'cell_size': 8, 'atlas_width': 32, 'atlas_height': 24, 'face_cell': (1, 1), 'cell_origin': [8, 8], 'pixel_position': [13, 14], 'row_pitch': 67, 'address': 971, 'face_row_end': 975, 'allocation_end': 1615}), ({'size': 7, 'face': 5, 'u': 5, 'v': 6, 'b': 2, 'base': 7}, {'cell_size': 9, 'atlas_width': 36, 'atlas_height': 27, 'face_cell': (3, 1), 'cell_origin': [27, 9], 'pixel_position': [33, 16], 'row_pitch': 75, 'address': 1273, 'face_row_end': 1277, 'allocation_end': 2032})], 2: [({'size': 3, 'face': 0, 'u': 0, 'v': 1, 'b': 3, 'base': 14}, {'cell_size': 5, 'atlas_width': 20, 'atlas_height': 15, 'face_cell': (2, 1), 'cell_origin': [10, 5], 'pixel_position': [11, 7], 'row_pitch': 63, 'address': 488, 'face_row_end': 497, 'allocation_end': 959}), ({'size': 4, 'face': 1, 'u': 1, 'v': 2, 'b': 3, 'base': 14}, {'cell_size': 6, 'atlas_width': 24, 'atlas_height': 18, 'face_cell': (0, 1), 'cell_origin': [0, 6], 'pixel_position': [2, 9], 'row_pitch': 75, 'address': 695, 'face_row_end': 704, 'allocation_end': 1364}), ({'size': 5, 'face': 2, 'u': 2, 'v': 3, 'b': 3, 'base': 14}, {'cell_size': 7, 'atlas_width': 28, 'atlas_height': 21, 'face_cell': (1, 0), 'cell_origin': [7, 0], 'pixel_position': [10, 4], 'row_pitch': 87, 'address': 392, 'face_row_end': 401, 'allocation_end': 1841}), ({'size': 6, 'face': 3, 'u': 3, 'v': 4, 'b': 3, 'base': 14}, {'cell_size': 8, 'atlas_width': 32, 'atlas_height': 24, 'face_cell': (1, 2), 'cell_origin': [8, 16], 'pixel_position': [12, 21], 'row_pitch': 99, 'address': 2129, 'face_row_end': 2138, 'allocation_end': 2390}), ({'size': 7, 'face': 4, 'u': 4, 'v': 5, 'b': 3, 'base': 14}, {'cell_size': 9, 'atlas_width': 36, 'atlas_height': 27, 'face_cell': (1, 1), 'cell_origin': [9, 9], 'pixel_position': [14, 15], 'row_pitch': 111, 'address': 1721, 'face_row_end': 1730, 'allocation_end': 3011}), ({'size': 8, 'face': 5, 'u': 5, 'v': 6, 'b': 3, 'base': 14}, {'cell_size': 10, 'atlas_width': 40, 'atlas_height': 30, 'face_cell': (3, 1), 'cell_origin': [30, 10], 'pixel_position': [36, 17], 'row_pitch': 123, 'address': 2213, 'face_row_end': 2222, 'allocation_end': 3704})], 3: [({'size': 4, 'face': 0, 'u': 0, 'v': 1, 'b': 4, 'base': 21}, {'cell_size': 6, 'atlas_width': 24, 'atlas_height': 18, 'face_cell': (2, 1), 'cell_origin': [12, 6], 'pixel_position': [13, 8], 'row_pitch': 99, 'address': 865, 'face_row_end': 881, 'allocation_end': 1803}), ({'size': 5, 'face': 1, 'u': 1, 'v': 2, 'b': 4, 'base': 21}, {'cell_size': 7, 'atlas_width': 28, 'atlas_height': 21, 'face_cell': (0, 1), 'cell_origin': [0, 7], 'pixel_position': [2, 10], 'row_pitch': 115, 'address': 1179, 'face_row_end': 1195, 'allocation_end': 2436}), ({'size': 6, 'face': 2, 'u': 2, 'v': 3, 'b': 4, 'base': 21}, {'cell_size': 8, 'atlas_width': 32, 'atlas_height': 24, 'face_cell': (1, 0), 'cell_origin': [8, 0], 'pixel_position': [11, 4], 'row_pitch': 131, 'address': 589, 'face_row_end': 605, 'allocation_end': 3165}), ({'size': 7, 'face': 3, 'u': 3, 'v': 4, 'b': 4, 'base': 21}, {'cell_size': 9, 'atlas_width': 36, 'atlas_height': 27, 'face_cell': (1, 2), 'cell_origin': [9, 18], 'pixel_position': [13, 23], 'row_pitch': 147, 'address': 3454, 'face_row_end': 3470, 'allocation_end': 3990}), ({'size': 8, 'face': 4, 'u': 4, 'v': 5, 'b': 4, 'base': 21}, {'cell_size': 10, 'atlas_width': 40, 'atlas_height': 30, 'face_cell': (1, 1), 'cell_origin': [10, 10], 'pixel_position': [15, 16], 'row_pitch': 163, 'address': 2689, 'face_row_end': 2705, 'allocation_end': 4911}), ({'size': 9, 'face': 5, 'u': 5, 'v': 6, 'b': 4, 'base': 21}, {'cell_size': 11, 'atlas_width': 44, 'atlas_height': 33, 'face_cell': (3, 1), 'cell_origin': [33, 11], 'pixel_position': [39, 18], 'row_pitch': 179, 'address': 3399, 'face_row_end': 3415, 'allocation_end': 5928})], 4: [({'size': 5, 'face': 0, 'u': 0, 'v': 1, 'b': 5, 'base': 28}, {'cell_size': 7, 'atlas_width': 28, 'atlas_height': 21, 'face_cell': (2, 1), 'cell_origin': [14, 7], 'pixel_position': [15, 9], 'row_pitch': 143, 'address': 1390, 'face_row_end': 1415, 'allocation_end': 3031}), ({'size': 6, 'face': 1, 'u': 1, 'v': 2, 'b': 5, 'base': 28}, {'cell_size': 8, 'atlas_width': 32, 'atlas_height': 24, 'face_cell': (0, 1), 'cell_origin': [0, 8], 'pixel_position': [2, 11], 'row_pitch': 163, 'address': 1831, 'face_row_end': 1856, 'allocation_end': 3940}), ({'size': 7, 'face': 2, 'u': 2, 'v': 3, 'b': 5, 'base': 28}, {'cell_size': 9, 'atlas_width': 36, 'atlas_height': 27, 'face_cell': (1, 0), 'cell_origin': [9, 0], 'pixel_position': [12, 4], 'row_pitch': 183, 'address': 820, 'face_row_end': 845, 'allocation_end': 4969}), ({'size': 8, 'face': 3, 'u': 3, 'v': 4, 'b': 5, 'base': 28}, {'cell_size': 10, 'atlas_width': 40, 'atlas_height': 30, 'face_cell': (1, 2), 'cell_origin': [10, 20], 'pixel_position': [14, 25], 'row_pitch': 203, 'address': 5173, 'face_row_end': 5198, 'allocation_end': 6118}), ({'size': 9, 'face': 4, 'u': 4, 'v': 5, 'b': 5, 'base': 28}, {'cell_size': 11, 'atlas_width': 44, 'atlas_height': 33, 'face_cell': (1, 1), 'cell_origin': [11, 11], 'pixel_position': [16, 17], 'row_pitch': 223, 'address': 3899, 'face_row_end': 3924, 'allocation_end': 7387}), ({'size': 10, 'face': 5, 'u': 5, 'v': 6, 'b': 5, 'base': 28}, {'cell_size': 12, 'atlas_width': 48, 'atlas_height': 36, 'face_cell': (3, 1), 'cell_origin': [36, 12], 'pixel_position': [42, 19], 'row_pitch': 243, 'address': 4855, 'face_row_end': 4880, 'allocation_end': 8776})], 5: [({'size': 6, 'face': 0, 'u': 0, 'v': 1, 'b': 6, 'base': 35}, {'cell_size': 8, 'atlas_width': 32, 'atlas_height': 24, 'face_cell': (2, 1), 'cell_origin': [16, 8], 'pixel_position': [17, 10], 'row_pitch': 195, 'address': 2087, 'face_row_end': 2123, 'allocation_end': 4715}), ({'size': 7, 'face': 1, 'u': 1, 'v': 2, 'b': 6, 'base': 35}, {'cell_size': 9, 'atlas_width': 36, 'atlas_height': 27, 'face_cell': (0, 1), 'cell_origin': [0, 9], 'pixel_position': [2, 12], 'row_pitch': 219, 'address': 2675, 'face_row_end': 2711, 'allocation_end': 5948}), ({'size': 8, 'face': 2, 'u': 2, 'v': 3, 'b': 6, 'base': 35}, {'cell_size': 10, 'atlas_width': 40, 'atlas_height': 30, 'face_cell': (1, 0), 'cell_origin': [10, 0], 'pixel_position': [13, 4], 'row_pitch': 243, 'address': 1085, 'face_row_end': 1121, 'allocation_end': 7325}), ({'size': 9, 'face': 3, 'u': 3, 'v': 4, 'b': 6, 'base': 35}, {'cell_size': 11, 'atlas_width': 44, 'atlas_height': 33, 'face_cell': (1, 2), 'cell_origin': [11, 22], 'pixel_position': [15, 27], 'row_pitch': 267, 'address': 7334, 'face_row_end': 7370, 'allocation_end': 8846}), ({'size': 10, 'face': 4, 'u': 4, 'v': 5, 'b': 6, 'base': 35}, {'cell_size': 12, 'atlas_width': 48, 'atlas_height': 36, 'face_cell': (1, 1), 'cell_origin': [12, 12], 'pixel_position': [17, 18], 'row_pitch': 291, 'address': 5375, 'face_row_end': 5411, 'allocation_end': 10511}), ({'size': 11, 'face': 5, 'u': 5, 'v': 6, 'b': 6, 'base': 35}, {'cell_size': 13, 'atlas_width': 52, 'atlas_height': 39, 'face_cell': (3, 1), 'cell_origin': [39, 13], 'pixel_position': [45, 20], 'row_pitch': 315, 'address': 6605, 'face_row_end': 6641, 'allocation_end': 12320})]}
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 face_row_end.

Six square cube faces occupy stipulated cells of a 4x3 atlas cross: [(2,1),(0,1),(1,0),(1,2),(1,1),(3,1)]. Every cell has a one-texel gutter and atlas rows end with a three-byte guard. Face sampling is storage addressing only. 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)
    cell_size = p["size"]+2
    atlas_width = 4*cell_size
    atlas_height = 3*cell_size
    face_cell = [(2,1),(0,1),(1,0),(1,2),(1,1),(3,1)][p["face"]]
    cell_origin = [face_cell[0]*cell_size,face_cell[1]*cell_size]
    pixel_position = [cell_origin[0]+1+p["u"],cell_origin[1]+1+p["v"]]
    row_pitch = atlas_width*p["b"]+3
    address = p["base"]+pixel_position[1]*row_pitch+pixel_position[0]*p["b"]
    face_row_end = p["base"]+(cell_origin[1]+1+p["v"])*row_pitch+(cell_origin[0]+1+p["size"])*p["b"]
    allocation_end = p["base"]+6*p["size"]*p["size"]*p["b"]
    return {'cell_size': cell_size, 'atlas_width': atlas_width, 'atlas_height': atlas_height, 'face_cell': face_cell, 'cell_origin': cell_origin, 'pixel_position': pixel_position, 'row_pitch': row_pitch, 'address': address, 'face_row_end': face_row_end, 'allocation_end': allocation_end}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'size': 2, 'face': 0, 'u': 0, 'v': 1, 'b': 2, 'base': 7}, {'cell_size': 4, 'atlas_width': 16, 'atlas_height': 12, 'face_cell': (2, 1), 'cell_origin': [8, 4], 'pixel_position': [9, 6], 'row_pitch': 35, 'address': 235, 'face_row_end': 239, 'allocation_end': 427}), ({'size': 3, 'face': 1, 'u': 1, 'v': 2, 'b': 2, 'base': 7}, {'cell_size': 5, 'atlas_width': 20, 'atlas_height': 15, 'face_cell': (0, 1), 'cell_origin': [0, 5], 'pixel_position': [2, 8], 'row_pitch': 43, 'address': 355, 'face_row_end': 359, 'allocation_end': 652}), ({'size': 4, 'face': 2, 'u': 2, 'v': 3, 'b': 2, 'base': 7}, {'cell_size': 6, 'atlas_width': 24, 'atlas_height': 18, 'face_cell': (1, 0), 'cell_origin': [6, 0], 'pixel_position': [9, 4], 'row_pitch': 51, 'address': 229, 'face_row_end': 233, 'allocation_end': 925}), ({'size': 5, 'face': 3, 'u': 3, 'v': 4, 'b': 2, 'base': 7}, {'cell_size': 7, 'atlas_width': 28, 'atlas_height': 21, 'face_cell': (1, 2), 'cell_origin': [7, 14], 'pixel_position': [11, 19], 'row_pitch': 59, 'address': 1150, 'face_row_end': 1154, 'allocation_end': 1246}), ({'size': 6, 'face': 4, 'u': 4, 'v': 5, 'b': 2, 'base': 7}, {'cell_size': 8, 'atlas_width': 32, 'atlas_height': 24, 'face_cell': (1, 1), 'cell_origin': [8, 8], 'pixel_position': [13, 14], 'row_pitch': 67, 'address': 971, 'face_row_end': 975, 'allocation_end': 1615}), ({'size': 7, 'face': 5, 'u': 5, 'v': 6, 'b': 2, 'base': 7}, {'cell_size': 9, 'atlas_width': 36, 'atlas_height': 27, 'face_cell': (3, 1), 'cell_origin': [27, 9], 'pixel_position': [33, 16], 'row_pitch': 75, 'address': 1273, 'face_row_end': 1277, 'allocation_end': 2032})], 2: [({'size': 3, 'face': 0, 'u': 0, 'v': 1, 'b': 3, 'base': 14}, {'cell_size': 5, 'atlas_width': 20, 'atlas_height': 15, 'face_cell': (2, 1), 'cell_origin': [10, 5], 'pixel_position': [11, 7], 'row_pitch': 63, 'address': 488, 'face_row_end': 497, 'allocation_end': 959}), ({'size': 4, 'face': 1, 'u': 1, 'v': 2, 'b': 3, 'base': 14}, {'cell_size': 6, 'atlas_width': 24, 'atlas_height': 18, 'face_cell': (0, 1), 'cell_origin': [0, 6], 'pixel_position': [2, 9], 'row_pitch': 75, 'address': 695, 'face_row_end': 704, 'allocation_end': 1364}), ({'size': 5, 'face': 2, 'u': 2, 'v': 3, 'b': 3, 'base': 14}, {'cell_size': 7, 'atlas_width': 28, 'atlas_height': 21, 'face_cell': (1, 0), 'cell_origin': [7, 0], 'pixel_position': [10, 4], 'row_pitch': 87, 'address': 392, 'face_row_end': 401, 'allocation_end': 1841}), ({'size': 6, 'face': 3, 'u': 3, 'v': 4, 'b': 3, 'base': 14}, {'cell_size': 8, 'atlas_width': 32, 'atlas_height': 24, 'face_cell': (1, 2), 'cell_origin': [8, 16], 'pixel_position': [12, 21], 'row_pitch': 99, 'address': 2129, 'face_row_end': 2138, 'allocation_end': 2390}), ({'size': 7, 'face': 4, 'u': 4, 'v': 5, 'b': 3, 'base': 14}, {'cell_size': 9, 'atlas_width': 36, 'atlas_height': 27, 'face_cell': (1, 1), 'cell_origin': [9, 9], 'pixel_position': [14, 15], 'row_pitch': 111, 'address': 1721, 'face_row_end': 1730, 'allocation_end': 3011}), ({'size': 8, 'face': 5, 'u': 5, 'v': 6, 'b': 3, 'base': 14}, {'cell_size': 10, 'atlas_width': 40, 'atlas_height': 30, 'face_cell': (3, 1), 'cell_origin': [30, 10], 'pixel_position': [36, 17], 'row_pitch': 123, 'address': 2213, 'face_row_end': 2222, 'allocation_end': 3704})], 3: [({'size': 4, 'face': 0, 'u': 0, 'v': 1, 'b': 4, 'base': 21}, {'cell_size': 6, 'atlas_width': 24, 'atlas_height': 18, 'face_cell': (2, 1), 'cell_origin': [12, 6], 'pixel_position': [13, 8], 'row_pitch': 99, 'address': 865, 'face_row_end': 881, 'allocation_end': 1803}), ({'size': 5, 'face': 1, 'u': 1, 'v': 2, 'b': 4, 'base': 21}, {'cell_size': 7, 'atlas_width': 28, 'atlas_height': 21, 'face_cell': (0, 1), 'cell_origin': [0, 7], 'pixel_position': [2, 10], 'row_pitch': 115, 'address': 1179, 'face_row_end': 1195, 'allocation_end': 2436}), ({'size': 6, 'face': 2, 'u': 2, 'v': 3, 'b': 4, 'base': 21}, {'cell_size': 8, 'atlas_width': 32, 'atlas_height': 24, 'face_cell': (1, 0), 'cell_origin': [8, 0], 'pixel_position': [11, 4], 'row_pitch': 131, 'address': 589, 'face_row_end': 605, 'allocation_end': 3165}), ({'size': 7, 'face': 3, 'u': 3, 'v': 4, 'b': 4, 'base': 21}, {'cell_size': 9, 'atlas_width': 36, 'atlas_height': 27, 'face_cell': (1, 2), 'cell_origin': [9, 18], 'pixel_position': [13, 23], 'row_pitch': 147, 'address': 3454, 'face_row_end': 3470, 'allocation_end': 3990}), ({'size': 8, 'face': 4, 'u': 4, 'v': 5, 'b': 4, 'base': 21}, {'cell_size': 10, 'atlas_width': 40, 'atlas_height': 30, 'face_cell': (1, 1), 'cell_origin': [10, 10], 'pixel_position': [15, 16], 'row_pitch': 163, 'address': 2689, 'face_row_end': 2705, 'allocation_end': 4911}), ({'size': 9, 'face': 5, 'u': 5, 'v': 6, 'b': 4, 'base': 21}, {'cell_size': 11, 'atlas_width': 44, 'atlas_height': 33, 'face_cell': (3, 1), 'cell_origin': [33, 11], 'pixel_position': [39, 18], 'row_pitch': 179, 'address': 3399, 'face_row_end': 3415, 'allocation_end': 5928})], 4: [({'size': 5, 'face': 0, 'u': 0, 'v': 1, 'b': 5, 'base': 28}, {'cell_size': 7, 'atlas_width': 28, 'atlas_height': 21, 'face_cell': (2, 1), 'cell_origin': [14, 7], 'pixel_position': [15, 9], 'row_pitch': 143, 'address': 1390, 'face_row_end': 1415, 'allocation_end': 3031}), ({'size': 6, 'face': 1, 'u': 1, 'v': 2, 'b': 5, 'base': 28}, {'cell_size': 8, 'atlas_width': 32, 'atlas_height': 24, 'face_cell': (0, 1), 'cell_origin': [0, 8], 'pixel_position': [2, 11], 'row_pitch': 163, 'address': 1831, 'face_row_end': 1856, 'allocation_end': 3940}), ({'size': 7, 'face': 2, 'u': 2, 'v': 3, 'b': 5, 'base': 28}, {'cell_size': 9, 'atlas_width': 36, 'atlas_height': 27, 'face_cell': (1, 0), 'cell_origin': [9, 0], 'pixel_position': [12, 4], 'row_pitch': 183, 'address': 820, 'face_row_end': 845, 'allocation_end': 4969}), ({'size': 8, 'face': 3, 'u': 3, 'v': 4, 'b': 5, 'base': 28}, {'cell_size': 10, 'atlas_width': 40, 'atlas_height': 30, 'face_cell': (1, 2), 'cell_origin': [10, 20], 'pixel_position': [14, 25], 'row_pitch': 203, 'address': 5173, 'face_row_end': 5198, 'allocation_end': 6118}), ({'size': 9, 'face': 4, 'u': 4, 'v': 5, 'b': 5, 'base': 28}, {'cell_size': 11, 'atlas_width': 44, 'atlas_height': 33, 'face_cell': (1, 1), 'cell_origin': [11, 11], 'pixel_position': [16, 17], 'row_pitch': 223, 'address': 3899, 'face_row_end': 3924, 'allocation_end': 7387}), ({'size': 10, 'face': 5, 'u': 5, 'v': 6, 'b': 5, 'base': 28}, {'cell_size': 12, 'atlas_width': 48, 'atlas_height': 36, 'face_cell': (3, 1), 'cell_origin': [36, 12], 'pixel_position': [42, 19], 'row_pitch': 243, 'address': 4855, 'face_row_end': 4880, 'allocation_end': 8776})], 5: [({'size': 6, 'face': 0, 'u': 0, 'v': 1, 'b': 6, 'base': 35}, {'cell_size': 8, 'atlas_width': 32, 'atlas_height': 24, 'face_cell': (2, 1), 'cell_origin': [16, 8], 'pixel_position': [17, 10], 'row_pitch': 195, 'address': 2087, 'face_row_end': 2123, 'allocation_end': 4715}), ({'size': 7, 'face': 1, 'u': 1, 'v': 2, 'b': 6, 'base': 35}, {'cell_size': 9, 'atlas_width': 36, 'atlas_height': 27, 'face_cell': (0, 1), 'cell_origin': [0, 9], 'pixel_position': [2, 12], 'row_pitch': 219, 'address': 2675, 'face_row_end': 2711, 'allocation_end': 5948}), ({'size': 8, 'face': 2, 'u': 2, 'v': 3, 'b': 6, 'base': 35}, {'cell_size': 10, 'atlas_width': 40, 'atlas_height': 30, 'face_cell': (1, 0), 'cell_origin': [10, 0], 'pixel_position': [13, 4], 'row_pitch': 243, 'address': 1085, 'face_row_end': 1121, 'allocation_end': 7325}), ({'size': 9, 'face': 3, 'u': 3, 'v': 4, 'b': 6, 'base': 35}, {'cell_size': 11, 'atlas_width': 44, 'atlas_height': 33, 'face_cell': (1, 2), 'cell_origin': [11, 22], 'pixel_position': [15, 27], 'row_pitch': 267, 'address': 7334, 'face_row_end': 7370, 'allocation_end': 8846}), ({'size': 10, 'face': 4, 'u': 4, 'v': 5, 'b': 6, 'base': 35}, {'cell_size': 12, 'atlas_width': 48, 'atlas_height': 36, 'face_cell': (1, 1), 'cell_origin': [12, 12], 'pixel_position': [17, 18], 'row_pitch': 291, 'address': 5375, 'face_row_end': 5411, 'allocation_end': 10511}), ({'size': 11, 'face': 5, 'u': 5, 'v': 6, 'b': 6, 'base': 35}, {'cell_size': 13, 'atlas_width': 52, 'atlas_height': 39, 'face_cell': (3, 1), 'cell_origin': [39, 13], 'pixel_position': [45, 20], 'row_pitch': 315, 'address': 6605, 'face_row_end': 6641, 'allocation_end': 12320})]}
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)
    cell_size = p["size"]+2
    atlas_width = 4*cell_size
    atlas_height = 3*cell_size
    face_cell = [(2,1),(0,1),(1,0),(1,2),(1,1),(3,1)][p["face"]]
    cell_origin = [face_cell[0]*cell_size,face_cell[1]*cell_size]
    pixel_position = [cell_origin[0]+1+p["u"],cell_origin[1]+1+p["v"]]
    row_pitch = atlas_width*p["b"]+3
    address = p["base"]+pixel_position[1]*row_pitch+pixel_position[0]*p["b"]
    face_row_end = p["base"]+(cell_origin[1]+1+p["v"])*row_pitch+(cell_origin[0]+1+p["size"])*p["b"]
    allocation_end = p["base"]+atlas_width*row_pitch
    return {'cell_size': cell_size, 'atlas_width': atlas_width, 'atlas_height': atlas_height, 'face_cell': face_cell, 'cell_origin': cell_origin, 'pixel_position': pixel_position, 'row_pitch': row_pitch, 'address': address, 'face_row_end': face_row_end, 'allocation_end': allocation_end}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'size': 2, 'face': 0, 'u': 0, 'v': 1, 'b': 2, 'base': 7}, {'cell_size': 4, 'atlas_width': 16, 'atlas_height': 12, 'face_cell': (2, 1), 'cell_origin': [8, 4], 'pixel_position': [9, 6], 'row_pitch': 35, 'address': 235, 'face_row_end': 239, 'allocation_end': 427}), ({'size': 3, 'face': 1, 'u': 1, 'v': 2, 'b': 2, 'base': 7}, {'cell_size': 5, 'atlas_width': 20, 'atlas_height': 15, 'face_cell': (0, 1), 'cell_origin': [0, 5], 'pixel_position': [2, 8], 'row_pitch': 43, 'address': 355, 'face_row_end': 359, 'allocation_end': 652}), ({'size': 4, 'face': 2, 'u': 2, 'v': 3, 'b': 2, 'base': 7}, {'cell_size': 6, 'atlas_width': 24, 'atlas_height': 18, 'face_cell': (1, 0), 'cell_origin': [6, 0], 'pixel_position': [9, 4], 'row_pitch': 51, 'address': 229, 'face_row_end': 233, 'allocation_end': 925}), ({'size': 5, 'face': 3, 'u': 3, 'v': 4, 'b': 2, 'base': 7}, {'cell_size': 7, 'atlas_width': 28, 'atlas_height': 21, 'face_cell': (1, 2), 'cell_origin': [7, 14], 'pixel_position': [11, 19], 'row_pitch': 59, 'address': 1150, 'face_row_end': 1154, 'allocation_end': 1246}), ({'size': 6, 'face': 4, 'u': 4, 'v': 5, 'b': 2, 'base': 7}, {'cell_size': 8, 'atlas_width': 32, 'atlas_height': 24, 'face_cell': (1, 1), 'cell_origin': [8, 8], 'pixel_position': [13, 14], 'row_pitch': 67, 'address': 971, 'face_row_end': 975, 'allocation_end': 1615}), ({'size': 7, 'face': 5, 'u': 5, 'v': 6, 'b': 2, 'base': 7}, {'cell_size': 9, 'atlas_width': 36, 'atlas_height': 27, 'face_cell': (3, 1), 'cell_origin': [27, 9], 'pixel_position': [33, 16], 'row_pitch': 75, 'address': 1273, 'face_row_end': 1277, 'allocation_end': 2032})], 2: [({'size': 3, 'face': 0, 'u': 0, 'v': 1, 'b': 3, 'base': 14}, {'cell_size': 5, 'atlas_width': 20, 'atlas_height': 15, 'face_cell': (2, 1), 'cell_origin': [10, 5], 'pixel_position': [11, 7], 'row_pitch': 63, 'address': 488, 'face_row_end': 497, 'allocation_end': 959}), ({'size': 4, 'face': 1, 'u': 1, 'v': 2, 'b': 3, 'base': 14}, {'cell_size': 6, 'atlas_width': 24, 'atlas_height': 18, 'face_cell': (0, 1), 'cell_origin': [0, 6], 'pixel_position': [2, 9], 'row_pitch': 75, 'address': 695, 'face_row_end': 704, 'allocation_end': 1364}), ({'size': 5, 'face': 2, 'u': 2, 'v': 3, 'b': 3, 'base': 14}, {'cell_size': 7, 'atlas_width': 28, 'atlas_height': 21, 'face_cell': (1, 0), 'cell_origin': [7, 0], 'pixel_position': [10, 4], 'row_pitch': 87, 'address': 392, 'face_row_end': 401, 'allocation_end': 1841}), ({'size': 6, 'face': 3, 'u': 3, 'v': 4, 'b': 3, 'base': 14}, {'cell_size': 8, 'atlas_width': 32, 'atlas_height': 24, 'face_cell': (1, 2), 'cell_origin': [8, 16], 'pixel_position': [12, 21], 'row_pitch': 99, 'address': 2129, 'face_row_end': 2138, 'allocation_end': 2390}), ({'size': 7, 'face': 4, 'u': 4, 'v': 5, 'b': 3, 'base': 14}, {'cell_size': 9, 'atlas_width': 36, 'atlas_height': 27, 'face_cell': (1, 1), 'cell_origin': [9, 9], 'pixel_position': [14, 15], 'row_pitch': 111, 'address': 1721, 'face_row_end': 1730, 'allocation_end': 3011}), ({'size': 8, 'face': 5, 'u': 5, 'v': 6, 'b': 3, 'base': 14}, {'cell_size': 10, 'atlas_width': 40, 'atlas_height': 30, 'face_cell': (3, 1), 'cell_origin': [30, 10], 'pixel_position': [36, 17], 'row_pitch': 123, 'address': 2213, 'face_row_end': 2222, 'allocation_end': 3704})], 3: [({'size': 4, 'face': 0, 'u': 0, 'v': 1, 'b': 4, 'base': 21}, {'cell_size': 6, 'atlas_width': 24, 'atlas_height': 18, 'face_cell': (2, 1), 'cell_origin': [12, 6], 'pixel_position': [13, 8], 'row_pitch': 99, 'address': 865, 'face_row_end': 881, 'allocation_end': 1803}), ({'size': 5, 'face': 1, 'u': 1, 'v': 2, 'b': 4, 'base': 21}, {'cell_size': 7, 'atlas_width': 28, 'atlas_height': 21, 'face_cell': (0, 1), 'cell_origin': [0, 7], 'pixel_position': [2, 10], 'row_pitch': 115, 'address': 1179, 'face_row_end': 1195, 'allocation_end': 2436}), ({'size': 6, 'face': 2, 'u': 2, 'v': 3, 'b': 4, 'base': 21}, {'cell_size': 8, 'atlas_width': 32, 'atlas_height': 24, 'face_cell': (1, 0), 'cell_origin': [8, 0], 'pixel_position': [11, 4], 'row_pitch': 131, 'address': 589, 'face_row_end': 605, 'allocation_end': 3165}), ({'size': 7, 'face': 3, 'u': 3, 'v': 4, 'b': 4, 'base': 21}, {'cell_size': 9, 'atlas_width': 36, 'atlas_height': 27, 'face_cell': (1, 2), 'cell_origin': [9, 18], 'pixel_position': [13, 23], 'row_pitch': 147, 'address': 3454, 'face_row_end': 3470, 'allocation_end': 3990}), ({'size': 8, 'face': 4, 'u': 4, 'v': 5, 'b': 4, 'base': 21}, {'cell_size': 10, 'atlas_width': 40, 'atlas_height': 30, 'face_cell': (1, 1), 'cell_origin': [10, 10], 'pixel_position': [15, 16], 'row_pitch': 163, 'address': 2689, 'face_row_end': 2705, 'allocation_end': 4911}), ({'size': 9, 'face': 5, 'u': 5, 'v': 6, 'b': 4, 'base': 21}, {'cell_size': 11, 'atlas_width': 44, 'atlas_height': 33, 'face_cell': (3, 1), 'cell_origin': [33, 11], 'pixel_position': [39, 18], 'row_pitch': 179, 'address': 3399, 'face_row_end': 3415, 'allocation_end': 5928})], 4: [({'size': 5, 'face': 0, 'u': 0, 'v': 1, 'b': 5, 'base': 28}, {'cell_size': 7, 'atlas_width': 28, 'atlas_height': 21, 'face_cell': (2, 1), 'cell_origin': [14, 7], 'pixel_position': [15, 9], 'row_pitch': 143, 'address': 1390, 'face_row_end': 1415, 'allocation_end': 3031}), ({'size': 6, 'face': 1, 'u': 1, 'v': 2, 'b': 5, 'base': 28}, {'cell_size': 8, 'atlas_width': 32, 'atlas_height': 24, 'face_cell': (0, 1), 'cell_origin': [0, 8], 'pixel_position': [2, 11], 'row_pitch': 163, 'address': 1831, 'face_row_end': 1856, 'allocation_end': 3940}), ({'size': 7, 'face': 2, 'u': 2, 'v': 3, 'b': 5, 'base': 28}, {'cell_size': 9, 'atlas_width': 36, 'atlas_height': 27, 'face_cell': (1, 0), 'cell_origin': [9, 0], 'pixel_position': [12, 4], 'row_pitch': 183, 'address': 820, 'face_row_end': 845, 'allocation_end': 4969}), ({'size': 8, 'face': 3, 'u': 3, 'v': 4, 'b': 5, 'base': 28}, {'cell_size': 10, 'atlas_width': 40, 'atlas_height': 30, 'face_cell': (1, 2), 'cell_origin': [10, 20], 'pixel_position': [14, 25], 'row_pitch': 203, 'address': 5173, 'face_row_end': 5198, 'allocation_end': 6118}), ({'size': 9, 'face': 4, 'u': 4, 'v': 5, 'b': 5, 'base': 28}, {'cell_size': 11, 'atlas_width': 44, 'atlas_height': 33, 'face_cell': (1, 1), 'cell_origin': [11, 11], 'pixel_position': [16, 17], 'row_pitch': 223, 'address': 3899, 'face_row_end': 3924, 'allocation_end': 7387}), ({'size': 10, 'face': 5, 'u': 5, 'v': 6, 'b': 5, 'base': 28}, {'cell_size': 12, 'atlas_width': 48, 'atlas_height': 36, 'face_cell': (3, 1), 'cell_origin': [36, 12], 'pixel_position': [42, 19], 'row_pitch': 243, 'address': 4855, 'face_row_end': 4880, 'allocation_end': 8776})], 5: [({'size': 6, 'face': 0, 'u': 0, 'v': 1, 'b': 6, 'base': 35}, {'cell_size': 8, 'atlas_width': 32, 'atlas_height': 24, 'face_cell': (2, 1), 'cell_origin': [16, 8], 'pixel_position': [17, 10], 'row_pitch': 195, 'address': 2087, 'face_row_end': 2123, 'allocation_end': 4715}), ({'size': 7, 'face': 1, 'u': 1, 'v': 2, 'b': 6, 'base': 35}, {'cell_size': 9, 'atlas_width': 36, 'atlas_height': 27, 'face_cell': (0, 1), 'cell_origin': [0, 9], 'pixel_position': [2, 12], 'row_pitch': 219, 'address': 2675, 'face_row_end': 2711, 'allocation_end': 5948}), ({'size': 8, 'face': 2, 'u': 2, 'v': 3, 'b': 6, 'base': 35}, {'cell_size': 10, 'atlas_width': 40, 'atlas_height': 30, 'face_cell': (1, 0), 'cell_origin': [10, 0], 'pixel_position': [13, 4], 'row_pitch': 243, 'address': 1085, 'face_row_end': 1121, 'allocation_end': 7325}), ({'size': 9, 'face': 3, 'u': 3, 'v': 4, 'b': 6, 'base': 35}, {'cell_size': 11, 'atlas_width': 44, 'atlas_height': 33, 'face_cell': (1, 2), 'cell_origin': [11, 22], 'pixel_position': [15, 27], 'row_pitch': 267, 'address': 7334, 'face_row_end': 7370, 'allocation_end': 8846}), ({'size': 10, 'face': 4, 'u': 4, 'v': 5, 'b': 6, 'base': 35}, {'cell_size': 12, 'atlas_width': 48, 'atlas_height': 36, 'face_cell': (1, 1), 'cell_origin': [12, 12], 'pixel_position': [17, 18], 'row_pitch': 291, 'address': 5375, 'face_row_end': 5411, 'allocation_end': 10511}), ({'size': 11, 'face': 5, 'u': 5, 'v': 6, 'b': 6, 'base': 35}, {'cell_size': 13, 'atlas_width': 52, 'atlas_height': 39, 'face_cell': (3, 1), 'cell_origin': [39, 13], 'pixel_position': [45, 20], 'row_pitch': 315, 'address': 6605, 'face_row_end': 6641, 'allocation_end': 12320})]}
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.

Six square cube faces occupy stipulated cells of a 4x3 atlas cross: [(2,1),(0,1),(1,0),(1,2),(1,1),(3,1)]. Every cell has a one-texel gutter and atlas rows end with a three-byte guard. Face sampling is storage addressing only. 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 = max(1,p["w"]//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*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"]
    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*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 chroma_width.

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 = max(1,p["h"]//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*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"]
    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*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 chroma_height.

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