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 | # Anti-regression check for the aomdec dump rungs that |
| 3 | # scripts/instrument-aom-oracle.sh derives. |
| 4 | # |
| 5 | # Why this exists: the four u8-narrowing rungs (PREFILT, POSTDEBLOCK, |
| 6 | # PREFILT_WIDE, POSTCDEF) shipped with `fwrite(plane + r*stride, 1, w, f)`, |
| 7 | # which on a 10/12-bit stream reads a HALVED plane pointer |
| 8 | # (CONVERT_TO_BYTEPTR in aom_ports/mem.h) and SIGSEGVs with a 0-byte file |
| 9 | # (lanes/av1oraclehbd.report.md). A rung defect that only shows up as an |
| 10 | # aomdec crash during a decode is found late; this reds on the DERIVATION |
| 11 | # instead, in seconds, without a build. |
| 12 | # |
| 13 | # The same class of loss applies to the prediction rungs: EC_PREDOUT8 (rung |
| 14 | # 16) and EC_PREDND (rung 17) lived only in the hand-patched oracle tree, so |
| 15 | # a rebuild from the script dropped the only probe that prints on a 10/12-bit |
| 16 | # stream (both, and the pre-existing EC_PREDOUT, sit after an `is_hbd` early |
| 17 | # return). Those are asserted here too, from a PRISTINE reconintra.c. |
| 18 | # |
| 19 | # What it does: copies the oracle source tree to a scratch dir, replaces |
| 20 | # av1/decoder/decodeframe.c and av1/common/reconintra.c with the PRISTINE |
| 21 | # upstream files, runs the instrument script over the copy, and asserts the |
| 22 | # derived files' shape. The real oracle tree is never written to. |
| 23 | # |
| 24 | # EXIT CONTRACT (lane-av1stagegaps). A staging driver must be able to tell the |
| 25 | # three states apart, because "checker passed", "checker failed" and "checker |
| 26 | # never ran" all printed as `rungs_exit=1` (or as nothing at all) and the suite |
| 27 | # ran anyway. Measured 2026-09-30 on host host-d: the driver log showed |
| 28 | # === ORACLE RUNG CHECKER |
| 29 | # rungs_exit=1 ok_count=0 <- no detail line at all |
| 30 | # === SUITE |
| 31 | # while the real reason, with stderr visible, was a missing PREREQUISITE: |
| 32 | # no oracle source at /home/user/.cache/aom-oracle/src/av1/decoder/decodeframe.c |
| 33 | # $ ls ~/.cache/aom-oracle/ |
| 34 | # build <- binaries only, no src/ tree |
| 35 | # 0 GREEN every assertion below held. |
| 36 | # 3 NOTRUN a PREREQUISITE is absent (no oracle source tree, or the base ref |
| 37 | # is not in it). Nothing was asserted: this is NOT a pass and NOT a |
| 38 | # defect. scripts/av1-suite-preflight.sh maps it to `not-run` and |
| 39 | # BLOCKS the suite unless a waiver names the host. |
| 40 | # 1 FAIL a derived file violates the rung contract, or the instrument |
| 41 | # script errored / was not idempotent. |
| 42 | |
| 43 | # |
| 44 | # Usage: |
| 45 | # scripts/check-aom-oracle-rungs.sh [SRC_DIR] [BASE_REF] |
| 46 | # Defaults: $AOM_ORACLE_SRC or ~/.cache/aom-oracle/src, and base ref v3.13.3 |
| 47 | # (override with AOM_ORACLE_BASE_REF). Exit 0 = all assertions hold. |
| 48 | |
| 49 | |
| 50 | SRC="" |
| 51 | BASE="" |
| 52 | HERE="" |
| 53 | DERIVED="/av1/decoder/decodeframe.c" |
| 54 | RECONINTRA="/av1/common/reconintra.c" |
| 55 | |
| 56 | |
| 57 | |
| 58 | [ || |
| 59 | [ || |
| 60 | || { |
| 61 | |
| 62 | } |
| 63 | |
| 64 | # systemd-run's --setenv=TMPDIR points at a per-suite dir; if staging created |
| 65 | # the unit but not the dir, mktemp fails with an error that reads like a |
| 66 | # checker bug. It is the same class as a missing oracle tree: not asserted. |
| 67 | probe="" || |
| 68 | |
| 69 | |
| 70 | WORK="" |
| 71 | |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | AOM_ORACLE_SRC="/src" || { |
| 77 | |
| 78 | |
| 79 | |
| 80 | } |
| 81 | |
| 82 | |
| 83 | |
| 84 | # Re-running must be a no-op, or the repair pass is not idempotent and a |
| 85 | # second run would rewrite a tree under someone's feet. |
| 86 | AOM_ORACLE_SRC="/src" |
| 87 | || { |
| 88 | |
| 89 | |
| 90 | } |
| 91 | || { |
| 92 | |
| 93 | |
| 94 | } |
| 95 | |
| 96 | fail=0 |
| 97 | |
| 98 | |
| 99 | |
| 100 | |
| 101 | |
| 102 | |
| 103 | |
| 104 | |
| 105 | |
| 106 | legacy= |
| 107 | |
| 108 | |
| 109 | rows= |
| 110 | |
| 111 | |
| 112 | fin= |
| 113 | |
| 114 | |
| 115 | for |
| 116 | ; do |
| 117 | n= |
| 118 | |
| 119 | done |
| 120 | |
| 121 | # Rung 12 (EC_AV1_FINAL_DUMP) is the depth-correct one and must stay that way: |
| 122 | # it converts, it writes 2 bytes per sample, and it is not routed through the |
| 123 | # narrowing checker. |
| 124 | conv= |
| 125 | |
| 126 | r12= |
| 127 | |
| 128 | |
| 129 | # --- rungs 16/17: the prediction rungs (lane-av1rungs17) -------------------- |
| 130 | # EC_PREDOUT8 must be installed at BOTH 8-bit prediction sites in |
| 131 | # reconintra.c -- the non-directional early return (DC, SMOOTH*, PAETH) and |
| 132 | # the directional / filter-intra tail. A one-site install would look fine on |
| 133 | # the directional arm and print nothing at all for every non-directional |
| 134 | # block, which is most of an intra frame. |
| 135 | p8= |
| 136 | |
| 137 | |
| 138 | # `mode=` is what makes a non-directional diff attributable at all; a rebuild |
| 139 | # that lost it would still install two sites and still pass the count above. |
| 140 | p8m= |
| 141 | |
| 142 | |
| 143 | # EC_PREDND is the hbd twin and the ONLY prediction probe that fires on a |
| 144 | # 10/12-bit stream. One site, at the non-directional early return. |
| 145 | pnd= |
| 146 | |
| 147 | pndm= |
| 148 | |
| 149 | |
| 150 | # --- rungs 19/20: the intra-prediction IDENTITY + DC INPUTS rungs --------- |
| 151 | # EC_PREDOUT8/EC_PREDND print only SOME of the writes inside |
| 152 | # `av1_predict_intra_block`: the palette branch returns before either, and so |
| 153 | # do the two non-directional early returns' opposite number. A chroma region |
| 154 | # where no rung fires was therefore un-attributable -- three lanes of 4:2:2 |
| 155 | # work stalled on exactly that (lanes/av1422ctrigger §5b). EC_PIB prints the |
| 156 | # CALL IDENTITY before any early return, so "did a call happen and did it |
| 157 | # return early" is readable from the trace. |
| 158 | pib= |
| 159 | |
| 160 | |
| 161 | pibb= |
| 162 | |
| 163 | |
| 164 | # EC_DCIN is what makes the DC VARIANT a printed field instead of an |
| 165 | # inference from the predicted value: four lanes read "libaom used dc_top" |
| 166 | # out of the number 202 without the availability operands being visible. |
| 167 | dcin= |
| 168 | |
| 169 | |
| 170 | dcina= |
| 171 | |
| 172 | |
| 173 | # --- rung 21: EC_DP, the branch decode_token_recon_block takes -------------- |
| 174 | # The inter arm (`predict_inter_block_visit`) prints NO intra rung, and the |
| 175 | # intra arm itself skips chroma on `!xd->is_chroma_ref`, so a block that |
| 176 | # emits no prediction rung is consistent with three different writers. |
| 177 | # EC_DP is what separates them -- it is how the INTRABC writer at the 4:2:2 |
| 178 | # seed was named (lanes/av1422ctattr §4). |
| 179 | dp= |
| 180 | |
| 181 | |
| 182 | dpa= |
| 183 | |
| 184 | |
| 185 | # Rung 16 claims to be idempotent in BOTH directions: an install on a |
| 186 | # pristine file, AND an upgrade of the no-`mode=` form the oracle tree's git |
| 187 | # HEAD carries. Rebuild the no-mode form, re-derive, and require the result to |
| 188 | # land back on the same bytes -- an upgrade path that silently no-ops (or |
| 189 | # double-writes) is exactly what a rebuild would hit. |
| 190 | |
| 191 | |
| 192 | |
| 193 | |
| 194 | |
| 195 | |
| 196 | |
| 197 | |
| 198 | |
| 199 | |
| 200 | |
| 201 | |
| 202 | |
| 203 | |
| 204 | |
| 205 | |
| 206 | |
| 207 | |
| 208 | |
| 209 | |
| 210 | AOM_ORACLE_SRC="/src" || { |
| 211 | |
| 212 | |
| 213 | |
| 214 | } |
| 215 | || { |
| 216 | |
| 217 | | |
| 218 | |
| 219 | } |
| 220 | |
| 221 | if [; then |
| 222 | |
| 223 | |
| 224 | fi |
| 225 |