Skip to content

Commit

Permalink
parse xpsnr rgb output
Browse files Browse the repository at this point in the history
  • Loading branch information
alexheretic committed Dec 22, 2024
1 parent 941c0a2 commit ddc2945
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/xpsnr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ impl XpsnrOut {
fn score_from_line(line: &str) -> Option<f32> {
const MIN_PREFIX: &str = "minimum: ";

if !line.contains("XPSNR y: ") {
if !line.contains("XPSNR") {
return None;
}

Expand All @@ -105,6 +105,14 @@ fn score_from_line(line: &str) -> Option<f32> {
mod test {
use super::*;

#[test]
fn parse_rgb_line() {
let score = score_from_line(
"XPSNR average, 1 frames r: 40.6130 g: 41.0275 b: 40.6961 (minimum: 40.6130)",
);
assert_eq!(score, Some(40.6130));
}

#[test]
fn parse_xpsnr_score() {
// Note: some lines omitted for brevity
Expand Down

0 comments on commit ddc2945

Please sign in to comment.