# AVC error-resilience list `avc_err_v1`

Clean streams + one error per case; apply with `tools/err_apply.py`, run a decoder over the list with `tools/err_run.py`.
Bit 0 = MSB of the byte. `region`: header = NAL header, slice header incl. cabac_alignment_one_bit, SPS / PPS, SEI and emulation prevention bytes inside headers; payload = slice data (the "tile" of a case is the slice index: AVC has no tiles); container (not sampled) = start codes and filler NAL units. Errors are meant for the stream after decryption.

Usage: `python3 tools/err_run.py --list errors/avc_err_v1.csv --cmd "mydec {in} {out}" --label mydec`; the result CSV has the same `id` as the list. Without `--cmd` the reference decoder is used (JM ldecod).

**Decoder output.** `{out}` must receive raw planar 4:2:0 frames in display order, exactly one frame size per frame (8-bit samples, or 16-bit little-endian samples for 10-bit streams; odd sizes round the chroma planes up). A decoder that writes to stdout is used without `{out}` in the template. Frames are compared by md5 with the clean decode.

**Outcomes.** `CRASH` = killed by a signal other than SIGABRT (segfault, bus error...); `ABORT` = SIGABRT (assert / abort() on bad data - HM and JM do this); `TIMEOUT` = slower than max(--timeout, 4x the clean decode) and killed; `ERROR` = exit code != 0; `DECODED` = exit 0, with frames_mismatch / first_bad_frame / recovered_at (output index from which all frames equal the clean tail) / frames_missing. A crash inside a wrapper script shows up as ERROR with exit code 128+N. `ref_hang_confirmed` = the reference decoder still hung with a 600 s limit. Decoders run with an 8 GB address-space limit (ERR_DEC_MEM_GB): a decoder that tries to allocate more on a damaged header fails (ERROR / ABORT / CRASH) instead of exhausting the machine.

**Notes.** A payload `drop` removes a whole slice NAL unit including its header (`part` = obu), or a whole access unit (`part` = tu). `truncate` usually decodes with frames missing. Header bits the reference trace does not name are labelled `unknown:after=<previous field>`. `damaged_symbol`: first CABAC bin of the JM bin trace that differs (slice, syntax element from the ctxIdx - H.264 Table 9-34 -, macroblock).

**2000 cases**

| stream | header | payload |
|---|---|---|
| `ERR/AVC/ERR_BoxingPractice/ERR_BoxingPractice_5120x1024_59p94p_10b_High10_cbr10M_L5.2_buf864M_10.33Mbps.264` | 250 | 250 |
| `ERR/AVC/ERR_Crosswalk/ERR_Crosswalk_5120x1024_59p94p_10b_High10_cbr10M_L5.2_buf864M_10.00Mbps.264` | 250 | 250 |
| `ERR/AVC/ERR_Long/ERR_Long_854x480_60p_10b_High10_cbr2.5M_L3.1_buf50M_2.53Mbps.264` | 250 | 250 |
| `ERR/AVC/ERR_LongZeros/ERR_LongZeros_854x480_60p_10b_High10_cbr2.5M_L3.1_buf50M_2.53Mbps.264` | 250 | 250 |

| kind | cases |
|---|---|
| bitflip | 1400 |
| burst | 200 |
| truncate | 200 |
| drop | 200 |

Reference decoder (JM ldecod) outcomes:

| outcome | cases |
|---|---|
| DECODED | 1008 |
| ERROR | 862 |
| CRASH | 64 |
| ABORT | 51 |
| TIMEOUT | 15 |
