Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for vmaf-subsample #825

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions av1an-core/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ impl Av1anContext {
temp_res.as_str(),
tq.vmaf_scaler.as_str(),
1,
1,
tq.vmaf_filter.as_deref(),
tq.vmaf_threads,
) {
Expand Down
2 changes: 2 additions & 0 deletions av1an-core/src/target_quality.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ pub struct TargetQuality {
pub vmaf_threads: usize,
pub model: Option<PathBuf>,
pub probing_rate: usize,
pub probing_subsample: usize,
pub probes: u32,
pub target: f64,
pub min_q: u32,
Expand Down Expand Up @@ -252,6 +253,7 @@ impl TargetQuality {
&self.vmaf_res,
&self.vmaf_scaler,
self.probing_rate,
self.probing_subsample,
self.vmaf_filter.as_deref(),
self.vmaf_threads,
)?;
Expand Down
13 changes: 9 additions & 4 deletions av1an-core/src/vmaf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ pub fn plot(
res: &str,
scaler: &str,
sample_rate: usize,
subsample: usize,
filter: Option<&str>,
threads: usize,
) -> Result<(), Box<EncoderCrash>> {
Expand Down Expand Up @@ -156,6 +157,7 @@ pub fn plot(
res,
scaler,
sample_rate,
subsample,
filter,
threads,
)?;
Expand All @@ -172,6 +174,7 @@ pub fn run_vmaf(
res: &str,
scaler: &str,
sample_rate: usize,
subsample: usize,
vmaf_filter: Option<&str>,
threads: usize,
) -> Result<(), Box<EncoderCrash>> {
Expand All @@ -193,16 +196,18 @@ pub fn run_vmaf(

let vmaf = if let Some(model) = model {
format!(
"[distorted][ref]libvmaf=log_fmt='json':eof_action=endall:log_path={}:model_path={}:n_threads={}",
"[distorted][ref]libvmaf=log_fmt='json':eof_action=endall:log_path={}:model_path={}:n_threads={}:n_subsample={}",
ffmpeg::escape_path_in_filter(stat_file),
ffmpeg::escape_path_in_filter(&model),
threads
threads,
subsample,
)
} else {
format!(
"[distorted][ref]libvmaf=log_fmt='json':eof_action=endall:log_path={}:n_threads={}",
"[distorted][ref]libvmaf=log_fmt='json':eof_action=endall:log_path={}:n_threads={}:n_subsample={}",
ffmpeg::escape_path_in_filter(stat_file),
threads
threads,
subsample,
)
};

Expand Down
5 changes: 5 additions & 0 deletions av1an/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,10 @@ pub struct CliOpts {
#[clap(long, default_value_t = 1, help_heading = "Target Quality")]
pub probing_rate: u32,

/// VMAF subsample for probes to speedup VMAF calculation
#[clap(long, default_value_t = 1, help_heading = "Target Quality")]
pub probing_subsample: usize,

/// Use encoding settings for probes specified by --video-params rather than faster, less accurate settings
///
/// Note that this always performs encoding in one-pass mode, regardless of --passes.
Expand Down Expand Up @@ -572,6 +576,7 @@ impl CliOpts {
video_params: video_params.clone(),
probe_slow: self.probe_slow,
probing_rate: adapt_probing_rate(self.probing_rate as usize),
probing_subsample: self.probing_subsample,
}
})
}
Expand Down
Loading