fn process_intensity_short_block_mpeg1(
    header: &FrameHeader,
    granule: &Granule,
    is_mixed: bool,
    mid_side: bool,
    ch0: &mut [f32; 576],
    ch1: &mut [f32; 576],
) -> usize {
    // As per ISO/IEC 11172-3, for short blocks that have intensity stereo coding enabled, all bands
    // starting after the last non-zero band in channel 1 may be intensity stereo coded.
    //
    // The scale-factors in channel 1 for those respective bands determine the intensity position.
    let rzero = granule.channels[1].rzero;

    // If the short block is mixed, then use the mixed bands table, otherwise use the short band
    // table.
    let bands = if is_mixed {
        SFB_MIXED_BANDS[header.sample_rate_idx]
    }
    else {
        &SFB_SHORT_BANDS[header.sample_rate_idx]
    };

    // Create an iterator that yields a band start-end pair, and scale-factor.
    let bands_iter = bands.iter()
                          .zip(&bands[1..])
                          .zip(granule.channels[1].scalefacs.iter());

    // Iterate over each band and decode the intensity stereo coding if the band is zero.
    for ((start, end), is_pos) in bands_iter {
        // TODO: If one window is non-zero in the band, should the entire band be considered
        // non-zero? Or could the next window(s) be intensity stereo coded? This check only supports
        // the latter case.
        if *start >= rzero {
            process_intensity_mpeg1(
                *is_pos as usize,
                mid_side,
                &mut ch0[*start..*end],
                &mut ch1[*start..*end],
            );
        }
    }

    rzero
}
/// Decodes all intensity stereo coded bands within an entire short block for MPEG1 bitstreams, and
/// returns the intensity bound.
Decodes all intensity stereo coded bands within an entire short block for MPEG1 bitstreams, and
returns the intensity bound.
Decodes all intensity stereo coded bands within an entire short block for MPEG1 bitstreams and returns the intensity bound .
fn process_intensity_short_block_mpeg1(
    header: &FrameHeader,
    granule: &Granule,
    is_mixed: bool,
    mid_side: bool,
    ch0: &mut [f32; 576],
    ch1: &mut [f32; 576],
) -> usize {
    // As per ISO/IEC 11172-3, for short blocks that have intensity stereo coding enabled, all bands
    // starting after the last non-zero band in channel 1 may be intensity stereo coded.
    //
    // The scale-factors in channel 1 for those respective bands determine the intensity position.
    let rzero = granule.channels[1].rzero;
    // If the short block is mixed, then use the mixed bands table, otherwise use the short band
    // table.
    let bands = if is_mixed {
        SFB_MIXED_BANDS[header.sample_rate_idx]
    }
    else {
        &SFB_SHORT_BANDS[header.sample_rate_idx]
    };
    // Create an iterator that yields a band start-end pair, and scale-factor.
    let bands_iter = bands.iter()
                          .zip(&bands[1..])
                          .zip(granule.channels[1].scalefacs.iter());
    // Iterate over each band and decode the intensity stereo coding if the band is zero.
    for ((start, end), is_pos) in bands_iter {
        // TODO: If one window is non-zero in the band, should the entire band be considered
        // non-zero? Or could the next window(s) be intensity stereo coded? This check only supports
        // the latter case.
        if *start >= rzero {
            process_intensity_mpeg1(
                *is_pos as usize,
                mid_side,
                &mut ch0[*start..*end],
                &mut ch1[*start..*end],
            );
        }
    }
    rzero
}
fn process_intensity_short_block_mpeg1 ( header : & FrameHeader , granule : & Granule , is_mixed : bool , mid_side : bool , ch0 : & mut [ f32 ; 576 ] , ch1 : & mut [ f32 ; 576 ] , ) -> usize { // As per ISO/IEC 11172-3, for short blocks that have intensity stereo coding enabled, all bands // starting after the last non-zero band in channel 1 may be intensity stereo coded. // // The scale-factors in channel 1 for those respective bands determine the intensity position. let rzero = granule . channels [ 1 ] . rzero ; // If the short block is mixed, then use the mixed bands table, otherwise use the short band // table. let bands = if is_mixed { SFB_MIXED_BANDS [ header . sample_rate_idx ] } else { & SFB_SHORT_BANDS [ header . sample_rate_idx ] } ; // Create an iterator that yields a band start-end pair, and scale-factor. let bands_iter = bands . iter ( ) . zip ( & bands [ 1 .. ] ) . zip ( granule . channels [ 1 ] . scalefacs . iter ( ) ) ; // Iterate over each band and decode the intensity stereo coding if the band is zero. for ( ( start , end ) , is_pos ) in bands_iter { // TODO: If one window is non-zero in the band, should the entire band be considered // non-zero? Or could the next window(s) be intensity stereo coded? This check only supports // the latter case. if * start >= rzero { process_intensity_mpeg1 ( * is_pos as usize , mid_side , & mut ch0 [ * start .. * end ] , & mut ch1 [ * start .. * end ] , ) ; } } rzero }
Decodes all intensity stereo coded bands within an entire short block for MPEG1 bitstreams, and
returns the intensity bound.
Decodes all intensity stereo coded bands within an entire short block for MPEG1 bitstreams and returns the intensity bound .
header
&FrameHeader
granule
&Granule
is_mixed
bool
mid_side
bool
ch0
&mut [f32; 576]
ch1
&mut [f32; 576]
header
&FrameHeader
granule
&Granule
is_mixed
bool
mid_side
bool
ch0
&mut [f32; 576]
ch1
&mut [f32; 576]