pub struct FrameHash {
pub algorithm: HashAlgorithm,
pub bits: Vec<u8>,
pub frame_index: u64,
}Expand description
A compact hash value representing one video frame.
Fields§
§algorithm: HashAlgorithmAlgorithm that produced this hash.
bits: Vec<u8>Raw hash bits stored as a byte vector.
frame_index: u64Frame index within the source media.
Implementations§
Source§impl FrameHash
impl FrameHash
Sourcepub fn new(algorithm: HashAlgorithm, bits: Vec<u8>, frame_index: u64) -> Self
pub fn new(algorithm: HashAlgorithm, bits: Vec<u8>, frame_index: u64) -> Self
Construct a new FrameHash.
Sourcepub fn hamming_distance(&self, other: &Self) -> Option<u32>
pub fn hamming_distance(&self, other: &Self) -> Option<u32>
Compute the Hamming distance between self and other.
Returns None if the two hashes have different algorithms or lengths.
Sourcepub fn is_similar(&self, other: &Self, max_distance: u32) -> bool
pub fn is_similar(&self, other: &Self, max_distance: u32) -> bool
Return true if the two hashes are within max_distance bits of each other.
Trait Implementations§
impl Eq for FrameHash
impl StructuralPartialEq for FrameHash
Auto Trait Implementations§
impl Freeze for FrameHash
impl RefUnwindSafe for FrameHash
impl Send for FrameHash
impl Sync for FrameHash
impl Unpin for FrameHash
impl UnsafeUnpin for FrameHash
impl UnwindSafe for FrameHash
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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>
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 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>
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