Skip to content

Commit 5543ceb

Browse files
committed
Fix compilation
oops
1 parent 5931d7a commit 5543ceb

File tree

2 files changed

+29
-18
lines changed

2 files changed

+29
-18
lines changed

av1an-core/src/context.rs

+29-7
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,11 @@ impl Av1anContext {
308308

309309
let (tx, rx) = mpsc::channel();
310310
let handle = s.spawn(|_| {
311-
broker.encoding_loop(tx, self.args.set_thread_affinity);
311+
broker.encoding_loop(
312+
tx,
313+
self.args.set_thread_affinity,
314+
self.args.ignore_frame_mismatch
315+
);
312316
});
313317

314318
// Queue::encoding_loop only sends a message if there was an error (meaning a chunk crashed)
@@ -348,11 +352,25 @@ impl Av1anContext {
348352
}
349353

350354
if let Some(ref tq) = self.args.target_quality {
355+
let mut temp_res = tq.vmaf_res.to_string();
356+
if tq.vmaf_res == "inputres" {
357+
let inputres = self.args.input.resolution()?;
358+
temp_res.push_str(&format!(
359+
"{}x{}",
360+
&inputres.0.to_string(),
361+
&inputres.1.to_string()
362+
));
363+
temp_res.to_string();
364+
} else {
365+
temp_res = tq.vmaf_res.to_string();
366+
}
367+
351368
if let Err(e) = vmaf::plot(
352369
self.args.output_file.as_ref(),
353370
&self.args.input,
354371
tq.model.as_deref(),
355-
tq.vmaf_res.as_str(),
372+
temp_res.as_str(),
373+
tq.vmaf_scaler.as_str(),
356374
1,
357375
tq.vmaf_filter.as_deref(),
358376
tq.vmaf_threads,
@@ -400,6 +418,7 @@ impl Av1anContext {
400418
current_pass: u8,
401419
worker_id: usize,
402420
padding: usize,
421+
ignore_frame_mismatch: bool,
403422
) -> Result<(), (Box<EncoderCrash>, u64)> {
404423
update_mp_chunk(worker_id, chunk.index, padding);
405424

@@ -618,11 +637,13 @@ impl Av1anContext {
618637
let encoded_frames = num_frames(chunk.output().as_ref());
619638

620639
let err_str = match encoded_frames {
621-
Ok(encoded_frames) if encoded_frames != chunk.frames() => Some(format!(
622-
"FRAME MISMATCH: chunk {}: {encoded_frames}/{} (actual/expected frames)",
623-
chunk.index,
624-
chunk.frames()
625-
)),
640+
Ok(encoded_frames) if !ignore_frame_mismatch && encoded_frames != chunk.frames() => {
641+
Some(format!(
642+
"FRAME MISMATCH: chunk {}: {encoded_frames}/{} (actual/expected frames)",
643+
chunk.index,
644+
chunk.frames()
645+
))
646+
}
626647
Err(error) => Some(format!(
627648
"FAILED TO COUNT FRAMES: chunk {}: {error}",
628649
chunk.index
@@ -689,6 +710,7 @@ impl Av1anContext {
689710
self.frames,
690711
self.args.min_scene_len,
691712
self.args.verbosity,
713+
self.args.scaler.as_str(),
692714
self.args.sc_pix_format,
693715
self.args.sc_method,
694716
self.args.sc_downscale_height,

av1an-core/src/settings.rs

-11
Original file line numberDiff line numberDiff line change
@@ -132,17 +132,6 @@ properly into a mkv file. Specify mkvmerge as the concatenation method by settin
132132
warn!("The output video's frame count may differ, and VMAF calculations may be incorrect");
133133
}
134134

135-
if self.vmaf_res == "inputres" {
136-
let inputres = self.input.resolution()?;
137-
self.vmaf_res.clear();
138-
self.vmaf_res.push_str(&format!(
139-
"{}x{}",
140-
&inputres.0.to_string(),
141-
&inputres.1.to_string()
142-
));
143-
self.vmaf_res.to_string();
144-
}
145-
146135
if let Some(vmaf_path) = &self
147136
.target_quality
148137
.as_ref()

0 commit comments

Comments
 (0)