Commit 75a06568 authored by Thomas Daede's avatar Thomas Daede

Add a Pixel trait which represents a u8 or u16 pixel.

parent 55cf5354
......@@ -18,6 +18,7 @@ use num_traits::*;
use context::INTRA_MODES;
use context::MAX_TX_SIZE;
use partition::*;
use util::*;
use std::mem::*;
#[cfg(target_arch = "x86")]
......@@ -185,10 +186,9 @@ decl_angular_ipred_fn!(rav1e_ipred_smooth_h_avx2);
#[cfg(all(target_arch = "x86_64", not(windows)))]
decl_angular_ipred_fn!(rav1e_ipred_smooth_v_avx2);
// TODO: rename the type bounds later
pub trait Intra<T>: Dim
where
T: PrimInt + Into<u32> + Into<i32> + 'static,
T: Pixel,
i32: AsPrimitive<T>,
u32: AsPrimitive<T>,
usize: AsPrimitive<T>
......
......@@ -210,6 +210,9 @@ pub fn clamp<T: PartialOrd>(input: T, min: T, max: T) -> T {
use num_traits::PrimInt;
use std::mem::size_of;
pub trait Pixel: PrimInt + Into<u32> + Into<i32> + 'static {}
impl<T> Pixel for T where T: PrimInt + Into<u32> + Into<i32> + 'static {}
pub trait ILog: PrimInt {
fn ilog(self) -> Self {
Self::from(size_of::<Self>() * 8 - self.leading_zeros() as usize).unwrap()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment