Expand description
§oxideav-av1
Status: orphan-rebuild scaffold (post 2026-05-20 audit), clean room rebuild in progress.
The decoder/encoder pipeline is not wired up yet. Bitstream parsing has reached:
-
Round 1. OBU bytestream walker described in §5.3 of the AV1 Bitstream & Decoding Process Specification — boundaries in a low-overhead bitstream plus
obu_type/obu_extension_flag/obu_has_size_field/temporal_id/spatial_id/obu_sizefields and a payload slice for each unit. See [obu]. -
Round 2. Sequence header OBU parse per §5.5 (
sequence_header_obu,color_config,timing_info,decoder_model_info,operating_parameters_info). Returns a strongly typed [sequence_header::SequenceHeader] descriptor plus a bit-position so the trailing-bits accounting from §5.3.1 can plug in cleanly next round. See [sequence_header]. -
Round 3. Leading slice of
uncompressed_header()per §5.9.2 —show_existing_frame/frame_to_show_map_idx/display_frame_id/frame_type/show_frame/showable_frame/error_resilient_mode/disable_cdf_update/allow_screen_content_tools/force_integer_mv/current_frame_id/frame_size_override_flag/order_hint/primary_ref_frame/refresh_frame_flags. Composes with round-2’sSequenceHeaderto drive every conditional read. See [frame_header]. -
Round 4. Frame-size sub-syntax block per §5.9.5 (
frame_size) + §5.9.6 (render_size) + §5.9.8 (superres_params) + §5.9.9 (compute_image_size). For every intra (KEY_FRAME/INTRA_ONLY_FRAME) frame in the §5.9.2 syntax tree, [parse_frame_header] now drops intoframe_size()+render_size()afterrefresh_frame_flagsand surfaces the eight-field [FrameSize] descriptor (frame_width/frame_height/render_width/render_height/superres_denom/upscaled_width/mi_cols/mi_rows). The §5.9.7frame_size_with_refs()found_refshortcut is not implemented yet — it readsRefUpscaledWidth[]/RefFrameHeight[]/RefRenderWidth[]/RefRenderHeight[]from a reference-frame state table this round does not track — so inter-frame parsing still stops atrefresh_frame_flagswithframe_size = None. See [frame_header]. -
Round 6.
allow_intrabc(§5.9.3 path of §5.9.2) +tile_info()(§5.9.15) wired into the streaming [parse_frame_header] walk. For intra frames whoseallow_screen_content_tools && UpscaledWidth == FrameWidthconjunction holds, the parser now consumes theallow_intrabcf(1)slot — otherwise the spec’sallow_intrabc = 0initialiser stands. After theframe_size()/render_size()block (intra path), the parser then walkstile_info()per §5.9.15 and surfaces a typed [tile_info::TileInfo] (uniform_tile_spacing_flag,tile_cols,tile_rows,tile_cols_log2,tile_rows_log2,context_update_tile_id,tile_size_bytes,mi_col_starts,mi_row_starts). The non-uniform-spacing path consumes thens(maxWidth)/ns(maxHeight)width_in_sbs_minus_1/height_in_sbs_minus_1fields via the new [bitreader::BitReader::ns] primitive (§4.10.7). Tile-content decode (motion vectors, transform / quantisation, in-loop filters, film grain) is still out of scope. See [tile_info]. -
Round 5. Uncompressed-header tail sub-syntaxes — §5.9.10
read_interpolation_filter()(returns [InterpolationFilter]), §5.9.11loop_filter_params()(returns [LoopFilterParams] with theCodedLossless || allow_intrabcshort-circuit, the fourloop_filter_level[]fields with theNumPlanes > 1 && (level[0] || level[1])gate on the chroma slots, thef(3)loop_filter_sharpness, and theloop_filter_delta_enabled / delta_update / update_ref_delta[i] / update_mode_delta[i]per-slot update walk overTOTAL_REFS_PER_FRAME = 8ref-deltas + 2 mode-deltas withsu(7)signed offsets), and §5.9.12quantization_params()+ §5.9.13read_delta_q()(returns [QuantizationParams] withbase_q_idx, the fourdelta_q_y_dc / delta_q_u_dc / delta_q_u_ac / delta_q_v_dc / delta_q_v_acper-plane offsets,diff_uv_delta/using_qmatrix/qm_y/qm_u/qm_v). These remain available as standalone parser entry points ([parse_interpolation_filter], [parse_loop_filter_params], [parse_quantization_params]) for callers that want to exercise the parsers on a raw byte slice. See [uncompressed_header_tail]. -
Round 7. §5.9.12
quantization_params()and §5.9.14segmentation_params()wired into the streaming [parse_frame_header] walk (intra path). Aftertile_info()the parser now consumesquantization_params()and surfaces a typed [QuantizationParams] on [FrameHeader::quantization_params], thensegmentation_params()and surfaces a typed [SegmentationParams] on [FrameHeader::segmentation_params] coveringsegmentation_enabled,segmentation_update_map,segmentation_temporal_update,segmentation_update_data, the full §5.9.14FeatureEnabled[i][j]/FeatureData[i][j]8×8 table (segment_feature_active/segment_feature_data), and the §5.9.14 trailingSegIdPreSkip/LastActiveSegIdderivations. The §5.9.14primary_ref_frame == PRIMARY_REF_NONEcollapse is honoured (update_map = 1,temporal_update = 0,update_data = 1, no bitstream reads for the three update flags). Per-featureSegmentation_Feature_Bits/Segmentation_Feature_Signed/Segmentation_Feature_MaxTable 5.9.14 tables are exposed as [SEGMENTATION_FEATURE_BITS] / [SEGMENTATION_FEATURE_SIGNED] / [SEGMENTATION_FEATURE_MAX]. See [uncompressed_header_tail::parse_segmentation_params]. -
Round 8. §5.9.17
delta_q_params()and §5.9.18delta_lf_params()wired into the streaming [parse_frame_header] walk (intra path). Aftersegmentation_params()the parser consumesdelta_q_params()and surfaces a typed [DeltaQParams] on [FrameHeader::delta_q_params] (delta_q_present— read asf(1)only whenbase_q_idx > 0;delta_q_res—f(2), read only whendelta_q_present == 1), thendelta_lf_params()and surfaces a typed [DeltaLfParams] on [FrameHeader::delta_lf_params] (delta_lf_present— gated ondelta_q_presentand suppressed whenallow_intrabc == 1;delta_lf_res/delta_lf_multi— read only whendelta_lf_present == 1). Both remain available as standalone parser entry points ([uncompressed_header_tail::parse_delta_q_params] / [uncompressed_header_tail::parse_delta_lf_params]). -
Round 9 — §5.9.11
loop_filter_params()wired into the streaming [parse_frame_header] walk (intra path). Afterdelta_lf_params()the parser derivesCodedLosslessfrom the §5.9.2 lines that scanLosslessArray[]over the per-segment qindexes (get_qindex(1, segmentId)with the §8.7 ignore-delta branch and theSEG_LVL_ALT_QClip3(0, 255, ..)clamp), then consumesloop_filter_params()and surfaces a typed [LoopFilterParams] on [FrameHeader::loop_filter_params]. The §5.9.11CodedLossless || allow_intrabcshort-circuit consumes no bits and resets the ref-deltas to their §5.9.11 defaults; the full path reads the fourloop_filter_level[]slots (chroma pair gated onNumPlanes > 1 && (level[0] || level[1])), thef(3)loop_filter_sharpness, and theloop_filter_delta_enabled/delta_updateper-slot update walk. -
Round 10 — §5.9.19
cdef_params()wired into the streaming [parse_frame_header] walk (intra path). Afterloop_filter_params()the parser consumescdef_params()and surfaces a typed [CdefParams] on [FrameHeader::cdef_params]. The §5.9.19CodedLossless || allow_intrabc || !enable_cdefshort-circuit consumes no bits and leavescdef_bits = 0,CdefDamping = 3, and all four strength arrays zeroed; the full path readscdef_damping_minus_3/cdef_bitsand the1 << cdef_bitscdef_y_pri/cdef_y_sec(+cdef_uv_*whenNumPlanes > 1) strength entries, applying the secondary== 3 ⇒ += 1adjustment. Also available as a standalone parser entry point ([parse_cdef_params]). -
Round 11 — §5.9.20
lr_params()wired into the streaming [parse_frame_header] walk (intra path). Aftercdef_params()the parser consumeslr_params()and surfaces a typed [LrParams] on [FrameHeader::lr_params]. The §5.9.20AllLossless || allow_intrabc || !enable_restorationshort-circuit consumes no bits and leaves every planeRESTORE_NONEwithUsesLr = 0; the full path reads onelr_type(f(2)) per plane (mapped throughRemap_Lr_Typeinto [FrameRestorationType]), then — when any plane uses LR —lr_unit_shift(post-incremented for 128×128 superblocks, otherwise extended bylr_unit_extra_shift) and the 4:2:0-chroma-gatedlr_uv_shift, deriving the threeLoopRestorationSize[]entries fromRESTORATION_TILESIZE_MAX. Also available as a standalone parser entry point ([parse_lr_params]). -
Round 12 — §5.9.21
read_tx_mode()wired into the streaming [parse_frame_header] walk (intra path). Afterlr_params()the parser consumesread_tx_mode()and surfaces a typed [TxMode] on [FrameHeader::tx_mode]. WhenCodedLossless == 1the §5.9.21 first branch consumes no bits and forces [TxMode::Only4x4]; otherwise thef(1)tx_mode_selectslot selects [TxMode::TxModeSelect] (1) or [TxMode::TxModeLargest] (0). Also available as a standalone parser entry point ([parse_tx_mode]). -
Round 13 — the §5.9.2 uncompressed-header tail completes the intra path. After
read_tx_mode()the parser consumesframe_reference_mode()(§5.9.23),skip_mode_params()(§5.9.22), theallow_warped_motionslot,reduced_tx_set(f(1)),global_motion_params()(§5.9.24), andfilm_grain_params()(§5.9.30), surfacing [FrameHeader::reference_select] /skip_mode_present/allow_warped_motion/reduced_tx_setplus typed [GlobalMotionParams] and [FilmGrainParams]. For an intra frame the first three blocks andglobal_motion_params()all collapse without reading bits (the §5.9.23FrameIsIntra ⇒ reference_select = 0, the §5.9.22skipModeAllowed = 0, the §5.9.2allow_warped_motionguard, and the §5.9.24FrameIsIntraidentity short-circuit);reduced_tx_setis one bit, andfilm_grain_params()reads its full §5.9.30 block when the sequence enables grain and the frame carriesapply_grain == 1.global_motion_params()exposes the complete §5.9.24/§5.9.25 inter syntax (read_global_param+ §5.9.26–§5.9.29decode_signed_subexp_with_ref/decode_subexp/inverse_recenter) via the standalone [parse_global_motion_params];film_grain_params()is likewise available via [parse_film_grain_params] (taking a [FilmGrainContext]). This is the end ofuncompressed_header()for the intra path — [FrameHeader::bits_consumed] now reaches the trailing bits / tile-group boundary. -
Round 14 — the inter-frame
uncompressed_header()path. AnINTER_FRAME/SWITCH_FRAMEheader now parses end-to-end. The §5.9.2elsebranch readsframe_refs_short_signaling, the explicitref_frame_idx[](or computes them via §7.8set_frame_refs()), the §5.9.7frame_size_with_refs()/ §5.9.5frame_size()+ §5.9.6render_size()size selection,allow_high_precision_mv, §5.9.10read_interpolation_filter(),is_motion_mode_switchable,use_ref_frame_mvs, then the shareddisable_frame_end_update_cdf+tile_info()+ quant / segment / delta / loop-filter / CDEF / LR /read_tx_mode()tail, the interframe_reference_mode()(reference_select), §5.9.22skip_mode_params(),allow_warped_motion,reduced_tx_set, interglobal_motion_params(), andfilm_grain_params(). Backed by a new public [frame_header::RefInfo] cross-frame reference state and surfaced via [parse_frame_header_with_refs] / [frame_header::InterFrameRefs] (on [FrameHeader::inter_refs]). Verified byte-exact against thei-frame-then-p-64x64fixture’sidx=1FRAME_HEADER+REF_MAPtrace lines. -
Round 15. The §8.2 symbol (arithmetic / msac) decoder, as a standalone [
symbol_decoder::SymbolDecoder]. Implements §8.2.2init_symbol(theSymbolValue/SymbolRange/SymbolMaxBits§8.2.4 state), §8.2.6read_symbol(the CDF-adaptive multisymbol search withEC_PROB_SHIFT/EC_MIN_PROB, theprev - currange update, and the seven-step renormalisation that draws new bits — or §8.2.2 padding zeros onceSymbolMaxBitsis exhausted), the §8.3 adaptive-rate CDF update, §8.2.3read_bool, §8.2.5read_literal(L(n)),NS(n)(§4.10.10), the arithmetic-codeddecode_subexp_bool(§5.9.28 bool variant), and §8.2.4exit_symbol(trailing-bit accounting + byte-alignment advance, rejecting theSymbolMaxBits < -14conformance violation viaError::SymbolExitUnderflow). The default CDF tables (§9.4) and the §8.3.2 CDF-selection process are out of scope this round — they land with the tile-content decode that consumes them. See [symbol_decoder]. -
Round 16. The §9.4 default CDF tables and the §8.3.1 / §8.3.2 CDF-selection process for a bounded intra-frame mode / partition syntax group, in a new [
cdf] module. Transcribes [DEFAULT_INTRA_FRAME_Y_MODE_CDF] (theintra_frame_y_mode5×5×14 table), the fiveDEFAULT_PARTITION_W{8,16,32,64,128}_CDFtables (thepartitionelement), [DEFAULT_SKIP_CDF], and [DEFAULT_SEGMENT_ID_CDF] verbatim from §9.4. [TileCdfContext] implements §8.3.1 (new_from_defaultscopies everyDefault_*table into a per-tile, mutableTile*Cdfworking set that the §8.2 [SymbolDecoder] adapts in place), and the §8.3.2 selection surfaces a&mut [u16]row for each element —intra_frame_y_mode([abovemode][leftmode]),partition(array-by-bsl, row-by-ctx),skip([ctx]), andsegment_id([ctx]) — feeding [SymbolDecoder::read_symbol] directly. The scalar §8.3.2 context-derivation helpers ([intra_mode_ctx] / [partition_ctx] / [skip_ctx] / [segment_id_ctx]) compute the index from neighbour inputs the (future) tile walk supplies. The remaining ~100 §9.4 tables, theinit_coeff_cdfscoefficient set, and the other §8.3.2 selections (split_or_horz/split_or_vert/tx_depth/txfm_split/ the motion-vector + uv-mode groups) are a clear followup. See [cdf]. -
Round 17. The §9.4 default CDF tables and the §8.3.1 / §8.3.2 CDF-selection process for the motion-vector component syntax group, extending [
cdf]. Transcribes [DEFAULT_MV_JOINT_CDF], [DEFAULT_MV_SIGN_CDF], [DEFAULT_MV_CLASS_CDF], [DEFAULT_MV_CLASS0_BIT_CDF], [DEFAULT_MV_CLASS0_FR_CDF], [DEFAULT_MV_CLASS0_HP_CDF], [DEFAULT_MV_BIT_CDF], [DEFAULT_MV_FR_CDF], and [DEFAULT_MV_HP_CDF] verbatim from §9.4 (the216*128/136*128/ … fixed-point notation expanded). [TileCdfContext] grows ninemv_*working-set fields broadcast per §8.3.1 toMV_CONTEXTS = 2slots (and to thecomp = 0..1axis where the source default is per-comp identical), and the §8.3.2 selection surfaces&mut [u16]rows for every MV element:mv_joint([MvCtx]),mv_sign/mv_class/mv_class0_bit/mv_class0_hp/mv_fr/mv_hp([MvCtx][comp]),mv_class0_fr([MvCtx][comp][mv_class0_bit]), andmv_bit([MvCtx][comp][i]). The §5.11.31MvCtxderivation —MvCtx = use_intrabc ? MV_INTRABC_CONTEXT : 0— is exposed as the [mv_ctx] helper. The remaining ~90 §9.4 tables (y_mode, uv_mode, angle-delta, tx-size, coefficient, palette, …) and the other §8.3.2 selections are a mechanical followup against the same [TileCdfContext] shape. -
Round 18. The §9.4 default CDF tables and the §8.3.1 / §8.3.2 selection for the inter-mode / reference-frame syntax group, extending [
cdf]. Transcribes the 13 remainingDefault_*_Cdftables driving every inter-block mode and reference syntax: [DEFAULT_NEW_MV_CDF], [DEFAULT_ZERO_MV_CDF], [DEFAULT_REF_MV_CDF], [DEFAULT_DRL_MODE_CDF], [DEFAULT_IS_INTER_CDF], [DEFAULT_COMP_MODE_CDF], [DEFAULT_SKIP_MODE_CDF], [DEFAULT_COMP_REF_CDF], [DEFAULT_COMP_BWD_REF_CDF], [DEFAULT_SINGLE_REF_CDF], [DEFAULT_COMPOUND_MODE_CDF], [DEFAULT_COMP_REF_TYPE_CDF], [DEFAULT_UNI_COMP_REF_CDF] verbatim from §9.4, plus the §8.3.2 [COMPOUND_MODE_CTX_MAP] lookup table. [TileCdfContext] grows the correspondingTile*Cdffields, [TileCdfContext::new_from_defaults] seeds them per §8.3.1, and the §8.3.2 selection surfaces&mut [u16]rows for every element:new_mv_cdf/zero_mv_cdf/ref_mv_cdf/drl_mode_cdf/is_inter_cdf/comp_mode_cdf/skip_mode_cdf/comp_ref_cdf/comp_bwd_ref_cdf/single_ref_cdf/compound_mode_cdf/comp_ref_type_cdf/uni_comp_ref_cdf. Scalar §8.3.2 context helpers [is_inter_ctx] (the(AvailU, AvailL) × (AboveIntra, LeftIntra)branch ladder), [skip_mode_ctx] (neighbourSkipModes[]sum), [ref_count_ctx] (</==/>three-branch shared by everysingle_ref_p*/comp_ref/comp_bwdref/uni_comp_ref_p*paragraph), and [compound_mode_ctx] (Compound_Mode_Ctx_Maplookup) compute eachctxfrom the neighbour-summary inputs the (future) tile walk supplies. -
Round 20. The §9.4 default CDF tables and the §8.3.1 / §8.3.2 selection for the transform-size syntax group, extending [
cdf]. Transcribes the four per-maxTxDepthtx_depthtables ([DEFAULT_TX_8X8_CDF], [DEFAULT_TX_16X16_CDF], [DEFAULT_TX_32X32_CDF], [DEFAULT_TX_64X64_CDF]) and the binary [DEFAULT_TXFM_SPLIT_CDF] verbatim from §9.4. [TileCdfContext] grows thetx_8x8/tx_16x16/tx_32x32/tx_64x64/txfm_splitfields, all seeded by [TileCdfContext::new_from_defaults] per §8.3.1. The §8.3.2 selection surfaces two&mut [u16]accessors —tx_depth_cdf(maxTxDepth, ctx)(the §8.3.2 four-wayTileTx{8x8,16x16,32x32,64x64}Cdf[ ctx ]switch keyed byMax_Tx_Depth[ MiSize ]; returnsNonewhenmaxTxDepth == 0) andtxfm_split_cdf(ctx). Scalar §8.3.2 context helpers [tx_depth_ctx] (the(aboveW >= maxTxWidth) + (leftH >= maxTxHeight)formula) and [txfm_split_ctx] (the(txSzSqrUp != maxTxSz) * 3 + (TX_SIZES - 1 - maxTxSz) * 6 + above + leftformula) compute eachctxfrom scalar inputs the §5.11.15 / §5.11.16 syntax supplies. -
Round 21. The §9.4 default CDF tables and the §8.3.1 / §8.3.2 selection for the inter-frame transform-type syntax group, extending [
cdf]. Transcribes the threeDefault_Inter_Tx_Type_Set{1,2,3}_Cdftables ([DEFAULT_INTER_TX_TYPE_SET1_CDF], [DEFAULT_INTER_TX_TYPE_SET2_CDF], [DEFAULT_INTER_TX_TYPE_SET3_CDF]) verbatim from §9.4 —Set1for the full 16-symbol set (4x4 / 8x8 inter blocks),Set2for the 16x16 inter set (12 symbols),Set3for the reduced 2-symbol{ IDTX, DCT_DCT }set (4x4..32x32 inter blocks). [TileCdfContext] grows theinter_tx_type_set1/inter_tx_type_set2/inter_tx_type_set3fields, all seeded by [TileCdfContext::new_from_defaults] per §8.3.1. The §8.3.2 selection surfaces an&mut [u16]accessorinter_tx_type_cdf(set, tx_size_sqr)(the §8.3.2 three-wayTX_SET_INTER_{1,2,3}switch; returnsNoneforTX_SET_DCTONLYper §5.11.47 and for any unreachable(set, tx_size_sqr)combination). The scalar §5.11.48 helper [inter_tx_type_set] computes theset ∈ { TX_SET_DCTONLY, TX_SET_INTER_1, TX_SET_INTER_2, TX_SET_INTER_3 }from the(Tx_Size_Sqr[txSz], Tx_Size_Sqr_Up[txSz], reduced_tx_set)tuple supplied by the surrounding §5.11.47 syntax. The intra counterpart (Default_Intra_Tx_Type_Set{1,2}_Cdfwith their extraintraDiraxis) and the remaining §9.4 tables (y_mode, uv_mode, angle-delta, coefficient, …) are mechanical followups against the same [TileCdfContext] shape. -
Round 22. The §9.4 default CDF table and the §8.3.1 / §8.3.2 selection for the inter-frame interpolation-filter syntax element, extending [
cdf]. Transcribes [DEFAULT_INTERP_FILTER_CDF] —[INTERP_FILTER_CONTEXTS][INTERP_FILTERS + 1], i.e. 16 contexts × 3 cumulative frequencies + adaptation counter — verbatim from §9.4. New §3 constantsINTERP_FILTERS = 3andINTERP_FILTER_CONTEXTS = 16. [TileCdfContext] grows theinterp_filterfield, seeded by [TileCdfContext::new_from_defaults] per §8.3.1. The §8.3.2 selection surfacesinterp_filter_cdf(ctx); the scalar [interp_filter_ctx] helper folds the §8.3.2 four-branch(above_type, left_type, dir, is_compound)formula into a single0..INTERP_FILTER_CONTEXTSindex (the caller supplies the already-resolved neighbour-type values per the spec’sRefFrame[0]matching predicate). Sentinel [INTERP_FILTER_NONE] (==INTERP_FILTERS, mirroring the spec’s literal3) marks an unavailable / mismatched neighbour. -
Round 23. The §9.4 default CDF table and the §8.3.1 / §8.3.2 selection for the motion-mode syntax element, extending [
cdf]. Transcribes [DEFAULT_MOTION_MODE_CDF] —[BLOCK_SIZES][MOTION_MODES + 1], i.e. 22 block-size rows × 3 cumulative frequencies + adaptation counter — verbatim from §9.4. New §3 constantMOTION_MODES = 3(per §6.10.26SIMPLE = 0/OBMC = 1/LOCALWARP = 2). [TileCdfContext] grows themotion_modefield, seeded by [TileCdfContext::new_from_defaults] per §8.3.1. The §8.3.2 selection surfacesmotion_mode_cdf(mi_size)— a straight0..BLOCK_SIZESindex (the spec’s selection text reads “TileMotionModeCdf[ MiSize ]”; no neighbour-context arithmetic). -
Round 24. The §9.4 default CDF tables and the §8.3.1 / §8.3.2 selection for the compound-prediction syntax elements, extending [
cdf]. Transcribes [DEFAULT_COMP_GROUP_IDX_CDF] ([COMP_GROUP_IDX_CONTEXTS][3]), [DEFAULT_COMPOUND_IDX_CDF] ([COMPOUND_IDX_CONTEXTS][3]) and [DEFAULT_COMPOUND_TYPE_CDF] ([BLOCK_SIZES][COMPOUND_TYPES + 1]) verbatim from §9.4. New §3 constantsCOMPOUND_TYPES = 2,COMP_GROUP_IDX_CONTEXTS = 6,COMPOUND_IDX_CONTEXTS = 6. [TileCdfContext] grows thecomp_group_idx/compound_idx/compound_typefields, seeded by [TileCdfContext::new_from_defaults] per §8.3.1. The §8.3.2 selection surfacescomp_group_idx_cdf(ctx)/compound_idx_cdf(ctx)(binary, precomputed-ctxindex) andcompound_type_cdf(mi_size)(a straight0..BLOCK_SIZESindex; the spec’s selection text reads “TileCompoundTypeCdf[ MiSize ]”). -
Round 134. The §9.4 default CDF tables and the §8.3.1 / §8.3.2 selection for the inter-frame intra-mode syntax elements, extending [
cdf]. Transcribes [DEFAULT_Y_MODE_CDF] ([BLOCK_SIZE_GROUPS][INTRA_MODES + 1]), [DEFAULT_UV_MODE_CFL_NOT_ALLOWED_CDF] ([INTRA_MODES][UV_INTRA_MODES_CFL_NOT_ALLOWED + 1]) and [DEFAULT_UV_MODE_CFL_ALLOWED_CDF] ([INTRA_MODES][UV_INTRA_MODES_CFL_ALLOWED + 1]) verbatim from §9.4. New §3 constantsBLOCK_SIZE_GROUPS = 4,UV_INTRA_MODES_CFL_NOT_ALLOWED = 13,UV_INTRA_MODES_CFL_ALLOWED = 14plus the §8.3.2 [SIZE_GROUP] table. [TileCdfContext] grows they_mode/uv_mode_cfl_not_allowed/uv_mode_cfl_allowedfields, seeded by [TileCdfContext::new_from_defaults] per §8.3.1. The §8.3.2 selection surfacesy_mode_cdf(ctx)(with [size_group] performing thectx = Size_Group[ MiSize ]mapping) anduv_mode_cdf(cfl_allowed, y_mode)(picking the cfl-allowed / cfl-not-allowed variant by the resolved flag, then indexing byYMode). -
Round 135. The §9.4 default CDF table and the §8.3.1 / §8.3.2 selection for the angle-delta syntax elements (
angle_delta_y/angle_delta_uv), extending [cdf]. Transcribes [DEFAULT_ANGLE_DELTA_CDF] ([DIRECTIONAL_MODES][(2 * MAX_ANGLE_DELTA + 1) + 1]) verbatim from §9.4. New §3 constantsDIRECTIONAL_MODES = 8,MAX_ANGLE_DELTA = 3and the directional-mode baseV_PRED = 1. [TileCdfContext] grows theangle_deltafield, seeded by [TileCdfContext::new_from_defaults] per §8.3.1. The §8.3.2 selection surfacesangle_delta_cdf(mode), which rebases a directionalYMode/UVModeonto0..DIRECTIONAL_MODESviamode - V_PRED(theTileAngleDeltaCdf[ YMode - V_PRED ]/TileAngleDeltaCdf[ UVMode - V_PRED ]selection). -
Round 136. The §9.4 default CDF tables and the §8.3.1
init_coeff_cdfs/ §8.3.2 selection for the coefficient-token entry sub-group — the gateway to tile-content decode: the transform-block skip flag ([DEFAULT_TXB_SKIP_CDF]), the end-of-block position class ([DEFAULT_EOB_PT_16_CDF] … [DEFAULT_EOB_PT_1024_CDF]), the EOB extra-bit ([DEFAULT_EOB_EXTRA_CDF]), and the DC sign ([DEFAULT_DC_SIGN_CDF]), all transcribed verbatim from §9.4. New §3 constantsPLANE_TYPES = 2,COEFF_CDF_Q_CTXS = 4,TXB_SKIP_CONTEXTS = 13,EOB_COEF_CONTEXTS = 9,DC_SIGN_CONTEXTS = 3. Unlike the non-coeff CDFs, these are reset by the separate [TileCdfContext::init_coeff_cdfs] (base_q_idx→idxvia [coeff_cdf_q_ctx]) so the working copy drops theCOEFF_CDF_Q_CTXSaxis, selectingDefault_*_Cdf[ idx ]. The coeff_base / coeff_base_eob / coeff_br braid is deferred to a later round. -
Round 137. The §9.4 default CDF tables and the §8.3.1 / §8.3.2 selection for the intra-frame transform-type syntax group, completing the §6.10.19 transform-set coverage started in round 21. Transcribes [
DEFAULT_INTRA_TX_TYPE_SET1_CDF] ([INTRA_TX_TYPE_SET1_SIZES][INTRA_MODES][TX_TYPES_INTRA_SET1 + 1], i.e.[2][13][8]per the §9.4 listing) and [DEFAULT_INTRA_TX_TYPE_SET2_CDF] ([INTRA_TX_TYPE_SET2_SIZES][INTRA_MODES][TX_TYPES_INTRA_SET2 + 1], i.e.[3][13][6]) verbatim from §9.4 —Set1for the full 7-symbol intra set (4x4 / 8x8 intra blocks),Set2for the reduced 5-symbol set (4x4 / 8x8 / 16x16 intra blocks). Both tables carry an extraintraDiraxis (INTRA_MODES = 13) on top of theTx_Size_Sqraxis already seen in the inter counterparts. New §3 constantsTX_SET_INTRA_1 = 1,TX_SET_INTRA_2 = 2,TX_TYPES_INTRA_SET1 = 7,TX_TYPES_INTRA_SET2 = 5,INTRA_TX_TYPE_SET1_SIZES = 2,INTRA_TX_TYPE_SET2_SIZES = 3, and the §8.3.2 [FILTER_INTRA_MODE_TO_INTRA_DIR] table. [TileCdfContext] grows theintra_tx_type_set1/intra_tx_type_set2fields, seeded by [TileCdfContext::new_from_defaults] per §8.3.1. The §8.3.2 selection surfaces an&mut [u16]accessorintra_tx_type_cdf(set, tx_size_sqr, intra_dir)(the §8.3.2 two-wayTX_SET_INTRA_{1,2}switch over the §8.3.2intraDiraxis; returnsNoneforTX_SET_DCTONLYper §5.11.47 and for any unreachable(set, tx_size_sqr, intra_dir)combination). The scalar §5.11.48 helper [intra_tx_type_set] computes theset ∈ { TX_SET_DCTONLY, TX_SET_INTRA_1, TX_SET_INTRA_2 }from the(Tx_Size_Sqr[txSz], Tx_Size_Sqr_Up[txSz], reduced_tx_set)tuple supplied by the surrounding §5.11.47 syntax (the intra branch differs from the inter one in two places:txSzSqrUp == TX_32X32itself routes toTX_SET_DCTONLYrather thanTX_SET_INTER_3, and thetxSzSqr == TX_16X16branch routes toTX_SET_INTRA_2rather thanTX_SET_INTER_2). The scalar §8.3.2 helper [intra_dir] derives theintraDiraxis from theuse_filter_intraflag plus theYMode/filter_intra_modepair. -
Round 138. The §9.4 default CDF table and the §8.3.1
init_coeff_cdfs/ §8.3.2 selection for the first member of thecoeff_base/coeff_base_eob/coeff_brbraid: [DEFAULT_COEFF_BASE_EOB_CDF] ([COEFF_CDF_Q_CTXS][TX_SIZES][PLANE_TYPES][SIG_COEF_CONTEXTS_EOB][4]), transcribed verbatim from §9.4.coeff_base_eobcodes the base level of the last non-zero coefficient (the base level iscoeff_base_eob + 1; only 1, 2, or 3 are coded). New §3 constantSIG_COEF_CONTEXTS_EOB = 4. [TileCdfContext] grows thecoeff_base_eobfield, seeded by [TileCdfContext::new_from_defaults] from theidx == 0slice and re-selected perbase_q_idxby [TileCdfContext::init_coeff_cdfs]. The §8.3.2 selection surfacescoeff_base_eob_cdf(tx_sz_ctx, ptype, ctx), the three-wayTileCoeffBaseEobCdf[ txSzCtx ][ ptype ][ ctx ]lookup; the §8.3.2 ctx derivation (get_coeff_base_ctx() - SIG_COEF_CONTEXTS + SIG_COEF_CONTEXTS_EOB) belongs to the not-yet-implemented tile-content walk and is deferred. The remaining two tables of the braid (Default_Coeff_Base_CdfandDefault_Coeff_Br_Cdf) are deferred to later rounds. -
Round 139. The §9.4 default CDF table and the §8.3.1
init_coeff_cdfs/ §8.3.2 selection for the second member of thecoeff_base/coeff_base_eob/coeff_brbraid: [DEFAULT_COEFF_BASE_CDF] ([COEFF_CDF_Q_CTXS][TX_SIZES][PLANE_TYPES][SIG_COEF_CONTEXTS][5], 1680 5-entry rows; declaredstaticsoclippy::large_const_arraysdoes not flag the per-use copy hazard), transcribed verbatim from §9.4.coeff_basecodes the base level of each non-EOB coefficient — a 4-symbol alphabet (0..3). New §3 constantSIG_COEF_CONTEXTS = 42. [TileCdfContext] grows thecoeff_basefield, seeded by [TileCdfContext::new_from_defaults] from theidx == 0slice and re-selected perbase_q_idxby [TileCdfContext::init_coeff_cdfs]. The §8.3.2 selection surfacescoeff_base_cdf(tx_sz_ctx, ptype, ctx), the three-wayTileCoeffBaseCdf[ txSzCtx ][ ptype ][ ctx ]lookup; theget_coeff_base_ctx()derivation itself belongs to the not-yet-implemented tile-content walk and is deferred. The largest(TX_SIZE = TX_64X64, ptype = chroma)slice is a flat{8192, 16384, 24576, 32768, 0}placeholder across every q-context and ctx value (an unreachable-chroma sentinel mirroring the r138 (tx4, pt1) placeholder pattern). The last remaining table of the braid (Default_Coeff_Br_Cdf) is deferred to a later round. -
Round 140. The §9.4 default CDF table and the §8.3.1
init_coeff_cdfs/ §8.3.2 selection for the LAST member of thecoeff_base/coeff_base_eob/coeff_brbraid: [DEFAULT_COEFF_BR_CDF] ([COEFF_CDF_Q_CTXS][TX_SIZES][PLANE_TYPES][LEVEL_CONTEXTS][BR_CDF_SIZE + 1], 840 5-entry rows; declaredstaticsoclippy::large_const_arraysdoes not flag the per-use copy hazard), transcribed verbatim from §9.4. With this table all three coefficient-CDF braid members are landed.coeff_brcodes the per-coefficient base-range increment used to push a level aboveNUM_BASE_LEVELS: each read codes a value in0..BR_CDF_SIZE = 4, and §5.11.39 stacksCOEFF_BASE_RANGE / (BR_CDF_SIZE - 1)such reads per coefficient. New §3 constantsLEVEL_CONTEXTS = 21andBR_CDF_SIZE = 4. [TileCdfContext] grows thecoeff_brfield, seeded by [TileCdfContext::new_from_defaults] from theidx == 0slice and re-selected perbase_q_idxby [TileCdfContext::init_coeff_cdfs]. The §8.3.2 selection surfacescoeff_br_cdf(tx_sz_ctx, ptype, ctx), implementing the spec selectorTileCoeffBrCdf[ Min(txSzCtx, TX_32X32) ][ ptype ][ ctx ]with theTX_32X32 = 3clamp built in (so anytxSzCtxis accepted; onlyptype/ctxare bounds-checked); theget_br_ctx()derivation itself belongs to the not-yet-implemented tile-content walk and is deferred. The largest(TX_SIZE = TX_64X64, ptype = chroma)slice is again a flat{8192, 16384, 24576, 32768, 0}placeholder, mirroring the r138 / r139 pattern. The next gate is the §8.3.2get_coeff_base_ctx()/get_br_ctx()neighbour-derivation helpers (deferred to a different round — they need tile-content walker state). -
Round 141. The §8.3.2 neighbour-derivation helpers that close out the coefficient-CDF braid: [
get_coeff_base_ctx] and [get_br_ctx] (plus the [get_coeff_base_eob_ctx] wrapper that subtractsSIG_COEF_CONTEXTSand addsSIG_COEF_CONTEXTS_EOBto land on the EOB-CDF context range). Each consumes a coefficient-magnitude arrayQuant[](laid out row-major with strideTx_Width[ adjTxSz ]) plus the position-in-scan + tx-class + tx-size and returns thectxindex consumed by the matchingcoeff_base_eob_cdf/coeff_base_cdf/coeff_br_cdfselector. [get_tx_class] performs the §8.3.2TxType -> TxClassreduction (V_DCT/V_ADST/V_FLIPADST-> [TX_CLASS_VERT],H_DCT/H_ADST/H_FLIPADST-> [TX_CLASS_HORIZ], everything else -> [TX_CLASS_2D]). New §3 constants [TX_SIZES_ALL] (= 19), [SIG_COEF_CONTEXTS_2D] (= 26), [SIG_REF_DIFF_OFFSET_NUM] (= 5), [NUM_BASE_LEVELS] (= 2), [COEFF_BASE_RANGE] (= 12), [TX_CLASS_2D], [TX_CLASS_HORIZ], [TX_CLASS_VERT]. New §-Additional- tables transcriptions [TX_WIDTH], [TX_HEIGHT], [TX_WIDTH_LOG2], [ADJUSTED_TX_SIZE], [SIG_REF_DIFF_OFFSET], [MAG_REF_OFFSET_WITH_TX_CLASS], [COEFF_BASE_CTX_OFFSET], [COEFF_BASE_POS_CTX_OFFSET]. Caller still owns the tile-content walk that suppliesQuant[]itself plus thecompute_tx_type()derivation that feeds [get_tx_class]; this round delivers the per-coefficientctxplumbing those callers will consume. -
Round 142. The §5.11.40
compute_tx_type()derivation — [compute_tx_type], the per-plane / per-block transform-type lookup the tile-content walker reads before kicking off coefficient decoding. Implements the full spec function:Lossless || Tx_Size_Sqr_Up[ txSz ] > TX_32X32short-circuits toDCT_DCT;plane == 0returns theTxTypes[ blockY ][ blockX ]luma cache entry;is_interchroma reads the cache at(Max(MiRow, blockY << subsampling_y), Max(MiCol, blockX << subsampling_x))then runs the [is_tx_type_in_set] admission filter; intra chroma reads [MODE_TO_TXFM][UVMode]then runs the same filter. The §5.11.40is_tx_type_in_set(txSet, txType)predicate is a direct read of [TX_TYPE_IN_SET_INTER] / [TX_TYPE_IN_SET_INTRA]. The caller supplies the §5.11.40txSet(i.e. the already-resolved [inter_tx_type_set] / [intra_tx_type_set] result) and a closure overTxTypes[y][x]so the helper does not bake in a particular storage shape. New §6.10.16 ordinal constants [TX_4X4] / [TX_8X8] / [TX_16X16] / [TX_32X32] / [TX_64X64] replace the localconst TX_*shadows the existing [inter_tx_type_set] / [intra_tx_type_set] helpers used. New §6.10.19 transform-type ordinals [DCT_DCT] through [H_FLIPADST] (16 entries) name the previously-numeric entries. New §-Additional-tables transcription [TX_SIZE_SQR_UP] (Tx_Size_Sqr_Up[ TX_SIZES_ALL ],t -> Max(w, h)-sided square). New §5.11.40 tables [MODE_TO_TXFM] (chroma-mode -> default transform-type), [TX_TYPE_IN_SET_INTRA] (TX_SET_TYPES_INTRA = 3rows ofTX_TYPES = 16admission flags), [TX_TYPE_IN_SET_INTER] (TX_SET_TYPES_INTER = 4rows). The derivation is pure / msac- independent — the tile walker plugs it in onceMiRow/MiCol/subsampling_x/subsampling_y/UVMode/TxTypesstate lands. 278 -> 288 tests, zero#[ignore]. -
Round 143. The §9.4 default CDF tables and the §8.3.1 / §8.3.2 selection for the inter-intra syntax group (
interintra,interintra_mode,wedge_interintra— the §5.11.28read_interintra_modetriple). Transcribes [DEFAULT_INTER_INTRA_CDF] ([BLOCK_SIZE_GROUPS - 1][3]), [DEFAULT_INTER_INTRA_MODE_CDF] ([BLOCK_SIZE_GROUPS - 1][INTERINTRA_MODES + 1]) and [DEFAULT_WEDGE_INTER_INTRA_CDF] ([BLOCK_SIZES][3]) verbatim from §9.4. New §3 constant [INTERINTRA_MODES] (= 4, per §6.10.27II_DC_PRED/II_V_PRED/II_H_PRED/II_SMOOTH_PRED). [TileCdfContext] grows theinter_intra/inter_intra_mode/wedge_inter_intrafields, seeded by [TileCdfContext::new_from_defaults] per §8.3.1. The §8.3.2 selection surfacesinter_intra_cdf(ctx)/inter_intra_mode_cdf(ctx)(the scalar [interintra_ctx] helper folds the spec’sctx = Size_Group[ MiSize ] - 1into a single0..(BLOCK_SIZE_GROUPS - 1)index, returningNonefor theSize_Group[ MiSize ] == 0rows that the §5.11.28 syntax gate excludes) andwedge_inter_intra_cdf(mi_size)(a straight0..BLOCK_SIZESindex). The wedge table’s outer dimension is transcribed full-width per the §9.4 listing; per its note only indices3..=9(theBLOCK_8X8..BLOCK_32X32band) are reachable. 288 -> 296 tests, zero#[ignore]. -
Round 144. The §9.4 default CDF table and the §8.3.1 / §8.3.2 selection for the wedge-index syntax element —
wedge_index, read by both §5.11.28read_interintra_mode(the inter-intra wedge sub-branch, whenwedge_interintra == 1) and §5.11.29read_compound_type(the inter-interCOMPOUND_WEDGEbranch). Transcribes [DEFAULT_WEDGE_INDEX_CDF] ([BLOCK_SIZES][WEDGE_TYPES + 1]) verbatim from §9.4 (p.435). New §3 constant [WEDGE_TYPES] (= 16, the spec text reads “Number of directions for the wedge mask process”). [TileCdfContext] grows thewedge_indexfield, seeded by [TileCdfContext::new_from_defaults] per §8.3.1. The §8.3.2 selectionwedge_index_cdf(mi_size)is a straightTileWedgeIndexCdf[ MiSize ]index. The table’s outer dimension is transcribed full-width per the §9.4 listing; per its note (p.436) indices 0..2, 10..17, and 20..21 are never used in the first dimension (matching the §3Wedge_Bits[ MiSize ] == 0rows) and carry the placeholder uniform CDF{ 2048, 4096, …, 30720, 32768, 0 }(step32768 / WEDGE_TYPES). 296 -> 302 tests, zero#[ignore]. -
Round 145. The §8.3.2
split_or_horz/split_or_vertcdf-derivation helpers — [split_or_horz_cdf] and [split_or_vert_cdf] — that build a 2-symbol binary cdf out of the already-selectedpartitioncdf (the spec’spartitionCdf) per p.362. Each helper folds the §9.4 partition probabilities of the “splittable plus orthogonal-axis” symbols into a singlepsum, then emitscdf[0] = (1 << 15) - psum,cdf[1] = 1 << 15,cdf[2] = 0; per the §8.3.2 note the probability of the disallowed orthogonal partition gets folded into the split probability, sosplit_or_horzcannot return aPARTITION_VERTandsplit_or_vertcannot return aPARTITION_HORZ. Theb_size != BLOCK_128X128guard drops thePARTITION_*_4term that the §9.4Default_Partition_W128_Cdfrow has no entry for. New §6.10.4 / §3 ordinal constants [PARTITION_NONE] / [PARTITION_HORZ] / [PARTITION_VERT] / [PARTITION_SPLIT] / [PARTITION_HORZ_A] / [PARTITION_HORZ_B] / [PARTITION_VERT_A] / [PARTITION_VERT_B] / [PARTITION_HORZ_4] / [PARTITION_VERT_4] + [EXT_PARTITION_TYPES] (= 10) + the block-size ordinal [BLOCK_128X128] (= 15) replace the literal indices the §8.3.2 formulas use. 302 -> 312 tests, zero#[ignore]. -
Round 146. The §5.11.50
get_palette_color_contextderivation — the function the §5.11.49 diagonal walk reads at eachpalette_color_idx_*position to produce theColorOrder[ PALETTE_COLORS ]permutation +ColorContextHashthat flow back through [palette_color_ctx] into the §8.3.2 cdf selector. Surface: [palette_color_context_from_neighbors] (pure-scoring core taking the three optional neighbour palette indices) and [get_palette_color_context] (spec-faithful 2-D entry that applies the §5.11.50r > 0/c > 0boundary guards). The [PaletteColorContext] struct packages both outputs. The partial selection sort is the §5.11.50 three-iteration loop that promotes the top-scoring neighbours to the head ofColorOrderwhile preserving the runners-up’s ascending order; the hash is thePalette_Color_Hash_Multipliers- weighted sum of the top three sorted scores. 312 -> 323 tests, zero#[ignore]. -
Round 147. The §5.11.49
palette_tokens( )per-plane diagonal walker — the §5.11.49 caller-facing entry point that drives the §5.11.50 colour-context derivation across one of the planes’ anti-diagonal walk, decodes onepalette_color_idx_{y,uv}per(i - j, j)against the cdf row picked by [palette_color_ctx], remaps throughColorOrder[idx], and fills the on-screen border by replicating the last on-screen column / row. Surface: [palette_tokens_plane] (driving the [SymbolDecoder] + [TileCdfContext]) and the [PalettePlane] selector. Two newErrorvariants surface caller-bug preconditions (Error::InvalidPaletteWalkArgs) and the §5.11.50 unreachable hash slots (Error::PaletteColorContextUnmapped). 323 -> 334 tests, zero#[ignore]. -
Round 148. The §9.3 block-size conversion tables (av1-spec p.400–401) — four
BLOCK_SIZES-indexed lookup tables that turn aMiSizeinto block dimensions: [MI_WIDTH_LOG2], [MI_HEIGHT_LOG2], [NUM_4X4_BLOCKS_WIDE], [NUM_4X4_BLOCKS_HIGH], plus the §3 constants [MI_SIZE] (4) and [MI_SIZE_LOG2] (2). Surface: the four tables plus the sixMiSize-keyedconst fnaccessors [block_width], [block_height], [num_4x4_blocks_wide], [num_4x4_blocks_high], [mi_width_log2], [mi_height_log2]. TheBlock_Width[ x ] = 4 * Num_4x4_Blocks_Wide[ x ]spec identity is encoded as theNUM_4X4_BLOCKS_WIDE[ x ] << MI_SIZE_LOG2shift so the identity is not duplicated as a numeric table. These feed the §5.11.49 [palette_tokens_plane] caller staged in r147 and unblock the wider §5.x reconstruction call sites that the parser will surface onceread_blockis wired. 334 -> 344 tests, zero#[ignore]. -
Round 149. The §5.11.49 caller-side argument derivation (av1-spec p.101-102) — [
palette_tokens_args] computes the four [PaletteTokensArgs] dimensions (blockWidth,blockHeight,onscreenWidth,onscreenHeight) from the parser-scope(MiSize, MiRow, MiCol, MiRows, MiCols, plane, subsampling_x, subsampling_y)tuple. Reuses the §9.3 tables staged in r148 and the §5.11.46 palette gate constant [BLOCK_8X8] (3). Both spec branches handled: the Y branch returns the §9.3-driven dimensions clipped byMin(.., (MiRows - MiRow) * MI_SIZE)/Min(.., (MiCols - MiCol) * MI_SIZE), the UV branch applies the>> subsampling_{x,y}shift then the §5.11.49<4-bump (block_w += 2; onscreen_w += 2when post-shiftblock_w < 4, ditto for height). Walker invariants (1 <= onscreen_* <= block_*,block_* <= 64) proven over every palette-eligible(MiSize, sub_x, sub_y, plane)combination. Bridges the data-flow gap pinned by the r147 follow-up test soread_blockcan callpalette_tokensonce the parser surfaces it. 344 -> 359 tests, zero#[ignore]. -
Round 150. The §9.3
Partition_Subsize[ 10 ][ BLOCK_SIZES ]lookup (av1-spec p.402-403) plus the §3 enumeration of the 22 namedBLOCK_*ordinals and the [BLOCK_INVALID] (22) sentinel. [PARTITION_SUBSIZE] transcribes the table verbatim — every rectangularbSizecolumn carriesBLOCK_INVALIDper the av1-spec p.401 note “The table will never get accessed for rectangular block sizes”. The typed accessor [partition_subsize] folds the sentinel intoOption<usize>(NoneonBLOCK_INVALIDor out-of-range indices) so the upcoming §5.11.4decode_partition()body can readsubSize = Partition_Subsize[ partition ][ bSize ]/splitSize = Partition_Subsize[ PARTITION_SPLIT ][ bSize ]and never hand a sentinel to its recursive children. Tests cover row-3 (SPLIT) halving identity, row-1 (HORZ) / row-2 (VERT) halving, row-4..7 (_A/_B) row equality with rows 1 / 2, row-8..9 (_4) quarter-splits, theBLOCK_4X4-only-resolves-for-PARTITION_NONEcolumn-0 invariant, exhaustive rectangular-bSize-is-invalid coverage, and the §5.11.4 subdivision-shrinks-area invariant. The 22BLOCK_*constants andBLOCK_INVALIDare also pinned against their av1-spec p.171-172 / p.7 ordinals. 359 -> 375 tests, zero#[ignore]. -
Round 151. The §5.11.4
decode_partition( r, c, bSize )body (av1-spec p.61-62) — the recursive partition-tree walker that stitches r137-r145’s §9.4 partition-default CDFs, r145’s §8.3.2 [split_or_horz_cdf] / [split_or_vert_cdf] binary-CDF derivation, r150’s §9.3 [PARTITION_SUBSIZE] table + [partition_subsize] accessor, and the §9.3 [MI_WIDTH_LOG2] / [NUM_4X4_BLOCKS_WIDE] tables into one [PartitionWalker] type. The walker carries the §6.10.4MiSizes[r][c]grid (filled at every leaf via the block’s [NUM_4X4_BLOCKS_WIDE] / [NUM_4X4_BLOCKS_HIGH] footprint), and consults it for the §8.3.2 [partition_ctx] derivationabove = AvailU && (Mi_Width_Log2[ MiSizes[r-1][c] ] < bsl)/left = AvailL && (Mi_Height_Log2[ MiSizes[r][c-1] ] < bsl)on every recursive child (av1-spec p.362). The walker emits aVec<DecodedBlockRecord>of(MiRow, MiCol, MiSize)leaves in §5.11.4 syntax order; the actual §5.11.5decode_block()body remains out of scope and is the next round’s target. All four §5.11.4 edge-of-frame branches are honoured: ther >= MiRows || c >= MiColsearly return; thebSize < BLOCK_8X8short-circuit toPARTITION_NONEwith no symbol read; thehasCols-alone branch that readssplit_or_horz; thehasRows-alone branch that readssplit_or_vert; and the!hasRows && !hasColsfall-through toPARTITION_SPLIT. All ten partition arms (NONE/HORZ/VERT/SPLIT/HORZ_A/HORZ_B/VERT_A/VERT_B/HORZ_4/VERT_4) dispatch the spec’s literaldecode_block/ recursivedecode_partitioncalls with the appropriatesubSize(thePartition_Subsize[ partition ][ bSize ]lookup) orsplitSize(thePartition_Subsize[ PARTITION_SPLIT ][ bSize ]lookup). New [TileGeometry] type carries the four §5.11.1 mi-unit tile bounds for the §5.11.51is_insidetest. The §5.11.4 bottom-right edge clip on the optionalHORZ_4/VERT_4fourth leaf (r + quarterBlock4x4 * 3 < MiRows/c + quarterBlock4x4 * 3 < MiCols) is applied literally. Out-of-range / out-of-tile inputs surface asError::PartitionWalkOutOfRange(caller-bug only — a conformant driver never produces one). Tests cover: single-leafPARTITION_NONEfor sub-BLOCK_8X8block sizes (no symbol read); single-leaf and split-emission against the W128 superblock; recursive descent down toBLOCK_4X4leaves; all ten partition arms via deterministic CDF setups; the edge-of-framehasRows-alone /hasCols-alone branches via a small mi-cropped frame; the §6.10.4MiSizes[]grid-fill invariant (every cell of the leaf’sbh4 * bw4footprint carriessub_size); and the §5.11.4r >= MiRows || c >= MiColsearly-return invariant. The walker leaves thedecode_blockcoefficient / motion-vector / reconstruction path entirely to the next round. -
Round 152. The §5.11.11
read_skip()syntax element (av1-spec p.65) — the per-blockskipsyntax read. Lands as a new [PartitionWalker::decode_skip] method on the r151 walker, plus aSkips[r][c]flag grid carried alongside the existing §6.10.4MiSizes[]grid. Both spec branches are honoured: when the caller passesseg_skip_active = true(the combined preconditionSegIdPreSkip && seg_feature_active( SEG_LVL_SKIP )from §5.9.14 segmentation state, computed upstream by the frame parser), the spec short-circuits toskip = 1with no symbol read; otherwise anS()symbol is decoded againstTileSkipCdf[ctx]wherectx = AvailU * Skips[MiRow-1][MiCol] + AvailL * Skips[MiRow][MiCol-1]per av1-spec p.378, driven through the walker’sSkips[]grid and [TileGeometry::is_inside] forAvailU/AvailL. The §5.11.5 grid-fill (av1-spec p.65 footer) stamps the decoded value over the block’sbw4 * bh4footprint, clipped at the frame’sMiRows/MiColsextent. New [PartitionWalker::skips] accessor returns a row-major view of the grid for downstream §5.11.x consumers. Out-of-rangemi_row/mi_col/sub_sizesurface asError::PartitionWalkOutOfRange. Tests cover: seg short-circuit no-symbol-read invariant; else-branch S() against rigged 2-symbol CDFs (forced 0 and 1); footprint grid-stamp on both branches; ctx-0 selection at the frame origin (AvailU = AvailL = false); ctx-2 selection through two priorSkips=1neighbours; AvailL-false at the left-tile-column boundary; non-zero tile origin clearing bothAvailU/AvailL; right-edgebw4clip; out-of-range guard returns; and the initial all-zeroSkips[]invariant. 394 -> 405 tests, zero#[ignore]. -
Round 154. The §5.11.10
read_skip_mode()syntax element (av1-spec p.67) — the per-blockskip_modesyntax read. Lands as a new [PartitionWalker::decode_skip_mode] method on the r152 walker, plus aSkipModes[r][c]flag grid carried alongside the r152Skips[]and the existing §6.10.4MiSizes[]grids. The §5.11.10 short-circuit set (any-true ⇒skip_mode = 0, no symbol read) is honoured:seg_feature_active(SEG_LVL_SKIP / REF_FRAME / GLOBALMV)collapsed into the caller-providedseg_skip_mode_off;!skip_mode_presentvia the §5.9.21 frame-header scalar; andBlock_Width[MiSize] < 8 || Block_Height[MiSize] < 8derived locally fromsub_sizevia the §9.3 [cdf::block_width] / [cdf::block_height] tables. Otherwise anS()symbol is decoded againstTileSkipModeCdf[ctx]withctx = AvailU * SkipModes[MiRow-1][MiCol] + AvailL * SkipModes[MiRow][MiCol-1]per av1-spec p.378, routed through the existing [skip_mode_ctx] helper. The §5.11.5 grid-fill stamps the value over the block’sbw4 * bh4footprint, clipped at the frame’sMiRows/MiColsextent. New [PartitionWalker::skip_modes] accessor returns a row-major view.skip_modeis the inter-frame compound-reference shortcut read in §5.11.18inter_frame_mode_infobefore the rest of the inter mode decode (intra-only frames never call this). Tests cover: seg short-circuit;skip_mode_presentfalse short-circuit; both Block_Width-and-Block_Height < 8 short-circuits via BLOCK_4X8 and BLOCK_8X4; else-branch S() against rigged 2-symbol CDFs (forced 0 and 1); footprint grid-stamp; ctx-0 selection at the frame origin; ctx-1 single-neighbour and ctx-2 both-neighbour selection; non-zero tile origin clearing AvailU / AvailL; right-edgebw4clip; out-of-range guard returns; and the initial all-zeroSkipModes[]invariant. 405 -> 417 tests, zero#[ignore]. -
Round 155. The §5.11.12
read_delta_qindex()syntax element (av1-spec p.67) — the per-superblock quantiser index delta read. Lands as a new [PartitionWalker::decode_delta_qindex] method on the r154 walker, plus aCurrentQIndexscalar tracked across calls via [PartitionWalker::current_q_index] / [PartitionWalker::set_current_q_index]. Honours the §5.11.12 superblock-skip short-circuit (MiSize == sbSize && skip⇒ no symbol read;sbSizederived from the §5.5.1use_128x128_superblockflag) and the outerReadDeltas(§6.10.4) gate. Otherwise anS()symbol is decoded againstTileDeltaQCdf(a single-row §8.3.2 CDF, no context index, lengthDELTA_Q_SMALL + 2 = 5); a decoded value ofDELTA_Q_SMALL = 3triggers the §5.11.12 escape ladder (delta_q_rem_bitsL(3)+ post-increment +delta_q_abs_bitsL(rem_bits + 1)), reconstructing the absolute value viadelta_q_abs = delta_q_abs_bits + (1 << n) + 1over the extended range0..=2 ∪ 3..=511. Non-zerodelta_q_absreadsdelta_q_sign_bitL(1)and applies the spec’sCurrentQIndex = Clip3(1, 255, CurrentQIndex + (reducedDeltaQIndex << delta_q_res))update. New constant [cdf::DELTA_Q_SMALL] (= 3) plus new table [cdf::DEFAULT_DELTA_Q_CDF] transcribed verbatim from §9.4 p.431 ([28160, 32120, 32677, 32768, 0]); new field [cdf::TileCdfContext::delta_q] + accessor [cdf::TileCdfContext::delta_q_cdf]. Tests cover: default CDF literal match; init-from-defaults invariant; sb-skip short-circuit for bothuse_128x128_superblockvalues; ReadDeltas false short-circuit; zerodelta_q_absno-update; literal-positive paths with and without shift; Clip3 lower-bound via hostile seed; Clip3 upper-bound; DELTA_Q_SMALL escape ladder minimum value; escape ladder stays inClip3(1, 255)range; cross-call accumulation; fresh-walker initialCurrentQIndex = 0; out-of-range guard; arithmetic decoder zero-byte sign-bit observation. 417 -> 433 tests, zero#[ignore]. -
Round 156. The §5.11.13
read_delta_lf()syntax element (av1-spec p.68) — the per-superblock loop-filter delta read, structurally parallel to §5.11.12 but iteratingframeLfCounttimes over a four-slotDeltaLF[ i ]accumulator with thedelta_lf_multiflag selecting between the §8.3.2 single-LF (TileDeltaLFCdf) and per-edge multi-LF (TileDeltaLFMultiCdf[ i ]) cdf branches. Lands as a new [PartitionWalker::decode_delta_lf] method plus acurrent_delta_lf: [i32; FRAME_LF_COUNT]accumulator on the walker (accessors [PartitionWalker::current_delta_lf] and [PartitionWalker::reset_current_delta_lf] for the §5.11.2 tile-entry reset). Honours the §5.11.13 superblock-skip short-circuit identically to §5.11.12, plus theReadDeltas && delta_lf_presentouter gate (two AND-ed flags). When the gate passes,frameLfCountis derived locally:delta_lf_multi == 0⇒ 1;delta_lf_multi == 1 && mono_chrome⇒FRAME_LF_COUNT - 2 = 2; otherwiseFRAME_LF_COUNT = 4. Each iteration readsdelta_lf_absS()against the branch-selected CDF, then either the literal value or the §5.11.13 escape ladder (delta_lf_rem_bitsL(3)+ post-increment +delta_lf_abs_bitsL(rem_bits + 1)⇒deltaLfAbs = abs_bits + (1 << n) + 1), then for non-zero magnitudesdelta_lf_sign_bitL(1)followed by theDeltaLF[ i ] = Clip3(-MAX_LOOP_FILTER, MAX_LOOP_FILTER, DeltaLF[ i ] + (reducedDeltaLfLevel << delta_lf_res))update. New constants [cdf::DELTA_LF_SMALL] (= 3), [cdf::FRAME_LF_COUNT] (= 4), and [cdf::MAX_LOOP_FILTER] (= 63 asi32— distinct from the pre-existinguncompressed_header_tail::MAX_LOOP_FILTERi16twin used by §5.9.11). New table [cdf::DEFAULT_DELTA_LF_CDF] transcribed verbatim from §9.4 p.431 ([28160, 32120, 32677, 32768, 0], equal toDEFAULT_DELTA_Q_CDFper the spec listing — preserved as two independent constants so adaptation drift on one does not leak through the other). New fields [cdf::TileCdfContext::delta_lf] + [cdf::TileCdfContext::delta_lf_multi] with accessors [cdf::TileCdfContext::delta_lf_cdf] / [cdf::TileCdfContext::delta_lf_multi_cdf]. 17 new cdf-module tests (433 -> 450): default-CDF literal match (incl. §9.4 equality withDEFAULT_DELTA_Q_CDF); init-from-defaults invariant for both single-LF and all four multi-LF rows; sb-skip short-circuit (64x64 and 128x128);ReadDeltasfalse short-circuit;delta_lf_presentfalse short-circuit; single-LF branch writes onlyDeltaLF[0]; multi-LF colour branch writes all four slots; multi-LF monochrome branch writes only the two Y slots; zero-delta_lf_absno-update; literal-positive with shift; Clip3 upper-bound atMAX_LOOP_FILTER = 63; Clip3 lower-bound via hostile seed;DELTA_LF_SMALLescape ladder minimum value; cross-call accumulation; fresh-walker initial accumulator all-zero +reset_current_delta_lfround-trip; out-of-range guard.decode_av1/encode_av1continue to returnError::NotImplemented. -
Round 157. The §5.11.56
read_cdef()syntax element (av1-spec p.104) — the per-leaf CDEF-index read, plus the §5.11.55clear_cdef()per-superblock sentinel reset. Lands as new [PartitionWalker::decode_cdef] + [PartitionWalker::clear_cdef] methods on the r156 walker, plus acdef_idx: Vec<i8>row-major grid sizedMiRows × MiColswith [PartitionWalker::cdef_idx] read accessor. CDEF operates on 64×64 anchor cells, so the walker masks the leaf(MiRow, MiCol)to the anchor at(MiRow & cdefMask4, MiCol & cdefMask4)(cdefMask4 = ~(cdefSize4 - 1),cdefSize4 = Num_4x4_Blocks_Wide[ BLOCK_64X64 ] = 16) and uses the anchor’s-1sentinel to decide whether the first leaf in this anchor should read anL(cdef_bits)literal (cdef_bitsin0..=3per §5.9.19f(2)). When the literal is read, the grid-fill loop stamps the value across the leaf’s(w4, h4)footprint at thecdefSize4 = 16stride so super-64 blocks (BLOCK_128X128) reach all four anchor cells while sub-64 blocks touch only their containing anchor. Subsequent leaves in the same 64×64 anchor short-circuit (no read; the anchor already holds the value). The §5.11.56 short-circuit set is honoured:skip || CodedLossless || !enable_cdef || allow_intrabc⇒ no read, anchor sentinel/value returned unchanged.clear_cdef( r, c, use_128x128_superblock )— called by the §5.11.2 tile walk before each superblock — stamps-1at the one (64×64 superblocks) or four (128×128 superblocks) anchor cells; out-of-grid anchors are silently skipped (the bottom/right superblock can straddle the frame edge). 18 new cdf-module tests (450 → 468): fresh-walker all--1invariant;clear_cdef64x64 single-anchor stamp;clear_cdef128x128 four-anchor stamp;clear_cdefout-of-grid skip; each of the fourskip/CodedLossless/!enable_cdef/allow_intrabcshort-circuit gates; first-leaf-reads-literal-and-stamps-anchor; second-leaf-in- anchor-no-read;cdef_bits == 0zero-bit stamp;cdef_bits == 3upper-bound; anchor-mask routes (10, 13) ⇒ (0, 0); BLOCK_128X128 stamps all four anchors; grid-fill clips at frame edge; short-circuit returns prior stamp;clear_cdefafter stamp resets anchor; out-of-range guard (4-way:mi_row/mi_col/sub_size/cdef_bits > 3).decode_av1/encode_av1continue to returnError::NotImplemented. -
Round 158. The §5.11.20
read_is_inter()syntax element (av1-spec p.71-72) — the per-block intra/inter classifier read inside §5.11.18inter_frame_mode_info(afterinter_segment_id/read_skip/read_cdef/read_delta_qindex/read_delta_lf) that dispatches between §5.11.22intra_block_mode_infoand §5.11.23inter_block_mode_info. Lands as a new [PartitionWalker::decode_is_inter] method on the r157 walker, plus anIsInters[r][c]flag grid carried alongside the r157cdef_idx[], r154SkipModes[], r152Skips[], and the existing §6.10.4MiSizes[]grids (IsInters[ r + y ][ c + x ] = is_interper the §5.11.5 footer at av1-spec p.65). All four arms of the §5.11.20 dispatch are honoured in spec order (first match fires, no read on the short-circuit arms): Arm 1 —skip_mode == 1forcesis_inter = 1; Arm 2 —seg_feature_active(SEG_LVL_REF_FRAME)routes through the caller-pre-computedFeatureData[segment_id][SEG_LVL_REF_FRAME] != INTRA_FRAMEboolean (the walker stays segmentation-state-free, identical to r154’sseg_skip_mode_offpattern); Arm 3 —seg_feature_active(SEG_LVL_GLOBALMV)forcesis_inter = 1; Arm 4 —S()symbol read againstTileIsInterCdf[ctx]withctxfrom the existing [is_inter_ctx] helper. The §8.3.2 ctx samples neighbour intra-ness from the complement of the walker’sIsInters[]grid (intra = !is_inter), with an unavailable neighbour treated as intra per §5.11.18 (LeftRefFrame[0] = AvailL ? RefFrames[..][0] : INTRA_FRAME⇒Noneto [is_inter_ctx]). The §5.11.5 grid-fill stamps the value over the block’sbw4 * bh4footprint, clipped at the frame’sMiRows/MiColsextent. New [PartitionWalker::is_inters] accessor returns a row-major view. 15 new cdf-module tests (468 → 483): fresh-walker grid all-zero; Arm 1 skip_mode short-circuit (position-invariant on a hostile0xFFbuffer); Arm 2 routing to intra and to inter (both position-invariant); Arm 3 globalmv short-circuit; Arm 1 takes precedence over Arm 2 / Arm 3; Arm 2 takes precedence over Arm 3; else-branch S() returning symbol 0 / 1 on rigged binary CDF rows (symbol-1 verifies the footprint grid-stamp); ctx-0 / ctx-1 / ctx-2 / ctx-3 selection through intra/inter seed combinations and ami_col_start = 4tile origin; bottom-right edge clip onBLOCK_16X16 @ (2, 2)in a 4×4 frame; three-way out-of-range guard ⇒PartitionWalkOutOfRange.decode_av1/encode_av1continue to returnError::NotImplemented. -
Round 159. The §5.11.9
read_segment_id()syntax element (av1-spec p.66) — the per-block segment-id reader called inside §5.11.8intra_segment_idand §5.11.19inter_segment_idwheneversegmentation_enabled. Lands as a new [PartitionWalker::decode_segment_id] method on the r158 walker, plus aSegmentIds[r][c]grid carried alongside the r158IsInters[], r156cdef_idx[], r154SkipModes[], r152Skips[], and the existing §6.10.4MiSizes[]grids (SegmentIds[ r + y ][ c + x ] = segment_idper the §5.11.5 grid-fill footer). The grid is pre-filled with the §5.11.9-1sentinel; cells inside a decoded block’sbh4 * bw4footprint then carrysegment_idin0..MAX_SEGMENTS = 0..8. The §5.11.9 neighbour cascade is honoured exactly as spelled out:prevULrequires bothAvailUANDAvailL;prevUandprevLeach gate on their own edge; out-of-grid neighbours fall through to-1. The four-armpredderivation (prevU == -1⇒prevL / 0;prevL == -1⇒prevU;prevUL == prevU⇒prevU; elseprevL) is preserved verbatim. The §5.11.9 dispatch distinguishes two paths:skip != 0⇒segment_id = pred(zero bits read); elsediff S()againstTileSegmentIdCdf[ctx](ctx from the existing [segment_id_ctx] helper) thensegment_id = neg_deinterleave(diff, pred, last_active_seg_id + 1). The walker stays segmentation-state-free: the caller passeslast_active_seg_id(the §5.9.14 trailing derivation) and theskipvalue the §5.11.11decode_skipjust returned. New public module-level [neg_deinterleave] helper transcribes the §5.11.9 bijection. New [PartitionWalker::segment_ids] accessor returns a row-major view. 11 new cdf-module tests (483 → 494): fresh-walker grid all-1; skip short-circuit at frame origin writessegment_id = pred = 0(noS()bit consumed on a hostile0xFFbyte buffer); skip inheritsprev_uwhenprev_lis unavailable; non-skip path withpred = 0returnsdiffunchanged; directneg_deinterleavetable exercises for both2 * ref < maxand2 * ref >= maxbranches plus edge cases (ref == 0identity,ref == max - 1inverted, smallest non-trivial alphabetmax = 2); ctx-0 origin selection; ctx-2 all-neighbours-match selection through three walker-stamped seeds; bottom-right edge clip onBLOCK_16X16 @ (2, 2)in a 4×4 frame; four-way out-of-range guard.decode_av1/encode_av1continue to returnError::NotImplemented. -
Round 160. The §5.11.8
intra_segment_id()syntax element (av1-spec p.66) — the intra-frame variant of the per-block segment-id read, called from §5.11.7intra_frame_mode_infoon both theSegIdPreSkipand!SegIdPreSkiparms. Lands as a new [PartitionWalker::decode_intra_segment_id] method that dispatches on the caller-passedsegmentation_enabledbit: when set, descends into r159 [PartitionWalker::decode_segment_id] (which does the §5.11.9 neighbour cascade + skip / non-skip dispatch + grid fill); when clear, stampssegment_id = 0over the leaf’sbh4 * bw4footprint without reading any bits. Both arms then resolve the §5.11.8Lossless = LosslessArray[ segment_id ]lookup via a caller-suppliedlossless_array: &[bool; MAX_SEGMENTS](the §6.8.2 per-segment table the frame-header walk computes fromqindex+DeltaQ?Dc+DeltaQ?Ac). Returns(segment_id, lossless). The walker stays segmentation-state-free: callers passsegmentation_enabled,last_active_seg_id, andlossless_arrayper-call (matching the r159 pattern). Range guards (out-of-rangesub_size,mi_row/mi_colpast the frame’s mi extent,last_active_seg_id >= MAX_SEGMENTS) fire on both arms so the no-symbol path is total over the same input space as the bitstream-reading path. 7 new cdf-module tests (494 → 501):segmentation_enabled = falseno-read on a hostile0xFFbuffer withlossless_array[0] = trueand= falsearms;segmentation_enabled = true, skip = 1at frame origin (pred = 0, noS()consumed);segmentation_enabled = true, skip = 0readingdiff = 3on a rigged CDF and looking uplossless_array[3]; per-segment Lossless indexing (rigdiff = 5, setlossless_array[5] = falsewhile every other slot istrue, expectLossless = false); bottom-right edge-clip onBLOCK_16X16 @ (2, 2)in a 4×4 frame on the!segmentation_enabledarm; five-way out-of-range guard covering both arms.decode_av1/encode_av1continue to returnError::NotImplemented. -
Round 161. The §5.11.7
intra_frame_mode_info()prefix dispatcher (av1-spec p.64) — the per-block top-level entry-point that composes the §5.11.7 first 11 lines:skip = 0; conditional pre-skipintra_segment_id();skip_mode = 0;read_skip(); conditional post-skipintra_segment_id();read_cdef();read_delta_qindex();read_delta_lf(); the fixedReadDeltas = 0/RefFrame[0] = INTRA_FRAME/RefFrame[1] = NONEassignments. Lands as a new [PartitionWalker::decode_intra_frame_mode_info_prefix] method on the r160 walker, returning the new public [cdf::IntraFrameModeInfoPrefix] struct carrying every post-call observable (skip,skip_mode,segment_id,lossless,cdef_idx,current_q_index,current_delta_lf,ref_frame). The §5.11.7SegIdPreSkipconditional routes the §5.11.8 call before or after the §5.11.11read_skip()per the caller-passedseg_id_pre_skipboolean (the §5.9.14 trailing derivation).skip_modeis fixed at0because the intra-frame walk never callsdecode_skip_mode(§5.11.10 short-circuits on!skip_mode_presentfor intra-only frames per §5.9.21). The §6.10.4ReadDeltas = 0assignment is left to the caller (the walker remains stateless about per-superblock first-block detection), matching the §6.10.4 pattern existing [PartitionWalker::decode_delta_qindex] / [PartitionWalker::decode_delta_lf] call sites already use. Range guards (out-of-rangesub_size,mi_row/mi_col,last_active_seg_id >= MAX_SEGMENTS,cdef_bits > 3) fire on the dispatcher level before any inner read so a caller bug never produces a partial-read. 8 new cdf-module tests (501 → 509): minimum-bit path (oneS()consumed forread_skip);SegIdPreSkip = truearm readingsegment_idfirst thenskip;SegIdPreSkip = falsearm post-skip withskip = 1triggering the §5.11.9 short-circuit; seg-skip-active forcingskip = 1with zero bits consumed on a hostile0xFFbuffer; fixedref_frame = [INTRA_FRAME, NONE];read_deltastrue wiring through to bothdelta_qanddelta_lfreads; five-way out-of-range guard;skip_modealways0on both pre-skip arms (verifiesSkipModes[]grid untouched). The §5.11.7 follow-on body (use_intrabcarm +intra_block_mode_infocomposite) and the §5.11.18inter_frame_mode_info/ §5.11.19inter_segment_idtwo-call protocol remain the next round’s targets.decode_av1/encode_av1continue to returnError::NotImplemented. -
Round 162. The §5.11.19
inter_segment_id( preSkip )syntax element (av1-spec p.71) — the inter-frame variant of the per-block segment-id read, called twice per block from §5.11.18 (once before §5.11.11read_skip()withpreSkip = 1and once after withpreSkip = 0). Lands as a new [PartitionWalker::decode_inter_segment_id] method. NewSEGMENT_ID_PREDICTED_CONTEXTS = 3(§9.3) constant and [cdf::DEFAULT_SEGMENT_ID_PREDICTED_CDF] table verbatim from §9.4 (av1-spec p.442 — three uniform[128 * 128, 32768, 0]rows for the binaryseg_id_predictedsymbol). New [cdf::TileCdfContext::segment_id_predicted] field initialised fromDEFAULT_SEGMENT_ID_PREDICTED_CDFplus the [cdf::TileCdfContext::segment_id_predicted_cdf] selector implementing the §8.3.2TileSegmentIdPredictedCdf[ ctx ]index. New persistentabove_seg_pred_context(lengthmi_cols) andleft_seg_pred_context(lengthmi_rows) buffers onPartitionWalkerper the §8.3.1 tile-entry initialisation; the §8.3.2 ctx walk readsLeftSegPredContext[ MiRow ] + AboveSegPredContext[ MiCol ](each0..=1; sum0..=2 < SEGMENT_ID_PREDICTED_CONTEXTS). [PartitionWalker::above_seg_pred_context] / [PartitionWalker::left_seg_pred_context] accessors surface the arrays. The dispatcher routes the full §5.11.19 cascade exactly: outer!segmentation_enabledcollapses tosegment_id = 0; inner!segmentation_update_mapadoptspredictedSegmentId;pre_skip && !SegIdPreSkipearly-exit returnssegment_id = 0; the post-skipskip != 0arm zeroes the context arrays then descends intodecode_segment_id(the §5.11.9 skip short-circuit fires inside); thesegmentation_temporal_update == 1arm readsseg_id_predicted, branches topredictedSegmentIdadopt orread_segment_id(), and stamps the context arrays with the just-read flag; thetemporal_update == 0fall-through readsread_segment_id()without touching the context arrays (per spec).predicted_segment_id(§5.11.21get_segment_id()) is caller-supplied from the §6.10 reference-frame walk so the walker stays inter-frame-state-free. Range guards (out-of-rangesub_size,mi_row/mi_colpast extent,last_active_seg_id >= MAX_SEGMENTS, and the newpredicted_segment_id > last_active_seg_idinvariant) fire up-front on every arm. 11 new cdf-module tests (509 → 520): fresh-walker context-array zeroing;!segmentation_enabledno-read on both pre/post-skip arms;!segmentation_update_mappredicted-id adoption;pre_skip && !SegIdPreSkipearly-exit; post-skip +skip != 0zeroing context arrays then descending into the §5.11.9 short-circuit (poisoned context arrays prove the spec write fires);temporal_update == 1+ riggedseg_id_predicted = 1adopting predicted id and stamping context to1;temporal_update == 1+ riggedseg_id_predicted = 0descending intodecode_segment_idand stamping context to0;temporal_update == 0fall-through leaving context untouched; five-way out-of-range guard;Default_Segment_Id_Predicted_Cdflayout; thesegment_id_predicted_cdfaccessor round-trip. The §5.11.18inter_frame_mode_info()top-level dispatcher remains the next round’s architectural payoff.decode_av1/encode_av1continue to returnError::NotImplemented. -
Round 163. The §5.11.21
get_segment_id()pure-helper function (av1-spec p.72) — the inter-frame per-block segment-id prediction lookup that scans the previous frame’sPrevSegmentIds[][]over the on-screen window covered by the current block and returns the smallest id found. Lands as a new free function [cdf::get_segment_id] (re-exported at the crate root) that takes the previous-frame segmentation surface as a row-major&[i32]slice plus its (prev_mi_rows,prev_mi_cols) extent, the current frame’s mi-extent (mi_rows,mi_cols) and anchor (mi_row,mi_col), and the block’ssub_size(§3BLOCK_*ordinal). ReturnsSome(seg)with the §5.11.21Minreduction result overxMis = Min(MiCols - MiCol, bw4)×yMis = Min(MiRows - MiRow, bh4)cells;segis in-1..=7(the-1sentinel surfaces when an unwritten previous-frame cell falls inside the window, letting callers detect a malformed reference surface via the existing §5.11.19predicted_segment_id > last_active_seg_idrange guard). ReturnsNonefor caller-bug arguments (out-of-rangesub_size, anchor outside the current frame, previous-frame extent smaller than the current frame’s, orprev_segment_idslength not matchingprev_mi_rows * prev_mi_cols). The function is pure (no walker state, no bitreader, no CDF) and complements the r162 [cdf::PartitionWalker::decode_inter_segment_id] caller — which takes a pre-computedpredicted_segment_id: u8so the walker can stay inter-frame-state-free — by giving the §6.10 reference-frame walk a verbatim spec-shaped routine to compute that argument fromPrevSegmentIds[]. 12 new cdf-module tests (520 → 532): uniform-0 / uniform-7 reductions over several block sizes; explicit Min-over-2x2-window cells with out-of-window decoy values that must not contribute; frame-edgexMis/yMisclipping on aBLOCK_16X16anchored at the bottom-right of a 4x4 mi-grid;-1sentinel round-trip; a wider-than-current previous frame exercising theprev_mi_colsrow stride; single-cellBLOCK_4X4covering exactlyprev[MiRow][MiCol]with a neighbour-cell decoy; out-of-range guards for invalidsub_size, anchor past frame extent, previous-frame extent smaller than current frame’s, and length / shape mismatch; an end-to-end composition test feedingget_segment_id’s result intodecode_inter_segment_id’s no-read!segmentation_update_maparm and verifying the predicted id is adopted with zero bit reads on a hostile0xFFbuffer. The §5.11.18inter_frame_mode_info()top-level dispatcher, §5.11.7use_intrabcarm, and §5.11.22intra_block_mode_infocomposite remain the next round’s targets.decode_av1/encode_av1continue to returnError::NotImplemented. -
Round 168. §5.11.17
read_var_tx_size()(av1-spec p.70) + §5.11.18inter_frame_mode_info()(av1-spec p.71) — the two missing inter-arm composites that bound the §5.11.5 walker’s inter side. The §5.11.17 reader is exposed as [cdf::PartitionWalker::read_var_tx_size] (callable standalone) and wired into the §5.11.16 inter-arm so [cdf::PartitionWalker::read_block_tx_size] no longer surfacesError::ReadVarTxSizeUnsupportedon theTX_MODE_SELECT && is_inter && !skip && !Losslessarm — the recursion stampsInterTxSizes[]per terminal-else leaf and the outer §5.11.5 footer stampsTxSizes[]over the full block footprint. The §8.3.2txfm_splitctx selector inlines the spec’sget_above_tx_width/get_left_tx_heighthelpers as private [cdf::PartitionWalker] methods against the walker’sSkips[]/IsInters[]/MiSizes[]/InterTxSizes[]grids, and routes the(above, left, txSzSqrUp, maxTxSz)derivation through the existing [cdf::txfm_split_ctx] helper. New free function [cdf::find_tx_size] (§5.11.36 helper, re-exported) supports themaxTxSz = find_tx_size(size, size)step of the ctx formula.The §5.11.18 reader is exposed as [
cdf::PartitionWalker::decode_inter_frame_mode_info] composing every leaf already wired through the walker: [cdf::PartitionWalker::decode_inter_segment_id] (pre- and post-skip arms), [cdf::PartitionWalker::decode_skip_mode], [cdf::PartitionWalker::decode_skip] (gated byskip_mode == 0), [cdf::PartitionWalker::decode_cdef], [cdf::PartitionWalker::decode_delta_qindex], [cdf::PartitionWalker::decode_delta_lf], and [cdf::PartitionWalker::decode_is_inter]. The terminalif (is_inter)dispatch short-circuits at two newErrorvariants:Error::InterBlockModeInfoUnsupported(§5.11.23inter_block_mode_info()— the next-round target for the MV stack / ref-frame readers) andError::IntraBlockModeInfoUnsupported(§5.11.22intra_block_mode_info()— the next-round target for the per-block intra angle / UV mode readers). New [cdf::DecodedInterFrameModeInfo] aggregate carries every §5.11.18 derived value.The §5.11.5 [
cdf::PartitionWalker::decode_block_syntax] walker is unchanged on theframe_is_intra = falsearm — it still surfacesError::DecodeBlockInterFrameUnsupported(the umbrella stub) because the §5.11.18 reader needs additional caller state (segmentation_update_map/segmentation_temporal_update/predicted_segment_id/seg_*_activeoverrides /skip_mode_present) the §5.11.5 driver doesn’t yet thread through. Direct callers ofdecode_inter_frame_mode_infoget the full pre-dispatch walk and the §5.11.22 / §5.11.23 distinction.11 new integration tests cover the §5.11.17 base case + depth cap + split path + frame-edge clip + caller-bug guards + the wired §5.11.16 inter-arm, plus the §5.11.18 intra / inter stub dispatch + skip-mode-forces-skip + segment-globalmv arm + caller-bug guards + the
DecodedInterFrameModeInfopublic-API smoke. Plus 1 new unit test forfind_tx_size.decode_av1/encode_av1continue to returnError::NotImplemented. -
Round 167. The §5.11.16
read_block_tx_size()reader (av1-spec p.70) — the per-block transform-size syntax-tree read that r166’s §5.11.5 walker hit as the first stub on the intra arm. Lands as a new [cdf::PartitionWalker::read_block_tx_size] method (callable standalone) and is wired into the §5.11.5 walker so the walker now reachesError::DecodeBlockComputePredictionUnsupported(§5.11.30) instead.The reader transcribes the spec body one-to-one. The outer
TX_MODE_SELECT && MiSize > BLOCK_4X4 && is_inter && !skip && !Losslessarm routes to §5.11.17read_var_tx_size(the next-arc target — surfaces a newError::ReadVarTxSizeUnsupported). Theelsearm inlines §5.11.15read_tx_size(!skip || !is_inter): aLosslessshort-circuit forcesTxSize = TX_4X4; otherwiseTxSizestarts atMax_Tx_Size_Rect[ MiSize ]and is further split viaSplit_Tx_Size[]fortx_depthiterations when the §5.11.15MiSize > BLOCK_4X4 && allowSelect && TxMode == TX_MODE_SELECTgate fires. The §8.3.2tx_depthctx walks the neighbourIsInters[]/MiSizes[]/InterTxSizes[]ladder perget_above_tx_width/get_left_tx_heightand selects the CDF row viaMax_Tx_Depth[ MiSize ]. Theelse-arm grid-fill stamps both [cdf::PartitionWalker::inter_tx_sizes] and the §5.11.5 footer’s [cdf::PartitionWalker::tx_sizes] across the block footprint.New spec tables ([
cdf::MAX_TX_SIZE_RECT] / [cdf::MAX_TX_DEPTH_TABLE] / [cdf::SPLIT_TX_SIZE] / [cdf::MAX_VARTX_DEPTH]) and 14 new rectangularTX_*ordinals ([cdf::TX_4X8] / … / [cdf::TX_64X16]) transcribe av1-spec p.402, p.69, p.404, §3 p.7, and §6.10.16 respectively. New [cdf::PartitionWalker] gridstx_sizes/inter_tx_sizescover §5.11.5 / §5.11.16 write semantics. [cdf::DecodedBlock] gains atx_sizefield; [cdf::PartitionWalker::decode_block_syntax] gains atx_mode_select: boolparameter (threaded from the §5.9.21 / §6.8.21 frame-headerTxModederivation).10 new integration tests cover the new reader’s spec paths; 5 new unit tests verify the spec tables.
decode_av1/encode_av1continue to returnError::NotImplemented. -
Round 166. The §5.11.5
decode_block()syntax-walker skeleton (av1-spec p.63-64) — the missing dispatcher that the §5.11.4 partition walker recurses into at every leaf. Lands as a new [cdf::PartitionWalker::decode_block_syntax] method that performs the §5.11.5 prologue (MiRow,MiCol,MiSize,bw4,bh4; theHasChromathree-arm dispatch onbh4 == 1 && subsampling_y && (MiRow & 1) == 0andbw4 == 1 && subsampling_x && (MiCol & 1) == 0;AvailU,AvailL,AvailUChroma,AvailLChromaderivation with the spec’s chroma fix-up arm) and the §5.11.6mode_info()intra arm composed from r161’s [cdf::PartitionWalker::decode_intra_frame_mode_info_prefix], r164’s [cdf::PartitionWalker::decode_use_intrabc], and r165’s [cdf::PartitionWalker::decode_intra_frame_y_mode]. The §5.11.49palette_tokens()call is a no-op on the no-palette path. Short-circuits at the §5.11.16read_block_tx_size()call with a newError::DecodeBlockReadBlockTxSizeUnsupported— the immediate next-round target.Four new
Errorvariants surface the §5.11.5 next-round boundaries one-to-one:Error::DecodeBlockInterFrameUnsupported(§5.11.18inter_frame_mode_info(), fires onframe_is_intra = falsewith zero bits consumed);Error::DecodeBlockReadBlockTxSizeUnsupported(§5.11.16, the stub the walker actually reaches);Error::DecodeBlockComputePredictionUnsupported(§5.11.30, reserved for the round that lands §5.11.16); andError::DecodeBlockResidualUnsupported(§5.11.34, reserved for the round that lands §5.11.30).New [
cdf::DecodedBlock] per-block aggregate — publicly constructible — carries the §5.11.5 prologue + §5.11.7 mode-info derivations on the no-stub path. Reachable once §5.11.16 lands.§5.11.4 partition driver mirror: [
cdf::PartitionWalker::decode_partition_syntax] walks the same recursion shape as [cdf::PartitionWalker::decode_partition] but routes every leaf throughdecode_block_syntaxinstead of the leaf-only emitter. Stub propagates from the first leaf that fires it.10 new integration tests (
tests/decode_block_syntax_walker.rs) cover the §5.11.5 prologue’s three-armHasChromadispatch onBLOCK_4X4, the §5.11.6 inter-arm stub, the §5.11.7SegIdPreSkippre-skip arm reaching the §5.11.16 stub after the composed reads fire in spec order, out-of-range guards, the §5.11.4 partition driver’sBLOCK_4X4short-circuit arm propagating the stub, the §5.11.4r >= MiRowsline-1 early return,DecodedBlockpublic-API constructibility,BLOCK_8X16grid-fill footprint (bw4 = 2, bh4 = 4), andBLOCK_16X16withcdef_bits = 2exercising the §5.11.56 literal-bits read.The §5.11.7 follow-on
else-arm elements (intra_angle_info_y,uv_mode,read_cfl_alphas,intra_angle_info_uv,palette_mode_info,filter_intra_mode_info) and theuse_intrabc == 1MV-stack / assign-mv body remain bounded leaf targets that can be slotted into a future round before or alongside §5.11.16.decode_av1/encode_av1continue to returnError::NotImplemented.
Tile-group / tile-content decode (the per-tile coefficient,
motion-vector, and reconstruction passes) remains out of scope, as
does the §7.20 reference frame update process that would store a
decoded frame back into [frame_header::RefInfo] across frames.
decode_av1 / encode_av1 continue to return
Error::NotImplemented.
Re-exports§
pub use codec_config::Av1CodecConfig;
Modules§
- annexb
- Annex B length-delimited bitstream format (read + write).
- codec_
config - The AV1 codec-configuration fields a container carries next to an
elementary stream — the
av1Crecord every AVIF / HEIFav01item and every ISOBMFFav01sample entry is required to carry (av1-avif §2.2.1: “the values of the fields in the AV1ItemConfigurationProperty shall match those of the Sequence Header OBU in the AV1 Image Item Data”). - decoder
- Decoder side of the crate.
- encoder
- Encoder side of the crate.
- registry
oxideav-coreframework integration: codec registration plus theoxideav_core::Decoderimplementation that bridges the crate’s spec-faithful frame decoder ([crate::decoder::SpecDecodeSession]) onto the packet-to-frame trait surface.- tile_
list - §5.12 tile-list OBU + §7.3 large-scale-tile decoding.
Enums§
- Error
- Crate-local error type.
Functions§
- decode_
av1 - Decode an AV1 IVF v0 buffer into a vector of decoded
decoder::Frames. - decode_
av1_ at_ operating_ point - r430 —
decode_av1at an externally selected operating point (§6.7.5choose_operating_point()): with a non-zeroOperatingPointIdcthe §5.3.1drop_obu()rule skips every OBU carrying an extension header outside the point’s temporal/spatial layer set, so a temporally scalable stream decodes to exactly the shown frames of the surviving layers. Seedecoder::decode_av1_at_operating_point. - encode_
av1 - Encode planar 4:2:0 8-bit YUV pixels into an intra-only AV1 elementary stream (IVF v0 container).
- register
- Codec registration entry point.