@geastack/engine 0.1.6 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/image_store.cpp CHANGED
@@ -2,8 +2,35 @@
2
2
  #include "image.h"
3
3
  #include "memory.h"
4
4
  #include "pixel.h"
5
+ #include "gea_perf_config.h"
5
6
 
6
7
  #include <cstring>
8
+ #include <limits>
9
+
10
+ #if GEA_EMBEDDED_PERF && defined(ESP_PLATFORM)
11
+ #include "esp_timer.h"
12
+ #include <atomic>
13
+ #include <cstdio>
14
+ #endif
15
+
16
+ // Baseline JPEGs can stream from the S3 ROM decoder directly into native
17
+ // pixels. Keep unsupported JPEG variants on stb's general-purpose path.
18
+ #ifdef ESP_PLATFORM
19
+ #include "sdkconfig.h"
20
+ #endif
21
+ #if !defined(GEA_EMBEDDED_ROM_TJPGD) && defined(ESP_PLATFORM) && defined(CONFIG_IDF_TARGET_ESP32S3)
22
+ #define GEA_EMBEDDED_ROM_TJPGD 1
23
+ #endif
24
+
25
+ // A linked esp_new_jpeg component supplies the S3 SIMD decoder. It writes
26
+ // straight to native RGB565; other pixel formats keep the ROM/stb paths.
27
+ #if !defined(GEA_EMBEDDED_ESP_JPEG) && defined(ESP_PLATFORM) && \
28
+ GEA_EMBEDDED_PIXEL_FORMAT == GEA_PIXEL_RGB565 && __has_include("esp_jpeg_dec.h")
29
+ #define GEA_EMBEDDED_ESP_JPEG 1
30
+ #endif
31
+ #if defined(GEA_EMBEDDED_ESP_JPEG) && GEA_EMBEDDED_ESP_JPEG && GEA_EMBEDDED_PIXEL_FORMAT == GEA_PIXEL_RGB565
32
+ #include "esp_jpeg_dec.h"
33
+ #endif
7
34
 
8
35
  // Route stb_image's allocations through the framework allocator (PSRAM-first
9
36
  // on embedded targets). Plain malloc would land on the tiny SRAM newlib heap
@@ -50,12 +77,16 @@ void *gea_stbi_realloc_sized(void *ptr, std::size_t oldSize, std::size_t newSize
50
77
  #include "stb_image.h"
51
78
 
52
79
  #if defined(GEA_EMBEDDED_ROM_TJPGD) && GEA_EMBEDDED_ROM_TJPGD
53
- // ESP32 ROM TinyJPEG decompressor. Block-streaming with a small work pool and
54
- // 1/2–1/8 descaling, so a full-page cover decodes in a few KB of scratch instead
55
- // of stb_image's several MB of large contiguous buffers (which the reader's
56
- // fragmented PSRAM cannot satisfy).
80
+ // The ROM emits one RGB888 MCU at a time, not a full-frame RGB(A) buffer.
81
+ #if defined(CONFIG_IDF_TARGET_ESP32S3)
82
+ #include "esp32s3/rom/tjpgd.h"
83
+ #else
57
84
  #include "esp32/rom/tjpgd.h"
58
85
  #endif
86
+ #ifdef ESP_PLATFORM
87
+ #include "esp_heap_caps.h"
88
+ #endif
89
+ #endif
59
90
 
60
91
  #include "AnimatedGIF.h"
61
92
 
@@ -339,6 +370,73 @@ int ImageStore::decodeGif(ImageSlot &image, const std::uint8_t *data, int length
339
370
  return -1;
340
371
  }
341
372
 
373
+ #if defined(GEA_EMBEDDED_ESP_JPEG) && GEA_EMBEDDED_ESP_JPEG && GEA_EMBEDDED_PIXEL_FORMAT == GEA_PIXEL_RGB565
374
+ int ImageStore::decodeJpegEsp(ImageSlot &image, const std::uint8_t *data, int length)
375
+ {
376
+ #if GEA_EMBEDDED_PERF && defined(ESP_PLATFORM)
377
+ static std::atomic<unsigned> sampleSequence{0};
378
+ const bool measure = sampleSequence.fetch_add(1, std::memory_order_relaxed) % 10 == 0;
379
+ const std::int64_t started = measure ? esp_timer_get_time() : 0;
380
+ #endif
381
+ const auto result = [&](jpeg_error_t rc, const char *stage) {
382
+ #if GEA_EMBEDDED_PERF && defined(ESP_PLATFORM)
383
+ if (measure) std::printf("[jpeg-esp] rc=%d stage=%s size=%dx%d total_us=%lld fallback=%s\n",
384
+ static_cast<int>(rc), stage, image.width, image.height,
385
+ static_cast<long long>(esp_timer_get_time() - started), rc == JPEG_ERR_OK ? "no" : "yes");
386
+ #else
387
+ (void)stage;
388
+ #endif
389
+ return rc == JPEG_ERR_OK ? 0 : -1;
390
+ };
391
+ struct Decoder {
392
+ jpeg_dec_handle_t handle = nullptr;
393
+ ~Decoder() { if (handle) jpeg_dec_close(handle); }
394
+ } decoder;
395
+ jpeg_dec_config_t config = DEFAULT_JPEG_DEC_CONFIG();
396
+ #if GEA_EMBEDDED_PIXEL_PANEL_ENDIAN
397
+ config.output_type = JPEG_PIXEL_FORMAT_RGB565_BE;
398
+ #else
399
+ config.output_type = JPEG_PIXEL_FORMAT_RGB565_LE;
400
+ #endif
401
+ // Plain whole-image decode supports arbitrary dimensions, including 410x502.
402
+ // Block mode, rotation and resize have stricter alignment requirements.
403
+ jpeg_error_t rc = jpeg_dec_open(&config, &decoder.handle);
404
+ if (rc != JPEG_ERR_OK) return result(rc, "open");
405
+ jpeg_dec_io_t io{};
406
+ io.inbuf = const_cast<std::uint8_t *>(data);
407
+ io.inbuf_len = length;
408
+ jpeg_dec_header_info_t info{};
409
+ rc = jpeg_dec_parse_header(decoder.handle, &io, &info);
410
+ if (rc != JPEG_ERR_OK) return result(rc, "header");
411
+ if (!info.width || !info.height || static_cast<std::size_t>(info.width) >
412
+ static_cast<std::size_t>(std::numeric_limits<int>::max()) / sizeof(pixel::native_t) / info.height)
413
+ return result(JPEG_ERR_INVALID_PARAM, "dimensions");
414
+ const std::size_t count = static_cast<std::size_t>(info.width) * info.height;
415
+ const int byteCount = static_cast<int>(count * sizeof(pixel::native_t));
416
+ int outputBytes = 0;
417
+ rc = jpeg_dec_get_outbuf_len(decoder.handle, &outputBytes);
418
+ if (rc != JPEG_ERR_OK) return result(rc, "buffer-size");
419
+ if (outputBytes != byteCount) return result(JPEG_ERR_INVALID_PARAM, "buffer-size");
420
+ auto *pixels = ImageMemory::allocate<pixel::native_t>(count);
421
+ if (!pixels) return result(JPEG_ERR_NO_MEM, "allocation");
422
+ io.outbuf = reinterpret_cast<std::uint8_t *>(pixels);
423
+ rc = jpeg_dec_process(decoder.handle, &io);
424
+ if (rc != JPEG_ERR_OK || io.out_size != byteCount) {
425
+ ImageMemory::release(pixels);
426
+ return result(rc == JPEG_ERR_OK ? JPEG_ERR_BAD_DATA : rc, "decode");
427
+ }
428
+ image.width = info.width;
429
+ image.height = info.height;
430
+ image.frameCount = 1;
431
+ image.pixels = pixels;
432
+ image.ownsPixels = true;
433
+ image.alpha = nullptr;
434
+ image.loopCount = 0;
435
+ image.playing = false;
436
+ return result(JPEG_ERR_OK, "decode");
437
+ }
438
+ #endif
439
+
342
440
  #if defined(GEA_EMBEDDED_ROM_TJPGD) && GEA_EMBEDDED_ROM_TJPGD
343
441
  namespace {
344
442
  // Shared input+output context for one ROM-tjpgd session (jd->device carries it
@@ -363,10 +461,13 @@ UINT geaTjpgdInput(JDEC *jd, BYTE *buf, UINT nbyte)
363
461
  return static_cast<UINT>(take);
364
462
  }
365
463
 
366
- // Receive a decoded RGB888 block and write it (as luma) into the native buffer.
464
+ // Convert each MCU directly into the final image. Preserve colour and source
465
+ // dimensions: image loading must not silently resize a 502px-high video frame.
367
466
  UINT geaTjpgdOutput(JDEC *jd, void *bitmap, JRECT *rect)
368
467
  {
369
468
  auto *c = static_cast<TjpgdCtx *>(jd->device);
469
+ if (!bitmap || rect->left > rect->right || rect->top > rect->bottom ||
470
+ rect->right >= c->outW || rect->bottom >= c->outH) return 0;
370
471
  const std::uint8_t *rgb = static_cast<const std::uint8_t *>(bitmap);
371
472
  for (int y = rect->top; y <= rect->bottom; y++) {
372
473
  for (int x = rect->left; x <= rect->right; x++) {
@@ -374,48 +475,49 @@ UINT geaTjpgdOutput(JDEC *jd, void *bitmap, JRECT *rect)
374
475
  const std::uint8_t g = rgb[1];
375
476
  const std::uint8_t b = rgb[2];
376
477
  rgb += 3;
377
- if (x < c->outW && y < c->outH) {
378
- const std::uint8_t lum = static_cast<std::uint8_t>((r * 77 + g * 150 + b * 29) >> 8);
379
- c->out[y * c->outW + x] = rgbaToNative(lum, lum, lum, 255);
380
- }
478
+ c->out[static_cast<std::size_t>(y) * c->outW + x] = rgbaToNative(r, g, b, 255);
381
479
  }
382
480
  }
383
481
  return 1;
384
482
  }
385
483
  } // namespace
386
484
 
387
- // Decode a (large) JPEG with the ROM tinyjpeg decompressor, descaling so the
388
- // output fits the panel. Returns 0 on success (fills `image`), -1 otherwise.
485
+ // Decode at the source dimensions with bounded scratch plus the native image.
389
486
  int ImageStore::decodeJpegTjpgd(ImageSlot &image, const std::uint8_t *data, int length)
390
487
  {
391
488
  TjpgdCtx ctx{data, static_cast<std::size_t>(length), 0, nullptr, 0, 0};
392
- // Work pool for the huffman/quant tables + one-MCU scratch. Generous and
393
- // PSRAM-backed so jd_prepare never fails for lack of pool.
394
- const std::size_t poolSize = 64 * 1024;
395
- void *pool = memory::Allocator::allocatePreferSpiram(poolSize, alignof(std::max_align_t));
489
+
490
+ // Keep the frequently accessed Huffman/quant tables in internal memory when
491
+ // available. Allocation is per decode and falls back to PSRAM under pressure.
492
+ constexpr std::size_t poolSize = 8 * 1024;
493
+ void *pool = nullptr;
494
+ #ifdef ESP_PLATFORM
495
+ pool = heap_caps_malloc(poolSize, MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
496
+ #endif
497
+ if (!pool) pool = memory::Allocator::allocatePreferSpiram(poolSize, alignof(std::max_align_t));
396
498
  if (!pool) return -1;
397
- JDEC jd;
398
- if (jd_prepare(&jd, geaTjpgdInput, pool, poolSize, &ctx) != JDR_OK) {
499
+ JDEC jd{};
500
+ const JRESULT prepareRc = jd_prepare(&jd, geaTjpgdInput, pool, poolSize, &ctx);
501
+ if (prepareRc != JDR_OK) {
399
502
  memory::Allocator::free(pool);
400
503
  return -1;
401
504
  }
402
- // Descale by powers of two until both axes sit at/under the panel's long
403
- // side; a grayscale e-paper contain-fitting the result shows no visible loss.
404
- int scale = 0;
405
- while (((static_cast<int>(jd.width) >> scale) > 480 || (static_cast<int>(jd.height) >> scale) > 480) && scale < 3) scale++;
406
- ctx.outW = static_cast<int>(jd.width) >> scale;
407
- ctx.outH = static_cast<int>(jd.height) >> scale;
408
- if (ctx.outW <= 0 || ctx.outH <= 0) {
505
+ if (jd.width == 0 || jd.height == 0 ||
506
+ jd.width > static_cast<UINT>(std::numeric_limits<int>::max()) ||
507
+ jd.height > static_cast<UINT>(std::numeric_limits<int>::max()) ||
508
+ static_cast<std::size_t>(jd.width) > std::numeric_limits<std::size_t>::max() / sizeof(pixel::native_t) / jd.height) {
409
509
  memory::Allocator::free(pool);
410
510
  return -1;
411
511
  }
512
+ ctx.outW = static_cast<int>(jd.width);
513
+ ctx.outH = static_cast<int>(jd.height);
412
514
  auto *px = ImageMemory::allocate<pixel::native_t>(static_cast<std::size_t>(ctx.outW) * ctx.outH);
413
515
  if (!px) {
414
516
  memory::Allocator::free(pool);
415
517
  return -1;
416
518
  }
417
519
  ctx.out = px;
418
- const JRESULT rc = jd_decomp(&jd, geaTjpgdOutput, static_cast<BYTE>(scale));
520
+ const JRESULT rc = jd_decomp(&jd, geaTjpgdOutput, 0);
419
521
  memory::Allocator::free(pool);
420
522
  if (rc != JDR_OK) {
421
523
  ImageMemory::release(px);
@@ -462,16 +564,17 @@ int ImageStore::decodeStatic(ImageSlot &image, const std::uint8_t *data, int len
462
564
  return 0;
463
565
  }
464
566
 
567
+ #if defined(GEA_EMBEDDED_ESP_JPEG) && GEA_EMBEDDED_ESP_JPEG && GEA_EMBEDDED_PIXEL_FORMAT == GEA_PIXEL_RGB565
568
+ if (detectFormat(data, length) == ImageFormat::Jpeg) {
569
+ if (decodeJpegEsp(image, data, length) == 0) return 0;
570
+ }
571
+ #endif
572
+
465
573
  #if defined(GEA_EMBEDDED_ROM_TJPGD) && GEA_EMBEDDED_ROM_TJPGD
466
- // Large JPEGs (covers/photos) go through the low-memory ROM decoder. Small
467
- // JPEGs keep the stb path (its fixed cost is fine and avoids the pool alloc).
574
+ // JPEG has no alpha; both loadBytes and loadBytesOpaque can use the native
575
+ // streaming path. Unsupported encodings (e.g. progressive) fall back to stb.
468
576
  if (detectFormat(data, length) == ImageFormat::Jpeg) {
469
- int jw = 0, jh = 0, jc = 0;
470
- if (stbi_info_from_memory(data, length, &jw, &jh, &jc) && static_cast<long long>(jw) * jh > 200000) {
471
- const int rc = decodeJpegTjpgd(image, data, length);
472
- if (rc == 0) return 0;
473
- // Fall through to stb on tjpgd failure (best-effort).
474
- }
577
+ if (decodeJpegTjpgd(image, data, length) == 0) return 0;
475
578
  }
476
579
  #endif
477
580
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geastack/engine",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "GeaStack rendering engine, intrinsic JSX primitives, and native engine backends.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -57,6 +57,7 @@
57
57
  },
58
58
  "sideEffects": false,
59
59
  "dependencies": {
60
- "@geastack/core": "^0.1.26"
61
- }
60
+ "@geastack/core": "^0.1.30"
61
+ },
62
+ "gitHead": "e375eddd8f725d7cc5de3fd46baca63e35936027"
62
63
  }
@@ -0,0 +1,261 @@
1
+ # Automatic CSS specialization
2
+
3
+ The compiler plugin reports CSS families reachable from application source, imported
4
+ stylesheets and dynamic style operations. The CLI combines this with native-source
5
+ usage before generating consistent engine and application definitions. Missing or
6
+ opaque analysis retains support. Applications need no feature switches.
7
+
8
+ The first families are transforms/perspective, grid, floats, writing modes/direction
9
+ and relief borders. Per-property analysis also omits unused blink timing, flex/grid
10
+ order, and percentage representations for gaps and corner radii. Dynamic values
11
+ retain the representations they can reach. Missing/older analysis retains defaults;
12
+ the CLI requires v2 before specializing those representations. The v3 facts also
13
+ omit unused opacity, text decoration/transformation, visibility, pointer-events,
14
+ masking and object-fit fields. Attribute-driven native animations and opaque native
15
+ CSS APIs retain support conservatively. Removing a family removes its per-node state and allows the
16
+ optimizer to discard its paths. Ordinary borders and border-box sizing stay usable.
17
+ The v4 facts additionally remove unused filters, box shadows, flex wrapping,
18
+ justify-items, align-content/self, min-width and deferred height expressions.
19
+ Logical size properties, unknown values and native CSS mutation retain the relevant
20
+ families. Shared CSS length parsing stays outside the transform-only guards;
21
+ font-size, padding and min/max sizes must work with transforms absent.
22
+ Renderer cache analysis separately removes unused persistent caches while retaining
23
+ uncached rendering paths.
24
+
25
+ Empty nodes store a four-byte text handle. Nonempty labels own independent strings
26
+ in stable pages of 16 records; releasing a label destroys its character buffer and
27
+ reuses the record. Pool pages retain their high-water capacity and prefer PSRAM on
28
+ ESP32. NodeText::storageBytes reports allocated pool payload, including spare records
29
+ and the page map, but excludes long string buffers and allocator metadata.
30
+
31
+ The pedal's linked S3 ELF measures 220-byte nodes and a 39,472-byte TreeState
32
+ for 160 slots, versus 400 and 68,272 with engine 0.1.6. Node members remain
33
+ naturally aligned direct fields; absent properties become compile-time constants.
34
+ The width probe still emits one S3 load, with no accessor or pool lookup. Total UI memory includes the
35
+ text pool and other allocations; these are not device heap or timing measurements.
36
+
37
+ Native applications that only inspect the mounted tree can include
38
+ ui/tree_inspection.h. Mutable UI headers conservatively retain all CSS families.
39
+
40
+ The common border color's binding flags occupy existing ComputedStyle alignment
41
+ padding, so an ordinary literal colored border does not allocate RareStyle.
42
+ Per-side color payloads remain sparse. In the S3 specialization, RareStyle is
43
+ 128 bytes (336 in the registry baseline). The native regression checks
44
+ both the primitive binding and the CSS shorthand/side-color/currentColor path.
45
+ These record sizes exclude the pool allocator's block and bookkeeping overhead.
46
+
47
+ The optional node record's style overrides share storage between inline entries
48
+ and overflow metadata, which are mutually exclusive. On S3 each override store
49
+ falls from 48 to 36 bytes and NodeRareData from 280 to 256 bytes. Its access
50
+ function has the same instruction sequence, with changed offsets only. Copies,
51
+ moves, overflow growth, removal and reuse retain their previous semantics.
52
+
53
+ Optional records now use an owning pointer table: record addresses remain stable
54
+ across growth and freed records are reused. This avoids deque indexing becoming
55
+ more expensive when a smaller record crosses a block-size threshold. The linked
56
+ S3 lookup is 52 bytes versus 90 before the pointer-table follow-up, with fewer loads/branches;
57
+ that is an assembly observation, not a device timing measurement. Allocations
58
+ include the record payloads, spare pointer-table capacity, reuse list, nested
59
+ containers and allocator overhead; record sizeof alone is not total heap use.
60
+
61
+ An allocator-level macOS regression compares the installed registry engine and the
62
+ candidate across six phases of a 49-node fixture. It sums all malloc zones, counting
63
+ nested containers, long text buffers, spare capacity and allocator rounding. The
64
+ attribute/listener/inline-style phase saves 68,576 allocated bytes; releasing long
65
+ labels saves 83,936 against the registry engine, which retains string capacity.
66
+ Pixels match in all phases. These totals include host framework state and are not
67
+ S3 heap readings or a whole-pedal workload. The test requires explicit reference
68
+ and candidate package paths and is intentionally separate from ordinary host checks.
69
+
70
+ Expanded class-rule coverage exposed a transform guard that had accidentally
71
+ removed shared length parsing in the earlier development candidates. The current
72
+ candidate corrects it and tests font-size, line-height and min/max/box edges with
73
+ transforms disabled. Earlier 288/260/252-byte development artifacts are superseded
74
+ and must not be treated as broadly behavior-qualified release candidates.
75
+
76
+ Grouping the existing byte-sized paint flags removes four alignment bytes from
77
+ ComputedStyle without bitfields or packed/unaligned members. S3 width and colour
78
+ probes remain single aligned loads (l16si/l16ui). ComputedStyle is 120 bytes;
79
+ linked firmware is 3,125,088 bytes versus 3,224,448 for the registry baseline.
80
+ The host allocator census savings remain unchanged because of host layout and
81
+ allocation rounding; do not add the S3 sizeof reduction to that host result.
82
+
83
+ The v5 analyzer additionally specializes z-index, aspect-ratio, margin-trim,
84
+ containment, justify-self, flex-line-count and deferred margin/padding expressions.
85
+ Unknown/dynamic values retain the required representation. Fixed pixel box edges
86
+ keep ordinary layout behavior without expression arrays or resolver calls. All
87
+ versions before v5 retain these newer fields. Grid's authored-template and layout
88
+ bookkeeping is also omitted from NodeRareData when grid is unreachable.
89
+
90
+ For the pedal this leaves Node at 232 bytes, while RareStyle falls from 176 to
91
+ 128 bytes and NodeRareData from 256 to 244 bytes. The linked firmware is 3,114,768
92
+ bytes. Host allocator savings in the 49-node fixture remain unchanged: that
93
+ fixture does not allocate rare styles, and the smaller optional records remain
94
+ in the same host allocation size class. Device allocation effects must be measured.
95
+
96
+
97
+ The source analyzer now resolves the narrow colour-only custom-property case
98
+ across all discovered files before retaining gradient caches. A whole-value
99
+ `var(--name)` can omit those caches only when every visible declaration is a
100
+ literal colour and every fallback is also a literal colour. Missing definitions,
101
+ variable aliases, compound backgrounds, interpolated CSS, opaque writes/imports
102
+ and native CSS mutation retain the caches. Custom-property names stay
103
+ case-sensitive; ordinary CSS property names do not. This adds build-time analysis,
104
+ not runtime field access or decoding. The focused analyzer has 122 passing cases;
105
+ cached/uncached native pixels and geometry match, with cache storage absent in
106
+ the pruned binary. The pedal image falls a further 4,368 bytes to 3,110,400, and
107
+ static PSRAM falls another 5,168 bytes. Node stays 232 bytes.
108
+
109
+ Hardware qualification is still open. On the connected S3, the preceding
110
+ `candidate-sizing` increased maintenance free PSRAM by a median 190,556 bytes
111
+ and free internal SRAM by 512 bytes versus the registry build. The PSRAM change
112
+ includes a 131,072-byte reduction in mapped code/rodata pages and a 25,952-byte
113
+ static-BSS reduction; it must not be described as isolated UI-tree allocation.
114
+ Two registry audio windows (45 seconds, A2-Full, amp and all six effects enabled)
115
+ had zero deadline misses. The sizing candidate had 55/1 and 0/2 misses on the two
116
+ stages. It therefore fails audio qualification despite the memory savings. The
117
+ colour-cache candidate needs its own measurements. No new package is published.
118
+
119
+
120
+ Hardware follow-up: the colour-cache candidate's two stage-B misses were traced
121
+ to the audio test's full task census. ESP-IDF scanned PSRAM task stacks while
122
+ holding its scheduler lock for 2,200/1,792 us. Reading only persistent task
123
+ metadata without stack scans reduces this to 114/112 us; DSP counters are now
124
+ captured before shutdown diagnostics. Two corrected 45-second windows report
125
+ 0/0 deadline misses and zero USB transfer errors. The resulting development
126
+ image is 3,110,736 bytes, and maintenance free PSRAM rises by a five-sample median
127
+ 195,640 bytes versus registry. DSP stage time is essentially unchanged. The
128
+ previous sizing image's 55 core-0 misses remain a rejected result; this does not
129
+ retroactively qualify it. No sample-by-sample device audio or busy-UI equivalence
130
+ is claimed, and no further package has been published. The maintained pedal
131
+ report is docs/UI_MEMORY_OPTIMIZATION.md; raw measurements are in its
132
+ build/css-feature-audit/device-node-compaction-comparison.json.
133
+
134
+
135
+ The v6 facts distinguish independent row/column gaps and independent corner
136
+ radii. Uniform literal radii use one aligned int16 field; all rendering indices
137
+ become the compile-time constant zero. Uniform gaps omit the unused axis fields.
138
+ Unknown values/functions and individual longhands keep the full representation,
139
+ and percentage storage remains independent. The S3 node becomes 220 bytes and
140
+ TreeState 39,472 bytes. Direct loads are preserved; a dynamic corner read loses
141
+ its index arithmetic. Five board samples show 1,964 additional free PSRAM bytes
142
+ versus the 232-byte checkpoint; the host allocator rounds to the same size class.
143
+ Uniform radii also emit one style write/cache entry instead of four; class-rule
144
+ cascade and inline removal are compared across full and pruned configurations.
145
+
146
+ The radius-write follow-up reduces the firmware another 496 bytes to 3,108,992.
147
+ Seven native configurations match across eighteen pixel/geometry frames; plain
148
+ and rounded allocator fixtures match registry pixels with no additional host
149
+ allocated-byte savings. The final image has 4,027,832 median free PSRAM bytes
150
+ (+197,608 versus registry), with the extra four bytes versus uniform fields
151
+ inside measurement noise. A 45-second steady full-chain run and a 90-second
152
+ real-touch soak both report zero DSP misses and USB errors. Steady DSP times
153
+ remain about 1,154/1,194 us; matched touch repaint times are broadly unchanged.
154
+ The soak's legacy panel points exercise a subset and toggle the amp/effects;
155
+ its quiet-time heuristic can miss delayed paints. Full-CSS WASM and pedal host
156
+ checks pass. This remains an unpublished checkpoint toward the original goal,
157
+ not proof of hardware sample equality or a final registry-only package build.
158
+
159
+
160
+ The combined storage work keeps computed style, layout and render fields direct.
161
+ It replaces seven listener vectors with one tagged collection, right-sizes
162
+ attribute payloads, allocates override blocks and virtual-list state only when
163
+ needed, and shares the valid result dimensions of the two layout memo entries.
164
+ The linked S3 checkpoint has a 212-byte Node and a 72-byte optional record.
165
+ A repeated device UI soak exposed a startup/buffer-disruption concern; it is
166
+ not release-qualified. See the pedal report for the negative measurements.
167
+
168
+ Analyzer v8 adds automatic side-border, background-layer and line-height-expression
169
+ specialization. Proven uniform borders need no per-side storage or rare-style
170
+ lookup; plain colors need no clip/placement/layer-count fields. Whole-value color
171
+ variables use the same conservative proof as gradient-cache analysis. Relative
172
+ line heights, non-flat backgrounds, side longhands, unknown values and opaque
173
+ native CSS retain their support. Old analyzers cannot remove these new fields.
174
+ The fully pruned native fixture has a 4-byte RareStyle (deferred flex basis only).
175
+
176
+ Custom-property records now reuse the stable immutable string already stored in
177
+ the CSS atom table, without a second string allocation or reference-count control
178
+ block for interned values. If the table is full, an owned shared string preserves
179
+ the exact value. Copies, mutation, empty values, cached color/length fields and
180
+ self-assignment after atom exhaustion are exercised. This changes cold variable
181
+ storage, not direct computed-style field reads. Total allocated bytes, including
182
+ fallbacks, are measured separately from record sizes.
183
+
184
+
185
+ Analyzer v9 retains scrolling for scrollable/unknown overflow, scroll controls,
186
+ local background attachment, native lists/inputs, dynamic or escaped element
187
+ factories and opaque CSS/native writes. A proven non-scrolling app keeps clipping
188
+ but omits six 32-bit scroll geometry fields, the scroll-dirty byte, child-extent
189
+ walks and pre-layout offset snapshots. Byte flags are grouped before aligned
190
+ colors/bounds, without bitfields or field accessors. Default/older-analyzer
191
+ builds retain scrolling and its 32-bit large-list coordinates. The native
192
+ full/pruned matrix compares hidden/clip/visible overflow through updates; a
193
+ separate retained-scroll regression checks scrollIntoView and offset changes.
194
+
195
+
196
+ Analyzer v10 separately proves deferred flex bases and custom-property length
197
+ caches unused. Fixed pixel/numeric bases retain direct scalar storage; relative
198
+ units, percentages, functions and unknown values retain expressions. Color-only
199
+ or quoted-text custom properties need no parsed length fields. Other values,
200
+ older analyzers and opaque native mutation retain them. This is automatic.
201
+
202
+ When every rare family is absent, RareStyle has no instance fields: nodes carry
203
+ no rare-style handle and allocate no rare-style pool, including inline builds.
204
+ An emptiness assertion prevents a newly added unguarded field from silently
205
+ escaping the family list. Unused scrolling also removes tree-level dirty words,
206
+ pending-scroll state and the optional virtual-list pointer. Reordering the two
207
+ atom IDs removes padding from custom-property records in full builds too.
208
+ These changes preserve direct hot-field reads; allocation and target measurements
209
+ remain separate from sizeof results.
210
+
211
+
212
+ Analyzer v11 adds maximum-height, scalar flex-basis and independent overflow-axis
213
+ proofs. Maximum-height declarations and logical maximum sizes retain their field;
214
+ explicit/unknown flex bases retain the scalar basis. Uniform overflow shorthands
215
+ share the existing aggregate field; longhands, unequal/unknown values and native
216
+ inputs/lists retain separate axes. The existing overflow helpers then compile to
217
+ one direct read instead of coupling two axes at runtime. Gradient-only `bg_fill`
218
+ and unused transform-scan cache state follow their existing feature proofs.
219
+ The pedal's chain UI uses max-height, so that field remains present automatically.
220
+
221
+
222
+ The separate `css-ranges-v1` proof selects byte storage for nonnegative padding,
223
+ gap, border width/radius, font size, resolved line height and flex factors.
224
+ Numeric values and CSS pixel lengths have separate bounds; the CLI applies the
225
+ actual layout pixel ratio before choosing a type. Inheritance, native defaults,
226
+ unitless line heights and 255/256 boundaries are included. Missing or unknown
227
+ proof, dynamic styles, relative units, animation, runtime scale changes and
228
+ opaque native mutation retain 16-bit fields. These are generated build facts,
229
+ not application opt-ins. Grouped byte fields retain ordinary direct loads;
230
+ there is no pointer lookup, bitfield unpacking or per-read range check.
231
+
232
+ Source discovery uses TypeScript syntax trees for imports, exports and literal
233
+ module calls. A leading side-effect stylesheet import must not disappear when
234
+ followed by another import/export. Computed or malformed module boundaries
235
+ retain the conservative feature set. The pedal's 65px root radius is therefore
236
+ included in the range proof before its 2x layout scale is applied.
237
+
238
+
239
+ ## Native node payload reachability
240
+
241
+ The independent `node-analysis-v1` fact set selects image nodes and native text
242
+ inputs from the complete discovered source graph. The CLI generates
243
+ `GEA_UI_IMAGE_NODES` and `GEA_UI_INPUT_NODES`; neither is an application opt-in.
244
+ Older analyzers, unresolved imports, dynamic element factories, opaque markup
245
+ and native UI mutation retain support. Literal tags are case-insensitive, as in
246
+ `Document::createElement`. CSS background images remain a separate renderer
247
+ feature, and custom button keyboards do not require native input/caret state.
248
+
249
+ An image-free build has no per-node image handle. An input-free build has no
250
+ focus/caret fields or native keyboard implementation. A scroll-free build omits
251
+ both scroll-dirty flags. Absent fields are compile-time constants; hot retained
252
+ style and layout fields remain embedded and directly readable. The native test
253
+ matrix exercises image/input support independently of each other and of CSS,
254
+ including positive image painting and input focus/caret behavior when enabled.
255
+
256
+ For the pedal, the linked S3 records are Node 160 B, ComputedStyle 88 B,
257
+ LayoutBox 38 B, RenderState 14 B and TreeState 29,816 B for 160 slots. Compared
258
+ with the preceding 164-byte candidate, this saves 648 B in TreeState and
259
+ 11,664 B of firmware. The 49-node host allocation fixture is unchanged because
260
+ of allocator rounding; these record reductions are not a host heap saving.
261
+ This remains a development checkpoint, not a 50-byte node or a 60 fps guarantee.