Commits
Commits on
ef5832fea151ca30db92b142c8de131c5f43fc49Filtered to vendor/cros-codecs/src/codec/h265/parser.rsClear filter2026-08-14
🐛 fix(engine-hw): a group of one picture writes a header a decoder can readAhmet Kaan Gümüş · 9a188c5
🐛 fix(engine-hw): a group of one picture writes a header a decoder can read Every intra-only hardware file was undecodable. The intra seat asks for a group of one picture, the predictor hands that limit to `SpsBuilder::max_frame_num`, and `1.ilog2()` is 0 -- so `0u8 - 4u8` wrapped to 252 in release and every SPS shipped `log2_max_frame_num_minus4 = 252`, outside the spec's 0..=12. Decoders answered "out of range (0-12): got 252". Saturate instead, in both builders that do the arithmetic (the `max_pic_order_cnt_lsb` twin asks for 2 and wrapped to 253) and in the H.265 parser's copy of the same line. Zero is not merely legal for an all-IDR stream, it is right: `frame_num` never leaves 0 there. The limit itself stays 1 -- that is the IDR-per-access-unit mechanism, and only the header field was garbage.
2026-08-13
🔧 chore(vendor): cros-codecs learns to write HEVC, from its own branchAhmet Kaan Gümüş · 75da480
🔧 chore(vendor): cros-codecs learns to write HEVC, from its own branch
The vendored 0.0.6 decodes HEVC and encodes H.264 and AV1; the seven
commits behind cros-codecs' `hevc-vaapi-encoder` branch are what give it
the third encoder, and they are carried here verbatim rather than
rewritten:
* `codec/h264/nalu_writer` - emulation prevention after an escaped byte
(the same >=5-zero-run bug the vendored H.264 writer had)
* `codec/h265/nalu_writer` - the H.265 writer that fix belongs to
* `codec/h265/parser` - VPS, SPS and PPS builders, the SPS deriving its
own conformance window from the resolution it is given
* `codec/h265/synthesizer` - the parameter sets written back out as
NALUs, which is what a driver emitting no packed headers needs
* `encoder/h265` + `encoder.rs` - initial tunings on the config
* `encoder/stateless/h265` - the codec and its low-delay predictor
* `encoder/stateless/h265/vaapi` - the VA-API backend
Applied with `git apply -3`; every hunk landed clean against the local
patches already here, the only file with drift being `parser.rs`, whose
entry-point-offset and sub-layer fixes sit far from the new builders.
The c2_wrapper commit is left out (nothing here uses it) and so is the
Cargo uprev (this tree is path-patched).
Upstream's own tests for the new code pass in the source checkout: 22 in
`codec::h265`, 4 in `codec::h264::nalu_writer`. They cannot run in
`vendor/` because the published crate ships no `src/**/test_data`.2026-08-12
🐛 fix(decode): a tiled HEVC counts its entry points past a u8Ahmet Kaan Gümüş · 907dae0
🐛 fix(decode): a tiled HEVC counts its entry points past a u8 §7.4.7.1 bounds num_entry_point_offsets for a tiles-without-wavefront stream by (num_tile_columns) * (num_tile_rows) - 1, and this parser accepts up to 20 columns by 22 rows -- 440, which it computed in u8 because both counts are u8. Release wrapped it to 183, so a conformant stream's 184th entry point onward was refused and the picture never arrived; a debug build panicked on the multiply. Widened before the multiply, where the spec does the arithmetic. Sibling of fbd4a24 (a real-library 4K wavefront HEVC HDR film's 33 entry points in a [u32; 32]), found by sweeping that fix's own line pair for the same shape.
🐛 fix(decode): a 4K wavefront HEVC is 33 entry points, not 32Ahmet Kaan Gümüş · 65ea910
🐛 fix(decode): a 4K wavefront HEVC is 33 entry points, not 32 A 4K wavefront HEVC film (3840x2160, CTB 64, entropy_coding_sync) writes num_entry_point_offsets = 33 in every slice header -- exactly PicHeightInCtbsY - 1, which is what ITU-T H.265 §7.4.7.1 allows -- and the vendored parser kept them in a [u32; 32]. The 33rd panicked, the plugin edge caught it, and the user got a black picture and an instant eof. The list is now sized by the stream. Same shape swept through the rest of the h265 parser, where a parsed count could outrun a fixed array: tile columns/rows (the CTB grid allows far more than the 19/21 the VA-API picture parameter holds), the long-term ref pic block, and sps/vps_max_sub_layers_minus1, which u(3) can read as 7 into 7-long arrays. Those refuse by name instead. And the door now asks the plugin for one picture before it lets a file in: a session that opens and then decodes nothing was the black screen with no explanation, so it is refused in its own words rather than in the missing-plugin ones.
2026-08-09
🎉 feat: MVP decode pipeline — mp4 → H.264 → gpui previewAhmet Kaan Gümüş · 0acbf8d
🎉 feat: MVP decode pipeline — mp4 → H.264 → gpui preview - engine: mp4 demux → Annex-B, rusty_h264 software decode, BT.601 I420→BGRA; decode on worker thread behind a bounded channel - engine-hw: optional VA-API decode plugin (cros-codecs) behind a C ABI, dlopen'd at runtime with silent software fallback; the app binary keeps zero libva/gbm/drm linkage so it runs on any distro - app: gpui window, per-frame RenderImage swap + drop_image - vendor/: cros-libva + cros-codecs with 3 LOCAL PATCH fixes (libva 1.23 struct init, radeonsi 64x64 min context, pub surface()) — upstream is dormant, so vendor/ is adopted code, not a temp fork - fixtures are gitignored; scripts/gen_fixtures.sh regenerates them