mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-17 00:34:25 +00:00
craft-video: FilmCraft's later H.264 encoder work (High 10, threads, sub-pel diamond) and its H.264 and ProRes tests * craft-video: H.264 High 10 and High 10 Intra in the encoder The encoder is generic over the sample type (u8 at 8 bits, u16 at 9-10 bits): QP' = QP + QpBdOffset for quantisation and lambdas, mb_qp_delta range and wrap, chroma QP mapping, deblocking thresholds scaled to the bit depth, clipping in prediction, interpolation and reconstruction. SPS bit depths, profile_idc 110, constraint_set3 for High 10 Intra, avcC high-profile fields, the High 10 cpbBrVclFactor for level choice. New YuvFrame16 / Encoder::encode16, EncoderConfig::bit_depth / intra_only. 8-bit output is unchanged. Merged onto craft-video's copy: its input stride checks, B-frame timestamp check, configuration validation, level 6.2 refusal, motion search start candidates and codec_params are kept. Ported from storytold/filmcraft#1580 (commit d24ce15e). * craft-video: the H.264 encoder honours threads: 1 and reuses MbInfo buffers; raw-YUV bench - A pool is built for every thread count, including 1: rayon calls outside install run on the global pool (all cores), so threads: 1 used to run on every core. A pool that cannot be built is an InvalidConfig error. - Up to eight macroblock-info buffers are recycled between pictures and cleared on reuse, instead of allocating one per picture. - examples/h264_h264enc_bench.rs encodes a raw YUV file and reports speed; its argument checks run as tests. Ported from storytold/filmcraft#3205 (merge 08f8075a). * craft-video: H.264 encoder sub-pel refinement on a 4-point diamond; 16x8 and 8x16 only after 8x8 beat 16x16 Sub-pel refinement tries the four axis neighbours instead of all eight, and the 16x8 / 8x16 partitions are searched only when 8x8 beat 16x16: fewer SATD evaluations for about the same decisions. craft-video's own motion search start candidates are kept. Ported from storytold/filmcraft#3207 (merge 8db5334c). * craft-video: FilmCraft's H.264 encoder tests; EncoderConfig::writer names the program in the SEI The encoder had no integration tests here. FilmCraft's come along as the h264_encode test target: ffmpeg/ffprobe oracle decodes (8-bit and High 10, bit-exact against the reconstruction), pinned decisions, CRF level choice and the settings SEI, thread counts and VBR overshoot. EncoderConfig::writer is the program and version the identification SEI names (craft-h264enc and this crate's version by default), so an application's files keep naming it. Two expectations differ from FilmCraft's copy: the pinned slice hashes (this encoder also starts the 16x16 search from the skip, zero and co-located vectors; with those left out and FilmCraft's writer name, it gives FilmCraft's four hashes exactly) and a CRF that is not a number, which this encoder refuses. * craft-video: FilmCraft's ProRes tests (oracle decode and encode, round trip, fuzz, perf) craft-video's ProRes copy came with only its hostile-input test. FilmCraft's ffmpeg oracle decode and encode tests, round trips, mutation fuzz and the ignored throughput tests come along; craft-video's own fuzz_hostile stays. Frame::new returns a Result here, so the tests unwrap it. --------- Co-authored-by: JordyUSA <75485565+JordyUSA@users.noreply.github.com> Co-authored-by: vangel76 <vangel1976@googlemail.com>
139 lines
3.3 KiB
TOML
139 lines
3.3 KiB
TOML
[package]
|
|
name = "craft-video"
|
|
description = "Clean-room pure-Rust video codecs, one feature per codec: DNxHD/DNxHR, VP8, ProRes, H.264, HEVC, VP9, AV1."
|
|
version.workspace = true
|
|
edition.workspace = true
|
|
license.workspace = true
|
|
rust-version.workspace = true
|
|
repository.workspace = true
|
|
|
|
[package.metadata.docs.rs]
|
|
all-features = true
|
|
|
|
[lints]
|
|
workspace = true
|
|
|
|
[features]
|
|
# Every codec feature turns on one codec module; none is on by default.
|
|
# DNxHD / DNxHR (SMPTE ST 2019-1): decoder and encoder.
|
|
dnx = []
|
|
# APV (Advanced Professional Video, RFC 9924): decoder and encoder; `apv-decode` or `apv-encode` for one of them.
|
|
apv = ["apv-decode", "apv-encode"]
|
|
apv-decode = ["craft-media/bitstream"]
|
|
apv-encode = ["craft-media/bitstream"]
|
|
# VP8 (RFC 6386): decoder and encoder; `vp8-decode` or `vp8-encode` for one of them.
|
|
vp8 = ["vp8-decode", "vp8-encode"]
|
|
vp8-decode = []
|
|
vp8-encode = []
|
|
# MPEG-2 video (ITU-T H.262) and MPEG-1 video (ISO/IEC 11172-2): decoder.
|
|
mpeg2 = []
|
|
# Apple ProRes (SMPTE RDD 36): decoder and encoder.
|
|
prores = ["craft-media/bitstream"]
|
|
# H.264 / AVC: decoder and encoder; `h264-decode` or `h264-encode` for one of them.
|
|
h264 = ["h264-decode", "h264-encode"]
|
|
h264-decode = ["craft-media/bitstream"]
|
|
h264-encode = ["craft-media/isobmff"]
|
|
# H.265 / HEVC: decoder and encoder; `hevc-decode` or `hevc-encode` for one of them.
|
|
hevc = ["hevc-decode", "hevc-encode"]
|
|
hevc-decode = ["craft-media/bitstream"]
|
|
hevc-encode = ["craft-media/isobmff"]
|
|
# VP9: decoder and encoder; `vp9-decode` or `vp9-encode` for one of them.
|
|
vp9 = ["vp9-decode", "vp9-encode"]
|
|
vp9-decode = ["craft-media/bitstream"]
|
|
vp9-encode = ["craft-media/isobmff"]
|
|
# AV1: decoder and encoder; `av1-decode` or `av1-encode` for one of them.
|
|
av1 = ["av1-decode", "av1-encode"]
|
|
av1-decode = []
|
|
av1-encode = ["craft-media/isobmff"]
|
|
# Decode and encode across worker threads (rayon) in the codecs that support it.
|
|
threads = ["dep:rayon"]
|
|
|
|
[dependencies]
|
|
craft-media = { workspace = true }
|
|
thiserror = { workspace = true }
|
|
rayon = { workspace = true, optional = true }
|
|
|
|
[dev-dependencies]
|
|
craft-media-testkit = { workspace = true }
|
|
|
|
[[test]]
|
|
name = "dnx"
|
|
required-features = ["dnx"]
|
|
|
|
[[test]]
|
|
name = "apv"
|
|
required-features = ["apv"]
|
|
|
|
[[test]]
|
|
name = "vp8"
|
|
required-features = ["vp8-decode"]
|
|
|
|
[[example]]
|
|
name = "vp8_fuzz"
|
|
required-features = ["vp8-decode"]
|
|
|
|
[[example]]
|
|
name = "vp8_vp8dec"
|
|
required-features = ["vp8-decode"]
|
|
|
|
[[test]]
|
|
name = "av1_decode"
|
|
required-features = ["av1-decode"]
|
|
|
|
[[example]]
|
|
name = "av1_av1dec"
|
|
required-features = ["av1-decode"]
|
|
|
|
[[test]]
|
|
name = "h264_decode"
|
|
required-features = ["h264-decode"]
|
|
|
|
[[test]]
|
|
name = "h264_encode"
|
|
required-features = ["h264-encode"]
|
|
|
|
[[example]]
|
|
name = "h264_h264dec"
|
|
required-features = ["h264-decode"]
|
|
|
|
[[example]]
|
|
name = "h264_h264enc_bench"
|
|
required-features = ["h264-encode"]
|
|
test = true
|
|
|
|
[[test]]
|
|
name = "hevc_decode"
|
|
required-features = ["hevc-decode"]
|
|
|
|
[[example]]
|
|
name = "hevc_hevcdec"
|
|
required-features = ["hevc-decode"]
|
|
|
|
[[test]]
|
|
name = "vp8_encode"
|
|
required-features = ["vp8"]
|
|
|
|
[[test]]
|
|
name = "vp9_decode"
|
|
required-features = ["vp9-decode"]
|
|
|
|
[[example]]
|
|
name = "vp9_vp9dec"
|
|
required-features = ["vp9-decode"]
|
|
|
|
[[test]]
|
|
name = "mpeg2"
|
|
required-features = ["mpeg2"]
|
|
|
|
[[test]]
|
|
name = "prores"
|
|
required-features = ["prores"]
|
|
|
|
[[test]]
|
|
name = "hevc"
|
|
required-features = ["hevc-encode"]
|
|
|
|
[[test]]
|
|
name = "av1"
|
|
required-features = ["av1"]
|