Skip to main content

InMemoryCoverFetch

Struct InMemoryCoverFetch 

Source
pub struct InMemoryCoverFetch<'a> { /* private fields */ }
Expand description

§6E-C / Task #24.2 — in-memory CoverFetch adapter.

Wraps a pre-materialized (cover_bits, costs) pair and slices on-demand per segment. Suitable for orchestrator integrations (Task #24.3) where the encoder’s Pass-1 cover already lives in memory and the streaming-Viterbi memory savings come from the STC-internal O(√n) checkpoint + back-pointer working set, not the cover side.

Memory bound: O(n) cover (caller-provided) + O(K × w) per segment fetch + O(num_segments × num_states × 8 B) checkpoints inside stc_embed_streaming_segmented. For long-clip video stego where the encoder’s full per-GOP cover materialization is itself the OOM source, a follow-on per-GOP-replay adapter (left as v1.1+ work) replaces the cover materialization with repeated Pass 1 invocations bounded by the segment’s GOP range. That follow-on requires encoder restartability at arbitrary GOP boundaries — out of scope for v1.0 (mobile clips are short enough that in-memory cover fits).

Implementations§

Source§

impl<'a> InMemoryCoverFetch<'a>

Source

pub fn new( cover_bits: &'a [u8], costs: &'a [f32], m: usize, w: usize, segment_size_in_blocks: usize, ) -> Option<Self>

Construct a new in-memory cover fetcher. cover_bits.len() must equal costs.len() and must equal m * w. Returns None on length-mismatch.

Trait Implementations§

Source§

impl<'a> CoverFetch for InMemoryCoverFetch<'a>

Source§

fn total_positions(&self) -> usize

Total cover position count n.
Source§

fn num_segments(&self) -> usize

Number of segments. Equals m.div_ceil(K) where K is the segment size.
Source§

fn segment_size_in_blocks(&self) -> usize

Segment size in message blocks (constant across segments except possibly the last). The last segment may have fewer blocks if m doesn’t divide evenly by K.
Source§

fn fetch_segment(&mut self, seg_idx: usize) -> (Vec<u8>, Vec<f32>)

Fetch one segment’s cover bits and costs. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V