code wiki / (root) / nx_av1_tile.nx

nx_av1_tile.nx

buildroot/runtime/nx_av1_tile.nx

7905 B224 linesdepth 5pulls 5 transitivereach 1 importersview sourcekind librarytopic av1
docsdependenciesstructsconstsfunctions

about

nx_av1_tile.nx -- AV1/AV2 tile geometry and tile_info, writer and reader. Layer four, on nx_av1_ec.nx / nx_av1_obu.nx / nx_av1_seq.nx. Tiles are how AV1 and AV2 parallelise: a frame is split into independently decodable rectangles, and every tile group in the bitstream is indexed against this geometry. Get the geometry wrong and the tile data is read at the wrong offsets -- the entropy decoder then produces confident nonsense. THE UNITS CHANGE THREE TIMES. Pixels -> 4x4 mode-info units -> superblocks, and the superblock step is 64 or 128 depending on a sequence-header flag. MiCols is 2 * ((width + 7) >> 3), which is NOT (width + 3) >> 2: the frame is rounded to an 8-pixel boundary FIRST and then counted in 4x4 units, so odd sizes round differently than the obvious formula gives. A 1x1 frame has 2 mode-info columns, not 1. ns() IS NOT f(n). The non-symmetric code spends w-1 bits on small values and w bits on large ones, so that an alphabet whose size is not a power of two costs no wasted bits. Reading it as a plain fixed-width field consumes one bit too few on every large value and desynchronises everything after. genealogy_id: av1_spec_5_9_15_tile_info lineage_id: nx_av1_tile_v1 license_tier: ORIGINAL

dependencies 3 imports · 1 importers

nx_syscalls.nx nx_bitstream.nx nx_av1_seq.nx nx_av1_tile.nx nx_av1_tile_gate.nx

imports: nx_syscalls.nxnx_bitstream.nxnx_av1_seq.nx

imported by: nx_av1_tile_gate.nx

structs

none

consts

29const NX_TILE_MAX_WIDTH: i64 = 4096
30const NX_TILE_MAX_AREA: i64 = 9437184
31const NX_TILE_MAX_COLS: i64 = 64
32const NX_TILE_MAX_ROWS: i64 = 64
34const NX_TILE_FLD_COLSLOG2: i64 = 0
35const NX_TILE_FLD_ROWSLOG2: i64 = 1
36const NX_TILE_FLD_COLS: i64 = 2
37const NX_TILE_FLD_ROWS: i64 = 3
38const NX_TILE_FLD_UNIFORM: i64 = 4
39const NX_TILE_FLD_SBCOLS: i64 = 5
40const NX_TILE_FLD_SBROWS: i64 = 6

functions

42func nx_av1_min2(a: i64, b: i64) -> i64 { if a < b { return a } return b }
43func nx_av1_max2(a: i64, b: i64) -> i64 { if a > b { return a } return b }
50func nx_av1_tile_log2(blk: i64, target: i64) -> i64
65func nx_av1_mi_cols(width: i64) -> i64
70func nx_av1_mi_rows(height: i64) -> i64
75func nx_av1_sb_cols(mi_cols: i64, use128: i64) -> i64
80func nx_av1_sb_rows(mi_rows: i64, use128: i64) -> i64
90func nx_av1_floorlog2b(v: i64) -> i64
98func nx_av1_ns_read(bs: *NxBitStream, n: i64) -> i64
111func nx_av1_ns_write(w: *NxAv1Bw, v: i64, n: i64) -> i64
called by 1: main calls 2: nx_av1_floorlog2bnx_av1_bw_put
133func nx_av1_tile_write_uniform(w: *NxAv1Bw, width: i64, height: i64,
173func nx_av1_tile_parse(bs: *NxBitStream, width: i64, height: i64,