Commits
2026-11-26
2026-11-25
ec-hw: EncoderConfig::buffer_ms overrides the rate-control buffer (None keeps 20 ms below GOP 10, else 1000 ms)Ahmet Kaan Gümüş · 600391dBrowse files
vk: VA rate feedback and HRD buffer on Vulkan, H.264 profile, colour configAhmet Kaan Gümüş · ff39f7f
vk: VA rate feedback and HRD buffer on Vulkan, H.264 profile, colour config hrd_buffer_ms and RateFeedback move to a shared ec-hw rate module, used by the VA and Vulkan encoders. Vulkan CBR now runs the 1000 ms buffer for GOP >= 10 and applies the steered bitrate through set_rate, no IDR. The H.264 profile maps to profile_idc, constraint_set1 (Constrained Baseline), PPS transform_8x8_mode and entropy_coding_mode. A profile the driver rejects is Unsupported. The colour description goes into the H.264/H.265 VUI and the AV1 colour config, as VA writes it. Adds the hw_config example: H.264 Main, BT.601 full range, GOP 15, forced key frame at 7; Vulkan and VA match in ffprobe fields and key frames.
ec-hw: compiles on every OS; VA (ec-va) is linux-only, pure config/frame types move to ungated types.rs/picture.rs with old paths re-exportedAhmet Kaan Gümüş · a588a1eBrowse files
ec-va: import_prime_raw / RawPrimeObject import DMA-BUFs by borrowed RawFd; cros-libva vendored in shims with Buffer owning its params, fixing a use-after-free of VAProcPipelineParameterBuffer regions that made every VPP region/scale convert render nothing (encode_surface/encode_frame of a size-mismatched source encoded black); ec-hw: submit_prime scales any source size to the encoder's size on the GPUAhmet Kaan Gümüş · d27d669Browse files
2026-11-16
ec-hw: 10-bit HEVC encode, pipelined submit/flush, prime submit, CBR/VBR closed-loop rate correction; remove edith-sinkAhmet Kaan Gümüş · ccbbd43
ec-hw: 10-bit HEVC encode, pipelined submit/flush, prime submit, CBR/VBR closed-loop rate correction; remove edith-sink - submit/submit_16/submit_prime + flush: DEPTH-3 pipelined encode, pool zero-filled - submit_prime: GPU copy of an imported surface into a pool surface, padding zeroed (bit-identical to the CPU upload path) - rate control: once-a-second bias + debt correction; mesa 26.2.6 / fw 20261019 overshoot 12-19% on detailed content (ffmpeg vaapi too) - edith-sink removed: the MCP export path covers it
2026-11-15
2026-10-23
Restore edith_codecs after local data loss (2026-10-23)Ahmet Kaan Gümüş · b7434a2
Restore edith_codecs after local data loss (2026-10-23) On 2026-10-23 an automated agent ran `rm -rf $HOME` and deleted the local repository with all of its history. This commit restores the working tree from the newest surviving copy, the host-c server lane mirror. That mirror matches local main as of the testcut Phase 2 reports, including the tool cache, the nextest fast profile and changed-crates.sh. The history before this commit was not recovered.
2026-09-07
feat(ec-hw): 10-bit BD row, 10-bit fps, ec-bench 10-bit row, docsAhmet Kaan Gümüş · ebea85e
feat(ec-hw): 10-bit BD row, 10-bit fps, ec-bench 10-bit row, docs The 10-bit BD row is film B's own 1920x1024 native crop, every arm in the 10-bit domain: hw AV1 10-bit is +36.7% BD-rate against librav1e speed 6 10-bit and +52.9% against libaom cpu-used 6 10-bit, with all three ladders asserted monotone. av1_encode_speed gains a 3840x1608 10-bit row, and ec-bench an 'ec-hw av1 10-bit' encode row that skips as a row without a VA device.
feat(ec-hw): CBR, VBR and QVBR rate control for hardware encodeAhmet Kaan Gümüş · 5fcd26f
feat(ec-hw): CBR, VBR and QVBR rate control for hardware encode The AV1 path had only ever measured CQP because the VA config was created without a VAConfigAttribRateControl at all: a driver configured for CQP ignores a bitrate handed to it afterwards. The attribute is now set from the mode, and VariableBitrate / Qvbr join the enum (VBR sends the ask as a 1.5x ceiling at 66%, QVBR sends quality_factor, which needed a field in VAEncMiscParameterRateControl's payload). Root cause of a 20% CBR undershoot, found by comparing with ffmpeg's own av1_vaapi on the same clip (it undershot 8%): the HRD buffer was two rate windows starting half full. One window, three quarters full -- what ffmpeg asks for -- brings CBR to -4.2/-5.1/-7.9% and VBR to +1.0/-3.8/-6.9% at 2/6/12 Mbps on film A 1080p30. Gate av1_encode_rate_control_lands prints the whole table (pix_fmt, mode, target, delivered, PSNR) and asserts CBR within 15%, VBR within 25%, PSNR monotone in the target, and QVBR under its ceiling.
feat(ec-hw): 10-bit AV1 hardware encodeAhmet Kaan Gümüş · 98dcdcf
feat(ec-hw): 10-bit AV1 hardware encode His whole AV1 library is yuv420p10le, so an 8-bit-only hardware encoder does not serve his files. EncoderConfig gains a bit_depth (8, or 10 for AV1: H264High and HEVCMain are 8-bit profiles by definition, which is a fact about the profiles this crate configures, not a driver refusal), a 10-bit encoder allocates P010 surfaces, uploads through encode_16, sets bit_depth_minus8 = 2 in the sequence parameters and high_bitdepth in the sequence header OBU it packs. encode_frame now passes a 10-bit decoded surface straight through when the encoder is 10-bit too, and VPPs only when the depths or the sizes differ. Gate av1_10bit_encode_agrees_between_two_decoders on film B's own 1920x1024 native crop: ec-av1 and libdav1d agree sample for sample on all 10 frames, ffprobe reads yuv420p10le out of the sequence header, decoded peak luma 610 (> 255), worst frame 48.09 dB from the source in the 10-bit domain.
feat(ec-hw): AV1 encode on by default, and an ec-bench hardware rowAhmet Kaan Gümüş · 24f4e5c
feat(ec-hw): AV1 encode on by default, and an ec-bench hardware row The opt-in existed because a 2026-08-14 submission crashed the GPU; on mesa 26.1.8 the path encodes streams two decoders agree on, so the refusal goes rather than outliving its evidence. ec-bench gains an 'ec-hw av1 encode' row that skips as a row when there is no VA device.
feat(ec-hw): AV1 hardware encode that two independent decoders agree onAhmet Kaan Gümüş · a518304
feat(ec-hw): AV1 hardware encode that two independent decoders agree on The AV1 encode path submitted parameters no header described: radeonsi parses the application's sequence and frame header OBUs and writes the stream from them, so without those OBUs the coded buffer meant nothing. This writes both (spec 5.5.1 / 5.9.1, the subset the driver advertises: one tile, one reference, no CDEF, no restoration, no superres), fills the picture parameter buffer to agree with them field for field, and prepends the temporal delimiter the driver does not emit. Gate: ec-av1 and ffmpeg's libdav1d decode every shown frame of a 640x384 and a 1920x1080 stream sample for sample, and the coded picture is within 60 dB of the one submitted.
2026-08-20
feat(ec-hw): route coded-size-mismatched encode_frame sources through VPP region copyAhmet Kaan Gümüş · 58e23aa
feat(ec-hw): route coded-size-mismatched encode_frame sources through VPP region copy Encoder::encode_frame refused any source whose coded_size differed from the encoder's block-rounded one (HEVC rounds to 32, so a 3840x2160 source's 2160 stayed unrounded while the HEVC coded height became 2176). Add Vpp::convert_region (crates/ec-va/src/vpp.rs) — a VAProcPipelineParameterBuffer submission with explicit surface_region/output_region rectangles, no scaling — and route both 10-bit (P010) and now 8-bit coded-size-mismatched sources through it into the encoder's own NV12 pool, placed at (0,0) using frame.display_size. Encoder's own SPS conformance window / frame_cropping (already sized from EncoderConfig.width/height, independent of the source frame) makes the produced stream report the true visible size, not the padded coded one. The pool is painted black/neutral-chroma once on creation (Encoder::fill_black) so the padding rows a region copy never touches are deterministic rather than driver-fresh-allocation garbage. Real 4K HEVC Main10 mkv (3840x2160): - encode_frame_accepts_p010_via_vpp: HEVC now accepted and round-trips (worst Y inf dB, worst UV 96.2 dB vs the CPU path; H264 worst Y/UV inf dB), and ffprobe confirms the produced stream is 3840x2160 for both targets. - p010_zero_copy_encode_is_realtime (--release): H264 zero-copy 6.52 ms/frame median (CPU path 18.80), HEVC zero-copy 5.29 ms/frame median (CPU path 16.95) — both under the 20 ms/frame target. cargo test -p ec-va -- --test-threads=1: 13 + 6 doctests, all green. cargo test -p ec-hw --release --test gpu -- --test-threads=1: 27 passed.
feat(ec-hw): P010 encode_frame goes through a GPU-resident VAProfileNone/VideoProc VPP pass, not CPU read-backAhmet Kaan Gümüş · 67c8428
feat(ec-hw): P010 encode_frame goes through a GPU-resident VAProfileNone/VideoProc VPP pass, not CPU read-back encode_frame previously refused any 10-bit (P010) frame outright, forcing a consumer's HDR->proxy export onto to_i420()+re-upload for the whole path. This adds ec_va::Vpp (Config/Context/Buffer/Picture — all the existing generic VA-API machinery, no new unsafe outside ec-va) wrapping VAProfileNone/VAEntrypointVideoProc, and wires a lazily-built 2-surface NV12 pool + Vpp into ec_hw::Encoder: a 10-bit frame is converted P010->NV12 on the GPU (VAProcPipelineParameterBuffer, whole-surface, no filters) and then submitted through the exact same encode_surface() path as an 8-bit frame. radeonsi capability check (vainfo): VAProfileNone/VAEntrypointVideoProc is advertised on this GPU, confirming the entrypoint this crate now uses is real hardware support, not a driver gap. HDR->SDR tonemap (VAProcFilterHighDynamicRangeToneMapping) was NOT wired: sys.rs carries the filter-type constants and Vpp::filters() (vaQueryVideoProcFilters) to check for it, but the charter's own gpu.rs tests (PSNR/bench harness) were not written this round — see the ledger DELTA for the honest state of that gap. Scoped compiles green: `cargo check -p ec-va[--tests]`, `cargo check -p ec-hw[--tests]`. The 23-test `ec-hw --test gpu` regression and a live P010 decode+encode_frame+decode-back PSNR run were NOT executed this round (budget) — next round's first move.
feat(hw): expose HEVC prefix-SEI HDR peak and VUI colour tags on Frame/DecoderAhmet Kaan Gümüş · 7669974
feat(hw): expose HEVC prefix-SEI HDR peak and VUI colour tags on Frame/Decoder
edith's replica needs MaxCLL/MaxFALL for HDR films whose container never
carried them (they live only in HEVC content_light_level/mastering_display
SEI) — ec-hw's decode() dropped every SEI NAL on the floor. HevcDecoder now
merges ec_core::color::hevc_sei_light per access unit (sticky across frames
that carry none) and resolves VUI colour tags from the SPS; H264Decoder
resolves VUI tags only (no SEI parsing for that codec yet); VP9/AV1 report
None (not implemented). New Frame::colour()/Decoder::colour() surface it,
bundled as ec_hw::frame::Colour{description, light} over the existing
ec-core ColorDescription/ContentLight types.
Tests: hdr_film_light_level_sei_is_exposed pins MaxCLL/MaxFALL 1230/419 and
primaries/transfer/matrix 9/16/9 against the real ReelD rip;
sdr_h264_colour_never_panics proves the VUI-only path doesn't panic on an
SDR fixture (skips when no fixtures generated, same convention as the rest
of gpu.rs).feat(ec-hw): zero-copy decode-to-encode surface path, VUI colour descriptionAhmet Kaan Gümüş · fc705c7
feat(ec-hw): zero-copy decode-to-encode surface path, VUI colour description Encoder::encode_frame submits a Frame's decoded VA surface directly as the encoder's source picture, with no to_i420 CPU read-back and no re-upload — what the consumer's previous backend did for a decode-then-encode pipeline. Refuses a cross-Display frame, a 10-bit (P010) source (no Main10 profile is built here), or a coded-size mismatch with a typed Error. EncoderConfig::colour(primaries, transfer, matrix, full_range) reaches the VUI of both the H.264 and HEVC packed SPS writers (video_signal_type_present_flag / colour_description_present_flag), so an HDR or BT.709 export stops reading back as "unspecified". Live-GPU tests in gpu.rs cover both: encode_frame vs the CPU-path baseline on the same decoded frames (PSNR compared, further: they came back byte identical on this driver), and ffprobe reading BT.2020/PQ/BT.2020nc back off a written stream while the no-colour-set case stays deterministic.
2026-08-14
feat(hw): hardware encoding for H.264 and HEVC, AV1 behind an opt-inAhmet Kaan Gümüş · 7368f27
feat(hw): hardware encoding for H.264 and HEVC, AV1 behind an opt-in IDR-then-P with a single reference, CQP or CBR, one frame in and one coded frame out. HEVC encoding is in the tree rather than on a branch, which is the whole point of writing this one: the conformance window is a field of the sequence, so 1916x1080 comes out the size it went in. The packed headers are the application's job here. This driver advertises `SEQUENCE | PICTURE | SLICE` and then writes none of them itself, so the crate writes the H.264 parameter sets and slice headers, and reuses `ec-h265-syntax` for the HEVC ones — the same code that parses them. Two driver behaviours are pinned down by comment where they were found by measurement: the parameter sets only reach the stream when a slice header accompanies them, and the HEVC slice header this driver composes omits `slice_loop_filter_across_slices_enabled_flag`, so the PPS has to say the flag is absent or every P picture decodes as `alignment_bit_equal_to_one = 0`. AV1 encoding is refused unless a caller sets `allow_av1`. That guard is not caution for its own sake: a probe at the driver's own minimum encode size took the GPU down with a hard recovery on 2026-08-14, and there is no error to return from a context that no longer exists.