edith_codecs
Clone
https://git.tahinli.com/Tahinli/edith_codecs.git
0 watching0 forksRust370.3 MiB9b67700Tahinli3 days ago4021 commits
| 1 | //! Shared fixtures for the integration tests. |
| 2 | //! |
| 3 | //! Each test binary compiles this module and uses part of it. |
| 4 | |
| 5 | |
| 6 | use ; |
| 7 | use DecodedPicture; |
| 8 | use ConformanceWindow; |
| 9 | use ; |
| 10 | |
| 11 | /// A synthetic picture with gradients, edges and texture — enough structure |
| 12 | /// that every intra direction gets used somewhere. |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | /// A picture with the statistics of camera video rather than of a noise |
| 48 | /// generator: smooth gradients, a few hard edges, and detail that decays with |
| 49 | /// distance from them. |
| 50 | /// |
| 51 | /// The speed bar this family carries was measured on real 1080p footage, so the |
| 52 | /// fixture the bar is asserted against has to look like footage. The textured |
| 53 | /// [`test_frame`] above is the opposite fixture — worst case for the residual |
| 54 | /// coder — and both numbers are worth printing. |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 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 | /// Write `bytes` to `path` and PROVE the file on disk is exactly that long. |
| 99 | /// |
| 100 | /// lane-h26xpinloud: the encode gate's sites used `std::fs::write(..).ok()?` |
| 101 | /// and [`write_au`] used `File::create` + `write_all(..).expect(..)`, then all |
| 102 | /// three handed `path` to ffmpeg. Checking the `Result` closes only the ERROR |
| 103 | /// path. An Ok-but-short write -- a filesystem that reports success and stores |
| 104 | /// fewer bytes (ENOSPC on a full mount, EFBIG under a size cap, a quota, a |
| 105 | /// failed final flush) -- left ffmpeg decoding a truncated stream, and the |
| 106 | /// failure surfaced as a plausible-looking wrong pixel or a shifted PSNR |
| 107 | /// number, not as a write failure. MEASURED: 1234 bytes written through a path |
| 108 | /// that LOOKS like a stream file in a scratch directory but whose filesystem |
| 109 | /// accepts every byte and stores none returns `Ok`, and the file on disk is 0 |
| 110 | /// bytes. So the length is checked here once, from the same `bytes.len()` the |
| 111 | /// writer used, and any shortfall carries the path, both counts, and the OS |
| 112 | /// error -- or, for the write that reported success and left a short file, the |
| 113 | /// plain statement that there was no OS error, which is exactly the case that |
| 114 | /// used to print nothing. |
| 115 | /// |
| 116 | /// This is the ec-av1 `dumpio::LoudDump` idea replicated per crate: there is no |
| 117 | /// shared test-support crate here and none is being added for one function. |
| 118 | /// Returns the failure LINE rather than a bare bool, so the bail callers and the |
| 119 | /// panic caller all end on one format that cannot drift apart. The success path |
| 120 | /// is byte-identical to the old write: same bytes, same path, truncate then |
| 121 | /// write. |
| 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 | |
| 151 | |
| 152 | |
| 153 | |
| 154 | |
| 155 | |
| 156 | |
| 157 | |
| 158 | |
| 159 | /// The one failure line every short pin ends on: site, path, the bytes the file |
| 160 | /// holds vs the bytes owed, and the reason. |
| 161 | |
| 162 | |
| 163 | |
| 164 | |
| 165 | |
| 166 | |
| 167 | |
| 168 | |
| 169 | |
| 170 | |
| 171 | |
| 172 | |
| 173 | |
| 174 | |
| 175 | /// A pin whose shortfall is reported and then BAILED on, for a caller that |
| 176 | /// returns `None` today. Prints the same line [`pin_loud`] returns, so `None` |
| 177 | /// from here never reads as a plain "ffmpeg said no". |
| 178 | |
| 179 | |
| 180 | |
| 181 | |
| 182 | |
| 183 | |
| 184 | /// [`pin_loud`] with the shortfall PANICKING, for a caller that fails loudly |
| 185 | /// today. The panic message IS the failure line, so the two callers of this |
| 186 | /// shape cannot drift apart either. |
| 187 | |
| 188 | |
| 189 | |
| 190 | |
| 191 | |
| 192 | |
| 193 | pub const PLANE_NAMES: = ; |
| 194 | |
| 195 | /// Bytes per sample of component `c`: 1 for 8-bit, 2 (little endian) above 8 bits. |
| 196 | |
| 197 | |
| 198 | |
| 199 | |
| 200 | /// The samples of a picture cropped to its conformance window, as the bytes a YUV |
| 201 | /// file of that frame holds (planar, 8-bit or little-endian 16-bit). |
| 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 | |
| 255 | |
| 256 | |
| 257 | |
| 258 | |
| 259 | /// A description of one mismatched plane: its location when the reference is known. |
| 260 | |
| 261 | |
| 262 | |
| 263 | |
| 264 | |
| 265 | |
| 266 | |
| 267 | |
| 268 | |
| 269 | |
| 270 | |
| 271 | |
| 272 | |
| 273 | |
| 274 | |
| 275 | |
| 276 | |
| 277 | |
| 278 | /// The first sample (x, y) of `plane` that differs from the reference YUV, where |
| 279 | /// frame `out_index` in output order starts at byte `out_index * frame_bytes`. |
| 280 | |
| 281 | |
| 282 | |
| 283 | |
| 284 | |
| 285 | |
| 286 | |
| 287 | |
| 288 | |
| 289 | |
| 290 | |
| 291 | |
| 292 | |
| 293 | |
| 294 | |
| 295 | |
| 296 | |
| 297 | |
| 298 | |
| 299 | |
| 300 | |
| 301 | |
| 302 | |
| 303 | |
| 304 | |
| 305 | |
| 306 | |
| 307 | |
| 308 | |
| 309 | |
| 310 | |
| 311 | |
| 312 | |
| 313 | |
| 314 | |
| 315 | |
| 316 | |
| 317 | |
| 318 | |
| 319 | |
| 320 | |
| 321 | /// The 32-bit checksum of one plane of `width` samples a row (D.3.19, hash_type 2). |
| 322 | |
| 323 | |
| 324 | |
| 325 | |
| 326 | |
| 327 | |
| 328 | |
| 329 | |
| 330 | |
| 331 | |
| 332 | |
| 333 | |
| 334 | |
| 335 | /// The 16-bit CRC of one plane (D.3.19, hash_type 1): the samples as bytes, low |
| 336 | /// byte first above 8 bits, then 16 zero bits. |
| 337 | |
| 338 | |
| 339 | |
| 340 | |
| 341 | |
| 342 | |
| 343 | |
| 344 | |
| 345 | |
| 346 | |
| 347 | |
| 348 | |
| 349 | |
| 350 | |
| 351 | |
| 352 | |
| 353 | |
| 354 | |
| 355 | |
| 356 | |
| 357 | |
| 358 | |
| 359 | /// The MD5 digest of each plane, as the SEI hash defines it. `None` when the |
| 360 | /// sample arrays do not match the picture size. |
| 361 | |
| 362 | |
| 363 | |
| 364 | |
| 365 | |
| 366 | |
| 367 | |
| 368 | |
| 369 | |
| 370 | |
| 371 | |
| 372 | |
| 373 | |
| 374 | |
| 375 | |
| 376 | |
| 377 | |
| 378 | |
| 379 | |
| 380 | |
| 381 | |
| 382 | |
| 383 | |
| 384 | |
| 385 | |
| 386 | |
| 387 | |
| 388 | |
| 389 | |
| 390 | |
| 391 | |
| 392 | |
| 393 | |
| 394 | |
| 395 | |
| 396 | |
| 397 | |
| 398 | |
| 399 | |
| 400 | |
| 401 | |
| 402 | /// Plane sizes as (width, height) for Y, Cb and Cr, at the picture's chroma format. |
| 403 | |
| 404 | |
| 405 | |
| 406 | |
| 407 | |
| 408 | /// Per plane, whether the picture matches the SEI hash of the same kind. An MD5 |
| 409 | /// digest is compared with the whole digest; a CRC or checksum with its value. |
| 410 | |
| 411 | |
| 412 | |
| 413 | |
| 414 | |
| 415 | |
| 416 | |
| 417 | |
| 418 | |
| 419 | |
| 420 | |
| 421 | |
| 422 | |
| 423 | |
| 424 | |
| 425 | |
| 426 | |
| 427 | |
| 428 | |
| 429 | |
| 430 | |
| 431 | |
| 432 | |
| 433 | |
| 434 | |
| 435 | |
| 436 | |
| 437 | |
| 438 | |
| 439 | |
| 440 | |
| 441 | |
| 442 | /// The digest in a `<name>_md5.txt` file: its first word, as 32 hex digits. That file holds the |
| 443 | /// MD5 of the whole decoded output (every frame, cropped, in output order). |
| 444 | |
| 445 | |
| 446 | |
| 447 | |
| 448 | |
| 449 | |
| 450 | |
| 451 | |
| 452 | |
| 453 | |
| 454 | |
| 455 | |
| 456 | |
| 457 | |
| 458 | |
| 459 | |
| 460 | |
| 461 | |
| 462 | |
| 463 |