fn process_intensity_mpeg1(is_pos: usize, mid_side: bool, ch0: &mut [f32], ch1: &mut [f32]) {
    // For MPEG1 bitstreams, a scalefac can only be up-to 4-bits long. Therefore it is not possible
    // for a bitstream to specify an is_pos > 15. However, assert here to protect against logic
    // errors in the decoder.
    debug_assert!(is_pos <= 15);

    // A position of 7 is considered invalid and should be decoded as mid-side stereo if enabled.
    // Additionally, since a 4-bit scalefac, and thus is_pos, can exceed a value of 7 and index
    // outside the bounds of the intesity stereo ratio table, ignore is_pos values > 7.
    if is_pos < 7 {
        let (ratio_l, ratio_r) = INTENSITY_STEREO_RATIOS[is_pos];

        for (l, r) in ch0.iter_mut().zip(ch1) {
            let is = *l;
            *l = ratio_l * is;
            *r = ratio_r * is;
        }
    }
    else if is_pos == 7 && mid_side {
        process_mid_side(ch0, ch1);
    }
}
/// Decodes channel 0 of the intensity stereo coded signal into left and right channels for MPEG1
/// bitstreams.
///
/// The intensity position for the scale factor band covering the samples in ch0 and ch1 slices is a
/// required argument.
///
/// As per ISO/IEC 11172-3, the following calculation may be performed to decode the intensity
/// stereo coded signal into left and right channels.
///
/// ```text
///      l[i] = ch0[i] * k_l
///      r[i] = ch0[i] * l_r
/// ```
///
/// where:
///      l[i], and r[i] are the left and right channels, respectively.
///      ch0[i] is the intensity stereo coded signal found in channel 0.
///      k_l, and k_r are the left and right channel ratios, respectively.
Decodes channel 0 of the intensity stereo coded signal into left and right channels for MPEG1
bitstreams.

The intensity position for the scale factor band covering the samples in ch0 and ch1 slices is a
required argument.

As per ISO/IEC 11172-3, the following calculation may be performed to decode the intensity
stereo coded signal into left and right channels.



l[i], and r[i] are the left and right channels, respectively.
ch0[i] is the intensity stereo coded signal found in channel 0.
k_l, and k_r are the left and right channel ratios, respectively.
Decodes channel 0 of the intensity stereo coded signal into left and right channels for MPEG1 bitstreams . The intensity position for the scale factor band covering the samples in ch0 and ch1 slices is a required argument . As per ISO / IEC 11172 - 3 the following calculation may be performed to decode the intensity stereo coded signal into left and right channels . l [ i ] and r [ i ] are the left and right channels respectively . ch0 [ i ] is the intensity stereo coded signal found in channel 0 . k_l and k_r are the left and right channel ratios respectively .
fn process_intensity_mpeg1(is_pos: usize, mid_side: bool, ch0: &mut [f32], ch1: &mut [f32]) {
    // For MPEG1 bitstreams, a scalefac can only be up-to 4-bits long. Therefore it is not possible
    // for a bitstream to specify an is_pos > 15. However, assert here to protect against logic
    // errors in the decoder.
    debug_assert!(is_pos <= 15);
    // A position of 7 is considered invalid and should be decoded as mid-side stereo if enabled.
    // Additionally, since a 4-bit scalefac, and thus is_pos, can exceed a value of 7 and index
    // outside the bounds of the intesity stereo ratio table, ignore is_pos values > 7.
    if is_pos < 7 {
        let (ratio_l, ratio_r) = INTENSITY_STEREO_RATIOS[is_pos];
        for (l, r) in ch0.iter_mut().zip(ch1) {
            let is = *l;
            *l = ratio_l * is;
            *r = ratio_r * is;
        }
    }
    else if is_pos == 7 && mid_side {
        process_mid_side(ch0, ch1);
    }
}
fn process_intensity_mpeg1 ( is_pos : usize , mid_side : bool , ch0 : & mut [ f32 ] , ch1 : & mut [ f32 ] ) { // For MPEG1 bitstreams, a scalefac can only be up-to 4-bits long. Therefore it is not possible // for a bitstream to specify an is_pos > 15. However, assert here to protect against logic // errors in the decoder. debug_assert ! ( is_pos 15 ) ; // A position of 7 is considered invalid and should be decoded as mid-side stereo if enabled. // Additionally, since a 4-bit scalefac, and thus is_pos, can exceed a value of 7 and index // outside the bounds of the intesity stereo ratio table, ignore is_pos values > 7. if is_pos < 7 { let ( ratio_l , ratio_r ) = INTENSITY_STEREO_RATIOS [ is_pos ] ; for ( l , r ) in ch0 . iter_mut ( ) . zip ( ch1 ) { let is = * l ; * l = ratio_l * is ; * r = ratio_r * is ; } } else if is_pos == 7 && mid_side { process_mid_side ( ch0 , ch1 ) ; } }
Decodes channel 0 of the intensity stereo coded signal into left and right channels for MPEG1
bitstreams.
Decodes channel 0 of the intensity stereo coded signal into left and right channels for MPEG1 bitstreams .
is_pos
usize
mid_side
bool
ch0
&mut [f32]
ch1
&mut [f32]
is_pos
usize
mid_side
bool
ch0
&mut [f32]
ch1
&mut [f32]