edith_codecs
Clone
https://git.tahinli.com/Tahinli/edith_codecs.git
0 watching0 forksRust370.3 MiB9b67700Tahinli3 days ago4021 commits
| 1 | //! Software decoder for this crate's own key-frame tile payloads (spec 5.11), |
| 2 | //! the reader half of [`crate::tile`]'s writer. |
| 3 | //! |
| 4 | //! `tile.rs` is another lane's territory this round (`lane-av1-rect` is |
| 5 | //! touching its partition search), so nothing here imports its private |
| 6 | //! helpers: the handful of `pub(crate)` items it already exposes |
| 7 | //! ([`crate::tile::block_grid`], [`crate::tile::has_half`], |
| 8 | //! [`crate::tile::INTRA_MODE_CTX`], [`crate::tile::write_golomb`]) are reused, |
| 9 | //! and everything else (the partition/coefficient context arithmetic, the |
| 10 | //! scan table) is a from-spec reimplementation kept in step with the writer by |
| 11 | //! the gate tests below rather than by sharing code with it. |
| 12 | //! |
| 13 | //! # Scope (round 1) |
| 14 | //! Key frames only, and only the shapes the encoder actually still needs to |
| 15 | //! prove itself against: every coded block is `DC_PRED` (this crate's mode |
| 16 | //! search names other intra modes, but a decoder for those needs the |
| 17 | //! directional-prediction edge-reach plumbing [`crate::intra::predict`] |
| 18 | //! already carries; wiring it up is round 2), never skipped, and every |
| 19 | //! superblock is a whole number of 64x64 units (a frame whose true edge falls |
| 20 | //! inside one, forcing the gathered-CDF partial-superblock path, is round 2 |
| 21 | //! too). Anything outside that refuses with [`Error::unsupported`] rather than |
| 22 | //! silently miscoding. |
| 23 | use crate; |
| 24 | |
| 25 | use |
| 26 | |
| 27 | |
| 28 | ; |
| 29 | use ; |
| 30 | |
| 31 | // lane-av112bit: the 12-bit warp refusal that used to stand at all three |
| 32 | // warp decision sites (compound, 16x16+, 8x8 leaf) was an inline literal |
| 33 | // (refusal_inventory.rs extracts refusal strings from the decode source); |
| 34 | // it named the real gap: warp's reduce bits inherited the 12-bit |
| 35 | // `conv_params->round_0` (warped_motion.c:295, convolve.h:81..86) and no |
| 36 | // witness existed. |
| 37 | // lane-av112bitw lifted it from all three sites: `warp::warp_round_0` |
| 38 | // implements the bump (`round_0 += max(bd + FILTER_BITS - round_0 - 14, 0)`, |
| 39 | // 5 at 12 bits), and the single-ref witness plus the rotating-mandelbrot |
| 40 | // compound-warp witness are both byte-exact vs ffmpeg. Compound inter |
| 41 | // itself was lifted by lane-av112bitc before that (the combines absorb the |
| 42 | // CONV_BUF gain drop, `INTER_POST_ROUND - delta`, see `mc::combine_compound`). |
| 43 | |
| 44 | |
| 45 | pub use *; |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | use *; |
| 52 | use *; |
| 53 | |
| 54 | |
| 55 | use *; |
| 56 | |
| 57 | |
| 58 | use *; |
| 59 | |
| 60 | |
| 61 | pub use *; |
| 62 | |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | pub use *; |
| 68 | |
| 69 | |
| 70 | use *; |
| 71 | |
| 72 | |
| 73 | |
| 74 | pub use *; |
| 75 | |
| 76 | |
| 77 | use *; |
| 78 | |
| 79 | |
| 80 | use *; |
| 81 | |
| 82 | |
| 83 | use *; |
| 84 | |
| 85 | |
| 86 | pub use *; |
| 87 | |
| 88 | |
| 89 | pub use *; |
| 90 | |
| 91 | |
| 92 | |
| 93 | |
| 94 | |
| 95 | pub use *; |
| 96 | |
| 97 | |
| 98 | pub use *; |
| 99 | |
| 100 | |
| 101 | pub use *; |
| 102 | |
| 103 | |
| 104 | |
| 105 | |
| 106 | |
| 107 | pub use *; |
| 108 | use *; |
| 109 | |
| 110 | /// Per-frame decode state, one instance per decoded stream (lane-thread1). |
| 111 | /// |
| 112 | /// Every field here used to be a `thread_local!` static, which made a decode a |
| 113 | /// function of the calling THREAD's history rather than of the bitstream alone |
| 114 | /// -- and made frame-parallel decoding impossible, since a worker thread sees |
| 115 | /// empty state. The cells keep exactly the interior mutability the statics |
| 116 | /// had, so every read/write site is byte-identical; what changes is WHERE the |
| 117 | /// state lives: `stream.rs` owns one `FrameCtx` and threads `&FrameCtx` down |
| 118 | /// the decode call graph. |
| 119 | /// |
| 120 | /// `Cell`/`RefCell` make this `!Sync` on purpose: a `FrameCtx` belongs to |
| 121 | /// exactly one thread's decode, and is never shared between workers. |
| 122 | /// One frame's in-loop filter intermediates, as [`FrameCtx::capture_stages`] |
| 123 | /// asks for them: each plane's post-deblock (pre-CDEF) and post-CDEF |
| 124 | /// (pre-restoration) samples, at the decoder's own plane stride. |
| 125 | pub |
| 126 | |
| 127 | |
| 128 | |
| 129 | |
| 130 | |
| 131 | |
| 132 | |
| 133 | |
| 134 | /// Takes whatever the last capturing decode left (see |
| 135 | /// [`FrameCtx::capture_stages`]). |
| 136 | // read from the encoder's loop restoration search |
| 137 | pub |
| 138 | |
| 139 | |
| 140 | |
| 141 | pub |
| 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 | |
| 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 | |
| 311 | |
| 312 | |
| 313 | |
| 314 | |
| 315 | |
| 316 | |
| 317 | |
| 318 | |
| 319 | |
| 320 | |
| 321 | |
| 322 | |
| 323 | |
| 324 | |
| 325 | |
| 326 | |
| 327 | |
| 328 | |
| 329 | |
| 330 | |
| 331 | |
| 332 | |
| 333 | |
| 334 | |
| 335 | |
| 336 | |
| 337 | |
| 338 | |
| 339 | |
| 340 | |
| 341 | |
| 342 | |
| 343 | |
| 344 | |
| 345 | |
| 346 | |
| 347 | |
| 348 | |
| 349 | |
| 350 | |
| 351 | |
| 352 | |
| 353 | /// `LocalKey::with` for a plain value: lets every former `STATIC.with(|c| ..)` |
| 354 | /// site read `fctx.field.with(|c| ..)` unchanged. `LocalKey`'s own inherent |
| 355 | /// `with` still wins for the scratch pools and gate counters that stay |
| 356 | /// thread-local. |
| 357 | pub |
| 358 | |
| 359 | |
| 360 | |
| 361 | |
| 362 | |
| 363 | |
| 364 | /// A [`FrameCtx`] copy for one of [`crate::par`]'s filter worker threads. |
| 365 | /// |
| 366 | /// `FrameCtx` is `!Sync` on purpose (a decode's state belongs to one thread), |
| 367 | /// and the post-decode filter chain reads exactly these fields: the bit depth |
| 368 | /// (every kernel's clamp and threshold shift), the segmentation table |
| 369 | /// (`segment_id_at`/`lf_level` in the deblocker), the frame's superres state |
| 370 | /// and the film-grain bit depth. Everything else keeps [`FrameCtx::new`]'s |
| 371 | /// default -- a field that turns out to be read after all shows up as a hash |
| 372 | /// mismatch in |
| 373 | /// `a_real_stream_filters_identically_with_one_and_four_filter_threads`. |
| 374 | pub |
| 375 | |
| 376 | |
| 377 | |
| 378 | |
| 379 | |
| 380 | |
| 381 | |
| 382 | |
| 383 | |
| 384 | |
| 385 | |
| 386 | |
| 387 | |
| 388 | |
| 389 | |
| 390 | |
| 391 | |
| 392 | |
| 393 | |
| 394 | |
| 395 | |
| 396 | use cratecdf; |
| 397 | use crate; |
| 398 | use crate; |
| 399 | use cratepredict; |
| 400 | use cratemc; |
| 401 | use crateSymbolDecoder; |
| 402 | use crate |
| 403 | |
| 404 | |
| 405 | |
| 406 | |
| 407 | |
| 408 | ; |
| 409 | use crate; |
| 410 | use crate; |
| 411 | |
| 412 | const PARTITION_NONE: usize = 0; |
| 413 | const PARTITION_HORZ: usize = 1; |
| 414 | const PARTITION_VERT: usize = 2; |
| 415 | const PARTITION_SPLIT: usize = 3; |
| 416 | const PARTITION_HORZ_A: usize = 4; |
| 417 | const PARTITION_HORZ_B: usize = 5; |
| 418 | const PARTITION_VERT_A: usize = 6; |
| 419 | const PARTITION_VERT_B: usize = 7; |
| 420 | const PARTITION_HORZ_4: usize = 8; |
| 421 | const PARTITION_VERT_4: usize = 9; |
| 422 | const SB_MI: u32 = 16; |
| 423 | const BLOCK_MI: u32 = 8; |
| 424 | |
| 425 | // lane-sb128 r1: this sequence's `use_128x128_superblock` (spec 5.5.1). |
| 426 | // Every superblock-granular rule below (`delta_q`/`delta_lf`'s "is this the |
| 427 | // superblock's own top-left mi?", the loop-restoration read's unit span, the |
| 428 | // partition tree's own root level) keys off it; `SB_MI` stays the 64x64 |
| 429 | // *quadrant* size a 128 superblock is decoded in, which is also what the CDEF |
| 430 | // grid is indexed by (libaom `read_cdef` reads one `cdef_idx` per 64x64 |
| 431 | // inside a 128 superblock). |
| 432 | thread_local! |
| 433 | |
| 434 | |
| 435 | |
| 436 | |
| 437 | |
| 438 | |
| 439 | |
| 440 | /// Called by [`crate::stream::decode_stream`] before each frame's tiles with |
| 441 | /// that frame's DECODE-order index. |
| 442 | |
| 443 | |
| 444 | |
| 445 | |
| 446 | |
| 447 | |
| 448 | |
| 449 | |
| 450 | |
| 451 | |
| 452 | |
| 453 | |
| 454 | |
| 455 | |
| 456 | |
| 457 | |
| 458 | |
| 459 | pub |
| 460 | |
| 461 | |
| 462 | |
| 463 | |
| 464 | |
| 465 | |
| 466 | |
| 467 | |
| 468 | |
| 469 | |
| 470 | |
| 471 | |
| 472 | /// Sets [`SB128`] for this thread (called once per frame from `stream.rs`). |
| 473 | pub |
| 474 | |
| 475 | |
| 476 | |
| 477 | |
| 478 | /// lane-av1mixloss: sets [`FrameCtx::lossless_per_seg`] (called once per frame |
| 479 | /// from `stream.rs`). |
| 480 | pub |
| 481 | |
| 482 | |
| 483 | |
| 484 | /// The BLOCK's own lossless bit: libaom's `xd->lossless[mbmi->segment_id]`. |
| 485 | /// The table is computed once per frame (libaom `decodeframe.c:5205`: |
| 486 | /// `qindex == 0` with every plane delta 0, `av1_get_qindex` applying the |
| 487 | /// segment's `SEG_LVL_ALT_Q`), but the frame never carries ONE lossless rule |
| 488 | /// -- `read_tx_size`, `read_tx_type` and `is_cfl_allowed` all index it by the |
| 489 | /// BLOCK's own segment id, which the spec-order `segment_id` read sets before |
| 490 | /// any mode/transform symbol of the block. A frame whose segments disagree |
| 491 | /// codes TX_4X4/WHT blocks and normal blocks side by side. |
| 492 | pub |
| 493 | |
| 494 | |
| 495 | |
| 496 | |
| 497 | /// Sets [`FrameCtx::disable_cdf_update`] (called once per frame from |
| 498 | /// `stream.rs`). |
| 499 | pub |
| 500 | |
| 501 | |
| 502 | |
| 503 | /// This frame's `disable_cdf_update`, for the tile readers -- |
| 504 | /// [`msac::SymbolDecoder::set_cdf_update`](crate::msac::SymbolDecoder::set_cdf_update). |
| 505 | pub |
| 506 | |
| 507 | |
| 508 | |
| 509 | /// The transform side a block of `side` pixels codes: its own (capped at the |
| 510 | /// caller's own largest) normally, 4 on a lossless BLOCK, where libaom's |
| 511 | /// `read_tx_size` returns TX_4X4 before it looks at anything else |
| 512 | /// (`decodeframe.c`: `if (xd->lossless[xd->mi[0]->segment_id]) return |
| 513 | /// TX_4X4;`). |
| 514 | pub |
| 515 | |
| 516 | |
| 517 | |
| 518 | /// `is_cfl_allowed` (libaom `blockd.h`): CfL is offered on a block up to |
| 519 | /// 32x32 -- but on a LOSSLESS BLOCK only when the block's CHROMA plane block |
| 520 | /// is exactly BLOCK_4X4, i.e. (at 4:2:0) a luma block of 8x8 or smaller. |
| 521 | /// Getting this wrong picks the 14-symbol CFL `uv_mode` alphabet where libaom |
| 522 | /// picks the 13-symbol one (class `wrong-alphabet-same-value`). |
| 523 | pub |
| 524 | |
| 525 | |
| 526 | |
| 527 | |
| 528 | |
| 529 | |
| 530 | |
| 531 | |
| 532 | |
| 533 | |
| 534 | |
| 535 | |
| 536 | |
| 537 | |
| 538 | |
| 539 | |
| 540 | |
| 541 | |
| 542 | |
| 543 | /// This sequence's superblock size in mi units (16 = 64x64, 32 = 128x128). |
| 544 | pub |
| 545 | |
| 546 | |
| 547 | |
| 548 | thread_local! |
| 549 | |
| 550 | |
| 551 | |
| 552 | |
| 553 | /// Current value of `PART128_GATHERED_SYMBOLS`: 128 roots that read the |
| 554 | /// half-out-of-frame gathered split_or_horz/split_or_vert symbol (spec |
| 555 | /// 5.11.4), which this decoder used to read and throw away. |
| 556 | // read only from the `#[cfg(test)]` gates |
| 557 | pub |
| 558 | |
| 559 | |
| 560 | |
| 561 | /// Current value of [`PART128_SYMBOLS`]. |
| 562 | // read only from the `#[cfg(test)]` gates |
| 563 | pub |
| 564 | |
| 565 | |
| 566 | |
| 567 | /// [`gather`] over an alphabet of any length -- the 128-level partition CDF |
| 568 | /// has 8 symbols (no `PARTITION_HORZ_4`/`_VERT_4` at `BLOCK_128X128`, spec |
| 569 | /// `partition_cdf_length`), so its forced-split gather sums 5 elements where |
| 570 | /// the 64/32 levels sum 6. |
| 571 | pub |
| 572 | |
| 573 | |
| 574 | |
| 575 | |
| 576 | /// [`VERT_ALIKE`]/[`HORZ_ALIKE`] without the 1:4 arms, for the 128 root. |
| 577 | pub const VERT_ALIKE128: = ; |
| 578 | pub const HORZ_ALIKE128: = ; |
| 579 | |
| 580 | // lane-realworld r1: this frame's `cdef.bits` (spec 5.9.19), threaded into |
| 581 | // [`maybe_read_cdef_idx`] the same way [`ENABLE_EDGE_FILTER`] threads a |
| 582 | // frame-level flag through the recursive block decode -- `0` (the default) |
| 583 | // makes every call a true no-op, matching every existing gate stream's |
| 584 | // `cdef_bits == 0` behaviour exactly. |
| 585 | // lane-realworld r8: the sequence header's `color_config.bit_depth`, set |
| 586 | // once per `decode_key_frame_tile_with_cdfs`/`decode_inter_frame_tile_with_cdfs` |
| 587 | // call the same way `CDEF_BITS` is above. `stream.rs`'s own refusal still |
| 588 | // blocks every non-8-bit stream from reaching a decode call, so this is `8` |
| 589 | // on every path that runs today -- threading it now (rather than the literal |
| 590 | // `8`) is stage 1 of widening past that refusal without re-deriving every |
| 591 | // clamp bound later. `PlaneBuf`'s sample storage stays `u16` regardless of |
| 592 | // depth (this decoder's own internal choice, matches dav1d/libaom). |
| 593 | /// `(1 << bit_depth) - 1` — the reconstruction clamp bound for the current |
| 594 | /// stream's [`BIT_DEPTH`], replacing the crate-wide literal `255`. |
| 595 | pub |
| 596 | |
| 597 | |
| 598 | /// The current stream's bit depth, for callers (e.g. dequant) that need the |
| 599 | /// raw value rather than the derived clamp bound. |
| 600 | pub |
| 601 | |
| 602 | |
| 603 | /// Sets [`BIT_DEPTH`] for the current thread, called once per frame from |
| 604 | /// [`crate::stream`]'s decode loop. |
| 605 | pub |
| 606 | |
| 607 | |
| 608 | |
| 609 | /// This stream's `mono_chrome` (see [`FrameCtx::mono_chrome`]): a |
| 610 | /// monochrome frame has `NumPlanes == 1`, so no block codes any chroma |
| 611 | /// symbol or chroma coefficient and the output picture is luma only. |
| 612 | pub |
| 613 | |
| 614 | |
| 615 | |
| 616 | /// Sets [`mono`] for the current thread, called once per frame from |
| 617 | /// [`crate::stream`]'s decode loop like [`set_bit_depth`]. |
| 618 | pub |
| 619 | |
| 620 | |
| 621 | |
| 622 | /// Sequence subsampling. Set once per frame from stream.rs, like set_mono. |
| 623 | pub |
| 624 | |
| 625 | |
| 626 | |
| 627 | |
| 628 | |
| 629 | pub |
| 630 | |
| 631 | |
| 632 | |
| 633 | |
| 634 | pub |
| 635 | |
| 636 | |
| 637 | |
| 638 | /// libaom ROUND_POWER_OF_TWO. At ss=1 equals div_ceil(dim, 2); at ss=0 is dim. |
| 639 | |
| 640 | pub |
| 641 | |
| 642 | |
| 643 | |
| 644 | /// This frame's superres state: `(upscaled_width, superres_denom)`, or |
| 645 | /// `(0, 8)` when the frame is not scaled. Spec 7.16's upscale runs |
| 646 | /// between CDEF and loop restoration, so LOOP RESTORATION -- unit grid, |
| 647 | /// `read_lr`'s unit corners and the pixel filters themselves -- works in |
| 648 | /// UPSCALED coordinates while deblock and CDEF work in downscaled ones |
| 649 | /// (libaom `av1_superres_upscale` in `decodeframe.c`, and |
| 650 | /// `av1_loop_restoration_corners_in_sb`'s own `mi_to_num_x`/`denom_x` |
| 651 | /// superres arms). Set once per frame from [`crate::stream`]'s decode |
| 652 | /// loop, like [`BIT_DEPTH`], and reset to `(0, 8)` on an unscaled frame |
| 653 | /// so a later frame never inherits it. |
| 654 | /// Sets [`SUPERRES`] for the current thread. `upscaled_width` is 0 (and |
| 655 | /// `denom` 8) for a frame that is not superres-scaled. |
| 656 | pub |
| 657 | |
| 658 | |
| 659 | |
| 660 | /// `(upscaled_width, superres_denom)` when this frame is superres-scaled |
| 661 | /// (libaom `av1_superres_scaled`), else `None`. |
| 662 | pub |
| 663 | |
| 664 | |
| 665 | |
| 666 | |
| 667 | /// `av1_init_warp_params` (libaom reconinter.c): warp is decided per PLANE and |
| 668 | /// bails out at `block_width < 8 || block_height < 8`, so the plane's OWN |
| 669 | /// block dimensions decide it -- never the square `side`/`chroma_side`, which |
| 670 | /// for a rectangular luma block (8x16, 16x8) or a PARTITION_HORZ/VERT strip is |
| 671 | /// bigger than the real block in one axis. |
| 672 | pub |
| 673 | |
| 674 | |
| 675 | |
| 676 | |
| 677 | |
| 678 | |
| 679 | |
| 680 | /// This frame's [`QUANT_DELTAS`] `(dc, ac)` pair for plane `plane_idx` (0 = |
| 681 | /// Y, 1 = U, 2 = V) -- luma has no coded `ac` delta (spec 5.9.12 never reads |
| 682 | /// one), so it is always `0` here. |
| 683 | |
| 684 | |
| 685 | |
| 686 | |
| 687 | |
| 688 | |
| 689 | |
| 690 | |
| 691 | |
| 692 | /// lane-av1-qmatrix: records this FRAME's quantisation-matrix levels |
| 693 | /// ([`crate::decode::FrameCtx::qm_levels`]) from the parsed |
| 694 | /// `quantization_params`. Called from `stream.rs` at the frame header, where |
| 695 | /// the refusal this lane lifted used to sit. |
| 696 | pub |
| 697 | |
| 698 | |
| 699 | |
| 700 | /// This block's inverse quantisation matrix -- libaom `av1_get_iqmatrix` |
| 701 | /// (`av1/common/quant_common.c:243`) plus `setup_segmentation_dequant`'s |
| 702 | /// `av1_use_qmatrix` gate, evaluated per dequantisation call site the same |
| 703 | /// way the site already evaluates its quantizer index. `None` dequantises |
| 704 | /// flat (the only behaviour before lane-av1-qmatrix): |
| 705 | /// - a level of 15, which is both libaom's flat sentinel and what every |
| 706 | /// `using_qmatrix == 0` frame's levels are parked at; |
| 707 | /// - a 1D/identity transform (`is_2d_transform` false: libaom's |
| 708 | /// `av1_get_iqmatrix` reads the NULL slot for those); |
| 709 | /// - a LOSSLESS block (libaom `av1_use_qmatrix`'s `!xd->lossless[seg]`: the |
| 710 | /// segment-adjusted quantizer index clamped to 0 with all five plane |
| 711 | /// deltas zero -- the same `block_q_idx` every other dequant site reads). |
| 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 | /// `read_delta_qindex`/`read_delta_q_params` (spec 5.11.10, libaom |
| 741 | /// `decodemv.c:85-146,735-770`), called right after [`maybe_read_cdef_idx`] |
| 742 | /// at every block-decode call site (spec order `skip -> cdef -> delta_q`). |
| 743 | /// A no-op when `delta_q_present` is unset, or when this block is not at the |
| 744 | /// superblock's own top-left MI position (`b_row == 0 && b_col == 0` in |
| 745 | /// libaom, collapsed here to a position check since a partition tree's |
| 746 | /// top-left leaf is the only block that can ever land there), or when that |
| 747 | /// leaf both *is* the whole superblock and is `skip` (the one case libaom |
| 748 | /// itself skips the read, state carrying over unchanged). |
| 749 | |
| 750 | |
| 751 | |
| 752 | |
| 753 | |
| 754 | |
| 755 | |
| 756 | |
| 757 | |
| 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 | /// `read_delta_lflevel`/`read_delta_lf_params` (spec 5.11.11, libaom |
| 789 | /// `decodemv.c:99-146,735-770`) -- same shape and same call-site gating as |
| 790 | /// [`maybe_read_delta_q`] (spec order `delta_q -> delta_lf`), looped over |
| 791 | /// `FRAME_LF_COUNT = 4` planes/directions when `delta_lf_multi` is set, or |
| 792 | /// read once into index 0 otherwise. |
| 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 | /// `read_cdef` (spec 5.11.56, libaom `decodemv.c:read_cdef`), called right |
| 844 | /// after `skip` is known at every block-decode call site. A no-op at |
| 845 | /// `cdef.bits == 0` (0-bit literal, nothing to consume) -- and |
| 846 | /// `read_cdef_params` already forces `bits = 0` under `coded_lossless`/ |
| 847 | /// `allow_intrabc`, so neither needs a separate check here. Reads once per |
| 848 | /// superblock, at the first non-skip block. |
| 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 | thread_local! |
| 896 | |
| 897 | |
| 898 | |
| 899 | |
| 900 | |
| 901 | |
| 902 | |
| 903 | |
| 904 | |
| 905 | /// Installs this frame's segmentation parameters and allocates its map, with |
| 906 | /// `prev` the primary reference frame's saved map (spec |
| 907 | /// `load_previous_segment_ids`; `None` for `PRIMARY_REF_NONE` or an empty |
| 908 | /// slot). Called once per frame, whether or not segmentation is enabled. |
| 909 | pub |
| 910 | |
| 911 | |
| 912 | |
| 913 | |
| 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 | /// This frame's decoded segment map, to be stored into whichever reference |
| 948 | /// slots `refresh_frame_flags` names (spec 7.20's `SavedSegmentIds`). |
| 949 | pub |
| 950 | |
| 951 | |
| 952 | |
| 953 | /// How many distinct segment ids any decoded block has carried. |
| 954 | // read only from the `#[cfg(test)]` gates |
| 955 | pub |
| 956 | |
| 957 | |
| 958 | |
| 959 | /// The lowest and highest quantizer index any decoded block was dequantized |
| 960 | /// with (`(i32::MAX, i32::MIN)` when nothing decoded). |
| 961 | // read only from the `#[cfg(test)]` gates |
| 962 | pub |
| 963 | |
| 964 | |
| 965 | |
| 966 | /// `seg_feature_active_idx(segment_id, feature)` for the frame currently |
| 967 | /// being decoded, with its `FeatureData` value. |
| 968 | |
| 969 | |
| 970 | |
| 971 | |
| 972 | |
| 973 | |
| 974 | |
| 975 | |
| 976 | /// `get_qindex(ignoreDeltaQ = 0, segment_id)` (spec 7.12.2, libaom |
| 977 | /// `av1_get_qindex`) for the block currently being decoded: the running |
| 978 | /// `CurrentQIndex` shifted by this block's segment's `SEG_LVL_ALT_Q` data. |
| 979 | /// Every dequant call site reads the block's quantizer through here. |
| 980 | |
| 981 | |
| 982 | |
| 983 | |
| 984 | |
| 985 | |
| 986 | |
| 987 | |
| 988 | |
| 989 | |
| 990 | |
| 991 | |
| 992 | |
| 993 | |
| 994 | |
| 995 | |
| 996 | |
| 997 | |
| 998 | |
| 999 | |
| 1000 | /// The segment id recorded for one mi cell of the current frame's map. |
| 1001 | |
| 1002 | |
| 1003 | |
| 1004 | |
| 1005 | |
| 1006 | |
| 1007 | |
| 1008 | |
| 1009 | /// `set_segment_id`: stamps `id` over every mi cell this block covers. |
| 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 | /// `copy_segment_id` (libaom `decodemv.c:342`): the previous frame's map is |
| 1036 | /// inherited VERBATIM over this block's own mi footprint -- per-cell copies, |
| 1037 | /// not the minified id [`predicted_segment_id`] hands the block. Without a |
| 1038 | /// previous map the footprint is zeroed, exactly as the C NULL branch does. |
| 1039 | |
| 1040 | |
| 1041 | |
| 1042 | |
| 1043 | |
| 1044 | |
| 1045 | |
| 1046 | |
| 1047 | |
| 1048 | |
| 1049 | |
| 1050 | |
| 1051 | |
| 1052 | |
| 1053 | |
| 1054 | |
| 1055 | |
| 1056 | |
| 1057 | |
| 1058 | |
| 1059 | |
| 1060 | |
| 1061 | |
| 1062 | |
| 1063 | |
| 1064 | |
| 1065 | /// `get_predicted_segment_id` (libaom `dec_get_segment_id` over |
| 1066 | /// `last_frame_seg_map`): the minimum previous-frame segment id over the |
| 1067 | /// block's own mi footprint. `0` when there is no previous map. |
| 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 | /// `av1_neg_deinterleave` (libaom `decodemv.c:258`). |
| 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 | /// `av1_get_spatial_seg_pred`: `(prediction, cdf_index)` from the current |
| 1123 | /// frame's already-decoded above/left/above-left neighbours. |
| 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 | /// `read_segment_id` (libaom `decodemv.c:280`): the spatially predicted id |
| 1151 | /// when `skip`, otherwise one `segment_id` symbol de-interleaved against |
| 1152 | /// that prediction. Does NOT write the map -- callers do. |
| 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 | /// `read_intra_segment_id` (spec 5.11.7): called twice per intra-frame block |
| 1181 | /// -- once before `skip` when `SegIdPreSkip`, once after it otherwise (the |
| 1182 | /// caller decides which by passing `pre_skip`). |
| 1183 | // Signature mirrors the spec's per-call inputs; a parameter struct would only move them. |
| 1184 | |
| 1185 | |
| 1186 | |
| 1187 | |
| 1188 | |
| 1189 | |
| 1190 | |
| 1191 | |
| 1192 | |
| 1193 | |
| 1194 | |
| 1195 | |
| 1196 | |
| 1197 | |
| 1198 | |
| 1199 | |
| 1200 | |
| 1201 | |
| 1202 | /// Whether this frame's intra blocks read their `segment_id` before `skip` |
| 1203 | /// (`SegIdPreSkip`); `false` also when segmentation is off. |
| 1204 | |
| 1205 | |
| 1206 | |
| 1207 | |
| 1208 | |
| 1209 | |
| 1210 | |
| 1211 | /// `read_inter_segment_id(preskip)` (spec 5.11.9, libaom `decodemv.c:352`). |
| 1212 | /// Called at both spec positions of an inter frame's block: `pre_skip = true` |
| 1213 | /// before `skip_mode`/`skip`, and `pre_skip = false` after them. |
| 1214 | // Signature mirrors the spec's per-call inputs; a parameter struct would only move them. |
| 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 | /// `av1_get_pred_context_seg_id`: above + left `seg_id_predicted` flags. |
| 1283 | |
| 1284 | |
| 1285 | |
| 1286 | |
| 1287 | |
| 1288 | |
| 1289 | |
| 1290 | |
| 1291 | |
| 1292 | |
| 1293 | |
| 1294 | |
| 1295 | |
| 1296 | |
| 1297 | |
| 1298 | |
| 1299 | |
| 1300 | |
| 1301 | |
| 1302 | |
| 1303 | /// Spec 5.11.9's `AboveSegPredContext`/`LeftSegPredContext` update. |
| 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 | /// [`Reach::of_tu`] for one transform unit, counting how often that per-unit |
| 1331 | /// answer differs from the standalone-block answer the call sites used before |
| 1332 | /// lane-palette2 r12 -- the counter a gate asserts on to prove a stream really |
| 1333 | /// exercised the fix. `col_off`/`row_off` are in SAMPLES from the parent |
| 1334 | /// block's top-left `(px, py)`. |
| 1335 | |
| 1336 | |
| 1337 | |
| 1338 | |
| 1339 | |
| 1340 | |
| 1341 | |
| 1342 | |
| 1343 | |
| 1344 | |
| 1345 | |
| 1346 | |
| 1347 | |
| 1348 | |
| 1349 | |
| 1350 | |
| 1351 | |
| 1352 | |
| 1353 | |
| 1354 | |
| 1355 | |
| 1356 | |
| 1357 | /// [`tu_reach`] for a unit whose LUMA footprint is a `tx_w` x `tx_h` rect |
| 1358 | /// (lane-av1-422b: a 4:2:2 chroma unit is square in chroma pixels, but its |
| 1359 | /// luma anchor is `(chroma_tx << ss_x, chroma_tx << ss_y)` -- at ss (1,0) |
| 1360 | /// twice as wide as it is tall). Same predicate as [`tu_reach`]; the |
| 1361 | /// square mismatch counter only means anything when the footprint actually |
| 1362 | /// is square. |
| 1363 | // Signature mirrors the spec's per-call inputs; a parameter struct would only move them. |
| 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 | /// lane-comppin r4: decode-order picture counter for `EC_AV1_PREFILT_DUMP`, |
| 1390 | /// mirroring stream.rs's `pictures_decoded` so the two dumps index |
| 1391 | /// identically against aomdec's own `ec_frame_idx` in decodeframe.c. |
| 1392 | static PREFILT_PICTURE_IDX: AtomicUsize = new; |
| 1393 | |
| 1394 | /// Records one decoded forward keyframe (see [`FWD_KF_HITS`]). |
| 1395 | pub |
| 1396 | |
| 1397 | |
| 1398 | |
| 1399 | thread_local! |
| 1400 | |
| 1401 | |
| 1402 | |
| 1403 | /// Current value of [`TXFM_SPLIT_READS`]. |
| 1404 | // read only from the `#[cfg(test)]` gates |
| 1405 | pub |
| 1406 | |
| 1407 | |
| 1408 | |
| 1409 | /// Sets the current thread's [`TX_SELECT_INTER`]/[`REDUCED_TX_SET_INTER`]/ |
| 1410 | /// [`ENABLE_FILTER_INTRA_INTER`]. |
| 1411 | pub |
| 1412 | |
| 1413 | |
| 1414 | |
| 1415 | |
| 1416 | |
| 1417 | |
| 1418 | |
| 1419 | |
| 1420 | |
| 1421 | |
| 1422 | |
| 1423 | |
| 1424 | |
| 1425 | |
| 1426 | |
| 1427 | |
| 1428 | |
| 1429 | |
| 1430 | |
| 1431 | |
| 1432 | |
| 1433 | |
| 1434 | |
| 1435 | /// Bumps one bucket of [`INTER_EDGE_STRIP_HITS`]. |
| 1436 | pub |
| 1437 | |
| 1438 | |
| 1439 | |
| 1440 | |
| 1441 | |
| 1442 | |
| 1443 | |
| 1444 | |
| 1445 | |
| 1446 | |
| 1447 | |
| 1448 | |
| 1449 | |
| 1450 | |
| 1451 | |
| 1452 | |
| 1453 | |
| 1454 | |
| 1455 | |
| 1456 | // lane-av1muchroma site 1: the total number of samples by which |
| 1457 | // `decode_block`'s SKIP arm chroma bookkeeping grids fell SHORT of their own |
| 1458 | // plane block, summed over every skipped block decoded. It reads the |
| 1459 | // allocation's real length, so it measures the shape rather than proxying a |
| 1460 | // condition: the square form this lane removed is `side >> ss_x` squared, |
| 1461 | // which at 4:2:2 (ss (1,0)) is exactly HALF the `side >> ss_x` x `side >> ss_y` |
| 1462 | // plane block, and restoring it drives this counter strictly positive on |
| 1463 | // every 4:2:2 skip block. Zero on 4:2:0 and 4:4:4, where the two forms are |
| 1464 | // the same number. |
| 1465 | thread_local! |
| 1466 | |
| 1467 | |
| 1468 | |
| 1469 | |
| 1470 | /// Current value of [`SKIP_ARM_CHROMA_SHORT_SAMPLES`]. |
| 1471 | // read only from the `#[cfg(test)]` gates |
| 1472 | pub |
| 1473 | |
| 1474 | |
| 1475 | |
| 1476 | // Number of times `decode_block`'s SKIP arm ran at a shape where the |
| 1477 | // per-axis and square chroma allocations DIFFER -- i.e. at 4:2:2, where |
| 1478 | // the square is half the plane block. Zero on 4:2:0 and 4:4:4, where the |
| 1479 | // two forms are the same number, so a gate that wants to prove it actually |
| 1480 | // exercised the shape under test (rather than passing vacuously) asserts |
| 1481 | // this moved. |
| 1482 | thread_local! |
| 1483 | |
| 1484 | |
| 1485 | |
| 1486 | |
| 1487 | /// Current value of [`SKIP_ARM_CHROMA_RECT_SHAPES`]. |
| 1488 | // read only from the `#[cfg(test)]` gates |
| 1489 | pub |
| 1490 | |
| 1491 | |
| 1492 | |
| 1493 | // lane-av1floorshift: the two FRAME chroma plane allocators |
| 1494 | // (`decode_key_frame_tile_with_cdfs` and `decode_inter_tile`'s `PlaneBuf` trio) |
| 1495 | // size U and V as `(width >> ss_x) x (height >> ss_y)` with `width`/`height` |
| 1496 | // the 32-aligned coded size and `true_width`/`true_height` its `mi_cols * 4` |
| 1497 | // counterpart. `lanes/av1subsizesweep.report.md` named these "floor-`>>` |
| 1498 | // chroma plane allocators -- shape assumption at frame edges; not probed": |
| 1499 | // the `>>` FLOORS where libaom's own producer CROPS (`round_ss`), so the |
| 1500 | // question was whether an odd frame dimension makes the allocation one sample |
| 1501 | // short of the extent every chroma walk inside the tile indexes. |
| 1502 | // |
| 1503 | // `FRAME_CHROMA_ALLOC_SHORT_SAMPLES` is the measured answer: the number of |
| 1504 | // samples by which the allocated `cw * ch` fell SHORT of the `round_ss` |
| 1505 | // extent the tile's chroma walks may address, summed over every frame. It |
| 1506 | // reads the allocation's real length against a recomputed `round_ss` bound, so |
| 1507 | // it measures the shape rather than proxying a condition. Restoring a bare |
| 1508 | // `>> 1` on either axis drives it strictly positive at an odd dimension. |
| 1509 | thread_local! |
| 1510 | |
| 1511 | |
| 1512 | |
| 1513 | |
| 1514 | // lane-av1floorshift: frames whose coded luma dimension made `>>` and |
| 1515 | // `round_ss` DISAGREE on a chroma axis -- i.e. the only frames on which the |
| 1516 | // floor-vs-crop question is even decidable. Zero on every even dimension, |
| 1517 | // which is why a gate asserting `FRAME_CHROMA_ALLOC_SHORT_SAMPLES == 0` is |
| 1518 | // vacuous without this: on an even frame the two forms are the same number |
| 1519 | // and the shortfall cannot move. |
| 1520 | thread_local! |
| 1521 | |
| 1522 | |
| 1523 | |
| 1524 | |
| 1525 | // How many times a frame chroma plane allocator ran at all -- one per frame, |
| 1526 | // from either the key-frame or the inter call site. The non-vacuity arm: the |
| 1527 | // other two counters are ZERO on every input that exists (see |
| 1528 | // [`note_frame_chroma_alloc`]), so a gate that only asserted them would pass |
| 1529 | // with the instrument removed entirely. |
| 1530 | thread_local! |
| 1531 | |
| 1532 | |
| 1533 | |
| 1534 | |
| 1535 | /// Current value of [`FRAME_CHROMA_ALLOC_CALLS`]. |
| 1536 | // read only from the `#[cfg(test)]` gates |
| 1537 | pub |
| 1538 | |
| 1539 | |
| 1540 | |
| 1541 | /// Current value of [`FRAME_CHROMA_ALLOC_SHORT_SAMPLES`]. |
| 1542 | // read only from the `#[cfg(test)]` gates |
| 1543 | pub |
| 1544 | |
| 1545 | |
| 1546 | |
| 1547 | /// Current value of [`FRAME_CHROMA_ALLOC_CROP_SHAPES`]. |
| 1548 | // read only from the `#[cfg(test)]` gates |
| 1549 | pub |
| 1550 | |
| 1551 | |
| 1552 | |
| 1553 | /// The census both frame chroma plane allocators share. `shape` is the frame's |
| 1554 | /// own 32-aligned coded `(width, height)`, `ss` its `(ss_x, ss_y)`. |
| 1555 | /// |
| 1556 | /// `round_ss` is libaom's chroma CROP (`av1_round_shift`), the extent the |
| 1557 | /// committed reference planes are stored at and the bound every chroma walk |
| 1558 | /// inside the tile is clamped against. |
| 1559 | /// |
| 1560 | /// `alloc` is the allocator's OWN `(cw, ch)` -- the numbers that size the |
| 1561 | /// `PlaneBuf` -- not a recomputation of them. That is what makes the gate |
| 1562 | /// bite: the shortfall is a difference between what was allocated and what the |
| 1563 | /// tile may address, so replacing the shift with a bare `>> 1` (the 4:2:0-only |
| 1564 | /// form this lane's target class is made of) moves it on the 4:2:2 and 4:4:4 |
| 1565 | /// witnesses, where the correct shift and the hardcoded one are different |
| 1566 | /// numbers. A counter that recomputed `shape >> ss` beside the allocation |
| 1567 | /// would have read the same value either way and proved nothing. |
| 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 | /// lane-av1ibcfork: this decoder's half of the per-unit BIT INTERVAL -- the |
| 1598 | /// exact mirror of the oracle's `EC_ECDUMP_IN` / `EC_ECDUMP_OUT` / |
| 1599 | /// `EC_ECDUMP_END` triple (`aom-oracle2/src/av1/decoder/decodetxb.c`: one |
| 1600 | /// print in `read_coeffs_txb` before and after its `aom_read_symbol`, one in |
| 1601 | /// the single caller `av1_read_coeffs_txb` after the whole unit). |
| 1602 | /// |
| 1603 | /// Why three prints and not one `EC_CENSUS_UNIT`: a COUNT is not a key. The |
| 1604 | /// two sides can walk a different NUMBER of units and still be paired, because |
| 1605 | /// the interval is what a unit CONSUMED. Entry position alone drifts the moment |
| 1606 | /// one side consumes a different number of bits, and list index is invalid the |
| 1607 | /// moment one side misses a unit -- both were measured here and both |
| 1608 | /// mis-attribute. `post_bit` after the `txb_skip` read is the same |
| 1609 | /// `aom_reader_tell` the oracle prints there; `end_bit` is the end of the whole |
| 1610 | /// unit including the optional luma `tx_type`, the eob, the base/BR passes and |
| 1611 | /// the sign/Golomb loop, so a unit that reads the right symbols in the wrong |
| 1612 | /// ORDER is caught too. |
| 1613 | /// |
| 1614 | /// `bit` counts the bits this decoder has pulled out of its window, so it sits |
| 1615 | /// at a CONSTANT offset from the oracle's tell (the OBU header libaom counts |
| 1616 | /// before `aom_reader_init`). The offset is measured per fixture, never |
| 1617 | /// assumed: +14 on `444_intrabc_rect4_witness.obu`. |
| 1618 | |
| 1619 | |
| 1620 | |
| 1621 | |
| 1622 | |
| 1623 | /// The unit's ENTRY position. Returns it so the caller can pass the same value |
| 1624 | /// to [`unit_iv_skip`] and [`unit_iv_end`] without reading the decoder again. |
| 1625 | |
| 1626 | |
| 1627 | |
| 1628 | |
| 1629 | |
| 1630 | |
| 1631 | |
| 1632 | |
| 1633 | |
| 1634 | |
| 1635 | |
| 1636 | |
| 1637 | |
| 1638 | |
| 1639 | |
| 1640 | /// The position immediately after this unit's `txb_skip` read. `bit_in == |
| 1641 | /// post_bit` means the read consumed ZERO bits (a CDF row already at a |
| 1642 | /// boundary), so this is also the real-read filter: the reader logs a step |
| 1643 | /// either way, and counting raw lines overstates the symbol count ~2x (measured |
| 1644 | /// on `444_intrabc_rect4_witness.obu`: 2395 lines, 512 real reads, against the |
| 1645 | /// oracle's 513 -- not the "~1069 fewer" an earlier round reported). |
| 1646 | |
| 1647 | |
| 1648 | |
| 1649 | |
| 1650 | |
| 1651 | |
| 1652 | |
| 1653 | |
| 1654 | |
| 1655 | |
| 1656 | |
| 1657 | |
| 1658 | |
| 1659 | |
| 1660 | |
| 1661 | |
| 1662 | |
| 1663 | |
| 1664 | |
| 1665 | |
| 1666 | |
| 1667 | /// The position after the WHOLE unit. One call per successful read, on both |
| 1668 | /// the all-zero early return and the full coefficient walk. |
| 1669 | |
| 1670 | |
| 1671 | |
| 1672 | |
| 1673 | |
| 1674 | |
| 1675 | |
| 1676 | |
| 1677 | |
| 1678 | |
| 1679 | |
| 1680 | |
| 1681 | /// A just-decoded palette-Y block's own predicted pixels |
| 1682 | /// (`side*side`, row-major, `colors[map[i]]`), consumed by |
| 1683 | /// [`PlaneBuf::reconstruct`]'s next call in place of `predict()` -- the |
| 1684 | /// same off-the-call-stack idiom as [`ENABLE_EDGE_FILTER`] (threading a |
| 1685 | /// per-block override through `read_plane`'s two dozen call sites is the |
| 1686 | /// alternative this avoids). Always empty again once that call consumes |
| 1687 | /// it (`.take()`), so a non-palette block's own `reconstruct` call never |
| 1688 | /// sees stale state. |
| 1689 | /// Arms the pending [`PALETTE_PRED`] override for the next `reconstruct` |
| 1690 | /// (`set`) / consumes it (`take`). Set and take MUST pair: a buffer armed at a |
| 1691 | /// site whose reconstruct never runs would be picked up by the NEXT block's |
| 1692 | /// reconstruct (class [[refusal-hides-a-defect]] / stale thread-local), so |
| 1693 | /// lane-lossless2: one transform unit's window on a block-sized palette |
| 1694 | /// prediction buffer. A unit reads its prediction at ITS OWN stride, so |
| 1695 | /// handing it the whole-block buffer makes every unit reconstruct the block's |
| 1696 | /// top-left corner (the luma split-transform paths already window; the chroma |
| 1697 | /// ones did not, which is invisible until a lossless frame codes a palette |
| 1698 | /// block as 4x4 chroma units). |
| 1699 | |
| 1700 | |
| 1701 | |
| 1702 | |
| 1703 | |
| 1704 | |
| 1705 | |
| 1706 | |
| 1707 | |
| 1708 | |
| 1709 | |
| 1710 | |
| 1711 | |
| 1712 | |
| 1713 | |
| 1714 | |
| 1715 | |
| 1716 | |
| 1717 | |
| 1718 | |
| 1719 | |
| 1720 | |
| 1721 | |
| 1722 | |
| 1723 | |
| 1724 | /// `EC_DEBUG_PAL=1` traces every arm and every consumption with its call site. |
| 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 | /// The luma window a `UV_CFL_PRED` chroma block averages its AC signal over. |
| 1752 | |
| 1753 | pub |
| 1754 | |
| 1755 | |
| 1756 | |
| 1757 | |
| 1758 | |
| 1759 | |
| 1760 | |
| 1761 | |
| 1762 | |
| 1763 | |
| 1764 | |
| 1765 | |
| 1766 | |
| 1767 | |
| 1768 | |
| 1769 | |
| 1770 | |
| 1771 | |
| 1772 | |
| 1773 | /// The dequantization + inverse transform of one transform unit, kept as its |
| 1774 | /// INPUTS so the transform runs where the unit is written. `stride == 0` means |
| 1775 | /// the dense `w x h` residual; otherwise it is re-laid into the |
| 1776 | /// `stride x stride` grid `reconstruct_mc_rect` reads both of its buffers at. |
| 1777 | |
| 1778 | pub |
| 1779 | |
| 1780 | |
| 1781 | |
| 1782 | |
| 1783 | |
| 1784 | |
| 1785 | |
| 1786 | |
| 1787 | |
| 1788 | |
| 1789 | |
| 1790 | |
| 1791 | |
| 1792 | |
| 1793 | |
| 1794 | |
| 1795 | |
| 1796 | |
| 1797 | |
| 1798 | |
| 1799 | |
| 1800 | |
| 1801 | |
| 1802 | |
| 1803 | |
| 1804 | |
| 1805 | |
| 1806 | |
| 1807 | /// lane-av1mixloss: Walsh-Hadamard transform units actually reconstructed. |
| 1808 | /// The mixed-lossless witness's proof the per-segment lossless path really |
| 1809 | /// ran on a frame that is NOT `CodedLossless`. |
| 1810 | static LOSSLESS_WHT_UNITS: AtomicUsize = new; |
| 1811 | |
| 1812 | /// [`LOSSLESS_WHT_UNITS`] -- total over the process, read as a before/after |
| 1813 | /// delta around one decode. |
| 1814 | // read only from the `#[cfg(test)]` gates |
| 1815 | pub |
| 1816 | |
| 1817 | |
| 1818 | |
| 1819 | /// lane-whtshape: 4x4 Walsh-Hadamard units reconstructed as part of a LOSSLESS |
| 1820 | /// transform unit that was itself NOT 4x4 -- a shape libaom cannot code. |
| 1821 | /// `read_tx_mode` (`av1/decoder/decodeframe.c:140`) returns `ONLY_4X4` for a |
| 1822 | /// `coded_lossless` frame before it looks at the `tx_mode` symbol, |
| 1823 | /// `read_tx_size` (`:1117`) returns `TX_4X4` before it looks at a tree, |
| 1824 | /// `get_vartx_max_txsize` (`av1/common/blockd.h:1447`) returns `TX_4X4` for |
| 1825 | /// EVERY plane of a lossless block, and of `av1/common/idct.c`'s |
| 1826 | /// `highbd_inv_txfm_add_*_c` only `highbd_inv_txfm_add_4x4_c` carries a |
| 1827 | /// `lossless` branch -- every other size falls through to the IDCT, because |
| 1828 | /// there is no non-4x4 lossless inverse transform to dispatch to. So one of |
| 1829 | /// these is a CALLER sizing a lossless unit wrongly, not a bitstream shape; |
| 1830 | /// read as a before/after delta around one decode it names the caller. Must |
| 1831 | /// read 0 on a stream whose lossless unit geometry is right. |
| 1832 | static LOSSLESS_WHT_SPLIT_UNITS: AtomicUsize = |
| 1833 | new; |
| 1834 | |
| 1835 | /// [`LOSSLESS_WHT_SPLIT_UNITS`] -- total over the process, read as a |
| 1836 | /// before/after delta around one decode. |
| 1837 | // read only from the `#[cfg(test)]` gates |
| 1838 | pub |
| 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 | |
| 1897 | |
| 1898 | |
| 1899 | |
| 1900 | |
| 1901 | |
| 1902 | |
| 1903 | |
| 1904 | |
| 1905 | |
| 1906 | |
| 1907 | |
| 1908 | |
| 1909 | |
| 1910 | |
| 1911 | |
| 1912 | |
| 1913 | |
| 1914 | /// An all-zero residual, for the transform units that code no coefficient: |
| 1915 | /// [`crate::transform::dequant_and_inverse_typed_wh`] returns those EMPTY, |
| 1916 | /// and the reconstruction loops below read this instead of a per-unit |
| 1917 | /// `vec![0; w * h]`. Sized for the largest stride a recorded unit can carry |
| 1918 | /// (a 128-wide inter block's prediction stride). |
| 1919 | pub static ZERO_RESIDUAL: = ; |
| 1920 | |
| 1921 | /// lane-blockscratch: one plane's coefficient levels as the block-tail |
| 1922 | /// neighbour writes want them. A plane that coded nothing (a skipped block, a |
| 1923 | /// strip with no chroma, luma under a var-tx split whose units already wrote |
| 1924 | /// themselves) names the shared [`ZERO_RESIDUAL`] instead of allocating and |
| 1925 | /// zeroing up to 64 KB of its own per block. |
| 1926 | |
| 1927 | |
| 1928 | |
| 1929 | |
| 1930 | |
| 1931 | |
| 1932 | /// lane-blockscratch: the mu-chunk chroma collector, allocated by the first |
| 1933 | /// unit that writes into it. Only a block wider or taller than 64 px codes its |
| 1934 | /// chroma per 64x64 chunk; every smaller block used to allocate and zero both |
| 1935 | /// collectors per block and then drop them untouched. |
| 1936 | |
| 1937 | |
| 1938 | |
| 1939 | |
| 1940 | |
| 1941 | |
| 1942 | |
| 1943 | |
| 1944 | |
| 1945 | |
| 1946 | |
| 1947 | |
| 1948 | |
| 1949 | |
| 1950 | |
| 1951 | |
| 1952 | |
| 1953 | /// Whether a coefficient grid codes nothing: a [`Grid::Zero`] unit IS the |
| 1954 | /// shared [`ZERO_RESIDUAL`], so one pointer compare answers the 60% of |
| 1955 | /// transform units that code no coefficient without the scan (lane-coefgrid). |
| 1956 | pub |
| 1957 | |
| 1958 | |
| 1959 | |
| 1960 | /// `residual`, or `n` zeros when it is the empty all-zero marker. |
| 1961 | |
| 1962 | |
| 1963 | |
| 1964 | |
| 1965 | |
| 1966 | |
| 1967 | |
| 1968 | |
| 1969 | /// Where a motion-compensated write reads its prediction from. |
| 1970 | |
| 1971 | pub |
| 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 | /// Whether a block's prediction may be built by a recon worker: a wavefront |
| 2017 | /// is running and this frame's references can be handed to it. |
| 2018 | |
| 2019 | |
| 2020 | |
| 2021 | |
| 2022 | /// Records one block's prediction build for the worker that reconstructs it. |
| 2023 | |
| 2024 | |
| 2025 | |
| 2026 | |
| 2027 | |
| 2028 | |
| 2029 | |
| 2030 | |
| 2031 | |
| 2032 | |
| 2033 | |
| 2034 | |
| 2035 | |
| 2036 | |
| 2037 | |
| 2038 | /// The previous block's prediction buffer, cleared and zero-filled to `n` |
| 2039 | /// (lane-blockmem): the same bytes the `vec![0u16; n]` it replaces produced, |
| 2040 | /// without the per-block allocation and free. |
| 2041 | |
| 2042 | |
| 2043 | |
| 2044 | |
| 2045 | |
| 2046 | |
| 2047 | |
| 2048 | |
| 2049 | |
| 2050 | |
| 2051 | |
| 2052 | |
| 2053 | /// [`PlaneBuf::reconstruct`] at its push site: the intra transform block is |
| 2054 | /// written into the tile's planes as soon as it is parsed. |
| 2055 | |
| 2056 | |
| 2057 | |
| 2058 | |
| 2059 | |
| 2060 | |
| 2061 | |
| 2062 | |
| 2063 | |
| 2064 | |
| 2065 | |
| 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 | |
| 2092 | |
| 2093 | |
| 2094 | |
| 2095 | |
| 2096 | /// [`PlaneBuf::reconstruct_rect`] at its push site. |
| 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 | |
| 2133 | |
| 2134 | |
| 2135 | |
| 2136 | |
| 2137 | |
| 2138 | |
| 2139 | /// [`PlaneBuf::reconstruct_mc_rect`] at `stride == w == h == side`. |
| 2140 | |
| 2141 | |
| 2142 | |
| 2143 | |
| 2144 | |
| 2145 | |
| 2146 | |
| 2147 | |
| 2148 | |
| 2149 | |
| 2150 | |
| 2151 | |
| 2152 | |
| 2153 | |
| 2154 | |
| 2155 | |
| 2156 | |
| 2157 | |
| 2158 | /// [`PlaneBuf::reconstruct_mc_rect`] at its push site. |
| 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 | /// [`push_intra_rect`] carrying the transform's INPUTS: the dequantization |
| 2219 | /// and inverse transform run here, at the push site. |
| 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 | /// [`push_mc_rect`] carrying the transform's INPUTS (see [`push_intra_tx`]). |
| 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 | |
| 2321 | |
| 2322 | |
| 2323 | |
| 2324 | |
| 2325 | |
| 2326 | |
| 2327 | |
| 2328 | |
| 2329 | |
| 2330 | |
| 2331 | |
| 2332 | |
| 2333 | |
| 2334 | |
| 2335 | |
| 2336 | |
| 2337 | |
| 2338 | |
| 2339 | |
| 2340 | |
| 2341 | |
| 2342 | |
| 2343 | |
| 2344 | |
| 2345 | |
| 2346 | |
| 2347 | |
| 2348 | |
| 2349 | |
| 2350 | |
| 2351 | |
| 2352 | |
| 2353 | |
| 2354 | |
| 2355 | |
| 2356 | |
| 2357 | |
| 2358 | |
| 2359 | |
| 2360 | |
| 2361 | |
| 2362 | |
| 2363 | /// Performs one intra transform block's write into the tile's planes. |
| 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 | |
| 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 | /// Performs one motion-compensated transform block's write (see [`exec_intra`]). |
| 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 | // The `tx_type` the last plane-0 [`read_plane`] actually coded, kept so |
| 2508 | // an intrabc block's chroma reads can inherit it (see |
| 2509 | // [`INTRABC_CHROMA_TX`]). Written on every luma read; only ever read |
| 2510 | // through that one arming site. |
| 2511 | // libaom `av1_get_tx_type` (`blockd.h:1350`): for `PLANE_TYPE_UV` it |
| 2512 | // branches on `is_inter_block(mbmi)` -- which `is_intrabc_block` also |
| 2513 | // satisfies (`blockd.h:373`) -- and takes the *colocated luma |
| 2514 | // transform's coded* `tx_type` (`mbmi->txk_type[...]`), never |
| 2515 | // `intra_mode_to_tx_type` of the chroma mode. `Some` only across an |
| 2516 | // intrabc block's two chroma [`read_plane`] calls; the type decides the |
| 2517 | // `TX_CLASS`, hence the scan order, `eob_multi_ctx` and every nz context |
| 2518 | // -- getting it wrong desyncs the chroma coefficients, it is not a |
| 2519 | // reconstruction-only detail. |
| 2520 | |
| 2521 | /// Whether this frame's header set `allow_intrabc` -- [`INTRABC_MI_GRID`] is |
| 2522 | /// `Some` exactly then (set once per frame in `decode_frame`), so the flag |
| 2523 | /// needs no separate plumbing to reach the rect-strip mode reader. |
| 2524 | |
| 2525 | |
| 2526 | |
| 2527 | |
| 2528 | thread_local! |
| 2529 | |
| 2530 | |
| 2531 | |
| 2532 | |
| 2533 | |
| 2534 | |
| 2535 | /// Current value of [`RECT_INTRABC_READS`]. |
| 2536 | pub |
| 2537 | |
| 2538 | |
| 2539 | |
| 2540 | thread_local! |
| 2541 | |
| 2542 | |
| 2543 | |
| 2544 | |
| 2545 | |
| 2546 | |
| 2547 | |
| 2548 | |
| 2549 | /// Current value of [`INTRABC_128RECT_CHUNK_SHAPE`]. |
| 2550 | // read only from the `#[cfg(test)]` gates |
| 2551 | |
| 2552 | |
| 2553 | |
| 2554 | |
| 2555 | /// Records one coded block into [`INTRABC_MI_GRID`]: every block contributes |
| 2556 | /// its size (libaom's `scan_row_mbmi` advances `processed_rows` off any |
| 2557 | /// candidate's `bsize`, ref-match or not), an intrabc one also its DV as an |
| 2558 | /// `INTRA_FRAME` candidate (libaom treats intrabc as `is_inter_block`). |
| 2559 | |
| 2560 | |
| 2561 | |
| 2562 | |
| 2563 | |
| 2564 | |
| 2565 | |
| 2566 | |
| 2567 | |
| 2568 | |
| 2569 | |
| 2570 | /// [`record_intrabc_mi`] with a true rectangular footprint: `av1_find_mv_refs` |
| 2571 | /// takes the block's real `bsize`, so a sub-8x8 `BLOCK_4X8`/`BLOCK_8X4` |
| 2572 | /// intrabc leaf must publish a 1x2/2x1 mi span, not a square (lane-av1txr). |
| 2573 | /// |
| 2574 | /// Also stamps libaom's `is_inter_block` verdict for this block into the |
| 2575 | /// `above_inter`/`left_inter` bands ([`tx_size_context_txfm_rect`]'s override |
| 2576 | /// term): `is_inter_block` is `is_intrabc_block(mbmi) || ref_frame[0] > |
| 2577 | /// INTRA_FRAME` (`blockd.h:373`), so an intrabc block is "inter" there and |
| 2578 | /// `get_tx_size_context` reads its BLOCK size rather than its transform band. |
| 2579 | /// The `false` half of the stamp is [`Neighbours::fill_lf_grid_rect`]'s, which |
| 2580 | /// every block runs; this runs after it (class leaked-band otherwise). |
| 2581 | |
| 2582 | |
| 2583 | |
| 2584 | |
| 2585 | |
| 2586 | |
| 2587 | |
| 2588 | |
| 2589 | |
| 2590 | |
| 2591 | |
| 2592 | |
| 2593 | |
| 2594 | |
| 2595 | |
| 2596 | |
| 2597 | |
| 2598 | |
| 2599 | |
| 2600 | |
| 2601 | |
| 2602 | |
| 2603 | |
| 2604 | |
| 2605 | |
| 2606 | |
| 2607 | |
| 2608 | |
| 2609 | |
| 2610 | |
| 2611 | |
| 2612 | |
| 2613 | |
| 2614 | |
| 2615 | |
| 2616 | |
| 2617 | |
| 2618 | |
| 2619 | |
| 2620 | |
| 2621 | |
| 2622 | |
| 2623 | |
| 2624 | |
| 2625 | |
| 2626 | |
| 2627 | |
| 2628 | |
| 2629 | |
| 2630 | |
| 2631 | |
| 2632 | /// Bump [`FIMV_FRAME_HITS`] -- called once per decoded frame header whose |
| 2633 | /// `force_integer_mv` bit is set. |
| 2634 | |
| 2635 | |
| 2636 | |
| 2637 | |
| 2638 | // lane-t900 r27: OBMC blends that actually READ a recorded switchable filter |
| 2639 | // off the neighbour band -- the positive half of the proof for "an OBMC |
| 2640 | // neighbour whose switchable interp filter was never recorded". A |
| 2641 | // fixed-filter frame returns before this point (its neighbours legitimately |
| 2642 | // carry the `[3, 3]` sentinel), so every bump is a neighbour whose own |
| 2643 | // `interp_filter` symbols were published by `record_inter_rect_mi`. |
| 2644 | thread_local! |
| 2645 | |
| 2646 | |
| 2647 | |
| 2648 | /// Current value of [`OBMC_FILTER_BAND_READS`]. |
| 2649 | // read only from the `#[cfg(test)]` gates |
| 2650 | pub |
| 2651 | |
| 2652 | |
| 2653 | |
| 2654 | /// lane-inter16ab r5: the six RECTANGULAR wedge shapes, in this order -- |
| 2655 | /// the counter slots of [`RECT_WEDGE_HITS`]/[`RECT_WII_HITS`]. |
| 2656 | pub const RECT_WEDGE_SHAPES: = |
| 2657 | ; |
| 2658 | |
| 2659 | |
| 2660 | |
| 2661 | |
| 2662 | |
| 2663 | // lane-intra14 r1: set while an INTRA block of an INTER frame is decoded |
| 2664 | // through one of the key-frame rect readers ([`decode_block_rect4`], |
| 2665 | // [`decode_block_rect64`]). `Some((size_group, skip))` tells |
| 2666 | // [`read_intra_mode_rect`] that (a) `skip`/segment id/cdef/delta-q were |
| 2667 | // already read by [`decode_inter_block`] and (b) the luma mode comes off |
| 2668 | // `y_mode_cdf[size_group_lookup[bsize]]` (libaom `read_intra_block_mode_info`, |
| 2669 | // decodemv.c:1189), never the key frame's above/left `kf_y_mode` pair. |
| 2670 | |
| 2671 | // lane-modectx r1: how many times a `kf_y_mode`/`y_mode` neighbour read at a |
| 2672 | // TILE edge found its coarse fallback band holding a NON-DC mode -- i.e. a |
| 2673 | // mode from the previous tile, where libaom's `up_available`/`left_available` |
| 2674 | // make the neighbour DC_PRED. Measured 0 over 20 two-tile-column streams: |
| 2675 | // `above_mode` is cleared per tile in `Neighbours::start_tile` and `left_mode` |
| 2676 | // per superblock row in `start_row`, so the luma fallback cannot leak the way |
| 2677 | // lane-mtfix's `above_uv_mode` one did. The gate asserts it stays 0 -- this is |
| 2678 | // the invariant that makes the coarse fallback safe. |
| 2679 | thread_local! |
| 2680 | |
| 2681 | |
| 2682 | |
| 2683 | |
| 2684 | /// Current value of [`MODE_TILE_EDGE_COARSE_LEAKS`]. |
| 2685 | // read only from the `#[cfg(test)]` gates |
| 2686 | pub |
| 2687 | |
| 2688 | |
| 2689 | |
| 2690 | thread_local! |
| 2691 | |
| 2692 | |
| 2693 | |
| 2694 | /// Current value of [`UV_LEFT_SS_Y_READS`]. |
| 2695 | |
| 2696 | |
| 2697 | |
| 2698 | |
| 2699 | // lane-av1leftwit: the per-tile epoch `uv_owner` cells are stamped with. |
| 2700 | // Bumped in `Neighbours::start_tile`; never read by decode logic. |
| 2701 | thread_local! |
| 2702 | |
| 2703 | |
| 2704 | |
| 2705 | |
| 2706 | |
| 2707 | |
| 2708 | |
| 2709 | |
| 2710 | |
| 2711 | |
| 2712 | |
| 2713 | |
| 2714 | |
| 2715 | /// [`bump_edge32`] of `base + bit`, returning the bit -- the gathered edge |
| 2716 | /// reads are `if`-conditions, so the counter has to ride the expression. |
| 2717 | |
| 2718 | |
| 2719 | |
| 2720 | |
| 2721 | |
| 2722 | |
| 2723 | |
| 2724 | |
| 2725 | |
| 2726 | |
| 2727 | |
| 2728 | |
| 2729 | |
| 2730 | |
| 2731 | |
| 2732 | /// One 16x4 / 4x16 inter strip's chroma situation, handed to |
| 2733 | /// [`decode_inter_block`] out of band (the same one-shot thread-local idiom |
| 2734 | /// `REDUCED_TX_SET_INTER` uses) rather than through twenty-three call sites |
| 2735 | /// that all mean "an ordinary block, chroma of its own". |
| 2736 | |
| 2737 | pub |
| 2738 | |
| 2739 | |
| 2740 | |
| 2741 | |
| 2742 | |
| 2743 | |
| 2744 | |
| 2745 | |
| 2746 | |
| 2747 | |
| 2748 | |
| 2749 | |
| 2750 | |
| 2751 | |
| 2752 | |
| 2753 | /// The single-reference MC parameters of the inter block that decoded |
| 2754 | /// last -- read by the next 1:4 strip to build its pair's chroma. |
| 2755 | |
| 2756 | |
| 2757 | |
| 2758 | |
| 2759 | |
| 2760 | |
| 2761 | |
| 2762 | |
| 2763 | |
| 2764 | |
| 2765 | /// Everything [`decode_inter_block`] needs to fold temporal MV candidates |
| 2766 | /// (spec 7.10.2.8), threaded down from [`decode_inter_frame_tile_with_cdfs`]: |
| 2767 | /// the current frame's own projected field ([`crate::motion_field::setup_motion_field`]'s |
| 2768 | /// output, built by the caller when `header.use_ref_frame_mvs` is set) plus |
| 2769 | /// the order-hint bookkeeping [`crate::motion_field::get_relative_dist`] |
| 2770 | /// needs to turn a query block's own resolved `ref_frame` into |
| 2771 | /// `TplArgs::cur_offset_0` (spec 7.9.3). |
| 2772 | pub |
| 2773 | |
| 2774 | |
| 2775 | |
| 2776 | |
| 2777 | |
| 2778 | |
| 2779 | |
| 2780 | |
| 2781 | |
| 2782 | /// Builds this frame's own saved motion field (libaom `av1_copy_frame_mvs`, |
| 2783 | /// spec 7.9's per-frame `MotionFieldMvs` storage step) from its fully |
| 2784 | /// decoded `grid`: every 4x4 unit an inter block covers reads the same |
| 2785 | /// `MiInfo` ([`decode_inter_block`]/`decode_inter_block8` write it |
| 2786 | /// block-uniform), so sampling any one 4x4 unit inside each 8x8 cell is |
| 2787 | /// exact — every block this crate ever codes is at least 8x8, so no 8x8 |
| 2788 | /// cell straddles two different blocks' values. |
| 2789 | pub |
| 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 | |
| 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 | |
| 2877 | |
| 2878 | |
| 2879 | |
| 2880 | |
| 2881 | |
| 2882 | |
| 2883 | |
| 2884 | |
| 2885 | |
| 2886 | /// The sequence header's `enable_intra_edge_filter`, set once per |
| 2887 | /// [`decode_key_frame_tile_with_cdfs`] call: [`PlaneBuf::reconstruct`]'s |
| 2888 | /// own read of it, kept off the call stack (see that function's own doc |
| 2889 | /// comment for why) rather than threaded through every `read_plane`/ |
| 2890 | /// `decode_block`/`decode_leaf8` call between here and there. |
| 2891 | /// Set [`ENABLE_EDGE_FILTER`] for this thread. |
| 2892 | /// |
| 2893 | /// `decode_key_frame_tile_with_cdfs` sets it, but `decode_inter_frame_tile` |
| 2894 | /// never did -- so an inter frame's intra blocks read whatever value the last |
| 2895 | /// key frame decoded ON THIS THREAD left behind. Inside one stream that is |
| 2896 | /// harmless (its own key frame sets it first), but a caller that decodes an |
| 2897 | /// inter frame directly, or a test harness running several streams on one |
| 2898 | /// thread, inherits a foreign sequence's bit: decode stops being a pure |
| 2899 | /// function of the bitstream. `decode_stream` now calls this once per stream |
| 2900 | /// from the sequence header, which covers every frame including inter ones. |
| 2901 | pub |
| 2902 | |
| 2903 | |
| 2904 | |
| 2905 | thread_local! |
| 2906 | |
| 2907 | |
| 2908 | |
| 2909 | |
| 2910 | |
| 2911 | |
| 2912 | |
| 2913 | |
| 2914 | |
| 2915 | |
| 2916 | |
| 2917 | |
| 2918 | |
| 2919 | |
| 2920 | |
| 2921 | /// Current value of `CDEF_MIXED_SKIP_UNITS`. |
| 2922 | |
| 2923 | |
| 2924 | |
| 2925 | |
| 2926 | /// Current value of `CDEF_SKIPPED_UNITS`. |
| 2927 | // read only from the `#[cfg(test)]` gates |
| 2928 | pub |
| 2929 | |
| 2930 | |
| 2931 | |
| 2932 | /// How many 8x8 CDEF units [`apply_cdef`] visited whose skip band no coded |
| 2933 | /// block wrote this frame -- a writer gap, always a defect (lane-cdefstrip r1). |
| 2934 | |
| 2935 | |
| 2936 | |
| 2937 | |
| 2938 | /// Current value of `CDEF_STRADDLE_UNITS`. |
| 2939 | // read only from the `#[cfg(test)]` gates |
| 2940 | pub |
| 2941 | |
| 2942 | |
| 2943 | |
| 2944 | |
| 2945 | |
| 2946 | |
| 2947 | |
| 2948 | |
| 2949 | |
| 2950 | /// Counts one [`CHROMA_EOB_CLASS1_HITS`] when `plane_idx`'s inherited |
| 2951 | /// `tx_type` put this block's `eob_pt` on the class-1 row. |
| 2952 | |
| 2953 | |
| 2954 | |
| 2955 | |
| 2956 | |
| 2957 | |
| 2958 | // Which plane the in-flight INTRA reconstruction is writing (0=Y, 1=U, 2=V). |
| 2959 | // lane-av1cmpaudit: aomdec's `EC_PREDOUT8`/`EC_PREDND` print `plane=`, and |
| 2960 | // without the same field on our side an `EC_PREDOUT8` vs `OUR_PRED` diff of a |
| 2961 | // per-plane prediction cannot be read off ours -- a luma/chroma disagreement |
| 2962 | // looked identical to a same-plane disagreement. Set by `exec_intra` (the |
| 2963 | // single place a `PlaneBuf::reconstruct{,_rect}` is reached from) and read only |
| 2964 | // by the `EC_PRED` rung, so it cannot change a decode. |
| 2965 | thread_local! |
| 2966 | |
| 2967 | |
| 2968 | |
| 2969 | /// The plane index the `EC_PRED` rung prints as `plane=`. |
| 2970 | |
| 2971 | |
| 2972 | |
| 2973 | |
| 2974 | /// Restores [`RECON_PLANE`] on drop, so `exec_intra` needs no cleanup path on |
| 2975 | /// either of its two early returns. |
| 2976 | ; |
| 2977 | |
| 2978 | |
| 2979 | |
| 2980 | |
| 2981 | |
| 2982 | |
| 2983 | const SUB_MI: u32 = 4; |
| 2984 | const MI: usize = 4; |
| 2985 | const SB: usize = 64; |
| 2986 | /// The `above_side`/`left_side` value a cell with no decoded neighbour holds |
| 2987 | /// (tile start, superblock-row start). |
| 2988 | /// |
| 2989 | /// [`Neighbours::partition_ctx_mi`] reads it as libaom's |
| 2990 | /// `av1_get_partition_plane_context` reads its own zero-initialised |
| 2991 | /// `above_partition_context` byte: bit `bsl` clear, i.e. "the neighbour is at |
| 2992 | /// least as wide as this block". lane-sb128 r1: the old sentinel was `SB` |
| 2993 | /// (64), which reads identically at every level up to 64x64 but sets the bit |
| 2994 | /// at the `BLOCK_128X128` root (64 * 2 <= 128) -- the 128-level partition |
| 2995 | /// symbol was read off CDF row 3 where libaom uses row 0 (aomdec |
| 2996 | /// `EC_PART mi_row=0 mi_col=0 bsize=15 ctx=16`, i.e. `bsl*4 + 0`). |
| 2997 | const NO_NEIGHBOUR_SIDE: usize = 128; |
| 2998 | const BLOCK: usize = 32; |
| 2999 | const SUB: usize = 16; |
| 3000 | const TX32: usize = 32; |
| 3001 | const TX16: usize = 16; |
| 3002 | const TX8: usize = 8; |
| 3003 | const TX4: usize = 4; |
| 3004 | const DC_PRED: usize = 0; |
| 3005 | /// `V_PRED` (spec 6.10.2): the first directional mode, and so the first that |
| 3006 | /// carries an angle delta — [`crate::tile`]'s own private copy of the same |
| 3007 | /// constant. |
| 3008 | const V_PRED: usize = 1; |
| 3009 | const H_PRED: usize = 2; |
| 3010 | /// `D157_PRED`: `fimode_to_intradir`'s target for `FILTER_D157_PRED` (spec |
| 3011 | /// `Fimode_To_Intradir`, libaom `blockd.h`). |
| 3012 | const D157_PRED: usize = 6; |
| 3013 | /// The last directional mode, `D67_PRED`. |
| 3014 | const D67_PRED: usize = 8; |
| 3015 | /// The symbol an angle delta of zero codes as (spec 9.3): the alphabet runs |
| 3016 | /// from -3 to +3, so this is its middle — [`crate::tile`]'s writer never |
| 3017 | /// codes anything else, so this decoder never reads anything else either. |
| 3018 | const ANGLE_DELTA_ZERO: usize = 3; |
| 3019 | const NUM_BASE_LEVELS: i32 = 2; |
| 3020 | const COEFF_BASE_RANGE: i32 = 12; |
| 3021 | const BR_STEP: i32 = 3; |
| 3022 | const MAX_BR_LEVEL: i32 = NUM_BASE_LEVELS + COEFF_BASE_RANGE; |
| 3023 | |
| 3024 | /// `partition_gather_vert_alike`/`_horz_alike` (spec 9.3): the partition types |
| 3025 | /// whose probability mass a superblock or block half outside the frame |
| 3026 | /// gathers into its one remaining flag — [`crate::tile`]'s own private copy, |
| 3027 | /// duplicated here (that module is another lane's territory this round) and |
| 3028 | /// kept in step with it by the byte-exact round-trip tests below rather than |
| 3029 | /// by sharing code. |
| 3030 | const VERT_ALIKE: = ; |
| 3031 | const HORZ_ALIKE: = ; |
| 3032 | |
| 3033 | |
| 3034 | |
| 3035 | |
| 3036 | |
| 3037 | |
| 3038 | |
| 3039 | |
| 3040 | |
| 3041 | |
| 3042 | |
| 3043 | /// The two-symbol CDF a partial superblock/block's forced-split flag is read |
| 3044 | /// with: the mass of `elements` becomes the probability of the one partition |
| 3045 | /// the frame edge still allows, mirroring [`crate::tile`]'s own `gather` |
| 3046 | /// (the encoder's non-adapting counterpart to this read). |
| 3047 | |
| 3048 | |
| 3049 | |
| 3050 | |
| 3051 | |
| 3052 | |
| 3053 | |
| 3054 | |
| 3055 | |
| 3056 | /// The coefficient q-context a frame's `base_q_idx` picks its default CDFs |
| 3057 | /// from (spec `Get_Qctx`), mirroring [`crate::tile`]'s private copy of the |
| 3058 | /// same rule. |
| 3059 | pub |
| 3060 | |
| 3061 | |
| 3062 | |
| 3063 | |
| 3064 | |
| 3065 | |
| 3066 | |
| 3067 | |
| 3068 | /// `Default_Scan_NxN` (spec 8.4.2), the same anti-diagonal walk |
| 3069 | /// [`crate::tile`]'s writer generates its scan tables with. |
| 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 | |
| 3099 | |
| 3100 | |
| 3101 | |
| 3102 | |
| 3103 | |
| 3104 | /// `Mrow_Scan`/`Mcol_Scan` (spec 8.4.2, libaom `scan.c`): the two |
| 3105 | /// class-specific scans a `V_DCT`/`H_DCT` transform block reads coefficients |
| 3106 | /// in, instead of the default zigzag. libaom's own tables are keyed by a |
| 3107 | /// *column-major* raster (`get_txb_bhl`'s `col = pos / height`) over its |
| 3108 | /// physically column-major level buffer, but they decompose to the exact |
| 3109 | /// same (row, col) walk as a flat row-major traversal of *our* row-major |
| 3110 | /// `grid`/`levels` (`pos = row * side + col`) once you read them that way: |
| 3111 | /// `Mrow_Scan` visits row 0 across every column, then row 1, ... — precisely |
| 3112 | /// `0..side*side` in our own indexing — and `Mcol_Scan` is that walk |
| 3113 | /// transposed (column 0 down every row, then column 1, ...). |
| 3114 | pub |
| 3115 | |
| 3116 | |
| 3117 | |
| 3118 | /// [`class_scan_table`] widened to `(w, h)` (lane-tx4x8). Checked against |
| 3119 | /// libaom's own `mrow_scan_4x8`/`mcol_scan_4x8`/`mrow_scan_8x4`/ |
| 3120 | /// `mcol_scan_8x4` (`scan.c`) converted out of their column-major encoding |
| 3121 | /// by `(p % h) * w + p / h`, the same conversion [`SCAN_16X8`] was |
| 3122 | /// transcribed with -- `mrow` is the plain row-major raster in our indexing |
| 3123 | /// and `mcol` its transpose, at rect sizes exactly as at square ones. |
| 3124 | |
| 3125 | |
| 3126 | |
| 3127 | |
| 3128 | |
| 3129 | |
| 3130 | |
| 3131 | |
| 3132 | |
| 3133 | |
| 3134 | |
| 3135 | |
| 3136 | |
| 3137 | |
| 3138 | |
| 3139 | |
| 3140 | |
| 3141 | |
| 3142 | |
| 3143 | /// One cell of [`read_coeffs`]'s level buffer. |
| 3144 | /// |
| 3145 | /// lane-coef2: the buffer is now PADDED (libaom's `TX_PAD_HOR`/`TX_PAD_VER`, |
| 3146 | /// `txb_common.h`) -- four zero columns to the right of `side` and four zero |
| 3147 | /// rows below it, at a fixed `stride = side + 4` -- so the four-away reads |
| 3148 | /// `base_ctx` makes (`(0, 4)`/`(4, 0)` are its widest offsets) land on real |
| 3149 | /// zero cells instead of needing the `row >= side || col >= side` edge test |
| 3150 | /// this used to run five times per coefficient. Nothing writes a padding |
| 3151 | /// cell, so the values are the same zeros the test returned. |
| 3152 | |
| 3153 | |
| 3154 | |
| 3155 | |
| 3156 | |
| 3157 | /// spec 5.11.39's three `TxClass`es (`tx_type_to_class`, libaom |
| 3158 | /// `txb_common.h`): everything but the two lone-axis-identity types this |
| 3159 | /// decoder reads (`V_DCT`/`H_DCT`) is `TX_CLASS_2D`. |
| 3160 | |
| 3161 | pub |
| 3162 | |
| 3163 | |
| 3164 | |
| 3165 | |
| 3166 | |
| 3167 | |
| 3168 | |
| 3169 | |
| 3170 | |
| 3171 | |
| 3172 | |
| 3173 | |
| 3174 | |
| 3175 | |
| 3176 | |
| 3177 | |
| 3178 | |
| 3179 | /// `nz_map_ctx_offset_1d`: `TX_CLASS_HORIZ`/`TX_CLASS_VERT` share one 32-entry |
| 3180 | /// table (indexed by the position along the transform's *coded* axis -- |
| 3181 | /// `col` for horiz, `row` for vert) that places their contexts past the 2D |
| 3182 | /// table's own 26 rows (`SIG_COEF_CONTEXTS_2D`), 16 rows total |
| 3183 | /// (`SIG_COEF_CONTEXTS_1D`) split 26/31/36. |
| 3184 | pub |
| 3185 | |
| 3186 | |
| 3187 | |
| 3188 | |
| 3189 | |
| 3190 | |
| 3191 | |
| 3192 | |
| 3193 | |
| 3194 | |
| 3195 | |
| 3196 | |
| 3197 | |
| 3198 | |
| 3199 | |
| 3200 | |
| 3201 | |
| 3202 | |
| 3203 | |
| 3204 | |
| 3205 | |
| 3206 | |
| 3207 | |
| 3208 | |
| 3209 | |
| 3210 | |
| 3211 | |
| 3212 | |
| 3213 | |
| 3214 | |
| 3215 | |
| 3216 | |
| 3217 | |
| 3218 | |
| 3219 | |
| 3220 | |
| 3221 | |
| 3222 | |
| 3223 | |
| 3224 | |
| 3225 | |
| 3226 | |
| 3227 | |
| 3228 | |
| 3229 | |
| 3230 | |
| 3231 | |
| 3232 | |
| 3233 | |
| 3234 | |
| 3235 | |
| 3236 | |
| 3237 | |
| 3238 | |
| 3239 | |
| 3240 | |
| 3241 | |
| 3242 | |
| 3243 | |
| 3244 | |
| 3245 | |
| 3246 | |
| 3247 | |
| 3248 | |
| 3249 | |
| 3250 | |
| 3251 | |
| 3252 | |
| 3253 | |
| 3254 | |
| 3255 | |
| 3256 | |
| 3257 | |
| 3258 | |
| 3259 | |
| 3260 | |
| 3261 | /// The five `base_ctx` neighbour taps and the three `br_ctx` ones as FLAT |
| 3262 | /// offsets into the padded level frame (lane-coefread): the tap pattern is a |
| 3263 | /// function of the tx class alone, which is fixed for a whole transform unit, |
| 3264 | /// so resolving it once per unit takes the class match and the `(dr, dc)` |
| 3265 | /// -> `dr * stride + dc` arithmetic out of the per-coefficient path. Same |
| 3266 | /// taps as [`base_ctx`]/[`br_ctx`] read, stated once; |
| 3267 | /// `flat_taps_match_the_row_col_neighbour_reads` pins them against the |
| 3268 | /// original `(dr, dc)` form. |
| 3269 | |
| 3270 | |
| 3271 | |
| 3272 | |
| 3273 | |
| 3274 | |
| 3275 | |
| 3276 | |
| 3277 | |
| 3278 | |
| 3279 | |
| 3280 | |
| 3281 | |
| 3282 | |
| 3283 | /// [`base_ctx`]'s neighbour sum, off flat taps: `((sum of five clamped |
| 3284 | /// neighbours) + 1) >> 1`, clamped to 4. |
| 3285 | |
| 3286 | |
| 3287 | |
| 3288 | |
| 3289 | |
| 3290 | |
| 3291 | |
| 3292 | |
| 3293 | |
| 3294 | /// [`br_ctx`]'s neighbour sum, off flat taps. |
| 3295 | |
| 3296 | |
| 3297 | |
| 3298 | |
| 3299 | |
| 3300 | |
| 3301 | |
| 3302 | |
| 3303 | |
| 3304 | /// lane-coefread: superseded on the decode path by [`br_mag`] plus the |
| 3305 | /// origin-offset tail the two coefficient readers state inline; kept as the |
| 3306 | /// `(row, col)` form `flat_taps_match_the_row_col_neighbour_reads` pins the |
| 3307 | /// flat one against. |
| 3308 | |
| 3309 | |
| 3310 | |
| 3311 | |
| 3312 | |
| 3313 | |
| 3314 | |
| 3315 | |
| 3316 | |
| 3317 | |
| 3318 | |
| 3319 | |
| 3320 | |
| 3321 | |
| 3322 | |
| 3323 | |
| 3324 | |
| 3325 | |
| 3326 | |
| 3327 | |
| 3328 | /// `Default_Scan_32x16` (spec 8.4.2, libaom `scan.c`'s `default_scan_32x16`): |
| 3329 | /// transposed from libaom's column-major buffer into this decoder's row-major |
| 3330 | /// `pos = row * 32 + col` (lane-rectwire, verified as a bijection of `0..512` |
| 3331 | /// against the real table). Not the square zigzag formula generalized to |
| 3332 | /// unequal `w`/`h` -- checked and that does NOT reproduce this table. |
| 3333 | const SCAN_32X16: = |
| 3334 | |
| 3335 | |
| 3336 | |
| 3337 | |
| 3338 | |
| 3339 | |
| 3340 | |
| 3341 | |
| 3342 | |
| 3343 | |
| 3344 | |
| 3345 | |
| 3346 | |
| 3347 | |
| 3348 | |
| 3349 | |
| 3350 | |
| 3351 | |
| 3352 | |
| 3353 | |
| 3354 | |
| 3355 | |
| 3356 | |
| 3357 | |
| 3358 | |
| 3359 | |
| 3360 | |
| 3361 | ; |
| 3362 | |
| 3363 | /// `Default_Scan_16x32`, this decoder's own row-major transcription (see |
| 3364 | /// [`SCAN_32X16`]'s doc comment). |
| 3365 | const SCAN_16X32: = |
| 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 | /// `Default_Scan_4x8` (libaom `scan.c`), this decoder's own row-major |
| 3395 | /// transcription (see [`SCAN_32X16`]'s doc comment for the conversion, which |
| 3396 | /// was re-verified this lane by regenerating [`SCAN_16X8`]/[`SCAN_8X16`] from |
| 3397 | /// the same source). |
| 3398 | const SCAN_4X8: = |
| 3399 | |
| 3400 | |
| 3401 | ; |
| 3402 | |
| 3403 | /// `Default_Scan_8x4`, same source and conversion as [`SCAN_4X8`]. |
| 3404 | const SCAN_8X4: = |
| 3405 | |
| 3406 | |
| 3407 | ; |
| 3408 | |
| 3409 | /// `Default_Scan_16x8`, this decoder's own row-major transcription (see |
| 3410 | /// [`SCAN_32X16`]'s doc comment). |
| 3411 | const SCAN_16X8: = |
| 3412 | |
| 3413 | |
| 3414 | |
| 3415 | |
| 3416 | |
| 3417 | |
| 3418 | ; |
| 3419 | |
| 3420 | /// `Default_Scan_8x16`, this decoder's own row-major transcription (see |
| 3421 | /// [`SCAN_32X16`]'s doc comment). |
| 3422 | const SCAN_8X16: = |
| 3423 | |
| 3424 | |
| 3425 | |
| 3426 | |
| 3427 | |
| 3428 | |
| 3429 | ; |
| 3430 | |
| 3431 | /// `Default_Scan_32x8`, this decoder's own row-major transcription (see |
| 3432 | /// [`SCAN_32X16`]'s doc comment) -- the chroma plane of a 64x16 |
| 3433 | /// `PARTITION_HORZ_4` superblock strip (lane-tx64x16). libaom stores its |
| 3434 | /// scans column-major (`p = col * height + row`), so a naive copy of |
| 3435 | /// `default_scan_32x8` would silently install the TRANSPOSED 8x32 order |
| 3436 | /// (class reference-layout-not-spec): `default_scan_16x8`'s literal bytes |
| 3437 | /// are byte-identical to this decoder's [`SCAN_8X16`]. |
| 3438 | const SCAN_32X8: = |
| 3439 | |
| 3440 | |
| 3441 | |
| 3442 | |
| 3443 | |
| 3444 | |
| 3445 | |
| 3446 | |
| 3447 | |
| 3448 | |
| 3449 | |
| 3450 | |
| 3451 | |
| 3452 | ; |
| 3453 | /// `Default_Scan_8x32`, [`SCAN_32X8`]'s transpose (the chroma plane of a |
| 3454 | /// 16x64 `PARTITION_VERT_4` strip). |
| 3455 | const SCAN_8X32: = |
| 3456 | |
| 3457 | |
| 3458 | |
| 3459 | |
| 3460 | |
| 3461 | |
| 3462 | |
| 3463 | |
| 3464 | |
| 3465 | |
| 3466 | |
| 3467 | |
| 3468 | |
| 3469 | ; |
| 3470 | /// `Default_Scan_16x4`, this decoder's own row-major transcription of |
| 3471 | /// libaom's column-major `default_scan_16x4` (`scan.c:66`) -- the CHROMA |
| 3472 | /// plane of a 32x8 `PARTITION_HORZ_4` strip at the 32x32 level |
| 3473 | /// (lane-tx64x16 r3). The transcription rule (`row * w + col` with |
| 3474 | /// `row = p % h`, `col = p / h`) was validated by REGENERATING the existing |
| 3475 | /// [`SCAN_16X8`] from `default_scan_16x8` byte for byte before these two |
| 3476 | /// were emitted -- a naive copy installs the transpose (class |
| 3477 | /// reference-layout-not-spec). |
| 3478 | const SCAN_16X4: = |
| 3479 | |
| 3480 | |
| 3481 | |
| 3482 | ; |
| 3483 | /// `Default_Scan_4x16`, [`SCAN_16X4`]'s transpose (the chroma plane of an |
| 3484 | /// 8x32 `PARTITION_VERT_4` strip). |
| 3485 | const SCAN_4X16: = |
| 3486 | |
| 3487 | |
| 3488 | |
| 3489 | ; |
| 3490 | |
| 3491 | /// [`neighbour`]'s rect form (lane-rectwire): same lane-coef2 padding |
| 3492 | /// (`stride = w + 4`, four spare rows), so the edge test is the zeros the |
| 3493 | /// padding already holds. |
| 3494 | |
| 3495 | |
| 3496 | |
| 3497 | |
| 3498 | |
| 3499 | /// [`base_ctx`]'s `TxClass::TwoD` arm widened to `(w, h)` (lane-rectwire): |
| 3500 | /// the rect generalization is libaom's own comment in |
| 3501 | /// `get_nz_map_ctx_from_stats` (`txb_common.h:189-224`), reduces to the exact |
| 3502 | /// same [`cdf::NZ_MAP_CTX_OFFSET_32`] table when `w == h`. Never called for |
| 3503 | /// `V_DCT`/`H_DCT` -- geometrically impossible at the two size pairs |
| 3504 | /// [`decode_block_rect`] codes (see that function's own doc comment). |
| 3505 | |
| 3506 | |
| 3507 | |
| 3508 | |
| 3509 | |
| 3510 | |
| 3511 | |
| 3512 | |
| 3513 | |
| 3514 | |
| 3515 | |
| 3516 | |
| 3517 | |
| 3518 | |
| 3519 | |
| 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 | /// [`br_ctx`]'s `TxClass::TwoD` arm widened to `(w, h)` (lane-rectwire): the |
| 3548 | /// neighbour-offset math itself is shape-independent, only the boundary |
| 3549 | /// clamp needs the real bound in each axis. |
| 3550 | /// lane-coefread: superseded by [`br_mag`] on the rect decode path too -- |
| 3551 | /// its body was character-for-character [`br_ctx`]'s, which |
| 3552 | /// `flat_taps_match_the_row_col_neighbour_reads` now asserts. |
| 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 | /// The `tx_type` a CDF symbol names, given the width of the row it was read |
| 3592 | /// from. |
| 3593 | /// |
| 3594 | /// The row's own width names its set (spec `Tx_Type_Intra_Inv_Set*` / |
| 3595 | /// `Tx_Type_Inter_Inv_Set*`): 17 slots (16 symbols) is `EXT_TX_SET_ALL16`, 13 |
| 3596 | /// (12) `EXT_TX_SET_DTT9_IDTX_1DDCT`, 8 (7) `TX_SET_INTRA_1`, and everything |
| 3597 | /// narrower the reduced `TX_SET_INTRA_2`/`TX_SET_INTER_3` order, whose two |
| 3598 | /// members are a prefix of the five. |
| 3599 | /// |
| 3600 | /// One function rather than a `match` at each reader, so |
| 3601 | /// [`crate::refusal_inventory`]'s enumeration of every (width, symbol) pair |
| 3602 | /// tests the mapping the readers actually use. |
| 3603 | pub |
| 3604 | |
| 3605 | |
| 3606 | |
| 3607 | |
| 3608 | |
| 3609 | |
| 3610 | |
| 3611 | |
| 3612 | /// [`tx_type_from_symbol`] inverted: which symbol of a `cdf_len`-wide |
| 3613 | /// `tx_type` CDF names `tx_type`, or `None` when that set does not hold it |
| 3614 | /// (class `table-and-reader-move-together` -- the writer picks its symbol |
| 3615 | /// through the reader's own map, so the two cannot drift). |
| 3616 | pub |
| 3617 | |
| 3618 | |
| 3619 | |
| 3620 | /// The remainder of a level the base and base-range syntax could not reach |
| 3621 | /// (spec 5.11.40): its bit length in unary, then that many of its own bits, |
| 3622 | /// most significant first — the exact inverse of [`crate::tile::write_golomb`]. |
| 3623 | pub |
| 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 | /// `decode_symbol`'s end-of-block position (spec 5.11.39): the inverse of |
| 3655 | /// [`crate::tile`]'s `write_eob`. |
| 3656 | |
| 3657 | |
| 3658 | |
| 3659 | |
| 3660 | |
| 3661 | |
| 3662 | |
| 3663 | |
| 3664 | |
| 3665 | |
| 3666 | |
| 3667 | |
| 3668 | |
| 3669 | |
| 3670 | |
| 3671 | |
| 3672 | |
| 3673 | |
| 3674 | |
| 3675 | |
| 3676 | |
| 3677 | |
| 3678 | |
| 3679 | |
| 3680 | |
| 3681 | |
| 3682 | |
| 3683 | |
| 3684 | |
| 3685 | |
| 3686 | |
| 3687 | |
| 3688 | |
| 3689 | |
| 3690 | |
| 3691 | |
| 3692 | |
| 3693 | |
| 3694 | |
| 3695 | /// One transform block's levels, the inverse of [`crate::tile`]'s |
| 3696 | /// `write_coeffs`, returned as a `side * side` grid in raster order, along |
| 3697 | /// with the transform type that grid was coded under (`DCT_DCT` when the |
| 3698 | /// block's `TxbSet` carries no `tx_type` symbol at all, e.g. 32-point and |
| 3699 | /// 64-point transforms, which never code anything else). |
| 3700 | /// |
| 3701 | /// # Errors |
| 3702 | /// Returns an error if the `tx_type` symbol decodes to a value outside its |
| 3703 | /// CDF's own set (a corrupt or unsupported bitstream) — every value the |
| 3704 | /// intra `Tx_Type_Intra_Inv_Set2` and inter `Tx_Type_Inter_Inv_Set3` CDFs can |
| 3705 | /// produce dispatches to a real inverse transform. |
| 3706 | /// `Intra_Mode_To_Tx_Type` (spec 9.3): chroma's transform type is never its |
| 3707 | /// own coded symbol -- `TxbSet::Chroma*`'s `tx_type` slot is always `None` |
| 3708 | /// (a chroma block shares no CDF row with `Luma16`'s mode-indexed one) -- so |
| 3709 | /// libaom's own `intra_mode_to_tx_type` (`blockd.h`) derives it purely from |
| 3710 | /// the plane's own predicted mode instead. Every entry this table can |
| 3711 | /// produce is a member of both `TX_SET_INTRA_1` and `_2` (spec 9.3's two |
| 3712 | /// intra sets differ only in `IDTX`/`V_DCT`/`H_DCT`, none of which this |
| 3713 | /// table ever names), so unlike the CDF-coded luma path there is no |
| 3714 | /// ext-tx-set membership check to fall back from here. |
| 3715 | pub |
| 3716 | |
| 3717 | |
| 3718 | |
| 3719 | |
| 3720 | |
| 3721 | |
| 3722 | |
| 3723 | |
| 3724 | |
| 3725 | |
| 3726 | |
| 3727 | |
| 3728 | |
| 3729 | /// `is_smooth` (libaom `reconintra.c`): true for `SMOOTH_PRED..=SMOOTH_H_PRED` |
| 3730 | /// (9..=11) — deliberately excludes `PAETH_PRED` (12), which the spec's own |
| 3731 | /// `get_intra_edge_filter_type`/libaom `get_filt_type` never treat as smooth. |
| 3732 | |
| 3733 | |
| 3734 | |
| 3735 | |
| 3736 | /// Decodes the payload [`crate::tile::sb_coeff_key_frame_tile`] writes, |
| 3737 | /// returning the picture it reconstructs to. |
| 3738 | /// |
| 3739 | /// `mi_cols`/`mi_rows` and `base_q_idx` are the frame header's, as parsed by |
| 3740 | /// [`ec_av1_syntax`]. `frame_width`/`frame_height` are the header's own true |
| 3741 | /// (render) size — a separate field from `mi_cols`/`mi_rows` (spec |
| 3742 | /// `compute_image_size` derives one from the other, but not losslessly: a |
| 3743 | /// width that is not a multiple of 8 samples leaves `mi_cols * 4` past it) — |
| 3744 | /// what the reconstruction is cropped to on the way out, mirroring |
| 3745 | /// [`crate::encode::crop_encoded`]. |
| 3746 | /// |
| 3747 | /// # Errors |
| 3748 | /// Returns an error when a block's partition, mode, skip flag or transform |
| 3749 | /// type is anything this decoder does not reconstruct (round 2: inter, tx |
| 3750 | /// types other than `DCT_DCT`, non-CDF-gathered rectangular splits below |
| 3751 | /// 16x16, a directional mode's angle delta other than zero, chroma-from-luma), |
| 3752 | /// or when the tile payload runs out of the symbols this decode expects (a |
| 3753 | /// genuinely foreign stream). |
| 3754 | |
| 3755 | // read only from the `#[cfg(test)]` gates |
| 3756 | // Signature mirrors the spec's per-call inputs; a parameter struct would only move them. |
| 3757 | |
| 3758 | pub |
| 3759 | |
| 3760 | |
| 3761 | |
| 3762 | |
| 3763 | |
| 3764 | |
| 3765 | |
| 3766 | |
| 3767 | |
| 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 |