wip aom keyframes

This commit is contained in:
Zen 2021-05-26 20:06:35 +03:00
parent d6a650876f
commit a8219d220e
6 changed files with 33 additions and 6 deletions

View file

@ -1,6 +1,3 @@
[workspace]
members = [
"av1an-core",
"av1an-pyo3",
]
members = ["av1an-core", "av1an-pyo3", "av1an-scene-detection"]

View file

@ -37,7 +37,7 @@ fn process_inputs(inputs: Vec<&Path>) -> Vec<&Path> {
// Process all inputs (folders and files)
// into single path vector
for fl in inputs {
for fl in inputs.clone() {
if fl.is_dir() {
for file in fl {
let path_file = Path::new(file);
@ -58,6 +58,12 @@ fn process_inputs(inputs: Vec<&Path>) -> Vec<&Path> {
.filter(|x| match_file_type(*x))
.collect();
if result.is_empty() {
println!("Not valid inputs");
println!("{:#?}", inputs);
exit(1);
}
result
}

View file

@ -14,7 +14,6 @@ use std::str::FromStr;
use std::{fs::File, io::Write};
use sysinfo::SystemExt;
pub mod aom_kf;
pub mod concat;
pub mod ffmpeg;
pub mod file_validation;

View file

@ -0,0 +1,7 @@
[package]
name = "av1an-scene-detection"
version = "0.1.0"
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View file

@ -1,3 +1,5 @@
use core::f64;
struct AomFirstPassStats {
frame: u64, // Frame number
weight: u64, // Weight assigned to this frame
@ -27,3 +29,16 @@ struct AomFirstPassStats {
noise_var: u64,
cor_coeff: u64,
}
fn get_second_ref_usage_thresh(frame_count_so_far: u64) -> f64 {
let adapt_upto = 32.0;
let min_second_ref_usage_thresh = 0.085;
let second_ref_usage_thresh_max_delta = 0.035;
if frame_count_so_far as f64 >= adapt_upto {
return min_second_ref_usage_thresh + second_ref_usage_thresh_max_delta;
} else {
min_second_ref_usage_thresh
+ (frame_count_so_far as f64 / (adapt_upto - 1.0)) * second_ref_usage_thresh_max_delta
}
}

View file

@ -0,0 +1,3 @@
#![allow(unused)]
pub mod aom_kf;