Struct SceneChangeDetector

pub struct SceneChangeDetector<T: Pixel> { pub intra_costs: Option<BTreeMap<usize, Box<[u32]>>>, /* private fields */ }

Runs keyframe detection on frames from the lookahead queue.

This struct is intended for advanced users who need the ability to analyze a small subset of frames at a time, for example in a streaming fashion. Most users will prefer to use new_detector and detect_scene_changes at the top level of this crate.

Fields

intra_costs: Option<BTreeMap<usize, Box<[u32]>>>

Calculated intra costs for each input frame. These can be cached for reuse by advanced API users. Caching will occur if this is not None.

Implementations

impl<T: Pixel> SceneChangeDetector<T>

fn new(resolution: (usize, usize), bit_depth: usize, frame_rate: Rational32, chroma_sampling: ChromaSampling, lookahead_distance: usize, scene_detection_mode: SceneDetectionSpeed, min_key_frame_interval: usize, max_key_frame_interval: usize, cpu_feature_level: CpuFeatureLevel) -> Self

Creates a new instance of the SceneChangeDetector.

fn enable_cache(&mut self)

Enables caching of intra costs. For advanced API users.

fn analyze_next_frame(&mut self, frame_set: &[&Arc<Frame<T>>], input_frameno: usize, previous_keyframe: usize) -> bool

Runs keyframe detection on the next frame in the lookahead queue.

This function requires that a subset of input frames is passed to it in order, and that keyframes is only updated from this method. input_frameno should correspond to the second frame in frame_set.

This will gracefully handle the first frame in the video as well.

Auto Trait Implementations

impl<T> Freeze for SceneChangeDetector<T> where Option<ScaleFunction<T>>: Freeze, Option<[Plane<T>; 2]>: Freeze, Option<Plane<T>>: Freeze,

impl<T> RefUnwindSafe for SceneChangeDetector<T> where Option<ScaleFunction<T>>: RefUnwindSafe, Option<[Plane<T>; 2]>: RefUnwindSafe, Option<Plane<T>>: RefUnwindSafe,

impl<T> Send for SceneChangeDetector<T> where Option<ScaleFunction<T>>: Send, Option<[Plane<T>; 2]>: Send, Option<Plane<T>>: Send,

impl<T> Sync for SceneChangeDetector<T> where Option<ScaleFunction<T>>: Sync, Option<[Plane<T>; 2]>: Sync, Option<Plane<T>>: Sync,

impl<T> Unpin for SceneChangeDetector<T> where Option<ScaleFunction<T>>: Unpin, Option<[Plane<T>; 2]>: Unpin, Option<Plane<T>>: Unpin,

impl<T> UnsafeUnpin for SceneChangeDetector<T> where Option<ScaleFunction<T>>: UnsafeUnpin, Option<[Plane<T>; 2]>: UnsafeUnpin, Option<Plane<T>>: UnsafeUnpin,

impl<T> UnwindSafe for SceneChangeDetector<T> where Option<ScaleFunction<T>>: UnwindSafe, Option<[Plane<T>; 2]>: UnwindSafe, Option<Plane<T>>: UnwindSafe,

Blanket Implementations

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

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

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

impl<T> From<T> for SceneChangeDetector<T>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> IntoEither for SceneChangeDetector<T>

impl<T> Pointable for SceneChangeDetector<T>

const ALIGN: usize = _;
type Init = T;
unsafe fn init(init: <T as Pointable>::Init) -> usize
unsafe fn deref<'a>(ptr: usize) -> &'a T
unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
unsafe fn drop(ptr: usize)

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

fn into(self) -> U

Calls U::from(self).

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

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

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

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

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