| 146 | } |
| 147 | |
| 148 | static int32_t get_num_codebooks(float bandwidth, int hop_length, float sample_rate) { |
| 149 | // The number of codebooks is determined by the bandwidth selected. |
| 150 | // Supported bandwidths are 1.5kbps (n_q = 2), 3 kbps (n_q = 4), 6 kbps (n_q = 8), |
| 151 | // 12 kbps (n_q = 16) and 24kbps (n_q = 32). |
| 152 | return (int32_t) ceilf(1000 * bandwidth / (ceilf(sample_rate / hop_length) * 10)); |
| 153 | } |
| 154 | |
| 155 | static int32_t get_bandwidth_per_quantizer(int bins, float frame_rate) { |
| 156 | return log2f((float) bins) * frame_rate; |
no outgoing calls
no test coverage detected