transform

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 26, 2026 License: BSD-2-Clause Imports: 0 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package transform implements VP9 inverse transforms (spec §8.7.1). Sizes 4/8/16/32; kernels DCT-II and ADST (no 32×32 ADST in VP9). Integer arithmetic: constants scaled by 2^14; drs = (v+(1<<13))>>14. 2-D pass (libvpx convention): rows (no shift) → transpose → cols → transpose with a single ROUND_POWER_OF_TWO of FinalShift(bs) = 4/5/6/6 for bs 4/8/16/32.

Index

Constants

This section is empty.

Variables

View Source
var BD16 = 8

Functions

func DCOnlyValue

func DCOnlyValue(dc int16, shift int) int16

DCOnlyValue returns the uniform output value of a DCT_DCT inverse 2-D transform when only the DC coefficient (after dequantization) is non-zero. shift is FinalShift(bs) for the block (libvpx vpx_idctNxN_1_add: two cascaded cospi_16 round-shifts, then ROUND_POWER_OF_TWO(_, shift)).

func DCOnlyValue16 added in v0.2.0

func DCOnlyValue16(dc int64, shift int) int64

func FinalShift added in v0.2.0

func FinalShift(bs int) int

FinalShift returns the VP9 inverse-transform output round-shift for a block of side bs pixels: 4 for 4×4, 5 for 8×8, 6 for 16×16 and 32×32 (libvpx vpx_idctNxN, ROUND_POWER_OF_TWO at the end of the column pass).

func InvTransform2D

func InvTransform2D(coeffs []int16, bs int, tt TxType)

InvTransform2D applies the inverse 2-D transform in-place. coeffs is bs×bs int16, row-major. bs ∈ {4,8,16,32}; bs=32 forces DCT_DCT.

Convention matches libvpx: the row pass writes 16-bit (wrapping) intermediates with NO shift; the column pass is followed by a single ROUND_POWER_OF_TWO of FinalShift(bs). (An earlier version shifted >>4 after each pass, scaling the residual 16× too small.)

func InvTransform2D16 added in v0.2.0

func InvTransform2D16(coeffs []int64, bs int, tt TxType)

Types

type TxType

type TxType int

TxType selects the 1-D kernel pair (row kernel, col kernel).

const (
	DCT_DCT   TxType = 0
	ADST_DCT  TxType = 1
	DCT_ADST  TxType = 2
	ADST_ADST TxType = 3
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL