edith
Clone
https://git.tahinli.com/Tahinli/edith.git
0 watching0 forksRust18.3 MiB978e685Tahinli3 months ago627 commits
| 1 | //! Hardware path checks. These need a built `libengine_hw.so` plus a working |
| 2 | //! VA-API driver, so they are `#[ignore]`d by default. Run them with: |
| 3 | //! |
| 4 | //! ```text |
| 5 | //! cargo build --workspace --release |
| 6 | //! LD_LIBRARY_PATH=target/release \ |
| 7 | //! cargo test -p engine --release --test hw_decode -- --ignored --nocapture --test-threads=1 |
| 8 | //! ``` |
| 9 | //! |
| 10 | //! The comparison test pins [`DecodeSession`] to the software decoder itself |
| 11 | //! (it sets `VE_SW=1` in-process, hence the required `--test-threads=1`); the |
| 12 | //! hardware side goes through [`HwSession`] directly and can never silently be |
| 13 | //! a fallback. |
| 14 | |
| 15 | use ; |
| 16 | use Instant; |
| 17 | |
| 18 | use DecodeSession; |
| 19 | use ; |
| 20 | use i420_to_bgra; |
| 21 | use ; |
| 22 | use Scratch; |
| 23 | use HwSession; |
| 24 | use ; |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | /// What the decode funnel converts this file's planes in, so a conversion done |
| 33 | /// by hand here is the one `DecodeSession` would have done. |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | /// Decodes the whole file through the plugin, returning (frame count, frame 30 as BGRA). |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | |
| 72 | /// The plugin must refuse junk by returning null, never by unwinding into us. |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 | |
| 82 | |
| 83 | /// 24 frames cut from a 2160p HDR remux that used to give a black picture and |
| 84 | /// an instant `eof`: at 3840x2160 with CTB 64 the picture is 34 CTB rows, so |
| 85 | /// wavefront slices carry `num_entry_point_offsets == 33` (§7.4.7.1 allows up |
| 86 | /// to PicHeightInCtbsY - 1) and the vendored parser indexed a `[u32; 32]` with |
| 87 | /// 32. Conformant stream, panicking parser -- caught at the plugin edge, which |
| 88 | /// is exactly why it reached the user as a silent eof. |
| 89 | |
| 90 | |
| 91 | |
| 92 | |
| 93 | |
| 94 | |
| 95 | |
| 96 | |
| 97 | |
| 98 | |
| 99 | |
| 100 | |
| 101 | |
| 102 | /// ...and the same file with its slice bytes scrambled -- a stream the plugin |
| 103 | /// opens and then cannot decode a picture out of -- is refused at the door, in |
| 104 | /// words that do not send the user installing a plugin they already have. The |
| 105 | /// case this whole bug arrived as: never a black picture and a silent `eof`. |
| 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 | |
| 148 | |
| 149 | |
| 150 | /// Seeking may only change *when* a picture arrives, never the picture: both |
| 151 | /// backends must land on bytes identical to a linear decode of the same index. |
| 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 | /// The same promise as [`seek_matches_linear`], made of every container and |
| 189 | /// codec pair there is a fixture for and at targets on, either side of and away |
| 190 | /// from a keyframe -- because which of them holds is a property of the *stream's |
| 191 | /// structure*, not of the seek code alone. |
| 192 | /// |
| 193 | /// An open-GOP HEVC stream (x265's default, so `test_hevc.mkv` and its 10-bit |
| 194 | /// twin, and every film off a disc or a web rip) stores the CRA that opens a GOP |
| 195 | /// *ahead of* the RASL leading pictures that are shown *before* it: keyframe 30 |
| 196 | /// on screen is the 28th block in the file. A seek that counts stored positions |
| 197 | /// rather than displayed pictures therefore hands back a picture two frames |
| 198 | /// later than the index it labels, and by a different amount in a GOP with |
| 199 | /// another number of leading pictures. `test_baseline.mp4` alone never showed |
| 200 | /// it: it has exactly one keyframe, at frame 0, where the two orders agree. |
| 201 | |
| 202 | |
| 203 | |
| 204 | |
| 205 | |
| 206 | |
| 207 | |
| 208 | |
| 209 | |
| 210 | |
| 211 | |
| 212 | |
| 213 | |
| 214 | |
| 215 | |
| 216 | |
| 217 | |
| 218 | |
| 219 | |
| 220 | |
| 221 | |
| 222 | |
| 223 | |
| 224 | |
| 225 | |
| 226 | |
| 227 | |
| 228 | |
| 229 | |
| 230 | |
| 231 | |
| 232 | |
| 233 | |
| 234 | |
| 235 | |
| 236 | |
| 237 | |
| 238 | |
| 239 | |
| 240 | |
| 241 | |
| 242 | |
| 243 | |
| 244 | |
| 245 | |
| 246 | |
| 247 | |
| 248 | |
| 249 | |
| 250 | |
| 251 | |
| 252 | |
| 253 | |
| 254 | /// Drains a bounded session, returning the indices it delivered. The loop ends |
| 255 | /// only on `RecvError`, i.e. the worker closed the channel by itself. |
| 256 | |
| 257 | |
| 258 | |
| 259 | |
| 260 | |
| 261 | |
| 262 | |
| 263 | |
| 264 | |
| 265 | /// A bounded range must stop on its own — both backends — with `Frame::index` |
| 266 | /// still the absolute source index, and then disconnect rather than hang. |
| 267 | |
| 268 | |
| 269 | |
| 270 | |
| 271 | |
| 272 | |
| 273 | |
| 274 | |
| 275 | |
| 276 | |
| 277 | |
| 278 | |
| 279 | |
| 280 | |
| 281 | |
| 282 | |
| 283 | |
| 284 | |
| 285 | |
| 286 | |
| 287 | |
| 288 | |
| 289 | |
| 290 | /// The real thing: a 4K HDR10 film through the funnel, against the picture the |
| 291 | /// same planes gave before the tone map was in it (BT.2020 matrix, HDR codes |
| 292 | /// shown as if they were SDR -- flat and grey-washed, which is the complaint |
| 293 | /// this whole path answers). Colour has to come *up*, not down, and the picture |
| 294 | /// has to land somewhere a display can show rather than at either rail. |
| 295 | /// |
| 296 | /// Gated on the film being here: it is a 20 GB download, not a fixture. HEVC |
| 297 | /// Main 10, so this is a hardware-only test in every sense. |
| 298 | |
| 299 | |
| 300 | |
| 301 | |
| 302 | |
| 303 | |
| 304 | |
| 305 | |
| 306 | |
| 307 | |
| 308 | |
| 309 | |
| 310 | |
| 311 | |
| 312 | |
| 313 | |
| 314 | |
| 315 | |
| 316 | |
| 317 | |
| 318 | |
| 319 | |
| 320 | |
| 321 | |
| 322 | |
| 323 | |
| 324 | |
| 325 | |
| 326 | |
| 327 | |
| 328 | |
| 329 | |
| 330 | |
| 331 | |
| 332 | |
| 333 | |
| 334 | |
| 335 | |
| 336 | |
| 337 | |
| 338 | |
| 339 | |
| 340 | |
| 341 | |
| 342 | |
| 343 | |
| 344 | |
| 345 | |
| 346 | |
| 347 | |
| 348 | |
| 349 | |
| 350 | |
| 351 | |
| 352 | |
| 353 | |
| 354 | |
| 355 | |
| 356 | |
| 357 | |
| 358 | |
| 359 | |
| 360 | |
| 361 | |
| 362 | |
| 363 | |
| 364 | |
| 365 | |
| 366 | |
| 367 | |
| 368 | |
| 369 | |
| 370 | |
| 371 | |
| 372 | |
| 373 | |
| 374 | |
| 375 | |
| 376 | |
| 377 | |
| 378 | |
| 379 | |
| 380 | |
| 381 | |
| 382 | /// H.264 8-bit decode is bit-exact by conformance, so the two backends must |
| 383 | /// agree. A mismatch means a driver deviation and is reported, not swallowed. |
| 384 | |
| 385 | |
| 386 | |
| 387 | |
| 388 | |
| 389 | |
| 390 | |
| 391 | |
| 392 | |
| 393 | |
| 394 | |
| 395 | |
| 396 | |
| 397 | |
| 398 | |
| 399 | |
| 400 | |
| 401 | |
| 402 | |
| 403 | |
| 404 | |
| 405 | |
| 406 | |
| 407 |