tx

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: LGPL-2.1 Imports: 2 Imported by: 0 modules, 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 tx ports the int32 flavor of FFmpeg's libavutil/tx transform framework, exactly as instantiated for AV_TX_INT32_MDCT by the fixed-point AAC decoder: the split-radix power-of-two FFT codelets and their fixed-point twiddle tables. Init-time table code may use package math directly (docs/go-design.md); the transform path is pure integer.

Every rounding step mirrors the C bit for bit. The macros of libavutil/tx_priv.h @ d09d5afc3a translate as:

CMUL    64-bit products, +0x40000000, arithmetic >>31 (cmul below)
BF      wrapping 32-bit add/sub (the C casts through unsigned;
        Go int32 arithmetic wraps identically)
RESCALE av_clip64(llrintf(x * 2147483648.0), INT32_MIN, INT32_MAX):
        the DOUBLE product is narrowed to FLOAT by llrintf's argument
        conversion, then rounded to integer ties-to-even (rescale below)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IMDCT

type IMDCT struct {
	// contains filtered or unexported fields
}

IMDCT is the int32 half-length inverse MDCT, the port of the mdct_inv_int32_c codelet (ff_tx_mdct_inv + ff_tx_mdct_init, libavutil/tx_template.c:1223-1342 @ d09d5afc3a) over an fftN_ns_int32_c subtransform. n is the coefficient count (the av_tx_init len): the AAC decoder uses n=1024, scale 1.0/1024*128 and n=128, scale 1.0/128*128 (init_dsp, libavcodec/aac/aacdec.c:1263-1296).

func NewIMDCT

func NewIMDCT(n int, scale float32) *IMDCT

NewIMDCT builds the inverse-MDCT context. n must be a power of two with n/2 between 32 and 512 (the AAC decoder needs 128 and 1024). scale is the float the C caller hands av_tx_init (SCALE_TYPE is float for TX_INT32).

func (*IMDCT) Tables

func (t *IMDCT) Tables() (m []int, expRe, expIm []int32)

Tables returns copies of the permutation map (entries pre-doubled, as stored) and the twiddle table split into re/im planes. Differential-test hook: the C harness dumps the live AVTXContext map/exp for comparison.

func (*IMDCT) Transform

func (t *IMDCT) Transform(dst, src []int32)

Transform runs the inverse MDCT: n spectral coefficients in src to n output samples in dst (the half-length output convention; the missing halves are the even/odd symmetric extensions the caller reconstructs during windowing). Mirrors ff_tx_mdct_inv (libavutil/tx_template.c: 1312-1342 @ d09d5afc3a) with stride == sizeof(int32), dst != src.

Jump to

Keyboard shortcuts

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