mirror of
https://github.com/master-of-zen/Av1an.git
synced 2024-11-24 18:18:06 +00:00
initial Rust code for reading aomenc fisrt pass
This commit is contained in:
parent
a0a8093112
commit
73c5c33f3f
2 changed files with 65 additions and 63 deletions
|
@ -1,63 +0,0 @@
|
|||
#[macro_use]
|
||||
extern crate cpython;
|
||||
extern crate bincode;
|
||||
extern crate serde;
|
||||
use serde::Deserialize;
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
use cpython::{Python, PyResult};
|
||||
|
||||
py_module_initializer!(aom_keyframes, init_aom_keyframes, PyInit_aom_keyframes, |py, m | {
|
||||
m.add(py, "__doc__", "Aom keyframes in Rust.. for whatever reason.. rust is good, right?")?;
|
||||
m.add(py, "read_struct", py_fn!(py, rust_aom_keyframes(val: &str)))?;
|
||||
Ok(())
|
||||
});
|
||||
|
||||
#[derive(Deserialize, Debug)]
|
||||
struct FrameData {
|
||||
frame: i32,
|
||||
weight: i32,
|
||||
intra_error: i32,
|
||||
frame_avg_wavelet_energy: i32,
|
||||
coded_error: i32,
|
||||
sr_coded_error: i32,
|
||||
tr_coded_error: i32,
|
||||
pcnt_inter: i32,
|
||||
pcnt_motion: i32,
|
||||
pcnt_second_ref: i32,
|
||||
pcnt_third_ref: i32,
|
||||
pcnt_neutral: i32,
|
||||
intra_skip_pct: i32,
|
||||
inactive_zone_rows: i32,
|
||||
inactive_zone_cols: i32,
|
||||
mvr: i32,
|
||||
mvr_abs: i32,
|
||||
mvc: i32,
|
||||
mvc_abs: i32,
|
||||
mvrv: i32,
|
||||
mvcv: i32,
|
||||
mv_in_out_count: i32,
|
||||
new_mv_count: i32,
|
||||
duration: i32,
|
||||
count: i32,
|
||||
raw_error_stdev: i32,
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
fn rust_aom_keyframes(_py: Python, stat_file: &str) -> PyResult<Vec<i32>>{
|
||||
unimplemented!();
|
||||
}
|
||||
|
||||
|
||||
fn read_struct(stat_file: &str) -> Vec<i32> {
|
||||
|
||||
let stat_path = Path::new(stat_file);
|
||||
|
||||
|
||||
|
||||
unimplemented!()
|
||||
|
||||
|
||||
}
|
65
Aom_Keyframes/src/main.rs
Normal file
65
Aom_Keyframes/src/main.rs
Normal file
|
@ -0,0 +1,65 @@
|
|||
#[macro_use]
|
||||
extern crate cpython;
|
||||
// Reading
|
||||
use std::mem::transmute;
|
||||
use std::fs::read;
|
||||
use cpython::{Python, PyResult};
|
||||
|
||||
/*
|
||||
py_module_initializer!(aom_keyframes, init_aom_keyframes, PyInit_aom_keyframes, |py, m | {
|
||||
m.add(py, "__doc__", "Aom keyframes in Rust.. for whatever reason.. rust is good, right?")?;
|
||||
m.add(py, "read_struct", py_fn!(py, rust_aom_keyframes(val: &str)))?;
|
||||
Ok(())
|
||||
});
|
||||
*/
|
||||
|
||||
#[derive(Debug)]
|
||||
#[repr(C)]
|
||||
struct FrameData {
|
||||
frame: f64,
|
||||
weight: f64,
|
||||
intra_error: f64,
|
||||
frame_avg_wavelet_energy: f64,
|
||||
coded_error: f64,
|
||||
sr_coded_error: f64,
|
||||
tr_coded_error: f64,
|
||||
pcnt_inter: f64,
|
||||
pcnt_motion: f64,
|
||||
pcnt_second_ref: f64,
|
||||
pcnt_third_ref: f64,
|
||||
pcnt_neutral: f64,
|
||||
intra_skip_pct: f64,
|
||||
inactive_zone_rows: f64,
|
||||
inactive_zone_cols: f64,
|
||||
mvr: f64,
|
||||
mvr_abs: f64,
|
||||
mvc: f64,
|
||||
mvc_abs: f64,
|
||||
mvrv: f64,
|
||||
mvcv: f64,
|
||||
mv_in_out_count: f64,
|
||||
new_mv_count: f64,
|
||||
duration: f64,
|
||||
count: f64,
|
||||
raw_error_stdev: f64,
|
||||
}
|
||||
|
||||
|
||||
fn main (){
|
||||
read_struct("k");
|
||||
}
|
||||
|
||||
|
||||
fn rust_aom_keyframes(_py: Python, stat_file: &str) -> PyResult<Vec<f64>>{
|
||||
unimplemented!();
|
||||
}
|
||||
|
||||
|
||||
fn read_struct(stat_file: &str) -> Vec<FrameData> {
|
||||
|
||||
let raw_data: Vec<u8> = read(stat_file).unwrap();
|
||||
let frame_list: Vec<FrameData> = unsafe {transmute(raw_data)};
|
||||
println!("Frame 1 / {}:\n{:?}", frame_list.len(), frame_list[0]);
|
||||
frame_list
|
||||
|
||||
}
|
Loading…
Reference in a new issue