sample_indices

Function sample_indices 

Source
pub fn sample_indices(
    n_frames: usize,
    native_fps: f32,
    target_fps: f32,
    min_frames: usize,
    max_frames: usize,
    temporal_patch_size: usize,
) -> Vec<usize>
Expand description

2026-09-25: Pick which frame indices to keep so the clip plays at fps.

native_fps is the container’s rate. Indices are the nearest to a uniform grid over the clip, not every Nth frame, which quantises badly when the ratio is not an integer. The count is clamped into [min_frames, max_frames], never above the frames that exist, and then down to a multiple of temporal_patch_size (at least one group), because a partial group cannot be encoded. A clip shorter than one group returns all of its frames. A non-finite or non-positive rate counts as DEFAULT_FPS.