pub struct PerceptualAnalysisResult {
pub coefficients: NonEmptyVec<f32>,
pub bin_energies: NonEmptyVec<f32>,
pub band_metrics: BandMetrics,
pub n_coefficients: NonZeroUsize,
pub n_frames: NonZeroUsize,
pub original_length: usize,
pub sample_rate: NonZeroU32,
pub mdct_params: MdctParams,
}Expand description
Output of the psychoacoustic analysis pipeline.
§Purpose
Bundles everything a downstream codec or bit-allocator needs: the raw
spectral coefficients to quantize, the per-bin energies used to build the
masking model, the per-band metrics summarising audibility and allowed noise,
and enough metadata to reconstruct the signal via reconstruct_signal.
§Fields
coefficients– Flattened MDCT coefficients stored in row-major (C) order with shape(n_coefficients, n_frames). Index ask * n_frames + ffor bink, framef. These are the values a codec would quantize.bin_energies– Average power per MDCT bin across all analysed frames.band_metrics– OneBandMetricper band.n_coefficients– Number of MDCT bins per frame (window_size / 2).n_frames– Number of analysis frames.original_length– Original signal length in samples, needed for accurate IMDCT.sample_rate– Sample rate of the analysed signal.mdct_params– The MDCT parameters used for analysis; required byreconstruct_signal.
Fields§
§coefficients: NonEmptyVec<f32>Flattened MDCT coefficients, shape (n_coefficients, n_frames), row-major.
bin_energies: NonEmptyVec<f32>Average power per MDCT bin (linear scale) across all frames.
band_metrics: BandMetricsPer-band psychoacoustic metrics.
n_coefficients: NonZeroUsizeNumber of MDCT coefficients (bins) per frame.
n_frames: NonZeroUsizeNumber of MDCT frames.
original_length: usizeOriginal signal length in samples.
sample_rate: NonZeroU32Sample rate of the analysed signal.
mdct_params: MdctParamsMDCT parameters used during analysis (needed for reconstruction).
Implementations§
Source§impl PerceptualAnalysisResult
impl PerceptualAnalysisResult
Sourcepub fn new(
coefficients: NonEmptyVec<f32>,
bin_energies: NonEmptyVec<f32>,
band_metrics: BandMetrics,
n_coefficients: NonZeroUsize,
n_frames: NonZeroUsize,
original_length: usize,
sample_rate: NonZeroU32,
mdct_params: MdctParams,
) -> Self
pub fn new( coefficients: NonEmptyVec<f32>, bin_energies: NonEmptyVec<f32>, band_metrics: BandMetrics, n_coefficients: NonZeroUsize, n_frames: NonZeroUsize, original_length: usize, sample_rate: NonZeroU32, mdct_params: MdctParams, ) -> Self
Creates a PerceptualAnalysisResult from pre-computed fields.
Trait Implementations§
Source§impl Clone for PerceptualAnalysisResult
impl Clone for PerceptualAnalysisResult
Source§fn clone(&self) -> PerceptualAnalysisResult
fn clone(&self) -> PerceptualAnalysisResult
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for PerceptualAnalysisResult
impl RefUnwindSafe for PerceptualAnalysisResult
impl Send for PerceptualAnalysisResult
impl Sync for PerceptualAnalysisResult
impl Unpin for PerceptualAnalysisResult
impl UnsafeUnpin for PerceptualAnalysisResult
impl UnwindSafe for PerceptualAnalysisResult
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Src, Dst> ConvertTo<Dst> for Srcwhere
Dst: ConvertFrom<Src>,
impl<Src, Dst> ConvertTo<Dst> for Srcwhere
Dst: ConvertFrom<Src>,
Source§fn convert_to(self) -> Dst
fn convert_to(self) -> Dst
Dst using audio-aware scaling. Read moreSource§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>
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>
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