Merge pull request #3765 from storytold/onee/i781-drop-filmcraft-codec-pins

media, export: drop the filmcraft-mpegts, -vp9, -hevc and -av1 pins for craft-libs (#781)
This commit is contained in:
FredApps authored and GitHub committed 2026-11-16 12:04:47 +01:00
commit 6ddcd5ee9c
9 files changed
+29 -52

No files matched your search

Generated
-4
View File
@@ -1875,9 +1875,6 @@ dependencies = [
"effectcraft-render",
"effectcraft-time",
"exr",
"filmcraft-av1",
"filmcraft-hevc",
"filmcraft-vp9",
"gif",
"image",
"log",
@@ -2050,7 +2047,6 @@ dependencies = [
"filmcraft-color",
"filmcraft-frame",
"filmcraft-media",
"filmcraft-mpegts",
"filmcraft-time",
"gif",
"image",
-8
View File
@@ -103,13 +103,6 @@ filmcraft-media = { git = "https://github.com/storytold/filmcraft", rev = "d5ead
filmcraft-frame = { git = "https://github.com/storytold/filmcraft", rev = "d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" }
filmcraft-color = { git = "https://github.com/storytold/filmcraft", rev = "d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" }
filmcraft-time = { git = "https://github.com/storytold/filmcraft", rev = "d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" }
# MPEG TS / PS headers read for AAC channel layouts (crates/media); craft-media has no MPEG TS reader
filmcraft-mpegts = { git = "https://github.com/storytold/filmcraft", rev = "d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" }
# decoders used as the round-trip oracles of craft-video's VP9, HEVC and AV1 encoders (crates/export
# dev-dependencies only); craft-video has no decoder for them
filmcraft-vp9 = { git = "https://github.com/storytold/filmcraft", rev = "d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" }
filmcraft-hevc = { git = "https://github.com/storytold/filmcraft", rev = "d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" }
filmcraft-av1 = { git = "https://github.com/storytold/filmcraft", rev = "d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" }
# timeline interchange (EDL, FCP7 XML, FCPXML, OTIO) for Premiere Pro interop (crates/interchange only)
filmcraft-interchange = { git = "https://github.com/storytold/filmcraft", rev = "d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" }
filmcraft-project = { git = "https://github.com/storytold/filmcraft", rev = "d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" }
@@ -144,7 +137,6 @@ sys-locale = "0.3"
# filmcraft-frame = { path = "../filmcraft/crates/frame" }
# filmcraft-color = { path = "../filmcraft/crates/color" }
# filmcraft-time = { path = "../filmcraft/crates/time" }
# filmcraft-mpegts = { path = "../filmcraft/crates/mpegts" }
[workspace.lints.rust]
unsafe_code = "forbid"
+2 -3
View File
@@ -31,7 +31,6 @@ tempfile = { workspace = true }
effectcraft-media = { workspace = true }
effectcraft-effects = { workspace = true }
effectcraft-color = { workspace = true }
filmcraft-hevc = { workspace = true }
filmcraft-av1 = { workspace = true }
filmcraft-vp9 = { workspace = true }
# The decoders that check the VP9, HEVC and AV1 encoders round-trip (av1 is already on).
craft-video = { workspace = true, features = ["vp9-decode", "hevc-decode"] }
effectcraft-keyframe = { workspace = true }
+2 -2
View File
@@ -86,13 +86,13 @@ pub struct Run {
pub lf_levels: Vec<u32>,
}
/// Encodes `pics`, checks every packet decodes (filmcraft-av1) to exactly the encoder's
/// Encodes `pics`, checks every packet decodes (craft-video's AV1 decoder) to exactly the encoder's
/// reconstruction and returns packets, reconstructions and luma PSNRs.
pub fn encode_and_check(cfg: EncoderConfig, pics: &[Pic]) -> Run {
let bd = cfg.bit_depth as u32;
let mut enc = Encoder::new(cfg).expect("config");
// single-threaded: each packet's picture comes out of its own decode call
let mut dec = filmcraft_av1::Decoder::with_threads(1);
let mut dec = craft_video::av1::decode::Decoder::with_threads(1);
let mut run = Run { packets: Vec::new(), recons: Vec::new(), psnr_y: Vec::new(), lf_levels: Vec::new() };
for (i, p) in pics.iter().enumerate() {
let pkt = enc.encode(&p.frame()).expect("encode");
+1 -1
View File
@@ -1,4 +1,4 @@
//! craft-video's AV1 encoder against the filmcraft-av1 decoder and ffmpeg's libdav1d.
//! craft-video's AV1 encoder against craft-video's AV1 decoder and ffmpeg's libdav1d.
mod bench;
mod common;
+13 -13
View File
@@ -1,4 +1,4 @@
//! Round trips through the filmcraft-hevc decoder and (when installed) ffmpeg: decoded pictures must
//! Round trips through the craft-video HEVC decoder and (when installed) ffmpeg: decoded pictures must
//! equal the encoder's own reconstruction bit-exactly.
use craft_video::hevc::{Encoder, EncoderConfig, Frame, Profile, RateControl};
@@ -84,9 +84,9 @@ fn encode(cfg: EncoderConfig, pics: &[Pic]) -> Run {
run
}
/// Decode with filmcraft-hevc and compare with the reconstructions.
fn check_filmcraft(run: &Run, w: usize, h: usize) {
let mut dec = filmcraft_hevc::Decoder::from_hvcc(&run.hvcc).unwrap();
/// Decode with craft-video's HEVC decoder and compare with the reconstructions.
fn check_decoder(run: &Run, w: usize, h: usize) {
let mut dec = craft_video::hevc::decode::Decoder::from_hvcc(&run.hvcc).unwrap();
let mut pics = Vec::new();
for (i, p) in run.packets.iter().enumerate() {
pics.extend(dec.decode(p, i as i64).unwrap());
@@ -211,7 +211,7 @@ fn intra_8bit_quality_and_decoders() {
let run = encode(cfg(w as u32, h as u32, 22, 1, Profile::Main), &pics);
eprintln!("intra QP22: {} bytes, PSNR-Y {:.2}", run.packets[0].len(), run.psnr_y[0]);
assert!(run.psnr_y[0] > 35.0, "PSNR {}", run.psnr_y[0]);
check_filmcraft(&run, w, h);
check_decoder(&run, w, h);
check_ffmpeg(&run, w, h, 8, "intra8");
}
@@ -267,7 +267,7 @@ fn inter_8bit_moving_pattern() {
let p_avg = sizes[1..].iter().sum::<usize>() as f64 / 5.0;
assert!(p_avg < sizes[0] as f64 * 0.6, "P frames {p_avg} vs I {}", sizes[0]);
assert!(run.psnr_y.iter().all(|&p| p > 33.0));
check_filmcraft(&run, w, h);
check_decoder(&run, w, h);
check_ffmpeg(&run, w, h, 8, "inter8");
}
@@ -276,7 +276,7 @@ fn odd_multiple_sizes_and_cropping() {
for (w, h) in [(34usize, 18usize), (66, 38), (8, 8), (130, 72), (2, 2), (2, 70), (264, 6)] {
let pics: Vec<Pic> = (0..3).map(|i| synth(w, h, 8, i, 2 * i)).collect();
let run = encode(cfg(w as u32, h as u32, 30, 2, Profile::Main), &pics);
check_filmcraft(&run, w, h);
check_decoder(&run, w, h);
check_ffmpeg(&run, w, h, 8, &format!("size{w}x{h}"));
}
}
@@ -305,7 +305,7 @@ fn noise_low_qp() {
.collect();
let run = encode(cfg(w as u32, h as u32, 0, 2, profile), &pics);
assert!(run.psnr_y.iter().all(|&p| p > 45.0), "{:?}", run.psnr_y);
check_filmcraft(&run, w, h);
check_decoder(&run, w, h);
check_ffmpeg(&run, w, h, bd, &format!("noise{bd}"));
}
}
@@ -317,7 +317,7 @@ fn high_qp_deblocking() {
for (qp, profile, bd) in [(38u8, Profile::Main, 8u32), (44, Profile::Main, 8), (37, Profile::Main10, 10)] {
let pics: Vec<Pic> = (0..5).map(|i| synth(w, h, bd, 2 * i, i)).collect();
let run = encode(cfg(w as u32, h as u32, qp, 4, profile), &pics);
check_filmcraft(&run, w, h);
check_decoder(&run, w, h);
check_ffmpeg(&run, w, h, bd, &format!("hq{qp}"));
}
}
@@ -329,7 +329,7 @@ fn long_gop_poc_wrap() {
let pics: Vec<Pic> = (0..300).map(|i| synth(w, h, 8, i % 7, i % 5)).collect();
let run = encode(cfg(w as u32, h as u32, 30, 0, Profile::Main), &pics);
assert_eq!(run.keys.iter().filter(|&&k| k).count(), 1);
check_filmcraft(&run, w, h);
check_decoder(&run, w, h);
check_ffmpeg(&run, w, h, 8, "pocwrap");
let run = encode(cfg(w as u32, h as u32, 30, 260, Profile::Main), &pics);
assert_eq!(run.keys.iter().filter(|&&k| k).count(), 2);
@@ -348,7 +348,7 @@ fn main10_round_trip() {
let run = encode(cfg(w as u32, h as u32, 24, 3, Profile::Main10), &pics);
eprintln!("main10 psnr {:?}", run.psnr_y);
assert!(run.psnr_y[0] > 35.0);
check_filmcraft(&run, w, h);
check_decoder(&run, w, h);
check_ffmpeg(&run, w, h, 10, "main10");
}
@@ -358,7 +358,7 @@ fn qp_extremes() {
for qp in [0u8, 51] {
let pics: Vec<Pic> = (0..2).map(|i| synth(w, h, 8, i, i)).collect();
let run = encode(cfg(w as u32, h as u32, qp, 30, Profile::Main), &pics);
check_filmcraft(&run, w, h);
check_decoder(&run, w, h);
check_ffmpeg(&run, w, h, 8, &format!("qp{qp}"));
}
}
@@ -375,7 +375,7 @@ fn bitrate_mode_hits_target() {
let kbps = bits as f64 / (pics.len() as f64 / 30.0) / 1000.0;
eprintln!("bitrate mode: {kbps:.1} kbit/s for a 400 kbit/s target");
assert!(kbps > 400.0 / 2.0 && kbps < 400.0 * 2.0, "{kbps}");
check_filmcraft(&run, w, h);
check_decoder(&run, w, h);
}
#[test]
+4 -4
View File
@@ -1,8 +1,8 @@
//! The VP9 intra encoder (`craft_video::vp9`) round-trips through FilmCraft's VP9 decoder (and
//! The VP9 intra encoder (`craft_video::vp9`) round-trips through craft-video's VP9 decoder (and
//! ffmpeg as an external oracle when installed): sizes, lossless exactness, PSNR.
use craft_video::vp9::decode::{Decoder, Picture, Plane};
use craft_video::vp9::{EncoderConfig, Vp9Encoder};
use filmcraft_vp9::{Decoder, Plane};
fn plane_u8(p: &Plane) -> Vec<u8> {
match p {
@@ -40,7 +40,7 @@ fn source(w: usize, h: usize, kind: u32) -> (Vec<u8>, Vec<u8>, Vec<u8>) {
(y, u, v)
}
fn decode(frame: &[u8]) -> filmcraft_vp9::Picture {
fn decode(frame: &[u8]) -> Picture {
let mut d = Decoder::with_threads(1);
let mut pics = d.decode(frame, 0).expect("decode");
assert_eq!(pics.len(), 1);
@@ -179,7 +179,7 @@ fn moving(w: usize, h: usize, t: usize, kind: u32) -> (Vec<u8>, Vec<u8>, Vec<u8>
(y, u, v)
}
fn planes_of(p: &filmcraft_vp9::Picture, w: usize, h: usize) -> [Vec<u8>; 3] {
fn planes_of(p: &Picture, w: usize, h: usize) -> [Vec<u8>; 3] {
let (cw, ch) = (w.div_ceil(2), h.div_ceil(2));
[crop(&plane_u8(&p.y), p.y_stride, w, h), crop(&plane_u8(&p.u), p.uv_stride, cw, ch), crop(&plane_u8(&p.v), p.uv_stride, cw, ch)]
}
+2 -3
View File
@@ -26,9 +26,8 @@ craft-dpx = { workspace = true }
craft-exr = { workspace = true, features = ["decode"] }
craft-gif = { workspace = true, features = ["frames"] }
craft-webp = { workspace = true, features = ["frames"] }
craft-audio = { workspace = true }
craft-media = { workspace = true }
filmcraft-mpegts = { workspace = true }
craft-audio = { workspace = true, features = ["aac-decode"] }
craft-media = { workspace = true, features = ["mpegts"] }
filmcraft-frame = { workspace = true }
filmcraft-color = { workspace = true }
filmcraft-time = { workspace = true }
+5 -14
View File
@@ -62,15 +62,15 @@ fn matroska(file: &dyn ByteReader) -> Option<Vec<u8>> {
/// first unit it can read. Only AAC is asked about, so the streams before that one were refused
/// whatever their codec, and an ADTS stream played has no configuration outside its frames.
fn latm(file: &dyn ByteReader) -> Option<Vec<u8>> {
use filmcraft_mpegts::Codec;
use craft_media::mpegts::{self, Codec};
let head = Head(file, file.len().min(MPEG_HEAD));
let mpeg = filmcraft_mpegts::open(&head).ok()?;
let audio = mpeg.streams.iter().enumerate().filter(|(_, s)| s.kind() == filmcraft_mpegts::Kind::Audio && !s.units.is_empty());
let mpeg = mpegts::open(&head).ok()?;
let audio = mpeg.streams.iter().enumerate().filter(|(_, s)| s.kind() == mpegts::Kind::Audio && !s.units.is_empty());
let played = audio.take(filmcraft_media::MAX_AUDIO_STREAMS).find_map(|(i, s)| {
let first = mpeg.read_unit(&head, i, 0).ok()?;
match s.codec {
Codec::AacAdts => filmcraft_mpegts::frame_info(&s.codec, &first).map(|_| None),
Codec::AacLatm => filmcraft_codecs::audio::latm_config(&first).map(|c| Some(c.asc)),
Codec::AacAdts => mpegts::frame_info(&s.codec, &first).map(|_| None),
Codec::AacLatm => craft_audio::aac::latm_config(&first).map(|c| Some(c.asc)),
_ => None,
}
});
@@ -97,12 +97,3 @@ impl craft_media::ByteSource for Head<'_> {
self.read(offset, buf)
}
}
impl filmcraft_mpegts::ByteSource for Head<'_> {
fn len(&self) -> u64 {
self.1
}
fn read_at(&self, offset: u64, buf: &mut [u8]) -> io::Result<()> {
self.read(offset, buf)
}
}