aacsbr: fix high<->low resolution envelope mapping
[nihav.git] / nihav-mpeg / src / codecs / aac / sbr / bs.rs
index 74e820da626bc669289021eb8c4d8181e2ddfdaf..f12e9d9dc0a9a4d7fda6c1409fde2ae76d5f32a0 100644 (file)
@@ -259,8 +259,8 @@ fn read_envelope(br: &mut BitReader, chan: &mut SBRChannel, coupled: bool, cbs:
             for (i, band_env) in envelope[..num_env_bands].iter_mut().enumerate() {
                 let delta           = br.read_cb(t_cb)?;
                 let last = match (freq_res, chan.last_freq_res) {
-                        (true, false) => chan.last_envelope[state.high_to_low_res[i]],
-                        (false, true) => chan.last_envelope[state.low_to_high_res[i]],
+                        (false, true) => chan.last_envelope[state.high_to_low_res[i]],
+                        (true, false) => chan.last_envelope[state.low_to_high_res[i]],
                         _ => chan.last_envelope[i],
                     };
                 *band_env = last + delta * scale;