LastCodedBands moves at most one band per frame (libopus)
Browse files at this commiteee0a6933db2d1a4bc4ffb9d3a6308a8ff84309aParent: 567ea1d- feat
- lastCodedBands moves at most one band per frame (libopus)
1 changed file +6 -1
crates/ec-opus/src/celt_enc.rsmodified+6 -1
| @@ -967,7 +967,12 @@ impl CeltEncoder { | |||
| 967 | let dual_stereo = alloc.dual_stereo; | 967 | let dual_stereo = alloc.dual_stereo; |
| 968 | let balance = alloc.balance; | 968 | let balance = alloc.balance; |
| 969 | let coded_bands = alloc.coded_bands; | 969 | let coded_bands = alloc.coded_bands; |
| 970 | - self.last_coded_bands = coded_bands; | 970 | + // libopus: lastCodedBands follows codedBands by at most one band per frame. |
| 971 | + self.last_coded_bands = if self.last_coded_bands != 0 { | ||
| 972 | + coded_bands.clamp(self.last_coded_bands - 1, self.last_coded_bands + 1) | ||
| 973 | + } else { | ||
| 974 | + coded_bands | ||
| 975 | + }; | ||
| 971 | 976 | ||
| 972 | // --- Fine energy ---------------------------------------------------- | 977 | // --- Fine energy ---------------------------------------------------- |
| 973 | for i in start..end { | 978 | for i in start..end { |