mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-17 19:14:26 +00:00
storytold main 83cb1133dd (291 commits) into the integration head bab1a99b85; 47 conflicted files.
- Domain test files (metafile, prepress, pdf plates, settings store, heif, media-testkit, atomic): tests next cut stay cut; tests new on main are kept, as trials where the crate's test target runs trials.
- atomic: main's group-bits test and Faulty::set_group go to src/tests.rs. audio: main's GSM and SBC oracles join tests/main.rs. cms constructors, pdf knockout_backdrop and testing_pdf join their crates' one test binary; timeline's preflight tests become src/preflight_tests.rs trials.
- update: main's changes to detect, install (linux, macos) and the tests land in next's split modules. The app's own offer is inspected on a thread of its own, picked up by tick's polling; settle_for_tests settles offers too. Later on a ready update drops the close it asked for. updater_pin_tests.rs stays deleted; its new pin test is in tests/it/update.rs.
- craft-color: main added a different crate at crates/color (the colour tags of compositor and display frames); it is next's craft-color module `tags`, re-exported at the root.
- Old crates/ui (combo, docking, testing, README) and keymap's ui/view.rs stay deleted; main's new crates/ui/src/testing files are dropped with them.
- New crates in the craft facade: ai, control, dds, frame, ipc, media-source, palette, press-print, score, ssip. testkit and xtask are listed outside it.
- Cargo.lock: the union of both locks, resolved by cargo metadata. Workflow: main's nextest Windows leg, with next's --keep-going clippy.
craft-video
Clean-room pure-Rust video codecs for the Craft apps, one feature per codec: DNxHD/DNxHR, VP8, ProRes and H.264.
- Input and output are byte slices and planar sample buffers; the crate opens no files itself and performs no filesystem I/O.
- Implemented from published standards and RFCs (SMPTE ST 2019-1, RFC 6386, SMPTE RDD 36 and ITU-T H.264).
- Tested against ffmpeg as an external oracle with roundtrips, hostile fuzzing, and conformance vectors.
No
unsafe, no panics on corrupt streams. Builds forwasm32-unknown-unknown. - Containers (MP4/MOV, Matroska/WebM), bit-level I/O (
craft_media::bitstream) and shared identifiers (CodecId,CodecParams) come fromcraft-media.
Cargo features
No codec feature is on by default.
| Feature | Module | Codec |
|---|---|---|
dnx |
dnx |
Avid DNxHD / DNxHR (SMPTE ST 2019-1 VC-3): decoder and encoder |
apv |
apv |
APV (Advanced Professional Video, RFC 9924): decoder (apv-decode alone) and encoder (apv-encode alone) |
vp8 |
vp8 |
VP8 (RFC 6386): decoder |
mpeg2 |
mpeg2 |
MPEG-2 video (ITU-T H.262) and MPEG-1 video (ISO/IEC 11172-2): decoder (mpeg2-decode alone); MPEG-2 encoder with I, P and B pictures and constant or variable bitrate within the VBV buffer (mpeg2-encode, which also turns on the decoder) |
mpeg4 |
mpeg4 |
MPEG-4 Part 2 video (ISO/IEC 14496-2, the Xvid/DivX format): Simple profile encoder (mpeg4-encode) |
hap |
hap |
Vidvox Hap: Hap, Hap Alpha, Hap Q, Hap Q Alpha and Hap Alpha-Only, decoder and encoder, with the Snappy and chunked second stages. DXT1, DXT5, scaled YCoCg-DXT5 and BC4 pictures decode in software; BC7 (Hap R) and BC6 (Hap HDR) frames are read and their blocks returned but not decoded to pictures. |
mjpeg |
mjpeg |
Motion JPEG: a decoder (baseline, extended and progressive Huffman JPEG; the Annex K tables for AVI MJPG packets that have none) and a baseline encoder, both over craft-jpeg. No two-field (MJPEG-A/B) packets and no lossless JPEG. |
prores |
prores |
Apple ProRes (SMPTE RDD 36): decoder and encoder |
h264 |
h264 |
ITU-T H.264 / AVC: decoder (h264-decode alone) and encoder (h264-encode alone) |
hevc |
hevc |
ITU-T H.265 / HEVC: decoder (hevc-decode alone) and encoder (hevc-encode alone) |
vp9 |
vp9 |
VP9: decoder (vp9-decode alone) and encoder (vp9-encode alone) |
av1 |
av1 |
AV1 (AOMedia Video 1): decoder (av1-decode alone) and clean-room encoder (av1-encode); tiled rav1e fallback for large frames (av1-large-encode) |
threads |
— | Multi-threaded slice/row parallelism via rayon |
Decoded frames
Each decoder returns its own picture type. frame::VideoFrame is a codec-agnostic form that
every decoder's output converts into with VideoFrame::try_from (always built; each conversion
comes with its codec's feature):
- Planes are
[Y, Cb, Cr],[R, G, B]or[Y](ColorFamily), plus an optional alpha plane. DNx, VP9 and AV1 (identity matrix) store RGB as G, B, R; the conversion reorders them. - Samples keep the decoder's storage,
u8oru16, with a bit depth per plane (HEVC chroma may differ from luma). Converting moves the buffers and copies no samples. - Chroma subsampling is a log2 shift per axis, 0 to 3 (FFV1 codes up to 3).
- Colour is given as ITU-T H.273 code points (
ColorTags), mapped from each codec's own signalling. Codecs that do not signal a value leave it unspecified (2). pts, sample aspect ratio, field order and the decoder's draft flag are carried over where the decoder reports them. ProRes signals the picture's shape (4:3 or 16:9); the sample aspect ratio is worked out from it and the frame size.
The constructors check that every plane's buffer, stride and size fit the frame, so a picture with inconsistent fields is an error, not an out-of-bounds read.