From a9e78e3cabb7c90336c44e20df36f8eb60e29014 Mon Sep 17 00:00:00 2001 From: Josh Holmer Date: Sun, 8 Oct 2023 22:01:58 -0400 Subject: [PATCH] Support grain tables for SVT-AV1 Requires https://gitlab.com/AOMediaCodec/SVT-AV1/-/merge_requests/1894 --- av1an-core/src/settings.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/av1an-core/src/settings.rs b/av1an-core/src/settings.rs index 071acc1d..177a17c4 100644 --- a/av1an-core/src/settings.rs +++ b/av1an-core/src/settings.rs @@ -331,6 +331,17 @@ pub(crate) fn insert_noise_table_params( video_params.retain(|param| !param.starts_with("--denoise-noise-level=")); video_params.push(format!("--film-grain-table={}", table.to_str().unwrap())); } + Encoder::svt_av1 => { + let film_grain_idx = video_params + .iter() + .find_position(|param| param.as_str() == "--film-grain"); + if let Some((idx, _)) = film_grain_idx { + video_params.remove(idx + 1); + video_params.remove(idx); + } + video_params.push("--fgs-table".to_string()); + video_params.push(table.to_str().unwrap().to_string()); + } Encoder::rav1e => { let photon_noise_idx = video_params .iter()