21 Commits
Author SHA1 Message Date
waozi a314369bf7 Pin AV1 dependencies to verified Gitea objects 2026-11-20 04:23:22 -03:00
waozi 3c81d58a5c Add packed AV1 transforms and reconstruction kernels
Use packed 8-bit and high-bit-depth inverse transforms, SIMD prediction
and filter paths, and direct coefficient entropy decoding for supported
KEY frames. Document tested capability, memory and benchmark limits.

Local validation covers source and saved C, Go and portable VM paths,
ASan/UBSan, the 32-stage integration run and external inverse kernels.
Separately pinned unit-stage provenance is retained.
2026-11-08 11:47:08 -03:00
waozi 594abbbd4f Dequantize while decoding coefficients, on Ziran 62d6913a
Coefficients are dequantized as their signs are read, into only the box
that holds them, and the inverse transform reads just that box. A DC-only
DCT_DCT block adds one constant. The 2D base context comes from a table,
signs negate without a branch, the deblock taps live for the whole frame,
and recursive intra prediction and the CDEF direction search run on
vectors. 1080p q40 decodes 29% faster, the other clips 9-13%.
2026-11-07 14:26:41 -03:00
waozi f772c821ea Post filters without frame copies, on Ziran 441ecbae
CDEF and loop restoration each write into a VecClone of their input,
which then takes the frame's place with VecSwap. Before, each filter
zero-filled its own frame, copied its input into it and copied its
result back. Restoration keeps the deblocked frame for its CDEF input.
CopyIntraSamples is gone.

Output planes are written a row at a time by StoreSampleRow, whose
indices are proven, so the per-sample stores need no checks. Recursive
intra prediction and the CDEF direction table check their block once on
entry, so their reads need none either. The benchmark hash reads its rows
as slices.

The lock moves to Ziran 441ecbae, which proves indices through else
branches and constant left shifts.
2026-11-07 10:16:44 -03:00
waozi 908dac3aee Faster coefficient decoding and range decoding, on Ziran 4244f076
The range decoder keeps its value at the top of a 64-bit window of the
next complemented input bits and refills it a byte at a time, so
renormalization is a shift. Coefficient skip, end-of-block and DC sign
symbols read their CDF rows directly. RangeBitPosition is where the
specification's bit reader stands, and error offsets use its byte.

Coefficient blocks read signs and Golomb extensions for the nonzero
levels only, and keep the coded positions of those levels in the
CoefficientScratch. DequantizeSparseInto reads just those coefficients
with flat weights; it matches DequantizeBlock on 342 sparse blocks of
every size and depth, with samples past the block untouched.

Intra edge samples are written in place and checked against the bit
depth once.

The lock moves to Ziran 4244f076.
2026-11-07 07:16:18 -03:00
waozi 061afd6607 Self-guided restoration on SIMD vectors
Both self-guided box-filter passes and the projection run four columns
at a time as s32x4 vectors, with one gather per reciprocal lookup. The
variance term is capped where the strength already saturates at 255, so
every product fits 32 bits. The oracle adds 288 wide blocks up to 64x8
with every vector tail, 30 of them at the maximum sample, checked
straight through SgrFilterInto with sentinels around the output.

The benchmark receipt no longer calls the authored decoder scalar.
2026-11-07 05:51:18 -03:00
waozi cfbcc4f89a CDEF block copies on SIMD vectors
Away from the frame edges, CDEF copies each padded row of a block as
u16x8 vectors, and its luma direction block as eight u16x8 rows. Blocks
at an edge keep the per-sample copy. PostCdefPlane no longer returns an
error it cannot produce.
2026-11-07 05:51:06 -03:00
waozi ff3d34368c Faster palette index maps, on Ziran c3f786fe
ReadPaletteMap ranks each index's left, top-left and top neighbours once
and maps the decoded token straight to its color, and it checks the five
color CDFs of a map size once instead of on every token. ReadSymbol still
checks a caller's CDF, through ValidCdf. PaletteIndexContext is no longer
held while decoding, so the working-memory records drop it.

The Ziran lock moves to c3f786fe, which reads constant tables in place
for SIMD gathers and runs std/simd operations inline under TinyCC.
2026-11-07 05:51:06 -03:00
waozi f879f28900 Deblocking on SIMD vectors, and a resumable critical path
Each deblocking edge segment filters its four lines as s32x4 vectors,
validated once per segment; FilterDeblockEdge stays the one-line
reference. The deblock oracle adds 1,024 four-line segments checked
against libaom.

The critical path queues a ticket that build-queue failed to run
(exit 78) again, and 'sh tests/av1_critical_path.sh resume' continues a
stopped run from its passed stages and shards.
2026-11-07 03:32:05 -03:00
waozi d953917196 Inverse transforms on SIMD vectors
Each inverse transform pass runs four rows or columns as std/simd s32x4
vectors in a #target procedure, so native x86-64 C picks SSE2 to AVX2 at
run time. A pass stays exact while every value is within 2^17 (ADST4
inputs within 2^16); a pass that exceeds it, and every 12-bit row pass,
runs on the s64 reference lane, so results are identical. All-zero row
and column groups skip the 1D kernels. The Ziran lock moves to 5b113f2a.
2026-11-07 00:58:04 -03:00
waozi 61632ec977 Run bundles with zi2zx run --vm on Ziran 56bcbef3
Ziran removed the zi2zx-vm binary; every stage now runs bundles on the
portable VM with zi2zx run --vm and the critical path snapshots the five
remaining binaries. The critical path runs directly and takes one
build-queue ticket for its setup, each stage, each conformance shard
(AV1_CONFORMANCE_SHARDS) and its finish, so other projects build between
them.
2026-11-06 20:55:07 -03:00
waozi 39eeebfc6c CDEF filtering on SIMD vectors
The CDEF filter runs each pass of eight samples as one std/simd s16x8
vector in a #target procedure, so native x86-64 C picks SSE2 to AVX2 at
run time with the same bits. The Ziran lock moves to 079a4869 for
std/simd, and the working-memory check skips the per-tier
ziran_simd_ops.h fragment that ziran_simd.h includes itself.
2026-11-06 18:56:37 -03:00
waozi 7ca46b0a38 Faster self-guided restoration on newer range proofs 2026-11-06 16:35:01 -03:00
waozi 4071c12bbc Faster CDEF direction search and filtering
The direction search runs in 32-bit values without revalidating frame samples, and every CDEF tap read is proven in range. ReadBits is one cold out-of-line definition. Transform and dequantization guards are stated as comparisons the prover reads. Tests resolve the toolchain from the package lock, now ziran 35eae053, instead of a sibling checkout. Output is bit-exact against libaom and dav1d on every benchmark stream; the critical path passed on the locked toolchain.
2026-11-06 14:47:14 -03:00
waozi 8ae37a68ca Faster entropy decoding, inverse transforms, dequantization and 4-wide CDEF
Renormalization reads up to 16 bits from one three-byte window and skips zero shifts; CDF adaptation is its own step. Coefficient levels and scan positions live in tile scratch, and contexts split into EOB, base and BR selections. Inverse transforms index one 64-value lane by proven masked positions with one signed cosine table. Dequantization shifts instead of dividing. 4-wide CDEF blocks filter two rows per pass. Toolchain pinned to ziran 872a53e5. Output is bit-exact against libaom and dav1d on every benchmark stream; the critical path passed on the locked toolchain.
2026-11-06 12:59:42 -03:00
waozi 5b13eafb66 Faster CDEF, Wiener and self-guided restoration 2026-11-06 10:45:53 -03:00
waozi 960ca7f844 Shared constant tables, clz renormalization and direct restoration output 2026-11-06 09:16:01 -03:00
waozi d7fa777c5d Faster coefficient decoding, CDEF and self-guided restoration
The bit reader takes whole bytes, booleans have their own decode, and
decoder-owned CDFs skip the per-symbol validation scan. Coefficient
blocks build their scan only up to the end of block, read context
neighbors from zero-padded levels, and decode into tile buffers instead
of returning 4 to 16 KB structs. Zero rows and columns skip the 1D
inverse transforms.

CDEF filters straight into the frame, skips zero-strength taps and the
clamp that a single strength cannot need, and skips blocks with no
strength. Self-guided restoration reads A2 from a reciprocal table.

Stage scripts that hashed the live toolchain now hash the critical
path's binary snapshot, and the working-memory record list follows the
new structs. Output is unchanged; the critical path passed all 26
stages. The benchmark now measures 16 to 360 ms per frame, down from 21
to 428 ms.
2026-11-06 07:36:43 -03:00
waozi 701f778031 Benchmark against libaom and dav1d; faster SGR, CDEF and inverse transforms
tests/av1_benchmark.sh decodes a six-stream corpus with the authored
decoder, libaom and dav1d in one process, single-threaded on a pinned
core, and fails unless all three sample hashes agree.

Self-guided box sums use per-column running sums and skip the odd rows
that pass 0 never reads, CDEF precomputes its 12 taps per block, and the
bit reversal in the inverse transforms is a fixed swap network. All are
bit-exact; the critical path passed all 26 stages.
2026-11-06 05:15:39 -03:00
waozi bd278217e2 Verify against libaom 3.15.3
The test oracle moves to libaom v3.15.3 and rebuilds itself when the pin
changes. Oracles that copy libaom internals follow its new writer buffer
size and film grain random state. Conformance keeps 275 bit-exact and 213
unsupported cases; the two layered svc vectors were renamed upstream. The
grain suite now fingerprints the binaries the critical path runs on.
2026-11-06 03:17:00 -03:00
waozi c872ae37d5 Owned scalar AV1 decoder for shown KEY frames, verified against libaom 3.13.1
Moved from the avif package into its own Ziran package. KEY frames decode
from OBU_FRAME or a frame header plus tile groups, with libaom's handling of
redundant headers, padding and reserved OBUs and operating-point 0 layer
selection. The critical path runs 26 stages, including the pinned libaom
test-vector conformance corpus, on one copy of the Ziran binaries.
2026-11-06 00:41:46 -03:00