ec-av1: lane-av1-422filter follow-up -- transcribe the 8-bit EC_AV1_POSTCDEF_DUMP rung into the oracle instrumentation generator as rung 15 (insert after the do_cdef block in decodeframe.c, full ALIGNED-buffer rows, marker EC_INSTRUMENTED_POSTCDEF, no-op on the already-patched tree), verified byte-identical to the hand patch by strip-and-replay on the live oracle tree and by a unique-anchor check on a pristine decodeframe.c; header rung list and the lane report's Decision note updated to match
Browse files at this commit1b5835f531f06d5c22aaf8019423c4fc5e9f4e38Parent: 2c965912 changed files +76 -3
lanes/av1422filter.report.mdmodified+6 -3
| @@ -77,9 +77,12 @@ | |||
| 77 | `sub8_leaf_chroma422` (parent lane's three fixes) untouched. | 77 | `sub8_leaf_chroma422` (parent lane's three fixes) untouched. |
| 78 | - The 8-bit `EC_AV1_POSTCDEF_DUMP` rung was added to the ORACLE's source | 78 | - The 8-bit `EC_AV1_POSTCDEF_DUMP` rung was added to the ORACLE's source |
| 79 | tree (`$HOME/.cache/aom-oracle/src/av1/decoder/decodeframe.c`, rebuilt | 79 | tree (`$HOME/.cache/aom-oracle/src/av1/decoder/decodeframe.c`, rebuilt |
| 80 | - with ninja), not to this repo's `scripts/instrument-aom-oracle.sh` — the | 80 | + with ninja) and transcribed into |
| 81 | - script's generator should grow the same patch if the oracle is ever | 81 | + `scripts/instrument-aom-oracle.sh` as rung 15 — its generator block |
| 82 | - rebuilt from scratch. | 82 | + reproduces the hand patch byte-for-byte (verified by strip-and-replay on |
| 83 | + the live tree; the marker `EC_INSTRUMENTED_POSTCDEF` keeps re-runs | ||
| 84 | + no-op), so `build-aom-oracle.sh` + the script rebuild the full ladder | ||
| 85 | + from scratch again. | ||
| 83 | 86 | ||
| 84 | ## Verification | 87 | ## Verification |
| 85 | 88 | ||
scripts/instrument-aom-oracle.shmodified+70 -0
| @@ -40,6 +40,13 @@ | |||
| 40 | # its superres margin (lane-superres r5: hand-tracing the arithmetic | 40 | # its superres margin (lane-superres r5: hand-tracing the arithmetic |
| 41 | # could only prove our own self-consistency, not correctness against | 41 | # could only prove our own self-consistency, not correctness against |
| 42 | # libaom). | 42 | # libaom). |
| 43 | +# EC_AV1_POSTCDEF_DUMP=<prefix> -> <prefix>.f<N> per frame, same shape as | ||
| 44 | +# the POSTDEBLOCK rung (full ALIGNED-buffer rows), written right after | ||
| 45 | +# the CDEF pass and before superres/LR -- splits a final-output | ||
| 46 | +# mismatch into "already in CDEF" vs "introduced by loop restoration" | ||
| 47 | +# without the 16-bit-only DUMP16 rungs (lane-av1422filter: on the | ||
| 48 | +# pinned 4:2:2 keyframe this named the 251/259-sample CDEF chroma | ||
| 49 | +# defect whose first samples were the ticket's first final samples). | ||
| 43 | # EC_TRACE_MODE_STEP=1 -> per-symbol range ladder inside | 50 | # EC_TRACE_MODE_STEP=1 -> per-symbol range ladder inside |
| 44 | # ec_read_intra_frame_mode_info_impl (rung 5's renamed body): | 51 | # ec_read_intra_frame_mode_info_impl (rung 5's renamed body): |
| 45 | # "EC_ISTEP mi_row=.. mi_col=.. name=skip val=.. rng=.." after | 52 | # "EC_ISTEP mi_row=.. mi_col=.. name=skip val=.. rng=.." after |
| @@ -832,3 +839,66 @@ s = s.replace(anchor, anchor + dump, 1) | |||
| 832 | open(path, "w").write(s) | 839 | open(path, "w").write(s) |
| 833 | print("decodemv rung 14 (per-entry EC_STACK) instrumented") | 840 | print("decodemv rung 14 (per-entry EC_STACK) instrumented") |
| 834 | PYST | 841 | PYST |
| 842 | + | ||
| 843 | +# --- rung 15: post-CDEF, pre-superres 8-bit row dump (lane-av1422filter) --- | ||
| 844 | +# The 8-bit mirror of rung 6 one stage later: written right after the CDEF | ||
| 845 | +# pass (the `if (do_cdef) {...}` block) and before superres/LR, so a final | ||
| 846 | +# chroma/luma mismatch splits into "already in CDEF" vs "introduced by | ||
| 847 | +# loop restoration". The *_DUMP16 family covers this stage only in 16-bit | ||
| 848 | +# builds (its 8-bit run SEGFAULTS); this rung is the 8-bit one. lane- | ||
| 849 | +# av1422filter added it to the live oracle tree by hand first, then it was | ||
| 850 | +# transcribed here (class: instrument that lives only in a build tree). | ||
| 851 | +python3 - "$F" <<'PYC' | ||
| 852 | +import sys | ||
| 853 | +path = sys.argv[1] | ||
| 854 | +s = open(path).read() | ||
| 855 | +if "EC_INSTRUMENTED_POSTCDEF" in s: | ||
| 856 | + print("postcdef dump already instrumented (no-op)") | ||
| 857 | + sys.exit(0) | ||
| 858 | + | ||
| 859 | +anchor = """ if (do_cdef) { | ||
| 860 | + if (pbi->num_workers > 1) { | ||
| 861 | + av1_cdef_frame_mt(cm, &pbi->dcb.xd, pbi->cdef_worker, | ||
| 862 | + pbi->tile_workers, &pbi->cdef_sync, | ||
| 863 | + pbi->num_workers, av1_cdef_init_fb_row_mt, | ||
| 864 | + do_extend_border_mt); | ||
| 865 | + } else { | ||
| 866 | + av1_cdef_frame(&pbi->common.cur_frame->buf, cm, &pbi->dcb.xd, | ||
| 867 | + av1_cdef_init_fb_row); | ||
| 868 | + } | ||
| 869 | + } | ||
| 870 | +""" | ||
| 871 | +dump = """ | ||
| 872 | + /* EC_INSTRUMENTED_POSTCDEF (8-bit twin of the POSTDEBLOCK rung: | ||
| 873 | + * full aligned buffer, post-CDEF pre-superres/LR) */ | ||
| 874 | + { | ||
| 875 | + const char *ec_dump = getenv("EC_AV1_POSTCDEF_DUMP"); | ||
| 876 | + if (ec_dump) { | ||
| 877 | + static int ec_postcdef_idx = 0; | ||
| 878 | + char ec_path[1024]; | ||
| 879 | + snprintf(ec_path, sizeof(ec_path), "%s.f%d", ec_dump, | ||
| 880 | + ec_postcdef_idx++); | ||
| 881 | + FILE *ec_f = fopen(ec_path, "wb"); | ||
| 882 | + if (ec_f) { | ||
| 883 | + const YV12_BUFFER_CONFIG *ec_b = &cm->cur_frame->buf; | ||
| 884 | + for (int ec_r = 0; ec_r < ec_b->y_height; ++ec_r) | ||
| 885 | + fwrite(ec_b->y_buffer + ec_r * ec_b->y_stride, 1, ec_b->y_width, | ||
| 886 | + ec_f); | ||
| 887 | + if (num_planes > 1) { | ||
| 888 | + for (int ec_r = 0; ec_r < ec_b->uv_height; ++ec_r) | ||
| 889 | + fwrite(ec_b->u_buffer + ec_r * ec_b->uv_stride, 1, | ||
| 890 | + ec_b->uv_width, ec_f); | ||
| 891 | + for (int ec_r = 0; ec_r < ec_b->uv_height; ++ec_r) | ||
| 892 | + fwrite(ec_b->v_buffer + ec_r * ec_b->uv_stride, 1, | ||
| 893 | + ec_b->uv_width, ec_f); | ||
| 894 | + } | ||
| 895 | + fclose(ec_f); | ||
| 896 | + } | ||
| 897 | + } | ||
| 898 | + } | ||
| 899 | +""" | ||
| 900 | +assert anchor in s, "do_cdef block anchor moved" | ||
| 901 | +s = s.replace(anchor, anchor + dump, 1) | ||
| 902 | +open(path, "w").write(s) | ||
| 903 | +print("postcdef dump instrumented") | ||
| 904 | +PYC | ||