-} else {
- let mut used_bits: i32 = 0;
-
- let mut tmp: [f32; BANDS] = [BITALLOC_TOP_LIMIT; BANDS];
- for band in 0..BANDS {
- if self.band_bits[band] != 0 {
- tmp[band] = (self.band_bits[band] as f32) * -2.0 + ch_data.coeffs4[band] - 0.415 + 2.0;
- }
- }
- while free_bits < used_bits {
- let mut low = BITALLOC_TOP_LIMIT;
- let mut idx = 0;
- for band in 0..BANDS {
- if tmp[band] < low {
- low = tmp[band];
- idx = band;
- }
- }
- tmp[idx] += 2.0;
- self.band_bits[idx] -= 1;
- if self.band_bits[idx] == 0 {
- tmp[idx] = BITALLOC_TOP_LIMIT;
- }
- for i in IMC_BANDS[idx]..IMC_BANDS[idx + 1] {
- if self.cw_len[i] > 0 {
- self.cw_len[i] -= 1;
- used_bits -= 1;
- if used_bits <= free_bits {
- break;
- }
- }
- }
- }
-}
-