edith_codecs
Clone
https://git.tahinli.com/Tahinli/edith_codecs.git
0 watching0 forksRust370.3 MiB9b67700Tahinli3 days ago4021 commits
| 1 | use *; |
| 2 | |
| 3 | /// Every (site, frame type, block side) the census can be called with |
| 4 | /// lands in its own ten-counter bucket, inside the array (class |
| 5 | /// `enumerate-table-domain`: an off-by-one here would silently add two |
| 6 | /// sites' trials together). |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | /// An [`crate::mvstack::MvStack`] with every context at zero and no |
| 26 | /// neighbours, for the pricer tests below to fill the one band each of |
| 27 | /// them is about. |
| 28 | /// lane-b128 task 0: every `ref_mv_idx` the `NEWMV`/`NEARMV` pricer |
| 29 | /// offers must be one [`crate::tile::write_drl_idx`] can really SIGNAL |
| 30 | /// against the same stack -- an offer the writer clamps prices the |
| 31 | /// residual against a predictor the decoder never derives, which is the |
| 32 | /// silent MV drift lane-sb128b root-caused (there fixed on the WRITER |
| 33 | /// side, so the stream stays legal; here the pricer's own offer set is |
| 34 | /// enumerated, class `enumerate-table-domain`). |
| 35 | /// |
| 36 | /// **This is the coverage claim for the drl-clamp cell** (lane-av1recipehunt |
| 37 | /// r2, 2026-09-29). It replaces the clip gate |
| 38 | /// `a_128_superblock_clip_whose_drl_index_the_write_time_stack_cannot_carry_decodes_exact`, |
| 39 | /// deleted in `3e8c65e6`+r2: that gate asserted `drl_clamp_hits() > 0` on a |
| 40 | /// real 1280x768 sb128 clip, but `DRL_CLAMP_HITS` is provably unreachable |
| 41 | /// while the invariant above holds, so no recipe could ever satisfy it. |
| 42 | /// Deletion loses no coverage on either half: |
| 43 | /// * the clamp half -- this test IS the coverage, and it is strictly |
| 44 | /// stronger than any clip gate: it enumerates the pricer's whole offer |
| 45 | /// set against the writer's rule for every stack size 0..=4, and larger |
| 46 | /// stacks add entries the pricers never offer (`best_new_mv_syntax` |
| 47 | /// breaks at `entries.len() <= idx` for `idx > 0`, so indices 3/4 are |
| 48 | /// unreachable at ANY stack size), which is why 0..=4 bounds the |
| 49 | /// domain rather than sampling it; |
| 50 | /// * the pixel half -- the deleted gate's own decode-vs-encoder- |
| 51 | /// reconstruction compare on a 1280x768 sb128 sequence is already made |
| 52 | /// four times over, by `a_128_superblock_clip_whose_root_search_codes_ |
| 53 | /// 128x128_blocks_decodes_exact`, |
| 54 | /// `a_128_root_block_with_a_real_residual_decodes_exact_through_both_decoders`, |
| 55 | /// `a_128_root_residual_block_under_a_per_unit_cdef_list_decodes_exact` |
| 56 | /// and `a_rect128_half_with_a_real_residual_decodes_exact_through_both_decoders` |
| 57 | /// (same geometry, same `force_sb128(true)`, same own-reconstruction AND |
| 58 | /// ffmpeg compare). |
| 59 | /// |
| 60 | /// MEASURED before deleting (153 clip x size x frame-count x q combinations, |
| 61 | /// `enc_probe`): `tile::drl_clamp_hits()` = 0 on every one. MUTATION PROOF |
| 62 | /// the clip was never the variable: widening `best_new_mv_syntax`'s offer |
| 63 | /// set to `0..5` fires the counter immediately (9/2/2/1 on |
| 64 | /// mandelbrot 640x384x8, mandelbrot 320x192x8, mosaic 320x192x8, |
| 65 | /// testsrc2 640x384x8) and the same clips read 0 on revert. `note_drl_clamp` |
| 66 | /// and `DRL_CLAMP_HITS` are KEPT as the tripwire for the owning fix |
| 67 | /// (`deferred(unblock: the DRL owner widens the pricer past the writer's |
| 68 | /// `start + 2` ceiling, or retires the counter)`) -- this test will go red |
| 69 | /// the moment either happens, which is the signal to re-open the cell. |
| 70 | /// |
| 71 | /// cargo test -p ec-av1 --lib -- every_drl_index_the_new_mv_pricer |
| 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 | |
| 102 | |
| 103 | |
| 104 | |
| 105 | |
| 106 | |
| 107 | |
| 108 | |
| 109 | |
| 110 | |
| 111 | |
| 112 | |
| 113 | |
| 114 | pub |
| 115 | |
| 116 | |
| 117 | |
| 118 | |
| 119 | |
| 120 | |
| 121 | |
| 122 | |
| 123 | |
| 124 | |
| 125 | |
| 126 | |
| 127 | |
| 128 | |
| 129 | |
| 130 | |
| 131 | |
| 132 | |
| 133 | /// [`super::compound_ref_bits`] pays exactly the symbols tile.rs' |
| 134 | /// `write_compound_ref_frames` codes for a pair, each at that symbol's |
| 135 | /// own neighbour-derived context. Red before lane-ctx, where the pricer |
| 136 | /// spent four constants at CDF row 0 that assumed the pair was |
| 137 | /// LAST+GOLDEN or LAST+ALTREF -- so a LAST+BWDREF pair was priced as |
| 138 | /// LAST+ALTREF with its `comp_bwdref` p6 symbol missing entirely. |
| 139 | |
| 140 | |
| 141 | |
| 142 | |
| 143 | |
| 144 | |
| 145 | |
| 146 | |
| 147 | |
| 148 | |
| 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 | |
| 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 | /// The `skip` and `is_inter` symbols are priced at the SAME context |
| 258 | /// tile.rs codes them with -- `above_skip + left_skip` for the first and |
| 259 | /// `intra_inter_ctx` for the second -- not at row 0. Red before lane-ctx |
| 260 | /// on every neighbour configuration whose context is not zero (class |
| 261 | /// pricer-context-zero). |
| 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 | |
| 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 | /// [`super::single_ref_bits`] pays exactly what tile.rs' |
| 320 | /// `write_single_ref` codes: the p1/p2/p6 chain for a BACKWARD |
| 321 | /// reference and the p1/p3/p4/p5 chain for a forward one, each symbol at |
| 322 | /// the context that symbol's own `single_ref_p*_ctx` derives from the |
| 323 | /// block's above/left neighbours. Red before lane-pricer, where every |
| 324 | /// backward reference was priced as LAST (p1=0,p3=0,p4=0) at context 0. |
| 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 | |
| 383 | |
| 384 | |
| 385 | |
| 386 | |
| 387 | |
| 388 | |
| 389 | |
| 390 | |
| 391 | |
| 392 | |
| 393 | |
| 394 | |
| 395 | |
| 396 | |
| 397 | |
| 398 | |
| 399 | |
| 400 | |
| 401 | |
| 402 | |
| 403 | |
| 404 | /// lane-av1tpl2's propagated map, on the two properties every decision |
| 405 | /// under it rests on: a frame the whole lookahead window repeats exactly |
| 406 | /// (uniform texture) leans on every cell alike, so every factor is 1 and |
| 407 | /// the weighting is a no-op; and where the window really does save bits |
| 408 | /// by predicting -- the textured half of a frame whose other half is |
| 409 | /// flat -- the factor FALLS below 1, i.e. that half is coded more |
| 410 | /// distortion-averse than the half nothing gains from. |
| 411 | /// The distortion metric itself (lane-sse): a block the true frame edge |
| 412 | /// cuts through is scored over its INSIDE part only, so a difference that |
| 413 | /// lives entirely in the padding costs nothing and a block wholly past |
| 414 | /// the edge scores zero. Before this, the search ranked modes, |
| 415 | /// transforms and partition trees on samples the display crop throws |
| 416 | /// away -- which lane-b64b had fixed for the 64x64 root alone. |
| 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 | |
| 443 | |
| 444 | |
| 445 | |
| 446 | |
| 447 | |
| 448 | /// lane-dq: libaom's objective mapping ([`super::deltaq_libaom`]) must |
| 449 | /// spend WHERE THE WINDOW LEANS, stay congruent to the base on the |
| 450 | /// `delta_q_res` grid, and stop at libaom's own `+-(res * 9 - 1)` bound. |
| 451 | |
| 452 | |
| 453 | |
| 454 | |
| 455 | |
| 456 | |
| 457 | |
| 458 | |
| 459 | |
| 460 | |
| 461 | |
| 462 | |
| 463 | |
| 464 | |
| 465 | |
| 466 | |
| 467 | |
| 468 | |
| 469 | |
| 470 | |
| 471 | |
| 472 | |
| 473 | |
| 474 | |
| 475 | |
| 476 | |
| 477 | |
| 478 | |
| 479 | |
| 480 | |
| 481 | |
| 482 | |
| 483 | |
| 484 | |
| 485 | |
| 486 | |
| 487 | |
| 488 | |
| 489 | |
| 490 | |
| 491 | |
| 492 | |
| 493 | |
| 494 | |
| 495 | |
| 496 | |
| 497 | |
| 498 | |
| 499 | |
| 500 | |
| 501 | |
| 502 | |
| 503 | |
| 504 | |
| 505 | |
| 506 | |
| 507 | |
| 508 | |
| 509 | |
| 510 | |
| 511 | |
| 512 | |
| 513 | /// lane-arfq: the per-level `delta_q` strength -- the spec parses onto |
| 514 | /// [`super::DqLevel`]'s own indices, a missing or broken field keeps the |
| 515 | /// shipped default, and the multiplier reaches the strength. |
| 516 | |
| 517 | |
| 518 | |
| 519 | |
| 520 | |
| 521 | |
| 522 | |
| 523 | |
| 524 | |
| 525 | |
| 526 | |
| 527 | |
| 528 | |
| 529 | |
| 530 | |
| 531 | |
| 532 | |
| 533 | |
| 534 | |
| 535 | |
| 536 | |
| 537 | |
| 538 | |
| 539 | |
| 540 | |
| 541 | |
| 542 | |
| 543 | |
| 544 | |
| 545 | |
| 546 | |
| 547 | |
| 548 | |
| 549 | |
| 550 | |
| 551 | |
| 552 | |
| 553 | |
| 554 | |
| 555 | |
| 556 | |
| 557 | |
| 558 | |
| 559 | |
| 560 | |
| 561 | |
| 562 | |
| 563 | |
| 564 | |
| 565 | |
| 566 | |
| 567 | |
| 568 | |
| 569 | |
| 570 | |
| 571 | |
| 572 | |
| 573 | |
| 574 | |
| 575 | |
| 576 | /// lane-rectx r5: libaom lays `has_tr_*`/`has_bl_*` out row-major for a |
| 577 | /// 128x128 superblock -- `MAX_MIB_SIZE_LOG2 = 5` mi columns per row, so a |
| 578 | /// row holds `32 >> bw_in_mi_log2` bits and the table holds |
| 579 | /// `32 >> bh_in_mi_log2` such rows. Walking every block position of that |
| 580 | /// superblock must therefore hit every bit of the table EXACTLY ONCE. |
| 581 | /// r4's `4 - bw_log2` index halved the row stride: the walk then covered |
| 582 | /// only a quarter of the 16x8 table and read the wrong byte for every |
| 583 | /// block row but the first (silently wrong above-right/below-left |
| 584 | /// availability -- wrong pixels, no error). |
| 585 | |
| 586 | |
| 587 | |
| 588 | |
| 589 | |
| 590 | |
| 591 | |
| 592 | |
| 593 | |
| 594 | |
| 595 | |
| 596 | |
| 597 | |
| 598 | |
| 599 | |
| 600 | |
| 601 | |
| 602 | |
| 603 | |
| 604 | |
| 605 | |
| 606 | |
| 607 | |
| 608 | |
| 609 | |
| 610 | |
| 611 | |
| 612 | |
| 613 | |
| 614 | |
| 615 | |
| 616 | |
| 617 | |
| 618 | |
| 619 | |
| 620 | |
| 621 | |
| 622 | |
| 623 | |
| 624 | |
| 625 | |
| 626 | |
| 627 | |
| 628 | use *; |
| 629 | use crate; |
| 630 | use craterun_with_stdin; |
| 631 | use ; |
| 632 | |
| 633 | /// Every rectangular shape this decoder codes, at every position a block |
| 634 | /// of that shape can sit inside a 64x64 superblock: [`Reach::of_rect`] |
| 635 | /// must answer exactly what libaom's `has_top_right`/`has_bottom_left` |
| 636 | /// (`reconintra.c`) answer, whose bodies are ported below. |
| 637 | /// |
| 638 | /// lane-tx4x8 r3 ([[enumerate-table-domain]], [[tool-disabled-in-every-gate]]): |
| 639 | /// `rect_reach_tables` used to route every shape but 4x8/8x4/16x32 to the |
| 640 | /// 32x16 row, so live 16x8 strips read the wrong bit at 10 (above-right) |
| 641 | /// and 7 (below-left) of the 21 reachable positions with no gate seeing |
| 642 | /// it. The per-shape `(len, byte sum)` fingerprints below come from the |
| 643 | /// oracle's own arrays, so a re-routed or truncated table fails here even |
| 644 | /// where the two rows happen to agree. |
| 645 | /// |
| 646 | /// Not covered (no parameter for either on `of_rect`): chroma `ss_x`/ |
| 647 | /// `ss_y`, and sub-block transforms (`row_off`/`col_off` > 0), which the |
| 648 | /// callers handle by predicting each transform unit as its own block. |
| 649 | /// `PARTITION_VERT_A`/`VERT_B` need no arm either: libaom's |
| 650 | /// `has_tr_vert_tables`/`has_bl_vert_tables` entry for every RECT bsize is |
| 651 | /// either the plain table itself (4x8, 8x16, 16x32, 32x64) or NULL |
| 652 | /// (the horizontal shapes, which those partitions never produce). |
| 653 | |
| 654 | |
| 655 | |
| 656 | |
| 657 | |
| 658 | |
| 659 | |
| 660 | |
| 661 | |
| 662 | |
| 663 | |
| 664 | |
| 665 | |
| 666 | |
| 667 | |
| 668 | |
| 669 | |
| 670 | |
| 671 | |
| 672 | |
| 673 | |
| 674 | |
| 675 | |
| 676 | |
| 677 | |
| 678 | |
| 679 | |
| 680 | |
| 681 | |
| 682 | |
| 683 | |
| 684 | |
| 685 | |
| 686 | |
| 687 | |
| 688 | |
| 689 | |
| 690 | |
| 691 | |
| 692 | |
| 693 | |
| 694 | |
| 695 | |
| 696 | |
| 697 | |
| 698 | |
| 699 | |
| 700 | |
| 701 | |
| 702 | |
| 703 | |
| 704 | |
| 705 | |
| 706 | |
| 707 | |
| 708 | |
| 709 | |
| 710 | |
| 711 | |
| 712 | |
| 713 | |
| 714 | |
| 715 | |
| 716 | |
| 717 | |
| 718 | |
| 719 | |
| 720 | |
| 721 | |
| 722 | |
| 723 | |
| 724 | |
| 725 | |
| 726 | |
| 727 | |
| 728 | |
| 729 | |
| 730 | |
| 731 | |
| 732 | |
| 733 | |
| 734 | |
| 735 | |
| 736 | |
| 737 | |
| 738 | |
| 739 | |
| 740 | |
| 741 | |
| 742 | |
| 743 | |
| 744 | |
| 745 | |
| 746 | |
| 747 | |
| 748 | |
| 749 | |
| 750 | |
| 751 | /// Whether ffmpeg is on PATH. Absence normally SKIPs, but |
| 752 | /// `EC_AV1_REQUIRE_FFMPEG=1` -- or `EC_AV1_REQUIRE_AOMENC=1`, since every |
| 753 | /// aomenc gate decodes its stream through ffmpeg and is meaningless |
| 754 | /// without it -- turns it into a hard failure. Without this the require |
| 755 | /// flag was silently short-circuited: `!have_ffmpeg()` is evaluated first |
| 756 | /// in `if !have_ffmpeg() || !have_aomenc()`, so a machine with no ffmpeg |
| 757 | /// printed SKIP and reported green (class gate-skips-on-its-own-failure). |
| 758 | pub |
| 759 | |
| 760 | |
| 761 | |
| 762 | |
| 763 | |
| 764 | |
| 765 | |
| 766 | |
| 767 | |
| 768 | |
| 769 | |
| 770 | |
| 771 | |
| 772 | |
| 773 | |
| 774 | /// Whether this ffmpeg was built with `encoder` (lane-pareto2: the |
| 775 | /// SVT-AV1 Pareto rows are skipped, never failed, on a build without it). |
| 776 | pub |
| 777 | |
| 778 | |
| 779 | |
| 780 | |
| 781 | |
| 782 | |
| 783 | |
| 784 | |
| 785 | |
| 786 | |
| 787 | /// Decodes an AV1 OBU stream with ffmpeg and hands back the three planes. |
| 788 | pub |
| 789 | |
| 790 | |
| 791 | |
| 792 | |
| 793 | |
| 794 | |
| 795 | |
| 796 | |
| 797 | |
| 798 | |
| 799 | |
| 800 | |
| 801 | |
| 802 | |
| 803 | |
| 804 | |
| 805 | |
| 806 | |
| 807 | |
| 808 | |
| 809 | |
| 810 | |
| 811 | |
| 812 | |
| 813 | |
| 814 | |
| 815 | |
| 816 | |
| 817 | |
| 818 | |
| 819 | |
| 820 | |
| 821 | /// A picture with something of everything in it: a gradient, an edge, a |
| 822 | /// ripple and a block of flat colour, none of them aligned to the block |
| 823 | /// grid. |
| 824 | /// The in-loop filters actually FIRE and the stream still decodes to |
| 825 | /// exactly what the encoder kept as its reconstruction |
| 826 | /// (gate-blind-to-feature: a filter search that always answered "off" |
| 827 | /// would leave every other test just as green, and the BD gate that |
| 828 | /// would notice is `#[ignore]`d). |
| 829 | /// |
| 830 | /// Run: |
| 831 | /// cargo test -p ec-av1 --release --lib -- \ |
| 832 | /// encode::tests::the_filter_search_picks_real_filters |
| 833 | |
| 834 | |
| 835 | |
| 836 | |
| 837 | |
| 838 | |
| 839 | |
| 840 | |
| 841 | |
| 842 | |
| 843 | |
| 844 | |
| 845 | |
| 846 | |
| 847 | |
| 848 | |
| 849 | |
| 850 | |
| 851 | |
| 852 | |
| 853 | |
| 854 | |
| 855 | |
| 856 | |
| 857 | |
| 858 | |
| 859 | |
| 860 | |
| 861 | |
| 862 | |
| 863 | |
| 864 | |
| 865 | pub |
| 866 | |
| 867 | |
| 868 | |
| 869 | |
| 870 | |
| 871 | |
| 872 | |
| 873 | |
| 874 | |
| 875 | |
| 876 | |
| 877 | |
| 878 | |
| 879 | |
| 880 | |
| 881 | |
| 882 | |
| 883 | |
| 884 | |
| 885 | |
| 886 | |
| 887 | |
| 888 | |
| 889 | |
| 890 | |
| 891 | |
| 892 | pub |
| 893 | |
| 894 | |
| 895 | |
| 896 | |
| 897 | |
| 898 | |
| 899 | |
| 900 | |
| 901 | |
| 902 | |
| 903 | |
| 904 | |
| 905 | |
| 906 | |
| 907 | /// lane-i64's witness: a smooth gradient is exactly the picture a whole |
| 908 | /// 64x64 intra block predicts as well as four 32x32 ones, so the key |
| 909 | /// frame's new root fires on most superblocks -- and what BOTH decoders |
| 910 | /// produce is the encoder's own reconstruction, sample for sample. |
| 911 | /// |
| 912 | /// The fire count is the `gate-blind-to-feature` guard: without it every |
| 913 | /// assert below passes on a stream that codes no whole superblock at all. |
| 914 | |
| 915 | |
| 916 | |
| 917 | |
| 918 | |
| 919 | |
| 920 | |
| 921 | |
| 922 | |
| 923 | |
| 924 | |
| 925 | |
| 926 | |
| 927 | |
| 928 | |
| 929 | |
| 930 | |
| 931 | |
| 932 | |
| 933 | |
| 934 | |
| 935 | |
| 936 | |
| 937 | |
| 938 | |
| 939 | |
| 940 | |
| 941 | |
| 942 | |
| 943 | |
| 944 | |
| 945 | |
| 946 | |
| 947 | |
| 948 | |
| 949 | |
| 950 | |
| 951 | |
| 952 | |
| 953 | |
| 954 | |
| 955 | |
| 956 | |
| 957 | |
| 958 | |
| 959 | |
| 960 | |
| 961 | |
| 962 | |
| 963 | |
| 964 | |
| 965 | |
| 966 | /// The claim the whole encoder rests on: what a decoder produces is what |
| 967 | /// the encoder said it would, sample for sample, on every plane. |
| 968 | /// |
| 969 | /// Prediction reads the reconstruction, so a single sample of drift |
| 970 | /// anywhere would spread into every block below and to the right of it — |
| 971 | /// which is why this is an equality and not a tolerance. |
| 972 | |
| 973 | |
| 974 | |
| 975 | |
| 976 | |
| 977 | |
| 978 | |
| 979 | |
| 980 | |
| 981 | |
| 982 | |
| 983 | |
| 984 | |
| 985 | |
| 986 | |
| 987 | |
| 988 | |
| 989 | |
| 990 | |
| 991 | |
| 992 | |
| 993 | |
| 994 | |
| 995 | |
| 996 | |
| 997 | |
| 998 | |
| 999 | |
| 1000 | |
| 1001 | |
| 1002 | |
| 1003 | |
| 1004 | |
| 1005 | |
| 1006 | |
| 1007 | |
| 1008 | |
| 1009 | |
| 1010 | |
| 1011 | |
| 1012 | |
| 1013 | |
| 1014 | |
| 1015 | |
| 1016 | |
| 1017 | |
| 1018 | |
| 1019 | |
| 1020 | |
| 1021 | |
| 1022 | |
| 1023 | /// A synthetic screen-content picture -- a few flat colours in a grid of |
| 1024 | /// boxes with hard edges and text-like bars, the shape a desktop capture |
| 1025 | /// has -- so the palette path is exercised on content it is for. |
| 1026 | |
| 1027 | pub |
| 1028 | |
| 1029 | |
| 1030 | |
| 1031 | |
| 1032 | |
| 1033 | |
| 1034 | |
| 1035 | |
| 1036 | |
| 1037 | |
| 1038 | |
| 1039 | |
| 1040 | |
| 1041 | |
| 1042 | |
| 1043 | |
| 1044 | |
| 1045 | |
| 1046 | |
| 1047 | |
| 1048 | |
| 1049 | |
| 1050 | |
| 1051 | |
| 1052 | |
| 1053 | |
| 1054 | /// The lane's own end-to-end check: on screen content the detector fires, |
| 1055 | /// blocks really take a palette (fire count, class |
| 1056 | /// `gate-blind-to-feature`), and ffmpeg -- libaom's own reader of every |
| 1057 | /// symbol this lane writes -- reconstructs exactly what the encoder did. |
| 1058 | /// The film-shaped `test_card` must NOT trip the detector, which is what |
| 1059 | /// keeps every non-screen stream byte-identical. |
| 1060 | |
| 1061 | |
| 1062 | |
| 1063 | |
| 1064 | |
| 1065 | |
| 1066 | |
| 1067 | |
| 1068 | |
| 1069 | |
| 1070 | |
| 1071 | |
| 1072 | |
| 1073 | |
| 1074 | |
| 1075 | |
| 1076 | |
| 1077 | |
| 1078 | |
| 1079 | |
| 1080 | |
| 1081 | |
| 1082 | |
| 1083 | |
| 1084 | |
| 1085 | |
| 1086 | |
| 1087 | |
| 1088 | |
| 1089 | |
| 1090 | |
| 1091 | |
| 1092 | |
| 1093 | |
| 1094 | |
| 1095 | |
| 1096 | |
| 1097 | |
| 1098 | |
| 1099 | |
| 1100 | |
| 1101 | |
| 1102 | |
| 1103 | |
| 1104 | |
| 1105 | |
| 1106 | |
| 1107 | |
| 1108 | |
| 1109 | |
| 1110 | |
| 1111 | |
| 1112 | |
| 1113 | |
| 1114 | |
| 1115 | |
| 1116 | |
| 1117 | |
| 1118 | |
| 1119 | |
| 1120 | |
| 1121 | |
| 1122 | |
| 1123 | |
| 1124 | |
| 1125 | |
| 1126 | |
| 1127 | |
| 1128 | |
| 1129 | |
| 1130 | |
| 1131 | |
| 1132 | |
| 1133 | |
| 1134 | |
| 1135 | |
| 1136 | |
| 1137 | |
| 1138 | |
| 1139 | |
| 1140 | |
| 1141 | |
| 1142 | |
| 1143 | |
| 1144 | |
| 1145 | |
| 1146 | |
| 1147 | |
| 1148 | |
| 1149 | |
| 1150 | |
| 1151 | |
| 1152 | |
| 1153 | |
| 1154 | |
| 1155 | |
| 1156 | |
| 1157 | |
| 1158 | |
| 1159 | |
| 1160 | |
| 1161 | |
| 1162 | |
| 1163 | |
| 1164 | |
| 1165 | |
| 1166 | |
| 1167 | |
| 1168 | |
| 1169 | |
| 1170 | |
| 1171 | |
| 1172 | |
| 1173 | |
| 1174 | |
| 1175 | |
| 1176 | |
| 1177 | |
| 1178 | |
| 1179 | |
| 1180 | |
| 1181 | |
| 1182 | |
| 1183 | /// lane-av1paletteuv: the census for `crate::tile::palette_uv_side`, the |
| 1184 | /// `(side / 2).max(4)` named in `lanes/av1subsizesweep.report.md` as a |
| 1185 | /// "4:2:2/4:4:0 palette map mis-sized" site. |
| 1186 | /// |
| 1187 | /// **What the site computes.** libaom reads the plane-1 colour-index map |
| 1188 | /// at `av1_get_block_dimensions(bsize, 1, xd)` (blockd.h:1512): per axis, |
| 1189 | /// `plane_block = block >> ss`, then `+2` when that came out under 4 |
| 1190 | /// (the chroma sub-8x8 bump, blockd.h:1533-1541). For a SQUARE 4:2:0 |
| 1191 | /// block both axes carry `ss = 1`, so both come to `side / 2` with the |
| 1192 | /// bump -- which is exactly `(side / 2).max(4)`. The value is right. |
| 1193 | /// |
| 1194 | /// **What it is not.** At 4:2:2 the correct map is `(side >> 1) x side` |
| 1195 | /// and at 4:4:4 it is `side x side` -- neither is square. So the value is |
| 1196 | /// 4:2:0-only BY CONSTRUCTION, and this gate is what keeps it that way: |
| 1197 | /// if an encoder that can emit another chroma shape ever appears, this |
| 1198 | /// reds rather than the writer silently writing a half-height map. |
| 1199 | /// |
| 1200 | /// The three arms are (1) the value matches libaom's own per-axis |
| 1201 | /// formula at 4:2:0 over every side the palette syntax admits, (2) no |
| 1202 | /// reachable writer path can be handed another chroma shape, (3) a real |
| 1203 | /// encode really fires chroma palettes, so arm 1 is not arithmetic on a |
| 1204 | /// function nothing calls (class `gate-blind-to-feature`). |
| 1205 | |
| 1206 | |
| 1207 | |
| 1208 | |
| 1209 | |
| 1210 | |
| 1211 | |
| 1212 | |
| 1213 | |
| 1214 | |
| 1215 | |
| 1216 | |
| 1217 | |
| 1218 | |
| 1219 | |
| 1220 | |
| 1221 | |
| 1222 | |
| 1223 | |
| 1224 | |
| 1225 | |
| 1226 | |
| 1227 | |
| 1228 | |
| 1229 | |
| 1230 | |
| 1231 | |
| 1232 | |
| 1233 | |
| 1234 | |
| 1235 | |
| 1236 | |
| 1237 | |
| 1238 | |
| 1239 | |
| 1240 | |
| 1241 | |
| 1242 | |
| 1243 | |
| 1244 | |
| 1245 | |
| 1246 | |
| 1247 | |
| 1248 | |
| 1249 | |
| 1250 | |
| 1251 | |
| 1252 | |
| 1253 | |
| 1254 | |
| 1255 | |
| 1256 | |
| 1257 | |
| 1258 | |
| 1259 | |
| 1260 | |
| 1261 | |
| 1262 | |
| 1263 | |
| 1264 | |
| 1265 | |
| 1266 | |
| 1267 | |
| 1268 | |
| 1269 | |
| 1270 | |
| 1271 | |
| 1272 | |
| 1273 | |
| 1274 | |
| 1275 | |
| 1276 | |
| 1277 | |
| 1278 | |
| 1279 | |
| 1280 | |
| 1281 | |
| 1282 | |
| 1283 | |
| 1284 | |
| 1285 | |
| 1286 | |
| 1287 | |
| 1288 | |
| 1289 | |
| 1290 | |
| 1291 | |
| 1292 | |
| 1293 | |
| 1294 | |
| 1295 | |
| 1296 | |
| 1297 | |
| 1298 | |
| 1299 | |
| 1300 | |
| 1301 | |
| 1302 | |
| 1303 | |
| 1304 | |
| 1305 | |
| 1306 | |
| 1307 | |
| 1308 | |
| 1309 | |
| 1310 | |
| 1311 | |
| 1312 | |
| 1313 | |
| 1314 | |
| 1315 | |
| 1316 | |
| 1317 | |
| 1318 | |
| 1319 | |
| 1320 | |
| 1321 | |
| 1322 | |
| 1323 | |
| 1324 | |
| 1325 | |
| 1326 | |
| 1327 | |
| 1328 | |
| 1329 | |
| 1330 | |
| 1331 | |
| 1332 | |
| 1333 | |
| 1334 | |
| 1335 | |
| 1336 | |
| 1337 | |
| 1338 | |
| 1339 | |
| 1340 | |
| 1341 | |
| 1342 | |
| 1343 | |
| 1344 | |
| 1345 | |
| 1346 | |
| 1347 | |
| 1348 | |
| 1349 | |
| 1350 | |
| 1351 | |
| 1352 | |
| 1353 | |
| 1354 | |
| 1355 | |
| 1356 | |
| 1357 | |
| 1358 | |
| 1359 | |
| 1360 | |
| 1361 | |
| 1362 | |
| 1363 | |
| 1364 | |
| 1365 | |
| 1366 | |
| 1367 | |
| 1368 | |
| 1369 | |
| 1370 | |
| 1371 | |
| 1372 | |
| 1373 | |
| 1374 | |
| 1375 | |
| 1376 | |
| 1377 | |
| 1378 | |
| 1379 | |
| 1380 | |
| 1381 | |
| 1382 | |
| 1383 | |
| 1384 | |
| 1385 | |
| 1386 | |
| 1387 | |
| 1388 | |
| 1389 | |
| 1390 | |
| 1391 | |
| 1392 | |
| 1393 | |
| 1394 | |
| 1395 | |
| 1396 | |
| 1397 | |
| 1398 | |
| 1399 | |
| 1400 | |
| 1401 | |
| 1402 | |
| 1403 | |
| 1404 | |
| 1405 | |
| 1406 | |
| 1407 | |
| 1408 | |
| 1409 | |
| 1410 | |
| 1411 | |
| 1412 | |
| 1413 | |
| 1414 | |
| 1415 | |
| 1416 | |
| 1417 | |
| 1418 | /// The lane's keep-rule measurement: the gate's own screen capture, one |
| 1419 | /// KEY FRAME, coded with and without `allow_intrabc` at four quantizers. |
| 1420 | /// Setting the bit forces deblocking, CDEF and loop restoration off for |
| 1421 | /// that frame, so the table is exactly the filter loss against the bytes |
| 1422 | /// the copied blocks save. |
| 1423 | |
| 1424 | |
| 1425 | |
| 1426 | |
| 1427 | |
| 1428 | |
| 1429 | |
| 1430 | |
| 1431 | |
| 1432 | |
| 1433 | |
| 1434 | |
| 1435 | |
| 1436 | |
| 1437 | |
| 1438 | |
| 1439 | |
| 1440 | |
| 1441 | |
| 1442 | |
| 1443 | |
| 1444 | |
| 1445 | |
| 1446 | |
| 1447 | |
| 1448 | |
| 1449 | |
| 1450 | |
| 1451 | |
| 1452 | |
| 1453 | |
| 1454 | |
| 1455 | |
| 1456 | |
| 1457 | |
| 1458 | |
| 1459 | |
| 1460 | |
| 1461 | |
| 1462 | |
| 1463 | |
| 1464 | |
| 1465 | |
| 1466 | |
| 1467 | |
| 1468 | |
| 1469 | |
| 1470 | |
| 1471 | |
| 1472 | |
| 1473 | |
| 1474 | |
| 1475 | |
| 1476 | |
| 1477 | |
| 1478 | |
| 1479 | |
| 1480 | |
| 1481 | |
| 1482 | /// lane-av1ibc's own end-to-end check: a repeated-pattern screen card |
| 1483 | /// sets `allow_intrabc` (so every in-loop filter is off), blocks really |
| 1484 | /// take a block vector (fire count + DV histogram, class |
| 1485 | /// `gate-blind-to-feature`), and both our own decoder and ffmpeg -- |
| 1486 | /// libaom's reader of the `use_intrabc`/`assign_dv` syntax -- reconstruct |
| 1487 | /// exactly what the encoder did. |
| 1488 | |
| 1489 | |
| 1490 | |
| 1491 | |
| 1492 | |
| 1493 | |
| 1494 | |
| 1495 | |
| 1496 | |
| 1497 | |
| 1498 | |
| 1499 | |
| 1500 | |
| 1501 | |
| 1502 | |
| 1503 | |
| 1504 | |
| 1505 | |
| 1506 | |
| 1507 | |
| 1508 | |
| 1509 | |
| 1510 | |
| 1511 | |
| 1512 | |
| 1513 | |
| 1514 | |
| 1515 | |
| 1516 | |
| 1517 | |
| 1518 | |
| 1519 | |
| 1520 | |
| 1521 | |
| 1522 | |
| 1523 | |
| 1524 | |
| 1525 | |
| 1526 | |
| 1527 | |
| 1528 | |
| 1529 | |
| 1530 | |
| 1531 | |
| 1532 | |
| 1533 | |
| 1534 | |
| 1535 | |
| 1536 | |
| 1537 | |
| 1538 | |
| 1539 | /// The minimal repro that isolated the inter-residual desync: a key frame |
| 1540 | /// followed by one inter frame whose single superblock carries one |
| 1541 | /// `NEARESTMV` block (`mv == (0, 0)`) with exactly one nonzero luma |
| 1542 | /// coefficient, its three sibling blocks all `skip: true`. Before the |
| 1543 | /// `is_inter` transform-block fix this broke ffmpeg/dav1d ("Invalid data |
| 1544 | /// found when processing input") even though every symbol either block |
| 1545 | /// codes is otherwise proven (all-skip inter blocks decode clean, and the |
| 1546 | /// same coefficient syntax decodes clean on every intra key-frame gate). |
| 1547 | |
| 1548 | |
| 1549 | |
| 1550 | |
| 1551 | |
| 1552 | |
| 1553 | |
| 1554 | |
| 1555 | |
| 1556 | |
| 1557 | |
| 1558 | |
| 1559 | |
| 1560 | |
| 1561 | |
| 1562 | |
| 1563 | |
| 1564 | |
| 1565 | |
| 1566 | |
| 1567 | |
| 1568 | |
| 1569 | |
| 1570 | |
| 1571 | |
| 1572 | |
| 1573 | |
| 1574 | |
| 1575 | |
| 1576 | |
| 1577 | |
| 1578 | |
| 1579 | |
| 1580 | |
| 1581 | |
| 1582 | |
| 1583 | |
| 1584 | |
| 1585 | |
| 1586 | |
| 1587 | |
| 1588 | |
| 1589 | |
| 1590 | |
| 1591 | |
| 1592 | |
| 1593 | |
| 1594 | |
| 1595 | |
| 1596 | |
| 1597 | |
| 1598 | |
| 1599 | |
| 1600 | |
| 1601 | |
| 1602 | |
| 1603 | |
| 1604 | |
| 1605 | |
| 1606 | |
| 1607 | |
| 1608 | |
| 1609 | |
| 1610 | |
| 1611 | |
| 1612 | |
| 1613 | |
| 1614 | |
| 1615 | |
| 1616 | |
| 1617 | |
| 1618 | |
| 1619 | |
| 1620 | |
| 1621 | |
| 1622 | |
| 1623 | |
| 1624 | |
| 1625 | |
| 1626 | |
| 1627 | |
| 1628 | |
| 1629 | |
| 1630 | |
| 1631 | |
| 1632 | |
| 1633 | |
| 1634 | |
| 1635 | |
| 1636 | |
| 1637 | /// `ffprobe`'s reported `width,height` for one OBU stream -- the coded |
| 1638 | /// frame size an AV1 decoder allocates, not necessarily the render size |
| 1639 | /// (see [`a_frame_round_trips_at_its_own_size`]). |
| 1640 | pub |
| 1641 | |
| 1642 | |
| 1643 | |
| 1644 | |
| 1645 | |
| 1646 | |
| 1647 | |
| 1648 | |
| 1649 | |
| 1650 | |
| 1651 | |
| 1652 | |
| 1653 | |
| 1654 | |
| 1655 | |
| 1656 | |
| 1657 | |
| 1658 | |
| 1659 | |
| 1660 | |
| 1661 | |
| 1662 | |
| 1663 | |
| 1664 | |
| 1665 | |
| 1666 | |
| 1667 | |
| 1668 | |
| 1669 | |
| 1670 | |
| 1671 | |
| 1672 | |
| 1673 | |
| 1674 | |
| 1675 | |
| 1676 | |
| 1677 | |
| 1678 | |
| 1679 | |
| 1680 | /// lane-av1cap: the final filter replay against the capture decode it |
| 1681 | /// replaced, at the block-padded and straddling sizes the whole-frame |
| 1682 | /// tests cover -- `set_verify_final_replay` makes |
| 1683 | /// [`pick_and_apply_filters`] run both on every frame and assert, per |
| 1684 | /// frame, that the spliced picture and the two filter stages the |
| 1685 | /// restoration search reads are bit-identical over the frame's own crop. |
| 1686 | |
| 1687 | |
| 1688 | |
| 1689 | |
| 1690 | |
| 1691 | |
| 1692 | |
| 1693 | |
| 1694 | |
| 1695 | |
| 1696 | |
| 1697 | |
| 1698 | |
| 1699 | |
| 1700 | |
| 1701 | |
| 1702 | |
| 1703 | |
| 1704 | |
| 1705 | /// A key frame at an arbitrary even size round-trips through ffmpeg over |
| 1706 | /// its own render rectangle: [`Encoded::reconstruction`] is exactly the |
| 1707 | /// picture's own size, and what ffmpeg decodes over that same top-left |
| 1708 | /// region equals it sample for sample. |
| 1709 | /// |
| 1710 | /// This does not check that `ffprobe` reports the picture's own size, |
| 1711 | /// because it does not: `ffprobe`/ffmpeg's AV1 decoder reports the coded |
| 1712 | /// (block-padded) frame size, the same one libaom itself would code for |
| 1713 | /// a non-block-aligned picture. `render_width`/`render_height` (which |
| 1714 | /// this crate sets correctly, spec 5.9.6) is a display hint no AV1 |
| 1715 | /// decoder is required to crop pixels by, and ffmpeg's does not -- |
| 1716 | /// checked empirically against ffprobe here and against a real libaom |
| 1717 | /// encode separately. So the coded size, not the render size, is what |
| 1718 | /// `ffprobe` is asserted to report below. |
| 1719 | |
| 1720 | |
| 1721 | |
| 1722 | |
| 1723 | |
| 1724 | |
| 1725 | |
| 1726 | |
| 1727 | |
| 1728 | |
| 1729 | |
| 1730 | |
| 1731 | |
| 1732 | |
| 1733 | |
| 1734 | |
| 1735 | |
| 1736 | |
| 1737 | |
| 1738 | |
| 1739 | |
| 1740 | |
| 1741 | |
| 1742 | |
| 1743 | |
| 1744 | |
| 1745 | |
| 1746 | |
| 1747 | |
| 1748 | |
| 1749 | |
| 1750 | |
| 1751 | |
| 1752 | |
| 1753 | |
| 1754 | |
| 1755 | |
| 1756 | |
| 1757 | |
| 1758 | |
| 1759 | |
| 1760 | |
| 1761 | /// 854x480 (padded to 864x480, an edge-replication padded key frame) used |
| 1762 | /// to diverge from ffmpeg's decode at luma (row 161, col 369): a debug |
| 1763 | /// `aomdec` trace of `has_top_right`/`has_bottom_left` at that exact |
| 1764 | /// block (a 16x16 at mi (40, 88)) showed libaom indexing its pinned |
| 1765 | /// `has_bl_16x16` table at bit 18 (`row * 8 + col`, row=2 col=2), while |
| 1766 | /// `Reach::bottom_left` indexed the same table at bit 10 (`row * 4 + |
| 1767 | /// col`) -- different bits of an 8-byte table, one true, one false. The |
| 1768 | /// stride libaom indexes by is fixed at its compile-time maximum |
| 1769 | /// superblock (128px, `MAX_MIB_SIZE_LOG2` = 5), not the actual superblock |
| 1770 | /// size a stream uses, so the right stride for a 16x16 or 32x32 block is |
| 1771 | /// `128 / side`, not `SUPERBLOCK / side` (64-relative) -- `Reach::of`'s |
| 1772 | /// row/col position within the (correctly 64-relative) superblock stayed |
| 1773 | /// right, only the table's own row stride was wrong. Fixed in |
| 1774 | /// `Reach::table_stride`; not an arithmetic-coder desync (an |
| 1775 | /// EC_RNG-per-symbol trace against the same debug decoder found the |
| 1776 | /// bitstream byte-for-byte identical to libaom's across all 51188 |
| 1777 | /// symbols of this frame before this bug was found). |
| 1778 | /// |
| 1779 | /// Since the frame header started writing the true (unpadded) display |
| 1780 | /// size into `frame_width`/`frame_height` rather than the padded coded |
| 1781 | /// size, ffmpeg crops to 854x480 on its own -- decoding at the padded |
| 1782 | /// 864x480 and cropping ourselves now reads past what ffmpeg actually |
| 1783 | /// emits (`av1_common_int.h`'s render/upscale path, mirrored by |
| 1784 | /// `av1_frame_size` on the decode side, crops the loop-filtered picture to |
| 1785 | /// the header's own size before output). |
| 1786 | |
| 1787 | |
| 1788 | |
| 1789 | |
| 1790 | |
| 1791 | |
| 1792 | |
| 1793 | |
| 1794 | |
| 1795 | |
| 1796 | |
| 1797 | |
| 1798 | |
| 1799 | |
| 1800 | |
| 1801 | |
| 1802 | /// [`Reach::of_tu`] against libaom's `has_top_right`/`has_bottom_left` |
| 1803 | /// transform-unit path, for every 4x4 unit of every 8x8 block of a |
| 1804 | /// superblock, both partition tables: |
| 1805 | /// |
| 1806 | /// 1. outside a `PARTITION_VERT_A`/`_B` it must answer exactly what the |
| 1807 | /// unit-as-its-own-block `Reach::of(4, ..)` answered before r2, so |
| 1808 | /// wiring the TU sites onto it changes no existing stream; |
| 1809 | /// 2. inside one it must not panic -- `has_tr_vert_tables[BLOCK_4X4]` is |
| 1810 | /// NULL in libaom because that lookup never happens, and reading a |
| 1811 | /// 4x4 row out of the three-row vert tables is what crashed a real |
| 1812 | /// `--enable-tx-size-search=1` stream (r2); |
| 1813 | /// 3. and it must be the BLOCK's vert answer where the two tables |
| 1814 | /// disagree: the top-right 4x4 unit of the 8x8 block at superblock |
| 1815 | /// row 1, column 0 reads its above-right samples from the 8x8 to its |
| 1816 | /// upper right, which a vertical AB partition codes AFTER it |
| 1817 | /// (`has_tr_vert_8x8` bit 16 = 0, ordinary `has_tr_8x8` bit 16 = 1). |
| 1818 | |
| 1819 | |
| 1820 | |
| 1821 | |
| 1822 | |
| 1823 | |
| 1824 | |
| 1825 | |
| 1826 | |
| 1827 | |
| 1828 | |
| 1829 | |
| 1830 | |
| 1831 | |
| 1832 | |
| 1833 | |
| 1834 | |
| 1835 | |
| 1836 | |
| 1837 | |
| 1838 | |
| 1839 | |
| 1840 | |
| 1841 | |
| 1842 | |
| 1843 | |
| 1844 | |
| 1845 | |
| 1846 | /// `Reach::top_right`/`bottom_left` against a from-scratch transcription |
| 1847 | /// of libaom's `has_top_right`/`has_bottom_left` (`av1/common/ |
| 1848 | /// reconintra.c`), for every 16x16 and 32x32 block position across three |
| 1849 | /// superblocks square -- interior and every superblock edge (top row, |
| 1850 | /// left column, right column, bottom row) both sizes reach. Written to |
| 1851 | /// catch the class the `table_stride` bug was: an index stride silently |
| 1852 | /// wrong for one block size while looking plausible for the other. |
| 1853 | |
| 1854 | |
| 1855 | |
| 1856 | |
| 1857 | |
| 1858 | |
| 1859 | |
| 1860 | |
| 1861 | |
| 1862 | |
| 1863 | |
| 1864 | |
| 1865 | |
| 1866 | |
| 1867 | |
| 1868 | |
| 1869 | |
| 1870 | |
| 1871 | |
| 1872 | |
| 1873 | |
| 1874 | |
| 1875 | |
| 1876 | |
| 1877 | |
| 1878 | |
| 1879 | |
| 1880 | |
| 1881 | |
| 1882 | |
| 1883 | |
| 1884 | |
| 1885 | |
| 1886 | |
| 1887 | |
| 1888 | |
| 1889 | |
| 1890 | |
| 1891 | |
| 1892 | |
| 1893 | |
| 1894 | |
| 1895 | |
| 1896 | |
| 1897 | |
| 1898 | |
| 1899 | |
| 1900 | |
| 1901 | |
| 1902 | |
| 1903 | |
| 1904 | |
| 1905 | |
| 1906 | |
| 1907 | |
| 1908 | |
| 1909 | |
| 1910 | |
| 1911 | |
| 1912 | |
| 1913 | |
| 1914 | |
| 1915 | |
| 1916 | |
| 1917 | |
| 1918 | |
| 1919 | |
| 1920 | |
| 1921 | |
| 1922 | |
| 1923 | |
| 1924 | |
| 1925 | |
| 1926 | |
| 1927 | |
| 1928 | |
| 1929 | |
| 1930 | |
| 1931 | |
| 1932 | |
| 1933 | |
| 1934 | |
| 1935 | |
| 1936 | |
| 1937 | |
| 1938 | |
| 1939 | |
| 1940 | /// lane-part32 r6: inside a `PARTITION_VERT_A`/`_B` the 8x8 squares are |
| 1941 | /// visited TL, BL, TR, BR, so the TR square (even 8x8 row, odd 8x8 |
| 1942 | /// column inside the superblock) may read the below-left samples the |
| 1943 | /// raster table forbids: `has_bl_8x8` is 0 at exactly those 16 slots |
| 1944 | /// where `has_bl_vert_8x8` is 1. Pinned here because no aomenc recipe |
| 1945 | /// swept in r6 produced a decodable 16x16-level VERT_B stream (every |
| 1946 | /// stream that partitions that small first hits the still-refused |
| 1947 | /// HORZ_A/HORZ_B/VERT_A-below-16 or coded-rect-strip-below-16 arms). |
| 1948 | /// [`Reach::of_tu`] against a from-scratch transcription of libaom's |
| 1949 | /// `has_top_right`/`has_bottom_left` TU branches (`reconintra.c`, luma, |
| 1950 | /// `ss_x = ss_y = 0`), which work in MI units where `of_tu` works in |
| 1951 | /// pixels -- lane-palette2 r12: the square multi-TU path used the |
| 1952 | /// standalone-block tables instead of this rule and granted a 16x16 |
| 1953 | /// D203 block's top-right 8x8 unit bottom-left pixels libaom refuses. |
| 1954 | |
| 1955 | |
| 1956 | |
| 1957 | |
| 1958 | |
| 1959 | |
| 1960 | |
| 1961 | |
| 1962 | |
| 1963 | |
| 1964 | |
| 1965 | |
| 1966 | |
| 1967 | |
| 1968 | |
| 1969 | |
| 1970 | |
| 1971 | |
| 1972 | |
| 1973 | |
| 1974 | |
| 1975 | |
| 1976 | |
| 1977 | |
| 1978 | |
| 1979 | |
| 1980 | |
| 1981 | |
| 1982 | |
| 1983 | |
| 1984 | |
| 1985 | |
| 1986 | |
| 1987 | |
| 1988 | |
| 1989 | |
| 1990 | |
| 1991 | |
| 1992 | |
| 1993 | |
| 1994 | |
| 1995 | |
| 1996 | |
| 1997 | |
| 1998 | |
| 1999 | |
| 2000 | |
| 2001 | |
| 2002 | |
| 2003 | |
| 2004 | |
| 2005 | |
| 2006 | |
| 2007 | |
| 2008 | |
| 2009 | |
| 2010 | |
| 2011 | |
| 2012 | |
| 2013 | |
| 2014 | |
| 2015 | |
| 2016 | |
| 2017 | |
| 2018 | |
| 2019 | |
| 2020 | |
| 2021 | |
| 2022 | |
| 2023 | |
| 2024 | |
| 2025 | |
| 2026 | |
| 2027 | |
| 2028 | |
| 2029 | |
| 2030 | |
| 2031 | |
| 2032 | |
| 2033 | |
| 2034 | |
| 2035 | |
| 2036 | |
| 2037 | |
| 2038 | |
| 2039 | |
| 2040 | |
| 2041 | |
| 2042 | |
| 2043 | |
| 2044 | |
| 2045 | |
| 2046 | |
| 2047 | |
| 2048 | |
| 2049 | |
| 2050 | |
| 2051 | |
| 2052 | |
| 2053 | |
| 2054 | |
| 2055 | |
| 2056 | |
| 2057 | |
| 2058 | |
| 2059 | |
| 2060 | |
| 2061 | |
| 2062 | |
| 2063 | |
| 2064 | |
| 2065 | |
| 2066 | |
| 2067 | |
| 2068 | |
| 2069 | |
| 2070 | |
| 2071 | |
| 2072 | |
| 2073 | |
| 2074 | /// An odd width or height is refused by name, not by however the padder |
| 2075 | /// or the block coder would happen to fail on it. |
| 2076 | |
| 2077 | |
| 2078 | |
| 2079 | |
| 2080 | |
| 2081 | |
| 2082 | |
| 2083 | |
| 2084 | |
| 2085 | |
| 2086 | |
| 2087 | |
| 2088 | |
| 2089 | |
| 2090 | |
| 2091 | /// A sequence at a size that is not a multiple of the block grid decodes |
| 2092 | /// to the right frame count and the right size for every frame, |
| 2093 | /// including the inter frames whose reference is the previous frame's |
| 2094 | /// own (padded) reconstruction. |
| 2095 | |
| 2096 | |
| 2097 | |
| 2098 | |
| 2099 | |
| 2100 | |
| 2101 | |
| 2102 | |
| 2103 | |
| 2104 | |
| 2105 | |
| 2106 | |
| 2107 | |
| 2108 | |
| 2109 | |
| 2110 | |
| 2111 | |
| 2112 | |
| 2113 | |
| 2114 | |
| 2115 | |
| 2116 | |
| 2117 | |
| 2118 | |
| 2119 | |
| 2120 | |
| 2121 | |
| 2122 | |
| 2123 | |
| 2124 | |
| 2125 | |
| 2126 | |
| 2127 | |
| 2128 | |
| 2129 | |
| 2130 | |
| 2131 | |
| 2132 | /// 1280x720 -- the export size a real edith timeline hits -- is exactly |
| 2133 | /// the "half straddle" class: 720 mod 32 == 16, so the true frame edge |
| 2134 | /// falls at exactly half of the last row of 32x32 blocks (`has_half`'s |
| 2135 | /// `pos + side_mi / 2 < bound` boundary), which is the case |
| 2136 | /// `sb_coeff_inter_frame_tile`'s `Quadrant::Split` now codes rather than |
| 2137 | /// refusing. A key frame alone already covered this size; this proves the |
| 2138 | /// inter tile writer's parity with it across a real multi-frame export. |
| 2139 | |
| 2140 | |
| 2141 | |
| 2142 | |
| 2143 | |
| 2144 | |
| 2145 | |
| 2146 | |
| 2147 | |
| 2148 | |
| 2149 | |
| 2150 | |
| 2151 | |
| 2152 | |
| 2153 | |
| 2154 | |
| 2155 | |
| 2156 | |
| 2157 | |
| 2158 | |
| 2159 | |
| 2160 | |
| 2161 | |
| 2162 | |
| 2163 | |
| 2164 | |
| 2165 | |
| 2166 | |
| 2167 | |
| 2168 | |
| 2169 | |
| 2170 | |
| 2171 | |
| 2172 | |
| 2173 | |
| 2174 | /// 640x360 is the class the charter names: 360 mod 32 == 8, so a 16x16 |
| 2175 | /// leaf's own half (`has_half` at the SUB level) itself straddles the |
| 2176 | /// true edge on one axis only. lane-av1-rect r7 wired the key frame |
| 2177 | /// writer's 8x8-leaf path (`crate::tile::write_leaf8`) live for exactly |
| 2178 | /// this case; lane-av1inter8 extends the same leaf-8 path to inter |
| 2179 | /// frames (`code_square_inter` at `side == 8`, `sb_coeff_inter_frame_tile`'s |
| 2180 | /// straddling-16x16 branch), so an inter frame no longer refuses this |
| 2181 | /// size either. This only proves the encoder does not error out -- see |
| 2182 | /// `a_640x360_half_straddle_sequence_round_trips_through_ffmpeg` for the |
| 2183 | /// decoder-clean proof (a 3-frame sequence, so the inter path is |
| 2184 | /// actually exercised). |
| 2185 | |
| 2186 | |
| 2187 | |
| 2188 | |
| 2189 | |
| 2190 | |
| 2191 | |
| 2192 | |
| 2193 | |
| 2194 | |
| 2195 | |
| 2196 | |
| 2197 | |
| 2198 | |
| 2199 | |
| 2200 | |
| 2201 | /// The r15 fix at production size: three 640x360 key frames (inter is |
| 2202 | /// still refused at this size, per the test above, so this stands in for |
| 2203 | /// the charter's "3-frame sequence" using three independent key frames of |
| 2204 | /// shifted content), each proven decoder-clean through ffmpeg rather than |
| 2205 | /// only encoder-clean. |
| 2206 | |
| 2207 | |
| 2208 | |
| 2209 | |
| 2210 | |
| 2211 | |
| 2212 | |
| 2213 | |
| 2214 | |
| 2215 | |
| 2216 | |
| 2217 | |
| 2218 | |
| 2219 | |
| 2220 | |
| 2221 | |
| 2222 | |
| 2223 | |
| 2224 | |
| 2225 | |
| 2226 | |
| 2227 | |
| 2228 | /// The 640x360 straddle class, but through the inter path an actual |
| 2229 | /// 3-frame sequence exercises (lane-av1inter8's own ladder rung (b)): |
| 2230 | /// proves the leaf-8 inter stream this round wires up is not just |
| 2231 | /// encoder-clean (the test above) but decoder-clean against ffmpeg too. |
| 2232 | |
| 2233 | |
| 2234 | |
| 2235 | |
| 2236 | |
| 2237 | |
| 2238 | |
| 2239 | |
| 2240 | |
| 2241 | |
| 2242 | |
| 2243 | |
| 2244 | |
| 2245 | |
| 2246 | |
| 2247 | |
| 2248 | |
| 2249 | |
| 2250 | |
| 2251 | |
| 2252 | |
| 2253 | |
| 2254 | |
| 2255 | |
| 2256 | |
| 2257 | |
| 2258 | |
| 2259 | |
| 2260 | /// One frame of a real clip, scaled to a whole number of 32x32 blocks. |
| 2261 | pub |
| 2262 | |
| 2263 | |
| 2264 | |
| 2265 | |
| 2266 | |
| 2267 | |
| 2268 | |
| 2269 | |
| 2270 | |
| 2271 | |
| 2272 | |
| 2273 | |
| 2274 | |
| 2275 | |
| 2276 | |
| 2277 | |
| 2278 | |
| 2279 | |
| 2280 | |
| 2281 | |
| 2282 | |
| 2283 | |
| 2284 | |
| 2285 | |
| 2286 | |
| 2287 | |
| 2288 | |
| 2289 | |
| 2290 | |
| 2291 | |
| 2292 | |
| 2293 | /// Prints what the mode search saves over DC prediction alone, for the |
| 2294 | /// synthetic pictures and for whatever clips `EC_AV1_CLIPS` names, so the |
| 2295 | /// weight the search puts on rate can be swept. |
| 2296 | |
| 2297 | |
| 2298 | |
| 2299 | |
| 2300 | |
| 2301 | |
| 2302 | |
| 2303 | |
| 2304 | |
| 2305 | |
| 2306 | |
| 2307 | |
| 2308 | |
| 2309 | |
| 2310 | |
| 2311 | |
| 2312 | |
| 2313 | |
| 2314 | |
| 2315 | |
| 2316 | |
| 2317 | |
| 2318 | |
| 2319 | |
| 2320 | |
| 2321 | |
| 2322 | |
| 2323 | |
| 2324 | |
| 2325 | |
| 2326 | /// Prints the whole mode-search ladder, so two builds of the search can be |
| 2327 | /// compared against each other rather than each against its own baseline. |
| 2328 | |
| 2329 | |
| 2330 | |
| 2331 | |
| 2332 | |
| 2333 | |
| 2334 | |
| 2335 | |
| 2336 | |
| 2337 | |
| 2338 | |
| 2339 | |
| 2340 | |
| 2341 | |
| 2342 | |
| 2343 | |
| 2344 | /// Splitting a 32x32 block into four 16x16 ones, measured both ways over |
| 2345 | /// the sweep pictures and whatever clips `EC_AV1_CLIPS` names. This is what |
| 2346 | /// sets [`SPLIT_BLOCKS`]; the table it prints is in the lane report. |
| 2347 | |
| 2348 | // ROBUST-RED on this tree, and the red is in the MEASURE, not the codec: |
| 2349 | // the `stripes` picture codes LOSSLESSLY at q110/90/70, so both ladders |
| 2350 | // come back as three identical `(inf, 1.8260748027008264)` points and |
| 2351 | // `bd_rate` has an empty trapezoid to integrate, which panics with |
| 2352 | // "the two ladders have to overlap in PSNR". Row 1 (`test card`) still |
| 2353 | // prints its number before the panic. Point `EC_AV1_CLIPS` at a real lossy |
| 2354 | // clip, or read only row 1. |
| 2355 | |
| 2356 | pub |
| 2357 | |
| 2358 | |
| 2359 | |
| 2360 | |
| 2361 | |
| 2362 | |
| 2363 | |
| 2364 | |
| 2365 | |
| 2366 | |
| 2367 | |
| 2368 | |
| 2369 | |
| 2370 | |
| 2371 | |
| 2372 | |
| 2373 | |
| 2374 | |
| 2375 | |
| 2376 | |
| 2377 | |
| 2378 | |
| 2379 | |
| 2380 | |
| 2381 | |
| 2382 | |
| 2383 | |
| 2384 | |
| 2385 | |
| 2386 | |
| 2387 | |
| 2388 | |
| 2389 | |
| 2390 | |
| 2391 | |
| 2392 | |
| 2393 | |
| 2394 | |
| 2395 | |
| 2396 | |
| 2397 | |
| 2398 | |
| 2399 | |
| 2400 | |
| 2401 | |
| 2402 | |
| 2403 | |
| 2404 | |
| 2405 | |
| 2406 | /// A striped picture, running one way or the other. The stripes are what |
| 2407 | /// separates a vertical predictor from a horizontal one: a mode search |
| 2408 | /// reading a transposed edge would pick the wrong one of the pair, which no |
| 2409 | /// symmetric picture would show. |
| 2410 | pub |
| 2411 | |
| 2412 | |
| 2413 | |
| 2414 | |
| 2415 | |
| 2416 | |
| 2417 | |
| 2418 | |
| 2419 | |
| 2420 | |
| 2421 | /// Where two planes first disagree, and by how much: a mismatch reported as |
| 2422 | /// a position says which block and which sample of it went wrong, which a |
| 2423 | /// pair of thousand-sample arrays does not. A length difference counts as a |
| 2424 | /// disagreement: `zip` stops at the shorter plane, so a short one would |
| 2425 | /// otherwise compare exact over the prefix the two share. |
| 2426 | pub |
| 2427 | |
| 2428 | |
| 2429 | |
| 2430 | |
| 2431 | |
| 2432 | |
| 2433 | |
| 2434 | |
| 2435 | |
| 2436 | |
| 2437 | |
| 2438 | |
| 2439 | |
| 2440 | |
| 2441 | |
| 2442 | |
| 2443 | |
| 2444 | |
| 2445 | |
| 2446 | |
| 2447 | /// Every mode the encoder offers has to predict what the decoder predicts, |
| 2448 | /// not just the ones a particular picture happens to choose: each is forced |
| 2449 | /// over a whole picture and the reconstruction gated against ffmpeg. |
| 2450 | |
| 2451 | |
| 2452 | |
| 2453 | |
| 2454 | |
| 2455 | |
| 2456 | |
| 2457 | |
| 2458 | |
| 2459 | |
| 2460 | |
| 2461 | |
| 2462 | |
| 2463 | |
| 2464 | |
| 2465 | |
| 2466 | |
| 2467 | |
| 2468 | |
| 2469 | |
| 2470 | |
| 2471 | |
| 2472 | |
| 2473 | |
| 2474 | |
| 2475 | |
| 2476 | |
| 2477 | |
| 2478 | |
| 2479 | |
| 2480 | |
| 2481 | |
| 2482 | |
| 2483 | |
| 2484 | |
| 2485 | |
| 2486 | |
| 2487 | |
| 2488 | |
| 2489 | |
| 2490 | |
| 2491 | |
| 2492 | /// The search has to follow the picture: vertical stripes are cheapest |
| 2493 | /// predicted from the row above, horizontal ones from the column to the |
| 2494 | /// left. Reading the edges the other way round would swap the two answers |
| 2495 | /// while leaving every fidelity gate intact. |
| 2496 | |
| 2497 | |
| 2498 | |
| 2499 | |
| 2500 | |
| 2501 | |
| 2502 | |
| 2503 | |
| 2504 | |
| 2505 | |
| 2506 | |
| 2507 | |
| 2508 | |
| 2509 | |
| 2510 | |
| 2511 | |
| 2512 | |
| 2513 | |
| 2514 | |
| 2515 | |
| 2516 | |
| 2517 | |
| 2518 | |
| 2519 | |
| 2520 | |
| 2521 | |
| 2522 | |
| 2523 | |
| 2524 | |
| 2525 | |
| 2526 | |
| 2527 | |
| 2528 | /// What the search is for: the same picture, at the same quantizer, coded |
| 2529 | /// smaller and more faithfully than DC alone can manage. |
| 2530 | /// Rate saved at matched fidelity, over a three-point ladder: the trapezoid |
| 2531 | /// between the two rate-distortion curves in log-rate against PSNR, as a |
| 2532 | /// fraction of the reference's rate. Negative means the second curve costs |
| 2533 | /// less for the same picture. |
| 2534 | pub |
| 2535 | |
| 2536 | |
| 2537 | |
| 2538 | |
| 2539 | |
| 2540 | |
| 2541 | |
| 2542 | |
| 2543 | |
| 2544 | |
| 2545 | |
| 2546 | |
| 2547 | |
| 2548 | |
| 2549 | |
| 2550 | |
| 2551 | |
| 2552 | |
| 2553 | |
| 2554 | |
| 2555 | |
| 2556 | |
| 2557 | |
| 2558 | |
| 2559 | |
| 2560 | |
| 2561 | |
| 2562 | |
| 2563 | |
| 2564 | |
| 2565 | |
| 2566 | |
| 2567 | |
| 2568 | |
| 2569 | |
| 2570 | |
| 2571 | |
| 2572 | |
| 2573 | |
| 2574 | |
| 2575 | |
| 2576 | /// A ladder of (luma PSNR, log10 bytes) for one mode set, ordered by |
| 2577 | /// fidelity. |
| 2578 | pub |
| 2579 | |
| 2580 | |
| 2581 | |
| 2582 | |
| 2583 | |
| 2584 | |
| 2585 | |
| 2586 | |
| 2587 | |
| 2588 | |
| 2589 | |
| 2590 | |
| 2591 | |
| 2592 | |
| 2593 | |
| 2594 | |
| 2595 | |
| 2596 | |
| 2597 | |
| 2598 | |
| 2599 | |
| 2600 | |
| 2601 | |
| 2602 | /// What the search is for: the same pictures cost less to code at the same |
| 2603 | /// fidelity than DC prediction alone can manage. A picture that runs one |
| 2604 | /// way saves far more than a busy one, which is the shape a working |
| 2605 | /// directional pair has. |
| 2606 | |
| 2607 | |
| 2608 | |
| 2609 | |
| 2610 | |
| 2611 | |
| 2612 | |
| 2613 | |
| 2614 | |
| 2615 | |
| 2616 | |
| 2617 | |
| 2618 | |
| 2619 | |
| 2620 | |
| 2621 | |
| 2622 | |
| 2623 | |
| 2624 | |
| 2625 | |
| 2626 | |
| 2627 | /// The pictures a sweep is measured over: two synthetic ones, plus a frame |
| 2628 | /// from each clip named in `EC_AV1_CLIPS` as `path@skip`, colon separated. |
| 2629 | pub |
| 2630 | |
| 2631 | |
| 2632 | |
| 2633 | |
| 2634 | |
| 2635 | |
| 2636 | |
| 2637 | |
| 2638 | |
| 2639 | |
| 2640 | |
| 2641 | |
| 2642 | |
| 2643 | |
| 2644 | |
| 2645 | /// What the six directional modes are worth, per picture, at whatever |
| 2646 | /// `LAMBDA_SCALE` currently is: the rate they save over the seven that read |
| 2647 | /// no further, and how often the search picks one. |
| 2648 | |
| 2649 | |
| 2650 | |
| 2651 | |
| 2652 | |
| 2653 | |
| 2654 | |
| 2655 | |
| 2656 | |
| 2657 | |
| 2658 | |
| 2659 | |
| 2660 | |
| 2661 | |
| 2662 | |
| 2663 | |
| 2664 | |
| 2665 | |
| 2666 | |
| 2667 | |
| 2668 | |
| 2669 | |
| 2670 | |
| 2671 | |
| 2672 | |
| 2673 | |
| 2674 | |
| 2675 | |
| 2676 | |
| 2677 | |
| 2678 | |
| 2679 | |
| 2680 | |
| 2681 | |
| 2682 | |
| 2683 | |
| 2684 | /// A picture whose stripes run along a diagonal, one way or the other. |
| 2685 | /// This is to the directional modes what [`stripes`] is to the vertical and |
| 2686 | /// horizontal pair: a predictor that walked the edge in the wrong direction |
| 2687 | /// would answer the two pictures the same way round. |
| 2688 | pub |
| 2689 | |
| 2690 | |
| 2691 | |
| 2692 | |
| 2693 | |
| 2694 | |
| 2695 | |
| 2696 | |
| 2697 | |
| 2698 | |
| 2699 | /// The mode picked by the most blocks of a picture, ignoring the first |
| 2700 | /// block, which has no neighbours to tell the modes apart with. |
| 2701 | pub |
| 2702 | |
| 2703 | |
| 2704 | |
| 2705 | |
| 2706 | |
| 2707 | |
| 2708 | |
| 2709 | |
| 2710 | |
| 2711 | |
| 2712 | |
| 2713 | |
| 2714 | |
| 2715 | |
| 2716 | |
| 2717 | |
| 2718 | |
| 2719 | |
| 2720 | /// The search has to follow a diagonal the way it runs: stripes down and to |
| 2721 | /// the right are cheapest predicted at 135 degrees, stripes down and to the |
| 2722 | /// left at 45. A walk that stepped the wrong way along the edge, or read |
| 2723 | /// the above row where it should read the left column, would swap these. |
| 2724 | |
| 2725 | |
| 2726 | |
| 2727 | |
| 2728 | |
| 2729 | |
| 2730 | |
| 2731 | |
| 2732 | |
| 2733 | |
| 2734 | |
| 2735 | |
| 2736 | |
| 2737 | |
| 2738 | /// What the directional modes are for: a picture that runs along a diagonal |
| 2739 | /// costs far less to code with them than the seven that read only their own |
| 2740 | /// edges can manage, and a picture that runs no particular way costs no |
| 2741 | /// more. The second half is the one that bites: a mode set the search |
| 2742 | /// cannot price is a mode set that loses rate on content that does not want |
| 2743 | /// it, which is what costing the mode symbol is for. |
| 2744 | |
| 2745 | |
| 2746 | |
| 2747 | |
| 2748 | |
| 2749 | |
| 2750 | |
| 2751 | |
| 2752 | |
| 2753 | |
| 2754 | |
| 2755 | |
| 2756 | |
| 2757 | |
| 2758 | |
| 2759 | |
| 2760 | |
| 2761 | |
| 2762 | |
| 2763 | |
| 2764 | |
| 2765 | |
| 2766 | /// A mode the encoder cannot predict must be refused rather than coded as |
| 2767 | /// something else, and a search with nothing to choose from likewise. |
| 2768 | |
| 2769 | |
| 2770 | |
| 2771 | |
| 2772 | |
| 2773 | |
| 2774 | |
| 2775 | |
| 2776 | |
| 2777 | |
| 2778 | |
| 2779 | |
| 2780 | |
| 2781 | |
| 2782 | |
| 2783 | /// The picture that comes back is the picture that went in, to within the |
| 2784 | /// quantizer. A prediction that read the wrong neighbours, or a block |
| 2785 | /// written into the wrong place, would still decode to what the encoder |
| 2786 | /// reconstructed — it is this gate that says the reconstruction is of the |
| 2787 | /// right picture. |
| 2788 | |
| 2789 | |
| 2790 | |
| 2791 | |
| 2792 | |
| 2793 | |
| 2794 | |
| 2795 | |
| 2796 | |
| 2797 | |
| 2798 | |
| 2799 | |
| 2800 | |
| 2801 | |
| 2802 | |
| 2803 | |
| 2804 | |
| 2805 | |
| 2806 | |
| 2807 | |
| 2808 | /// A finer quantizer costs bits and buys fidelity, and a wider deadzone |
| 2809 | /// does the opposite. Both are monotone, which is what a rate-distortion |
| 2810 | /// loop above this will assume. |
| 2811 | |
| 2812 | |
| 2813 | |
| 2814 | |
| 2815 | |
| 2816 | |
| 2817 | |
| 2818 | |
| 2819 | |
| 2820 | |
| 2821 | |
| 2822 | |
| 2823 | |
| 2824 | |
| 2825 | |
| 2826 | |
| 2827 | |
| 2828 | |
| 2829 | |
| 2830 | |
| 2831 | |
| 2832 | |
| 2833 | |
| 2834 | |
| 2835 | |
| 2836 | |
| 2837 | |
| 2838 | |
| 2839 | |
| 2840 | |
| 2841 | |
| 2842 | |
| 2843 | |
| 2844 | |
| 2845 | |
| 2846 | |
| 2847 | |
| 2848 | |
| 2849 | |
| 2850 | |
| 2851 | |
| 2852 | |
| 2853 | |
| 2854 | |
| 2855 | |
| 2856 | |
| 2857 | |
| 2858 | |
| 2859 | |
| 2860 | |
| 2861 | |
| 2862 | |
| 2863 | |
| 2864 | |
| 2865 | |
| 2866 | |
| 2867 | |
| 2868 | |
| 2869 | |
| 2870 | |
| 2871 | |
| 2872 | |
| 2873 | |
| 2874 | |
| 2875 | |
| 2876 | /// A flat picture is a flat stream: every block predicts its neighbours' |
| 2877 | /// average, which is the picture's own value, and codes nothing. |
| 2878 | |
| 2879 | |
| 2880 | |
| 2881 | |
| 2882 | |
| 2883 | |
| 2884 | |
| 2885 | |
| 2886 | |
| 2887 | |
| 2888 | |
| 2889 | |
| 2890 | |
| 2891 | |
| 2892 | |
| 2893 | |
| 2894 | |
| 2895 | |
| 2896 | |
| 2897 | /// The sizes the encoder refuses, refused for a reason rather than by |
| 2898 | /// panicking somewhere below. Sizes off the 32x32 block grid encode fine |
| 2899 | /// (see `a_frame_round_trips_at_its_own_size`) -- the true frame edge |
| 2900 | /// lands past the halfway point of whichever block it falls in, so |
| 2901 | /// `PARTITION_NONE` or a single gathered split flag still says everything |
| 2902 | /// the spec needs. lane-av1-rect r7 wired the 8x8-leaf path for a 16x16 |
| 2903 | /// leaf straddling on exactly one axis (e.g. 40x32), and lane-av1rect the |
| 2904 | /// both-axes cut (e.g. 40x40, both dims mod 32 == 8), which spec 5.11.4 |
| 2905 | /// codes with NO partition symbol at all -- `PARTITION_SPLIT` inferred, |
| 2906 | /// down to the in-frame 8x8s, no rectangular transform anywhere (the old |
| 2907 | /// refusal here claimed otherwise and was wrong; see |
| 2908 | /// `crate::stream::tests::a_sweep_of_doubly_straddling_sizes_round_trips_ |
| 2909 | /// through_ffmpeg`). No size refusal is left: an 8x8 leaf can never |
| 2910 | /// straddle either, because `MiCols`/`MiRows` are always EVEN (spec |
| 2911 | /// 5.9.5 `compute_image_size`: `2 * ((frame_width + 7) >> 3)`), so the |
| 2912 | /// true edge always lands on an 8-luma-sample boundary in mi terms and a |
| 2913 | /// 4x4 leaf -- which neither writer has -- is never asked for. What is |
| 2914 | /// still refused is a malformed picture. |
| 2915 | |
| 2916 | |
| 2917 | |
| 2918 | |
| 2919 | |
| 2920 | |
| 2921 | |
| 2922 | |
| 2923 | |
| 2924 | |
| 2925 | |
| 2926 | |
| 2927 | |
| 2928 | |
| 2929 | /// 40x32: cols mod 32 == 8, so the true edge cuts a 16x16 leaf's own |
| 2930 | /// column half only (`has_half` false on cols, true on rows) -- exactly |
| 2931 | /// the single-axis straddle lane-av1-rect r7 wires through |
| 2932 | /// `crate::tile::write_leaf8`'s 8x8 leaves. Not yet decoder-clean: |
| 2933 | /// dav1d rejects the stream ("Invalid data found"). r7's falsification |
| 2934 | /// candidate (`partition_w8`'s ctx reading the enclosing 16x16 slot) is |
| 2935 | /// FALSIFIED by r8's rng trace against a debug `aomdec`: libaom's own |
| 2936 | /// `partition_plane_context` masks at `bsl = 0` for `BLOCK_8X8`, and every |
| 2937 | /// `partition_context_lookup` entry this writer ever produces (no 4x4 |
| 2938 | /// splits exist) has bit 0 clear, so the ctx is provably 0 for every |
| 2939 | /// leaf regardless of neighbour state -- our writer already agreed with |
| 2940 | /// the decoder here (`ctx=0` both sides). r8 still ported the mi-precise |
| 2941 | /// tracking (`Neighbours::{above,left}_side_mi`, `partition_ctx_mi`) as a |
| 2942 | /// spec-accurate fix in its own right (it matters once 4x4 exists), and |
| 2943 | /// it does not regress the gate. r11 tell-for-tell traced two further, |
| 2944 | /// real bugs and fixed both: (1) `write_leaf8`'s intra-mode context read |
| 2945 | /// the *enclosing* 16x16 slot's stale `above_mode`/`left_mode` for both |
| 2946 | /// leaves, when the second leaf's true above (or left) neighbour is the |
| 2947 | /// first leaf itself -- fixed by threading the first leaf's mode into the |
| 2948 | /// second leaf's context, mi-precise, like `record_mi` already does for |
| 2949 | /// coefficients; (2) `TxbSet::Luma8`'s transform-type table was |
| 2950 | /// `INTRA_TX_TYPE_SET1_8` (`TX_SET_INTRA_1`, 7-way, correct only when |
| 2951 | /// `reduced_tx_set` is false), but this crate's key frames set |
| 2952 | /// `reduced_tx_set: true`, which per `get_tx_set` (spec 5.11.48) puts |
| 2953 | /// *every* intra size up to 16x16 -- not only 16x16 -- on `TX_SET_INTRA_2` |
| 2954 | /// (5-way); the wrong cardinality read enough of the stream as `TX_TYPE` |
| 2955 | /// symbol bits to desync everything after it. Fixed with a new |
| 2956 | /// `INTRA_TX_TYPE_SET2_8` (libaom's flat default for that exact |
| 2957 | /// eset/size slot). Both fixes are provably correct against libaom |
| 2958 | /// source and each closed part of the gap (leaf0's `eob` went from a |
| 2959 | /// desynced 36 to a near-miss 3, writer's real eob is 7), but a residual |
| 2960 | /// divergence remained in the `EOB_PT` symbol's decoded value despite an |
| 2961 | /// aligned bit cost. r12 traced that residual with a fresh dual-trace |
| 2962 | /// (do not reuse r11's committed logs, which predate its own fixes) and |
| 2963 | /// found two more real bugs, both now fixed: (3) `write_leaf8` hardcoded |
| 2964 | /// `cfl: false` for `write_intra_mode`'s chroma-mode CDF choice, but |
| 2965 | /// `is_cfl_allowed` (spec 5.11.5) is true for any block `<= 32x32` -- |
| 2966 | /// every other `write_block` caller at 16x16 and up already passes |
| 2967 | /// `true`; the narrower `uv_mode_no_cfl` alphabet is one symbol short of |
| 2968 | /// `uv_mode_cfl`, so even an identical `DC_PRED` decision consumed a |
| 2969 | /// different amount of arithmetic range and derailed everything after |
| 2970 | /// it. (4) `record()`'s `above_mode`/`left_mode` write is a no-op at an |
| 2971 | /// 8x8 leaf's own side (`side / SUB == 0` for `SUB` = 16), and |
| 2972 | /// `write_leaf8` called only `record_mi` (the coefficient-context half), |
| 2973 | /// never updating those coarse arrays itself -- so a *second* straddling |
| 2974 | /// 16x16 quadrant stacked above or left of the first (never covered by |
| 2975 | /// r11's same-call `prev_leaf` override, which only threads state |
| 2976 | /// between the two leaves of one shared quadrant) read whatever stale |
| 2977 | /// mode sat in that slot before either leaf ran. Fixed by writing the |
| 2978 | /// leaf's own mode into `above_mode[c]`/`left_mode[r]` directly. Fixing |
| 2979 | /// (3) alone shrank the tell drift after leaf(0,8) from a decoder |
| 2980 | /// `eob_pt=3` (wrong) vs the writer's real `eob_pt=4` down to a `tell` |
| 2981 | /// offset of a single unit; fixing (3)+(4) together still leaves a |
| 2982 | /// residual divergence one leaf further in -- the decoder now reads |
| 2983 | /// leaf(2,8)'s own luma coefficient block as `txs_ctx=1` (a 32-sample |
| 2984 | /// transform) where the writer intends `TX_8X8` (`txs_ctx=2`), meaning |
| 2985 | /// something *before* this leaf's own `EC_TXBSKIP`/`EC_TXTYPE` still |
| 2986 | /// desyncs the stream by exactly the width of one earlier symbol -- not |
| 2987 | /// yet isolated to a single named symbol. r15 found the last bug: the |
| 2988 | /// header fix from r14 explained the rng skew fully, and the remaining |
| 2989 | /// desync (still past `mi_row=4`) was `write_leaf8`'s (4) fix itself -- |
| 2990 | /// its `above_mode[c]`/`left_mode[r]` forced write ran *inside* the leaf |
| 2991 | /// loop, once per leaf, so the first leaf's write clobbered the true |
| 2992 | /// external neighbour mode the second leaf of the *same* straddling |
| 2993 | /// quadrant still needed for its non-adjacency axis (a column-straddle |
| 2994 | /// case: two leaves share one `outer_at` column index, so leaf 1's |
| 2995 | /// write to `left_mode[r]` overwrote the real western neighbour before |
| 2996 | /// leaf 2 read it). Fixed by moving the write out of `write_leaf8` and |
| 2997 | /// doing it once, after the whole leaf loop, from the last (bottom/ |
| 2998 | /// right-most) leaf's mode. The stream now round-trips through ffmpeg. |
| 2999 | |
| 3000 | |
| 3001 | |
| 3002 | |
| 3003 | |
| 3004 | |
| 3005 | |
| 3006 | |
| 3007 | |
| 3008 | |
| 3009 | |
| 3010 | |
| 3011 | |
| 3012 | |
| 3013 | |
| 3014 | |
| 3015 | |
| 3016 | |
| 3017 | |
| 3018 | |
| 3019 | |
| 3020 | |
| 3021 | |
| 3022 | |
| 3023 | /// A frame of real video, rather than a picture built to be easy. |
| 3024 | /// |
| 3025 | /// `EC_AV1_CLIP` names the clip and `EC_AV1_CLIP_SKIP` how far into it to |
| 3026 | /// seek; ffmpeg decodes one frame, crops it to the block grid, and the |
| 3027 | /// encoder's reconstruction has to survive the same equality gate as the |
| 3028 | /// synthetic pictures — real video reaches contexts a test card does not. |
| 3029 | |
| 3030 | |
| 3031 | |
| 3032 | |
| 3033 | |
| 3034 | |
| 3035 | |
| 3036 | |
| 3037 | |
| 3038 | |
| 3039 | |
| 3040 | |
| 3041 | |
| 3042 | |
| 3043 | |
| 3044 | |
| 3045 | |
| 3046 | |
| 3047 | |
| 3048 | |
| 3049 | |
| 3050 | |
| 3051 | |
| 3052 | |
| 3053 | |
| 3054 | |
| 3055 | |
| 3056 | |
| 3057 | |
| 3058 | |
| 3059 | |
| 3060 | |
| 3061 | |
| 3062 | |
| 3063 | |
| 3064 | /// [`test_card`], panned `shift` samples to the right (wrapping), so a |
| 3065 | /// sequence of these is a translation a motion search can actually find |
| 3066 | /// — the content [`test_card`] itself draws, not a fresh pattern, so an |
| 3067 | /// inter frame's rate against the key frame's is measuring the same |
| 3068 | /// picture moving, not two different pictures. |
| 3069 | pub |
| 3070 | |
| 3071 | |
| 3072 | |
| 3073 | |
| 3074 | |
| 3075 | |
| 3076 | |
| 3077 | |
| 3078 | |
| 3079 | |
| 3080 | |
| 3081 | |
| 3082 | |
| 3083 | |
| 3084 | |
| 3085 | |
| 3086 | |
| 3087 | |
| 3088 | |
| 3089 | |
| 3090 | |
| 3091 | |
| 3092 | |
| 3093 | |
| 3094 | |
| 3095 | |
| 3096 | |
| 3097 | |
| 3098 | /// Decodes `frames` concatenated 4:2:0 frames out of one AV1 OBU stream. |
| 3099 | pub |
| 3100 | |
| 3101 | |
| 3102 | |
| 3103 | |
| 3104 | |
| 3105 | |
| 3106 | |
| 3107 | |
| 3108 | |
| 3109 | |
| 3110 | |
| 3111 | |
| 3112 | |
| 3113 | |
| 3114 | |
| 3115 | |
| 3116 | |
| 3117 | |
| 3118 | |
| 3119 | |
| 3120 | |
| 3121 | |
| 3122 | |
| 3123 | |
| 3124 | |
| 3125 | |
| 3126 | |
| 3127 | |
| 3128 | |
| 3129 | |
| 3130 | |
| 3131 | |
| 3132 | |
| 3133 | |
| 3134 | |
| 3135 | |
| 3136 | |
| 3137 | |
| 3138 | |
| 3139 | |
| 3140 | |
| 3141 | |
| 3142 | |
| 3143 | |
| 3144 | |
| 3145 | |
| 3146 | |
| 3147 | /// The same claim [`ffmpeg_decodes_exactly_what_the_encoder_reconstructed`] |
| 3148 | /// makes for a key frame, extended down the reference chain: each inter |
| 3149 | /// frame's reconstruction predicts from the previous frame's own decoded |
| 3150 | /// reconstruction, so a single sample of drift anywhere would propagate |
| 3151 | /// into every frame after it -- which is why every frame is checked, not |
| 3152 | /// just the last one, and why this is an equality and not a tolerance. |
| 3153 | |
| 3154 | |
| 3155 | |
| 3156 | |
| 3157 | |
| 3158 | |
| 3159 | |
| 3160 | |
| 3161 | |
| 3162 | |
| 3163 | |
| 3164 | |
| 3165 | |
| 3166 | |
| 3167 | |
| 3168 | |
| 3169 | |
| 3170 | |
| 3171 | |
| 3172 | |
| 3173 | |
| 3174 | |
| 3175 | |
| 3176 | |
| 3177 | |
| 3178 | |
| 3179 | |
| 3180 | |
| 3181 | |
| 3182 | |
| 3183 | |
| 3184 | |
| 3185 | |
| 3186 | |
| 3187 | |
| 3188 | |
| 3189 | |
| 3190 | |
| 3191 | |
| 3192 | |
| 3193 | // The same sequence through OUR OWN decoder, sample-exact against the |
| 3194 | // encoder's reconstruction. ffmpeg stays the bitstream oracle |
| 3195 | // ([[shared-oracle-blindness]]) -- but a stream ffmpeg REFUSES yields no |
| 3196 | // divergence point at all, while our decoder can be traced symbol by |
| 3197 | // symbol (`EC_TRACE_MODE_STEP`) on the very stream that broke. This is |
| 3198 | // the instrument the inter `TxMode::Select` hunt lacked; on failure it |
| 3199 | // names the first differing frame, plane and position. |
| 3200 | // lane-sb128b: the writer used to price a `NEWMV` residual against |
| 3201 | // `stack.pred_mv` whenever the SEARCH chose a `ref_mv_idx` the |
| 3202 | // write-time stack could not carry, while the drl symbols signalled the |
| 3203 | // clamped index -- so the decoder derived a DIFFERENT motion vector with |
| 3204 | // the entropy stream still in sync, and the drift only surfaced frames |
| 3205 | // later as a drl desync (on film B, as the encoder's own trial decode |
| 3206 | // refusing a reference slot). |
| 3207 | // |
| 3208 | // The clamp needs a stack that shrinks between search and write, which |
| 3209 | // is what a 128x128 superblock's visit order does; the counter is the |
| 3210 | // point (class `gate-blind-to-feature`): a green round trip on a clip |
| 3211 | // that never clamps proves nothing. |
| 3212 | // |
| 3213 | // `#[ignore]`: [`force_sb128`] moves a process-global. |
| 3214 | // |
| 3215 | // The drl-clamp cell this gate's counter used to gate is no longer gated |
| 3216 | // here: it is covered by |
| 3217 | // [`every_drl_index_the_new_mv_pricer_offers_is_one_the_writer_can_signal`], |
| 3218 | // which enumerates the pricer's offer set against the writer's rule (see |
| 3219 | // its doc). The clamp needs a stack that shrinks between search and |
| 3220 | // write, which is what a 128x128 superblock's visit order would do -- but |
| 3221 | // the pricer never offers an index this tree's `write_drl_idx` cannot |
| 3222 | // signal, so no clip can provoke it (lane-av1recipehunt: 153 attempts, 0; |
| 3223 | // widening the pricer to `0..5` fires the counter immediately, reverting |
| 3224 | // silences it). `drl_clamp_hits` is kept as the tripwire for that fix. |
| 3225 | |
| 3226 | /// lane-b128: the 128x128 `PARTITION_NONE` root -- one block, one mode |
| 3227 | /// and one motion vector where the four 64x64 roots below spend four of |
| 3228 | /// each (cen3's L1). The counter is the gate on the fixture (class |
| 3229 | /// `gate-blind-to-feature`): a green round trip on a clip that never |
| 3230 | /// codes a 128x128 block proves nothing. RED before the search existed |
| 3231 | /// (zero such blocks coded, `tile::write_sb128_root` wrote SPLIT at every |
| 3232 | /// root by construction). |
| 3233 | /// |
| 3234 | /// Both readers: our own decoder sample-exact against the encoder's |
| 3235 | /// reconstruction (a writer/reader desync surfaces as a pixel miss or a |
| 3236 | /// refusal here, not in the BD gate) AND ffmpeg as the bitstream oracle. |
| 3237 | /// |
| 3238 | /// `#[ignore]`: [`force_sb128`] moves a process-global. |
| 3239 | /// |
| 3240 | /// Runs only inside `superblock_size_global_suite`. |
| 3241 | |
| 3242 | |
| 3243 | |
| 3244 | |
| 3245 | |
| 3246 | |
| 3247 | |
| 3248 | |
| 3249 | |
| 3250 | |
| 3251 | |
| 3252 | |
| 3253 | |
| 3254 | |
| 3255 | |
| 3256 | |
| 3257 | |
| 3258 | |
| 3259 | |
| 3260 | |
| 3261 | |
| 3262 | |
| 3263 | |
| 3264 | |
| 3265 | |
| 3266 | |
| 3267 | |
| 3268 | |
| 3269 | |
| 3270 | |
| 3271 | |
| 3272 | |
| 3273 | |
| 3274 | |
| 3275 | |
| 3276 | |
| 3277 | |
| 3278 | |
| 3279 | |
| 3280 | |
| 3281 | |
| 3282 | |
| 3283 | |
| 3284 | |
| 3285 | |
| 3286 | |
| 3287 | |
| 3288 | |
| 3289 | |
| 3290 | |
| 3291 | |
| 3292 | |
| 3293 | |
| 3294 | |
| 3295 | |
| 3296 | |
| 3297 | |
| 3298 | |
| 3299 | |
| 3300 | |
| 3301 | |
| 3302 | |
| 3303 | |
| 3304 | |
| 3305 | |
| 3306 | |
| 3307 | |
| 3308 | |
| 3309 | |
| 3310 | |
| 3311 | |
| 3312 | |
| 3313 | |
| 3314 | |
| 3315 | |
| 3316 | |
| 3317 | |
| 3318 | /// lane-b128r: the 128 root's own RESIDUAL arm -- four TX_64X64 luma |
| 3319 | /// units interleaved with a TX_32X32 chroma pair per 64x64 mu chunk. The |
| 3320 | /// same pan the skip-only witness above uses, with the arm FORCED |
| 3321 | /// ([`force_b128_residual`]): on synthetic bars the RD picks the residual |
| 3322 | /// about once per frame, which witnesses the shape but not every context |
| 3323 | /// it reads, and forcing codes all 420 roots of the clip through it. RED |
| 3324 | /// before this lane by construction (`write_inter_block_128` refused |
| 3325 | /// every non-skip 128 block, so no such block existed to decode), and RED |
| 3326 | /// again on the first draft of the writer, whose neighbour band recorded |
| 3327 | /// `skip = true` for a block that carries a residual -- the next root's |
| 3328 | /// `skip` symbol then took CDF row 1 where the reader takes row 0. |
| 3329 | /// |
| 3330 | /// lane-b128res: the fixture's q moved 150 -> 60. The forced arm replaces |
| 3331 | /// the skip arm's cost unconditionally (that is what makes the writer see |
| 3332 | /// the residual), and the cost model moved under it since lane-b128r -- |
| 3333 | /// lane-rectdq made every non-skipped root pay its delta_q group and the |
| 3334 | /// pyramid re-prices the leaves -- so at q=150, then q=90, the NONE root |
| 3335 | /// lost its partition at ALL 420 roots and the writer coded none. q=60 |
| 3336 | /// puts 52 written blocks back on this clip; the `coded > 0` assert below |
| 3337 | /// is the guard that catches the next such drift. |
| 3338 | /// |
| 3339 | /// Runs only inside `superblock_size_global_suite`. |
| 3340 | |
| 3341 | |
| 3342 | |
| 3343 | |
| 3344 | |
| 3345 | |
| 3346 | |
| 3347 | |
| 3348 | |
| 3349 | |
| 3350 | |
| 3351 | |
| 3352 | |
| 3353 | |
| 3354 | |
| 3355 | |
| 3356 | |
| 3357 | |
| 3358 | |
| 3359 | |
| 3360 | |
| 3361 | |
| 3362 | |
| 3363 | |
| 3364 | |
| 3365 | |
| 3366 | |
| 3367 | |
| 3368 | |
| 3369 | |
| 3370 | |
| 3371 | |
| 3372 | |
| 3373 | |
| 3374 | |
| 3375 | |
| 3376 | |
| 3377 | |
| 3378 | |
| 3379 | |
| 3380 | |
| 3381 | |
| 3382 | |
| 3383 | |
| 3384 | |
| 3385 | |
| 3386 | |
| 3387 | |
| 3388 | |
| 3389 | |
| 3390 | |
| 3391 | |
| 3392 | |
| 3393 | |
| 3394 | |
| 3395 | |
| 3396 | |
| 3397 | |
| 3398 | |
| 3399 | |
| 3400 | |
| 3401 | |
| 3402 | |
| 3403 | |
| 3404 | |
| 3405 | |
| 3406 | |
| 3407 | |
| 3408 | |
| 3409 | |
| 3410 | |
| 3411 | |
| 3412 | |
| 3413 | |
| 3414 | /// lane-edge128: a 128x128 root block WITH a residual on a clip whose |
| 3415 | /// CDEF search codes a per-64x64 `cdef_idx` list. `read_cdef` (spec |
| 3416 | /// 5.11.56) codes ONE literal for the block that first reaches a unit and |
| 3417 | /// copies it over every unit the block SPANS, so the four units of a 128 |
| 3418 | /// root share one index -- while the encoder's CDEF search prices a |
| 3419 | /// preset per unit and its filter replay applied all four. Only the first |
| 3420 | /// reached the stream, so every decoder filtered the other three with the |
| 3421 | /// origin's strengths and the encoder's reconstruction (the picture the |
| 3422 | /// next frame predicts from) was a filter apart from what a decoder |
| 3423 | /// produces. RED before this lane on the native BD gate's bars 2160p row |
| 3424 | /// (`EC_AV1_B128RES=1`, q=90, frame 11: 8 luma and 702 chroma samples, |
| 3425 | /// the rows above the 128 superblock's own edge); the stream itself was |
| 3426 | /// always right -- ffmpeg and our own decoder agreed with each other and |
| 3427 | /// disagreed with the encoder. |
| 3428 | /// |
| 3429 | /// `take_cdef_covered_units` is the gate on the fixture (class |
| 3430 | /// `gate-blind-to-feature`): a clip whose CDEF picks one strength pair |
| 3431 | /// for the whole frame codes no literal at all and witnesses nothing. |
| 3432 | /// |
| 3433 | /// Runs only inside `superblock_size_global_suite`. |
| 3434 | |
| 3435 | |
| 3436 | |
| 3437 | |
| 3438 | |
| 3439 | |
| 3440 | |
| 3441 | |
| 3442 | |
| 3443 | |
| 3444 | |
| 3445 | |
| 3446 | |
| 3447 | |
| 3448 | |
| 3449 | |
| 3450 | |
| 3451 | |
| 3452 | |
| 3453 | |
| 3454 | |
| 3455 | |
| 3456 | |
| 3457 | |
| 3458 | |
| 3459 | |
| 3460 | |
| 3461 | |
| 3462 | |
| 3463 | |
| 3464 | |
| 3465 | |
| 3466 | |
| 3467 | |
| 3468 | |
| 3469 | |
| 3470 | |
| 3471 | |
| 3472 | |
| 3473 | |
| 3474 | |
| 3475 | |
| 3476 | |
| 3477 | |
| 3478 | |
| 3479 | |
| 3480 | |
| 3481 | |
| 3482 | |
| 3483 | |
| 3484 | |
| 3485 | |
| 3486 | |
| 3487 | |
| 3488 | |
| 3489 | |
| 3490 | |
| 3491 | |
| 3492 | |
| 3493 | |
| 3494 | |
| 3495 | |
| 3496 | |
| 3497 | |
| 3498 | |
| 3499 | |
| 3500 | |
| 3501 | |
| 3502 | |
| 3503 | |
| 3504 | |
| 3505 | |
| 3506 | |
| 3507 | |
| 3508 | |
| 3509 | /// lane-rectres: a `PARTITION_HORZ` 128 root whose two 128x64 halves |
| 3510 | /// CARRY A RESIDUAL -- the mu-chunk shape (one TX_64X64 luma unit plus a |
| 3511 | /// TX_32X32 chroma pair per chunk) `write_inter_block_128_rect` now |
| 3512 | /// codes under `EC_AV1_RECTRES`, at the footprint the decoder's own |
| 3513 | /// mu-chunk loop reads. The arm is FORCED ([`force_b128_rectres`], the |
| 3514 | /// rect partition with [`force_b128_rect`]) so every inter root of the |
| 3515 | /// clip goes through it; the `coded > 0` assert is the guard that catches |
| 3516 | /// the next fixture drift (the whole-128 twin of this witness went RED |
| 3517 | /// twice that way). |
| 3518 | /// |
| 3519 | /// Runs only inside `superblock_size_global_suite`. |
| 3520 | |
| 3521 | |
| 3522 | |
| 3523 | |
| 3524 | |
| 3525 | |
| 3526 | |
| 3527 | |
| 3528 | |
| 3529 | |
| 3530 | |
| 3531 | |
| 3532 | |
| 3533 | |
| 3534 | |
| 3535 | |
| 3536 | |
| 3537 | |
| 3538 | |
| 3539 | |
| 3540 | |
| 3541 | |
| 3542 | |
| 3543 | |
| 3544 | |
| 3545 | |
| 3546 | |
| 3547 | |
| 3548 | |
| 3549 | |
| 3550 | |
| 3551 | |
| 3552 | |
| 3553 | |
| 3554 | |
| 3555 | |
| 3556 | |
| 3557 | |
| 3558 | |
| 3559 | |
| 3560 | |
| 3561 | |
| 3562 | |
| 3563 | |
| 3564 | |
| 3565 | |
| 3566 | |
| 3567 | |
| 3568 | |
| 3569 | |
| 3570 | |
| 3571 | |
| 3572 | |
| 3573 | |
| 3574 | |
| 3575 | |
| 3576 | |
| 3577 | |
| 3578 | |
| 3579 | |
| 3580 | |
| 3581 | |
| 3582 | |
| 3583 | |
| 3584 | |
| 3585 | |
| 3586 | |
| 3587 | |
| 3588 | |
| 3589 | |
| 3590 | |
| 3591 | |
| 3592 | |
| 3593 | |
| 3594 | |
| 3595 | /// lane-rectres: an AB shape (`PARTITION_HORZ_A` forced) whose THREE |
| 3596 | /// pieces carry residuals -- the 128x64 half through the two-chunk arm, |
| 3597 | /// the two 64x64 squares through the one-chunk arm (the shape libaom's |
| 3598 | /// own AB partitions earn their keep with). testsrc2 at 12 frames, the |
| 3599 | /// shipped AB witness's own recipe: an 8-frame clip parks an ARF whose |
| 3600 | /// reference picture the GOP has not produced yet, which refuses before |
| 3601 | /// any AB root is coded. |
| 3602 | /// |
| 3603 | /// Runs only inside `superblock_size_global_suite`. |
| 3604 | |
| 3605 | |
| 3606 | |
| 3607 | |
| 3608 | |
| 3609 | |
| 3610 | |
| 3611 | |
| 3612 | |
| 3613 | |
| 3614 | |
| 3615 | |
| 3616 | |
| 3617 | |
| 3618 | |
| 3619 | |
| 3620 | |
| 3621 | |
| 3622 | |
| 3623 | |
| 3624 | |
| 3625 | |
| 3626 | |
| 3627 | |
| 3628 | |
| 3629 | |
| 3630 | |
| 3631 | |
| 3632 | |
| 3633 | |
| 3634 | |
| 3635 | |
| 3636 | |
| 3637 | |
| 3638 | |
| 3639 | |
| 3640 | |
| 3641 | |
| 3642 | |
| 3643 | |
| 3644 | |
| 3645 | |
| 3646 | |
| 3647 | |
| 3648 | |
| 3649 | |
| 3650 | |
| 3651 | |
| 3652 | |
| 3653 | |
| 3654 | |
| 3655 | |
| 3656 | |
| 3657 | |
| 3658 | |
| 3659 | |
| 3660 | |
| 3661 | |
| 3662 | |
| 3663 | |
| 3664 | |
| 3665 | |
| 3666 | |
| 3667 | |
| 3668 | |
| 3669 | |
| 3670 | |
| 3671 | |
| 3672 | |
| 3673 | |
| 3674 | |
| 3675 | |
| 3676 | |
| 3677 | |
| 3678 | /// lane-rectres, lane-edge128's interaction on the rect shapes: a HORZ |
| 3679 | /// half WITH a residual under a clip whose CDEF search codes a |
| 3680 | /// per-64x64 `cdef_idx` list. The half codes ONE literal at its origin |
| 3681 | /// and the decoder stamps BOTH units it spans with it, so the owner map |
| 3682 | /// ([`crate::tile::cdef_unit_owner`], now extended past Whole128) has to |
| 3683 | /// collapse the pair -- exactly the bug class that broke bars 2160p at |
| 3684 | /// the whole-128 root. RED before this lane by construction: no rect |
| 3685 | /// piece could carry a residual, so no such literal existed. |
| 3686 | /// |
| 3687 | /// Runs only inside `superblock_size_global_suite`. |
| 3688 | |
| 3689 | |
| 3690 | |
| 3691 | |
| 3692 | |
| 3693 | |
| 3694 | |
| 3695 | |
| 3696 | |
| 3697 | |
| 3698 | |
| 3699 | |
| 3700 | |
| 3701 | |
| 3702 | |
| 3703 | |
| 3704 | |
| 3705 | |
| 3706 | |
| 3707 | |
| 3708 | |
| 3709 | |
| 3710 | |
| 3711 | |
| 3712 | |
| 3713 | |
| 3714 | |
| 3715 | |
| 3716 | |
| 3717 | |
| 3718 | |
| 3719 | |
| 3720 | |
| 3721 | |
| 3722 | |
| 3723 | |
| 3724 | |
| 3725 | |
| 3726 | |
| 3727 | |
| 3728 | |
| 3729 | |
| 3730 | |
| 3731 | |
| 3732 | |
| 3733 | |
| 3734 | |
| 3735 | |
| 3736 | |
| 3737 | |
| 3738 | |
| 3739 | |
| 3740 | |
| 3741 | |
| 3742 | |
| 3743 | |
| 3744 | |
| 3745 | |
| 3746 | |
| 3747 | |
| 3748 | |
| 3749 | |
| 3750 | |
| 3751 | |
| 3752 | |
| 3753 | |
| 3754 | |
| 3755 | |
| 3756 | |
| 3757 | |
| 3758 | |
| 3759 | |
| 3760 | /// lane-b128r: the COMPOUND arm at the 128 root -- one 128x128 block |
| 3761 | /// naming `LAST` plus `GOLDEN`/`ALTREF`, through the same |
| 3762 | /// `write_compound_block` chain every smaller compound block takes, at a |
| 3763 | /// window it had never been exercised at. RED before this lane: the |
| 3764 | /// search passed an empty compound list at the 128 root, so the count was |
| 3765 | /// 0 and no such block existed to decode. |
| 3766 | /// |
| 3767 | /// Runs only inside `superblock_size_global_suite`. |
| 3768 | |
| 3769 | |
| 3770 | |
| 3771 | |
| 3772 | |
| 3773 | |
| 3774 | |
| 3775 | |
| 3776 | |
| 3777 | |
| 3778 | |
| 3779 | |
| 3780 | |
| 3781 | |
| 3782 | |
| 3783 | |
| 3784 | |
| 3785 | |
| 3786 | |
| 3787 | |
| 3788 | |
| 3789 | |
| 3790 | |
| 3791 | |
| 3792 | |
| 3793 | |
| 3794 | |
| 3795 | |
| 3796 | |
| 3797 | |
| 3798 | |
| 3799 | |
| 3800 | |
| 3801 | |
| 3802 | |
| 3803 | |
| 3804 | |
| 3805 | |
| 3806 | |
| 3807 | |
| 3808 | |
| 3809 | |
| 3810 | |
| 3811 | |
| 3812 | |
| 3813 | |
| 3814 | |
| 3815 | |
| 3816 | |
| 3817 | |
| 3818 | |
| 3819 | |
| 3820 | |
| 3821 | |
| 3822 | |
| 3823 | |
| 3824 | |
| 3825 | |
| 3826 | |
| 3827 | |
| 3828 | |
| 3829 | |
| 3830 | |
| 3831 | |
| 3832 | |
| 3833 | |
| 3834 | |
| 3835 | |
| 3836 | |
| 3837 | |
| 3838 | |
| 3839 | |
| 3840 | /// lane-b128hv: the 128 root's `PARTITION_HORZ` and `PARTITION_VERT` |
| 3841 | /// arms -- two 128x64 / 64x128 inter blocks where the NONE arm codes one |
| 3842 | /// square. Three passes over one `testsrc2` clip: |
| 3843 | /// |
| 3844 | /// * HORZ forced at every root ([`force_b128_rect`]), so every context |
| 3845 | /// the 128x64 shape reads is exercised rather than the handful the RD |
| 3846 | /// would pick; |
| 3847 | /// * VERT forced the same way; |
| 3848 | /// * UNFORCED, which is the count the gate rows are read against -- the |
| 3849 | /// same clip with the RD free to choose among NONE / HORZ / VERT / |
| 3850 | /// four superblocks. |
| 3851 | /// |
| 3852 | /// Each pass is sample-exact against the encoder's own reconstruction |
| 3853 | /// through `decode_stream` AND through ffmpeg; a writer/reader mismatch |
| 3854 | /// surfaces here as a refusal or a pixel miss, never in the BD gate. RED |
| 3855 | /// before this lane by construction: `write_sb128_root` could only name |
| 3856 | /// `PARTITION_NONE` or `PARTITION_SPLIT`, so the count was 0 on all three. |
| 3857 | /// |
| 3858 | /// Runs only inside `superblock_size_global_suite`. |
| 3859 | |
| 3860 | |
| 3861 | |
| 3862 | |
| 3863 | |
| 3864 | |
| 3865 | |
| 3866 | |
| 3867 | |
| 3868 | |
| 3869 | |
| 3870 | |
| 3871 | |
| 3872 | |
| 3873 | |
| 3874 | |
| 3875 | |
| 3876 | |
| 3877 | |
| 3878 | |
| 3879 | |
| 3880 | |
| 3881 | |
| 3882 | |
| 3883 | |
| 3884 | |
| 3885 | |
| 3886 | |
| 3887 | |
| 3888 | |
| 3889 | |
| 3890 | |
| 3891 | |
| 3892 | |
| 3893 | |
| 3894 | |
| 3895 | |
| 3896 | |
| 3897 | |
| 3898 | |
| 3899 | |
| 3900 | |
| 3901 | |
| 3902 | |
| 3903 | |
| 3904 | |
| 3905 | |
| 3906 | |
| 3907 | |
| 3908 | |
| 3909 | |
| 3910 | |
| 3911 | |
| 3912 | |
| 3913 | |
| 3914 | |
| 3915 | |
| 3916 | |
| 3917 | |
| 3918 | |
| 3919 | |
| 3920 | |
| 3921 | |
| 3922 | |
| 3923 | |
| 3924 | |
| 3925 | |
| 3926 | |
| 3927 | |
| 3928 | |
| 3929 | |
| 3930 | |
| 3931 | |
| 3932 | |
| 3933 | |
| 3934 | |
| 3935 | |
| 3936 | |
| 3937 | |
| 3938 | |
| 3939 | |
| 3940 | |
| 3941 | |
| 3942 | |
| 3943 | |
| 3944 | |
| 3945 | |
| 3946 | |
| 3947 | |
| 3948 | |
| 3949 | |
| 3950 | /// Restores the process-global 128-superblock state the folded cases move: |
| 3951 | /// the sb128 mode back to its prior value, and every `force_b128_*` arm back |
| 3952 | /// to off, so one case cannot leak into the next. |
| 3953 | |
| 3954 | |
| 3955 | |
| 3956 | |
| 3957 | |
| 3958 | |
| 3959 | |
| 3960 | |
| 3961 | |
| 3962 | /// The ten cases that set the process-global superblock size, folded into |
| 3963 | /// one ignored test so they never share a process with another such test. |
| 3964 | /// Each case runs under `catch_unwind`; every failing name is reported. |
| 3965 | /// |
| 3966 | /// cargo test -p ec-av1 --release --lib -- --ignored \ |
| 3967 | /// superblock_size_global_suite --nocapture |
| 3968 | |
| 3969 | |
| 3970 | |
| 3971 | |
| 3972 | |
| 3973 | |
| 3974 | |
| 3975 | |
| 3976 | |
| 3977 | |
| 3978 | |
| 3979 | |
| 3980 | |
| 3981 | |
| 3982 | |
| 3983 | |
| 3984 | |
| 3985 | |
| 3986 | |
| 3987 | |
| 3988 | |
| 3989 | |
| 3990 | |
| 3991 | |
| 3992 | |
| 3993 | |
| 3994 | |
| 3995 | |
| 3996 | |
| 3997 | |
| 3998 | |
| 3999 | |
| 4000 | |
| 4001 | |
| 4002 | |
| 4003 | |
| 4004 | |
| 4005 | |
| 4006 | |
| 4007 | |
| 4008 | |
| 4009 | |
| 4010 | |
| 4011 | |
| 4012 | |
| 4013 | |
| 4014 | |
| 4015 | |
| 4016 | |
| 4017 | |
| 4018 | |
| 4019 | |
| 4020 | |
| 4021 | |
| 4022 |