Skip to content

armgit / BUI

Public Imported from GitHub
0

Blender's GPU Accelerated UI, Decoupled from it's original codebase. Supports Rust, Python, JS, React, C & C++. Twice as good as GPUI

video docs

Preetham Pemmasani3212f8f2e1f3
diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md
index e9cbd14..3bf7b0b 100644
--- a/ARCHITECTURE.md
+++ b/ARCHITECTURE.md
@@ -119,6 +119,21 @@ unused. Animated images (`kit/intern/image/anim.c`, `play.c`) are decoded a
frame at a time on the workers and advance on the context's frame timer,
shared with custom nodes (`bk_ctx_arm_timer`), only while on screen.
+Video uses the same path: one codec interface (`BKImAnimCodec`: open, output
+size, next, seek, close) for GIF, WebP and the OS movie backends
+(`movie_mf.c` Media Foundation, `movie_gst.c` GStreamer, `movie_avf.m`
+AVFoundation; loaded at run time), one clock (`play.c`), and private cache
+entries per player (`video.c`). Frames are NV12 pixmaps
+(`BUI_PIXMAP_NV12_*`) at the size drawn, two per player reused; a pixmap's
+`stream` keeps one GPU texture pair per player, updated in place, converted
+to RGB in the shader (the software raster converts what it draws).
+
+The optional parts (image formats, video, the GPU renderers, FreeType, the
+file browser, Dear ImGui) are one table, `features.json`, read by CMake
+(`features.cmake`), cargo (`blenderui-sys/build.rs`) and `bui build`
+(`bindings/node/features.js`). Off, their sources aren't compiled; their API
+stays.
+
Textured triangle meshes (`BUI_raster_mesh`, what Dear ImGui emits) are the
one non-analytic primitive: indexed vertices with UV and color sampling a
`BUI_texture_*` texture. The software raster fills them with a fixed-point
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 39a4897..1b59af7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,39 @@ All notable changes to **blenderui** (BUI). The format follows
## [Unreleased]
### Added
+- **Video, in every language** (`kit/intern/image`: `video.c`, `movie*.c`). One codec
+ interface for GIF, WebP and video (Blender's MovieReader shape: open, output size, next,
+ seek, close) and one clock (`play.c`: pause, seek, rate, loop, end). The OS decodes,
+ loaded at run time so a machine without it still starts: Windows Media Foundation
+ (`IMFSourceReader` with a DXVA Direct3D 11 device manager; decoding and scaling on the
+ GPU), Linux GStreamer (`decodebin ! videoconvert ! videoscale ! appsink`, `dlopen`ed;
+ VA-API through its `va` plugin), macOS AVFoundation (written, **untested**: no Mac).
+ Frames are NV12 at the size drawn, two per player reused (no allocation per frame), in
+ one GPU texture pair per player updated in place (YCbCr to RGB in the Direct3D 11 and
+ OpenGL shaders; the software raster converts what it draws); off screen, clipped or in a
+ window that isn't rendering, nothing is decoded. C: `BK_video_*` (new, play, pause,
+ seek, rate, loop, poster, controls, state, time, duration, size, listener, texture,
+ backends), the `"video"` node with Blender-style controls (play/pause button, scrubber
+ with the time; `BK_node_set_video`), canvas items' `video`. Rust: `<video src loop
+ poster autoplay>`, `video().video(handle)`, `blenderui::Video` (play, pause, seek,
+ set_rate, set_loop, time, duration, state, `on_state`, texture), `Painter::video`.
+ Python: `bui.Video` and the `Video` component (`controls`, `on_ended`). React /
+ @blender-ui/native / `bui build`: `<video>`. Dear ImGui: `BK_video_texture`. Muted
+ autoplay by default; no audio yet.
+- **GPU NV12 pixmaps and stream textures**: `BuiPixmap.format` (`BUI_PIXMAP_NV12_BT601`
+ / `_BT709`) and `.stream` (frames of one stream update one texture in place), and
+ `BUI_pixmap_read`. The GPU parity test covers them (Direct3D 11 and OpenGL).
+- **Pay only for what you use: one feature table** (`features.json`): image formats,
+ video, the GPU renderers, FreeType, the file browser and Dear ImGui are CMake options
+ (`features.cmake`), cargo features of `blenderui-sys` and `blenderui` (same names;
+ build.rs maps them and checks the list), and what `bui build` reads. Off, a part isn't
+ compiled; its API stays. `bui build` links the smallest prebuilt runtime (`base`,
+ `media`, `full`) with the features an app uses: `--features`, then package.json
+ `"bui": {"features": [...]}`, then detection in the bundle (`<video>`, media file
+ extensions, `gpu:`, file dialogs).
+- `bench/video` (`bui_video_bench`, `make_clips.sh`) and `tests/video_test.c`,
+ `bindings/rust/blenderui/tests/video.rs` (counting allocator), `features.rs`,
+ `bindings/python/tests/test_video.py`.
- **Images, once in C for every binding** (`kit/intern/image`, after Blender's imbuf: one
image type, `BKImBuf`, and a format table): PNG, GIF (animated), BMP, TGA and QOI with
Wuffs (memory-safe), JPEG with libjpeg-turbo 3.1.2 (EXIF orientation, CMYK, DCT-scaled
diff --git a/README.md b/README.md
index 7e1eaf9..7ce2e66 100644
--- a/README.md
+++ b/README.md
@@ -218,6 +218,7 @@ If you're starting fresh in Python, the Blender components are the friendliest.
- **One memory-budgeted cache** (256 MiB by default). Scrolling 1,000 photo thumbnails: **2.9 ms p99 frames and 100 MB**, against 96 ms and 2.5 GB when decoding on the UI thread; **0 allocations** in a settled frame, every block freed at exit. [Images](https://bui.preetham.top/docs/concepts/images/).
- **Animated GIF and WebP play** everywhere an image shows, decoded one frame at a time at the size drawn (two frames held per animation), each frame for its own delay, only the image's rectangle repainting. Off screen, scrolled away or in a hidden window they pause: 200 animations at once take **0.76 ms p50 / 1.5 ms p99** render frames, and **nothing at all** once off screen. `frame` holds one frame; reduced motion holds them all.
- **Large images on the GPU**: images over 2047 px get a texture of their own on Direct3D 11 and OpenGL (tiled only past the device limit), freed with the image.
+- **Video**: `<video>` in every language, decoded by the OS (Media Foundation with DXVA, GStreamer, AVFoundation; loaded at run time) at the size drawn, frames in one GPU texture per player updated in place, YCbCr converted in the shader, and **nothing decoded off screen**. 1080p plays at **0.99 ms** render frames and **9 %** of a core on the GPU renderer, five at once at 28 %, with **0 allocations per frame**. Play, pause, seek, rate, loop, poster, state events, and Blender-style controls. [Video](https://bui.preetham.top/docs/concepts/video/).
- `<img>`, CSS `background-image`, `object-fit`, Blender `Image` components, tkinter `PhotoImage` (now also JPEG, WebP, BMP, TGA, QOI, HDR, SVG), canvas items, data-table image columns, chat-list media and Dear ImGui textures (animated ones too).
### JavaScript and React
@@ -229,10 +230,11 @@ If you're starting fresh in Python, the Blender components are the friendliest.
### Small standalone apps
-- **`bui build app.jsx`** produces one executable of about **7 MB**: BUI with an embedded QuickJS engine.
+- **`bui build app.jsx`** produces one executable of **6.3 to 6.9 MB** (by the features it uses): BUI with an embedded QuickJS engine.
- **First frame in ~70 ms**, at **19 MB** of RAM, with nothing to install. There's no browser and no webview.
- **`--bun`** builds a Bun executable instead, with Node's APIs and a JIT.
- Builds take under a second: the app's bundle is appended to a prebuilt runtime.
+- **Pay for what you use**: one feature table (`features.json`) drives CMake options, cargo features and `bui build`, which links the smallest runtime an app needs: **6.3 MB** for hello world, 6.9 MB with images or video. [Binary size](https://bui.preetham.top/docs/reference/binary-size/).
### Dear ImGui
diff --git a/docs/c-api.md b/docs/c-api.md
index 72b4043..7480fcc 100644
--- a/docs/c-api.md
+++ b/docs/c-api.md
@@ -129,6 +129,30 @@ and `BK_set_animations(0)` holds them all. To step one yourself:
`BK_anim_open`, then `BK_anim_next` for each frame and its delay;
`BK_imbuf_texture_update` puts a frame into a texture.
+## Video
+
+`BK_video_*` (kit/intern/image/video.c) plays video files through the OS
+decoders (Media Foundation, GStreamer, AVFoundation; loaded at run time),
+decoded at the size drawn, in one GPU texture per player, and only while it
+shows. Muted autoplay; no audio yet.
+
+```c
+BKVideo *v = BK_video_new("intro.mp4"); /* loads when first drawn */
+BK_video_set_loop(v, 1);
+BK_video_set_controls(v, 1); /* Blender-style controls on "video" nodes */
+BK_video_set_listener(v, on_state, app); /* BK_VIDEO_LOADING .. ENDED, ERROR */
+BKNode *n = BK_node_new("video");
+BK_node_set_video(n, v, BK_FIT_CONTAIN); /* or a canvas item's .video */
+BK_video_seek(v, 10.0);
+BK_video_set_rate(v, 2.0);
+int tex = BK_video_texture(v, 0, 640, 360); /* Dear ImGui: the frame in a texture */
+BK_video_free(v); /* after nodes / items let go */
+```
+
+`BK_video_backends()` names what the build has. Optional parts (image formats,
+video, the GPU renderers, the file browser) are CMake options from
+`features.json`; see [Binary size](https://bui.preetham.top/docs/reference/binary-size/).
+
## Showing the kit in your own window
The kit always draws into a `BuiRaster`: the software raster, or Direct3D 11
diff --git a/docs/components.md b/docs/components.md
index afd4f32..ec68228 100644
--- a/docs/components.md
+++ b/docs/components.md
@@ -118,6 +118,7 @@ of Blender's SVG icons (`buipy.kit_icon_names()` lists them).
| `MenuButton` | `MenuButton(text, items, *, icon=None)` |
| `Label` | `Label(text, *, icon=None, align="left", color=None, bold=False)` |
| `Image` | `Image(src, *, fit="contain", frame=None)`: an image file (PNG, JPEG, WebP, GIF, BMP, TGA, QOI, HDR, PNM, SVG), natural size from its header, pixels decoded off the UI thread; `fit` as CSS `object-fit`; animations play, or hold `frame` |
+| `Video` | `Video(src, *, autoplay=True, loop=False, controls=False, poster=None, fit="contain", on_ended=None)`: a video file decoded by the OS at the size drawn; `controls` draws Blender's play/pause button and scrubber; `play()`, `pause()`, `seek(s)`, `player` (rate, time, duration, state, on_state) |
| `ProgressBar` | `ProgressBar(value=0.0, text=None)` |
| `Separator`, `Spacer` | `Separator(factor=0.5, line=False)` / `Spacer()` |
diff --git a/docs/imgui.md b/docs/imgui.md
index 8e48509..ddf7a69 100644
--- a/docs/imgui.md
+++ b/docs/imgui.md
@@ -216,6 +216,9 @@ get its id: Python `tex, w, h = blenderui.image_texture(data)` then
Animated GIF and WebP: Python `blenderui.AnimatedTexture(data)` (call
`update()` each frame, draw `texture`), Rust `blenderui::Animation` with
`Image::update_texture`, C `BK_anim_next` with `BK_imbuf_texture_update`.
+Video: Python `tex = clip.texture(tex, w, h)` on a `blenderui.Video`, Rust
+`Video::texture`, C `BK_video_texture`: the current frame, updated in place;
+calling it each frame keeps the video playing.
## Headless rendering and tests
diff --git a/docs/javascript.md b/docs/javascript.md
index 0eac93d..1960e9f 100644
--- a/docs/javascript.md
+++ b/docs/javascript.md
@@ -277,6 +277,19 @@ compiled per app, and a build takes well under a second. Prebuilt runtimes
are for Windows x64. On other platforms, `npm run build` in `bindings/node`
builds `bui-runtime` from source.
+### What an app pays for
+
+`bui build` links the smallest prebuilt runtime with the kit features the app
+uses (`features.json`: `base`, `media` with every image format and video,
+`full` with the GPU renderer and the file browser): `--features png,video`,
+else `"bui": {"features": [...]}` in package.json, else what it finds in the
+bundle (`<video>`, media file names). A hello-world app is 6.3 MB, one with
+images or video 6.9 MB (Windows x64). See
+[Binary size](https://bui.preetham.top/docs/reference/binary-size/).
+
+`<video src="intro.mp4" loop />` plays video in React and the DOM API (muted
+autoplay, `autoPlay={false}` holds the first frame); no media events yet.
+
## How it works
- **A UI thread.** BUI runs its own message loop on a thread of its own, so
diff --git a/docs/rust.md b/docs/rust.md
index 950e015..9bcdc2a 100644
--- a/docs/rust.md
+++ b/docs/rust.md
@@ -449,6 +449,14 @@ play (paused while off screen); `<img frame="2">` holds a frame,
yourself (`Image::update_texture` for Dear ImGui). See
[Images](https://bui.preetham.top/docs/concepts/images/).
+`<video src="intro.mp4" loop poster="intro.jpg" />` plays a video file (muted
+autoplay; `autoplay="false"` holds the first frame): the OS decodes it at the
+size drawn, only while it shows. Keep a `blenderui::Video` to control it
+(`play`, `pause`, `seek`, `set_rate`, `time`, `duration`, `on_state`) and
+pass it with `video().video(rc.clone())` or `Painter::video`. Cargo features
+(`png`, `jpeg`, `video`, `gpu`, ... from `features.json`, all default) drop
+what an app doesn't use. See [Video](https://bui.preetham.top/docs/concepts/video/).
+
## Painting your own content
`canvas(|bounds, painter| ..)` is gpui's `canvas()`: it paints with a
diff --git a/website/src/content/docs/concepts/images.mdx b/website/src/content/docs/concepts/images.mdx
index 16cceac..3ddf324 100644
--- a/website/src/content/docs/concepts/images.mdx
+++ b/website/src/content/docs/concepts/images.mdx
@@ -27,6 +27,8 @@ Three things make it fast and light:
| PNM | BUI | PGM and PPM, ASCII and binary, 8 and 16 bit (what Tk reads) |
| SVG | nanosvg (Blender's copy, already used for its icons) | rasterized at the drawn size; CMake `BUI_IMAGE_SVG` (on) |
+Each format is a feature of the build (`features.json`): leave out what an app doesn't show, and it costs no binary size ([Binary size](/docs/reference/binary-size)). Videos play through [Video](/docs/concepts/video), with the same worker threads and clock.
+
Not built in yet (planned as options, off by default): AVIF (dav1d + libavif), OpenEXR (tinyexr), TIFF, JPEG XL, and HEIC through the system (WIC on Windows, ImageIO on macOS).
Licences: Wuffs (MIT, used as MIT), libjpeg-turbo (IJG, BSD-3-Clause, zlib), libwebp (BSD-3-Clause) and nanosvg (zlib) are all compatible with BUI's GPL-2.0-or-later. See [License and credits](/docs/project/license-and-credits).
diff --git a/website/src/content/docs/concepts/video.mdx b/website/src/content/docs/concepts/video.mdx
new file mode 100644
index 0000000..672ccfd
--- /dev/null
+++ b/website/src/content/docs/concepts/video.mdx
@@ -0,0 +1,146 @@
+---
+title: Video
+description: A <video> in every language, decoded by the operating system at the size it is drawn, frames in one GPU texture updated in place, and nothing decoded while it is off screen. Backends, API, controls, performance and limits.
+section: Concepts
+order: 66
+sources: ["kit/intern/image/video.c", "kit/intern/image/movie.c", "kit/intern/image/movie_mf.c", "kit/intern/image/movie_gst.c", "kit/intern/image/movie_avf.m", "kit/intern/image/anim.c", "kit/intern/image/play.c", "kit/intern/image/cache.c", "kit/include/BUI_kit.h", "gpu/include/GPU_raster.h", "gpu/intern/gpu_raster.c", "gpu/shaders/bui_ui.hlsl", "gpu/intern/gpu_gl.c", "bindings/rust/blenderui/src/video.rs", "bindings/python/src/buipy_video.c", "bindings/python/bui/components/widgets.py", "bench/video/video_bench.c", "tests/video_test.c", "features.json"]
+---
+
+BUI plays video with the same machinery as [animated images](/docs/concepts/images#animations): one codec interface for GIF, WebP and video (Blender's `MovieReader` shape: open, next frame, seek, close), one clock (`play.c`) and the same worker threads. What is different is where the frames come from and where they go.
+
+- **The operating system decodes.** Windows uses Media Foundation (DXVA hardware decoding through its own Direct3D 11 device, scaling on the GPU), Linux uses GStreamer (VA-API through its `va` plugin where the driver has it, software otherwise), macOS uses AVFoundation / VideoToolbox. They are loaded at run time: a machine without them (Windows "N" editions, a Linux box without GStreamer) starts normally and just reports no video. Nothing is linked: on Windows the `video` feature adds 3 KB to a fat-LTO binary ([Binary size](/docs/reference/binary-size)).
+- **Decoded at the size drawn.** A 4K file in a 640 px box is decoded and scaled by the decoder (on the GPU on Windows) to 640 px, as NV12 (1.5 bytes a pixel). Resizing within 0.5x to 1.25x of that size just scales when drawing; beyond it the decoder switches size where it was.
+- **One texture, updated in place.** Two NV12 frames per player are allocated once (the one shown and the next, decoded ahead), then reused: no allocation per frame. On the GPU renderers each player has one luma and one chroma texture updated in place; the shader converts BT.601 / BT.709 YCbCr to RGB. The software raster converts only the pixels it draws, while drawing.
+- **Only what is on screen plays.** A video scrolled away, clipped, in a hidden window, or in a window that isn't rendering pauses: no decoding, no timers, no redraws. It continues from where it was when it shows again.
+
+## Showing a video
+
+<LangTabs>
+<Tab label="Rust">
+
+```rust
+use blenderui::prelude::*;
+
+// the element owns its player: muted autoplay (autoplay="false" to hold the
+// first frame), loop, poster
+rsx! { <video src="intro.mp4" loop poster="intro.jpg" class="w-[640px] h-[360px] object-cover" /> }
+
+// or keep the player: play, pause, seek, rate, time, duration, state events
+let clip = std::rc::Rc::new({
+ let mut v = blenderui::Video::new("intro.mp4").unwrap();
+ v.on_state(|s| if s == blenderui::VideoState::Ended { println!("done") });
+ v
+});
+video().video(clip.clone()).w(px(640.0)).h(px(360.0));
+clip.seek(std::time::Duration::from_secs(10));
+clip.set_rate(2.0);
+
+// in a canvas
+canvas(move |b, p| p.video(b, &clip, blenderui::sys::BK_FIT_CONTAIN));
+```
+
+</Tab>
+<Tab label="JavaScript">
+
+```jsx
+// React and @blender-ui/native's DOM API (and `bui build` apps): the same <video> as Rust
+<video src="intro.mp4" loop poster="intro.jpg" style={{ width: 640, height: 360, objectFit: 'cover' }} />
+<video src="intro.mp4" autoplay="false" /> {/* holds the first frame */}
+```
+
+</Tab>
+<Tab label="Python">
+
+```py
+import blenderui as bui
+from blenderui.components import Video
+
+v = Video("intro.mp4", controls=True, loop=True, poster="intro.jpg", fit="cover",
+ on_ended=lambda: print("done"))
+v.pause(); v.seek(10.0); v.play()
+v.player.rate = 2.0 # the bui.Video behind it
+print(v.player.time, v.player.duration, v.player.state == bui.VIDEO_PLAYING)
+bui.video_backends # "mf", "gstreamer", "avfoundation"; "" without video
+```
+
+</Tab>
+<Tab label="C">
+
+```c
+BKVideo *v = BK_video_new("intro.mp4"); /* muted autoplay; loads when first drawn */
+BK_video_set_loop(v, 1);
+BK_video_set_controls(v, 1); /* Blender-style controls on "video" nodes */
+BK_video_set_listener(v, on_state, app); /* loaded, playing, paused, ended, error */
+
+BKNode *n = BK_node_new("video"); /* the frame, fitted, and its controls */
+BK_node_set_video(n, v, BK_FIT_CONTAIN);
+
+BKCanvasItem it = {.type = BK_ITEM_IMAGE, .coords = (float[]){0, 0, 640, 360}, .ncoords = 4,
+ .video = v, .fit = BK_FIT_COVER}; /* or on a canvas */
+BK_canvas_set_item(canvas, &it);
+
+BK_video_seek(v, 10.0);
+BK_video_set_rate(v, 2.0);
+double t = BK_video_time(v), d = BK_video_duration(v);
+BK_video_free(v); /* after the node / item let go */
+```
+
+</Tab>
+<Tab label="Dear ImGui">
+
+```py
+import blenderui as bui
+from blenderui import imgui
+
+clip = bui.Video("intro.mp4")
+tex = 0
+# every frame:
+tex = clip.texture(tex, 640, 360) # the current frame, updated in place (RGBA)
+if tex:
+ imgui.image(tex, clip.size or (640, 360))
+```
+
+C: `BK_video_texture(v, tex, max_w, max_h)`; Rust: `Video::texture`. Calling it each frame is what keeps the video playing; keep rendering while `BK_video_state` is `BK_VIDEO_PLAYING`.
+
+</Tab>
+</LangTabs>
+
+**Defaults.** A video autoplays muted (what browsers allow without a click), plays once (`loop` to repeat), and fits its box like `object-fit: contain`. Its size is 300 x 150 (HTML's) until the first frame tells the real one. `poster` shows an image until then.
+
+**Controls.** `controls` on a `"video"` node (C, Python's `Video(controls=True)`) draws Blender's widgets over the bottom of the video: a play/pause button and a number-slider scrubber showing `0:12 / 1:30`, like the Timeline's playback controls and frame slider. Click to play or pause, drag the scrubber to seek (the video holds while you drag), Space toggles. Rust and JavaScript elements don't draw controls yet: build them from the player's methods.
+
+**Events.** One listener per player (`BK_video_set_listener`, Rust `on_state`, Python `on_state` / `on_ended`) hears every state change: loading, playing, paused, ended, error. JavaScript elements have no media events yet.
+
+## Backends
+
+| Backend | Where | Default | Notes |
+| --- | --- | --- | --- |
+| Media Foundation | Windows | on (`video`) | `IMFSourceReader` with a DXVA `IMFDXGIDeviceManager` (one Direct3D 11 video device for every player) and the reader's video processor: hardware decoding and scaling. H.264, HEVC*, VP9*, AV1* (*with the Store extensions). Tested on Windows 11. |
+| GStreamer | Linux | on (`video`) | `filesrc ! decodebin ! videoconvert ! videoscale ! appsink`, `dlopen`ed. Hardware decoding where GStreamer's `va` plugin finds VA-API, else software (libav, openh264, dav1d plugins). Chosen over raw VA-API: it brings the demuxers and every system decoder; VA-API alone would need our own demuxers and a software fallback anyway. Compiled and syntax-checked under WSL; see [Platforms](/docs/reference/platforms). |
+| AVFoundation | macOS | on (`video`) | `AVAssetReader` with VideoToolbox scaling, weak-linked frameworks. **Untested**: written against the documented API without a Mac; it compiles only on Apple platforms, so it can't affect others. |
+| dav1d, FFmpeg | any | not written | Planned as optional features (off by default): dav1d (BSD-2) for AV1 where the OS lacks it, with a small MP4/WebM demuxer; FFmpeg for everything (LGPL or GPL by its build, patent-encumbered codecs: opt-in only). They are not in the feature table until they exist. |
+
+Formats are the OS's: what Windows' Movies & TV, GStreamer's `gst-play-1.0` or QuickTime Player plays, BUI plays. `BK_video_backends()` / `bui.video_backends` / `Video::backends()` name the ones a build has. Audio isn't played yet (every video is muted); see Limits.
+
+## How it works
+
+1. `BK_video_new` makes a *private* entry of the [image cache](/docs/concepts/images#how-it-works): the same requests, worker threads and visibility tracking as an `<img>`, but owned by the player (never shared or evicted) and with its own clock.
+2. The first draw asks for the first frame at the drawn size. A worker opens the file with the first backend that reads it (sniffing the container: MP4/MOV, WebM/MKV, AVI, ASF, Ogg, MPEG-PS/TS, FLV), plans the decode size from the intrinsic size and the box (`imb_plan`, as for images) and decodes NV12 into a fresh frame.
+3. While it shows, the clock asks for the next frame one step ahead; it decodes into the frame the screen let go of. When its time comes (the frame's duration over the rate), it is swapped in and only its rectangle redraws, on the window's frame timer.
+4. A seek drops the frame decoded ahead, seeks the decoder to the keyframe before the time and decodes forward to the frame showing then; it shows as soon as it is ready, paused or not.
+5. On the GPU, the frame's planes are uploaded into the player's two textures (`UpdateSubresource` / `glTexSubImage2D`) and one instanced quad samples them; a parity test checks the CPU and GPU conversions agree to within 2 levels.
+
+## Performance
+
+<BenchChart id="video-frames" />
+
+<BenchChart id="video-cpu" />
+
+## Limits
+
+- **No audio** yet: every video is muted. A small mixer (miniaudio) behind an optional feature is the plan.
+- **Not zero-copy** on Windows: frames are decoded and scaled on the GPU, then copied back (at the drawn size) and uploaded to the renderer's own device. Sharing the decoder's textures with the renderer's device is the next step.
+- **8-bit** output: 10-bit (P010) and HDR video are converted to 8-bit NV12 by the decoder.
+- No dav1d or FFmpeg backend yet: a format the OS can't decode doesn't play (state: error).
+- Rust and JavaScript `<video>` elements have no built-in controls and JavaScript has no media events.
+- An `<img src="clip.mp4">` doesn't play video (as in browsers): use `<video>`.
diff --git a/website/src/content/docs/reference/binary-size.mdx b/website/src/content/docs/reference/binary-size.mdx
new file mode 100644
index 0000000..35d5e0b
--- /dev/null
+++ b/website/src/content/docs/reference/binary-size.mdx
@@ -0,0 +1,61 @@
+---
+title: Binary size and features
+description: Pay only for what you use. One feature table turns BUI's optional parts (image formats, video, the GPU renderers, the file browser, Dear ImGui) on or off in CMake, cargo and bui build, and bui build links the smallest runtime an app needs. Measured sizes.
+section: Reference
+order: 22
+languages: ["c", "rust", "javascript", "python"]
+sources: ["features.json", "features.cmake", "kit/CMakeLists.txt", "gpu/CMakeLists.txt", "bindings/rust/blenderui-sys/build.rs", "bindings/rust/blenderui-sys/Cargo.toml", "bindings/rust/blenderui/Cargo.toml", "bindings/rust/blenderui/tests/features.rs", "bindings/node/features.js", "bindings/node/cli.js", "bindings/node/scripts/build.js", "bindings/node/bench/size/hello.jsx"]
+---
+
+A feature should cost binary size only if you use it. BUI's optional parts are one table, [`features.json`](https://github.com/ppmpreetham/BUI/blob/main/features.json), and three tools read it:
+
+- **CMake** (`features.cmake`): one option each, `ON` by default (`-DBUI_VIDEO=OFF`). See [CMake options](/docs/reference/cmake-options#optional-parts-featuresjson).
+- **cargo**: the same names are features of `blenderui-sys` and `blenderui`, all on by default. `blenderui-sys/build.rs` maps each to its CMake option and stops the build if `Cargo.toml` misses one; a test checks `blenderui` forwards them all.
+- **`bui build`**: links the smallest prebuilt runtime that has what the app uses.
+
+Off, a part's sources aren't compiled at all. Its API stays, so code compiles either way: a missing format doesn't decode, a video reports an error state, `BK_file_dialog` returns -1, and windows draw with the software raster.
+
+| Feature | What it is |
+| --- | --- |
+| `png`, `gif`, `bmp`, `tga`, `qoi` | Those formats (Wuffs, only the modules on) |
+| `jpeg` | libjpeg-turbo |
+| `webp` | libwebp (with animations) |
+| `hdr`, `pnm` | BUI's readers |
+| `svg` | SVG images (nanosvg, which the icons need anyway) |
+| `video` | [Video](/docs/concepts/video) through the OS, loaded at run time |
+| `gpu` | Direct3D 11 / OpenGL renderers |
+| `freetype` | FreeType text (else stb_truetype) |
+| `filebrowser` | Blender's File Browser and `BK_file_dialog` |
+| `imgui` | Dear ImGui on BUI (cargo: off unless `blenderui-imgui` asks) |
+
+## Rust
+
+```toml
+[dependencies]
+# only what this app shows: no JPEG, WebP, video, GPU or file browser code
+blenderui = { version = "0.3", default-features = false, features = ["slug", "png", "svg", "freetype"] }
+```
+
+## bui build
+
+Rebuilding the runtime per app would need a Rust and C toolchain on every machine that runs `bui build`. Splitting it into a core and loadable modules would cost a dynamic-library boundary (no whole-program LTO across it) and more files to ship. So the package ships a few prebuilt runtimes, listed in `features.json`, and `bui build` appends the app to the smallest one that has every feature the app needs: no compiler, and the same one-file executable.
+
+| Runtime | Has |
+| --- | --- |
+| `base` | UI, text, SVG images |
+| `media` | base + every image format + video |
+| `full` | media + the GPU renderer + the file browser |
+
+How `bui build` decides, explicit first:
+
+1. `--features png,video` on the command line;
+2. `"bui": { "features": ["png", "video"] }` in the app's `package.json`;
+3. otherwise, it looks in the bundle: `<video>` elements, media file names in string literals (`"logo.webp"`, `"intro.mp4"`) and file dialogs.
+
+It prints its choice (`bui: runtime "media" for png, video`). A path built at run time (`"photo." + ext`, a file the user picks) can't be seen in the bundle, and the GPU renderer is never detected (the library's own code mentions its option): list those features explicitly. A feature no prebuilt runtime has is an error that says so.
+
+## Measured
+
+<BenchChart id="binary-size" />
+
+By feature, on Windows x64 with fat LTO: every image format together is about 596 KB (most of it libwebp and libjpeg-turbo), video 3 KB (the OS decodes; Media Foundation is loaded at run time), the Direct3D 11 renderer 42 KB and the file browser about 50 KB. The base runtime is about a tenth smaller than the full one; most of what remains is the same for every app: QuickJS, Rust's standard library, the CSS and layout engine, Blender's icons and the embedded Inter font. The Python wheel, the Node addon and cargo builds with default features have everything.
diff --git a/website/src/content/docs/reference/cmake-options.mdx b/website/src/content/docs/reference/cmake-options.mdx
index 25c7422..42908e3 100644
--- a/website/src/content/docs/reference/cmake-options.mdx
+++ b/website/src/content/docs/reference/cmake-options.mdx
@@ -4,7 +4,7 @@ description: Every option you can pass when building BUI from source with CMake,
section: Reference
order: 20
languages: ["c", "cpp", "imgui"]
-sources: ["CMakeLists.txt", "kit/CMakeLists.txt", "gpu/CMakeLists.txt", "ui/CMakeLists.txt", "bindings/imgui/CMakeLists.txt", "bindings/python/CMakeLists.txt", "backends/qt/CMakeLists.txt", "examples/CMakeLists.txt", "docs/getting-started.md", "pyproject.toml", "bindings/rust/blenderui-sys/build.rs"]
+sources: ["CMakeLists.txt", "features.json", "features.cmake", "kit/CMakeLists.txt", "gpu/CMakeLists.txt", "ui/CMakeLists.txt", "bindings/imgui/CMakeLists.txt", "bindings/python/CMakeLists.txt", "backends/qt/CMakeLists.txt", "examples/CMakeLists.txt", "docs/getting-started.md", "pyproject.toml", "bindings/rust/blenderui-sys/build.rs"]
---
When you build BUI from source, a handful of CMake options decide what gets built and how text is drawn. The defaults suit almost everyone, so you only need this page when you want something specific: C only, Windows' own fonts, or Dear ImGui with Blender's widgets.
@@ -39,11 +39,22 @@ Options are cached in the build folder. To change one later, configure again wit
| `BUI_SLUG` | `ON` | The GPU renderer's default way to draw text: `ON` is Slug (glyph outlines), `OFF` the per-glyph atlas. Switchable at run time either way (`BUI_SLUG=0/1`, `BUI_gpu_set_slug`). |
| `BUI_TEXT_STB` | `ON` | Deprecated and ignored: the portable engine is the default everywhere now. |
-## Images
+## Optional parts (features.json)
-| Option | Default | What it does |
-| --- | --- | --- |
-| `BUI_IMAGE_SVG` | `ON` | SVG files in the [image module](/docs/concepts/images), rasterized by the nanosvg the kit already uses for Blender's icons (so it adds about 1 KB). PNG, JPEG, WebP, GIF, BMP, TGA, QOI, HDR and PNM are always built in. |
+Every sizeable optional part of the C kit is one row of `features.json`, the single table that CMake (`features.cmake`: an option each), cargo (the same names as features of `blenderui-sys` and `blenderui`) and `bui build` read. Off, a part's sources aren't compiled, so it costs no binary size; its API stays and reports it missing (no format, no video backend, `BK_file_dialog` returns -1). See [Binary size](/docs/reference/binary-size) for what each costs.
+
+| Option | Cargo feature | Default | What it is |
+| --- | --- | --- | --- |
+| `BUI_IMAGE_PNG`, `_GIF`, `_BMP`, `_TGA`, `_QOI` | `png`, `gif`, `bmp`, `tga`, `qoi` | `ON` | Those formats through Wuffs (one translation unit with only the modules turned on). |
+| `BUI_IMAGE_JPEG` | `jpeg` | `ON` | libjpeg-turbo's decoder. |
+| `BUI_IMAGE_WEBP` | `webp` | `ON` | libwebp's decoder and demuxer (animated WebP). |
+| `BUI_IMAGE_HDR`, `BUI_IMAGE_PNM` | `hdr`, `pnm` | `ON` | BUI's own readers. |
+| `BUI_IMAGE_SVG` | `svg` | `ON` | SVG files, through the nanosvg the icons use anyway (about 1 KB). |
+| `BUI_VIDEO` | `video` | `ON` | [Video](/docs/concepts/video) through the OS: Media Foundation, AVFoundation or GStreamer, loaded at run time. |
+| `BUI_GPU` | `gpu` | `ON` | The Direct3D 11 / OpenGL renderers. Off: every window draws with the software raster. |
+| `BUI_TEXT_FREETYPE` | `freetype` | `ON` | Text through FreeType like Blender (else stb_truetype). |
+| `BUI_FILEBROWSER` | `filebrowser` | `ON` | Blender's File Browser: the `filebrowser` node and `BK_file_dialog`. |
+| `BUI_BUILD_IMGUI` | `imgui` | `ON` (CMake, with a C++ compiler), off in cargo | Dear ImGui on BUI. |
See [Text and fonts](../../concepts/text-and-fonts/) for what these change on screen.
@@ -72,7 +83,10 @@ These aren't options, but they change what you get:
**C only, smallest build:**
```sh
-cmake -S . -B build -DBUI_BUILD_PYTHON_BINDINGS=OFF -DBUI_BUILD_IMGUI=OFF -DBUI_BUILD_TESTS=OFF
+cmake -S . -B build -DBUI_BUILD_PYTHON_BINDINGS=OFF -DBUI_BUILD_IMGUI=OFF -DBUI_BUILD_TESTS=OFF \
+ -DBUI_IMAGE_PNG=OFF -DBUI_IMAGE_GIF=OFF -DBUI_IMAGE_BMP=OFF -DBUI_IMAGE_TGA=OFF \
+ -DBUI_IMAGE_QOI=OFF -DBUI_IMAGE_JPEG=OFF -DBUI_IMAGE_WEBP=OFF -DBUI_IMAGE_HDR=OFF \
+ -DBUI_IMAGE_PNM=OFF -DBUI_VIDEO=OFF -DBUI_GPU=OFF -DBUI_FILEBROWSER=OFF
```
**Dear ImGui with Blender's widgets, plus the examples:**
diff --git a/website/src/content/docs/reference/coverage.mdx b/website/src/content/docs/reference/coverage.mdx
index 37ee03d..27fcf5b 100644
--- a/website/src/content/docs/reference/coverage.mdx
+++ b/website/src/content/docs/reference/coverage.mdx
@@ -24,6 +24,7 @@ sources: ["SYNTAX_COVERAGE.md", "docs/rust.md", "docs/qt.md", "docs/imgui.md", "
| Dear ImGui, C | **399 of 399** functions | Complete |
| Dear ImGui, Python and safe Rust | **366 of 399** functions | Partial |
| Image formats (every language) | PNG, JPEG, WebP (animated), GIF (animated), BMP, TGA, QOI, Radiance HDR, PNM, SVG; not yet AVIF, EXR, TIFF, JPEG XL, HEIC ([Images](/docs/concepts/images)) | Partial |
+| `<video>` (every language) | Play, pause, seek, rate, loop, poster, state events, Blender-style controls (C, Python); what the OS decodes; no audio, no controls or events on Rust/JS elements yet ([Video](/docs/concepts/video)) | Partial |
## tkinter
diff --git a/website/src/content/docs/reference/platforms.mdx b/website/src/content/docs/reference/platforms.mdx
index dcb36fc..098bc71 100644
--- a/website/src/content/docs/reference/platforms.mdx
+++ b/website/src/content/docs/reference/platforms.mdx
@@ -20,6 +20,7 @@ BUI runs on Windows, Linux and macOS. Windows and Linux are fully supported; mac
| Renderer | CPU raster, or GPU (Direct3D 11) | CPU raster, or GPU (OpenGL 3.3) | CPU raster |
| HiDPI | Per-monitor DPI | `Xft.dpi` | Retina (backing scale) |
| Images | All [built-in formats](/docs/concepts/images); decode threads; GPU atlas | All built-in formats; decode threads; GPU atlas | All built-in formats; decode threads (CPU raster) |
+| [Video](/docs/concepts/video) | Works: Media Foundation (DXVA), tested | Works: GStreamer (VA-API where available), tested under WSL | AVFoundation: written, **untested** |
**Works** means it works and is tested. **Experimental** means it's written and checked by CI, but has had little hands-on testing on real hardware (macOS: one Apple Silicon Mac so far).
@@ -29,6 +30,7 @@ BUI runs on Windows, Linux and macOS. Windows and Linux are fully supported; mac
- **GPU renderer:** Direct3D 11 (feature level 10.0 or newer). Machines without it stay on the CPU raster.
- **Compilers:** MSVC, or MinGW-w64 GCC. The published Python wheels are built with MinGW (UCRT) and statically linked to the GCC runtime, so they depend only on system DLLs and Python's. The Rust crate's default target uses MSVC: install the Visual Studio Build Tools.
- **JavaScript:** the npm packages ship a prebuilt addon and the `bui-runtime` for **Windows x64**.
+- **Video:** Media Foundation, loaded at run time (Windows "N" editions without the Media Feature Pack start normally and report no video). H.264 always; HEVC, VP9 and AV1 with Microsoft's Store extensions. Tested on Windows 11 (Ryzen 7 5800U, Radeon graphics).
## Linux
@@ -38,6 +40,7 @@ BUI runs on Windows, Linux and macOS. Windows and Linux are fully supported; mac
- **Tested on:** the C, Python, window and GPU parity tests pass on Mesa's software OpenGL and on an NVIDIA GPU. The suites also run under WSLg.
- **Building from source** needs the X11 headers: `libx11-dev` (Debian, Ubuntu) or `libX11-devel` (Fedora). No GL headers are needed.
- **JavaScript:** no prebuilt npm addon yet. Build it from a clone with `npm run build` in `bindings/node` (needs Rust, CMake and a C compiler); windows are native.
+- **Video:** GStreamer 1.x, `dlopen`ed (no headers needed to build): install `gstreamer1.0-plugins-base` and `-good`, plus `gstreamer1.0-libav` (or `-plugins-bad` for openh264/dav1d) for H.264 and friends, and `gstreamer1.0-vaapi` / the `va` plugin for hardware decoding. Tested under WSL (Kali, GStreamer 1.24, software decoding); the OpenGL NV12 shader passes the parity test there on Mesa.
## macOS <Badge tone="preview">Experimental</Badge>
diff --git a/website/src/data/bench.ts b/website/src/data/bench.ts
index d113c06..497cad8 100644
--- a/website/src/data/bench.ts
+++ b/website/src/data/bench.ts
@@ -449,7 +449,41 @@ const tablesBase = {
["", "WebP, GPU", "0.51 / 1.10 ms", "20 ms", "553 ms", "1,997", "71 MB (38 MB)", "0 decodes, 0 renders"],
["1,000 (about 240 on screen)", "GIF, CPU", "1.51 / 3.08 ms", "62 ms", "327 ms", "2,600", "83 MB (47 MB)", "0 decodes, 0 renders"],
],
- note: "Ryzen 7 5800U, Windows 11, 4 decode threads. Render time is the UI thread's BK_render; decode time is measured around each decode on the workers (Windows' process CPU times are sampled at the clock tick and miss these short bursts, so they are not used). Every visible animation advances at its own 100 ms: about 2,000 frames a second for 200. The cache holds two frames per animation and its decoder's canvas. MEM allocations: 8 per decoded frame (the frame, the scaled frame and the scaler's tables on the worker, the step request on the UI thread). Off screen: the canvas stops showing them, and over the next 3 s nothing decodes, no timer fires and nothing renders. Every MEM block is freed after closing. Program: bench/images/image_grid.c (bui_image_bench <dir> anim <count> [gif|webp] [gpu]).",
+ note: "Ryzen 7 5800U, Windows 11, 4 decode threads. Render time is the UI thread's BK_render; decode time is measured around each decode on the workers (Windows' process CPU times are sampled at the clock tick and miss these short bursts, so they are not used). Every visible animation advances at its own 100 ms: about 2,000 frames a second for 200. The cache holds two frames per animation and its decoder's canvas. MEM allocations: 8 per decoded frame (the frame, the scaled frame and the scaler's tables on the worker, the step request on the UI thread; measured before the step request was reused, which removed that one). Off screen: the canvas stops showing them, and over the next 3 s nothing decodes, no timer fires and nothing renders. Every MEM block is freed after closing. Program: bench/images/image_grid.c (bui_image_bench <dir> anim <count> [gif|webp] [gpu]).",
+ },
+ video: {
+ caption:
+ "Video: H.264 clips (testsrc2, 30 fps, 12 s, bench/video/make_clips.sh) looping, muted, each in its own box (object-fit: contain) of a headless window, driven like a window loop for 8 s, then off screen for 3 s",
+ columns: ["Clip x players (box)", "Renderer", "First frame", "Render p50 / p99", "CPU (one core)", "Frames shown per s", "Dropped", "Working set", "MEM allocs per frame", "Off screen, 3 s"],
+ numeric: [2, 3, 4, 5, 6, 7, 8],
+ rows: [
+ ["1080p x 1 (1920 x 1080)", "CPU", "372 ms", "18.7 / 24.6 ms", "26 %", "29.9", "0.5 %", "132 MB", "<strong>0</strong>", "<strong>0 decodes, 0 renders, 0 ms</strong>"],
+ ["", "GPU", "257 ms", "<strong>0.99</strong> / 48.0 ms", "9 %", "30.0", "0 %", "274 MB", "0", "0 decodes, 0 renders, 0 ms"],
+ ["1080p x 5 (640 x 360 each)", "CPU", "515 ms", "5.2 / 17.0 ms", "70 %", "150.1", "0 %", "530 MB", "0", "0 decodes, 0 renders, 0 ms"],
+ ["", "GPU", "560 ms", "0.54 / 4.9 ms", "28 %", "149.9", "0.1 %", "448 MB", "0", "0 decodes, 0 renders, 0 ms"],
+ ["4K x 1 (1920 x 1080)", "CPU", "494 ms", "19.7 / 33.6 ms", "24 %", "30.0", "0 %", "310 MB", "0", "0 decodes, 0 renders, 31 ms"],
+ ["", "GPU", "676 ms", "1.04 / 51.0 ms", "10 %", "30.0", "0 %", "447 MB", "0", "0 decodes, 0 renders, 0 ms"],
+ ],
+ note: "Ryzen 7 5800U (Radeon integrated GPU: its video memory is system memory, so decoder surfaces count in the working set), Windows 11, Media Foundation with DXVA. First frame: from BK_video_new to every player showing a frame (opening the files, the decoders and, the first time, the Direct3D 11 video device). CPU: process CPU time (UI thread, decode workers and Media Foundation's threads) over wall time, of one of 16 logical cores; repeated runs varied by up to 1.6x (5 players, CPU renderer: 44 % and 70 %). Dropped: frames the clips' 30 fps wanted in the measured time that never showed. The GPU p99 is one slow frame among ~240 (a driver-side upload stall); p50 is the typical frame. MEM allocations per rendered frame: frames, requests and textures are reused. Off screen: no decode, timer or render; one 4K run spent 31 ms of CPU time in the 3 s (a step in flight). Every MEM block is freed after closing. Program: bench/video/video_bench.c (bui_video_bench <clip> <count> <w> <h> [gpu] [seconds]).",
+ },
+ binarySize: {
+ caption:
+ "Binary size by feature: bui-runtime (BUI + QuickJS, the `bui build` runtime), Windows x64, MSVC, the dist profile (release, fat LTO, one codegen unit)",
+ columns: ["Runtime / app", "Kit features", "Bytes", "MB"],
+ numeric: [2, 3],
+ rows: [
+ ["<strong>base</strong> runtime", "UI, text (FreeType), SVG", "6,444,544", "6.15"],
+ ["base + video", "+ video (Media Foundation)", "6,447,616 (+3,072)", "6.15"],
+ ["base + GPU", "+ Direct3D 11 renderer", "6,486,528 (+41,984)", "6.19"],
+ ["images runtime", "+ PNG, GIF, BMP, TGA, QOI, JPEG, WebP, HDR, PNM", "7,040,512 (+595,968)", "6.71"],
+ ["<strong>media</strong> runtime", "+ every image format + video", "7,047,680", "6.72"],
+ ["<strong>full</strong> runtime", "+ GPU renderer + file browser", "7,139,328", "6.81"],
+ ["full, before video (v0.3.0 tree + images)", "everything then", "7,097,856", "6.77"],
+ ["hello-world app (bui build)", "base + 175 KB bundle", "6,619,464", "6.31"],
+ ["images app (bui build)", "media + bundle", "7,222,630", "6.89"],
+ ["video app (bui build)", "media + bundle", "7,222,603", "6.89"],
+ ],
+ note: "Measured with bindings/node/scripts/build.js (cargo build -p blenderui-qjs --profile dist --no-default-features --features blenderui/...): the runtimes features.json lists, and single-feature variants for the deltas. The apps are bindings/node/bench/size/*.jsx built with `bui build`, which picked the runtime from the bundle (hello: base; images and video: media). What every runtime keeps: QuickJS, Rust's std, the CSS/Tailwind engine and layout, Blender's icons (about 0.8 MB of SVG data) and the embedded Inter font.",
},
} satisfies Record<string, Table>
@@ -862,6 +896,57 @@ export const charts = {
table: "imageAnim",
source: "bench/images/image_grid.c",
},
+ "video-frames": {
+ kind: "groups",
+ title: "Video: render time per frame",
+ subtitle: "H.264 at 30 fps, Media Foundation (DXVA), decoded at the size drawn",
+ unit: "ms",
+ better: "lower",
+ headline: { value: "0", text: "decodes, renders and allocations per frame while off screen" },
+ series: [{ name: "p50", ours: true }, { name: "p99" }],
+ groups: [
+ { label: "1080p x 1", sub: "CPU renderer", values: [18.7, 24.6] },
+ { label: "1080p x 1", sub: "GPU renderer", values: [0.99, 48.0] },
+ { label: "1080p x 5", sub: "CPU renderer", values: [5.2, 17.0] },
+ { label: "1080p x 5", sub: "GPU renderer", values: [0.54, 4.9] },
+ { label: "4K x 1", sub: "CPU renderer", values: [19.7, 33.6] },
+ { label: "4K x 1", sub: "GPU renderer", values: [1.04, 51.0] },
+ ],
+ table: "video",
+ source: "bench/video/video_bench.c",
+ },
+ "video-cpu": {
+ kind: "bars",
+ title: "Video: CPU time",
+ subtitle: "Process CPU (all threads) over wall time, of one core, while playing",
+ unit: "%",
+ better: "lower",
+ bars: [
+ { label: "1080p x 1", sub: "GPU renderer", value: 9, ours: true },
+ { label: "4K x 1", sub: "GPU renderer", value: 10, ours: true },
+ { label: "1080p x 5", sub: "GPU renderer", value: 28, ours: true },
+ { label: "1080p x 1", sub: "CPU renderer", value: 26, ours: true },
+ { label: "4K x 1", sub: "CPU renderer", value: 24, ours: true },
+ { label: "1080p x 5", sub: "CPU renderer", value: 70, ours: true },
+ ],
+ table: "video",
+ source: "bench/video/video_bench.c",
+ },
+ "binary-size": {
+ kind: "bars",
+ title: "bui build: what an app pays for",
+ subtitle: "bui-runtime by the features it has (Windows x64, fat LTO)",
+ unit: "MB",
+ better: "lower",
+ headline: { value: "0.6 MB", text: "smaller for an app without images or video" },
+ bars: [
+ { label: "base", sub: "UI, text, SVG", value: 6.15, ours: true },
+ { label: "media", sub: "+ images, video", value: 6.72, ours: true },
+ { label: "full", sub: "+ GPU, file browser", value: 6.81, ours: true },
+ ],
+ table: "binarySize",
+ source: "features.json",
+ },
} satisfies Record<string, ChartSpec>
export type ChartId = keyof typeof charts