diff --git a/Cargo.lock b/Cargo.lock index aa17145..f6d6146 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2301,7 +2301,7 @@ dependencies = [ [[package]] name = "ofx" version = "0.3.0" -source = "git+https://github.com/AdrianEddy/ofx-rs.git?rev=9c718fc#9c718fc13fbea5e30e17fdb42d339fa9c57bc6cb" +source = "git+https://github.com/AdrianEddy/ofx-rs.git?rev=3370dc4#3370dc4e2ef67a344a799d1e93c823851ed30dd3" dependencies = [ "libc", "log", @@ -2313,7 +2313,7 @@ dependencies = [ [[package]] name = "ofx_sys" version = "0.2.0" -source = "git+https://github.com/AdrianEddy/ofx-rs.git?rev=9c718fc#9c718fc13fbea5e30e17fdb42d339fa9c57bc6cb" +source = "git+https://github.com/AdrianEddy/ofx-rs.git?rev=3370dc4#3370dc4e2ef67a344a799d1e93c823851ed30dd3" dependencies = [ "bindgen", "libc", diff --git a/Cargo.toml b/Cargo.toml index ae24a12..619b8d8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,8 +40,8 @@ codegen-units = 1 opt-level = 2 [patch.crates-io] -ofx = { git = "https://github.com/AdrianEddy/ofx-rs.git", rev = "9c718fc" } -ofx_sys = { git = "https://github.com/AdrianEddy/ofx-rs.git", rev = "9c718fc" } +ofx = { git = "https://github.com/AdrianEddy/ofx-rs.git", rev = "3370dc4" } +ofx_sys = { git = "https://github.com/AdrianEddy/ofx-rs.git", rev = "3370dc4" } #ofx = { path = "../ofx-rs/ofx" } #ofx_sys = { path = "../ofx-rs/ofx-sys" } metal = { git = "https://github.com/gfx-rs/metal-rs/", rev = "d24f1a4" } diff --git a/src/gyroflow.rs b/src/gyroflow.rs index 56409d4..9ee4171 100644 --- a/src/gyroflow.rs +++ b/src/gyroflow.rs @@ -2,7 +2,7 @@ use std::sync::Arc; use std::sync::atomic::AtomicBool; use std::sync::atomic::Ordering::SeqCst; -use gyroflow_core::{ StabilizationManager, stabilization::{ RGBA8, RGBA16, RGBAf }, keyframes::{ KeyframeType, KeyframeManager }, filesystem }; +use gyroflow_core::{ StabilizationManager, stabilization::{ RGBA8, RGBA16, RGBAf, RGBAf16 }, keyframes::{ KeyframeType, KeyframeManager }, filesystem }; use gyroflow_core::gpu::{ BufferDescription, Buffers, BufferSource }; use lru::LruCache; use ofx::*; @@ -661,8 +661,8 @@ impl Execute for GyroflowPlugin { let out_texture = output_image.get_opengl_texture_index()? as u32; let mut src_size = src_size; let mut out_size = out_size; - src_size.2 = src_size.0 * 4 * match source_image.get_pixel_depth()? { BitDepth::Byte => 1, BitDepth::Short => 2, BitDepth::Float => 4 }; - out_size.2 = out_size.0 * 4 * match output_image.get_pixel_depth()? { BitDepth::Byte => 1, BitDepth::Short => 2, BitDepth::Float => 4 }; + src_size.2 = src_size.0 * 4 * match source_image.get_pixel_depth()? { BitDepth::None => 0, BitDepth::Byte => 1, BitDepth::Short => 2, BitDepth::Half => 2, BitDepth::Float => 4 }; + out_size.2 = out_size.0 * 4 * match output_image.get_pixel_depth()? { BitDepth::None => 0, BitDepth::Byte => 1, BitDepth::Short => 2, BitDepth::Half => 2, BitDepth::Float => 4 }; // log::info!("OpenGL in: {texture}, out: {out_texture} src_size: {src_size:?}, out_size: {out_size:?}, in_rect: {src_rect:?}, out_rect: {out_rect:?}"); Some(Buffers { @@ -684,13 +684,17 @@ impl Execute for GyroflowPlugin { } else { use std::slice::from_raw_parts_mut; let src_buf = unsafe { match source_image.get_pixel_depth()? { + BitDepth::None => { return FAILED; } BitDepth::Byte => { let b = source_image.get_descriptor::()?; let mut b = b.data(); from_raw_parts_mut(b.ptr_mut(0), b.bytes()) }, BitDepth::Short => { let b = source_image.get_descriptor::()?; let mut b = b.data(); from_raw_parts_mut(b.ptr_mut(0), b.bytes()) }, + BitDepth::Half => { let b = source_image.get_descriptor::()?; let mut b = b.data(); from_raw_parts_mut(b.ptr_mut(0), b.bytes()) }, BitDepth::Float => { let b = source_image.get_descriptor::()?; let mut b = b.data(); from_raw_parts_mut(b.ptr_mut(0), b.bytes()) } } }; let dst_buf = unsafe { match output_image.get_pixel_depth()? { + BitDepth::None => { return FAILED; } BitDepth::Byte => { let b = output_image.get_descriptor::()?; let mut b = b.data(); from_raw_parts_mut(b.ptr_mut(0), b.bytes()) }, BitDepth::Short => { let b = output_image.get_descriptor::()?; let mut b = b.data(); from_raw_parts_mut(b.ptr_mut(0), b.bytes()) }, + BitDepth::Half => { let b = output_image.get_descriptor::()?; let mut b = b.data(); from_raw_parts_mut(b.ptr_mut(0), b.bytes()) }, BitDepth::Float => { let b = output_image.get_descriptor::()?; let mut b = b.data(); from_raw_parts_mut(b.ptr_mut(0), b.bytes()) } } }; @@ -716,9 +720,11 @@ impl Execute for GyroflowPlugin { if let Some(ref mut buffers) = buffers { let processed = match output_image.get_pixel_depth()? { - BitDepth::Byte => stab.process_pixels:: (timestamp_us, buffers), - BitDepth::Short => stab.process_pixels::(timestamp_us, buffers), - BitDepth::Float => stab.process_pixels:: (timestamp_us, buffers) + BitDepth::None => { return FAILED; }, + BitDepth::Byte => stab.process_pixels:: (timestamp_us, buffers), + BitDepth::Short => stab.process_pixels:: (timestamp_us, buffers), + BitDepth::Half => stab.process_pixels::(timestamp_us, buffers), + BitDepth::Float => stab.process_pixels:: (timestamp_us, buffers) }; match processed { Ok(_) => {