edith_codecs
Clone
https://git.tahinli.com/Tahinli/edith_codecs.git
0 watching·0 forks·Rust·370.3 MiB·9b67700·Tahinli·3 days ago·4021 commits
| 1 | //! ISO/IEC 14496-3 4.6.18.4/4.6.18.8 QMF prototype filter: the normative |
| 2 | //! 640-tap coefficient table, cross-validated from two independent sources |
| 3 | //! (checksum: sum, sum-of-squares, max and its index). |
| 4 | //! |
| 5 | //! NOT wired into `crate::sbr_qmf` -- see that module and the ledger for why |
| 6 | //! this round reverted: every analysis/synthesis carrier-phase and |
| 7 | //! window-derivation hypothesis tried against this table (the literal |
| 8 | //! folded 4.6.18.4/4.6.18.8 reading a review produced, and several |
| 9 | //! offset/omega variants of the prior fitted bank's own convention) failed |
| 10 | //! to round-trip a broadband signal above ~0.70 correlation (the folded |
| 11 | //! reading specifically collapsed to ~0.03-0.05, i.e. not even |
| 12 | //! structurally close), so `sbr_qmf` still runs its own fitted Kaiser bank. |
| 13 | //! This table is kept, checksum-pinned, as a verified input for the next |
| 14 | //! attempt. |
| 15 | |
| 16 | /// The normative 640-tap QMF prototype, index 0..639. Not currently |
| 17 | /// consumed by `sbr_qmf` (see the module doc); kept and checksum-pinned for |
| 18 | /// the next attempt at the normative bank. |
| 19 | #[allow(dead_code)] |
| 20 | pub const QMF_WINDOW: [f64; 640] = [ |
| 21 | 0.0, -0.00055252865047, -0.00056176925738, -0.00049475180896, |
| 22 | -0.00048752279712, -0.00048937912498, -0.00050407143497, -0.00052265642972, |
| 23 | -0.00054665656337, -0.00056778025613, -0.00058709304852, -0.00061327473938, |
| 24 | -0.00063124935319, -0.00065403333621, -0.00067776907764, -0.00069416146273, |
| 25 | -0.00071577364744, -0.00072550431222, -0.00074409418541, -0.00074905980532, |
| 26 | -0.0007681371927, -0.00077248485949, -0.00078343322877, -0.00077798694927, |
| 27 | -0.000780366471, -0.00078014496257, -0.0007757977331, -0.00076307935757, |
| 28 | -0.00075300014201, -0.00073193571525, -0.00072153919876, -0.00069179375372, |
| 29 | -0.00066504150893, -0.00063415949025, -0.0005946118933, -0.00055645763906, |
| 30 | -0.00051455722108, -0.00046063254803, -0.00040951214522, -0.00035011758756, |
| 31 | -0.00028969811748, -0.0002098337344, -0.00014463809349, -6.173344072e-05, |
| 32 | 1.349497418e-05, 0.00010943831274, 0.00020430170688, 0.00029495311041, |
| 33 | 0.0004026540216, 0.00051073884952, 0.00062393761391, 0.00074580258865, |
| 34 | 0.00086084433262, 0.00098859883015, 0.00112501551307, 0.00125778846475, |
| 35 | 0.00139024948272, 0.00154432198471, 0.00168680832531, 0.00183482654224, |
| 36 | 0.00198411407369, 0.00214615835557, 0.00230172547746, 0.00246256169126, |
| 37 | 0.00262017586902, 0.00278704643465, 0.00294694477165, 0.00311254206525, |
| 38 | 0.00327396134847, 0.00344188741828, 0.00360082681231, 0.00376039229104, |
| 39 | 0.00392074323703, 0.00408197531935, 0.0042264269227, 0.00437307196781, |
| 40 | 0.00452098527825, 0.00466064606118, 0.00479325608498, 0.00491376035745, |
| 41 | 0.00503930226013, 0.00514073539032, 0.00524611661324, 0.00534716811982, |
| 42 | 0.00541967759307, 0.00548760401507, 0.00554757145088, 0.00559380230045, |
| 43 | 0.00562206432097, 0.00564551969164, 0.00563891995151, 0.00562661141932, |
| 44 | 0.0055917128663, 0.005540436394, 0.0054753783077, 0.0053838975897, |
| 45 | 0.00527157587272, 0.00513822754514, 0.00498396877629, 0.004810946906, |
| 46 | 0.00460395301471, 0.00438018617447, 0.0041251642327, 0.00384564081246, |
| 47 | 0.00354012465507, 0.00320918858098, 0.00284467578623, 0.00245085400321, |
| 48 | 0.0020274176185, 0.00157846825768, 0.00109023290512, 0.0005832264248, |
| 49 | 2.760451905e-05, -0.00054642808664, -0.00115681355227, -0.00180394725893, |
| 50 | -0.00248267236449, -0.003193377839, -0.00394011240522, -0.004722259624, |
| 51 | -0.00553372111088, -0.00637922932685, -0.00726158168517, -0.00817982333726, |
| 52 | -0.00913253296085, -0.01011502154986, -0.01113155480321, -0.01218499959508, |
| 53 | 0.01327182200351, 0.01439046660792, 0.01554055533423, 0.01673247129989, |
| 54 | 0.01794333813443, 0.01918724313698, 0.02045317933555, 0.02174675502535, |
| 55 | 0.02306801692862, 0.02441609920285, 0.02578758475467, 0.02718594296329, |
| 56 | 0.02860721736385, 0.03005026574279, 0.03150176087389, 0.03297540810337, |
| 57 | 0.03446209487686, 0.03596975605542, 0.03748128504252, 0.03900536794745, |
| 58 | 0.04053491705584, 0.04206490946367, 0.04360975421304, 0.04514884056413, |
| 59 | 0.04668430272642, 0.04821657200672, 0.04973857556014, 0.05125561555216, |
| 60 | 0.05276307465207, 0.05424527683589, 0.05571736482138, 0.05716164501299, |
| 61 | 0.0585915683626, 0.05998374801761, 0.06134551717207, 0.06268578081172, |
| 62 | 0.06397158980681, 0.0652247106438, 0.06643675122104, 0.06760759851228, |
| 63 | 0.06870438283512, 0.06976302447127, 0.07076287107266, 0.07170026731102, |
| 64 | 0.07256825833083, 0.07336202550803, 0.07410036424342, 0.07474525581194, |
| 65 | 0.07531373362019, 0.07580083586584, 0.07619924793396, 0.07649921704119, |
| 66 | 0.07670934904245, 0.07681739756964, 0.07682300113923, 0.07672049241746, |
| 67 | 0.07650507183194, 0.07617483218536, 0.07573057565061, 0.0751576255287, |
| 68 | 0.07446643947564, 0.0736406005762, 0.07267746427299, 0.07158263647903, |
| 69 | 0.07035330735093, 0.06896640131951, 0.06745250215166, 0.06576906686508, |
| 70 | 0.06394448059633, 0.06196027790387, 0.0598166570809, 0.05751526919867, |
| 71 | 0.05504600343009, 0.05240938217366, 0.04959786763445, 0.04663033051701, |
| 72 | 0.04347687821958, 0.04014582784127, 0.03664181168133, 0.03295839306691, |
| 73 | 0.02908240060125, 0.02503075618909, 0.02079970728622, 0.01637012582228, |
| 74 | 0.01176238327857, 0.00696368621617, 0.00197656014503, -0.00320868968304, |
| 75 | -0.00857117491366, -0.01412888273558, -0.01988341292573, -0.02582272888064, |
| 76 | -0.03195312745332, -0.03827765720822, -0.04478068215856, -0.05148041767934, |
| 77 | -0.05837053268336, -0.06544098531359, -0.07269433008129, -0.08013729344279, |
| 78 | -0.08775475365593, -0.09555333528914, -0.10353295311463, -0.1116826931773, |
| 79 | -0.120007798468, -0.12850028503878, -0.13715517611934, -0.1459766491187, |
| 80 | -0.15496070710605, -0.16409588556669, -0.17338081721706, -0.18281725485142, |
| 81 | -0.19239667457267, -0.20212501768103, -0.21197358538056, -0.22196526964149, |
| 82 | -0.23206908706791, -0.24230168845974, -0.25264803095722, -0.26310532994603, |
| 83 | -0.27366340405625, -0.28432141891085, -0.29507167170646, -0.30590985751916, |
| 84 | -0.31682789136456, -0.32781137272105, -0.33887226938665, -0.3499914122931, |
| 85 | 0.36115899031355, 0.37237955463061, 0.38363500139043, 0.39492117615675, |
| 86 | 0.40623176767625, 0.41756968968409, 0.42891199207373, 0.44025537543665, |
| 87 | 0.45159965356824, 0.46293080852757, 0.47424532146115, 0.48552530911099, |
| 88 | 0.49677082545707, 0.50798175000434, 0.51912349702391, 0.53022408956855, |
| 89 | 0.54125534487322, 0.55220512585061, 0.5630789140137, 0.57385241316923, |
| 90 | 0.58454032354679, 0.59511230862496, 0.6055783538918, 0.61591099320291, |
| 91 | 0.62612426956055, 0.63619801077286, 0.64612696959461, 0.65590163024671, |
| 92 | 0.66551398801627, 0.67496631901712, 0.68423532934598, 0.69332823767032, |
| 93 | 0.70223887193539, 0.71094104263095, 0.71944626349561, 0.72774489002994, |
| 94 | 0.73582117582769, 0.74368278636488, 0.75131374561237, 0.75870807608242, |
| 95 | 0.76586748650939, 0.77277808813327, 0.77942875190216, 0.7858353120392, |
| 96 | 0.79197358416424, 0.797846641377, 0.80344857518505, 0.80876950044491, |
| 97 | 0.81381912706217, 0.81857760046468, 0.82304198905409, 0.8272275347336, |
| 98 | 0.8311038457152, 0.83469373618402, 0.83797173378865, 0.84095413924722, |
| 99 | 0.84362382812005, 0.84598184698206, 0.84803157770763, 0.84978051984268, |
| 100 | 0.85119715249343, 0.85230470352147, 0.85310209497017, 0.85357205739107, |
| 101 | 0.85373856005937, 0.85357205739107, 0.85310209497017, 0.85230470352147, |
| 102 | 0.85119715249343, 0.84978051984268, 0.84803157770763, 0.84598184698206, |
| 103 | 0.84362382812005, 0.84095413924722, 0.83797173378865, 0.83469373618402, |
| 104 | 0.8311038457152, 0.8272275347336, 0.82304198905409, 0.81857760046468, |
| 105 | 0.81381912706217, 0.80876950044491, 0.80344857518505, 0.797846641377, |
| 106 | 0.79197358416424, 0.7858353120392, 0.77942875190216, 0.77277808813327, |
| 107 | 0.76586748650939, 0.75870807608242, 0.75131374561237, 0.74368278636488, |
| 108 | 0.73582117582769, 0.72774489002994, 0.71944626349561, 0.71094104263095, |
| 109 | 0.70223887193539, 0.69332823767032, 0.68423532934598, 0.67496631901712, |
| 110 | 0.66551398801627, 0.65590163024671, 0.64612696959461, 0.63619801077286, |
| 111 | 0.62612426956055, 0.61591099320291, 0.6055783538918, 0.59511230862496, |
| 112 | 0.58454032354679, 0.57385241316923, 0.5630789140137, 0.55220512585061, |
| 113 | 0.54125534487322, 0.53022408956855, 0.51912349702391, 0.50798175000434, |
| 114 | 0.49677082545707, 0.48552530911099, 0.47424532146115, 0.46293080852757, |
| 115 | 0.45159965356824, 0.44025537543665, 0.42891199207373, 0.41756968968409, |
| 116 | 0.40623176767625, 0.39492117615675, 0.38363500139043, 0.37237955463061, |
| 117 | -0.36115899031355, -0.3499914122931, -0.33887226938665, -0.32781137272105, |
| 118 | -0.31682789136456, -0.30590985751916, -0.29507167170646, -0.28432141891085, |
| 119 | -0.27366340405625, -0.26310532994603, -0.25264803095722, -0.24230168845974, |
| 120 | -0.23206908706791, -0.22196526964149, -0.21197358538056, -0.20212501768103, |
| 121 | -0.19239667457267, -0.18281725485142, -0.17338081721706, -0.16409588556669, |
| 122 | -0.15496070710605, -0.1459766491187, -0.13715517611934, -0.12850028503878, |
| 123 | -0.120007798468, -0.1116826931773, -0.10353295311463, -0.09555333528914, |
| 124 | -0.08775475365593, -0.08013729344279, -0.07269433008129, -0.06544098531359, |
| 125 | -0.05837053268336, -0.05148041767934, -0.04478068215856, -0.03827765720822, |
| 126 | -0.03195312745332, -0.02582272888064, -0.01988341292573, -0.01412888273558, |
| 127 | -0.00857117491366, -0.00320868968304, 0.00197656014503, 0.00696368621617, |
| 128 | 0.01176238327857, 0.01637012582228, 0.02079970728622, 0.02503075618909, |
| 129 | 0.02908240060125, 0.03295839306691, 0.03664181168133, 0.04014582784127, |
| 130 | 0.04347687821958, 0.04663033051701, 0.04959786763445, 0.05240938217366, |
| 131 | 0.05504600343009, 0.05751526919867, 0.0598166570809, 0.06196027790387, |
| 132 | 0.06394448059633, 0.06576906686508, 0.06745250215166, 0.06896640131951, |
| 133 | 0.07035330735093, 0.07158263647903, 0.07267746427299, 0.0736406005762, |
| 134 | 0.07446643947564, 0.0751576255287, 0.07573057565061, 0.07617483218536, |
| 135 | 0.07650507183194, 0.07672049241746, 0.07682300113923, 0.07681739756964, |
| 136 | 0.07670934904245, 0.07649921704119, 0.07619924793396, 0.07580083586584, |
| 137 | 0.07531373362019, 0.07474525581194, 0.07410036424342, 0.07336202550803, |
| 138 | 0.07256825833083, 0.07170026731102, 0.07076287107266, 0.06976302447127, |
| 139 | 0.06870438283512, 0.06760759851228, 0.06643675122104, 0.0652247106438, |
| 140 | 0.06397158980681, 0.06268578081172, 0.06134551717207, 0.05998374801761, |
| 141 | 0.0585915683626, 0.05716164501299, 0.05571736482138, 0.05424527683589, |
| 142 | 0.05276307465207, 0.05125561555216, 0.04973857556014, 0.04821657200672, |
| 143 | 0.04668430272642, 0.04514884056413, 0.04360975421304, 0.04206490946367, |
| 144 | 0.04053491705584, 0.03900536794745, 0.03748128504252, 0.03596975605542, |
| 145 | 0.03446209487686, 0.03297540810337, 0.03150176087389, 0.03005026574279, |
| 146 | 0.02860721736385, 0.02718594296329, 0.02578758475467, 0.02441609920285, |
| 147 | 0.02306801692862, 0.02174675502535, 0.02045317933555, 0.01918724313698, |
| 148 | 0.01794333813443, 0.01673247129989, 0.01554055533423, 0.01439046660792, |
| 149 | -0.01327182200351, -0.01218499959508, -0.01113155480321, -0.01011502154986, |
| 150 | -0.00913253296085, -0.00817982333726, -0.00726158168517, -0.00637922932685, |
| 151 | -0.00553372111088, -0.004722259624, -0.00394011240522, -0.003193377839, |
| 152 | -0.00248267236449, -0.00180394725893, -0.00115681355227, -0.00054642808664, |
| 153 | 2.760451905e-05, 0.0005832264248, 0.00109023290512, 0.00157846825768, |
| 154 | 0.0020274176185, 0.00245085400321, 0.00284467578623, 0.00320918858098, |
| 155 | 0.00354012465507, 0.00384564081246, 0.0041251642327, 0.00438018617447, |
| 156 | 0.00460395301471, 0.004810946906, 0.00498396877629, 0.00513822754514, |
| 157 | 0.00527157587272, 0.0053838975897, 0.0054753783077, 0.005540436394, |
| 158 | 0.0055917128663, 0.00562661141932, 0.00563891995151, 0.00564551969164, |
| 159 | 0.00562206432097, 0.00559380230045, 0.00554757145088, 0.00548760401507, |
| 160 | 0.00541967759307, 0.00534716811982, 0.00524611661324, 0.00514073539032, |
| 161 | 0.00503930226013, 0.00491376035745, 0.00479325608498, 0.00466064606118, |
| 162 | 0.00452098527825, 0.00437307196781, 0.0042264269227, 0.00408197531935, |
| 163 | 0.00392074323703, 0.00376039229104, 0.00360082681231, 0.00344188741828, |
| 164 | 0.00327396134847, 0.00311254206525, 0.00294694477165, 0.00278704643465, |
| 165 | 0.00262017586902, 0.00246256169126, 0.00230172547746, 0.00214615835557, |
| 166 | 0.00198411407369, 0.00183482654224, 0.00168680832531, 0.00154432198471, |
| 167 | 0.00139024948272, 0.00125778846475, 0.00112501551307, 0.00098859883015, |
| 168 | 0.00086084433262, 0.00074580258865, 0.00062393761391, 0.00051073884952, |
| 169 | 0.0004026540216, 0.00029495311041, 0.00020430170688, 0.00010943831274, |
| 170 | 1.349497418e-05, -6.173344072e-05, -0.00014463809349, -0.0002098337344, |
| 171 | -0.00028969811748, -0.00035011758756, -0.00040951214522, -0.00046063254803, |
| 172 | -0.00051455722108, -0.00055645763906, -0.0005946118933, -0.00063415949025, |
| 173 | -0.00066504150893, -0.00069179375372, -0.00072153919876, -0.00073193571525, |
| 174 | -0.00075300014201, -0.00076307935757, -0.0007757977331, -0.00078014496257, |
| 175 | -0.000780366471, -0.00077798694927, -0.00078343322877, -0.00077248485949, |
| 176 | -0.0007681371927, -0.00074905980532, -0.00074409418541, -0.00072550431222, |
| 177 | -0.00071577364744, -0.00069416146273, -0.00067776907764, -0.00065403333621, |
| 178 | -0.00063124935319, -0.00061327473938, -0.00058709304852, -0.00056778025613, |
| 179 | -0.00054665656337, -0.00052265642972, -0.00050407143497, -0.00048937912498, |
| 180 | -0.00048752279712, -0.00049475180896, -0.00056176925738, -0.00055252865047, |
| 181 | ]; |
| 182 | |
| 183 | #[cfg(test)] |
| 184 | mod tests { |
| 185 | use super::*; |
| 186 | |
| 187 | #[test] |
| 188 | fn checksum_matches_the_cross_validated_source() { |
| 189 | let sum: f64 = QMF_WINDOW.iter().sum(); |
| 190 | let sum_sq: f64 = QMF_WINDOW.iter().map(|v| v * v).sum(); |
| 191 | let mut max = f64::MIN; |
| 192 | let mut argmax = 0usize; |
| 193 | for (i, &v) in QMF_WINDOW.iter().enumerate() { |
| 194 | if v > max { |
| 195 | max = v; |
| 196 | argmax = i; |
| 197 | } |
| 198 | } |
| 199 | assert!((sum - 81.46300943655164).abs() < 1e-9, "sum={sum}"); |
| 200 | assert!((sum_sq - 64.00000000000003).abs() < 1e-9, "sum_sq={sum_sq}"); |
| 201 | assert!((max - 0.85373856005937).abs() < 1e-12, "max={max}"); |
| 202 | assert_eq!(argmax, 320); |
| 203 | } |
| 204 | } |
| 205 |