edith_codecs
Clone
https://git.tahinli.com/Tahinli/edith_codecs.git
0 watching0 forksRust370.3 MiB237a87fTahinli7 days ago3928 commits
| 1 | #!/usr/bin/env python3 |
| 2 | """Reads the delta every 3.0 dB envelope codeword carries off the reference |
| 3 | decoder's `env_facs_q V is invalid` range check, by ACCUMULATION. |
| 4 | |
| 5 | `sbrtables.py --stage values` applies a codeword once to a raw start value and |
| 6 | reads the delta from the out-of-range complaint. The 3.0 dB books ride a 6-bit |
| 7 | (5-bit balance) raw field but are checked against a 7-bit ceiling, so a single |
| 8 | positive 3.0 dB delta never trips it and every one was emitted as 0 |
| 9 | (ENV30_F/ENV30_T/ENVB30_F/ENVB30_T: 32/32/13/13 zeros). |
| 10 | |
| 11 | The check sees the ACCUMULATED value, and delta-time coding accumulates across |
| 12 | envelopes and frames: a `_T` codeword repeated for enough envelopes walks any |
| 13 | non-zero delta out of range, and a `_F` codeword is walked out by trusted |
| 14 | negative `_T` steps riding after it. The complaint reports the first value out |
| 15 | of range (mod 256); a tiny simulator predicts that value for every candidate |
| 16 | delta and the one candidate that reproduces every probe is the answer. Trusted |
| 17 | negative entries go through the same readout and must come back unchanged. |
| 18 | |
| 19 | Writes the values in place into crates/ec-aac/src/sbr_tables.rs. |
| 20 | |
| 21 | python3 scripts/aac-tables/sbrvalues.py |
| 22 | """ |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | = |
| 29 | |
| 30 | # noqa: E402 |
| 31 | # noqa: E402 |
| 32 | |
| 33 | = |
| 34 | = |
| 35 | = |
| 36 | = 40 |
| 37 | |
| 38 | |
| 39 | |
| 40 | = |
| 41 | = |
| 42 | |
| 43 | = |
| 44 | |
| 45 | |
| 46 | |
| 47 | return |
| 48 | |
| 49 | |
| 50 | |
| 51 | return |
| 52 | |
| 53 | |
| 54 | |
| 55 | = |
| 56 | return |
| 57 | |
| 58 | |
| 59 | |
| 60 | """First out-of-range `scale * value` (mod 256) along `raw + cumsum(steps)`.""" |
| 61 | = |
| 62 | |
| 63 | += |
| 64 | = * |
| 65 | |
| 66 | return % 256 |
| 67 | return None |
| 68 | |
| 69 | |
| 70 | |
| 71 | """env0 F-coded from `raw` (no F slots: one band), env1 T-coded with `word`, |
| 72 | then RUNS frames with both envelopes T-coded with `word`. ch0 of a coupled |
| 73 | pair rides trusted zero words.""" |
| 74 | = |
| 75 | = |
| 76 | = |
| 77 | = |
| 78 | = |
| 79 | = |
| 80 | += * |
| 81 | return b, + * # steps = word each |
| 82 | |
| 83 | |
| 84 | |
| 85 | """env0 F-coded from `raw` with `word` in band 1, env1 T-coded with band 0 |
| 86 | zero and band 1 `step`, then RUNS frames of the same T pair.""" |
| 87 | = |
| 88 | = |
| 89 | = |
| 90 | , = , |
| 91 | = |
| 92 | = |
| 93 | = |
| 94 | = |
| 95 | = |
| 96 | += * 6 |
| 97 | return b, + * 13 |
| 98 | |
| 99 | |
| 100 | |
| 101 | = |
| 102 | = |
| 103 | = 2 |
| 104 | = 12 |
| 105 | = |
| 106 | , = |
| 107 | = 31 |
| 108 | = |
| 109 | |
| 110 | = |
| 111 | = # (steps template, raw, observed) |
| 112 | = |
| 113 | # Probe until exactly one candidate reproduces every observation. |
| 114 | |
| 115 | = |
| 116 | |
| 117 | = |
| 118 | = |
| 119 | = + |
| 120 | |
| 121 | |
| 122 | , = |
| 123 | |
| 124 | , = |
| 125 | = |
| 126 | = |
| 127 | = |
| 128 | |
| 129 | |
| 130 | |
| 131 | |
| 132 | break |
| 133 | |
| 134 | |
| 135 | continue |
| 136 | = |
| 137 | = |
| 138 | = |
| 139 | |
| 140 | = |
| 141 | = |
| 142 | = == and == |
| 143 | |
| 144 | return , |
| 145 | |
| 146 | |
| 147 | |
| 148 | = |
| 149 | global , |
| 150 | , = , |
| 151 | = |
| 152 | = |
| 153 | |
| 154 | |
| 155 | , = |
| 156 | |
| 157 | = |
| 158 | = # later books ride on these |
| 159 | |
| 160 | = |
| 161 | |
| 162 | |
| 163 | = |
| 164 | |
| 165 | |
| 166 | , = , |
| 167 | |
| 168 | return |
| 169 | = |
| 170 | |
| 171 | |
| 172 | |
| 173 | |
| 174 | return |
| 175 | |
| 176 | = |
| 177 | |
| 178 | |
| 179 | |
| 180 | |
| 181 | |
| 182 |