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 ¶
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 ¶
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 ¶
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.