Documentation
¶
Overview ¶
Command av1txasm turns the AV1 encoder's 1D forward transforms (internal/av1/transform_fwd.go) and the inverse ones (transform_bf.go) into AVX2 kernels that run eight of them at once, one per 32-bit lane:
go run ./tools/av1txasm -dir internal/av1
Each butterfly statement of fdct8 to fdct64, fadst8 and fadst16 (a copy, a sum or difference, or a halfBtf of two cosines) becomes a few vector instructions on eight lanes, the same arithmetic as the Go: the products' low 32 bits, summed, rounded and shifted down. Copies only rename; every value has a 32-byte slot in the kernel's frame, reused after the value's last use. Two files are written:
- fwdtx_amd64.s: for each transform a column kernel (eight adjacent columns of a residual, read a row at a time with a stride, scaled up, transformed, rounded down and written to eight columns of the column pass's output) and a row kernel (eight rows of that output, transposed in, transformed and transposed out, rounded down; for the ADSTs also one reading the rows right to left).
- fwdtx_amd64.go: their declarations and the switches that call them.
- invtx_amd64.s and invtx_amd64.go: the same for the inverse DCTs and 8- and 16-point ADSTs (whose rotations, clamped to the spec's ranges, fit 32 bits at bit depths up to 10), each pass rounded and clamped as inverseTransform's.