libopustooling

package
v0.2.10 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: BSD-3-Clause Imports: 9 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

Index

Constants

View Source
const (
	// DefaultVersion is the pinned libopus reference used by fixture tooling.
	DefaultVersion = "1.6.1"

	// dnn/vec.h selects its vector implementation from compiler macros even
	// when libopus RTCD and intrinsics are disabled. Clear those macros so the
	// scalar DRED reference uses the generic DNN path on every architecture.
	ScalarDNNBuildCFLAGS = LibopusScalarCFLAGS + " -DDISABLE_NEON -U__ARM_NEON__ -U__ARM_NEON -U__AVX__ -U__AVX2__ -U__FMA__ -U__SSE__ -U__SSE2__ -U__SSE3__ -U__SSSE3__ -U__SSE4_1__ -U__SSE4_2__"

	// The SIMD DRED reference uses the native libopus instruction selection and
	// optimization level paired with GOEXPERIMENT=simd.
	DREDSIMDBuildCFLAGS = LibopusBaseCFLAGS

	// OSCEScalarDNNBuildCFLAGS keeps OSCE BWE/LACE reference helpers on the
	// generic DNN path even on ARM, where dnn/vec.h checks compiler NEON macros
	// directly.
	OSCEScalarDNNBuildCFLAGS = "" /* 170-byte string literal not displayed */

)

Variables

This section is empty.

Functions

func CompiledGoAMD64Level added in v0.2.0

func CompiledGoAMD64Level() string

CompiledGoAMD64Level reports the GOAMD64 level used to compile this binary. It is empty on non-amd64 builds.

func DREDModelSourcesStamp added in v0.2.0

func DREDModelSourcesStamp() string

DREDModelSourcesStamp identifies the pinned DRED model source contents in a feature build stamp.

func DREDSIMDBuildEnv added in v0.2.0

func DREDSIMDBuildEnv() ([]string, error)

DREDSIMDBuildEnv pins the native compiler and flags for the DRED SIMD oracle.

func DREDSIMDBuildIsCurrent added in v0.2.0

func DREDSIMDBuildIsCurrent(buildDir string) bool

DREDSIMDBuildIsCurrent checks the isolated native-instruction DRED build.

func DefaultSearchRoots

func DefaultSearchRoots() []string

DefaultSearchRoots covers common invocation locations: repository root, package subdirs (e.g. testvectors), and deeper test runs.

func EnsureLibopus

func EnsureLibopus(version string, roots []string) bool

EnsureLibopus invokes tools/ensure_libopus.sh from the first matching root.

func EnsureLibopusCustom

func EnsureLibopusCustom(version string, roots []string) bool

EnsureLibopusCustom invokes tools/ensure_libopus.sh with ENABLE_CUSTOM enabled (libopus configured with --enable-custom-modes, defining CUSTOM_MODES and the Opus Custom API) from the first matching root.

func EnsureLibopusCustomFixedQEXTSIMD added in v0.2.0

func EnsureLibopusCustomFixedQEXTSIMD(version string, roots []string) bool

EnsureLibopusCustomFixedQEXTSIMD builds the paired CUSTOM_MODES + FIXED_POINT + QEXT SIMD reference.

func EnsureLibopusCustomFixedQEXTScalar added in v0.2.0

func EnsureLibopusCustomFixedQEXTScalar(version string, roots []string) bool

EnsureLibopusCustomFixedQEXTScalar builds the paired CUSTOM_MODES + FIXED_POINT + QEXT scalar reference.

func EnsureLibopusCustomFixedSIMD added in v0.2.0

func EnsureLibopusCustomFixedSIMD(version string, roots []string) bool

EnsureLibopusCustomFixedSIMD builds the paired CUSTOM_MODES + FIXED_POINT SIMD reference.

func EnsureLibopusCustomFixedScalar added in v0.2.0

func EnsureLibopusCustomFixedScalar(version string, roots []string) bool

EnsureLibopusCustomFixedScalar builds the paired CUSTOM_MODES + FIXED_POINT scalar reference.

func EnsureLibopusCustomQEXTSIMD added in v0.2.0

func EnsureLibopusCustomQEXTSIMD(version string, roots []string) bool

EnsureLibopusCustomQEXTSIMD builds the paired CUSTOM_MODES + QEXT SIMD reference.

func EnsureLibopusCustomQEXTScalar added in v0.2.0

func EnsureLibopusCustomQEXTScalar(version string, roots []string) bool

EnsureLibopusCustomQEXTScalar builds the paired CUSTOM_MODES + QEXT scalar reference.

func EnsureLibopusCustomScalar

func EnsureLibopusCustomScalar(version string, roots []string) bool

EnsureLibopusCustomScalar invokes tools/ensure_libopus.sh with ENABLE_CUSTOM_SCALAR enabled (--enable-custom-modes on the scalar generic-C kernels) from the first matching root with the standard scalar compiler policy.

func EnsureLibopusDREDQEXTSIMD added in v0.2.0

func EnsureLibopusDREDQEXTSIMD(version string, roots []string) bool

EnsureLibopusDREDQEXTSIMD builds the combined DRED + QEXT RTCD/intrinsics reference.

func EnsureLibopusDREDQEXTScalar added in v0.2.0

func EnsureLibopusDREDQEXTScalar(version string, roots []string) bool

EnsureLibopusDREDQEXTScalar builds the combined DRED + QEXT generic-C reference.

func EnsureLibopusFixedQEXTSIMD added in v0.2.0

func EnsureLibopusFixedQEXTSIMD(version string, roots []string) bool

EnsureLibopusFixedQEXTSIMD builds the FIXED_POINT + ENABLE_QEXT RTCD/intrinsics reference.

func EnsureLibopusFixedQEXTScalar added in v0.2.0

func EnsureLibopusFixedQEXTScalar(version string, roots []string) bool

EnsureLibopusFixedQEXTScalar builds the FIXED_POINT + ENABLE_QEXT generic-C reference.

func EnsureLibopusFixedSIMD added in v0.2.0

func EnsureLibopusFixedSIMD(version string, roots []string) bool

EnsureLibopusFixedSIMD builds the FIXED_POINT RTCD/intrinsics reference.

func EnsureLibopusFixedScalar added in v0.2.0

func EnsureLibopusFixedScalar(version string, roots []string) bool

EnsureLibopusFixedScalar builds the FIXED_POINT generic-C reference.

func EnsureLibopusQEXT

func EnsureLibopusQEXT(version string, roots []string) bool

EnsureLibopusQEXT invokes tools/ensure_libopus.sh with ENABLE_QEXT enabled from the first matching root.

func EnsureLibopusQEXTSIMD added in v0.2.0

func EnsureLibopusQEXTSIMD(version string, roots []string) bool

EnsureLibopusQEXTSIMD builds the QEXT-enabled RTCD/intrinsics reference.

func EnsureLibopusQEXTScalar added in v0.2.0

func EnsureLibopusQEXTScalar(version string, roots []string) bool

EnsureLibopusQEXTScalar builds the QEXT-enabled generic-C reference.

func EnsureLibopusSIMD

func EnsureLibopusSIMD(version string, roots []string) bool

EnsureLibopusSIMD invokes tools/ensure_libopus.sh with ENABLE_SIMD enabled (libopus configured with its native --enable-rtcd --enable-intrinsics, so config.h DEFINES the platform SIMD macros) from the first matching root. It is paired with Go SIMD builds and direct tests of matching SIMD kernels.

func EnsureLibopusScalar

func EnsureLibopusScalar(version string, roots []string) bool

EnsureLibopusScalar invokes tools/ensure_libopus.sh with ENABLE_SCALAR enabled (generic C with assembly, RTCD, intrinsics, loop vectorization, and SLP vectorization disabled) from the first matching root. FMA contraction stays enabled to match scalar Go arithmetic.

func FindCCompiler

func FindCCompiler() (string, error)

FindCCompiler returns a GCC/Clang-style C compiler suitable for helper builds.

func FindOpusCompare

func FindOpusCompare(version string, roots []string) (string, error)

FindOpusCompare returns a validated opus_compare from the reference tree paired with the current Go build.

func FindOpusDemo

func FindOpusDemo(version string, roots []string) (string, error)

FindOpusDemo returns a validated opus_demo from the reference tree paired with the current Go build.

func FindOrEnsureDefaultOpusDemo added in v0.2.0

func FindOrEnsureDefaultOpusDemo(version string, roots []string) (string, error)

FindOrEnsureDefaultOpusDemo selects the unsuffixed autotools-default tree independently of the current Go instruction lane. It is appropriate only for fixtures whose recorded producer path is tmp_check/opus-<version>/opus_demo.

func FindOrEnsureOpusCompare

func FindOrEnsureOpusCompare(version string, roots []string) (string, error)

FindOrEnsureOpusCompare builds and validates the explicit tree paired with the current Go build before locating opus_compare.

func FindOrEnsureOpusDemo

func FindOrEnsureOpusDemo(version string, roots []string) (string, error)

FindOrEnsureOpusDemo builds and validates the explicit tree paired with the current Go build before locating opus_demo.

func FindOrEnsureOpusDemoForVariant added in v0.2.0

func FindOrEnsureOpusDemoForVariant(version string, roots []string, variant LibopusReferenceVariant) (string, error)

FindOrEnsureOpusDemoForVariant selects an explicit libopus reference tree without consulting the Go scalar/SIMD lane. Fixture honesty uses this when the fixture records a scalar or SIMD producer.

func FindOrEnsureQEXTOpusDemo

func FindOrEnsureQEXTOpusDemo(version string, roots []string) (string, error)

FindOrEnsureQEXTOpusDemo resolves the QEXT-enabled tool paired with the current Go instruction lane and validates its build before returning it.

func FindQEXTOpusDemo

func FindQEXTOpusDemo(version string, roots []string) (string, bool)

FindQEXTOpusDemo returns the first executable QEXT-enabled opus_demo build found under tmp_check.

func LibopusAMD64TargetCFlags added in v0.2.0

func LibopusAMD64TargetCFlags() ([]string, error)

LibopusAMD64TargetCFlags returns the exact target flags for directly compiled C helpers, or nil when the amd64 target override is unset.

func LibopusReferenceSourceSuffix added in v0.2.0

func LibopusReferenceSourceSuffix(variant LibopusReferenceVariant) (string, error)

LibopusReferenceSourceSuffix returns the mandatory source-tree suffix for a paired reference. The unsuffixed autotools-default tree is never selected; an AMD64 target opt-in adds its target identity to the default float tree.

func OSCEScalarDNNBuildEnv

func OSCEScalarDNNBuildEnv() ([]string, error)

OSCEScalarDNNBuildEnv returns a controlled environment for OSCE reference helper builds.

func OSCEScalarDNNBuildIsCurrent

func OSCEScalarDNNBuildIsCurrent(buildDir string) bool

OSCEScalarDNNBuildIsCurrent reports whether buildDir was produced with the current OSCE-enabled scalar-DNN helper contract.

func ResetDREDSIMDBuildIfStale added in v0.2.0

func ResetDREDSIMDBuildIfStale(buildDir string) error

ResetDREDSIMDBuildIfStale removes only the stale DRED SIMD build directory.

func ResetOSCEScalarDNNBuildIfStale

func ResetOSCEScalarDNNBuildIfStale(buildDir string) error

ResetOSCEScalarDNNBuildIfStale removes buildDir when it was produced before the current OSCE-enabled scalar-DNN helper contract.

func ResetScalarDNNBuildIfStale

func ResetScalarDNNBuildIfStale(buildDir string) error

ResetScalarDNNBuildIfStale removes buildDir when it was produced before the current scalar-DNN helper contract. This avoids silently reusing x86-vector DNN reference oracles from older local or CI caches.

func ResolveLibopusAMD64Target added in v0.2.0

func ResolveLibopusAMD64Target() (string, error)

ResolveLibopusAMD64Target validates the optional GOAMD64-matched reference target. It returns an empty target when the opt-in is unset.

func ScalarDNNBuildEnv

func ScalarDNNBuildEnv() ([]string, error)

ScalarDNNBuildEnv returns a controlled environment for libopus helper builds.

func ScalarDNNBuildIsCurrent

func ScalarDNNBuildIsCurrent(buildDir string) bool

ScalarDNNBuildIsCurrent reports whether buildDir was produced with the current scalar-DNN helper contract.

func ValidateDREDModelSources added in v0.2.0

func ValidateDREDModelSources(sourceDir string) error

ValidateDREDModelSources verifies the pinned DRED model source identity in a reference source tree before a feature archive is reused or built.

func ValidateLibopusInstructionConfig added in v0.2.0

func ValidateLibopusInstructionConfig(config string, variant LibopusReferenceVariant, goarch string) error

ValidateLibopusInstructionConfig checks the complete SIMD/RTCD macro family in a generated config.h against the selected Go instruction lane.

func ValidateLibopusReferenceArchive added in v0.2.0

func ValidateLibopusReferenceArchive(archivePath string, variant LibopusReferenceVariant, version string) error

ValidateLibopusReferenceArchive validates the provenance stamped beside an archive path. Paired archives live under <source>/.libs/libopus.a.

func ValidateLibopusReferenceBuild added in v0.2.0

func ValidateLibopusReferenceBuild(refDir string, variant LibopusReferenceVariant, version string) error

ValidateLibopusReferenceBuild verifies the stamp, host/compiler target, generated config, and static archive for a paired reference tree.

func ValidateLibopusReferenceToolOverride added in v0.2.0

func ValidateLibopusReferenceToolOverride(path, tool string, variant LibopusReferenceVariant, version string) error

ValidateLibopusReferenceToolOverride requires an explicit tool executable to resolve to the requested tool in a validated, explicitly named paired tree. It validates the executable target so a symlink cannot escape into another variant while callers can continue returning the user's original path.

func WriteDREDSIMDBuildStamp added in v0.2.0

func WriteDREDSIMDBuildStamp(buildDir string) error

WriteDREDSIMDBuildStamp records the native DRED helper build contract.

func WriteOSCEScalarDNNBuildStamp

func WriteOSCEScalarDNNBuildStamp(buildDir string) error

WriteOSCEScalarDNNBuildStamp records that buildDir satisfies the current OSCE-enabled scalar-DNN helper contract.

func WriteScalarDNNBuildStamp

func WriteScalarDNNBuildStamp(buildDir string) error

WriteScalarDNNBuildStamp records that buildDir satisfies the current scalar-DNN helper contract.

Types

type LibopusBuildProvenance

type LibopusBuildProvenance struct {
	GOOS                    string `json:"goos"`
	GOARCH                  string `json:"goarch"`
	LibopusVersion          string `json:"libopus_version"`
	QEXT                    string `json:"qext"`
	HostOS                  string `json:"host_os"`
	HostArch                string `json:"host_arch"`
	HostBits                string `json:"host_bits"`
	CC                      string `json:"cc"`
	CCPath                  string `json:"cc_path"`
	CCTarget                string `json:"cc_target"`
	CCVersion               string `json:"cc_version"`
	Configure               string `json:"configure"`
	CFLAGS                  string `json:"cflags"`
	CPPFLAGS                string `json:"cppflags"`
	LDFLAGS                 string `json:"ldflags"`
	LibopusBuildStampSHA256 string `json:"libopus_build_stamp_sha256"`
}

LibopusBuildProvenance captures the native helper build that produced a generated libopus fixture.

func LibopusBuildProvenanceForTool

func LibopusBuildProvenanceForTool(toolPath string) (LibopusBuildProvenance, bool)

LibopusBuildProvenanceForTool returns provenance for a tool produced by tools/ensure_libopus.sh. The returned digest is over the exact stamp file bytes so fixture metadata changes whenever the validated native helper build changes.

type LibopusReferenceConfigError added in v0.2.0

type LibopusReferenceConfigError struct {
	Err error
}

LibopusReferenceConfigError reports a paired-reference override or build whose declared configuration does not match the requested Go lane.

func (*LibopusReferenceConfigError) Error added in v0.2.0

func (*LibopusReferenceConfigError) Unwrap added in v0.2.0

func (e *LibopusReferenceConfigError) Unwrap() error

type LibopusReferenceVariant added in v0.2.0

type LibopusReferenceVariant string

LibopusReferenceVariant identifies the native libopus instruction path that matches the current Go build.

const (
	// LibopusAMD64TargetEnv selects a separately built amd64 float-core
	// reference at the requested GOAMD64 level. Empty keeps the established
	// reference tree selection.
	LibopusAMD64TargetEnv = "GOPUS_LIBOPUS_AMD64_TARGET"

	LibopusReferenceScalar                LibopusReferenceVariant = "scalar"
	LibopusReferenceSIMD                  LibopusReferenceVariant = "simd"
	LibopusReferenceFixedScalar           LibopusReferenceVariant = "fixed-scalar"
	LibopusReferenceFixedSIMD             LibopusReferenceVariant = "fixed-simd"
	LibopusReferenceFixedQEXTScalar       LibopusReferenceVariant = "fixed-qext-scalar"
	LibopusReferenceFixedQEXTSIMD         LibopusReferenceVariant = "fixed-qext-simd"
	LibopusReferenceQEXTScalar            LibopusReferenceVariant = "qext-scalar"
	LibopusReferenceQEXTSIMD              LibopusReferenceVariant = "qext-simd"
	LibopusReferenceDREDQEXTScalar        LibopusReferenceVariant = "dred-qext-scalar"
	LibopusReferenceDREDQEXTSIMD          LibopusReferenceVariant = "dred-qext-simd"
	LibopusReferenceCustomScalar          LibopusReferenceVariant = "custom-scalar"
	LibopusReferenceCustomSIMD            LibopusReferenceVariant = "custom-simd"
	LibopusReferenceCustomQEXTScalar      LibopusReferenceVariant = "custom-qext-scalar"
	LibopusReferenceCustomQEXTSIMD        LibopusReferenceVariant = "custom-qext-simd"
	LibopusReferenceCustomFixedScalar     LibopusReferenceVariant = "custom-fixed-scalar"
	LibopusReferenceCustomFixedSIMD       LibopusReferenceVariant = "custom-fixed-simd"
	LibopusReferenceCustomFixedQEXTScalar LibopusReferenceVariant = "custom-fixed-qext-scalar"
	LibopusReferenceCustomFixedQEXTSIMD   LibopusReferenceVariant = "custom-fixed-qext-simd"

	LibopusBaseCFLAGS = "-O3 -DNDEBUG"
	// Scalar C references retain the compiler's normal FMA contraction while
	// disabling loop and SLP vectorization to match the scalar Go arithmetic.
	LibopusScalarCVectorizationFlags = "-fno-tree-vectorize -fno-tree-slp-vectorize"
	LibopusScalarCFLAGS              = LibopusBaseCFLAGS + " " + LibopusScalarCVectorizationFlags
)

func ResolveLibopusCustomFixedQEXTReferenceVariant added in v0.2.0

func ResolveLibopusCustomFixedQEXTReferenceVariant() (LibopusReferenceVariant, error)

ResolveLibopusCustomFixedQEXTReferenceVariant selects CUSTOM_MODES, FIXED_POINT, and ENABLE_QEXT with the current Go instruction lane.

func ResolveLibopusCustomFixedReferenceVariant added in v0.2.0

func ResolveLibopusCustomFixedReferenceVariant() (LibopusReferenceVariant, error)

ResolveLibopusCustomFixedReferenceVariant selects CUSTOM_MODES and FIXED_POINT with the instruction lane paired to the current Go build.

func ResolveLibopusCustomQEXTReferenceVariant added in v0.2.0

func ResolveLibopusCustomQEXTReferenceVariant() (LibopusReferenceVariant, error)

ResolveLibopusCustomQEXTReferenceVariant selects CUSTOM_MODES and ENABLE_QEXT with the instruction lane paired to the current Go build.

func ResolveLibopusDREDQEXTReferenceVariant added in v0.2.0

func ResolveLibopusDREDQEXTReferenceVariant() (LibopusReferenceVariant, error)

ResolveLibopusDREDQEXTReferenceVariant selects ENABLE_DRED, ENABLE_DEEP_PLC, and ENABLE_QEXT with the instruction lane paired to the current Go build.

func ResolveLibopusFixedQEXTReferenceVariant added in v0.2.0

func ResolveLibopusFixedQEXTReferenceVariant() (LibopusReferenceVariant, error)

ResolveLibopusFixedQEXTReferenceVariant selects FIXED_POINT and ENABLE_QEXT with the current Go build's scalar or SIMD instruction lane.

func ResolveLibopusFixedReferenceVariant added in v0.2.0

func ResolveLibopusFixedReferenceVariant() (LibopusReferenceVariant, error)

ResolveLibopusFixedReferenceVariant selects FIXED_POINT with the current Go build's scalar or SIMD instruction lane.

func ResolveLibopusQEXTReferenceVariant added in v0.2.0

func ResolveLibopusQEXTReferenceVariant() (LibopusReferenceVariant, error)

ResolveLibopusQEXTReferenceVariant selects the same instruction lane with ENABLE_QEXT compiled into the pinned reference.

func ResolveLibopusReferenceVariant added in v0.2.0

func ResolveLibopusReferenceVariant() (LibopusReferenceVariant, error)

ResolveLibopusReferenceVariant maps the current Go build and optional GOPUS_LIBOPUS_REF_SCALAR override to the matching explicit libopus tree. Empty or "auto" follows the build tags; scalar/1 and simd/0 can only confirm the matching lane and fail when they conflict with the Go build.

Jump to

Keyboard shortcuts

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