xref: /btstack/3rd-party/lc3-google/src/tables.h (revision 4930cef6e21e6da2d7571b9259c7f0fb8bed3d01)
19a19cd78SMatthias Ringwald /******************************************************************************
29a19cd78SMatthias Ringwald  *
3*4930cef6SMatthias Ringwald  *  Copyright 2022 Google LLC
49a19cd78SMatthias Ringwald  *
59a19cd78SMatthias Ringwald  *  Licensed under the Apache License, Version 2.0 (the "License");
69a19cd78SMatthias Ringwald  *  you may not use this file except in compliance with the License.
79a19cd78SMatthias Ringwald  *  You may obtain a copy of the License at:
89a19cd78SMatthias Ringwald  *
99a19cd78SMatthias Ringwald  *  http://www.apache.org/licenses/LICENSE-2.0
109a19cd78SMatthias Ringwald  *
119a19cd78SMatthias Ringwald  *  Unless required by applicable law or agreed to in writing, software
129a19cd78SMatthias Ringwald  *  distributed under the License is distributed on an "AS IS" BASIS,
139a19cd78SMatthias Ringwald  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
149a19cd78SMatthias Ringwald  *  See the License for the specific language governing permissions and
159a19cd78SMatthias Ringwald  *  limitations under the License.
169a19cd78SMatthias Ringwald  *
179a19cd78SMatthias Ringwald  ******************************************************************************/
189a19cd78SMatthias Ringwald 
199a19cd78SMatthias Ringwald #ifndef __LC3_TABLES_H
209a19cd78SMatthias Ringwald #define __LC3_TABLES_H
219a19cd78SMatthias Ringwald 
229a19cd78SMatthias Ringwald #include "common.h"
239a19cd78SMatthias Ringwald #include "bits.h"
249a19cd78SMatthias Ringwald 
259a19cd78SMatthias Ringwald 
269a19cd78SMatthias Ringwald /**
279a19cd78SMatthias Ringwald  * MDCT Twiddles and window coefficients
289a19cd78SMatthias Ringwald  */
299a19cd78SMatthias Ringwald 
309a19cd78SMatthias Ringwald struct lc3_fft_bf3_twiddles { int n3; const struct lc3_complex (*t)[2]; };
319a19cd78SMatthias Ringwald struct lc3_fft_bf2_twiddles { int n2; const struct lc3_complex *t; };
329a19cd78SMatthias Ringwald struct lc3_mdct_rot_def { int n4; const struct lc3_complex *w; };
339a19cd78SMatthias Ringwald 
349a19cd78SMatthias Ringwald extern const struct lc3_fft_bf3_twiddles *lc3_fft_twiddles_bf3[];
359a19cd78SMatthias Ringwald extern const struct lc3_fft_bf2_twiddles *lc3_fft_twiddles_bf2[][3];
369a19cd78SMatthias Ringwald extern const struct lc3_mdct_rot_def *lc3_mdct_rot[LC3_NUM_DT][LC3_NUM_SRATE];
379a19cd78SMatthias Ringwald 
389a19cd78SMatthias Ringwald extern const float *lc3_mdct_win[LC3_NUM_DT][LC3_NUM_SRATE];
399a19cd78SMatthias Ringwald 
409a19cd78SMatthias Ringwald 
419a19cd78SMatthias Ringwald /**
429a19cd78SMatthias Ringwald  * Limits of bands
439a19cd78SMatthias Ringwald  */
449a19cd78SMatthias Ringwald 
459a19cd78SMatthias Ringwald #define LC3_NUM_BANDS  64
469a19cd78SMatthias Ringwald 
479a19cd78SMatthias Ringwald extern const int lc3_band_lim[LC3_NUM_DT][LC3_NUM_SRATE][LC3_NUM_BANDS+1];
489a19cd78SMatthias Ringwald 
499a19cd78SMatthias Ringwald 
509a19cd78SMatthias Ringwald /**
519a19cd78SMatthias Ringwald  * SNS Quantization
529a19cd78SMatthias Ringwald  */
539a19cd78SMatthias Ringwald 
549a19cd78SMatthias Ringwald extern const float lc3_sns_lfcb[32][8];
559a19cd78SMatthias Ringwald extern const float lc3_sns_hfcb[32][8];
569a19cd78SMatthias Ringwald 
579a19cd78SMatthias Ringwald struct lc3_sns_vq_gains {
589a19cd78SMatthias Ringwald     int count; const float *v;
599a19cd78SMatthias Ringwald };
609a19cd78SMatthias Ringwald 
619a19cd78SMatthias Ringwald extern const struct lc3_sns_vq_gains lc3_sns_vq_gains[4];
629a19cd78SMatthias Ringwald 
639a19cd78SMatthias Ringwald extern const int32_t lc3_sns_mpvq_offsets[][11];
649a19cd78SMatthias Ringwald 
659a19cd78SMatthias Ringwald 
669a19cd78SMatthias Ringwald /**
679a19cd78SMatthias Ringwald  * TNS Arithmetic Coding
689a19cd78SMatthias Ringwald  */
699a19cd78SMatthias Ringwald 
709a19cd78SMatthias Ringwald extern const struct lc3_ac_model lc3_tns_order_models[];
719a19cd78SMatthias Ringwald extern const uint16_t lc3_tns_order_bits[][8];
729a19cd78SMatthias Ringwald 
739a19cd78SMatthias Ringwald extern const struct lc3_ac_model lc3_tns_coeffs_models[];
749a19cd78SMatthias Ringwald extern const uint16_t lc3_tns_coeffs_bits[][17];
759a19cd78SMatthias Ringwald 
769a19cd78SMatthias Ringwald 
779a19cd78SMatthias Ringwald /**
789a19cd78SMatthias Ringwald  * Long Term Postfilter
799a19cd78SMatthias Ringwald  */
809a19cd78SMatthias Ringwald 
819a19cd78SMatthias Ringwald extern const float *lc3_ltpf_cnum[LC3_NUM_SRATE][4];
829a19cd78SMatthias Ringwald extern const float *lc3_ltpf_cden[LC3_NUM_SRATE][4];
839a19cd78SMatthias Ringwald 
849a19cd78SMatthias Ringwald 
859a19cd78SMatthias Ringwald /**
869a19cd78SMatthias Ringwald  * Spectral Data Arithmetic Coding
879a19cd78SMatthias Ringwald  */
889a19cd78SMatthias Ringwald 
899a19cd78SMatthias Ringwald extern const uint8_t lc3_spectrum_lookup[2][2][256][4];
909a19cd78SMatthias Ringwald extern const struct lc3_ac_model lc3_spectrum_models[];
919a19cd78SMatthias Ringwald extern const uint16_t lc3_spectrum_bits[][17];
929a19cd78SMatthias Ringwald 
939a19cd78SMatthias Ringwald 
949a19cd78SMatthias Ringwald #endif /* __LC3_TABLES_H */
95