Commits
Commits on
2a2adbabb7cf5c876fc67adeb705e5b6f8efdd0dFiltered to crates/ec-av1/src/encoder.rsClear filter2026-09-04
refactor(av1): FrameCtx stays crate-private -- public signatures back to what they wereAhmet Kaan Gümüş · 1c71b70
refactor(av1): FrameCtx stays crate-private -- public signatures back to what they were The FrameCtx refactor threaded `&crate::decode::FrameCtx` through 21 `pub fn` signatures, which put a `pub(crate)` type in the crate's public API: external callers of `Av1Encoder::encode` stopped compiling (tools/ec-bench). `Av1Encoder` now owns its `FrameCtx` -- one per stream, not per frame, since the inter-frame inheritance guards carry state across frames -- so `encode` takes `(&mut self, picture)` again. `encode_key_frame`, `encode_key_frame_with_modes` and `encode_sequence` keep their old public signatures as wrappers over `pub(crate) *_with_ctx` inners that make the context. The other 14 helpers that gained the parameter (intra/mc/warp/motion predictors, `decode_key_frame_tile`) have no caller outside the crate and become `pub(crate)`. `Av1Encoder` is still `Send` (compile-time assert), but owning cells makes it `!Sync`; nothing in the workspace shares one by reference.
refactor(av1): the 38 per-frame decode-state thread_locals become one FrameCtxAhmet Kaan Gümüş · b9a9498
refactor(av1): the 38 per-frame decode-state thread_locals become one FrameCtx Every per-frame/per-stream decode state in ec-av1 lived in a thread_local! static, so a decode was a function of the calling THREAD's history rather than of the bitstream, and a worker thread saw empty state -- the blocker for frame-parallel decoding. All 38 (SB128, BIT_DEPTH, SUPERRES, CDEF_*, DELTA_Q_*/DELTA_LF_*, CURRENT_Q_IDX, QUANT_DELTAS, the 9 SEG* maps, TX_SELECT_INTER, REDUCED_TX_SET_INTER, ENABLE_FILTER_INTRA_INTER, PALETTE_PRED, INTRABC_*, LUMA_TX_TYPE, INTRA_IN_INTER_MODE, INTER_STRIP_CHROMA, INTER_LAST_MC, ENABLE_EDGE_FILTER, LAST_FRAME_WIDE_MARGIN, REACH_SB_PX, GRAIN_BIT_DEPTH) are now fields of decode::FrameCtx, owned by decode_stream_with and threaded as `fctx: &FrameCtx` down the decode call graph (~1200 call sites). The fields keep the Cell/RefCell interior mutability the statics had, so every read/write site is byte-identical and this is a pure ownership move; Cell/RefCell also make FrameCtx !Sync on purpose -- one context per decoding thread, never shared. The scratch pools, gate hit counters and trace switches stay thread_local by design.
2026-09-01
fix(av1): have_ffmpeg() SKIPped green under EC_AV1_REQUIRE_AOMENC=1Ahmet Kaan Gümüş · 91c1335
fix(av1): have_ffmpeg() SKIPped green under EC_AV1_REQUIRE_AOMENC=1 Every real-aomenc gate opens `if !have_ffmpeg() || !have_aomenc()`, and only have_aomenc() asserted under the require flag -- have_ffmpeg() is evaluated first and short-circuits, so a machine without ffmpeg printed SKIP and the whole 20-gate batch reported green with the require flag set (class gate-skips-on-its-own-failure). have_ffmpeg() now mirrors have_aomenc(): absence panics when EC_AV1_REQUIRE_FFMPEG=1 or EC_AV1_REQUIRE_AOMENC=1 is set (an aomenc gate decodes its stream through ffmpeg, so requiring the oracle implies requiring ffmpeg). Applied to all five copies of the helper (stream/tile/decode/encode/encoder test modules), which had the same silent-false shape.
2026-08-30
2026-08-27
feat(av1): a quality/size targeting surface over base_q_idxAhmet Kaan Gümüş · a55d2ef
feat(av1): a quality/size targeting surface over base_q_idx
RateTarget::{QIndex,Quality,BytesPerFrame} on Av1Encoder::with_rate_target,
additive alongside the existing EncoderConfig::base_q_idx path. Quality
maps to base_q_idx via the calibration sweep's linear fit; BytesPerFrame
steers it with a clamped proportional controller (no accumulated debt, so
no windup class to bound). Calibration sweep test records the curve.2026-08-26
wip(av1): write the true display size as frame_width/height, not the padded oneAhmet Kaan Gümüş · 6b1cdcc
wip(av1): write the true display size as frame_width/height, not the padded one Frame headers now carry the picture's true (unpadded) size as frame_width/frame_height, with mi_cols/mi_rows derived from that true size via spec compute_image_size (2*((w+7)>>3)) instead of the padded picture's width/4 -- mirroring rav1e/libaom, so a decoder crops to the true size instead of the coded (padded-to-32/64) one. render_width/render_height come out equal to frame_width/frame_height, so render_and_frame_size_different is false and no render_size bits are written. tile.rs: check_blocks no longer requires mi_cols/mi_rows to be an exact multiple of the 32x32 block grid (a true size need not be); a new block_grid() ceiling-divides mi_cols/mi_rows into the block-column/row count actually coded, shared by sb_coeff_key_frame_tile, split_coeff_key_frame_tile and (now) encode_key_frame_inner's own block/superblock generation loop, which used to derive its cols/rows straight from the padded picture's width -- it must agree with the tile writer's own count exactly. KNOWN REGRESSION, not yet root-caused: three existing round-trip tests that used a size not a whole 32x32 (or, for the facade, 64x64) block now fail ffmpeg/dav1d decode with "Invalid data found" (an_854x480_picture_round_ trips_through_its_padding, a_frame_round_trips_at_its_own_size at 1920x1080/ 640x352/1280x720, sequence_round_trips_at_a_non_multiple_size at 160x96). Reasoned through the cols/rows/has_cols/has_rows arithmetic by hand for the BLOCK(32)-alignment case and it should be invariant (true mi_cols/mi_rows land in the same (padded-8, padded] window that keeps every BLOCK_MI(8)- aligned threshold's comparison unchanged) -- confirmed by an EC_RNG-gated rng-per-symbol trace (temporary, reverted) diverging from aomdec's own trace from the very first symbol, which does not match that reasoning and was not resolved before the turn budget ran out. The three tests' own assertions were updated to expect the new true-size ffprobe/decode behaviour (that part is not in question); the decode failure itself is the open defect. Not attempted: sb_coeff_inter_frame_tile has no has_cols/has_rows-style partial-superblock handling at all (always PARTITION_SPLIT, always 4 quadrants) -- a true size that isn't a 64x64 (SUPERBLOCK) multiple needs that ported from the key-frame writer before an inter/multi-frame stream can use a true, non-superblock-aligned size. The facade's key-frame path already regresses today for the same underlying reason before inter frames are even reached.
feat(av1): streaming encoder facade with configurable colour (I11)Ahmet Kaan Gümüş · f421d98
feat(av1): streaming encoder facade with configurable colour (I11)
Av1Encoder is the one-in-one-out surface edith_replica's engine will call
in place of rav1e: EncoderConfig{width,height,base_q_idx,gop,colour} in,
encode(&Picture) -> Packet{data,key,order} out, gop-cadenced key frames
predicting inter frames from the previous reconstruction like
encode_sequence already did. encode_key_frame_inner/encode_inter_frame
are now shared (pub(crate)) between encode_sequence and the facade
instead of being duplicated. The sequence header's colour_config is wired
to Colour::{Bt709Limited,Bt601Limited,Unspecified} (spec 5.5.2's CICP
triple + range), replacing the hardcoded "unspecified" -- verified against
ffprobe.