edith_codecs
Clone
https://git.tahinli.com/Tahinli/edith_codecs.git
0 watching0 forksRust370.3 MiB9b67700Tahinli3 days ago4021 commits
| 1 | //! Inter-block context and reference helpers: switchable interp and intra/inter contexts, the OBMC run, compound ref and mv readers. Moved out of `decode/mod.rs` (av1split D9); the items are unchanged apart from `pub(super)` visibility. |
| 2 | |
| 3 | use *; |
| 4 | |
| 5 | /// `av1_get_pred_context_switchable_interp`'s context for `interp_filter[dir]` |
| 6 | /// -- `above`/`left` are the neighbour's own resolved index for this |
| 7 | /// direction (0..=2, or `3` = no info, spec `SWITCHABLE_FILTERS`). |
| 8 | /// `is_compound` folds in libaom `av1_get_pred_context_switchable_interp`'s |
| 9 | /// own `ctx_offset` term (`INTER_FILTER_COMP_OFFSET` = 4, added when *this* |
| 10 | /// block itself has a second reference) -- lane-av1idx: a stale "this |
| 11 | /// decoder never codes a compound reference" assumption baked this to |
| 12 | /// always-0, which desynced the CDF context bucket (not the decoded value |
| 13 | /// outright, hence small pixel deltas rather than a hard desync) the moment |
| 14 | /// lane-av1blend unmasked plain-average compound blocks on a Switchable- |
| 15 | /// filter frame. |
| 16 | pub |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | /// Resolves the interpolation filter kernel(s) an inter block's motion |
| 31 | /// compensation reads (spec 5.11.10/5.11.20): a fixed-filter frame |
| 32 | /// (`interp_fixed = Some`) never reads a symbol; a `Switchable` frame |
| 33 | /// (`interp_fixed = None`) reads `interp_filter[0]` and, when |
| 34 | /// `enable_dual_filter`, a second `interp_filter[1]` -- unless |
| 35 | /// `force_regular` (this block's own `needs_interp_filter() == 0` case: a |
| 36 | /// `GLOBALMV` block, whose global motion is always `IDENTITY` in this |
| 37 | /// decoder's scope, spec 5.11.10's `large && YMode == GLOBALMV` branch), |
| 38 | /// which forces `EIGHTTAP` without reading anything. |
| 39 | |
| 40 | pub |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | |
| 72 | |
| 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 | /// The `is_inter` context (spec 5.11.16 via `av1_get_intra_inter_context`), |
| 103 | /// duplicating [`crate::tile`]'s private copy of the same rule. |
| 104 | pub |
| 105 | |
| 106 | |
| 107 | |
| 108 | |
| 109 | |
| 110 | |
| 111 | |
| 112 | |
| 113 | |
| 114 | |
| 115 | |
| 116 | |
| 117 | |
| 118 | |
| 119 | |
| 120 | |
| 121 | |
| 122 | |
| 123 | |
| 124 | |
| 125 | /// `CLASS0_SIZE << (class + 2)`, duplicating `crate::tile`'s private |
| 126 | /// `mv_class_base` (spec 3): the magnitude an `MV_CLASS_n` component's own |
| 127 | /// bits start counting from. |
| 128 | |
| 129 | |
| 130 | |
| 131 | |
| 132 | /// One motion vector component's non-zero diff (spec 5.11.32 |
| 133 | /// `read_mv_component`), the inverse of [`crate::tile`]'s private |
| 134 | /// `write_mv_component`. |
| 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 | |
| 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 | /// A motion vector coded as a residual against `pred` (spec 5.11.32 |
| 188 | /// `read_mv`), the inverse of [`crate::tile`]'s private `write_mv`. |
| 189 | pub |
| 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 | /// One intrabc block's block vector (spec 5.11.13 `read_intrabc_info` -> |
| 235 | /// `assign_mv` with `use_intrabc`, libaom `assign_dv`/`av1_find_ref_dv`). |
| 236 | /// |
| 237 | /// The predictor is the ordinary MV stack built against `INTRA_FRAME` |
| 238 | /// (`av1_find_mv_refs(..., INTRA_FRAME, ...)`): `nearestmv`, or `nearmv` |
| 239 | /// when that is zero, or -- when both are -- the fixed fallback DV one |
| 240 | /// superblock up, or `INTRABC_DELAY_PIXELS` (256) plus one superblock to the |
| 241 | /// left when this is the tile's first superblock row. The predictor is then |
| 242 | /// rounded to full pel, and the difference reads off the *dv* nmv context |
| 243 | /// (libaom `ndvc`) at full-pel precision (`MV_SUBPEL_NONE`: no `fr`/`hp` |
| 244 | /// symbols, exactly this decoder's `force_integer_mv` carve-out). No DRL |
| 245 | /// symbol is coded for a DV, so none of this can move the bitstream |
| 246 | /// position -- only the reconstructed vector. |
| 247 | pub |
| 248 | |
| 249 | |
| 250 | |
| 251 | |
| 252 | |
| 253 | |
| 254 | |
| 255 | |
| 256 | |
| 257 | |
| 258 | |
| 259 | |
| 260 | |
| 261 | |
| 262 | |
| 263 | |
| 264 | |
| 265 | |
| 266 | |
| 267 | |
| 268 | |
| 269 | |
| 270 | |
| 271 | |
| 272 | |
| 273 | |
| 274 | |
| 275 | |
| 276 | |
| 277 | |
| 278 | |
| 279 | |
| 280 | |
| 281 | |
| 282 | |
| 283 | |
| 284 | |
| 285 | |
| 286 | |
| 287 | |
| 288 | |
| 289 | |
| 290 | |
| 291 | |
| 292 | |
| 293 | |
| 294 | |
| 295 | |
| 296 | |
| 297 | |
| 298 | |
| 299 | |
| 300 | |
| 301 | |
| 302 | |
| 303 | |
| 304 | |
| 305 | |
| 306 | |
| 307 | |
| 308 | |
| 309 | |
| 310 | /// A 1/8-pel motion vector component converted to the 1/16-pel offset |
| 311 | /// [`mc::predict`] takes, duplicating [`crate::encode`]'s private `mv_to_q4` |
| 312 | /// (its own doc comment explains the `*2`/`*1` luma/chroma split). |
| 313 | pub |
| 314 | |
| 315 | |
| 316 | |
| 317 | |
| 318 | |
| 319 | |
| 320 | |
| 321 | |
| 322 | |
| 323 | |
| 324 | |
| 325 | |
| 326 | |
| 327 | |
| 328 | |
| 329 | |
| 330 | |
| 331 | |
| 332 | |
| 333 | |
| 334 | |
| 335 | |
| 336 | |
| 337 | |
| 338 | |
| 339 | |
| 340 | |
| 341 | |
| 342 | |
| 343 | |
| 344 | |
| 345 | |
| 346 | |
| 347 | |
| 348 | |
| 349 | |
| 350 | |
| 351 | |
| 352 | |
| 353 | |
| 354 | |
| 355 | |
| 356 | |
| 357 | |
| 358 | |
| 359 | |
| 360 | |
| 361 | |
| 362 | |
| 363 | |
| 364 | |
| 365 | |
| 366 | |
| 367 | |
| 368 | |
| 369 | |
| 370 | |
| 371 | |
| 372 | |
| 373 | |
| 374 | |
| 375 | |
| 376 | |
| 377 | |
| 378 | |
| 379 | |
| 380 | |
| 381 | |
| 382 | |
| 383 | |
| 384 | |
| 385 | |
| 386 | |
| 387 | |
| 388 | |
| 389 | |
| 390 | |
| 391 | |
| 392 | |
| 393 | |
| 394 | |
| 395 | |
| 396 | |
| 397 | |
| 398 | |
| 399 | |
| 400 | |
| 401 | |
| 402 | |
| 403 | |
| 404 | |
| 405 | |
| 406 | |
| 407 | |
| 408 | |
| 409 | |
| 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 | |
| 443 | /// Reads one inter-coded plane's transform block and reconstructs it by |
| 444 | /// adding its residual onto a motion-compensated `prediction` -- the inter |
| 445 | /// counterpart of [`read_plane`] (every inter transform this decoder reads is |
| 446 | /// `side`-square with no oversized-64 case, so there is no padded-grid |
| 447 | /// branch to mirror). |
| 448 | |
| 449 | pub |
| 450 | |
| 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 | |
| 514 | |
| 515 | |
| 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 | /// The intra twin of [`read_inter_chroma_lossless`]: an INTRA block inside a |
| 566 | /// lossless frame codes its chroma plane as 4x4 transform units, plane-major |
| 567 | /// inside each 64x64 mu chunk (libaom `decode_token_recon_block`'s |
| 568 | /// `for (plane..) for (blk_row..) for (blk_col..)` with `av1_get_tx_size` |
| 569 | /// returning TX_4X4 under `xd->lossless[..]`). CfL never rides here: |
| 570 | /// `is_cfl_allowed` (`blockd.h`) needs a BLOCK_4X4 chroma plane block, i.e. a |
| 571 | /// luma block of 8x8 or less, which the sub-8x8 readers own. |
| 572 | |
| 573 | pub |
| 574 | |
| 575 | |
| 576 | |
| 577 | |
| 578 | |
| 579 | |
| 580 | |
| 581 | |
| 582 | |
| 583 | |
| 584 | |
| 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 | |
| 629 | |
| 630 | |
| 631 | |
| 632 | |
| 633 | |
| 634 | |
| 635 | |
| 636 | |
| 637 | |
| 638 | |
| 639 | |
| 640 | |
| 641 | |
| 642 | |
| 643 | |
| 644 | |
| 645 | |
| 646 | |
| 647 | |
| 648 | |
| 649 | |
| 650 | |
| 651 | |
| 652 | |
| 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 | /// lane-av1h5: the CHUNK-MAJOR token order for a block's var-tx leaf list. |
| 711 | /// |
| 712 | /// libaom's `decode_token_recon_block` (`av1/decoder/decodeframe.c:972`) |
| 713 | /// iterates 64x64 "mu" chunks with the PLANE loop INSIDE the chunk loop: |
| 714 | /// `for (row..) for (col..) { for (plane..) for (blk_row..) for (blk_col..) }`, |
| 715 | /// `blk_row`/`blk_col` restarting at the chunk origin, on a chunk grid of |
| 716 | /// `mi_size_wide[BLOCK_64X64]` = 16 mi per axis. |
| 717 | /// |
| 718 | /// The transform tree hands us a BLOCK-wide raster instead (32 leaves across |
| 719 | /// at 128), whose chunk members are NOT contiguous: leaves 0..15 are chunk |
| 720 | /// (0,0) row 0, but chunk (0,0) rows 1..15 are leaves 32..47, 64..79, ... |
| 721 | /// Walking it as given closes each chunk every SIXTEEN leaves and codes its |
| 722 | /// chroma sixteen times -- 64 chroma walks per 128 root where libaom codes 4, |
| 723 | /// and 24576 chroma units per inter frame against the oracle's 1536. |
| 724 | /// |
| 725 | /// Below 64 a block IS one chunk, so the two orders coincide and the sort is |
| 726 | /// skipped (the returned order is the identity). `changed` is `true` only |
| 727 | /// when the sort actually permutes the list, so a no-op ordering reads zero |
| 728 | /// on [`MU_CHUNK_ORDER_HITS`] and cannot make a gate look armed. |
| 729 | pub |
| 730 | |
| 731 | |
| 732 | |
| 733 | |
| 734 | |
| 735 | |
| 736 | |
| 737 | |
| 738 | |
| 739 | |
| 740 | |
| 741 | |
| 742 | |
| 743 | |
| 744 | |
| 745 | |
| 746 | |
| 747 | /// lane-lossless2: the chroma half of a lossless INTER block. libaom's |
| 748 | /// `read_tx_size` (`av1/decoder/decodeframe.c`) returns TX_4X4 for EVERY |
| 749 | /// plane of a lossless block, so the chroma plane block is a raster of 4x4 |
| 750 | /// transform units instead of one whole-block transform, and |
| 751 | /// `decode_token_recon_block` walks them PLANE-MAJOR inside each 64x64 "mu" |
| 752 | /// chunk (`for (plane..) for (blk_row..) for (blk_col..)`): every U unit of |
| 753 | /// the chunk, then every V unit. Reads one chunk-sized region |
| 754 | /// (`org`/`reg`, chroma pixels relative to the block) and copies its units |
| 755 | /// into the block-sized `u_out`/`v_out` grids. |
| 756 | |
| 757 | pub |
| 758 | |
| 759 | |
| 760 | |
| 761 | |
| 762 | |
| 763 | |
| 764 | |
| 765 | |
| 766 | |
| 767 | |
| 768 | |
| 769 | |
| 770 | |
| 771 | |
| 772 | |
| 773 | |
| 774 | |
| 775 | |
| 776 | |
| 777 | |
| 778 | |
| 779 | |
| 780 | |
| 781 | |
| 782 | |
| 783 | |
| 784 | |
| 785 | |
| 786 | |
| 787 | |
| 788 | |
| 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 | |
| 822 | |
| 823 | |
| 824 | |
| 825 | |
| 826 | |
| 827 | |
| 828 | |
| 829 | |
| 830 | |
| 831 | |
| 832 | |
| 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 | |
| 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 | |
| 893 | |
| 894 | |
| 895 | |
| 896 | |
| 897 | |
| 898 | /// The 8x8 inter leaf's lossless chroma arm (lane-av1-llinter), shared by the |
| 899 | /// single-ref and compound paths, for every plane block BIGGER than 4x4: |
| 900 | /// libaom's `read_tx_size` (`av1/decoder/decodeframe.c:1197`, |
| 901 | /// `if (xd->lossless[xd->mi[0]->segment_id]) return TX_4X4;`) returns TX_4X4 |
| 902 | /// for EVERY plane of a lossless block, not just luma, so the plane block is |
| 903 | /// a raster of TX_4X4 units read by the same per-unit walk the bigger inter |
| 904 | /// blocks run. |
| 905 | /// |
| 906 | /// **The plane block is PER-AXIS**, `av1_ss_size_lookup[BLOCK_8X8][ss_x][ss_y]` |
| 907 | /// (`av1/common/blockd.h:1186`): BLOCK_8X8 at 4:4:4 (2x2 units), BLOCK_4X8 at |
| 908 | /// 4:2:2 (1x2 units), BLOCK_4X4 at 4:2:0 (one unit, `get_txb_ctx`'s |
| 909 | /// `plane_bsize == txsize_to_bsize[tx_size]` branch, ctx_offset 7 -- the one |
| 910 | /// shape that keeps the single-unit read and is NOT routed here). Gating this |
| 911 | /// arm on the 4:4:4 shape instead left 4:2:2 coding its 4x8 plane block as ONE |
| 912 | /// TX_4X8 unit at ctx_offset 7, where libaom reads TWO TX_4X4 units at |
| 913 | /// ctx_offset 10 (`av1/common/txb_common.h:430-433`): the first unit's |
| 914 | /// `txb_skip` symbol then came out of the wrong CDF row, which desynchronised |
| 915 | /// the coder for the rest of the frame. |
| 916 | /// |
| 917 | /// `(blk_w, blk_h)` is that per-axis plane block and `stride` the composed |
| 918 | /// grid's row pitch (the leaf's `chroma_w`); the grids are `stride * blk_h` |
| 919 | /// (`Grid::Zero` when every unit hung off the frame edge) and each unit's own |
| 920 | /// coefficient context is left stamped in the neighbour bands -- the caller's |
| 921 | /// tail must not let its whole-block `record_mi` overwrite them. |
| 922 | |
| 923 | pub |
| 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 | |
| 967 | |
| 968 | |
| 969 | |
| 970 | |
| 971 | |
| 972 | |
| 973 | |
| 974 | |
| 975 | |
| 976 | |
| 977 | |
| 978 | /// Spec 5.11.25's `single_ref_p1`..`p6` tree (reachable only once `comp_mode` |
| 979 | /// is known `SINGLE_REFERENCE` -- `decode_stream` refuses any frame with |
| 980 | /// `reference_select` set before this is ever called, so that read is never |
| 981 | /// needed here). `above_ref`/`left_ref` are `-1` for an intra/unavailable |
| 982 | /// neighbour, else the `1..=7` reference that neighbour coded (lane-av1refs). |
| 983 | pub |
| 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 | |
| 1024 | |
| 1025 | |
| 1026 | |
| 1027 | |
| 1028 | |
| 1029 | |
| 1030 | |
| 1031 | |
| 1032 | |
| 1033 | |
| 1034 | |
| 1035 | |
| 1036 | |
| 1037 | /// Spec 5.11.25's `comp_mode` (lane-av1comp): whether an inter block reads |
| 1038 | /// `SINGLE_REFERENCE` or `COMPOUND_REFERENCE`, only reached once a frame's |
| 1039 | /// `reference_select` header bit lets a block choose per-block instead of |
| 1040 | /// fixing the mode. `above`/`left` are `None` for an intra/unavailable |
| 1041 | /// neighbour, [`NeighbourRef`] for a coded one -- [`reference_mode_ctx`]'s |
| 1042 | /// own doc. Called from [`decode_inter_block`] once its own `reference_select` |
| 1043 | /// parameter is set; [`decode_inter_block8`]'s 8x8 leaf path gates the same |
| 1044 | /// way with a coarser (`LAST_FRAME`-only) neighbour shape. |
| 1045 | /// lane-twostage: this frame's references as DIMENSIONS now and PIXELS on |
| 1046 | /// demand. An inter tile's parse reads reference SIZES (`mc::scale_factor`) |
| 1047 | /// only, so the pictures are resolved at the first [`ref_planes`] call |
| 1048 | /// rather than at frame entry. On the threaded path that resolution is a |
| 1049 | /// WAIT on the producing frame's pixels, which is what lets a consumer parse |
| 1050 | /// while its references are still being filtered. |
| 1051 | /// lane-defer8: the prediction that asks for them can run in a closure, see |
| 1052 | /// [`ref_planes_deferred`]. |
| 1053 | pub |
| 1054 | |
| 1055 | |
| 1056 | |
| 1057 | |
| 1058 | |
| 1059 | |
| 1060 | |
| 1061 | |
| 1062 | |
| 1063 | |
| 1064 | |
| 1065 | |
| 1066 | |
| 1067 | |
| 1068 | /// A frame's reference pictures as `Arc`s behind a wait, for the recon |
| 1069 | /// workers that build predictions off the parse thread. |
| 1070 | |
| 1071 | pub |
| 1072 | |
| 1073 | |
| 1074 | |
| 1075 | |
| 1076 | |
| 1077 | |
| 1078 | /// Where a [`RefPix`] gets its pictures: already in hand, or behind a wait |
| 1079 | /// the caller owns (`stream.rs`'s reference promises). |
| 1080 | pub |
| 1081 | |
| 1082 | |
| 1083 | |
| 1084 | |
| 1085 | /// spec 7.11.3.3's scale of a reference of `(width, height)` (cropped luma |
| 1086 | /// sizes) against this frame's `(width, height)`. |
| 1087 | pub |
| 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 | |
| 1184 | |
| 1185 | |
| 1186 | |
| 1187 | |
| 1188 | |
| 1189 | |
| 1190 | |
| 1191 | |
| 1192 | |
| 1193 | |
| 1194 | |
| 1195 | |
| 1196 | |
| 1197 | |
| 1198 | |
| 1199 | |
| 1200 | |
| 1201 | |
| 1202 | |
| 1203 | /// This slot's picture SIZE, with [`ref_planes`]' own error when the slot |
| 1204 | /// carries no usable picture -- `dims` is `None` exactly when `planes()` |
| 1205 | /// would have nothing there, so the parse thread keeps refusing the same |
| 1206 | /// streams at the same block WITHOUT waiting for a producer's pixels |
| 1207 | /// (lane-defer8). |
| 1208 | pub |
| 1209 | |
| 1210 | |
| 1211 | |
| 1212 | |
| 1213 | |
| 1214 | |
| 1215 | |
| 1216 | |
| 1217 | |
| 1218 | |
| 1219 | |
| 1220 | |
| 1221 | |
| 1222 | |
| 1223 | |
| 1224 | |
| 1225 | |
| 1226 | |
| 1227 | /// [`ref_planes`] from inside a prediction closure, where there is no `?` |
| 1228 | /// to take: the error is parked on the [`RefPix`] and taken by the frame |
| 1229 | /// decoder ([`RefPix::take_err`]). The block's |
| 1230 | /// prediction is left zeroed -- the frame is failing either way. |
| 1231 | pub |
| 1232 | |
| 1233 | |
| 1234 | |
| 1235 | |
| 1236 | |
| 1237 | |
| 1238 | |
| 1239 | |
| 1240 | |
| 1241 | |
| 1242 | |
| 1243 | |
| 1244 | /// A whole reference plane as a [`PlaneBuf`]: no tile window, no margin. |
| 1245 | pub |
| 1246 | |
| 1247 | |
| 1248 | |
| 1249 | |
| 1250 | |
| 1251 | |
| 1252 | |
| 1253 | |
| 1254 | |
| 1255 | |
| 1256 | |
| 1257 | |
| 1258 | |
| 1259 | |
| 1260 | /// A reference picture's own chroma plane shape, `(width, height)`, from its |
| 1261 | /// luma size and its chroma sample count. A stored reference carries no |
| 1262 | /// subsampling field, so the format is read back off the count -- and the |
| 1263 | /// counts are the producer's own [`round_ss`] crops |
| 1264 | /// (`decode.rs:25806`), so the test must use `round_ss` too and not a bare |
| 1265 | /// halving: 4:4:4 stores `w * h`, 4:2:2 stores `round_ss(w, 1) * h` (half |
| 1266 | /// width CEIL, full height), 4:2:0 stores `round_ss(w, 1) * round_ss(h, 1)`. |
| 1267 | /// A floor test here silently misses every odd-width 4:2:2 reference and |
| 1268 | /// drops it into the 4:2:0 arm -- the same defect one dimension over. |
| 1269 | /// |
| 1270 | /// The two-way test this replaces ("luma-sized, else a quarter") folded 4:2:2 |
| 1271 | /// into the 4:2:0 shape entirely, so a 4:2:2 reference plane claimed |
| 1272 | /// `h / 2` rows -- half the samples it actually holds. Every chroma MC |
| 1273 | /// reading such a plane then had its source row clamped against |
| 1274 | /// `true_height` (spec 7.11.3.4 / libaom's |
| 1275 | /// `dec_calc_subpel_params_and_extend` clamps to the reference's valid |
| 1276 | /// area), which folded every chroma row at or past the frame's midpoint |
| 1277 | /// back onto the last valid row: on the pinned t422 fixture frame 1, the |
| 1278 | /// 8x4 inter strip at luma (88, 208) MC-predicted chroma (88, 104) from |
| 1279 | /// frame 0 with mv 0 and a pure copy, yet wrote (206, 204, 202, 200) x4 |
| 1280 | /// rows where the reference holds (202, 204, 204, 167) / |
| 1281 | /// (185, 190, 190, 165) / ... |
| 1282 | /// **Ambiguity, measured rather than argued away:** the inference reads a |
| 1283 | /// format off a length, so it is only as good as the lengths being |
| 1284 | /// distinct. Brute-forced against the producer's own `round_ss` crops over |
| 1285 | /// every `w, h` in `1..=128`, the 4:4:4 and 4:2:2 counts are distinct from |
| 1286 | /// each other and from the 4:2:0 count, and both route correctly for |
| 1287 | /// **every `w >= 2 && h >= 2`**. No stream this decoder accepts reaches a |
| 1288 | /// 1-pixel chroma plane; the pinned fixture's chroma is 128x144. |
| 1289 | /// |
| 1290 | /// **4:2:0 at odd dimensions: CLOSED by lane-av1odd440.** The arm used to be |
| 1291 | /// the old `(width / 2, height / 2)` floor, which was what the two-way test |
| 1292 | /// this replaces produced -- harmless then, since no 4:2:0 stream changed |
| 1293 | /// shape, and wrong for an odd-dimension 4:2:0 reference: the producer |
| 1294 | /// stored `round_ss(w, 1) x round_ss(h, 1)`, so the floor arm |
| 1295 | /// under-declared. Measured over the `1..=128` square, running each 4:2:0 |
| 1296 | /// count through this very function: 12160 of the 16384 pairs came back |
| 1297 | /// smaller than the plane actually holds, 12033 of those with `w >= 2` and |
| 1298 | /// 127 in the `w == 1` column, where the floor cannot even express |
| 1299 | /// `(1, round_ss(h, 1))`. It was left alone pending "a lane that can bring |
| 1300 | /// odd-dimension 4:2:0 fixtures with it" -- this is that lane: the pinned |
| 1301 | /// `420_odd65x65_key.obu` is a real 65x65 4:2:0 key frame (declared at |
| 1302 | /// `encode::encode_key_frame_at_size`, because aomenc rounds the coded size |
| 1303 | /// down to even and cannot produce one) whose chroma planes are 33x33, and |
| 1304 | /// the gate `an_odd_luma_420_key_frame_decodes_pixel_exact` decodes it |
| 1305 | /// sample-exact against `aomdec`. The arm is now the producer's own crop, |
| 1306 | /// so a 4:2:0 reference at ANY size routes back to the shape the producer |
| 1307 | /// wrote. Even sizes are untouched: `(2k + 1) / 2 == k`, so every 4:2:0 |
| 1308 | /// reference this decoder met before this lane claims exactly the same |
| 1309 | /// shape it did then. |
| 1310 | pub |
| 1311 | |
| 1312 | |
| 1313 | |
| 1314 | |
| 1315 | |
| 1316 | |
| 1317 | |
| 1318 | |
| 1319 | |
| 1320 | |
| 1321 | /// Resolves a reference's own planes -- the `ref_frame -> picture` lookup |
| 1322 | /// [`decode_inter_block`]'s single-ref path does, factored out so the |
| 1323 | /// compound path can call it twice (lane-av1comp), and the point where |
| 1324 | /// lane-twostage's pixel wait happens. |
| 1325 | pub |
| 1326 | |
| 1327 | |
| 1328 | |
| 1329 | |
| 1330 | |
| 1331 | |
| 1332 | |
| 1333 | |
| 1334 | |
| 1335 | |
| 1336 | |
| 1337 | |
| 1338 | |
| 1339 | |
| 1340 | |
| 1341 | |
| 1342 | /// libaom `foreach_overlappable_nb_above` (`obmc.h`): walks the mi row |
| 1343 | /// directly above this block's own column span, one bordering block at a |
| 1344 | /// time (stepping by that neighbour's own `MiInfo::size`, which is always |
| 1345 | /// `<= 16` since no block this decoder ever codes exceeds 64x64), collecting |
| 1346 | /// every *inter* neighbour found (an intra or unset cell is skipped, one mi |
| 1347 | /// unit at a time, and does not itself count as a step). `max_neighbors` |
| 1348 | /// caller-bounds the scan: `1` for the eligibility check (any hit at all), |
| 1349 | /// `av1_build_obmc_inter_prediction`'s own `max_neighbor_obmc` table for the |
| 1350 | /// real blend pass. lane-intra16x4 r2: libaom's own "4-wide block, treat as |
| 1351 | /// half of a chroma pair" merge (`obmc.h`'s `mi_step == 1` special case) IS |
| 1352 | /// ported below -- the round-1 note that no block is narrower than 8px stopped |
| 1353 | /// being true when the 1:4 partitions landed. A 16x4 / 4x16 strip has |
| 1354 | /// `mi_size_high`/`mi_size_wide` 1, so libaom snaps the walk back to the pair's |
| 1355 | /// even index, reads the ODD (chroma-carrying) half as the neighbour and steps |
| 1356 | /// by 2. Measured: the 16x16 block right of a 16x16-level HORZ_4 partition |
| 1357 | /// whose strip 0 is inter and strips 1..3 intra counted that inter strip as |
| 1358 | /// overlappable here, while libaom's pair merge reads the INTRA strip 1 and |
| 1359 | /// counts none -- so we read a `motion_mode` symbol libaom never wrote (class |
| 1360 | /// `symbol-consumption-gap`), desyncing the tile at the next coefficient. |
| 1361 | pub |
| 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 | |
| 1419 | |
| 1420 | |
| 1421 | |
| 1422 | |
| 1423 | |
| 1424 | |
| 1425 | |
| 1426 | |
| 1427 | |
| 1428 | |
| 1429 | |
| 1430 | /// `foreach_overlappable_nb_left`'s left-column mirror of |
| 1431 | /// [`overlappable_above`] -- see its doc for the shared corner-cut. |
| 1432 | pub |
| 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 | |
| 1483 | |
| 1484 | |
| 1485 | |
| 1486 | |
| 1487 | |
| 1488 | |
| 1489 | |
| 1490 | |
| 1491 | |
| 1492 | |
| 1493 | /// libaom `motion_mode_allowed`'s neighbour term: does ANY bordering inter |
| 1494 | /// block sit on this block's above row or left column ("check_num_overlappable |
| 1495 | /// _neighbors", `obmc.h`). The single source of truth for the DECODER's own |
| 1496 | /// `motion_mode_eligible` and for the tile WRITER's (`tile::write_motion_mode`) |
| 1497 | /// -- the two disagreeing by one block writes a `motion_mode` symbol the |
| 1498 | /// decoder never reads (class `symbol-consumption-gap`). |
| 1499 | pub |
| 1500 | |
| 1501 | |
| 1502 | |
| 1503 | |
| 1504 | |
| 1505 | |
| 1506 | |
| 1507 | |
| 1508 | |
| 1509 | |
| 1510 | |
| 1511 | |
| 1512 | /// The warp-sample gather's own `has_top_right` probe (libaom `av1_findSamples` |
| 1513 | /// calls the same `mvref_common.c` function the MV stack does). lane-sb128 r2: |
| 1514 | /// this used to hardcode `SB_MI` (a 64x64 superblock) -- at `sb_size == 128` |
| 1515 | /// libaom's mask loop runs one level further and strips the top-right sample |
| 1516 | /// off blocks whose neighbour IS decoded, so a warped 128-superblock frame |
| 1517 | /// picked up wrong warp parameters (frame 6 of the 128 inter gate). Delegates |
| 1518 | /// to the single sb-aware port in [`crate::mvstack::has_top_right`]; `bs` is |
| 1519 | /// the block's own side in 4x4 (`mi`) units (square inter leaves only here). |
| 1520 | pub |
| 1521 | |
| 1522 | |
| 1523 | |
| 1524 | |
| 1525 | |
| 1526 | |
| 1527 | |
| 1528 | |
| 1529 | /// `av1_findSamples` (`mvref_common.c`), full port: the up to |
| 1530 | /// `LEAST_SQUARES_SAMPLES_MAX` (8) above/left/top-left/top-right neighbour |
| 1531 | /// samples (`record_samples`) that share this block's own single reference |
| 1532 | /// frame and are themselves single-ref -- `mbmi->num_proj_ref` is |
| 1533 | /// `.len()` of the returned vec. `bw4` is the block's own side in 4x4 units |
| 1534 | /// (square, so also `bh4`; a real block's `xd->width`/`xd->height` in |
| 1535 | /// libaom are also mi units of that same square side here). Each sample's |
| 1536 | /// own `bw`/`bh` (fed to [`crate::warp::record_sample`]'s offset formula) |
| 1537 | /// come from the *neighbour* cell's own coded size, not this block's. |
| 1538 | |
| 1539 | pub |
| 1540 | |
| 1541 | |
| 1542 | |
| 1543 | |
| 1544 | |
| 1545 | |
| 1546 | |
| 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 | |
| 1638 | |
| 1639 | |
| 1640 | |
| 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 | |
| 1681 | |
| 1682 | |
| 1683 | |
| 1684 | |
| 1685 | |
| 1686 | |
| 1687 | |
| 1688 | |
| 1689 | |
| 1690 | |
| 1691 | |
| 1692 | |
| 1693 | |
| 1694 | |
| 1695 | |
| 1696 | |
| 1697 | |
| 1698 | |
| 1699 | |
| 1700 | |
| 1701 | |
| 1702 | /// `mbmi->num_proj_ref`: [`find_samples`]'s own count, all that |
| 1703 | /// `motion_mode_allowed` needs to pick the 3-symbol `motion_mode_cdf` over |
| 1704 | /// the 2-symbol `obmc_cdf` (spec 5.11.24). |
| 1705 | |
| 1706 | pub |
| 1707 | |
| 1708 | |
| 1709 | |
| 1710 | |
| 1711 | |
| 1712 | |
| 1713 | |
| 1714 | |
| 1715 | |
| 1716 | |
| 1717 | |
| 1718 | |
| 1719 | |
| 1720 | |
| 1721 | |
| 1722 | |
| 1723 | /// `av1_get_obmc_mask` (`reconinter.c`): the per-position blend weight |
| 1724 | /// (`AOM_BLEND_A64` numerator, out of 64) for the neighbour's own |
| 1725 | /// contribution's *complement* -- i.e. `dst = (mask*orig + (64-mask)*nbr + |
| 1726 | /// 32) >> 6`, low near the shared border (heavier neighbour weight) rising |
| 1727 | /// to 64 (no neighbour contribution) away from it. Only the lengths this |
| 1728 | /// decoder's own overlap sizes ever produce (luma 8/16/32, chroma 4/8/16) |
| 1729 | /// are transcribed. |
| 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 | |
| 1762 | /// A bordering block's own resolved interp filter kernel, `(h, v)` -- |
| 1763 | /// mirrors [`resolve_interp_filter`]'s own return order from its stored |
| 1764 | /// `[u8; 2]` (`Neighbours::above_filter`/`left_filter`, `[sym0, sym1]` = |
| 1765 | /// `[v_sym, h_sym]`). The `[3, 3]` sentinel is only ever stored for an intra |
| 1766 | /// neighbour (excluded by [`overlappable_above`]/[`overlappable_left`]'s |
| 1767 | /// `is_inter` gate) or when `interp_fixed` is `Some` for the whole frame |
| 1768 | /// (handled here first) -- so a sentinel reaching the kernel lookup means the |
| 1769 | /// stream desynced upstream, and this refuses instead of panicking. |
| 1770 | pub |
| 1771 | |
| 1772 | |
| 1773 | |
| 1774 | |
| 1775 | |
| 1776 | |
| 1777 | |
| 1778 | |
| 1779 | |
| 1780 | |
| 1781 | |
| 1782 | |
| 1783 | |
| 1784 | |
| 1785 | |
| 1786 | |
| 1787 | |
| 1788 | |
| 1789 | |
| 1790 | |
| 1791 | |
| 1792 | |
| 1793 | |
| 1794 | |
| 1795 | /// lane-obmcrec r1 MEASUREMENT rung (`EC_OBMCREC=1`): every OBMC neighbour whose |
| 1796 | /// recorded switchable-filter symbols are the `[3, 3]` "never recorded" sentinel |
| 1797 | /// -- names the neighbour's own position/shape/reference so the decode path that |
| 1798 | /// failed to record its filter can be identified. Read-only, off by default. |
| 1799 | |
| 1800 | |
| 1801 | |
| 1802 | |
| 1803 | |
| 1804 | |
| 1805 | |
| 1806 | |
| 1807 | |
| 1808 | |
| 1809 | |
| 1810 | |
| 1811 | |
| 1812 | |
| 1813 | |
| 1814 | |
| 1815 | |
| 1816 | |
| 1817 | |
| 1818 | |
| 1819 | |
| 1820 | |
| 1821 | |
| 1822 | |
| 1823 | |
| 1824 | |
| 1825 | |
| 1826 | |
| 1827 | |
| 1828 | |
| 1829 | |
| 1830 | |
| 1831 | |
| 1832 | |
| 1833 | |
| 1834 | |
| 1835 | /// One neighbour's own re-prediction over a `w`x`h` region, MC'd fresh |
| 1836 | /// against its own `mv`/reference/filter (libaom `av1_build_inter_predictor` |
| 1837 | /// under `av1_setup_build_prediction_by_{above,left}_pred`). |
| 1838 | |
| 1839 | |
| 1840 | |
| 1841 | |
| 1842 | |
| 1843 | |
| 1844 | |
| 1845 | |
| 1846 | |
| 1847 | |
| 1848 | |
| 1849 | |
| 1850 | |
| 1851 | |
| 1852 | |
| 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 | /// Blends `tmp` into `dst` (stride `stride`) at `(ox, oy)`, mask varying by |
| 1897 | /// row (the above-neighbour pass, `aom_blend_a64_vmask`). |
| 1898 | /// `ii_weights1d` (reconinter.c:524): the interintra smooth-mask falloff. |
| 1899 | pub const II_WEIGHTS_1D: = |
| 1900 | |
| 1901 | |
| 1902 | |
| 1903 | |
| 1904 | |
| 1905 | ; |
| 1906 | |
| 1907 | /// lane-interintra r1: non-wedge interintra prediction for one plane |
| 1908 | /// (reconinter.c `av1_build_interintra_predictor` + `combine_interintra` + |
| 1909 | /// `build_smooth_interintra_mask`). Builds the intra predictor for the |
| 1910 | /// block's II mode (DC/V/H/SMOOTH, angle 0, no filter-intra) from `plane`'s |
| 1911 | /// own decoded edges at `(x, y)`, then blends it over the inter prediction |
| 1912 | /// in `pred`: `comp = (mask*intra + (64-mask)*inter + 32) >> 6` |
| 1913 | /// (`aom_blend_a64_mask`, intra as src0). `ii_size_scales[plane_bsize]` |
| 1914 | /// reduces to `128 / side` for the square plane sizes this decoder reaches. |
| 1915 | /// lane-wii r2: `wedge == Some(..)` replaces the mode mask with the wedge |
| 1916 | /// codebook mask (fixed sign 0; luma stride, 2x2 box-averaged for chroma). |
| 1917 | // Signature mirrors the spec's per-call inputs; a parameter struct would only move them. |
| 1918 | |
| 1919 | pub |
| 1920 | |
| 1921 | |
| 1922 | |
| 1923 | |
| 1924 | |
| 1925 | |
| 1926 | |
| 1927 | |
| 1928 | |
| 1929 | |
| 1930 | |
| 1931 | |
| 1932 | |
| 1933 | |
| 1934 | |
| 1935 | |
| 1936 | |
| 1937 | |
| 1938 | |
| 1939 | |
| 1940 | |
| 1941 | |
| 1942 | |
| 1943 | |
| 1944 | |
| 1945 | |
| 1946 | |
| 1947 | |
| 1948 | |
| 1949 | |
| 1950 | |
| 1951 | |
| 1952 | |
| 1953 | |
| 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 | /// `w` is the number of columns actually written (clipped to the block's own |
| 2017 | /// buffer at a frame edge); `ts` is `tmp`'s own stride, the neighbour |
| 2018 | /// prediction's full width. |
| 2019 | |
| 2020 | |
| 2021 | |
| 2022 | |
| 2023 | |
| 2024 | |
| 2025 | |
| 2026 | |
| 2027 | |
| 2028 | |
| 2029 | |
| 2030 | |
| 2031 | |
| 2032 | |
| 2033 | |
| 2034 | |
| 2035 | |
| 2036 | |
| 2037 | |
| 2038 | |
| 2039 | |
| 2040 | |
| 2041 | /// Blends `tmp` into `dst` at `(ox, oy)`, mask varying by column (the |
| 2042 | /// left-neighbour pass, `aom_blend_a64_hmask`). |
| 2043 | |
| 2044 | |
| 2045 | |
| 2046 | |
| 2047 | |
| 2048 | |
| 2049 | |
| 2050 | |
| 2051 | |
| 2052 | |
| 2053 | |
| 2054 | |
| 2055 | |
| 2056 | |
| 2057 | |
| 2058 | |
| 2059 | |
| 2060 | |
| 2061 | |
| 2062 | |
| 2063 | /// libaom's own `BLOCK_SIZE` enum index for a `w4`x`h4` (mi-unit) block -- |
| 2064 | /// only for the `EC_OBMC` trace rung below, so it reads byte-identical to |
| 2065 | /// the instrumented aomdec's `backup_mbmi.bsize`. |
| 2066 | |
| 2067 | |
| 2068 | |
| 2069 | |
| 2070 | |
| 2071 | |
| 2072 | |
| 2073 | |
| 2074 | |
| 2075 | |
| 2076 | |
| 2077 | |
| 2078 | |
| 2079 | |
| 2080 | |
| 2081 | |
| 2082 | |
| 2083 | |
| 2084 | |
| 2085 | |
| 2086 | |
| 2087 | |
| 2088 | |
| 2089 | |
| 2090 | |
| 2091 | /// The `EC_OBMC` rung: one line per blended neighbour, in the instrumented |
| 2092 | /// aomdec's own byte format (`decodeframe.c` |
| 2093 | /// `dec_build_prediction_by_{above,left}_pred`), so the two decoders' OBMC |
| 2094 | /// neighbour lists diff line for line. `filt` is libaom's packed |
| 2095 | /// `interp_filters.as_int` = `y_filter | (x_filter << 16)`. |
| 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 | /// `av1_build_obmc_inter_prediction` (libaom `reconinter.c`): re-predicts |
| 2129 | /// the overlap strip against each bordering above/left inter neighbour's own |
| 2130 | /// mv/ref/filter and blends it into this block's just-built single-reference |
| 2131 | /// prediction, luma then both 4:2:0 chroma planes -- above pass first, then |
| 2132 | /// left, each reading only the *original* prediction this function was |
| 2133 | /// handed (never the other pass's own output), matching libaom's own |
| 2134 | /// independence between the two. `max_neighbor_obmc`'s own cap table |
| 2135 | /// (`{0,1,2,3,4,4}` indexed by `mi_size_wide_log2`/`_high_log2`, this |
| 2136 | /// decoder's own square blocks always index the same value both ways) bounds |
| 2137 | /// how many bordering blocks actually get blended, separate from the |
| 2138 | /// eligibility scan's own unbounded ("any at all") walk. |
| 2139 | |
| 2140 | pub |
| 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 | |
| 2175 | |
| 2176 | |
| 2177 | |
| 2178 | |
| 2179 | |
| 2180 | |
| 2181 | |
| 2182 | |
| 2183 | |
| 2184 | |
| 2185 | |
| 2186 | |
| 2187 | |
| 2188 | |
| 2189 | |
| 2190 | |
| 2191 | |
| 2192 | |
| 2193 | |
| 2194 | |
| 2195 | |
| 2196 | |
| 2197 | |
| 2198 | |
| 2199 | |
| 2200 | |
| 2201 | |
| 2202 | |
| 2203 | |
| 2204 | |
| 2205 | |
| 2206 | |
| 2207 | |
| 2208 | |
| 2209 | |
| 2210 | |
| 2211 | |
| 2212 | |
| 2213 | |
| 2214 | |
| 2215 | |
| 2216 | |
| 2217 | |
| 2218 | |
| 2219 | |
| 2220 | |
| 2221 | |
| 2222 | |
| 2223 | |
| 2224 | |
| 2225 | |
| 2226 | |
| 2227 | |
| 2228 | |
| 2229 | |
| 2230 | |
| 2231 | |
| 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 | |
| 2261 | |
| 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 | |
| 2294 | |
| 2295 | |
| 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 | /// `av1_skip_u4x4_pred_in_obmc`'s above-pass decision (libaom |
| 2321 | /// `reconinter.c` 829): the PLANE block (`write_w >> ss_x`, `write_h >> |
| 2322 | /// ss_y`) is 4x4, 8x4 or 4x8. `ss_x`/`ss_y` are the FRAME's own pair -- the |
| 2323 | /// same values [`obmc_run`]'s chroma windows shift by -- never a ratio over |
| 2324 | /// the square `chroma_side` (lane-av1-llpred2: that ratio dropped the |
| 2325 | /// 4:2:0 16x8/8x16 skip and shifted by 64 at 4:4:4). Pure so the check |
| 2326 | /// below pins the rect-strip decision without decoding a stream. |
| 2327 | pub |
| 2328 | |
| 2329 | |
| 2330 | |
| 2331 | |
| 2332 | |
| 2333 | |
| 2334 | |
| 2335 | |
| 2336 | /// One OBMC neighbour as the PARSE thread resolved it (lane-defer8): every |
| 2337 | /// value [`obmc_run`] needs that lives in the mode-info grid or the |
| 2338 | /// neighbour bands, which the parse keeps overwriting as it walks on. |
| 2339 | pub |
| 2340 | |
| 2341 | |
| 2342 | |
| 2343 | |
| 2344 | |
| 2345 | |
| 2346 | |
| 2347 | |
| 2348 | |
| 2349 | |
| 2350 | /// [`obmc_plan`]'s result: the two neighbour passes plus this block's own |
| 2351 | /// geometry, everything [`obmc_run`] reads apart from reference PIXELS. |
| 2352 | pub |
| 2353 | |
| 2354 | |
| 2355 | |
| 2356 | |
| 2357 | |
| 2358 | |
| 2359 | |
| 2360 | |
| 2361 | |
| 2362 | |
| 2363 | |
| 2364 | |
| 2365 | |
| 2366 | |
| 2367 | |
| 2368 | |
| 2369 | |
| 2370 | |
| 2371 | |
| 2372 | |
| 2373 | |
| 2374 | |
| 2375 | |
| 2376 | |
| 2377 | /// The reference-pixel half of OBMC: re-predicts every planned neighbour |
| 2378 | /// over this block's own edge strips and blends it into the prediction |
| 2379 | /// (libaom `av1_build_obmc_inter_prediction`). Reads nothing but reference |
| 2380 | /// pixels and the plan, so it runs wherever the block's prediction is built |
| 2381 | /// -- at the prediction's own push site (lane-defer8). |
| 2382 | pub |
| 2383 | |
| 2384 | |
| 2385 | |
| 2386 | |
| 2387 | |
| 2388 | |
| 2389 | |
| 2390 | |
| 2391 | |
| 2392 | |
| 2393 | |
| 2394 | |
| 2395 | |
| 2396 | |
| 2397 | |
| 2398 | |
| 2399 | |
| 2400 | |
| 2401 | |
| 2402 | |
| 2403 | |
| 2404 | |
| 2405 | |
| 2406 | |
| 2407 | |
| 2408 | |
| 2409 | |
| 2410 | |
| 2411 | |
| 2412 | |
| 2413 | |
| 2414 | |
| 2415 | |
| 2416 | |
| 2417 | |
| 2418 | |
| 2419 | |
| 2420 | |
| 2421 | |
| 2422 | |
| 2423 | |
| 2424 | |
| 2425 | |
| 2426 | |
| 2427 | |
| 2428 | |
| 2429 | |
| 2430 | |
| 2431 | |
| 2432 | |
| 2433 | |
| 2434 | |
| 2435 | |
| 2436 | |
| 2437 | |
| 2438 | |
| 2439 | |
| 2440 | |
| 2441 | |
| 2442 | |
| 2443 | |
| 2444 | |
| 2445 | |
| 2446 | |
| 2447 | |
| 2448 | |
| 2449 | |
| 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 | |
| 2493 | |
| 2494 | |
| 2495 | |
| 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 | |
| 2529 | |
| 2530 | |
| 2531 | |
| 2532 | |
| 2533 | |
| 2534 | |
| 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 | |
| 2577 | |
| 2578 | |
| 2579 | |
| 2580 | |
| 2581 | |
| 2582 | |
| 2583 | |
| 2584 | |
| 2585 | |
| 2586 | |
| 2587 | /// `is_any_masked_compound_used` (libaom `reconinter.h`), specialised to |
| 2588 | /// the square block sizes this decoder ever decodes (32/16/8, all |
| 2589 | /// `min(w,h) >= 8`, `is_comp_ref_allowed` true): `COMPOUND_DIFFWTD` is then |
| 2590 | /// always `is_interinter_compound_used`, so the function is always `true` |
| 2591 | /// for `side` -- kept as a named call (rather than inlined `true`) so a |
| 2592 | /// future sub-8 block size does not silently misdecode a real stream. |
| 2593 | pub |
| 2594 | |
| 2595 | |
| 2596 | |
| 2597 | |
| 2598 | |
| 2599 | |
| 2600 | |
| 2601 | |
| 2602 | /// The `BLOCK_SIZES_ALL` index of a `bw x bh` block (libaom `enum BLOCK_SIZE`, |
| 2603 | /// `blockd.h`) -- the row every size-indexed inter CDF table |
| 2604 | /// (`compound_type_cdf`, `wedge_idx_cdf`) is keyed by. Our `decode_inter_block` |
| 2605 | /// carries the enclosing SQUARE `side` for context purposes (the accepted |
| 2606 | /// strip corner-cut), so a 16x8 / 8x16 PARTITION_HORZ/VERT strip that reads |
| 2607 | /// one of those symbols off `side` alone takes BLOCK_16X16's row and desyncs |
| 2608 | /// (lane-inter16ab r3: a real 16x8 compound strip with `comp_group_idx == 1`, |
| 2609 | /// decode-order frame 5, our range 64901 vs the oracle's 47271 at the very |
| 2610 | /// next block's mode read). |
| 2611 | pub |
| 2612 | |
| 2613 | |
| 2614 | |
| 2615 | |
| 2616 | |
| 2617 | |
| 2618 | |
| 2619 | |
| 2620 | |
| 2621 | |
| 2622 | |
| 2623 | |
| 2624 | |
| 2625 | |
| 2626 | |
| 2627 | |
| 2628 | |
| 2629 | |
| 2630 | |
| 2631 | |
| 2632 | |
| 2633 | |
| 2634 | |
| 2635 | |
| 2636 | |
| 2637 | |
| 2638 | |
| 2639 | /// `av1_wedge_params_lookup[bsize].wedge_types > 0` (libaom `reconinter.c`): |
| 2640 | /// the block sizes that carry a wedge codebook at all. A `compound_type` |
| 2641 | /// symbol is written only for these; every other size infers |
| 2642 | /// `COMPOUND_DIFFWTD`. |
| 2643 | pub |
| 2644 | |
| 2645 | |
| 2646 | |
| 2647 | |
| 2648 | |
| 2649 | |
| 2650 | /// Whether a compound reference pair is unidirectional (both references on |
| 2651 | /// the same temporal side of the current frame) -- `has_uni_comp_refs` |
| 2652 | /// (libaom `av1_reference_frame_utils.h`/`pred_common.c`'s own definition: |
| 2653 | /// a pair is `UNIDIR_COMP_REFERENCE` exactly when neither reference is |
| 2654 | /// backward-while-the-other-is-forward, i.e. `is_backward(ref0) == |
| 2655 | /// is_backward(ref1)`). Used to build a real |
| 2656 | /// [`crate::mvstack::NeighbourRef::uni`] once `ref1` is known, matching |
| 2657 | /// [`crate::mvstack::comp_reference_type_ctx`]'s own `is_backward` calls. |
| 2658 | pub |
| 2659 | |
| 2660 | |
| 2661 | |
| 2662 | |
| 2663 | /// `get_comp_group_idx_context` (libaom `pred_common.h`): sums the |
| 2664 | /// above/left neighbour contributions [`Neighbours::record_inter`]/ |
| 2665 | /// [`Neighbours::record_compound_ctx`] already precomputed, clamped to 5. |
| 2666 | /// lane-inter8 r2: `at_mi` is the block's own top-left in 4x4 mi units -- |
| 2667 | /// an 8x8 leaf used to pass its enclosing 16x16's corner here, so all four |
| 2668 | /// leaves read the same neighbour cell (class context-read-from-one-cell). |
| 2669 | pub |
| 2670 | |
| 2671 | |
| 2672 | |
| 2673 | |
| 2674 | |
| 2675 | |
| 2676 | |
| 2677 | |
| 2678 | |
| 2679 | |
| 2680 | /// `get_comp_index_context` (libaom `pred_common.h`): the above/left |
| 2681 | /// neighbour bits plus `3 * (fwd == bck)`, where `fwd`/`bck` are this |
| 2682 | /// block's own two references' distances from the current frame (spec |
| 2683 | /// 7.11.3.15's `get_relative_dist`, same convention |
| 2684 | /// [`crate::compound::dist_wtd_comp_weight_assign`] uses). |
| 2685 | |
| 2686 | pub |
| 2687 | |
| 2688 | |
| 2689 | |
| 2690 | |
| 2691 | |
| 2692 | |
| 2693 | |
| 2694 | |
| 2695 | |
| 2696 | |
| 2697 | |
| 2698 | |
| 2699 | |
| 2700 | |
| 2701 | |
| 2702 | |
| 2703 | |
| 2704 | |
| 2705 | |
| 2706 | |
| 2707 | |
| 2708 | |
| 2709 | pub |
| 2710 | |
| 2711 | |
| 2712 | |
| 2713 | |
| 2714 | |
| 2715 | |
| 2716 | |
| 2717 | |
| 2718 | |
| 2719 | |
| 2720 | |
| 2721 | |
| 2722 | |
| 2723 | |
| 2724 | |
| 2725 | |
| 2726 | |
| 2727 | |
| 2728 | |
| 2729 | |
| 2730 | |
| 2731 | |
| 2732 | /// Spec 5.11.25's `comp_reference_type` + the `uni_comp_ref`/`comp_ref`/ |
| 2733 | /// `comp_bwdref` trees (libaom `decodemv.c`'s `read_ref_frames` compound |
| 2734 | /// arm), reached once [`read_comp_mode`] has already returned |
| 2735 | /// `COMPOUND_REFERENCE`. Returns `(RefFrame[0], RefFrame[1])`. |
| 2736 | /// `above`/`left` are [`comp_reference_type_ctx`]'s own `NeighbourRef` |
| 2737 | /// convention; `above_ref`/`left_ref` are the scalar `1..=7`/`-1` |
| 2738 | /// convention [`read_single_ref`] already uses, for every downstream binary |
| 2739 | /// decision. libaom `pred_common.c`'s own compound context functions |
| 2740 | /// (`av1_get_pred_context_uni_comp_ref_p[1|2]`, `comp_ref_p[1|2]`, |
| 2741 | /// `comp_bwdref_p[1]`) turned out to be exactly [`single_ref_p1_ctx`].. |
| 2742 | /// [`single_ref_p6_ctx`]/[`uni_comp_ref_p1_ctx`] under a different name |
| 2743 | /// (same vote-the-neighbours-above-left shape, same forward/backward and |
| 2744 | /// LAST/LAST2/LAST3/GOLDEN groupings) -- lane-av1comp audited each one |
| 2745 | /// against the C source rather than porting six near-duplicate functions. |
| 2746 | /// Its caller today only needs the symbols consumed, correctly, to keep the |
| 2747 | /// arithmetic decoder's own state in sync before refusing the block by name |
| 2748 | /// -- the returned pair is not yet threaded into any motion-compensation |
| 2749 | /// path. |
| 2750 | pub |
| 2751 | |
| 2752 | |
| 2753 | |
| 2754 | |
| 2755 | |
| 2756 | |
| 2757 | |
| 2758 | |
| 2759 | |
| 2760 | |
| 2761 | |
| 2762 | |
| 2763 | |
| 2764 | |
| 2765 | |
| 2766 | |
| 2767 | |
| 2768 | |
| 2769 | |
| 2770 | |
| 2771 | |
| 2772 | |
| 2773 | |
| 2774 | |
| 2775 | |
| 2776 | |
| 2777 | |
| 2778 | |
| 2779 | |
| 2780 | |
| 2781 | |
| 2782 | |
| 2783 | |
| 2784 | |
| 2785 | |
| 2786 | |
| 2787 | |
| 2788 | |
| 2789 | |
| 2790 | |
| 2791 | |
| 2792 | |
| 2793 | |
| 2794 | |
| 2795 | |
| 2796 | |
| 2797 | |
| 2798 | |
| 2799 | |
| 2800 | |
| 2801 | |
| 2802 | |
| 2803 | |
| 2804 | |
| 2805 | |
| 2806 | |
| 2807 | |
| 2808 | |
| 2809 | |
| 2810 | |
| 2811 | |
| 2812 | |
| 2813 | |
| 2814 | |
| 2815 | /// Spec 5.11.24's `compound_mode` (lane-av1comp): which of the eight |
| 2816 | /// `INTER_COMPOUND_MODES` (`NEAREST_NEARESTMV`..`NEW_NEWMV`, returned as |
| 2817 | /// `0..=7`) a `COMPOUND_REFERENCE` block takes, reached once |
| 2818 | /// [`read_comp_mode`] has already returned `COMPOUND_REFERENCE`. `ctx` is |
| 2819 | /// libaom's `av1_mode_context_analyzer`'s compound branch -- |
| 2820 | /// `compound_mode_ctx_map[ref_mv_ctx >> 1][min(new_mv_ctx, COMP_NEWMV_CTXS |
| 2821 | /// - 1)]` (`mvref_common.h`) -- folded from [`crate::mvstack:: |
| 2822 | /// find_mv_stack_compound`]'s own `new_mv_ctx`/`ref_mv_ctx`. The read symbol |
| 2823 | /// is not yet turned into an assigned MV pair or motion-compensated -- |
| 2824 | /// lane-av1comp. |
| 2825 | pub |
| 2826 | |
| 2827 | |
| 2828 | |
| 2829 | |
| 2830 | |
| 2831 | |
| 2832 | |
| 2833 | |
| 2834 | |
| 2835 | |
| 2836 | /// spec 7.10.2.10 `assign_mv`'s compound branch, plus the compound half of |
| 2837 | /// `read_drl_idx` (spec 5.11.24) it depends on -- `mode` is |
| 2838 | /// [`read_inter_compound_mode`]'s own `0..=7` (`NEAREST_NEARESTMV`.. |
| 2839 | /// `NEW_NEWMV`, libaom `enums.h` order). Every `GLOBAL_GLOBALMV` side reads |
| 2840 | /// as `(0, 0)` since [`crate::stream::decode_stream`] already refuses any |
| 2841 | /// non-`IDENTITY` global motion model before a tile is ever decoded. |
| 2842 | /// |
| 2843 | /// Ported straight from libaom `decodemv.c`'s `read_drl_idx` (the |
| 2844 | /// `NEW_NEWMV`/`have_nearmv_in_inter_mode` branches) and `assign_mv`/its |
| 2845 | /// caller's `ref_mv[]`/`nearmv[]` setup: the `NEAR_NEWMV`/`NEW_NEARMV` |
| 2846 | /// `1 + ref_mv_idx` special case is folded into `new_idx` below, matching |
| 2847 | /// `read_drl_idx`'s own comment about "offsetting the NEARESTMV mode". |
| 2848 | |
| 2849 | pub |
| 2850 | |
| 2851 | |
| 2852 | |
| 2853 | |
| 2854 | |
| 2855 | |
| 2856 | |
| 2857 | |
| 2858 | , |
| 2859 | fctx: &crateFrameCtx, |
| 2860 | ) |
| 2861 | |
| 2862 | |
| 2863 | |
| 2864 | |
| 2865 | |
| 2866 | |
| 2867 | |
| 2868 | |
| 2869 | |
| 2870 | |
| 2871 | |
| 2872 | |
| 2873 | |
| 2874 | |
| 2875 | |
| 2876 | |
| 2877 | |
| 2878 | |
| 2879 | |
| 2880 | |
| 2881 | |
| 2882 | |
| 2883 | |
| 2884 | |
| 2885 | |
| 2886 | |
| 2887 | |
| 2888 | |
| 2889 | |
| 2890 | |
| 2891 | |
| 2892 | |
| 2893 | |
| 2894 | |
| 2895 | |
| 2896 | |
| 2897 | |
| 2898 | |
| 2899 | |
| 2900 | |
| 2901 | |
| 2902 | |
| 2903 | |
| 2904 | |
| 2905 | |
| 2906 | |
| 2907 | |
| 2908 | |
| 2909 | |
| 2910 | |
| 2911 | |
| 2912 | |
| 2913 | |
| 2914 | |
| 2915 | |
| 2916 | |
| 2917 | |
| 2918 | |
| 2919 | |
| 2920 | |
| 2921 | |
| 2922 | |
| 2923 | |
| 2924 | |
| 2925 | |
| 2926 | |
| 2927 | |
| 2928 | |
| 2929 | |
| 2930 | |
| 2931 | |
| 2932 | /// Derives this query block's own [`crate::mvstack::GmMvTable`] -- one |
| 2933 | /// `gm_get_motion_vector` (spec 7.10.2.1) result per reference frame, at |
| 2934 | /// THIS block's own `(mi_row, mi_col, bw4, bh4)` (mvstack.rs's own doc: the |
| 2935 | /// table is always computed at the *querying* block's position, never a |
| 2936 | /// donating neighbour's). |
| 2937 | pub |
| 2938 | |
| 2939 | |
| 2940 | |
| 2941 | |
| 2942 | |
| 2943 | |
| 2944 | |
| 2945 | |
| 2946 | |
| 2947 | |
| 2948 | |
| 2949 | |
| 2950 | |
| 2951 | |
| 2952 | |
| 2953 | |
| 2954 | |
| 2955 | |
| 2956 | |
| 2957 | |
| 2958 | |
| 2959 | |
| 2960 | |
| 2961 | /// Decodes one square inter-frame block (32x32 whole or 16x16 leaf): skip, |
| 2962 | /// `is_inter`, then either the single-reference/MV-stack/motion-vector chain |
| 2963 | /// and motion-compensated reconstruction, or the inter frame's own intra |
| 2964 | /// path (`Y_MODE` by size group, not `KF_Y_MODE` by neighbour), mirroring |
| 2965 | /// [`crate::tile`]'s `sb_coeff_inter_frame_tile`'s whole-block branch and its |
| 2966 | /// private `write_inter_frame_leaf` -- both share this one function here, |
| 2967 | /// parameterised by `side`/the transform sets/scan tables/size group they |
| 2968 | /// each use. |
| 2969 | /// |
| 2970 | /// # Errors |
| 2971 | /// Returns an error when a symbol names anything this decoder does not |
| 2972 | /// reconstruct: a reference other than `LAST_FRAME`, `GLOBALMV` (round 3; |
| 2973 | /// `NEARESTMV`/`NEARMV`/`NEWMV` are all reconstructed), or an intra |
| 2974 | /// mode/tx-type outside what [`read_intra_mode`]/[`read_coeffs`] already |
| 2975 | /// refuse. |
| 2976 | |
| 2977 | /// lane-inter4 r1: 16-px-cell coordinates -> MI (4-px) coordinates, the unit |
| 2978 | /// [`decode_inter_block`]'s `at` now takes. |
| 2979 | pub const |
| 2980 | |
| 2981 | |
| 2982 | |
| 2983 | /// The luma transform leaf a chroma unit inherits its `tx_type` from |
| 2984 | /// (libaom `av1_get_tx_type`, `blockd.h:1287-1297`): an INTER block's chroma |
| 2985 | /// unit never codes a `tx_type` symbol of its own, so the type is read out |
| 2986 | /// of `xd->tx_type_map` at the chroma unit's own position scaled back to luma |
| 2987 | /// (`blk_row << ss_y`, `blk_col << ss_x`). `leaves` is the block's coded |
| 2988 | /// transform tree in decode order, `(row, col, tw, th, tx_type)` with |
| 2989 | /// `(row, col)` in MI relative to the block and `(tw, th)` in PIXELS; |
| 2990 | /// `rel_mi` is the chroma unit's own luma-relative top-left MI cell. One |
| 2991 | /// function serves the 128x128 mu-chunk tail and the 64x64 arms alike -- the |
| 2992 | /// lookup is the same rule, so a second inline copy would be a second |
| 2993 | /// convention. |
| 2994 | /// |
| 2995 | /// A leaf that coded nothing resolves to `DctDct` here exactly as libaom's |
| 2996 | /// `decodetxb.c:199-203` stamps `DCT_DCT` into that leaf's map cell on the |
| 2997 | /// `all_zero` path: a chroma unit over a SKIPPED luma quadrant must NOT |
| 2998 | /// inherit the block-level (top-left leaf) type. |
| 2999 | pub |
| 3000 | |
| 3001 | |
| 3002 | |
| 3003 | |
| 3004 | |
| 3005 | |
| 3006 | |
| 3007 | |
| 3008 | |
| 3009 | |
| 3010 | |
| 3011 | |
| 3012 | |
| 3013 | |
| 3014 | thread_local! |
| 3015 | |
| 3016 | |
| 3017 | |
| 3018 | |
| 3019 | |
| 3020 | |
| 3021 | |
| 3022 | |
| 3023 | |
| 3024 | |
| 3025 | |
| 3026 | |
| 3027 | |
| 3028 | |
| 3029 | thread_local! |
| 3030 | |
| 3031 | |
| 3032 | |
| 3033 | |
| 3034 | |
| 3035 | /// [`CHROMA_RECT_BLOCK_TX_FALLBACK`]: rect chroma units handed the block-level |
| 3036 | /// type because no luma leaf covered their own MI cell. |
| 3037 | // read only from the `#[cfg(test)]` gates |
| 3038 | pub |
| 3039 | |
| 3040 | |
| 3041 | |
| 3042 | /// [`CHROMA_RECT_BLOCK_TX_FALLBACK_MULTI`]: of those, the ones whose chroma |
| 3043 | /// plane had more than one unit. |
| 3044 | // read only from the `#[cfg(test)]` gates |
| 3045 | pub |
| 3046 | |
| 3047 |