window

package
v0.7.2 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 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

View Source
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).

View Source
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

func KBD(alpha float64, n int) []float32

KBD returns the rising half of a Kaiser-Bessel derived window of length n. Mirrors libavcodec/kbdwin.c:kbd_window_init @ d09d5afc3a.

func KBDFixed

func KBDFixed(alpha float64, n int) []int32

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

func Sine(n int) []float32

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

func SineFixed(n int) []int32

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.

Jump to

Keyboard shortcuts

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