MCPcopy Create free account
hub / github.com/PABannier/encodec.cpp / get_num_codebooks

Function get_num_codebooks

encodec.cpp:148–153  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

146}
147
148static 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
155static int32_t get_bandwidth_per_quantizer(int bins, float frame_rate) {
156 return log2f((float) bins) * frame_rate;

Callers 1

encodec_load_modelFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected