edith_codecs
Clone
https://git.tahinli.com/Tahinli/edith_codecs.git
0 watching0 forksRust376.2 MiBa69dfabTahinli5 hours ago4073 commits
| 1 | use *; |
| 2 | use *; |
| 3 | |
| 4 | |
| 5 | |
| 6 | /// lane-ab128: the 128 root's four AB shapes -- `PARTITION_HORZ_A` (two |
| 7 | /// 64x64 on top, one 128x64 below), `_HORZ_B`, `_VERT_A`, `_VERT_B`. |
| 8 | /// Five passes over the same `testsrc2` clip |
| 9 | /// `a_128_root_horz_and_vert_halves_decode_exact_through_both_decoders` |
| 10 | /// uses: each shape forced at every root ([`force_b128_ab`]), so every |
| 11 | /// context and every visit order the shape reads is exercised rather than |
| 12 | /// the handful the RD would pick, and then an UNFORCED pass whose |
| 13 | /// per-shape count is REPORTED (it is the number the gate rows are read |
| 14 | /// against). |
| 15 | /// |
| 16 | /// Each pass is sample-exact against the encoder's own reconstruction |
| 17 | /// through `decode_stream` AND through ffmpeg; a writer/reader mismatch |
| 18 | /// surfaces here as a refusal or a pixel miss, never in the BD gate. RED |
| 19 | /// before this lane by construction: `write_sb128_root` could only name |
| 20 | /// NONE / HORZ / VERT / SPLIT, so all four counts were 0. |
| 21 | /// |
| 22 | /// Runs only inside `superblock_size_global_suite`. |
| 23 | pub |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 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 | |
| 103 | |
| 104 | |
| 105 | |
| 106 | |
| 107 | |
| 108 | |
| 109 | |
| 110 | |
| 111 | |
| 112 | |
| 113 | |
| 114 | |
| 115 | |
| 116 | |
| 117 | |
| 118 | |
| 119 | |
| 120 | |
| 121 | |
| 122 | |
| 123 | |
| 124 | |
| 125 | |
| 126 | |
| 127 | |
| 128 | |
| 129 | |
| 130 | |
| 131 | |
| 132 | |
| 133 | |
| 134 | |
| 135 | |
| 136 | |
| 137 | |
| 138 | |
| 139 | |
| 140 | |
| 141 | |
| 142 | |
| 143 | |
| 144 | |
| 145 | |
| 146 | |
| 147 | |
| 148 | |
| 149 | |
| 150 | |
| 151 | |
| 152 | |
| 153 | |
| 154 | |
| 155 | |
| 156 | |
| 157 | |
| 158 | |
| 159 | |
| 160 | |
| 161 | |
| 162 | |
| 163 | |
| 164 | |
| 165 | |
| 166 | |
| 167 | |
| 168 | |
| 169 | |
| 170 | /// The rate term the mode search ranks every decision by has to be the |
| 171 | /// rate the writer then spends. The search prices a block's coefficients |
| 172 | /// through `tile::coeff_bits` -- the writer's own symbol chain, but |
| 173 | /// against the default CDFs a tile starts from and the contexts of a |
| 174 | /// block whose neighbours coded nothing -- while the tile writer codes |
| 175 | /// them against a state that has been adapting all frame (the |
| 176 | /// price-the-narrowing class). This measures that drift: the sum of what |
| 177 | /// the search paid for the coefficients it kept, against the bytes the |
| 178 | /// writer actually emitted for the whole tile (which also carries the |
| 179 | /// partition/mode/skip/mv syntax the sum leaves out, so the writer is |
| 180 | /// expected to be the larger of the two). |
| 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 | |
| 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 | /// The census behind step (1) of the pricer lane: for every transform |
| 286 | /// block the writer really codes, what the search priced those levels at |
| 287 | /// against what the writer spent on them, split by table set and non-zero |
| 288 | /// count. One average hides the interesting part -- the classes the |
| 289 | /// estimate is systematically wrong about (all-zero blocks, the |
| 290 | /// one-coefficient blocks the inter search lives on) -- so the split is |
| 291 | /// printed and only the total is asserted on. |
| 292 | |
| 293 | |
| 294 | |
| 295 | |
| 296 | |
| 297 | |
| 298 | |
| 299 | |
| 300 | |
| 301 | |
| 302 | |
| 303 | |
| 304 | |
| 305 | |
| 306 | |
| 307 | |
| 308 | |
| 309 | |
| 310 | |
| 311 | |
| 312 | |
| 313 | |
| 314 | |
| 315 | |
| 316 | |
| 317 | |
| 318 | |
| 319 | |
| 320 | |
| 321 | |
| 322 | |
| 323 | |
| 324 | |
| 325 | |
| 326 | |
| 327 | |
| 328 | |
| 329 | /// Low motion has to actually buy something: at least one inter frame of |
| 330 | /// a panning sequence has to cost fewer bytes than the key frame that |
| 331 | /// starts it, and the inter-block share it prints has to be non-zero -- |
| 332 | /// a search that never picks an inter mode would still pass a rate gate |
| 333 | /// on a picture with no motion in it (the class this repo calls |
| 334 | /// gate-blind-to-feature), so the share is printed even though it is not |
| 335 | /// asserted on beyond being reachable at all. |
| 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 | /// `frames` consecutive pictures out of a real clip, scaled to a whole |
| 370 | /// number of 32x32 blocks. Generalizes [`clip_frame`]/[`clip_frame_pair`] |
| 371 | /// to an arbitrary count for the fixture regression gate below. |
| 372 | pub |
| 373 | |
| 374 | |
| 375 | |
| 376 | |
| 377 | |
| 378 | |
| 379 | |
| 380 | |
| 381 | |
| 382 | |
| 383 | |
| 384 | |
| 385 | |
| 386 | |
| 387 | |
| 388 | |
| 389 | /// [`clip_frames`] with the filter chain spelled out, so a caller can ask |
| 390 | /// for a native-resolution CROP instead of a downscale (the downscale is |
| 391 | /// what destroys a screen capture's exact repeats -- class |
| 392 | /// `gate-recipe-confound`). `width`/`height` must be what `vf` produces. |
| 393 | pub |
| 394 | |
| 395 | |
| 396 | |
| 397 | |
| 398 | |
| 399 | |
| 400 | |
| 401 | |
| 402 | |
| 403 | |
| 404 | |
| 405 | |
| 406 | |
| 407 | |
| 408 | // ----------------------------------------------------------------------- |
| 409 | // The encoder's standing BD-rate baseline against libaom and rav1e. |
| 410 | // Every PSNR below is measured on FFMPEG-DECODED pixels, never on an |
| 411 | // encoder's own reconstruction ([[shared-oracle-blindness]]): our decoder |
| 412 | // agreeing with our encoder proves nothing about the bitstream. |
| 413 | // ----------------------------------------------------------------------- |
| 414 | |
| 415 | /// All-plane PSNR of a decoded picture against its source, on the same |
| 416 | /// 8-bit scale [`psnr`] uses. |
| 417 | pub |
| 418 | |
| 419 | |
| 420 | |
| 421 | |
| 422 | |
| 423 | |
| 424 | |
| 425 | |
| 426 | |
| 427 | |
| 428 | /// The pictures back as the planar 8-bit bytes an encoder reads. |
| 429 | pub |
| 430 | |
| 431 | |
| 432 | |
| 433 | |
| 434 | |
| 435 | |
| 436 | |
| 437 | |
| 438 | |
| 439 | /// A (all-plane PSNR, log10 bytes) ladder from another AV1 encoder driven |
| 440 | /// through ffmpeg: one point per entry of `points`, each a quality flag |
| 441 | /// set. Returns the ladder ordered by fidelity and the total encode wall |
| 442 | /// clock. The stream is decoded back through [`ffmpeg_decode_sequence`], |
| 443 | /// so both curves are measured by the same decoder. |
| 444 | pub |
| 445 | |
| 446 | |
| 447 | |
| 448 | |
| 449 | |
| 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 | /// Every reference ladder point that did not decode sample-exactly |
| 530 | /// through our own decoder, collected across a whole gate run so the BD |
| 531 | /// table still prints and EVERY bad point is named |
| 532 | /// (`encoder params frame plane sample`) instead of only the first. |
| 533 | static LADDER_FAILURES: Mutex = new; |
| 534 | |
| 535 | pub |
| 536 | |
| 537 | |
| 538 | |
| 539 | |
| 540 | /// Fail the gate at its END on everything [`external_ladder`] collected. |
| 541 | pub |
| 542 | |
| 543 | |
| 544 | |
| 545 | |
| 546 | |
| 547 | |
| 548 | |
| 549 | |
| 550 | |
| 551 | /// First differing sample between two pictures, as |
| 552 | /// `(plane, index, left, right)` -- so a gate failure names the plane and |
| 553 | /// the sample instead of just "differs". A length difference counts as a |
| 554 | /// mismatch of that plane at the first index past the shorter one. |
| 555 | pub |
| 556 | |
| 557 | |
| 558 | |
| 559 | |
| 560 | |
| 561 | |
| 562 | |
| 563 | |
| 564 | |
| 565 | |
| 566 | |
| 567 | /// The same ladder for this encoder, at four `base_q_idx` points. The PSNR |
| 568 | /// comes from ffmpeg's decode of our own stream, and at EVERY point the |
| 569 | /// stream is decoded twice -- by ffmpeg and by our own |
| 570 | /// [`crate::stream::decode_stream`] -- and all three pictures (encoder |
| 571 | /// reconstruction, ffmpeg's decode, our decode) are asserted sample-exact |
| 572 | /// in Y, U and V over every shown frame in display order. That is itself |
| 573 | /// a gate: it proves the bitstream says what the encoder thinks, in the |
| 574 | /// only two decoders that read it. |
| 575 | pub |
| 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 | /// [`our_ladder`] through the streaming facade — the surface the editor's |
| 660 | /// export drives (`EC_AV1_GATE_FACADE=1`). With a [`crate::encoder::Pyramid`] |
| 661 | /// each stream is also reordered (hidden `ALTREF` first, |
| 662 | /// `show_existing_frame` last per group) and each level is coded at its |
| 663 | /// own quantizer offset; without one it is the flat ladder, which |
| 664 | /// `encoder::tests::the_facade_codes_the_same_bytes_as_encode_sequence` |
| 665 | /// pins byte-identical to [`our_ladder`]'s, so this arm must print the |
| 666 | /// same BD numbers. Returns the ladder, the wall, per pyramid level over |
| 667 | /// the whole ladder how many frames and how many bytes it spent, and the |
| 668 | /// pyramid the streams were EFFECTIVELY coded under — the content gate in |
| 669 | /// `Av1Encoder::encode_frames` drops a screen-content clip back to the |
| 670 | /// flat path, so a requested pyramid can come back `None` here. |
| 671 | pub |
| 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 | |
| 752 | |
| 753 | |
| 754 | /// Byte-exactness gate for encoder work that is meant to change only |
| 755 | /// how long the encoder takes. |
| 756 | /// |
| 757 | /// The BD gate above measures quality, which a speed lane can move by a |
| 758 | /// hair without failing anything; this pins the streams themselves. |
| 759 | /// Re-measured on the lane-av1lr merge with main d5fc99e0 (per-64x64 |
| 760 | /// `cdef_idx` literals and per-unit loop restoration syntax are new bits |
| 761 | /// in the tile) and again on lane-av1mv's merge of it: an extra |
| 762 | /// reference's `NEWMV` is a coded-bits change too, judged by the BD gate |
| 763 | /// above, not by this pin. Re-pinned on lane-av1price2: the search now |
| 764 | /// prices coefficients against the tables the frame's writer really |
| 765 | /// starts from on every non-screen frame (`tile::arm_pricing_cdfs`), a |
| 766 | /// decision change the BD gate judges. Re-pinned again on |
| 767 | /// lane-av1skipctx: the search now prices `txb_skip`/`dc_sign` at the |
| 768 | /// real neighbour contexts ([`Plane::coef_ctx`]) instead of zero, which |
| 769 | /// is the same kind of decision change. Re-pinned on lane-av1lambda: |
| 770 | /// [`LAMBDA_SCALE`] moved 0.1 -> 0.05, so every RD decision in the |
| 771 | /// search moved with it. Re-pinned on lane-av1rejudge: local warp is on |
| 772 | /// by default ([`warp_on`], a sequence/frame header bit and a new |
| 773 | /// motion_mode symbol on eligible blocks) and |
| 774 | /// [`LEAF_SECOND_NEW_MARGIN`] moved 0.8 -> 1.2. Re-pinned on lane-av1tpl: |
| 775 | /// every inter frame's superblocks now code at their own lambda |
| 776 | /// ([`TPL_STRENGTH`]), so every RD decision in an inter frame moved. |
| 777 | /// Re-pinned on lane-av1resweep: [`LAMBDA_SCALE`] moved 0.05 -> 0.0275 |
| 778 | /// and the two var-tx depth searches ([`tx32_depth_search`], |
| 779 | /// [`compound_var_tx`]) are on by default, all three re-judged on the |
| 780 | /// native gate's real film rows. |
| 781 | /// Re-pinned on lane-av1cfl: the chroma search offers `UV_CFL_PRED`, so |
| 782 | /// every block whose chroma takes it codes a different mode symbol, two |
| 783 | /// alpha symbols and different chroma coefficients. `EC_AV1_CFL=0` |
| 784 | /// restores the previous streams. Re-pinned again in the same lane once |
| 785 | /// directional luma winners searched their `angle_delta_y` |
| 786 | /// (`EC_AV1_ANGLE=0` restores that half). |
| 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 | |
| 899 | |
| 900 | |
| 901 | |
| 902 | |
| 903 | |
| 904 | |
| 905 | |
| 906 | |
| 907 | |
| 908 | |
| 909 | |
| 910 | |
| 911 | |
| 912 | |
| 913 | |
| 914 | |
| 915 | |
| 916 | |
| 917 | |
| 918 | |
| 919 | |
| 920 | |
| 921 | |
| 922 | |
| 923 | /// A ladder is only a ladder if both axes rise together. |
| 924 | pub |
| 925 | |
| 926 | |
| 927 | |
| 928 | |
| 929 | |
| 930 | |
| 931 | |
| 932 | |
| 933 | |
| 934 | /// Which var-tx depth this clip's INTER blocks resolved to (lane-av1tx2, |
| 935 | /// split by block class in lane-av1txdepth): depth 0 is one transform over |
| 936 | /// the whole block, 1 its four halves; the classes are the 16x16/8x8 |
| 937 | /// leaves and the 32x32 root, each single-reference or compound. A class |
| 938 | /// with no counts at all never reached `commit_inter_luma` -- which is |
| 939 | /// what its knob being off looks like (class `gate-blind-to-feature`). |
| 940 | pub |
| 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 | |
| 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 | |
| 1024 | |
| 1025 | /// The video stream's coded size, from ffprobe. |
| 1026 | pub |
| 1027 | |
| 1028 | |
| 1029 | |
| 1030 | /// `EC_AV1_NATIVE_CROP=<width>x<height>`: the native gate's window at a |
| 1031 | /// size of the reader's choosing instead of [`crate::probe::gate_crop`]'s |
| 1032 | /// superblock-aligned one, still centred and still even for 4:2:0. |
| 1033 | /// |
| 1034 | /// WHY IT EXISTS (lane-sse): `gate_crop` rounds DOWN to whole 128-wide |
| 1035 | /// superblocks by design, so no default gate row has a block the frame |
| 1036 | /// edge cuts through -- while every arbitrary export size does (3840x1608 |
| 1037 | /// is 25.1 superblock rows, 1920x1080 is 8.4). `EC_AV1_NATIVE_CROP= |
| 1038 | /// 1920x1080` is the straddling arm the edge-clipped distortion score is |
| 1039 | /// read on. |
| 1040 | pub |
| 1041 | |
| 1042 | |
| 1043 | |
| 1044 | |
| 1045 | |
| 1046 | |
| 1047 | |
| 1048 | |
| 1049 | |
| 1050 | |
| 1051 | |
| 1052 | |
| 1053 | |
| 1054 | |
| 1055 | /// The probe arms the gate's source (lane-probe, class `instrument |
| 1056 | /// disagrees with the gate`). `examples/enc_probe` built its own ffmpeg |
| 1057 | /// command line and had no `-ss`, so it read film B from frame 0 -- a |
| 1058 | /// black leader -- and coded 59 kB where the gate's own ladder point |
| 1059 | /// coded 89 kB of the same title; every census taken through it was |
| 1060 | /// probe-relative. Both now call [`crate::probe::source`]; this pins that |
| 1061 | /// the shared loader honours the seek (arming the probe's way and the |
| 1062 | /// gate's way gives byte-identical streams, and dropping the seek does |
| 1063 | /// not), on a synthetic clip whose content moves over time. |
| 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 | /// lane-refs: THE FRAME FILTER REACHES THE PIXELS. `mc::predict` used to |
| 1133 | /// hardwire the REGULAR kernel, so the encoder could not have coded a |
| 1134 | /// SMOOTH or SHARP frame even if the header had said so -- the search, |
| 1135 | /// the trials, the recon and the frame header now all read |
| 1136 | /// `FrameCtx::interp_filter`. Each of the three kernels codes its own |
| 1137 | /// distinct stream (a filter that never reached the prediction would code |
| 1138 | /// the same bytes as REGULAR, class `symbol consumption gap`), and ffmpeg |
| 1139 | /// reconstructs every frame of each of them exactly, which is what proves |
| 1140 | /// the header and the prediction agree. |
| 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 | /// lane-hpmv: THE EIGHTH-PEL VECTOR REACHES THE STREAM. With |
| 1185 | /// `allow_high_precision_mv` off the writer refuses an odd eighth-pel |
| 1186 | /// residual outright (`round_to_valid_mv` rounds it away first), so the |
| 1187 | /// finest vector the encoder could commit to was a quarter pel. With the |
| 1188 | /// header bit on, the writer codes an `mv_hp`/`mv_class0_hp` symbol per |
| 1189 | /// non-zero component and the search's fourth stage refines to the |
| 1190 | /// eighth: this asserts ZERO hp symbols in the off arm, non-zero in the |
| 1191 | /// on arm, and -- the part that makes it a signal rather than a symbol |
| 1192 | /// count (class `fixture proves the symbol, not the signal`) -- that some |
| 1193 | /// of them come out ZERO, i.e. name a vector the off arm cannot code at |
| 1194 | /// all. Both streams are decoded by ffmpeg AND by this crate's own |
| 1195 | /// decoder and asserted sample-exact against the encoder's own |
| 1196 | /// reconstruction, which is what proves the header bit and the symbols |
| 1197 | /// agree. |
| 1198 | |
| 1199 | |
| 1200 | |
| 1201 | |
| 1202 | |
| 1203 | |
| 1204 | |
| 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 |