edith_codecs
Clone
https://git.tahinli.com/Tahinli/edith_codecs.git
0 watching0 forksRust370.3 MiB9b67700Tahinli3 days ago4021 commits
lane-vp9gates — ec-vp9 ready for edith as its software VP9 decoder
Base: 95bc8a76 (main). Branch lane/vp9gates. Worktree ~/.cache/wt/vp9gates.
Changes
- Dead code removed (each verified unused by grep over
crates/ec-vp9and by the compiler):read_partition(src/modes.rs), no callers.TM_PRED(src/tables/mod.rs), no uses.#![allow(dead_code)]insrc/tables/gen_tables.rs. Removing it exposed two unused tables,COEF_CON_TREEandPT_ENERGY_CLASS, which are deleted.- Dead parameters of
read_intra_frame_mode_info(partition_probs,x_mis,y_mis) removed, with the single call site updated.
Cargo.toml[workspace.dependencies]: addedec-vp8andec-vp9in the existing format (ec-vp9-syntaxwas already present).- Input-reachable panics:
- New
compressed_header_slicehelper insrc/decode.rs. The compressed-header slices (three sites) were indexed with sizes read from the frame and could panic on a truncated frame. They now returnError::corrupt. - Tile-data start (
dataafter the compressed header) now usesframe.get(..)and returnsError::corruptwhen out of range. - Left as is, because the guard is local and the code cannot fail: the 4-byte
try_into().unwrap()reads indecode.rs(tile sizes, guarded byensure) andstream.rs(IVF demux, guarded by the loop bound). Theexpect("frame scratch")andexpect("inter walk state")take/restore invariants are unchanged; the new no-panic test exercises them and found no violation. - All
unwrap/expect/panic!sites in#[cfg(test)]code (bool encoder,stack_budget, superframe tests) are out of scope. - Full audit of every slice index in the ~10k lines is NOT done. The no-panic test below is the evidence for input safety, not a proof.
- New
- Clippy clean. Mechanical fixes:
Boxre-assignment (*self.ctx = ...), operator precedence parentheses,div_ceil, unnecessary cast,assert!(!..), inlined format argument,as_chunks,if letfor single-armmatch,&ftof,for fr in. Structural lints are allowed crate-wide insrc/lib.rswith a reason comment:too_many_arguments,type_complexity,needless_range_loop,neg_multiply,collapsible_if,ptr_arg. These mirror libvpx argument lists and spec index loops, and rewriting byte-exact kernels was out of scope. - Marked superseded:
lanes/vp9inter.report.mdandlanes/vp9hbd.report.mdnow begin with the SUPERSEDED line. - New test
crates/ec-vp9/tests/no_panic.rs:truncated_and_corrupted_streams_never_panic. It uses the crate's committedtests/data/*.ivf(11 files), a fixed-seed xorshift generator (seed0x5EED_00F0_0009), 24 container truncations and 24 container corruptions per file, and 24 frame-level mutations (truncation or byte corruption) on each of the first 3 frames after a valid prefix. Every panic is collected with its case label and reported together.
Verify
Run via scripts/remote-run.sh vp9gates -- ....
cargo clippy -p ec-vp9 -p ec-vp9-syntax --all-targets -- -D warnings: exit 0 (clean).cargo test -p ec-vp9 -p ec-vp9-syntax --release --no-fail-fast: 60 passed, 12 failed. Baseline on95bc8a76(same command): 59 passed, 12 failed. The diff of per-test results is only the new testtruncated_and_corrupted_streams_never_panic ... ok. The 12 failing tests are identical on main and on this branch:dump_probe::diff_stats,keyframe_exact(2:keyframes_match_ffmpeg,lossless_64_matches_ffmpeg), andscratch_bool,scratch_err,scratch_hdr,scratch_hdr2,scratch_hdr3,scratch_lfdump,scratch_lossless,scratch_sweep,scratch_tok(9 scratch harnesses).- Cause on the server:
~/fixtures/vp9/does not exist on the hosts (ls ~/fixtureson host a shows novp9directory), sofixtures/vp9/*.ivfreads fail with NotFound. The local primary checkout hasfixtures/vp9/. This is an environment gap, not a code regression. Fixing it needs the server fixtures synced; I did not change the hosts.
- The new no_panic test passes on this seed with zero panics (about 9 s in release).
Left
- Fixture-dependent tests (above) need
fixtures/vp9/on the server to be green. - Full slice-index audit of
decode.rs,inter.rs,mc.rs,loopfilter.rsfor input reachability is not done. The no-panic test samples it; a fuzz pass would go further. decode_syntaxdoc says "decode still refuses inter frames", which contradicts the inter path indecode.decode_streamdoc mentionsvp9 interrefusals for "lane-ineligible" frames. Both docs look stale; not edited here.- Debug env hooks (
EC_VP9_FORCE_UH,EC_VP9_FORCE_HSZ, trace gates) are read in the decode path; they can change header sizes. Left in place.
Public API for edith (summary)
Entry points:
ec_vp9::decode::Decoder:new()/Default,decode(&mut self, frame: &[u8]) -> Result<Option<Picture>>(one frame or one superframe chunk;Somewhen shown),decode_syntax(&mut self, frame: &[u8]) -> Result<()>(syntax harness), andlast_frame_blocks(&self) -> usize.ec_vp9::stream::decode_stream(data: &[u8]) -> Result<Vec<Picture>>anddecode_stream_with(data, sink: FnMut(&Picture, usize, u64) -> Result<()>)for whole IVF (DKIF/VP90) streams.
Frame type: ec_vp9::decode::Picture with y, u, v: Vec<Sample> (cropped planes),
width, height: u16, stride, uv_stride: usize, bit_depth: u8, subsampling_x,
subsampling_y: u8. Sample = u16 for every depth.
Errors: ec_vp9::{Error, Result} (re-exported from ec_core).
Supported (per crate docs and decode_one):
- Profiles 0-3. Profile 3 reserved-zero bit is enforced (corrupt otherwise).
- Bit depth 8, 10, 12. Other depths are
Error::unsupported. - Subsampling 4:2:0, 4:2:2, 4:4:0, 4:4:4.
- Keyframes, intra-only frames, inter frames (MC, residual, loop filter, 8-slot DPB),
scaled references,
show_existing_frame, odd dimensions.
Not verified here: edith wiring. Nothing in edith is changed by this lane.
Commit
lane/vp9gates: ec-vp9 dead code, checked slices, clippy clean, no-panic test