pub struct VideoFrameProcessor { /* private fields */ }Expand description
GPU-accelerated video frame processor.
Provides CPU-fallback implementations of common video frame operations that would execute on the GPU in production environments.
Implementations§
Source§impl VideoFrameProcessor
impl VideoFrameProcessor
Sourcepub fn new(config: FrameProcessConfig) -> Self
pub fn new(config: FrameProcessConfig) -> Self
Create a new VideoFrameProcessor with the given configuration.
Sourcepub fn compute_histogram(&self, frame: &[u8]) -> Result<Vec<u32>>
pub fn compute_histogram(&self, frame: &[u8]) -> Result<Vec<u32>>
Simulate GPU-accelerated frame histogram computation.
For each channel, counts pixel value occurrences (0-255).
Returns a Vec of 256 * channels counts (interleaved per channel).
§Errors
Returns an error if the frame buffer size does not match the configured dimensions.
Sourcepub fn adjust_brightness(&self, frame: &[u8], delta: i16) -> Result<Vec<u8>>
pub fn adjust_brightness(&self, frame: &[u8], delta: i16) -> Result<Vec<u8>>
Simulate GPU-accelerated frame brightness adjustment.
Adds delta to each pixel value, clamping the result to [0, 255].
§Errors
Returns an error if the frame buffer size does not match the configured dimensions.
Sourcepub fn adjust_contrast(&self, frame: &[u8], factor: f32) -> Result<Vec<u8>>
pub fn adjust_contrast(&self, frame: &[u8], factor: f32) -> Result<Vec<u8>>
Simulate GPU-accelerated contrast adjustment.
For each pixel: clamp((pixel - 128) * factor + 128, 0, 255).
§Errors
Returns an error if the frame buffer size does not match the configured dimensions.
Sourcepub fn adjust_saturation(&self, frame: &[u8], factor: f32) -> Result<Vec<u8>>
pub fn adjust_saturation(&self, frame: &[u8], factor: f32) -> Result<Vec<u8>>
Simulate GPU-accelerated saturation adjustment for RGB frames (3 channels).
Converts each RGB pixel to HSL, multiplies the S component by factor,
then converts back to RGB. For non-RGB frames this is a no-op copy.
§Errors
Returns an error if the frame buffer size does not match the configured dimensions.
Sourcepub fn frame_difference(
&self,
frame_a: &[u8],
frame_b: &[u8],
) -> Result<Vec<u8>>
pub fn frame_difference( &self, frame_a: &[u8], frame_b: &[u8], ) -> Result<Vec<u8>>
Compute frame difference (absolute difference per pixel).
§Errors
Returns an error if either frame buffer size does not match the configured dimensions.
Sourcepub fn mean_absolute_error(&self, frame_a: &[u8], frame_b: &[u8]) -> Result<f64>
pub fn mean_absolute_error(&self, frame_a: &[u8], frame_b: &[u8]) -> Result<f64>
Compute mean absolute error between two frames.
§Errors
Returns an error if either frame buffer size does not match the configured dimensions.
Sourcepub fn config(&self) -> &FrameProcessConfig
pub fn config(&self) -> &FrameProcessConfig
Get the configuration.
Sourcepub fn process_frame(
&self,
frame: &[u8],
brightness_delta: i16,
) -> Result<FrameProcessResult>
pub fn process_frame( &self, frame: &[u8], brightness_delta: i16, ) -> Result<FrameProcessResult>
Process a frame and return a FrameProcessResult with timing information.
This is a convenience wrapper that applies brightness adjustment and records the simulated GPU processing time.
§Errors
Returns an error if the frame buffer size does not match the configured dimensions.
Auto Trait Implementations§
impl Freeze for VideoFrameProcessor
impl RefUnwindSafe for VideoFrameProcessor
impl Send for VideoFrameProcessor
impl Sync for VideoFrameProcessor
impl Unpin for VideoFrameProcessor
impl UnsafeUnpin for VideoFrameProcessor
impl UnwindSafe for VideoFrameProcessor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more