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 22, 2024
1 parent 31421df commit 7b9e645
Show file tree
Hide file tree
Showing 3 changed files with 15 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/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 7b9e645

Please sign in to comment.