1*9a19cd78SMatthias Ringwald /****************************************************************************** 2*9a19cd78SMatthias Ringwald * 3*9a19cd78SMatthias Ringwald * Copyright 2021 Google, Inc. 4*9a19cd78SMatthias Ringwald * 5*9a19cd78SMatthias Ringwald * Licensed under the Apache License, Version 2.0 (the "License"); 6*9a19cd78SMatthias Ringwald * you may not use this file except in compliance with the License. 7*9a19cd78SMatthias Ringwald * You may obtain a copy of the License at: 8*9a19cd78SMatthias Ringwald * 9*9a19cd78SMatthias Ringwald * http://www.apache.org/licenses/LICENSE-2.0 10*9a19cd78SMatthias Ringwald * 11*9a19cd78SMatthias Ringwald * Unless required by applicable law or agreed to in writing, software 12*9a19cd78SMatthias Ringwald * distributed under the License is distributed on an "AS IS" BASIS, 13*9a19cd78SMatthias Ringwald * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14*9a19cd78SMatthias Ringwald * See the License for the specific language governing permissions and 15*9a19cd78SMatthias Ringwald * limitations under the License. 16*9a19cd78SMatthias Ringwald * 17*9a19cd78SMatthias Ringwald ******************************************************************************/ 18*9a19cd78SMatthias Ringwald 19*9a19cd78SMatthias Ringwald /** 20*9a19cd78SMatthias Ringwald * LC3 - Bandwidth detector 21*9a19cd78SMatthias Ringwald * 22*9a19cd78SMatthias Ringwald * Reference : Low Complexity Communication Codec (LC3) 23*9a19cd78SMatthias Ringwald * Bluetooth Specification v1.0 24*9a19cd78SMatthias Ringwald */ 25*9a19cd78SMatthias Ringwald 26*9a19cd78SMatthias Ringwald #ifndef __LC3_BWDET_H 27*9a19cd78SMatthias Ringwald #define __LC3_BWDET_H 28*9a19cd78SMatthias Ringwald 29*9a19cd78SMatthias Ringwald #include "common.h" 30*9a19cd78SMatthias Ringwald #include "bits.h" 31*9a19cd78SMatthias Ringwald 32*9a19cd78SMatthias Ringwald 33*9a19cd78SMatthias Ringwald /** 34*9a19cd78SMatthias Ringwald * Bandwidth detector (cf. 3.3.5) 35*9a19cd78SMatthias Ringwald * dt, sr Duration and samplerate of the frame 36*9a19cd78SMatthias Ringwald * e Energy estimation per bands 37*9a19cd78SMatthias Ringwald * return Return detected bandwitdth 38*9a19cd78SMatthias Ringwald */ 39*9a19cd78SMatthias Ringwald enum lc3_bandwidth lc3_bwdet_run( 40*9a19cd78SMatthias Ringwald enum lc3_dt dt, enum lc3_srate sr, const float *e); 41*9a19cd78SMatthias Ringwald 42*9a19cd78SMatthias Ringwald /** 43*9a19cd78SMatthias Ringwald * Return number of bits coding the bandwidth value 44*9a19cd78SMatthias Ringwald * sr Samplerate of the frame 45*9a19cd78SMatthias Ringwald * return Number of bits coding the bandwidth value 46*9a19cd78SMatthias Ringwald */ 47*9a19cd78SMatthias Ringwald int lc3_bwdet_get_nbits(enum lc3_srate sr); 48*9a19cd78SMatthias Ringwald 49*9a19cd78SMatthias Ringwald /** 50*9a19cd78SMatthias Ringwald * Put bandwidth indication 51*9a19cd78SMatthias Ringwald * bits Bitstream context 52*9a19cd78SMatthias Ringwald * sr Samplerate of the frame 53*9a19cd78SMatthias Ringwald * bw Bandwidth detected 54*9a19cd78SMatthias Ringwald */ 55*9a19cd78SMatthias Ringwald void lc3_bwdet_put_bw(lc3_bits_t *bits, 56*9a19cd78SMatthias Ringwald enum lc3_srate sr, enum lc3_bandwidth bw); 57*9a19cd78SMatthias Ringwald 58*9a19cd78SMatthias Ringwald /** 59*9a19cd78SMatthias Ringwald * Get bandwidth indication 60*9a19cd78SMatthias Ringwald * bits Bitstream context 61*9a19cd78SMatthias Ringwald * sr Samplerate of the frame 62*9a19cd78SMatthias Ringwald * bw Return bandwidth indication 63*9a19cd78SMatthias Ringwald * return 0: Ok -1: Invalid bandwidth indication 64*9a19cd78SMatthias Ringwald */ 65*9a19cd78SMatthias Ringwald int lc3_bwdet_get_bw(lc3_bits_t *bits, 66*9a19cd78SMatthias Ringwald enum lc3_srate sr, enum lc3_bandwidth *bw); 67*9a19cd78SMatthias Ringwald 68*9a19cd78SMatthias Ringwald 69*9a19cd78SMatthias Ringwald #endif /* __LC3_BWDET_H */ 70