Build cumulative frequency table.
(freqs: &[u32; 256])
| 307 | |
| 308 | /// Build cumulative frequency table. |
| 309 | fn build_cum_table(freqs: &[u32; 256]) -> ([u32; 257], [u32; 256]) { |
| 310 | let mut cum = [0u32; 257]; |
| 311 | let sym_freqs = *freqs; |
| 312 | for i in 0..256 { |
| 313 | cum[i + 1] = cum[i] + freqs[i]; |
| 314 | } |
| 315 | (cum, sym_freqs) |
| 316 | } |
| 317 | |
| 318 | /// Build decode lookup table: for each slot in [0, PROB_SCALE), which symbol? |
| 319 | fn build_decode_table( |