Documentation
¶
Overview ¶
Package window generates the AAC analysis half-windows at init time. Init-time code; may use package math directly (docs/go-design.md).
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( KBDLong1024Fixed = KBDFixed(4.0, 1024) KBDShort128Fixed = KBDFixed(6.0, 128) Sine1024Fixed = sine1024FixedTab[:] Sine128Fixed = sine128FixedTab[:] )
Fixed-point (int32) decoder windows, mirroring init_tables_fixed_fn (libavcodec/aac/aacdec_fixed.c:53-66 @ d09d5afc3a). The KBD windows are computed at init (their C initializer is all-double arithmetic, which ports exactly); the sine windows are baked oracle dumps, because their C initializer rounds sinf() output and the oracle libm's sinf is not correctly rounded (see sinefixed_tables.go).
var ( KBDLong1024 = KBD(4.0, 1024) KBDShort128 = KBD(6.0, 128) Sine1024 = Sine(1024) Sine128 = Sine(128) )
Computed once at init, like ff_aac_float_common_init (libavcodec/aactab.c:97-100 @ d09d5afc3a).
Functions ¶
func KBD ¶
KBD returns the rising half of a Kaiser-Bessel derived window of length n. Mirrors libavcodec/kbdwin.c:kbd_window_init @ d09d5afc3a.
func KBDFixed ¶
KBDFixed computes the integer Kaiser-Bessel derived window as a length-n slice: all n entries are filled and used (they are the rising half of the 2n-point symmetric window, which vector_fmul_window reads in full). Mirrors the int_window branch of kbd_window_init (libavcodec/kbdwin.c:25-52 @ d09d5afc3a): lrint(2147483647 * sqrt(sum*scale)), all intermediates double, lrint rounding ties to even (FE_TONEAREST).
func Sine ¶
Sine returns the rising half of a sine window of length n. Mirrors libavcodec/sinewin_tablegen.h @ d09d5afc3a: w[i] = sin((i + 0.5) * pi / (2n)).
func SineFixed ¶
SineFixed computes the integer sine window as a length-n slice (all n entries filled) the way the FORMULA computes it: sine_window_init_fixed (libavcodec/sinewin_fixed_tablegen.h:56-63 @ d09d5afc3a), SIN_FIX(a) = (int)floor(a*0x80000000 + 0.5) where a is sinf() of a float argument, here approximated by the correctly rounded float32(sin(float64(x))).
This is NOT what the decoder uses: the oracle libm's sinf deviates from correct rounding on a handful of inputs (14/1024, 3/128), so the decoder windows are the baked oracle values above. This function exists so TestSineFixedBakedDelta can pin exactly how far the baked tables sit from the portable formula; if a future pin moves, rerun tools/cimdct and re-bake.
Types ¶
This section is empty.