edith_codecs
Clone
https://git.tahinli.com/Tahinli/edith_codecs.git
0 watching0 forksRust370.3 MiB9b67700Tahinli3 days ago4021 commits
| 1 | //! ETSI-style saturating basic operators (port of the 3GPP TS 26.173 basic_op set). |
| 2 | |
| 3 | |
| 4 | pub const MAX_16: i16 = 32767; |
| 5 | pub const MIN_16: i16 = -32768; |
| 6 | pub const MAX_32: i32 = 0x7fff_ffff; |
| 7 | pub const MIN_32: i32 = i32MIN; |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | /// L_mult: (a*b)<<1 with saturation of the single overflow case. |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | /// L_mac |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | /// L_msu |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | /// round(): extract_h(L + 0x8000) with the C code's special-case for MAX_32. |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | /// plain (non saturating) 16x16 -> 32 multiply-accumulate |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 | |
| 82 | |
| 83 | |
| 84 | |
| 85 | /// (l1 * (l2<<16)) >> 32 ; l2 is a 16-bit value passed as i32 (C passes int32 and shifts it). |
| 86 | |
| 87 | |
| 88 | |
| 89 | |
| 90 | /// shl for 16-bit, negative shift = arithmetic right (count masked & 0xf as in the C code). |
| 91 | |
| 92 | |
| 93 | |
| 94 | |
| 95 | |
| 96 | |
| 97 | |
| 98 | |
| 99 | |
| 100 | |
| 101 | |
| 102 | |
| 103 | |
| 104 | |
| 105 | |
| 106 | |
| 107 | |
| 108 | |
| 109 | |
| 110 | |
| 111 | |
| 112 | |
| 113 | |
| 114 | |
| 115 | |
| 116 | |
| 117 | |
| 118 | |
| 119 | |
| 120 | |
| 121 | |
| 122 | |
| 123 | |
| 124 | |
| 125 | |
| 126 | |
| 127 | |
| 128 | |
| 129 | |
| 130 | |
| 131 | |
| 132 | |
| 133 | |
| 134 | |
| 135 | |
| 136 | /// normalize_amr_wb (C-equivalent, == norm_l for positive input). |
| 137 | |
| 138 | |
| 139 | |
| 140 | |
| 141 | |
| 142 | |
| 143 | |
| 144 | |
| 145 | |
| 146 | |
| 147 | |
| 148 | |
| 149 | |
| 150 | |
| 151 | |
| 152 | |
| 153 | |
| 154 | |
| 155 | |
| 156 | |
| 157 | |
| 158 | |
| 159 | |
| 160 | |
| 161 | |
| 162 | |
| 163 | |
| 164 | |
| 165 | |
| 166 | |
| 167 | |
| 168 | |
| 169 | // ---- codec constants (pvamrwbdecoder_cnst.h) ---- |
| 170 | pub const L_FRAME: usize = 256; |
| 171 | pub const L_SUBFR16K: usize = 80; |
| 172 | pub const L_SUBFR: usize = 64; |
| 173 | pub const NB_SUBFR: usize = 4; |
| 174 | pub const M: usize = 16; |
| 175 | pub const M16K: usize = 20; |
| 176 | pub const L_FILT16K: usize = 15; |
| 177 | pub const L_FILT: usize = 12; |
| 178 | pub const GP_CLIP: i16 = 15565; |
| 179 | pub const PIT_SHARP: i16 = 27853; |
| 180 | pub const PIT_MIN: i16 = 34; |
| 181 | pub const PIT_FR2: i16 = 128; |
| 182 | pub const PIT_FR1_9B: i16 = 160; |
| 183 | pub const PIT_FR1_8B: i16 = 92; |
| 184 | pub const PIT_MAX: i16 = 231; |
| 185 | pub const L_INTERPOL: usize = 17; |
| 186 | pub const PREEMPH_FAC: i16 = 22282; |
| 187 | pub const GAMMA1: i16 = 30147; |
| 188 | pub const TILT_FAC: i16 = 22282; |
| 189 | pub const Q_MAX: i16 = 8; |
| 190 | pub const RANDOM_INITSEED: i16 = 21845; |
| 191 | pub const L_MEANBUF: usize = 3; |
| 192 | pub const ONE_PER_MEANBUF: i16 = 10923; |
| 193 | pub const EHF_MASK: i16 = 0x0008; |
| 194 | pub const AMR_WB_PCM_FRAME: usize = 320; |
| 195 | pub const NBBITS_7K: i16 = 132; |
| 196 | pub const NBBITS_9K: i16 = 177; |
| 197 | pub const NBBITS_12K: i16 = 253; |
| 198 | pub const NBBITS_14K: i16 = 285; |
| 199 | pub const NBBITS_16K: i16 = 317; |
| 200 | pub const NBBITS_18K: i16 = 365; |
| 201 | pub const NBBITS_20K: i16 = 397; |
| 202 | pub const NBBITS_23K: i16 = 461; |
| 203 | pub const NBBITS_24K: i16 = 477; |
| 204 | pub const NBBITS_SID: i16 = 35; |
| 205 | pub const AMR_WB_COMPRESSED: = ; |