edith_codecs
Clone
https://git.tahinli.com/Tahinli/edith_codecs.git
0 watching0 forksRust370.3 MiB9b67700Tahinli3 days ago4021 commits
| 1 | #!/usr/bin/env bash |
| 2 | # Add the decode-localization instrumentation to the libaom oracle's aomdec. |
| 3 | # |
| 4 | # These patches used to live only in the hand-built /tmp tree; the 2026-08-30 |
| 5 | # tmpfs reclaim destroyed them along with the tree (see memory |
| 6 | # oracle-in-reaped-dir). They are re-derived here so `build-aom-oracle.sh` + |
| 7 | # this script reproduce the full ladder from scratch. |
| 8 | # |
| 9 | # Rungs provided (both env-gated, so an uninstrumented run is unchanged): |
| 10 | # DEPTH TRAP (lane-av1oraclerungdepth): the DUMP rungs 1 / 6 / 7 / 15 write |
| 11 | # 1 byte per sample with no YV12_FLAG_HIGHBITDEPTH check (they are paired |
| 12 | # with decoder-side dumps that narrow to u8 on purpose). On a 10/12-bit |
| 13 | # stream they crash the oracle, or where they survive produce a file of |
| 14 | # EXACTLY HALF w*h*bps -- which looks like a truncated decode but is the |
| 15 | # rung's depth assumption. Each of those four carries a |
| 16 | # `DEPTH ASSUMPTION` block naming its decoder-side pair; rung 12 |
| 17 | # (EC_AV1_FINAL_DUMP) is the depth-correct one. |
| 18 | # EC_AV1_PREFILT_DUMP=<prefix> -> <prefix>.f<N> per frame, Y then U then V, |
| 19 | # crop-sized rows, written after tile decode and BEFORE any loop filter, |
| 20 | # CDEF or LR. Diff against our own EC_AV1_PREFILT_DUMP to separate a |
| 21 | # reconstruction mismatch from a filtering one. |
| 22 | # EC_TRACE=1 -> "EC_PART mi_row=.. mi_col=.. bsize=.. ctx=.. tell=.. rng=.." |
| 23 | # before every partition symbol, "EC_PART_VAL .. value=.." after. The |
| 24 | # range ladder: compare rng element-by-element against our own |
| 25 | # `TRACE part32_pre` (class compare-range-not-tell -- ranges, never tell). |
| 26 | # EC_TRACE_COEFF=1 -> "EC_COEFF plane=.. row=.. col=.. tx_size=.. rng=.." |
| 27 | # before every coefficient block, "EC_COEFF_VAL .. rng=.." after. |
| 28 | # Partition granularity is too coarse to localize a coefficient desync; |
| 29 | # two lanes stalled on 2026-08-30 because this rung did not exist. |
| 30 | # EC_TRACE_MODE=1 -> "EC_MODE mi_row=.. mi_col=.. rng=.." before every inter |
| 31 | # block's mode info, "EC_MODE_VAL .. mode=.. ref0/1=.. mv0=.. rng=.." |
| 32 | # (rung 13 adds "stack=" to that line and an "EC_MODE_MV" line right |
| 33 | # after assign_mv) |
| 34 | # after -- the mv-stack/DRL/mv reads EC_PART cannot see. The same flag |
| 35 | # also emits "EC_IMODE .. rng=.." / "EC_IMODE_VAL .. mode=.. uv_mode=.. |
| 36 | # skip=.. tx=.. rng=.." around every INTRA key-frame block: without it |
| 37 | # the key-frame path has no traced symbol at all between the partition |
| 38 | # read and the first coefficient block, which is precisely the gap a |
| 39 | # rect-strip desync hides in. |
| 40 | # EC_AV1_POSTDEBLOCK_DUMP=<prefix> -> <prefix>.f<N> per frame, Y then U then |
| 41 | # V, full ALIGNED-buffer rows (y_width/y_height, not y_crop_width -- |
| 42 | # cm->cur_frame->buf at this point is still the pre-superres buffer, |
| 43 | # but its aligned width already extends past FrameWidth out to the |
| 44 | # mi-aligned true width, which is exactly the margin content we need). |
| 45 | # Written right after av1_loop_filter_frame_mt returns and before |
| 46 | # CDEF/superres run -- ground truth for the post-deblock, pre-superres |
| 47 | # row content over frame_width..true_width that decode.rs stashes as |
| 48 | # its superres margin (lane-superres r5: hand-tracing the arithmetic |
| 49 | # could only prove our own self-consistency, not correctness against |
| 50 | # libaom). |
| 51 | # EC_AV1_POSTCDEF_DUMP=<prefix> -> <prefix>.f<N> per frame, same shape as |
| 52 | # the POSTDEBLOCK rung (full ALIGNED-buffer rows), written right after |
| 53 | # the CDEF pass and before superres/LR -- splits a final-output |
| 54 | # mismatch into "already in CDEF" vs "introduced by loop restoration" |
| 55 | # without the 16-bit-only DUMP16 rungs (lane-av1422filter: on the |
| 56 | # pinned 4:2:2 keyframe this named the 251/259-sample CDEF chroma |
| 57 | # defect whose first samples were the ticket's first final samples). |
| 58 | # EC_TRACE_MODE_STEP=1 -> per-symbol range ladder inside |
| 59 | # ec_read_intra_frame_mode_info_impl (rung 5's renamed body): |
| 60 | # "EC_ISTEP mi_row=.. mi_col=.. name=skip val=.. rng=.." after |
| 61 | # read_skip_txfm, name=cdef/dq after read_cdef/read_delta_q_params, |
| 62 | # name=mode after mbmi->mode, name=angle_y after the Y angle_delta read, |
| 63 | # name=uv_mode after mbmi->uv_mode, name=angle_uv after the UV |
| 64 | # angle_delta read (rung 10, lane-sbpart r6). EC_TRACE_MODE's own |
| 65 | # before/after prints only bracket the WHOLE block; this is the |
| 66 | # per-symbol ladder the charter asked for to localize block2's first |
| 67 | # wrong read. |
| 68 | # Rung 9 (unconditional, no env gate) -- SGR per-tap ground truth |
| 69 | # (lane-lr r7): `calculate_intermediate_result` in |
| 70 | # av1/common/restoration.c is `static`, so a standalone harness cannot |
| 71 | # call it to get real A[]/B[] intermediate arrays, only the final |
| 72 | # flt0/flt1 via the public av1_selfguided_restoration_c. This rung |
| 73 | # drops `static` so an external harness can call it directly with a |
| 74 | # `dgd32`-style buffer (see scripts/lr-sgr-pin-harness.c) and diff |
| 75 | # every A[k]/B[k] tap against a from-scratch recompute -- the missing |
| 76 | # half of r6's 9-tap cross-check. No behaviour change (only linkage). |
| 77 | # |
| 78 | # Idempotent: re-running is a no-op. Rebuild afterwards with |
| 79 | # ninja -C ~/.cache/aom-oracle/build aomdec |
| 80 | |
| 81 | SRC="" |
| 82 | F="/av1/decoder/decodeframe.c" |
| 83 | [ || { ; ; } |
| 84 | |
| 85 | |
| 86 | |
| 87 | |
| 88 | |
| 89 | |
| 90 | |
| 91 | |
| 92 | |
| 93 | |
| 94 | |
| 95 | |
| 96 | |
| 97 | |
| 98 | |
| 99 | |
| 100 | |
| 101 | |
| 102 | |
| 103 | |
| 104 | |
| 105 | |
| 106 | |
| 107 | |
| 108 | |
| 109 | |
| 110 | |
| 111 | |
| 112 | |
| 113 | |
| 114 | |
| 115 | |
| 116 | |
| 117 | |
| 118 | |
| 119 | |
| 120 | |
| 121 | |
| 122 | |
| 123 | |
| 124 | |
| 125 | |
| 126 | |
| 127 | |
| 128 | |
| 129 | |
| 130 | |
| 131 | |
| 132 | |
| 133 | |
| 134 | |
| 135 | |
| 136 | |
| 137 | |
| 138 | |
| 139 | |
| 140 | |
| 141 | |
| 142 | |
| 143 | |
| 144 | |
| 145 | |
| 146 | |
| 147 | |
| 148 | |
| 149 | |
| 150 | |
| 151 | |
| 152 | |
| 153 | |
| 154 | |
| 155 | |
| 156 | |
| 157 | |
| 158 | |
| 159 | |
| 160 | |
| 161 | |
| 162 | |
| 163 | |
| 164 | |
| 165 | |
| 166 | |
| 167 | |
| 168 | |
| 169 | |
| 170 | |
| 171 | |
| 172 | |
| 173 | |
| 174 | |
| 175 | |
| 176 | |
| 177 | |
| 178 | |
| 179 | |
| 180 | # --- rung 3: coefficient range ladder (decodetxb.c) --------------------- |
| 181 | G="/av1/decoder/decodetxb.c" |
| 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 | # --- rung 4: mode-info range ladder (decodemv.c) ------------------------ |
| 229 | H="/av1/decoder/decodemv.c" |
| 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 | # --- rung 5: intra key-frame mode-info ladder (decodemv.c) -------------- |
| 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 | # --- rung 6: post-deblock, pre-superres row dump ------------------------ |
| 329 | # DEPTH ASSUMPTION (lane-av1oraclerungdepth): 1 byte per sample, NO |
| 330 | # YV12_FLAG_HIGHBITDEPTH check. Deliberate -- byte-paired with our |
| 331 | # EC_AV1_POSTDEBLOCK_DUMP, which narrows to u8 (decode.rs:20048-20054, |
| 332 | # `dump_stage(..., &y, &u, &v)` over the u16 planes; same closure at :53489). |
| 333 | # TRAP: on an HBD stream the file is EXACTLY HALF w*h*2, which reads like a |
| 334 | # truncated/short decode, not a decoder bug. For HBD use rung 12 |
| 335 | # EC_AV1_FINAL_DUMP (:730) -- depth-correct (u8 / u16 LE). |
| 336 | # OBSERVED 2026-09-29 (HBD build, av112bit-key.obu): the 1-byte fwrite SIGSEGVs |
| 337 | # (exit 139); where it survives it writes 30720 B where 61440 B is expected -- |
| 338 | # exactly half. That is this rung, not a truncated decode. |
| 339 | |
| 340 | |
| 341 | |
| 342 | |
| 343 | |
| 344 | |
| 345 | |
| 346 | |
| 347 | |
| 348 | |
| 349 | |
| 350 | |
| 351 | |
| 352 | |
| 353 | |
| 354 | |
| 355 | |
| 356 | |
| 357 | |
| 358 | |
| 359 | |
| 360 | |
| 361 | |
| 362 | |
| 363 | |
| 364 | |
| 365 | |
| 366 | |
| 367 | |
| 368 | |
| 369 | |
| 370 | |
| 371 | |
| 372 | |
| 373 | |
| 374 | |
| 375 | |
| 376 | |
| 377 | |
| 378 | |
| 379 | |
| 380 | |
| 381 | |
| 382 | |
| 383 | |
| 384 | |
| 385 | |
| 386 | |
| 387 | |
| 388 | |
| 389 | |
| 390 | |
| 391 | # --- rung 7: pre-deblock, FULL aligned-buffer row dump (lane-superres r5) - |
| 392 | # EC_AV1_PREFILT_DUMP (rung 1) is used by other lanes at its existing |
| 393 | # y_crop_width/y_crop_height shape -- left untouched. This adds a second, |
| 394 | # additive env var at the SAME anchor (pre-loop-filter) but dumping the full |
| 395 | # y_width/y_height aligned buffer, so a margin-region reconstruction bug can |
| 396 | # be told apart from a margin-region deblock bug. |
| 397 | # DEPTH ASSUMPTION (lane-av1oraclerungdepth): 1 byte per sample, NO |
| 398 | # YV12_FLAG_HIGHBITDEPTH check. Deliberate -- byte-paired with our |
| 399 | # EC_AV1_PREFILT_WIDE_DUMP, which narrows to u8 (decode.rs:20078-20090, |
| 400 | # `dump_prefilter_wide`; same closure at :53489). TRAP: on an HBD |
| 401 | # stream the file is EXACTLY HALF w*h*2, which reads like a truncated/short |
| 402 | # decode, not a decoder bug. For HBD use rung 12 EC_AV1_FINAL_DUMP (:730) -- |
| 403 | # depth-correct (u8 / u16 LE). |
| 404 | # OBSERVED 2026-09-29 (HBD build, av112bit-key.obu): the 1-byte fwrite SIGSEGVs |
| 405 | # (exit 139); where it survives it writes 30720 B where 61440 B is expected -- |
| 406 | # exactly half. That is this rung, not a truncated decode. |
| 407 | |
| 408 | |
| 409 | |
| 410 | |
| 411 | |
| 412 | |
| 413 | |
| 414 | |
| 415 | |
| 416 | |
| 417 | |
| 418 | |
| 419 | |
| 420 | |
| 421 | |
| 422 | |
| 423 | |
| 424 | |
| 425 | |
| 426 | |
| 427 | |
| 428 | |
| 429 | |
| 430 | |
| 431 | |
| 432 | |
| 433 | |
| 434 | |
| 435 | |
| 436 | |
| 437 | |
| 438 | |
| 439 | |
| 440 | |
| 441 | |
| 442 | |
| 443 | |
| 444 | |
| 445 | |
| 446 | |
| 447 | |
| 448 | |
| 449 | |
| 450 | # --- rung 8: palette colour-index map range ladder (detokenize.c) ------- |
| 451 | # EC_TRACE_PALETTE=1 -> "EC_PAL row=.. col=.. ctx=.. n=.. rng=.." before every |
| 452 | # colour-index symbol in decode_color_map_tokens's wavefront, "EC_PAL_VAL |
| 453 | # row=.. col=.. color_idx=.. rng=.." after. lane-palette r4: r3 already |
| 454 | # cleared every table/context function against this same source line-for-line |
| 455 | # by hand; this rung is what lets a real per-symbol range compare (class |
| 456 | # compare-range-not-tell / equal-range-means-unread) replace that by-hand |
| 457 | # check instead of re-reading the tables again. |
| 458 | I="/av1/decoder/detokenize.c" |
| 459 | [ || { ; ; } |
| 460 | |
| 461 | |
| 462 | |
| 463 | |
| 464 | |
| 465 | |
| 466 | |
| 467 | |
| 468 | |
| 469 | |
| 470 | |
| 471 | |
| 472 | |
| 473 | |
| 474 | |
| 475 | |
| 476 | |
| 477 | |
| 478 | |
| 479 | |
| 480 | |
| 481 | |
| 482 | |
| 483 | |
| 484 | |
| 485 | |
| 486 | |
| 487 | |
| 488 | |
| 489 | |
| 490 | |
| 491 | |
| 492 | |
| 493 | |
| 494 | |
| 495 | |
| 496 | |
| 497 | |
| 498 | |
| 499 | |
| 500 | |
| 501 | |
| 502 | # --- rung 8b: palette map[0] (av1_read_uniform) range ladder ------------ |
| 503 | |
| 504 | |
| 505 | |
| 506 | |
| 507 | |
| 508 | |
| 509 | |
| 510 | |
| 511 | |
| 512 | |
| 513 | |
| 514 | |
| 515 | |
| 516 | |
| 517 | |
| 518 | |
| 519 | |
| 520 | |
| 521 | |
| 522 | |
| 523 | |
| 524 | |
| 525 | |
| 526 | |
| 527 | |
| 528 | |
| 529 | |
| 530 | |
| 531 | |
| 532 | # --- rung 9: export calculate_intermediate_result for a direct harness call |
| 533 | I="/av1/common/restoration.c" |
| 534 | [ || { ; ; } |
| 535 | |
| 536 | |
| 537 | |
| 538 | |
| 539 | |
| 540 | |
| 541 | |
| 542 | |
| 543 | |
| 544 | |
| 545 | |
| 546 | |
| 547 | |
| 548 | |
| 549 | |
| 550 | |
| 551 | |
| 552 | |
| 553 | # --- rung 10: per-symbol range ladder inside intra key-frame mode info -- |
| 554 | |
| 555 | |
| 556 | |
| 557 | |
| 558 | |
| 559 | |
| 560 | |
| 561 | |
| 562 | |
| 563 | |
| 564 | |
| 565 | |
| 566 | |
| 567 | |
| 568 | |
| 569 | |
| 570 | |
| 571 | |
| 572 | |
| 573 | |
| 574 | |
| 575 | |
| 576 | |
| 577 | |
| 578 | |
| 579 | |
| 580 | |
| 581 | |
| 582 | |
| 583 | |
| 584 | |
| 585 | |
| 586 | |
| 587 | |
| 588 | |
| 589 | |
| 590 | |
| 591 | |
| 592 | |
| 593 | |
| 594 | |
| 595 | |
| 596 | |
| 597 | |
| 598 | |
| 599 | |
| 600 | |
| 601 | |
| 602 | |
| 603 | |
| 604 | |
| 605 | |
| 606 | |
| 607 | |
| 608 | |
| 609 | |
| 610 | |
| 611 | |
| 612 | |
| 613 | |
| 614 | |
| 615 | |
| 616 | |
| 617 | |
| 618 | # --- rung 11: per-symbol range ladder inside read_coeffs_txb (decodetxb.c) -- |
| 619 | # lane-sbpart r7: rung 3's EC_TRACE_COEFF only bracketed a whole coefficient |
| 620 | # block (entry/exit rng) -- too coarse to find WHICH symbol inside a Luma64 |
| 621 | # corner-scan block diverges. This adds EC_COEFF_STEP tag=eob/base_eob/ |
| 622 | # after_bases/sign/post_golomb lines, rng after each, under the same |
| 623 | # EC_TRACE_COEFF flag (no new env var). Localized r7's own bisect to the |
| 624 | # `base` symbol at scan position (row=1,col=0) inside block2's luma corner: |
| 625 | # entry rng and eob/base_eob both match ours byte-for-byte, then our `base` |
| 626 | # read at that position decodes value=3 (triggering an extra `br` read) |
| 627 | # where the oracle's equivalent position decodes level=1 -- see |
| 628 | # lanes/sbpart-r7.report.md. |
| 629 | G="/av1/decoder/decodetxb.c" |
| 630 | [ || { ; ; } |
| 631 | |
| 632 | |
| 633 | |
| 634 | |
| 635 | |
| 636 | |
| 637 | |
| 638 | |
| 639 | |
| 640 | |
| 641 | |
| 642 | |
| 643 | |
| 644 | |
| 645 | |
| 646 | |
| 647 | |
| 648 | |
| 649 | |
| 650 | |
| 651 | |
| 652 | |
| 653 | |
| 654 | |
| 655 | |
| 656 | |
| 657 | |
| 658 | |
| 659 | |
| 660 | |
| 661 | |
| 662 | |
| 663 | |
| 664 | |
| 665 | |
| 666 | |
| 667 | |
| 668 | |
| 669 | |
| 670 | |
| 671 | |
| 672 | |
| 673 | |
| 674 | |
| 675 | |
| 676 | |
| 677 | |
| 678 | |
| 679 | |
| 680 | |
| 681 | |
| 682 | |
| 683 | |
| 684 | |
| 685 | |
| 686 | |
| 687 | |
| 688 | |
| 689 | |
| 690 | |
| 691 | |
| 692 | |
| 693 | |
| 694 | |
| 695 | |
| 696 | # --- rung 12: FINAL reconstruction dump (lane-hidden r1) ---------------- |
| 697 | # EC_AV1_FINAL_DUMP=<prefix> -> <prefix>.f<N> per DECODED frame (decode order, |
| 698 | # hidden alt-ref frames included), written after CDEF + superres + loop |
| 699 | # restoration have all run, i.e. exactly the frame as it is stored into the |
| 700 | # reference buffer. Y then U then V, crop-sized rows (post-superres |
| 701 | # y_crop_width), 8-bit as u8 and high bitdepth as u16 LE -- bit-depth |
| 702 | # correct, unlike the u8-narrowing debug dumps. |
| 703 | # |
| 704 | # DEPTH TRAP (lane-av1oraclerungdepth) -- READ BEFORE USING ANY DUMP RUNG: |
| 705 | # rungs 1 (PREFILT :146), 6 (POSTDEBLOCK :352), 7 (PREFILT_WIDE :416) and |
| 706 | # 15 (POSTCDEF :934) write 1 byte per sample with NO YV12_FLAG_HIGHBITDEPTH |
| 707 | # check, because each is byte-paired with a decoder-side dump that narrows to |
| 708 | # u8 on purpose. On a 10/12-bit stream those four are unusable: measured on the |
| 709 | # HBD oracle build with `av112bit-key.obu` (160x128 4:2:0 12-bit, 30720 |
| 710 | # samples) their 1-byte fwrite SIGSEGVs (exit 139, 0-byte file), and where it |
| 711 | # survives it writes 30720 B where w*h*bps = 61440 B is expected -- EXACTLY |
| 712 | # HALF, which reads like a truncated decode. Check `stat -c%s` against |
| 713 | # w*h*bps before calling either a decoder defect. This rung (12) is the |
| 714 | # depth-correct one for HBD. Each of those four rungs carries a |
| 715 | # `DEPTH ASSUMPTION` block naming its decoder-side pair and line. |
| 716 | # |
| 717 | # Rungs 1/6 (pre-filter / post-deblock) stop before CDEF+LR+superres, and |
| 718 | # every ffmpeg/aomdec pixel gate in this repo compares SHOWN frames only |
| 719 | # (class gate-blind-to-hidden-frames), so before this rung no instrument in |
| 720 | # the repo could compare a hidden frame's final pixels at all. |
| 721 | |
| 722 | |
| 723 | |
| 724 | |
| 725 | |
| 726 | |
| 727 | |
| 728 | |
| 729 | |
| 730 | |
| 731 | |
| 732 | |
| 733 | |
| 734 | |
| 735 | |
| 736 | |
| 737 | |
| 738 | |
| 739 | |
| 740 | |
| 741 | |
| 742 | |
| 743 | |
| 744 | |
| 745 | |
| 746 | |
| 747 | |
| 748 | |
| 749 | |
| 750 | |
| 751 | |
| 752 | |
| 753 | |
| 754 | |
| 755 | |
| 756 | |
| 757 | |
| 758 | |
| 759 | |
| 760 | |
| 761 | |
| 762 | |
| 763 | |
| 764 | |
| 765 | |
| 766 | |
| 767 | |
| 768 | |
| 769 | |
| 770 | |
| 771 | |
| 772 | |
| 773 | # --- rung 13: MV ground truth inside the inter mode ladder (lane-inter8 r3) -- |
| 774 | # lane-inter8 r3 patched the live oracle tree BY HAND and rebuilt aomdec, so |
| 775 | # these two probes existed only in ~/.cache/aom-oracle/src and any rebuild |
| 776 | # from this script would have silently dropped them (class: instrument that |
| 777 | # lives only in a build tree). Both extend rung 4 and are gated by the same |
| 778 | # EC_TRACE_MODE: |
| 779 | # * EC_MODE_MV .. mode=.. mv0=(..,..) rng=.. -- printed immediately after |
| 780 | # assign_mv, i.e. the MV as decoded, BEFORE interintra/motion-mode/ |
| 781 | # interp-filter syntax moves the range further; lets a lane separate an |
| 782 | # MV defect from a later-symbol defect on the same block. |
| 783 | # * stack=<ref_mv_count[ref_frame_type]> added to rung 4's EC_MODE_VAL -- |
| 784 | # the reference's own mv-stack depth for the block's reference pair. |
| 785 | H="/av1/decoder/decodemv.c" |
| 786 | [ || { ; ; } |
| 787 | |
| 788 | |
| 789 | |
| 790 | |
| 791 | |
| 792 | |
| 793 | |
| 794 | |
| 795 | |
| 796 | |
| 797 | |
| 798 | |
| 799 | |
| 800 | |
| 801 | |
| 802 | |
| 803 | |
| 804 | |
| 805 | |
| 806 | |
| 807 | |
| 808 | |
| 809 | |
| 810 | |
| 811 | |
| 812 | |
| 813 | |
| 814 | |
| 815 | |
| 816 | |
| 817 | |
| 818 | |
| 819 | |
| 820 | |
| 821 | |
| 822 | |
| 823 | |
| 824 | |
| 825 | |
| 826 | |
| 827 | # --- rung 14: temporal-MV (MFMV) ground truth (lane-interbis, scripted by ---- |
| 828 | # --- lane-refstamp r1) ----------------------------------------------------- |
| 829 | # lane-interbis patched the live oracle tree BY HAND for its motion-field hunt, |
| 830 | # so these two probes lived only in ~/.cache/aom-oracle/src and a rebuild from |
| 831 | # this script would have dropped them (class: instrument that lives only in a |
| 832 | # build tree -- same reason rung 13 exists). |
| 833 | # * EC_TRACE_TPL=1 -> "EC_TPL mi_row=.. mi_col=.. blk=(..,..) mfmv0=(..,..) |
| 834 | # rfo=.." (or ".. INVALID") for every temporal candidate `add_tpl_ref_mv` |
| 835 | # probes -- the reference's own projected motion field, cell by cell, to |
| 836 | # compare against ours (EC_TRACE_TPL on our side). |
| 837 | # * the resolved MV STACK itself, one "EC_STACK mi_row=.. mi_col=.. ref=.. |
| 838 | # i=.. this=(..,..) comp=(..,..) w=.." line per entry, printed under rung |
| 839 | # 4's EC_TRACE_MODE right after EC_MODE_VAL (rung 13 only prints the |
| 840 | # stack DEPTH). |
| 841 | |
| 842 | |
| 843 | |
| 844 | |
| 845 | |
| 846 | |
| 847 | |
| 848 | |
| 849 | |
| 850 | |
| 851 | |
| 852 | |
| 853 | |
| 854 | |
| 855 | |
| 856 | |
| 857 | |
| 858 | |
| 859 | |
| 860 | |
| 861 | |
| 862 | |
| 863 | |
| 864 | |
| 865 | |
| 866 | |
| 867 | |
| 868 | |
| 869 | |
| 870 | |
| 871 | |
| 872 | |
| 873 | |
| 874 | |
| 875 | |
| 876 | |
| 877 | |
| 878 | |
| 879 | |
| 880 | |
| 881 | |
| 882 | |
| 883 | |
| 884 | |
| 885 | |
| 886 | |
| 887 | |
| 888 | |
| 889 | |
| 890 | |
| 891 | |
| 892 | |
| 893 | |
| 894 | |
| 895 | |
| 896 | |
| 897 | |
| 898 | # --- rung 15: post-CDEF, pre-superres 8-bit row dump (lane-av1422filter) --- |
| 899 | # The 8-bit mirror of rung 6 one stage later: written right after the CDEF |
| 900 | # pass (the `if (do_cdef) {...}` block) and before superres/LR, so a final |
| 901 | # chroma/luma mismatch splits into "already in CDEF" vs "introduced by |
| 902 | # loop restoration". The *_DUMP16 family covers this stage only in 16-bit |
| 903 | # builds (its 8-bit run SEGFAULTS); this rung is the 8-bit one. lane- |
| 904 | # av1422filter added it to the live oracle tree by hand first, then it was |
| 905 | # transcribed here (class: instrument that lives only in a build tree). |
| 906 | # DEPTH ASSUMPTION (lane-av1oraclerungdepth): 1 byte per sample, NO |
| 907 | # YV12_FLAG_HIGHBITDEPTH check. Deliberate -- byte-paired with our |
| 908 | # EC_AV1_POSTCDEF_DUMP, which narrows to u8 (decode.rs:20048-20054; same |
| 909 | # closure at :53489). TRAP: on an HBD stream the file is EXACTLY HALF w*h*2, |
| 910 | # which reads like a truncated/short decode, not a decoder bug. For HBD use rung 12 |
| 911 | # EC_AV1_FINAL_DUMP (:730) -- depth-correct (u8 / u16 LE). |
| 912 | # OBSERVED 2026-09-29 (HBD build, av112bit-key.obu): the 1-byte fwrite SIGSEGVs |
| 913 | # (exit 139); where it survives it writes 30720 B where 61440 B is expected -- |
| 914 | # exactly half. That is this rung, not a truncated decode. |
| 915 | |
| 916 | |
| 917 | |
| 918 | |
| 919 | |
| 920 | |
| 921 | |
| 922 | |
| 923 | |
| 924 | |
| 925 | |
| 926 | |
| 927 | |
| 928 | |
| 929 | |
| 930 | |
| 931 | |
| 932 | |
| 933 | |
| 934 | |
| 935 | |
| 936 | |
| 937 | |
| 938 | |
| 939 | |
| 940 | |
| 941 | |
| 942 | |
| 943 | |
| 944 | |
| 945 | |
| 946 | |
| 947 | |
| 948 | |
| 949 | |
| 950 | |
| 951 | |
| 952 | |
| 953 | |
| 954 | |
| 955 | |
| 956 | |
| 957 | |
| 958 | |
| 959 | |
| 960 | |
| 961 | |
| 962 | |
| 963 | |
| 964 | |
| 965 | |
| 966 | |
| 967 | |
| 968 | |
| 969 | |
| 970 | # --- depth contract for the four u8-narrowing dump rungs ------------------ |
| 971 | # PREFILT (rung 1), POSTDEBLOCK (rung 3), PREFILT_WIDE (rung 7) and POSTCDEF |
| 972 | # are paired with ec-av1 decoder rungs that narrow every sample with `as u8`, |
| 973 | # so the oracle side owes ONE BYTE PER SAMPLE at every depth. As instrumented |
| 974 | # above they wrote `fwrite(plane + r*stride, 1, w, f)`, which is wrong twice |
| 975 | # over on a high-bit-depth stream: |
| 976 | # 1. YV12_BUFFER_CONFIG stores plane pointers in HALVED form -- aom_ports/mem.h |
| 977 | # defines CONVERT_TO_BYTEPTR(x) = x >> 1 -- so the real address is |
| 978 | # CONVERT_TO_SHORTPTR(p) (p << 1). Pointer arithmetic on the raw uint8_t* |
| 979 | # therefore yields an unrelated half-address, and fwrite faults inside |
| 980 | # memmove: SIGSEGV (exit 139) with a 0-byte file, on EVERY HBD stream, for |
| 981 | # all four rungs, while rung 12 (which does convert) works. A lane hitting |
| 982 | # it sees a crashed aomdec and cannot tell it from a decoder defect. |
| 983 | # 2. y_stride/uv_stride count SAMPLES, so `+ r*stride` in bytes also picks the |
| 984 | # wrong row even where the address happens to be readable. |
| 985 | # At 8 bit neither applies: buf is the real pointer and flags is 0, so the |
| 986 | # bytes emitted are bit-for-bit what these rungs always wrote. This block owns |
| 987 | # the contract for all four, runs last, and is a REPAIR pass: it rewrites the |
| 988 | # loops an earlier (or pre-fix) instrumentation left behind, so re-running this |
| 989 | # script on an already-instrumented tree fixes it in place. |
| 990 | |
| 991 | |
| 992 | |
| 993 | |
| 994 | |
| 995 | |
| 996 | |
| 997 | |
| 998 | |
| 999 | |
| 1000 | |
| 1001 | |
| 1002 | |
| 1003 | |
| 1004 | |
| 1005 | |
| 1006 | |
| 1007 | |
| 1008 | |
| 1009 | |
| 1010 | |
| 1011 | |
| 1012 | |
| 1013 | |
| 1014 | |
| 1015 | |
| 1016 | |
| 1017 | |
| 1018 | |
| 1019 | |
| 1020 | |
| 1021 | |
| 1022 | |
| 1023 | |
| 1024 | |
| 1025 | |
| 1026 | |
| 1027 | |
| 1028 | |
| 1029 | |
| 1030 | |
| 1031 | |
| 1032 | |
| 1033 | |
| 1034 | |
| 1035 | |
| 1036 | |
| 1037 | |
| 1038 | |
| 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 | |
| 1066 | |
| 1067 | |
| 1068 | |
| 1069 | |
| 1070 | |
| 1071 | |
| 1072 | |
| 1073 | |
| 1074 | |
| 1075 | |
| 1076 | |
| 1077 | |
| 1078 | |
| 1079 | |
| 1080 | |
| 1081 | |
| 1082 | |
| 1083 | |
| 1084 | |
| 1085 | |
| 1086 | |
| 1087 | |
| 1088 | |
| 1089 | |
| 1090 | |
| 1091 | |
| 1092 | |
| 1093 | |
| 1094 | |
| 1095 | |
| 1096 | |
| 1097 | |
| 1098 | |
| 1099 | |
| 1100 | |
| 1101 | |
| 1102 | |
| 1103 | |
| 1104 | |
| 1105 | |
| 1106 | |
| 1107 | |
| 1108 | |
| 1109 | |
| 1110 | |
| 1111 | |
| 1112 | |
| 1113 | |
| 1114 | |
| 1115 | |
| 1116 | |
| 1117 | |
| 1118 | |
| 1119 | |
| 1120 | |
| 1121 | |
| 1122 | |
| 1123 | |
| 1124 | |
| 1125 | |
| 1126 | |
| 1127 | |
| 1128 | |
| 1129 | |
| 1130 | |
| 1131 | |
| 1132 | |
| 1133 | |
| 1134 | |
| 1135 | |
| 1136 | |
| 1137 | |
| 1138 | |
| 1139 | |
| 1140 | |
| 1141 | |
| 1142 | # --- rung 16: EC_PREDOUT8, the 8-bit predicted block (lane-av1cmpaudit) ---- |
| 1143 | # This rung lived ONLY in the hand-patched oracle tree -- `instrument-aom- |
| 1144 | # oracle.sh` never transcribed it -- so a rebuild from this script silently |
| 1145 | # dropped it (class: instrument that lives only in a build tree, the same |
| 1146 | # reason rung 13 exists). It is transcribed here at BOTH 8-bit prediction |
| 1147 | # sites in reconintra.c: the non-directional early-return path (DC, SMOOTH*, |
| 1148 | # PAETH) and the directional / filter-intra tail. lane-av1cmpaudit also grew |
| 1149 | # `mode=` on both: without it, an agreeing-top / disagreeing-bottom pattern |
| 1150 | # on a non-directional unit could not be attributed to a mode at all. |
| 1151 | # `mode=` sits after `txh=`, matching EC_PREDND's own field order; every |
| 1152 | # pre-existing field keeps its position. |
| 1153 | # |
| 1154 | # Idempotent, and an UPGRADE as well as an install: the oracle tree's git HEAD |
| 1155 | # already carries the rung WITHOUT `mode=`, so the script has to rewrite that |
| 1156 | # form too, not just insert the block into a pristine upstream file. |
| 1157 | I="/av1/common/reconintra.c" |
| 1158 | [ || { ; ; } |
| 1159 | |
| 1160 | |
| 1161 | |
| 1162 | |
| 1163 | |
| 1164 | |
| 1165 | |
| 1166 | |
| 1167 | |
| 1168 | |
| 1169 | |
| 1170 | |
| 1171 | |
| 1172 | |
| 1173 | |
| 1174 | |
| 1175 | |
| 1176 | |
| 1177 | |
| 1178 | |
| 1179 | |
| 1180 | |
| 1181 | |
| 1182 | |
| 1183 | |
| 1184 | |
| 1185 | |
| 1186 | |
| 1187 | |
| 1188 | |
| 1189 | |
| 1190 | |
| 1191 | |
| 1192 | |
| 1193 | |
| 1194 | |
| 1195 | |
| 1196 | |
| 1197 | |
| 1198 | |
| 1199 | |
| 1200 | |
| 1201 | |
| 1202 | |
| 1203 | |
| 1204 | |
| 1205 | |
| 1206 | |
| 1207 | |
| 1208 | |
| 1209 | |
| 1210 | |
| 1211 | |
| 1212 | |
| 1213 | |
| 1214 | |
| 1215 | |
| 1216 | |
| 1217 | |
| 1218 | |
| 1219 | |
| 1220 | |
| 1221 | |
| 1222 | |
| 1223 | |
| 1224 | |
| 1225 | |
| 1226 | |
| 1227 | |
| 1228 | |
| 1229 | |
| 1230 | |
| 1231 | |
| 1232 | |
| 1233 | |
| 1234 | |
| 1235 | |
| 1236 | |
| 1237 | |
| 1238 | |
| 1239 | |
| 1240 | |
| 1241 | # --- rung 17: EC_PREDND, the hbd twin of EC_PREDOUT8 (lane-av1cmpaudit) ---- |
| 1242 | # The 10/12-bit non-directional twin of rung 16, and like it this rung lived |
| 1243 | # ONLY in the hand-patched oracle tree. Without it a rebuild drops the only |
| 1244 | # prediction probe that fires on a high-bitdepth stream -- rung 16 and the |
| 1245 | # pre-existing EC_PREDOUT both sit after the `is_hbd` early return and print |
| 1246 | # nothing there. EC_PREDND already carried `mode=`, so unlike rung 16 this one |
| 1247 | # is an INSTALL-ONLY rung: it is inserted into a pristine upstream file and is |
| 1248 | # a no-op on the already-instrumented tree. |
| 1249 | I="/av1/common/reconintra.c" |
| 1250 | [ || { ; ; } |
| 1251 | |
| 1252 | |
| 1253 | |
| 1254 | |
| 1255 | |
| 1256 | |
| 1257 | |
| 1258 | |
| 1259 | |
| 1260 | |
| 1261 | |
| 1262 | |
| 1263 | |
| 1264 | |
| 1265 | |
| 1266 | |
| 1267 | |
| 1268 | |
| 1269 | |
| 1270 | |
| 1271 | |
| 1272 | |
| 1273 | |
| 1274 | |
| 1275 | |
| 1276 | |
| 1277 | |
| 1278 | |
| 1279 | |
| 1280 | |
| 1281 | |
| 1282 | |
| 1283 | |
| 1284 | |
| 1285 | |
| 1286 | |
| 1287 | |
| 1288 | |
| 1289 | |
| 1290 | |
| 1291 | |
| 1292 | |
| 1293 | |
| 1294 | |
| 1295 | # --- rung 18: var-tx partition CONTEXT OPERANDS (lane-av1oddheightfork3) ---- |
| 1296 | # `EC_VARTX` itself was hand-added to the oracle tree and was NOT in this |
| 1297 | # generator, so a rebuild from the script dropped it (the rung-loss class: |
| 1298 | # every rung must be derived here or the next lane loses it). This block |
| 1299 | # installs BOTH, from a pristine upstream file, idempotently, and is the only |
| 1300 | # place either print may be edited. |
| 1301 | # |
| 1302 | # Why the operands: `txfm_partition_context` (av1_common_int.h:1747-1769) is |
| 1303 | # `category * 3 + (*above_ctx < txw) + (*left_ctx < txh)`, so a ctx |
| 1304 | # disagreement with our decoder names WHICH `TXFM_CONTEXT` neighbour band |
| 1305 | # differs only if both operands are printed -- `EC_VARTX` alone gives the sum |
| 1306 | # (ctx) and nothing under it. `above` is read at `+ blk_col` of the row band, |
| 1307 | # `left` at `+ blk_row` of the column band; those indices are in the print so |
| 1308 | # a reader can tell a band-offset bug from a value bug. Env-gated on |
| 1309 | # EC_VARTXCTX (a separate flag from EC_VARTX so an existing EC_VARTX ladder |
| 1310 | # log stays byte-identical to before this rung). |
| 1311 | |
| 1312 | |
| 1313 | |
| 1314 | |
| 1315 | |
| 1316 | |
| 1317 | |
| 1318 | |
| 1319 | |
| 1320 | |
| 1321 | |
| 1322 | |
| 1323 | |
| 1324 | |
| 1325 | |
| 1326 | |
| 1327 | |
| 1328 | |
| 1329 | |
| 1330 | |
| 1331 | |
| 1332 | |
| 1333 | |
| 1334 | |
| 1335 | |
| 1336 | |
| 1337 | |
| 1338 | |
| 1339 | |
| 1340 | |
| 1341 | |
| 1342 | |
| 1343 | |
| 1344 | |
| 1345 | |
| 1346 | |
| 1347 | |
| 1348 | |
| 1349 | |
| 1350 | |
| 1351 | |
| 1352 | |
| 1353 | # --- rung 19: EC_PIB, EVERY av1_predict_intra_block call (lane-av1422ctattr) --- |
| 1354 | # WHY. Three lanes of 4:2:2 chroma archaeology stalled on ONE blind spot: |
| 1355 | # `av1_predict_intra_block` has an early `if (use_palette) { ...; return; }` |
| 1356 | # and TWO early `return`s after it (the 8-bit non-directional site and the |
| 1357 | # hbd one), so EC_PREDOUT8 / EC_PREDND only print on SOME of the paths that |
| 1358 | # write a block. A chroma region where no rung fires is therefore |
| 1359 | # un-attributable: "libaom used dc_top" was an inference from the predicted |
| 1360 | # VALUE, not a printed flag, and the whole ladder looked like it had no block |
| 1361 | # there at all. EC_PIB prints the CALL IDENTITY -- before any early return -- |
| 1362 | # so the question "which call wrote this pixel, and did it return early" is |
| 1363 | # answerable from the trace instead of from arithmetic. |
| 1364 | # |
| 1365 | # Field order is deliberately identical to EC_PREDOUT8/EC_PRED for the fields |
| 1366 | # they share, so a rung 16 line and a rung 19 line for the same block read as |
| 1367 | # one line. `use_palette` is the early-return bit: use_palette=1 with no |
| 1368 | # EC_PREDOUT8/EC_PRED twin line IS a palette write. |
| 1369 | # |
| 1370 | # Env: EC_PIB=1. Optional EC_PIBWIN="mi_row_lo:mi_row_hi:mi_col_lo:mi_col_hi" |
| 1371 | # (any field < 0 means "any") so a seed's own block can be isolated without |
| 1372 | # dumping a whole frame. |
| 1373 | |
| 1374 | |
| 1375 | |
| 1376 | |
| 1377 | |
| 1378 | |
| 1379 | |
| 1380 | |
| 1381 | |
| 1382 | |
| 1383 | |
| 1384 | |
| 1385 | |
| 1386 | |
| 1387 | |
| 1388 | |
| 1389 | |
| 1390 | |
| 1391 | |
| 1392 | |
| 1393 | |
| 1394 | |
| 1395 | |
| 1396 | |
| 1397 | |
| 1398 | |
| 1399 | |
| 1400 | |
| 1401 | |
| 1402 | |
| 1403 | |
| 1404 | |
| 1405 | |
| 1406 | |
| 1407 | |
| 1408 | |
| 1409 | |
| 1410 | |
| 1411 | |
| 1412 | |
| 1413 | |
| 1414 | |
| 1415 | |
| 1416 | |
| 1417 | |
| 1418 | |
| 1419 | |
| 1420 | |
| 1421 | |
| 1422 | |
| 1423 | |
| 1424 | |
| 1425 | |
| 1426 | |
| 1427 | |
| 1428 | |
| 1429 | |
| 1430 | |
| 1431 | |
| 1432 | |
| 1433 | |
| 1434 | |
| 1435 | |
| 1436 | |
| 1437 | |
| 1438 | |
| 1439 | |
| 1440 | |
| 1441 | |
| 1442 | |
| 1443 | |
| 1444 | |
| 1445 | |
| 1446 | |
| 1447 | |
| 1448 | |
| 1449 | |
| 1450 | |
| 1451 | |
| 1452 | |
| 1453 | |
| 1454 | |
| 1455 | |
| 1456 | |
| 1457 | |
| 1458 | |
| 1459 | |
| 1460 | |
| 1461 | |
| 1462 | |
| 1463 | |
| 1464 | |
| 1465 | |
| 1466 | |
| 1467 | |
| 1468 | |
| 1469 | |
| 1470 | |
| 1471 | |
| 1472 | |
| 1473 | |
| 1474 | |
| 1475 | |
| 1476 | |
| 1477 | |
| 1478 | |
| 1479 | |
| 1480 | |
| 1481 | |
| 1482 | |
| 1483 | |
| 1484 | # --- rung 21: EC_DP, the per-block branch taken in decode_token_recon_block --- |
| 1485 | # WHY. `decode_token_recon_block` has two arms -- intra (the only one whose |
| 1486 | # prediction prints a rung) and inter (`predict_inter_block_visit`, no |
| 1487 | # intra rung at all) -- AND, inside the intra arm, `if (plane && !xd- |
| 1488 | # >is_chroma_ref) break;`, so a chroma plane can be skipped entirely. A |
| 1489 | # region where NO prediction rung fires is consistent with all three, and the |
| 1490 | # rung ladder alone cannot tell them apart. EC_DP prints the branch decision |
| 1491 | # for every block: which arm, whether chroma is reconstructed at all, and the |
| 1492 | # max_unit geometry the loop walks. Env: EC_DP=1. |
| 1493 | |
| 1494 | |
| 1495 | |
| 1496 | |
| 1497 | |
| 1498 | |
| 1499 | |
| 1500 | |
| 1501 | |
| 1502 | |
| 1503 | |
| 1504 | |
| 1505 | |
| 1506 | |
| 1507 | |
| 1508 | |
| 1509 | |
| 1510 | |
| 1511 | |
| 1512 | |
| 1513 | |
| 1514 | |
| 1515 | |
| 1516 | |
| 1517 | |
| 1518 | |
| 1519 | |
| 1520 | |
| 1521 | |
| 1522 | |
| 1523 | |
| 1524 | |
| 1525 | |
| 1526 | |
| 1527 | |
| 1528 |