Skip to main content

BlendOps

Struct BlendOps 

Source
pub struct BlendOps<S: SimdOps> { /* private fields */ }
Expand description

Blending operations using SIMD.

Implementations§

Source§

impl<S: SimdOps> BlendOps<S>

Source

pub const fn new(simd: S) -> Self

Create a new blending operations instance.

Source

pub const fn simd(&self) -> &S

Get the underlying SIMD implementation.

Source

pub fn lerp_u8(&self, a: u8, b: u8, weight: u8) -> u8

Linear interpolation between two values.

Returns: a + (b - a) * weight / 256

Weight is in range [0, 256] where:

  • 0 = 100% a
  • 256 = 100% b
  • 128 = 50% each
Source

pub fn lerp_i16x8(&self, a: I16x8, b: I16x8, weight: i16) -> I16x8

Linear interpolation for i16x8 vectors.

Returns: a + (b - a) * weight / 256

Source

pub fn weighted_avg_u8x16(&self, a: U8x16, b: U8x16, weight: u8) -> U8x16

Weighted average of two u8x16 vectors.

Returns: (a * (256 - weight) + b * weight + 128) / 256

Source

pub fn bilinear_blend_u8( &self, tl: u8, tr: u8, bl: u8, br: u8, hweight: u8, vweight: u8, ) -> u8

Bilinear blend for motion compensation.

Blends 4 samples using horizontal and vertical weights. Used for sub-pixel motion estimation.

Layout:

tl --- tr
|      |
bl --- br

Returns: blend of all 4 based on (hweight, vweight)

Source

pub fn bilinear_blend_row_8( &self, tl: &[u8], tr: &[u8], bl: &[u8], br: &[u8], hweight: u8, vweight: u8, dst: &mut [u8], )

Bilinear blend for a row of 8 pixels.

Takes 4 input rows and blends them bilinearly.

Source§

impl<S: SimdOps + SimdOpsExt> BlendOps<S>

Source

pub fn bilinear_blend_row_8_simd( &self, tl: &[u8], tr: &[u8], bl: &[u8], br: &[u8], hweight: u8, vweight: u8, dst: &mut [u8], )

Bilinear blend using SIMD for a row of 8 pixels.

Trait Implementations§

Source§

impl<S: SimdOps + Default> Default for BlendOps<S>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<S> Freeze for BlendOps<S>
where S: Freeze,

§

impl<S> RefUnwindSafe for BlendOps<S>
where S: RefUnwindSafe,

§

impl<S> Send for BlendOps<S>

§

impl<S> Sync for BlendOps<S>

§

impl<S> Unpin for BlendOps<S>
where S: Unpin,

§

impl<S> UnsafeUnpin for BlendOps<S>
where S: UnsafeUnpin,

§

impl<S> UnwindSafe for BlendOps<S>
where S: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.