Trace the oracle's intra key-frame mode info too
Browse files at this commitc8e7f7e6844106d17fdeb211c6baaeec83366663Parent: 7e312c0- feat
- trace the oracle's intra key-frame mode info too
1 changed file +52 -1
scripts/instrument-aom-oracle.shmodified+52 -1
| @@ -21,7 +21,12 @@ | ||
| 21 | 21 | # two lanes stalled on 2026-08-30 because this rung did not exist. |
| 22 | 22 | # EC_TRACE_MODE=1 -> "EC_MODE mi_row=.. mi_col=.. rng=.." before every inter |
| 23 | 23 | # block's mode info, "EC_MODE_VAL .. mode=.. ref0/1=.. mv0=.. rng=.." |
| 24 | -# after -- the mv-stack/DRL/mv reads EC_PART cannot see. | |
| 24 | +# after -- the mv-stack/DRL/mv reads EC_PART cannot see. The same flag | |
| 25 | +# also emits "EC_IMODE .. rng=.." / "EC_IMODE_VAL .. mode=.. uv_mode=.. | |
| 26 | +# skip=.. tx=.. rng=.." around every INTRA key-frame block: without it | |
| 27 | +# the key-frame path has no traced symbol at all between the partition | |
| 28 | +# read and the first coefficient block, which is precisely the gap a | |
| 29 | +# rect-strip desync hides in. | |
| 25 | 30 | # |
| 26 | 31 | # Idempotent: re-running is a no-op. Rebuild afterwards with |
| 27 | 32 | # ninja -C ~/.cache/aom-oracle/build aomdec |
| @@ -212,3 +217,49 @@ s = s.replace(old, new, 1) | ||
| 212 | 217 | open(path, "w").write(s) |
| 213 | 218 | print("decodemv instrumented") |
| 214 | 219 | PYM |
| 220 | + | |
| 221 | +# --- rung 5: intra key-frame mode-info ladder (decodemv.c) -------------- | |
| 222 | +python3 - "$SRC/av1/decoder/decodemv.c" <<'PYI' | |
| 223 | +import sys | |
| 224 | +path = sys.argv[1] | |
| 225 | +s = open(path).read() | |
| 226 | +if "EC_INSTRUMENTED_INTRA" in s: | |
| 227 | + print("intra mode-info already instrumented (no-op)") | |
| 228 | + sys.exit(0) | |
| 229 | + | |
| 230 | +old = """static void read_intra_frame_mode_info(AV1_COMMON *const cm, | |
| 231 | + DecoderCodingBlock *dcb, aom_reader *r) {""" | |
| 232 | +new = """/* EC_INSTRUMENTED_INTRA */ | |
| 233 | +static void ec_read_intra_frame_mode_info_impl(AV1_COMMON *const cm, | |
| 234 | + DecoderCodingBlock *dcb, | |
| 235 | + aom_reader *r); | |
| 236 | + | |
| 237 | +static void read_intra_frame_mode_info(AV1_COMMON *const cm, | |
| 238 | + DecoderCodingBlock *dcb, aom_reader *r) { | |
| 239 | + const int ec_trace = getenv("EC_TRACE_MODE") != NULL; | |
| 240 | + const MACROBLOCKD *const ec_xd = &dcb->xd; | |
| 241 | + if (ec_trace) { | |
| 242 | + fprintf(stderr, "EC_IMODE mi_row=%d mi_col=%d bsize=%d rng=%u\\n", | |
| 243 | + ec_xd->mi_row, ec_xd->mi_col, (int)ec_xd->mi[0]->bsize, | |
| 244 | + (unsigned)r->ec.rng); | |
| 245 | + } | |
| 246 | + ec_read_intra_frame_mode_info_impl(cm, dcb, r); | |
| 247 | + if (ec_trace) { | |
| 248 | + const MB_MODE_INFO *const ec_mbmi = ec_xd->mi[0]; | |
| 249 | + fprintf(stderr, | |
| 250 | + "EC_IMODE_VAL mi_row=%d mi_col=%d mode=%d uv_mode=%d skip=%d " | |
| 251 | + "tx=%d rng=%u\\n", | |
| 252 | + ec_xd->mi_row, ec_xd->mi_col, (int)ec_mbmi->mode, | |
| 253 | + (int)ec_mbmi->uv_mode, (int)ec_mbmi->skip_txfm, | |
| 254 | + (int)ec_mbmi->tx_size, (unsigned)r->ec.rng); | |
| 255 | + } | |
| 256 | +} | |
| 257 | + | |
| 258 | +static void ec_read_intra_frame_mode_info_impl(AV1_COMMON *const cm, | |
| 259 | + DecoderCodingBlock *dcb, | |
| 260 | + aom_reader *r) {""" | |
| 261 | +assert old in s, "read_intra_frame_mode_info signature moved" | |
| 262 | +s = s.replace(old, new, 1) | |
| 263 | +open(path, "w").write(s) | |
| 264 | +print("intra mode-info instrumented") | |
| 265 | +PYI |