pub struct ReferenceKernel<N: FromPrimitive = f32> { /* private fields */ }Expand description
A reference implementation of the Kernel trait, copied verbatim from the officially-endorsed implementation by darwinium-com.
Trait Implementations§
Source§impl<N: Default + FromPrimitive> Default for ReferenceKernel<N>
impl<N: Default + FromPrimitive> Default for ReferenceKernel<N>
Source§fn default() -> ReferenceKernel<N>
fn default() -> ReferenceKernel<N>
Returns the “default value” for a type. Read more
Source§impl Kernel for ReferenceKernel<f32>
Available on crate features std only.
impl Kernel for ReferenceKernel<f32>
Available on crate features
std only.Source§type Buffer1WidthX = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B1>, B1>, B1>, B1>, B1>, B1>
type Buffer1WidthX = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B1>, B1>, B1>, B1>, B1>, B1>
The width of the first stage (compression) buffer.
Source§type Buffer1LengthY = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B1>, B1>, B1>, B1>, B1>, B1>
type Buffer1LengthY = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B1>, B1>, B1>, B1>, B1>, B1>
The length of the first stage (compression) buffer.
Source§type InternalFloat = f32
type InternalFloat = f32
The internal floating point type used for intermediate calculations.
Source§type InputDimension = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, B0>, B0>, B0>
type InputDimension = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, B0>, B0>, B0>
The width and height of the input image.
Source§type OutputDimension = UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>
type OutputDimension = UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>
The width and height of the output hash.
Source§type RequiredHardwareFeature = Term
type RequiredHardwareFeature = Term
The hardware features required to run this kernel
Source§fn ident(&self) -> Self::Ident
fn ident(&self) -> Self::Ident
Return an identification of the kernel. For composite kernels that route to multiple kernels, report the kernel that would be executed.
Source§fn adjust_quality(input: Self::InternalFloat) -> f32
fn adjust_quality(input: Self::InternalFloat) -> f32
Adjust the quality metric to be between 0 and 1.
Source§fn dct2d(
&mut self,
buffer: &GenericArray<GenericArray<f32, Self::Buffer1WidthX>, Self::Buffer1LengthY>,
tmp_row_buffer: &mut GenericArray<f32, Self::Buffer1WidthX>,
output: &mut GenericArray<GenericArray<f32, U16>, U16>,
)
fn dct2d( &mut self, buffer: &GenericArray<GenericArray<f32, Self::Buffer1WidthX>, Self::Buffer1LengthY>, tmp_row_buffer: &mut GenericArray<f32, Self::Buffer1WidthX>, output: &mut GenericArray<GenericArray<f32, U16>, U16>, )
Apply a 2D DCT-II transformation to the input buffer write the result to the output buffer.
Source§fn sum_of_gradients(
&mut self,
input: &GenericArray<GenericArray<Self::InternalFloat, U16>, U16>,
) -> Self::InternalFloat
fn sum_of_gradients( &mut self, input: &GenericArray<GenericArray<Self::InternalFloat, U16>, U16>, ) -> Self::InternalFloat
Compute the sum of gradients of the input buffer in both horizontal and vertical directions.
Source§fn quantize(
&mut self,
input: &GenericArray<GenericArray<f32, U16>, U16>,
threshold: &mut Self::InternalFloat,
output: &mut GenericArray<GenericArray<u8, U2>, U16>,
)
fn quantize( &mut self, input: &GenericArray<GenericArray<f32, U16>, U16>, threshold: &mut Self::InternalFloat, output: &mut GenericArray<GenericArray<u8, U2>, U16>, )
Convert input to binary by thresholding at median
Source§fn jarosz_compress(
&mut self,
buffer: &GenericArray<GenericArray<f32, U512>, U512>,
output: &mut GenericArray<GenericArray<f32, Self::Buffer1WidthX>, Self::Buffer1LengthY>,
)
fn jarosz_compress( &mut self, buffer: &GenericArray<GenericArray<f32, U512>, U512>, output: &mut GenericArray<GenericArray<f32, Self::Buffer1WidthX>, Self::Buffer1LengthY>, )
Apply a tent-filter average to every 8x8 sub-block of the input buffer and write the result of each sub-block to the output buffer.
Source§fn cvt_rgb8_to_luma8f<const R_COEFF: u32, const G_COEFF: u32, const B_COEFF: u32>(
&mut self,
input: &GenericArray<GenericArray<u8, U3>, Self::InputDimension>,
output: &mut GenericArray<f32, Self::InputDimension>,
)
fn cvt_rgb8_to_luma8f<const R_COEFF: u32, const G_COEFF: u32, const B_COEFF: u32>( &mut self, input: &GenericArray<GenericArray<u8, U3>, Self::InputDimension>, output: &mut GenericArray<f32, Self::InputDimension>, )
Convert one row of input from RGB8 to LUMA8 floating point. Read more
Source§fn cvt_rgba8_to_luma8f<const R_COEFF: u32, const G_COEFF: u32, const B_COEFF: u32>(
&mut self,
input: &GenericArray<GenericArray<u8, U4>, Self::InputDimension>,
output: &mut GenericArray<f32, Self::InputDimension>,
)
fn cvt_rgba8_to_luma8f<const R_COEFF: u32, const G_COEFF: u32, const B_COEFF: u32>( &mut self, input: &GenericArray<GenericArray<u8, U4>, Self::InputDimension>, output: &mut GenericArray<f32, Self::InputDimension>, )
Convert RGBA8 to LUMA8. Read more
Source§fn pdqf_t(
&mut self,
input: &mut GenericArray<GenericArray<Self::InternalFloat, Self::OutputDimension>, Self::OutputDimension>,
)
fn pdqf_t( &mut self, input: &mut GenericArray<GenericArray<Self::InternalFloat, Self::OutputDimension>, Self::OutputDimension>, )
Transpose a PDQF matrix in place. Output is equivalent to PDQF(t(image)). Read more
Source§fn pdqf_negate_alt_cols<const NEGATE: bool>(
&mut self,
input: &mut GenericArray<GenericArray<Self::InternalFloat, Self::OutputDimension>, Self::OutputDimension>,
)
fn pdqf_negate_alt_cols<const NEGATE: bool>( &mut self, input: &mut GenericArray<GenericArray<Self::InternalFloat, Self::OutputDimension>, Self::OutputDimension>, )
Negate alternative columns of PDQF matrix in place. Equivalent to PDQF(flop(image)). Read more
Source§fn pdqf_negate_alt_rows<const NEGATE: bool>(
&mut self,
input: &mut GenericArray<GenericArray<Self::InternalFloat, Self::OutputDimension>, Self::OutputDimension>,
)
fn pdqf_negate_alt_rows<const NEGATE: bool>( &mut self, input: &mut GenericArray<GenericArray<Self::InternalFloat, Self::OutputDimension>, Self::OutputDimension>, )
Negate alternative rows of PDQF matrix in place. Equivalent to PDQF(flip(image)). Read more
Source§fn pdqf_negate_off_diagonals(
&mut self,
input: &mut GenericArray<GenericArray<Self::InternalFloat, Self::OutputDimension>, Self::OutputDimension>,
)
fn pdqf_negate_off_diagonals( &mut self, input: &mut GenericArray<GenericArray<Self::InternalFloat, Self::OutputDimension>, Self::OutputDimension>, )
Negate off-diagonals of PDQF matrix in place. Equivalent to PDQF(rotate180(image)). Read more
Source§fn required_hardware_features_met() -> bool
fn required_hardware_features_met() -> bool
Shorthand to
<<K as Kernel>::RequiredHardwareFeature as EvaluateHardwareFeature>::met_runtime() Read moreSource§impl Kernel for ReferenceKernel<f64>
Available on crate features std only.
impl Kernel for ReferenceKernel<f64>
Available on crate features
std only.Source§type Buffer1WidthX = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B1>, B1>, B1>, B1>, B1>, B1>
type Buffer1WidthX = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B1>, B1>, B1>, B1>, B1>, B1>
The width of the first stage (compression) buffer.
Source§type Buffer1LengthY = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B1>, B1>, B1>, B1>, B1>, B1>
type Buffer1LengthY = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B1>, B1>, B1>, B1>, B1>, B1>
The length of the first stage (compression) buffer.
Source§type InternalFloat = f64
type InternalFloat = f64
The internal floating point type used for intermediate calculations.
Source§type InputDimension = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, B0>, B0>, B0>
type InputDimension = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, B0>, B0>, B0>
The width and height of the input image.
Source§type OutputDimension = UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>
type OutputDimension = UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>
The width and height of the output hash.
Source§type RequiredHardwareFeature = Term
type RequiredHardwareFeature = Term
The hardware features required to run this kernel
Source§fn ident(&self) -> Self::Ident
fn ident(&self) -> Self::Ident
Return an identification of the kernel. For composite kernels that route to multiple kernels, report the kernel that would be executed.
Source§fn adjust_quality(input: Self::InternalFloat) -> f32
fn adjust_quality(input: Self::InternalFloat) -> f32
Adjust the quality metric to be between 0 and 1.
Source§fn dct2d(
&mut self,
buffer: &GenericArray<GenericArray<f64, Self::Buffer1WidthX>, Self::Buffer1LengthY>,
tmp_row_buffer: &mut GenericArray<f64, Self::Buffer1WidthX>,
output: &mut GenericArray<GenericArray<f64, U16>, U16>,
)
fn dct2d( &mut self, buffer: &GenericArray<GenericArray<f64, Self::Buffer1WidthX>, Self::Buffer1LengthY>, tmp_row_buffer: &mut GenericArray<f64, Self::Buffer1WidthX>, output: &mut GenericArray<GenericArray<f64, U16>, U16>, )
Apply a 2D DCT-II transformation to the input buffer write the result to the output buffer.
Source§fn sum_of_gradients(
&mut self,
input: &GenericArray<GenericArray<Self::InternalFloat, U16>, U16>,
) -> Self::InternalFloat
fn sum_of_gradients( &mut self, input: &GenericArray<GenericArray<Self::InternalFloat, U16>, U16>, ) -> Self::InternalFloat
Compute the sum of gradients of the input buffer in both horizontal and vertical directions.
Source§fn quantize(
&mut self,
input: &GenericArray<GenericArray<f64, U16>, U16>,
threshold: &mut Self::InternalFloat,
output: &mut GenericArray<GenericArray<u8, U2>, U16>,
)
fn quantize( &mut self, input: &GenericArray<GenericArray<f64, U16>, U16>, threshold: &mut Self::InternalFloat, output: &mut GenericArray<GenericArray<u8, U2>, U16>, )
Convert input to binary by thresholding at median
Source§fn jarosz_compress(
&mut self,
buffer: &GenericArray<GenericArray<f32, U512>, U512>,
output: &mut GenericArray<GenericArray<f64, Self::Buffer1WidthX>, Self::Buffer1LengthY>,
)
fn jarosz_compress( &mut self, buffer: &GenericArray<GenericArray<f32, U512>, U512>, output: &mut GenericArray<GenericArray<f64, Self::Buffer1WidthX>, Self::Buffer1LengthY>, )
Apply a tent-filter average to every 8x8 sub-block of the input buffer and write the result of each sub-block to the output buffer.
Source§fn cvt_rgb8_to_luma8f<const R_COEFF: u32, const G_COEFF: u32, const B_COEFF: u32>(
&mut self,
input: &GenericArray<GenericArray<u8, U3>, Self::InputDimension>,
output: &mut GenericArray<f32, Self::InputDimension>,
)
fn cvt_rgb8_to_luma8f<const R_COEFF: u32, const G_COEFF: u32, const B_COEFF: u32>( &mut self, input: &GenericArray<GenericArray<u8, U3>, Self::InputDimension>, output: &mut GenericArray<f32, Self::InputDimension>, )
Convert one row of input from RGB8 to LUMA8 floating point. Read more
Source§fn cvt_rgba8_to_luma8f<const R_COEFF: u32, const G_COEFF: u32, const B_COEFF: u32>(
&mut self,
input: &GenericArray<GenericArray<u8, U4>, Self::InputDimension>,
output: &mut GenericArray<f32, Self::InputDimension>,
)
fn cvt_rgba8_to_luma8f<const R_COEFF: u32, const G_COEFF: u32, const B_COEFF: u32>( &mut self, input: &GenericArray<GenericArray<u8, U4>, Self::InputDimension>, output: &mut GenericArray<f32, Self::InputDimension>, )
Convert RGBA8 to LUMA8. Read more
Source§fn pdqf_t(
&mut self,
input: &mut GenericArray<GenericArray<Self::InternalFloat, Self::OutputDimension>, Self::OutputDimension>,
)
fn pdqf_t( &mut self, input: &mut GenericArray<GenericArray<Self::InternalFloat, Self::OutputDimension>, Self::OutputDimension>, )
Transpose a PDQF matrix in place. Output is equivalent to PDQF(t(image)). Read more
Source§fn pdqf_negate_alt_cols<const NEGATE: bool>(
&mut self,
input: &mut GenericArray<GenericArray<Self::InternalFloat, Self::OutputDimension>, Self::OutputDimension>,
)
fn pdqf_negate_alt_cols<const NEGATE: bool>( &mut self, input: &mut GenericArray<GenericArray<Self::InternalFloat, Self::OutputDimension>, Self::OutputDimension>, )
Negate alternative columns of PDQF matrix in place. Equivalent to PDQF(flop(image)). Read more
Source§fn pdqf_negate_alt_rows<const NEGATE: bool>(
&mut self,
input: &mut GenericArray<GenericArray<Self::InternalFloat, Self::OutputDimension>, Self::OutputDimension>,
)
fn pdqf_negate_alt_rows<const NEGATE: bool>( &mut self, input: &mut GenericArray<GenericArray<Self::InternalFloat, Self::OutputDimension>, Self::OutputDimension>, )
Negate alternative rows of PDQF matrix in place. Equivalent to PDQF(flip(image)). Read more
Source§fn pdqf_negate_off_diagonals(
&mut self,
input: &mut GenericArray<GenericArray<Self::InternalFloat, Self::OutputDimension>, Self::OutputDimension>,
)
fn pdqf_negate_off_diagonals( &mut self, input: &mut GenericArray<GenericArray<Self::InternalFloat, Self::OutputDimension>, Self::OutputDimension>, )
Negate off-diagonals of PDQF matrix in place. Equivalent to PDQF(rotate180(image)). Read more
Source§fn required_hardware_features_met() -> bool
fn required_hardware_features_met() -> bool
Shorthand to
<<K as Kernel>::RequiredHardwareFeature as EvaluateHardwareFeature>::met_runtime() Read moreimpl PreciseKernel for ReferenceKernel<f32>
Available on crate features
std only.impl PreciseKernel for ReferenceKernel<f64>
Available on crate features
std only.Auto Trait Implementations§
impl<N> Freeze for ReferenceKernel<N>
impl<N> RefUnwindSafe for ReferenceKernel<N>where
N: RefUnwindSafe,
impl<N> Send for ReferenceKernel<N>where
N: Send,
impl<N> Sync for ReferenceKernel<N>where
N: Sync,
impl<N> Unpin for ReferenceKernel<N>where
N: Unpin,
impl<N> UnsafeUnpin for ReferenceKernel<N>
impl<N> UnwindSafe for ReferenceKernel<N>where
N: UnwindSafe,
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
Mutably borrows from an owned value. Read more