Skip to content

Commit

Permalink
Fix vmaf flag check with target-quality
Browse files Browse the repository at this point in the history
Fixes issue where final vmaf was always ran if target-quality was set, this does not allow you to run vmaf without target-quality
  • Loading branch information
luigi311 committed Apr 23, 2024
1 parent 31421df commit a56ca42
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
24 changes: 13 additions & 11 deletions av1an-core/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,17 +360,19 @@ impl Av1anContext {
temp_res = tq.vmaf_res.to_string();
}

if let Err(e) = vmaf::plot(
self.args.output_file.as_ref(),
&self.args.input,
tq.model.as_deref(),
temp_res.as_str(),
tq.vmaf_scaler.as_str(),
1,
tq.vmaf_filter.as_deref(),
tq.vmaf_threads,
) {
error!("VMAF calculation failed with error: {}", e);
if self.args.vmaf {
if let Err(e) = vmaf::plot(
self.args.output_file.as_ref(),
&self.args.input,
tq.model.as_deref(),
temp_res.as_str(),
tq.vmaf_scaler.as_str(),
1,
tq.vmaf_filter.as_deref(),
tq.vmaf_threads,
) {
error!("VMAF calculation failed with error: {}", e);
}
}
}

Expand Down
1 change: 1 addition & 0 deletions av1an-core/src/scenes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ fn get_test_args() -> Av1anContext {
sc_downscale_height: None,
force_keyframes: Vec::new(),
target_quality: None,
vmaf: false,
verbosity: Verbosity::Normal,
workers: 1,
set_thread_affinity: None,
Expand Down
1 change: 1 addition & 0 deletions av1an-core/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ pub struct EncodeArgs {

pub concat: ConcatMethod,
pub target_quality: Option<TargetQuality>,
pub vmaf: bool,
}

impl EncodeArgs {
Expand Down
1 change: 1 addition & 0 deletions av1an/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,7 @@ pub fn parse_cli(args: CliOpts) -> anyhow::Result<Vec<EncodeArgs>> {
args.force_keyframes.as_deref().unwrap_or(""),
)?,
target_quality: args.target_quality_params(temp, video_params, output_pix_format.format),
vmaf: args.vmaf,
verbosity: if args.quiet {
Verbosity::Quiet
} else if args.verbose {
Expand Down

0 comments on commit a56ca42

Please sign in to comment.