Skip to main content

Module slice_data

Module slice_data 

Source
Expand description

EVC slice_data() walker (ISO/IEC 23094-1 §7.3.8).

Round-2 scope: drive the CABAC engine through every ae(v) syntax element of a Baseline-profile bitstream so that:

  • every bin is consumed in spec-correct order (matching the syntax tables in §7.3.8.1 through §7.3.8.7), and
  • the engine reaches the end of the slice cleanly via the end_of_tile_one_bit terminate decision (§7.3.8.1).

Pixel emission, transform/quant inversion, intra/inter prediction, deblocking, ALF, DRA — all deferred to round 3+. The walker just advances the CABAC state and surfaces the parsed values via callbacks so the test fixtures (and round-3 pixel pipeline) can observe them without paying for re-parsing.

§Profile constraints we exploit

Baseline profile (Annex A.3.2) forces:

  • sps_btt_flag == 0 (only quad-split via split_cu_flag),
  • sps_suco_flag == 0, sps_admvp_flag == 0, sps_eipd_flag == 0,
  • sps_cm_init_flag == 0 → every regular bin maps to ctxTable 0, ctxIdx 0 (init (valState=256, valMps=0)),
  • sps_alf_flag == 0, sps_addb_flag == 0, sps_dquant_flag == 0, sps_ats_flag == 0, sps_ibc_flag == 0, sps_dra_flag == 0, sps_adcc_flag == 0 → run-length residual coding,
  • single_tile_in_pic_flag == 1 (one tile per picture).

For an IDR slice in Baseline, slice_type == I so predModeConstraint becomes INTRA_IBC at the CU split point and the subsequent coding_unit() is invoked twice — once for DUAL_TREE_LUMA and once for DUAL_TREE_CHROMA — per §7.3.8.3 lines 2789–2799.

§Surface

walk_baseline_idr_slice takes the slice’s RBSP, the active SPS/PPS state and a SliceWalkInputs descriptor; it returns the number of coding_unit() invocations parsed. The walker stops cleanly on the terminate decision, then verifies the bitstream is byte-aligned per §7.3.8.1 trailing logic.

Structs§

AlfCtbFlags
Per-CTU adaptive-loop-filter applicability decoded from coding_tree_unit() (§7.3.8.2 lines 2626-2631). Each field carries the resolved on/off state for the CTB after applying the §7.4.9.2 inference rules: when the corresponding flag is not present in the bitstream it is inferred to the slice-level enable (luma → slice_alf_enabled_flag, Cb → sliceChromaAlfEnabledFlag, Cr → sliceChroma2AlfEnabledFlag).
AlfCtbStats
Tallies of the per-CTU ALF map bins actually consumed from the CABAC stream. Threaded into each path’s stats struct so fixtures can assert the §7.3.8.2 presence gating fired exactly as the spec requires.
InterDecodeInputs
Inputs for the Baseline P/B decode entry point.
InterDecodeStats
Stats from decode_baseline_inter_slice.
SliceDecodeInputs
Inputs that the round-3 decoder needs in addition to SliceWalkInputs — slice QP and the picture buffer’s bit depth.
SliceDecodeStats
Stats from decode_baseline_idr_slice. A superset of SliceWalkStats for testability — coding_units, residual coeff counts, etc.
SliceTileWalkOrder
The §7.3.8.1 slice_data() CTU-iteration order for a multi-tile slice.
SliceTileWalkSegment
One tile’s contribution to the §7.3.8.1 slice_data() walk.
SliceWalkInputs
Static SPS/PPS state that the walker needs to make per-syntax-element decisions. Only the fields actually consulted by the Baseline-profile path are surfaced; the rest are tracked implicitly (e.g. sps_btt_flag = 0 is hard-wired in the walker).
SliceWalkStats
Counters reported back to the caller after a successful walk. Each one is incremented every time the walker consumes the corresponding syntax element from the CABAC stream — handy for hand-built fixture tests.

Functions§

decode_baseline_idr_slice
Decode a Baseline-profile IDR slice into a freshly-allocated YuvPicture. Round-3 deliverable: drives the CABAC engine through every syntax element (matching walk_baseline_idr_slice), reconstructs samples per §8.4.4 / §8.7 / §8.7.5, and returns the picture buffer.
decode_baseline_inter_slice
Decode a Baseline-profile P or B slice. Each CU is single-tree; supports cu_skip_flag (default-AMVP from candidate mvp_idx_l0=0, no MVD) and the explicit-MV inter path. Intra CUs inside a P/B slice fall back to the round-3 intra-pred pipeline.
derive_x_first_ctb
Derive xFirstCtb for a CTB at raster address CtbAddrInRs, per the §7.3.8.2 coding_tree_unit( ) preamble (lines 2620-2623).
resolve_slice_tile_walk_order
Resolve the §7.3.8.1 slice_data() CTU-iteration order from the slice-tile list and the §6.5.1 per-picture tile derivations.
walk_baseline_idr_slice
Walk a Baseline-profile IDR slice’s slice_data(). Returns walk stats once end_of_tile_one_bit terminates the engine cleanly. Errors indicate the bitstream cannot be consumed by the round-2 walker (unsupported toolset combination or premature engine exhaustion).
walk_baseline_idr_slice_tiled
Walk a Baseline-profile IDR slice’s slice_data() over a multi-tile CTU-iteration order (§7.3.8.1). This is the consumer the tile chain (rounds 273/278/281/292) has named: it drives the per-CTU CABAC walk off the resolved SliceTileWalkOrder rather than a flat picture raster, so a slice spanning several tiles decodes in the spec’s tile-major order.