Expand description
§combs-media
Media preprocessing — the traits-first basic block for non-text modalities. Vision (SigLIP-style image preprocessing) and audio (WAV → 16 kHz → Whisper log-mel) are both plain host-side code (no GPU dependency) producing normalized tensors the runtime hands to the model’s embedding entry points.
Structs§
- LogMel
- Whisper log-mel extractor. Owns the FFT plan, window, and filterbank; build once, reuse per utterance.
- Pixel
Batch - A preprocessed image: planar CHW f32, normalized, ready for
Tensor::from_data(TensorData::new(data, [1, c, h, w])). - Siglip
Preprocessor - SigLIP / Idefics3 single-image preprocessing (SmolVLM-256M/500M):
RGB → resize longest edge to
image_size(aspect preserved, bilinear) → pad to a square with 0.5 → rescale 1/255 → normalize mean/std 0.5. (Padding at the normalization mean maps to 0 after normalization.)
Enums§
- Media
Error - Errors produced while decoding or preprocessing media.
Constants§
- CHUNK_
FRAMES - Frames one 30 s window produces (CHUNK_SAMPLES / HOP_LENGTH).
- CHUNK_
SAMPLES - Samples in one 30 s model window.
- HOP_
LENGTH - STFT hop (10 ms at 16 kHz).
- N_FFT
- STFT window length (25 ms at 16 kHz).
- N_MELS
- Mel bins.
- SAMPLE_
RATE - Sample rate every speech model input is resampled to.
Traits§
- Image
Preprocessor - Turns encoded image bytes (PNG/JPEG/WebP) into normalized pixel batches.
Functions§
- decode_
wav - Decodes a WAV payload to mono f32 samples in [-1, 1].
- pad_
or_ trim - Zero-pads or truncates to exactly
lensamples (the 30 s model window). - resample_
linear - Linear-interpolation resampler. Documented v1 simplification: no low-pass filter, which is adequate for speech into a 16 kHz pipeline; a windowed-sinc resampler can replace this without changing callers.
Type Aliases§
- Result
- Convenient result alias for this crate.