pub struct SegmentFingerprint {
pub hash: u64,
pub frame_count: usize,
pub duration_ms: u64,
}Expand description
A compact fingerprint for a single video segment (group of frames).
Fields§
§hash: u64Perceptual hash of the segment (64-bit).
frame_count: usizeNumber of frames in this segment.
duration_ms: u64Duration of this segment in milliseconds.
Implementations§
Source§impl SegmentFingerprint
impl SegmentFingerprint
Sourcepub fn new(hash: u64, frame_count: usize, duration_ms: u64) -> Self
pub fn new(hash: u64, frame_count: usize, duration_ms: u64) -> Self
Create a SegmentFingerprint from pre-computed values.
Sourcepub fn from_frame_data(
data: &[u8],
frame_count: usize,
duration_ms: u64,
) -> Self
pub fn from_frame_data( data: &[u8], frame_count: usize, duration_ms: u64, ) -> Self
Derive a SegmentFingerprint from raw frame data.
Uses a two-pass FNV-1a–based perceptual hash that is sensitive to the distribution of byte values (luminance-like) rather than the exact raw bytes, giving some robustness to minor encoding differences.
Sourcepub fn hamming_distance(&self, other: &Self) -> u32
pub fn hamming_distance(&self, other: &Self) -> u32
Compute the Hamming distance (number of differing bits) between two hashes.
Sourcepub fn ms_per_frame(&self) -> u64
pub fn ms_per_frame(&self) -> u64
Returns the average milliseconds per frame.
Returns 0 if frame_count is zero.
Trait Implementations§
Source§impl Clone for SegmentFingerprint
impl Clone for SegmentFingerprint
Source§fn clone(&self) -> SegmentFingerprint
fn clone(&self) -> SegmentFingerprint
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SegmentFingerprint
impl Debug for SegmentFingerprint
impl Eq for SegmentFingerprint
Source§impl PartialEq for SegmentFingerprint
impl PartialEq for SegmentFingerprint
Source§fn eq(&self, other: &SegmentFingerprint) -> bool
fn eq(&self, other: &SegmentFingerprint) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for SegmentFingerprint
Auto Trait Implementations§
impl Freeze for SegmentFingerprint
impl RefUnwindSafe for SegmentFingerprint
impl Send for SegmentFingerprint
impl Sync for SegmentFingerprint
impl Unpin for SegmentFingerprint
impl UnsafeUnpin for SegmentFingerprint
impl UnwindSafe for SegmentFingerprint
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