lc3_codec/decoder/side_info.rs
1#[derive(Debug, Clone, Copy, PartialEq, Eq)]
2pub enum Bandwidth {
3 /// 0 - Narrow Band (4khz audio bandwidth)
4 NarrowBand = 0,
5
6 /// 1 - Wide Band (8khz audio bandwidth)
7 WideBand = 1,
8
9 /// 2 - Semi Super Wide Band (12khz audio bandwidth)
10 SemiSuperWideBand = 2,
11
12 /// 3 - Super Wide Band (16khz audio bandwidth)
13 SuperWideBand = 3,
14
15 /// 4 - Full Band (20khz audio bandwidth)
16 FullBand = 4,
17}
18
19#[derive(Debug)]
20pub struct SideInfo {
21 // in the order in which they are decoded
22 pub bandwidth: Bandwidth, // bandwidth cutoff index (P_BW)
23 pub lastnz: usize, // last non-zero tupple
24 pub lsb_mode: bool, // lsb mode bit (least significant bit)
25 pub global_gain_index: usize, // global gain index (gg_ind or gg_idx)
26 pub num_tns_filters: usize, // number of temporal noise shaping (tns) filters
27 pub reflect_coef_order_ari_input: [usize; 2], // Intermediate order of quantized reflection coefficients used as input to the arithmetic decoder (further information is extracted there)
28 pub sns_vq: SnsVq,
29 pub long_term_post_filter_info: LongTermPostFilterInfo,
30 pub noise_factor: usize, // noise level - noise factor (f_nf)
31}
32
33#[derive(Debug, Clone, Copy)]
34pub struct LongTermPostFilterInfo {
35 pub pitch_present: bool, // pitch present flag
36 // only set if pitch_present = true
37 pub is_active: bool, // is long-term post filter active
38 pub pitch_index: usize, // long-term post filter pitch index (lookup for the pitch lag)
39}
40
41impl LongTermPostFilterInfo {
42 pub fn new(is_active: bool, pitch_present: bool, pitch_index: usize) -> Self {
43 Self {
44 is_active,
45 pitch_present,
46 pitch_index,
47 }
48 }
49}
50
51#[derive(Debug)]
52pub struct SnsVq {
53 pub ind_lf: usize,
54 pub ind_hf: usize,
55 pub ls_inda: usize,
56 pub ls_indb: usize,
57 pub idx_a: usize,
58 pub idx_b: usize,
59 pub submode_lsb: u8,
60 pub submode_msb: u8,
61 pub g_ind: usize,
62}