edith
Clone
https://git.tahinli.com/Tahinli/edith.git
0 watching0 forksRust18.3 MiBff99ad6Tahinli6 days ago1055 commits
| 1 | //! Vorbis decode, in Ogg and in Matroska, comes out the way ffmpeg's own decode |
| 2 | //! of the same file does, at the same length to the sample. Edith decodes Vorbis |
| 3 | //! with `ec-vorbis`, and the audio path cuts each stream to its own end: the page |
| 4 | //! granules in Ogg, the last block's `DiscardPadding` in Matroska. |
| 5 | //! |
| 6 | //! The reference is generated here: ffmpeg encodes a stereo tone pair with |
| 7 | //! libvorbis, the file is decoded through [`AudioSession`] (the call site a |
| 8 | //! project's audio takes), and ffmpeg decodes it again to 32-bit float. The two |
| 9 | //! are compared channel by channel. A Matroska copy of the same stream is held to |
| 10 | //! the same reference, because the container is the only thing that differs. |
| 11 | //! |
| 12 | //! A seek into the file is held to the full run's own samples (see |
| 13 | //! [`a_seek_into_ogg_vorbis_is_the_full_runs_samples`]). |
| 14 | //! |
| 15 | //! Skipped loudly, the way the rest of the suite skips its reference decodes, |
| 16 | //! when ffmpeg is not on the box. |
| 17 | |
| 18 | use Path; |
| 19 | use Command; |
| 20 | |
| 21 | use AudioSession; |
| 22 | use Scratch; |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | /// The interleaved samples of `path`'s first audio track, and its channel count. |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | /// `path` decoded from `start_secs` on, interleaved, and its channel count. |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | /// ffmpeg's decode of the same file, as interleaved 32-bit float at `channels`. |
| 70 | |
| 71 | |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 | |
| 82 | |
| 83 | |
| 84 | |
| 85 | |
| 86 | |
| 87 | |
| 88 | |
| 89 | |
| 90 | |
| 91 | |
| 92 | |
| 93 | |
| 94 | |
| 95 | |
| 96 | |
| 97 | |
| 98 | |
| 99 | |
| 100 | |
| 101 | /// Normalised correlation over the common length: 1.0 for the same waveform at |
| 102 | /// the same offset. |
| 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 | |
| 137 | |
| 138 | |
| 139 | |
| 140 | |
| 141 | |
| 142 | |
| 143 | |
| 144 | |
| 145 | |
| 146 | |
| 147 | /// A two-second tone, libvorbis at a middling quality: 440 Hz in the left channel |
| 148 | /// and 880 Hz in the right when there are two. |
| 149 | |
| 150 | |
| 151 | |
| 152 | |
| 153 | |
| 154 | |
| 155 | |
| 156 | |
| 157 | |
| 158 | |
| 159 | |
| 160 | |
| 161 | |
| 162 | |
| 163 | |
| 164 | |
| 165 | |
| 166 | |
| 167 | |
| 168 | |
| 169 | |
| 170 | |
| 171 | |
| 172 | |
| 173 | |
| 174 | |
| 175 | |
| 176 | |
| 177 | |
| 178 | |
| 179 | |
| 180 | |
| 181 | |
| 182 | |
| 183 | |
| 184 | |
| 185 | |
| 186 | |
| 187 | |
| 188 | |
| 189 | |
| 190 | |
| 191 | |
| 192 | |
| 193 | |
| 194 | |
| 195 | |
| 196 | |
| 197 | |
| 198 | |
| 199 | |
| 200 | |
| 201 | |
| 202 | |
| 203 | |
| 204 | |
| 205 | |
| 206 | |
| 207 | |
| 208 | |
| 209 | |
| 210 | |
| 211 | |
| 212 | |
| 213 | |
| 214 | |
| 215 | /// A seek into an Ogg Vorbis file lands on the full run's own samples: the |
| 216 | /// tail from `start` is the same frames, bit for bit, at the same timeline |
| 217 | /// position. Exact, not a tolerance: the reader lands on the packet at or before |
| 218 | /// the target, and the decoder's warm-up is dropped (`ec-vorbis` answers nothing |
| 219 | /// for a fresh decoder's first block, and that block's position is not taken). |
| 220 | |
| 221 | |
| 222 | |
| 223 | |
| 224 | |
| 225 | |
| 226 | |
| 227 | |
| 228 | |
| 229 | |
| 230 | |
| 231 | /// The same seek on Matroska: its blocks are stamped in whole milliseconds, which |
| 232 | /// is not where the samples are, so the reader has to place each packet by the |
| 233 | /// samples before it rather than by its stamp. |
| 234 | |
| 235 | |
| 236 | |
| 237 | |
| 238 | |
| 239 | |
| 240 | |
| 241 | |
| 242 | |
| 243 | |
| 244 | |
| 245 | /// A Matroska file long enough for several clusters: the targets fall in and |
| 246 | /// across them, where the container's own seek used to land a cluster past the |
| 247 | /// target. |
| 248 | |
| 249 | |
| 250 | |
| 251 | |
| 252 | |
| 253 | |
| 254 | |
| 255 | |
| 256 | |
| 257 | |
| 258 | |
| 259 | /// Six seeks across `file`, each held to the full run's own tail from the same |
| 260 | /// timeline position. |
| 261 | |
| 262 | |
| 263 | |
| 264 | |
| 265 | |
| 266 | |
| 267 | |
| 268 | |
| 269 | |
| 270 | |
| 271 | |
| 272 | |
| 273 | |
| 274 | |
| 275 | |
| 276 | |
| 277 | |
| 278 | |
| 279 | |
| 280 | |
| 281 | |
| 282 | |
| 283 | |
| 284 | |
| 285 | |
| 286 | |
| 287 | |
| 288 | |
| 289 | |
| 290 |