edith_codecs
Clone
https://git.tahinli.com/Tahinli/edith_codecs.git
0 watching0 forksRust370.3 MiBbf299cdTahinli2 months ago2294 commits
| 1 | #!/usr/bin/env python3 |
| 2 | """Codebook 11 (escape) and the scalefactor codebook. |
| 3 | |
| 4 | cb11: an all-ones filler makes the escape's unary length run away, so the |
| 5 | filler is `1^6 0` repeated -- bounded escapes -- and probes that land their |
| 6 | END element on one of those zeros are retried at another phase. |
| 7 | |
| 8 | sfb: the probe sits in the scale_factor_data field of a one-band frame whose |
| 9 | spectral field is the all-ones filler; the band's scalefactor is read back from |
| 10 | the dequantised magnitudes (|X| = x^(4/3) * 2^((sf-100)/4), x integral). |
| 11 | """ |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | = |
| 24 | |
| 25 | |
| 26 | |
| 27 | = |
| 28 | = |
| 29 | |
| 30 | |
| 31 | break |
| 32 | = |
| 33 | |
| 34 | = |
| 35 | = |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | = |
| 41 | = |
| 42 | |
| 43 | = None |
| 44 | |
| 45 | |
| 46 | |
| 47 | = |
| 48 | = |
| 49 | = |
| 50 | = 0 |
| 51 | |
| 52 | |
| 53 | = |
| 54 | |
| 55 | , = , |
| 56 | |
| 57 | |
| 58 | continue |
| 59 | |
| 60 | = |
| 61 | |
| 62 | += |
| 63 | = |
| 64 | += 1 |
| 65 | |
| 66 | |
| 67 | return |
| 68 | |
| 69 | |
| 70 | # --- scalefactor codebook --------------------------------------------------- |
| 71 | |
| 72 | |
| 73 | |
| 74 | """Scalefactor of the second coded band, one frame per probe.""" |
| 75 | = |
| 76 | = |
| 77 | |
| 78 | |
| 79 | |
| 80 | continue |
| 81 | = |
| 82 | |
| 83 | |
| 84 | continue |
| 85 | # |X| = x^(4/3) * 2^((sf-100)/4) with x in {1, 2} (codebook 3, lav 2); |
| 86 | # only one of the two makes sf integral. |
| 87 | = None |
| 88 | |
| 89 | = 100 + 4 * |
| 90 | |
| 91 | = |
| 92 | |
| 93 | return |
| 94 | |
| 95 | |
| 96 | |
| 97 | = |
| 98 | |
| 99 | |
| 100 | = |
| 101 | |
| 102 | = |
| 103 | |
| 104 | = |
| 105 | |
| 106 | = |
| 107 | = |
| 108 | = 0 |
| 109 | |
| 110 | |
| 111 | = |
| 112 | |
| 113 | , = , |
| 114 | |
| 115 | = |
| 116 | |
| 117 | += |
| 118 | = |
| 119 | += 1 |
| 120 | |
| 121 | |
| 122 | return |
| 123 | |
| 124 | |
| 125 | |
| 126 | |
| 127 | = |
| 128 | |
| 129 | |
| 130 | |
| 131 | |
| 132 | |
| 133 | = |
| 134 | |
| 135 | |
| 136 | |
| 137 |