edith_codecs
Clone
0 watching0 forksRust370.3 MiB9b67700Tahinli3 days ago4021 commits
procodecs / codecs half (branch lane-procodecs)
What was built
crates/engine/src/decode/intra.rs: shared pulledStream<S: Seat>+run::<S>span loop +probe()(first-sample facts). Seats:decode/prores.rs(ec-prores),decode/dnxhd.rs(ec-dnxhd),decode/mjpeg.rs(ec-mjpeg).Pulled::{ProRes,Dnxhd,Mjpeg}(next + next_wide),rundispatch in decode.rs,hw_decodesrefuses them (engine-hw arms were already no-ops).- Seeks: every sample is a sync sample; a span starts exactly on the frame (one frame earlier when interlaced, for the deinterlacer).
- Pictures: 10-bit via
Deep(4:2:2/4:4:4 averaged to 4:2:0); 12-bit (ProRes 4444, DNxHD 12) narrowed to 10 (>>2); gray -> I420 neutral chroma; export usesnext_wide(10-bit seat) for ProRes/DNxHD. - Interlace: ProRes/DNxHD frame flag, MJPEG two-JPEG packets (woven by ec-mjpeg, field order from mp4
fiel/mkv FieldOrder viadeinterlace::container_order, default TFF) -> sharedDeinterlacer(flagged_only, like MPEG-2).deinterlace::filter_fieldnow also accepts I444/I410.probe_media().video.interlaced= "tff"/"bff" for these. - MJPEG full range:
probestatesfull_range=true+ BT.601 as the stream's own colour tags;Demuxer::openre-resolvesmeta.color(containercolrstill wins). ProRes/DNxHD matrix/transfer/primaries come from their frame headers. - ProRes alpha: no alpha path exists for video clips in the engine; alpha plane dropped (documented in intra.rs / prores.rs), colour planes unaffected.
- Containers (demux.rs):
CODEC_IDSrow Mjpeg (V_MJPEG/jpeg);MP4_ONLYtable (mjpa, apco apcs apcn apch ap4h ap4x, AVdn AVdh);mkv_private_codec(V_QUICKTIME / V_MS/VFW/FOURCC with AVdn/AVdh in CodecPrivate, mirrors ec-matroska); samples pass verbatim (no Annex-B) in mp4 and mkv.Demuxer::fill_intra(one decode of the first sample at open) fills bit depth (ProRes 422 10, 4444 12, DNx 8/10/12, MJPEG 8), chroma, DNxHD profile, interlace, colour; a named decoder refusal (DNxHD alpha, 12-bit JPEG...) fails the open, a merely undecodable first sample does not. New fieldintrain Mp4Demuxer/MkvDemuxer, accessorDemuxer::intra()(wildcard arm for other variants, so the AVI variant needs no edit). - Capability matrix: unit test extended (Mjpeg row, MP4_ONLY, mkv private rule). Documented gaps in
UNSUPPORTED:V_PRORES(ProRes in Matroska: ec-matroska maps no id),V_QUICKTIME/V_MS/VFW/FOURCC(only DNxHD inside). - Profiles (video_profile.rs): ProRes
422 Proxy|422 LT|422|422 HQ|4444|4444 XQ(from sample-entry fourcc; Apple names, not ffprobe's); DNxHRDNxHR LB|SQ|HQ|HQX|444, DNxHDDNxHD 36..220xby nominal rate (within 6 %). - MCP (crates/mcp/src/tools/media.rs):
codec_phrase("ProRes 422 HQ", "DNxHR HQX", "DNxHD 145", "MJPEG"),plain_codecfor apco.. / AVdn(dnxhd) / AVdh(dnxhr) / V_MJPEG / jpeg / mjpa (mjpeg); unit test added. JSONcodecis the engine name ("ProRes", "DNxHD", "MJPEG"),profilethe profile.
Tests
crates/engine/tests/procodecs.rs (6 tests, ~75 s on host c): ProRes proxy/lt/standard/hq/4444/4444xq/4444+alpha/interlaced; DNxHD 120/185x/36 (1080p), DNxHR lb/sq/hq/hqx/444 (+ sq/hqx in mkv), DNxHD interlaced; MJPEG yuvj420/422 in mov+mkv; two-field MJPEG in mov(mjpa)+mkv; ProRes-in-mkv named gap. Per case: probe (codec, width, fps, depth, profile, interlaced, duration, frame count, sync points), BGRA PSNR vs ffmpeg (measured 31-55 dB, floor 28; 4:4:4 lowest because chroma is averaged, wrong matrix/range = ~24), seeks (7 targets + a range) bit-equal to sequential, export (duration, nb_frames), A/V sync (flash 1.0 s / beep) open + seek + export for 7 clips. Exactness vs ffmpeg is not claimed at the engine level (chroma averaging, 8-bit truncation); the decoders are byte-exact in their own crates. mov vs mkv MJPEG pictures compared.
Hunks in shared files
- export.rs (one line, codec list):
wide: (wide && meta.codec == Codec::Hevc)->matches!(meta.codec, Codec::Hevc | Codec::ProRes | Codec::Dnxhd)(10-bit export seat). - deinterlace.rs:
container_ordermade pub(crate);field_orderreturns the intra facts first;filter_fieldaccepts I444/I410. - No app/project/playback/text/edith changes. App diffs needed: none (file-dialog filters: add
mov/mkvare already there;.mxf/AVI belong to the other half).
Cargo.toml (already in base)
ec-prores, ec-dnxhd, ec-mjpeg = path "../../../edith_codecs/crates/".
Limits
- 4:2:2/4:4:4 are averaged to 4:2:0 and 10/12-bit reduced to 8 for playback (as HEVC/H.264 High 10 do); export keeps 10 bits.
- Per-clip Deinterlace mode is not honoured (as MPEG-2): interlaced ones are always frame-deinterlaced.
- ProRes alpha dropped. ProRes in Matroska and MJPEG-B (
mjpb) not mapped. DNxHD profile name by nominal rate,Nonefor non-Avid rates. - The AVI half can reuse
decode::intra::{probe, Stream}; for AVI setIntraFacts/fill_intraequivalents and pass BottomFieldFirst for MJPG-tag two-field packets.
Gates (host c, final commit "style(engine): intra seat uses as_chunks")
cargo clippy -p engine -p edith_mcp -p edith --release --all-targets -- -D warnings: clean.- Full
cargo test -p engine -p edith_mcp -p edith --release --no-fail-fast: passed 3588, failed 2 (the known VA-API-only h264_/hevc_mid_gop_seeks_match_a_sequential_decode).