forge
Explore
Log in

Don't you dare go Hollow

Trace the oracle's intra key-frame mode info too

Browse files at this commit

c8e7f7e6844106d17fdeb211c6baaeec83366663Ahmet Kaan GümüşParent: 7e312c0
  • feat
    • trace the oracle's intra key-frame mode info too
Show full message
feat(av1): trace the oracle's intra key-frame mode info too

The rect-strip desync could not be bisected because libaom's key-frame path had
no traced symbol at all between the partition read and the first coefficient
block -- EC_TRACE_MODE covered only decodemv.c's inter path. That gap is
exactly where the defect hides.

EC_TRACE_MODE now also wraps read_intra_frame_mode_info and prints the msac
range either side, with the decoded mode, uv_mode, skip and tx size. Same
wrapper-around-impl shape, same idempotence guard, still silent when unset --
verified emitting on a real stream and silent without the flag.
scripts/instrument-aom-oracle.shmodified+52 -1
@@ -21,7 +21,12 @@
21 # two lanes stalled on 2026-08-30 because this rung did not exist.21 # two lanes stalled on 2026-08-30 because this rung did not exist.
22 # EC_TRACE_MODE=1 -> "EC_MODE mi_row=.. mi_col=.. rng=.." before every inter22 # EC_TRACE_MODE=1 -> "EC_MODE mi_row=.. mi_col=.. rng=.." before every inter
23 # block's mode info, "EC_MODE_VAL .. mode=.. ref0/1=.. mv0=.. rng=.."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 # Idempotent: re-running is a no-op. Rebuild afterwards with31 # Idempotent: re-running is a no-op. Rebuild afterwards with
27 # ninja -C ~/.cache/aom-oracle/build aomdec32 # ninja -C ~/.cache/aom-oracle/build aomdec
@@ -212,3 +217,49 @@ s = s.replace(old, new, 1)
212 open(path, "w").write(s)217 open(path, "w").write(s)
213 print("decodemv instrumented")218 print("decodemv instrumented")
214 PYM219 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