Documentation
¶
Index ¶
- Constants
- func BuildCHelper(cfg CHelperConfig) (string, error)
- func BuildDREDHelper(repoRoot, sourceFile, outputBase string, includeInternal bool) (string, error)
- func BuildOSCEHelper(repoRoot, sourceFile, outputBase string, includeInternal bool) (string, error)
- func CTLSequenceHelperPath() (string, error)
- func CustomRefPath(elem ...string) string
- func CustomScalarRefPath(elem ...string) string
- func DecodeDiffHelperPath() (string, error)
- func EncodeDiffHelperPath() (string, error)
- func EnsureDREDBuild(repoRoot string) (sourceDir, buildDir string, err error)
- func EnsureOSCEBuild(repoRoot string) (sourceDir, buildDir string, err error)
- func FixedRefPath(elem ...string) string
- func HelperUnavailable(t testing.TB, label string, err error)
- func OracleEnabled() bool
- func ProbeCELTAlgQuant(x []int32, k, spread, b int, gain int32, bufBytes int) (collapseMask uint32, bytes []byte, resynth []int32, err error)
- func ProbeCELTAlgUnquant(n, k, spread, b int, gain int32, bytes []byte) (collapseMask uint32, x []int32, err error)
- func ProbeCELTAntiCollapse(in CELTAntiCollapseInput) ([]int32, error)
- func ProbeCELTFixedAmp2Log2(bandE []int32, nbEBands, effEnd, end, C int) ([]int32, error)
- func ProbeCELTFixedComputeBandEnergies(eBands, logN []int16, x []int32, nbEBands, shortMdctSize, end, C, LM int) ([]int32, error)
- func ProbeCELTFixedDecode(packet []byte, channels, frameSize, start, end int) ([]int16, error)
- func ProbeCELTFixedDecodeSeq(packets [][]byte, channels, frameSize, start, end, samplingRate int) ([][]int16, error)
- func ProbeCELTFixedDenormaliseBands(eBands []int16, bandLogE, x []int32, ...) ([]int32, error)
- func ProbeCELTFixedEncode(pcm []int16, ...) ([]byte, error)
- func ProbeCELTFixedEncodeExt(pcm []int16, ...) ([]byte, error)
- func ProbeCELTFixedEncodeRate(pcm []int16, ...) ([]byte, error)
- func ProbeCELTFixedEncodeSeq(pcm []int16, channels, frameSize, start, end, bitrate, complexity int, ...) ([][]byte, error)
- func ProbeCELTFixedEnergyUnquant(p CELTEnergyUnquantParams) ([]int32, error)
- func ProbeCELTFixedMathPairs(mode uint32, a, b []int32) ([]uint32, error)
- func ProbeCELTFixedMathWords(mode uint32, words []uint32) ([]uint32, error)
- func ProbeCELTFixedNormaliseBands(eBands []int16, bandE, freq []int32, nbEBands, shortMdctSize, end, C, M int) ([]int32, error)
- func ProbeCELTFixedPLC(packet []byte, channels, frameSize, start, end, numLost int) ([]int16, error)
- func ProbeCELTFixedPLCRecovery(prime, good []byte, channels, frameSize, start, end, numLost int) ([]int16, error)
- func ProbeCELTMDCT(mode uint32, p CELTMDCTParams, in []int32) ([]int32, error)
- func ProbeCELTMath(mode uint32, samples []float32) ([]float32, error)
- func ProbeCELTMathWords(mode uint32, count int, words []uint32) ([]uint32, error)
- func ProbeCELTPVQSearch(x []int32, k int) (yy int32, iy []int32, err error)
- func ProbeCELTPVQSearchFloat(x []float32, k int) (yy float32, iy []int32, err error)
- func ProbeCELTPatchTransientDecision(newE, oldE []int32, nbEBands, start, end, c int) (bool, error)
- func ProbeCELTRenormaliseVector(x []int32, gain int32) ([]int32, error)
- func ProbeCELTStereoIthetaQ30(cases []CELTStereoIthetaCase) ([]uint32, error)
- func ProbeCELTTFAnalysis(eBands []int16, length int, isTransient bool, lambda int, x []int32, ...) (tfSelect int, tfRes []int, err error)
- func ProbeCELTTFEncode(start, end int, isTransient bool, tfRes []int, ...) (buf []byte, outTFRes []int, err error)
- func ProbeDNNKernelCGEMV8x4(rows, cols int, weights []byte, scale, x []float32) ([]float32, error)
- func ProbeDNNKernelSGEMV(rows, cols, colStride int, weights, x []float32) ([]float32, error)
- func ProbeDNNKernelScalarCGEMV8x4(rows, cols int, weights []byte, scale, x []float32) ([]float32, error)
- func ProbeFloatQuant(mode uint32, samples []float32) ([]int16, error)
- func ProbeFloatQuantScaledInt32(scale float32, samples []float32) ([]int32, error)
- func ProbeOpusEncodeFixed(p OpusEncodeFixedParams) ([][]byte, error)
- func ProbeSILKShort2Float(samples []int16) ([]float32, error)
- func ProbeSoftClip(n, channels int, samples, mem []float32) ([]float32, []float32, error)
- func QEXTRefPath(elem ...string) string
- func ReadRefFileOrSkip(t testing.TB, label string, elem ...string) []byte
- func ReadRefPathOrSkip(t testing.TB, path, label string) []byte
- func RefPath(elem ...string) string
- func RequireOracle(t testing.TB)
- func RunHelper(binPath string, input []byte) ([]byte, error)
- func RunHelperArgs(binPath string, input []byte, args ...string) ([]byte, error)
- func RunHelperArgsEnv(binPath string, input []byte, env []string, args ...string) ([]byte, error)
- func RunHelperEnv(binPath string, input []byte, env []string) ([]byte, error)
- func SIMDRefPath(elem ...string) string
- func ScalarRefPath(elem ...string) string
- func ScalarRefRequested() bool
- func StrictRefRequired() bool
- type CELTAllocTrimResult
- type CELTAntiCollapseInput
- type CELTBitexactThetaPair
- type CELTDeemphasisResult
- type CELTEnergyEncodeParams
- type CELTEnergyEncodeResult
- type CELTEnergyUnquantParams
- type CELTFrontendResult
- type CELTMDCTKFFT
- type CELTMDCTParams
- type CELTMDCTTables
- type CELTPrefilterParams
- type CELTPrefilterResult
- type CELTQuantAllBandsEncodeParams
- type CELTQuantAllBandsEncodeResult
- type CELTQuantAllBandsParams
- type CELTQuantAllBandsResult
- type CELTStereoIthetaCase
- type CELTSynthesisParams
- type CELTSynthesisResult
- type CELTTransientResult
- type CHelperConfig
- type CTLOp
- type CTLResult
- type CTLSequenceParams
- type DecodeDiffCase
- type DecodeDiffResult
- type EncodeDiffParams
- type EncodeDiffRecord
- type HelperCache
- type KissFFTComplex
- type KissFFTFullResult
- type KissFFTRadixResult
- type KissFFTTwiddle
- type OpusEncodeFixedParams
- type OraclePayload
- func (p *OraclePayload) Bytes() []byte
- func (p *OraclePayload) Float32(v float32)
- func (p *OraclePayload) Float32s(values ...float32)
- func (p *OraclePayload) I16(v int16)
- func (p *OraclePayload) I32(v int32)
- func (p *OraclePayload) I32s(values ...int32)
- func (p *OraclePayload) Magic(magic string)
- func (p *OraclePayload) Raw(data []byte)
- func (p *OraclePayload) U16(v uint16)
- func (p *OraclePayload) U32(v uint32)
- func (p *OraclePayload) U32s(values ...uint32)
- type OracleReader
- func NewOracleReader(label, outputMagic string, data []byte) (*OracleReader, error)
- func NewOracleReaderMagicVersion(label, outputMagic string, data []byte) (*OracleReader, uint32, error)
- func NewOracleReaderVersion(label, outputMagic string, data []byte) (*OracleReader, uint32, error)
- func RunOracle(binPath string, input []byte, label, outputMagic string) (*OracleReader, error)
- func RunOracleEnv(binPath string, input []byte, label, outputMagic string, env []string) (*OracleReader, error)
- func RunOracleVersion(binPath string, input []byte, label, outputMagic string, wantVersion uint32) (*OracleReader, error)
- func RunOracleVersionEnv(binPath string, input []byte, label, outputMagic string, wantVersion uint32, ...) (*OracleReader, error)
- func (r *OracleReader) Bytes(n int) []byte
- func (r *OracleReader) Count(want int) int
- func (r *OracleReader) Err() error
- func (r *OracleReader) ExpectConsumed() error
- func (r *OracleReader) ExpectRemaining(n int)
- func (r *OracleReader) Float32() float32
- func (r *OracleReader) Float64() float64
- func (r *OracleReader) I16() int16
- func (r *OracleReader) I32() int32
- func (r *OracleReader) Remaining() int
- func (r *OracleReader) U16() uint16
- func (r *OracleReader) U32() uint32
- func (r *OracleReader) U64() uint64
- type QEXTDecode96kParams
- type QEXTDecode96kResult
- type QEXTEncode96kParams
- type QEXTEncode96kResult
Constants ¶
const ( // CELTAlgQuantModeQuant drives FIXED_POINT alg_quant with a real ec_enc. CELTAlgQuantModeQuant = uint32(0) // CELTAlgQuantModeUnquant drives FIXED_POINT alg_unquant with a real ec_dec. CELTAlgQuantModeUnquant = uint32(1) )
const ( // CELTAllocAnalysisModeTFAnalysis selects the FIXED_POINT tf_analysis kernel. CELTAllocAnalysisModeTFAnalysis = uint32(0) // CELTAllocAnalysisModeTFEncode selects the FIXED_POINT tf_encode kernel. CELTAllocAnalysisModeTFEncode = uint32(1) // CELTAllocAnalysisModeAllocTrim selects the FIXED_POINT alloc_trim_analysis kernel. CELTAllocAnalysisModeAllocTrim = uint32(2) )
const ( // CELTAntiCollapseModeRenormalise selects the FIXED_POINT // renormalise_vector kernel. CELTAntiCollapseModeRenormalise = uint32(0) // CELTAntiCollapseModeAntiCollapse selects the FIXED_POINT anti_collapse // kernel. CELTAntiCollapseModeAntiCollapse = uint32(1) )
const ( // CELTDecodeModeEnergy selects the FIXED_POINT energy unquantizers // (unquant_coarse_energy + unquant_fine_energy + unquant_energy_finalise). CELTDecodeModeEnergy = uint32(0) // CELTDecodeModeDecode selects the full FIXED_POINT celt_decode_with_ec. CELTDecodeModeDecode = uint32(1) // CELTDecodeModeDecodeSeq decodes a sequence of packets through one // FIXED_POINT decoder (cross-frame state + downsample output path). CELTDecodeModeDecodeSeq = uint32(2) )
const ( // CELTEncodeModeEncode selects the full FIXED_POINT celt_encode_with_ec, // dumping the produced packet bytes. CELTEncodeModeEncode = uint32(0) // CELTEncodeModeFrontend selects the inline FIXED_POINT encode front-end // (celt_preemphasis + compute_mdcts + compute_band_energies + // normalise_bands), dumping freq, bandE and the normalised X. CELTEncodeModeFrontend = uint32(1) // CELTEncodeModeEncodeSeq encodes N consecutive frames on a single encoder // (VBR/CVBR/CBR), dumping every produced packet so cross-frame state can be // validated. CELTEncodeModeEncodeSeq = uint32(2) // CELTEncodeModeEncodeExt runs one celt_encode_with_ec frame with the LFE // and/or energy_mask controls applied, dumping the produced packet bytes. CELTEncodeModeEncodeExt = uint32(3) )
const ( // CELTFixedMathModeSqrt selects the FIXED_POINT celt_sqrt kernel. CELTFixedMathModeSqrt = uint32(0) // CELTFixedMathModeSqrt32 selects the FIXED_POINT celt_sqrt32 kernel. CELTFixedMathModeSqrt32 = uint32(1) // CELTFixedMathModeRsqrtNorm32 selects the FIXED_POINT celt_rsqrt_norm32 kernel. CELTFixedMathModeRsqrtNorm32 = uint32(2) // CELTFixedMathModeComputeBandEnergies selects the FIXED_POINT // compute_band_energies kernel (array-shaped oracle). CELTFixedMathModeComputeBandEnergies = uint32(3) // CELTFixedMathModeNormaliseBands selects the FIXED_POINT normalise_bands // kernel (array-shaped oracle). CELTFixedMathModeNormaliseBands = uint32(4) // CELTFixedMathModeRcp selects the FIXED_POINT celt_rcp kernel. CELTFixedMathModeRcp = uint32(5) // CELTFixedMathModeRcpNorm16 selects the FIXED_POINT celt_rcp_norm16 kernel. CELTFixedMathModeRcpNorm16 = uint32(6) // CELTFixedMathModeRcpNorm32 selects the FIXED_POINT celt_rcp_norm32 kernel. CELTFixedMathModeRcpNorm32 = uint32(7) // CELTFixedMathModeCosNorm selects the FIXED_POINT celt_cos_norm kernel. CELTFixedMathModeCosNorm = uint32(8) // CELTFixedMathModeCosNorm32 selects the FIXED_POINT celt_cos_norm32 kernel. CELTFixedMathModeCosNorm32 = uint32(9) // CELTFixedMathModeFracDiv32Q29 selects the FIXED_POINT frac_div32_q29 // kernel (two int32 inputs per record). CELTFixedMathModeFracDiv32Q29 = uint32(10) // CELTFixedMathModeFracDiv32 selects the FIXED_POINT frac_div32 kernel // (two int32 inputs per record). CELTFixedMathModeFracDiv32 = uint32(11) )
const ( CELTMathModeLog2 = uint32(0) CELTMathModeExp2 = uint32(1) CELTMathModeFracMul16 = uint32(2) CELTMathModeBitexactCos = uint32(3) CELTMathModeBitexactLog2Tan = uint32(4) CELTMathModeISqrt32 = uint32(5) CELTMathModeUdiv = uint32(6) CELTMathModeSudiv = uint32(7) CELTMathModeLog2TanTheta = uint32(8) CELTMathModeAtanNorm = uint32(9) CELTMathModeAtan2pNorm = uint32(10) CELTMathModeCosNorm2 = uint32(11) CELTMathModeStereoIthetaQ30 = uint32(12) CELTMathModeLog = uint32(13) CELTMathModeSin = uint32(14) CELTMathModeBitexactThetaPair = uint32(15) CELTMathModeDynallocImportance = uint32(16) )
const ( // CELTMDCTModeForward selects the FIXED_POINT clt_mdct_forward_c transform. CELTMDCTModeForward = uint32(0) // CELTMDCTModeBackward selects the FIXED_POINT clt_mdct_backward_c transform. CELTMDCTModeBackward = uint32(1) )
const ( // CELTTransientModeAnalysis selects the FIXED_POINT transient_analysis // kernel. CELTTransientModeAnalysis = uint32(0) // CELTTransientModePatch selects the FIXED_POINT patch_transient_decision // kernel. CELTTransientModePatch = uint32(1) )
const ( CTLOpSet = 0 CTLOpGet = 1 CTLOpProcess = 2 CTLOpReset = 3 )
CTL sequence opcodes. Values are in the libopus argument domain.
const ( // DecodeDiffFormatFloat32 selects opus_decode_float (PCM is float32 LE). DecodeDiffFormatFloat32 = uint32(0) // DecodeDiffFormatInt16 selects opus_decode (PCM is int16 LE). DecodeDiffFormatInt16 = uint32(1) // DecodeDiffFormatInt24 selects opus_decode24 (PCM is int32 LE, 24-bit). DecodeDiffFormatInt24 = uint32(2) )
const ( DNNKernelSGEMV = uint32(0) DNNKernelCGEMV8x4 = uint32(1) )
const ( EncodeDiffForceModeAuto = 0 EncodeDiffForceModeSILKOnly = 1000 EncodeDiffForceModeHybrid = 1001 EncodeDiffForceModeCELTOnly = 1002 )
EncodeDiff force-mode codes (opus_private.h MODE_* consumed by OPUS_SET_FORCE_MODE). Zero leaves the mode auto.
const ( EncodeDiffBandwidthAuto = 0 EncodeDiffBandwidthNarrowband = 1101 EncodeDiffBandwidthMediumband = 1102 EncodeDiffBandwidthWideband = 1103 EncodeDiffBandwidthSuperwideband = 1104 EncodeDiffBandwidthFullband = 1105 )
EncodeDiff bandwidth codes (OPUS_BANDWIDTH_*). Zero leaves the bandwidth unset (encoder auto-selects).
const ( EncodeDiffSignalAuto = uint32(0xFFFFFC18) // OPUS_AUTO = -1000 EncodeDiffSignalVoice = uint32(3001) EncodeDiffSignalMusic = uint32(3002) )
EncodeDiff signal codes (OPUS_SIGNAL_*). OPUS_AUTO (-1000) is the two's complement uint32.
const ( EncodeDiffApplicationVoIP = 2048 EncodeDiffApplicationAudio = 2049 EncodeDiffApplicationRestrictedLD = 2051 )
EncodeDiff application codes (OPUS_APPLICATION_*).
const ( FloatQuantModeFloat2Int16 = uint32(0) FloatQuantModeOSCEOutputScale = uint32(1) FloatQuantModeFARGANSynthInt = uint32(2) FloatQuantModeCELTRaw32767Round = uint32(3) FloatQuantModeCELTDispatch = uint32(4) FloatQuantModeSILKFloat2Short = uint32(5) FloatQuantModeSILKFloat2IntScale = uint32(6) FloatQuantModeSILKShort2Float = uint32(7) )
const ( // KissFFTModeBfly2 selects the FIXED_POINT kf_bfly2 radix-2 butterfly. KissFFTModeBfly2 = uint32(0) // KissFFTModeBfly4 selects the FIXED_POINT kf_bfly4 radix-4 butterfly. KissFFTModeBfly4 = uint32(1) // KissFFTModeBfly3 selects the FIXED_POINT kf_bfly3 radix-3 butterfly. KissFFTModeBfly3 = uint32(2) // KissFFTModeBfly5 selects the FIXED_POINT kf_bfly5 radix-5 butterfly. KissFFTModeBfly5 = uint32(3) // KissFFTModeFFT selects the full forward opus_fft_c transform. KissFFTModeFFT = uint32(4) // KissFFTModeIFFT selects the full inverse opus_ifft_c transform. KissFFTModeIFFT = uint32(5) )
const ( OpusForceModeAuto = 0 OpusForceModeSILKOnly = 1000 OpusForceModeHybrid = 1001 OpusForceModeCELTOnly = 1002 )
Forced coding mode codes for OpusEncodeFixedParams.ForceMode. They mirror the libopus opus_private.h MODE_* constants consumed by OPUS_SET_FORCE_MODE.
const ( OpusBandwidthAuto = 0 OpusBandwidthNarrowband = 1101 OpusBandwidthMediumband = 1102 OpusBandwidthWideband = 1103 OpusBandwidthSuperwideband = 1104 OpusBandwidthFullband = 1105 )
Bandwidth codes for OpusEncodeFixedParams.Bandwidth. They mirror the libopus OPUS_BANDWIDTH_* constants consumed by OPUS_SET_BANDWIDTH. Zero leaves the bandwidth unset (encoder auto-selects).
const ( // QEXTDecode96kFormatFloat32 selects opus_decode_float output. QEXTDecode96kFormatFloat32 = uint32(0) // QEXTDecode96kFormatInt16 selects opus_decode output. QEXTDecode96kFormatInt16 = uint32(1) // QEXTDecode96kFormatInt24 selects opus_decode24 output. QEXTDecode96kFormatInt24 = uint32(2) )
const ( // CELTEnergyEncodeModeQuant drives quant_coarse_energy + quant_fine_energy + // quant_energy_finalise. CELTEnergyEncodeModeQuant = uint32(0) )
const ( // CELTPVQModeSearch selects the FIXED_POINT op_pvq_search_c kernel. CELTPVQModeSearch = uint32(0) )
const ( // CELTQuantEnergyModeAmp2Log2 selects the FIXED_POINT amp2Log2 kernel. CELTQuantEnergyModeAmp2Log2 = uint32(0) )
const ( // CELTSynthesisDecodeBufferSize mirrors DECODE_BUFFER_SIZE // (DEC_PITCH_BUF_SIZE) in celt/celt_decoder.c. The synthesis writes into a // per-channel decode_mem buffer of size CELTSynthesisDecodeBufferSize+overlap. CELTSynthesisDecodeBufferSize = 2048 )
Variables ¶
This section is empty.
Functions ¶
func BuildCHelper ¶
func BuildCHelper(cfg CHelperConfig) (string, error)
func BuildDREDHelper ¶
func BuildOSCEHelper ¶
func CTLSequenceHelperPath ¶
CTLSequenceHelperPath returns the built CTL-sequence oracle path (building it on first use) so callers can detect availability before running the sweep.
func CustomRefPath ¶
CustomRefPath returns a path under the pinned custom-modes (--enable-custom-modes) libopus reference tree. Its config.h defines CUSTOM_MODES and the Opus Custom API, so C oracle helpers built against it can call opus_custom_mode_create / opus_custom_encoder_create / opus_custom_decoder_create. When GOPUS_LIBOPUS_REF_SCALAR=1 it returns the scalar custom tree so the celt/custom parity gate links the bit-reproducible reference.
func CustomScalarRefPath ¶
CustomScalarRefPath returns a path under the scalar custom-modes libopus reference tree (--enable-custom-modes on the generic-C kernels, built with --disable-asm --disable-rtcd --disable-intrinsics). It is the bit-reproducible Opus Custom oracle for the pure-Go celt/custom parity gate.
func DecodeDiffHelperPath ¶
DecodeDiffHelperPath builds (once) and returns the differential decode oracle binary path.
func EncodeDiffHelperPath ¶
EncodeDiffHelperPath returns the built float encode-diff oracle path (building it on first use) so tests can detect availability before running the sweep.
func EnsureDREDBuild ¶
func EnsureOSCEBuild ¶
func FixedRefPath ¶
FixedRefPath returns a path under the pinned fixed-point (--enable-fixed-point) libopus reference tree. Its config.h defines FIXED_POINT, so C oracle helpers built against it exercise the integer CELT/SILK kernels.
func OracleEnabled ¶
func OracleEnabled() bool
func ProbeCELTAlgQuant ¶
func ProbeCELTAlgQuant(x []int32, k, spread, b int, gain int32, bufBytes int) (collapseMask uint32, bytes []byte, resynth []int32, err error)
ProbeCELTAlgQuant runs the FIXED_POINT alg_quant kernel against the real libopus reference. X is the celt_norm (int32) input vector of length N; gain is the opus_val32 (int32) resynthesis gain. resynth is forced on, so X is reconstructed in place. It returns the anti-collapse mask, the finalised range-coder bytes, and the resynthesised X of length N.
func ProbeCELTAlgUnquant ¶
func ProbeCELTAlgUnquant(n, k, spread, b int, gain int32, bytes []byte) (collapseMask uint32, x []int32, err error)
ProbeCELTAlgUnquant runs the FIXED_POINT alg_unquant kernel against the real libopus reference, decoding from the supplied range-coder bytes. It returns the anti-collapse mask and the decoded celt_norm X of length n.
func ProbeCELTAntiCollapse ¶
func ProbeCELTAntiCollapse(in CELTAntiCollapseInput) ([]int32, error)
ProbeCELTAntiCollapse runs the FIXED_POINT anti_collapse kernel against the real libopus reference and returns the modified X vector.
func ProbeCELTFixedAmp2Log2 ¶
ProbeCELTFixedAmp2Log2 runs the FIXED_POINT amp2Log2 kernel against the real libopus reference, returning the resulting log2 band energies (channel-major, Q24, length C*nbEBands). bandE is the channel-major Q12 band amplitude array of length C*nbEBands.
func ProbeCELTFixedComputeBandEnergies ¶
func ProbeCELTFixedComputeBandEnergies(eBands, logN []int16, x []int32, nbEBands, shortMdctSize, end, C, LM int) ([]int32, error)
ProbeCELTFixedComputeBandEnergies runs the FIXED_POINT compute_band_energies kernel against the real libopus reference, returning the resulting band energies (channel-major, length C*nbEBands). The x slice is the channel-major frequency-domain signal of length C*(shortMdctSize<<LM).
func ProbeCELTFixedDecode ¶
ProbeCELTFixedDecode runs the full FIXED_POINT celt_decode_with_ec on a CELT packet using the static 48000/960 mode, returning interleaved int16 PCM of length channels*frameSize.
func ProbeCELTFixedDecodeSeq ¶
func ProbeCELTFixedDecodeSeq(packets [][]byte, channels, frameSize, start, end, samplingRate int) ([][]int16, error)
ProbeCELTFixedDecodeSeq creates ONE FIXED_POINT libopus CELT decoder at the given output samplingRate (48000/24000/16000/12000/8000) and decodes the supplied sequence of CELT packets in order through it, returning one int16 PCM slice per packet. frameSize is the 48k-core per-channel sample count; each returned frame has channels*(frameSize/downsample) interleaved samples, where downsample = resampling_factor(samplingRate). This exercises the cross-frame decode_mem/post-filter/energy-prediction carry and the downsample output path.
func ProbeCELTFixedDenormaliseBands ¶
func ProbeCELTFixedDenormaliseBands(eBands []int16, bandLogE, x []int32, nbEBands, shortMdctSize, start, end, M, downsample int, silence bool) ([]int32, error)
ProbeCELTFixedDenormaliseBands runs the FIXED_POINT denormalise_bands kernel against the real libopus reference, returning the de-normalised synthesis spectrum freq of length N = M*shortMdctSize.
eBands mode band boundaries (m->eBands), length >= end+1 bandLogE per-band quantized log energy (celt_glog), length >= end x normalized coefficients (celt_norm), length M*eBands[end]
func ProbeCELTFixedEncode ¶
func ProbeCELTFixedEncode(pcm []int16, channels, frameSize, start, end, bitrate, complexity, nbCompressedBytes int) ([]byte, error)
ProbeCELTFixedEncode runs the full FIXED_POINT celt_encode_with_ec on the static 48000/960 mode for the supplied interleaved int16 PCM (channels*frameSize samples) at the given CBR target, returning the produced CELT packet bytes. This is the end-goal reference for the integer encoder.
func ProbeCELTFixedEncodeExt ¶
func ProbeCELTFixedEncodeExt(pcm []int16, channels, frameSize, start, end, bitrate, complexity, nbCompressedBytes int, vbr, constrainedVBR, lfe bool, mask []int32) ([]byte, error)
ProbeCELTFixedEncodeExt runs the full FIXED_POINT celt_encode_with_ec on the static 48000/960 mode with the LFE and/or energy_mask controls applied, returning the produced CELT packet bytes. mask, when non-nil, holds channels*nbEBands celt_glog (Q24, channel-major) values passed via OPUS_SET_ENERGY_MASK.
func ProbeCELTFixedEncodeRate ¶
func ProbeCELTFixedEncodeRate(pcm []int16, channels, frameSize, start, end, bitrate, complexity, nbCompressedBytes, sampleRate int, vbr, constrainedVBR, lfe bool, mask []int32) ([]byte, error)
ProbeCELTFixedEncodeRate runs the full FIXED_POINT celt_encode_with_ec for a CELT encoder created at the given API sampleRate (48000/24000/16000/12000/ 8000). The CELT mode is always 48000/960; sampleRate sets st->upsample via celt_encoder_init, so the supplied frameSize and pcm are at the API rate (frameSize*upsample == the 48 kHz core N). Other arguments match ProbeCELTFixedEncodeExt.
func ProbeCELTFixedEncodeSeq ¶
func ProbeCELTFixedEncodeSeq(pcm []int16, channels, frameSize, start, end, bitrate, complexity int, vbr, constrainedVBR bool, maxBytes, nframes int) ([][]byte, error)
ProbeCELTFixedEncodeSeq creates one FIXED_POINT CELT encoder, configures it for the given VBR/constrained-VBR/CBR mode and bitrate, and encodes nframes consecutive frames of interleaved int16 PCM (channels*frameSize*nframes samples) in sequence. It returns the produced packet bytes for each frame so cross-frame state (VBR reservoir/drift, energy histories, spec_avg, consec_transient, prefilter_mem) can be validated. maxBytes is the per-frame output buffer size (the VBR/CBR cap).
func ProbeCELTFixedEnergyUnquant ¶
func ProbeCELTFixedEnergyUnquant(p CELTEnergyUnquantParams) ([]int32, error)
ProbeCELTFixedEnergyUnquant runs unquant_coarse_energy, unquant_fine_energy and unquant_energy_finalise on the supplied coded bytes against the real libopus FIXED_POINT reference, returning the resulting oldEBands (channel-major, Q24, length Channels*NbEBands).
func ProbeCELTFixedMathPairs ¶
ProbeCELTFixedMathPairs runs a two-input FIXED_POINT celt math kernel (the frac_div32 family) over a list of (a, b) pairs, returning one int32-as-uint32 output per pair. The header record count is the number of pairs; each record consumes two int32 inputs.
func ProbeCELTFixedMathWords ¶
ProbeCELTFixedMathWords runs the FIXED_POINT celt math oracle for the given mode over a list of int32-as-uint32 inputs, returning the int32-as-uint32 outputs produced by libopus.
func ProbeCELTFixedNormaliseBands ¶
func ProbeCELTFixedNormaliseBands(eBands []int16, bandE, freq []int32, nbEBands, shortMdctSize, end, C, M int) ([]int32, error)
ProbeCELTFixedNormaliseBands runs the FIXED_POINT normalise_bands kernel against the real libopus reference, returning the normalised celt_norm output (channel-major, length C*N where N = M*shortMdctSize). The freq slice is the channel-major frequency-domain signal of the same length and bandE holds the per-band amplitudes (channel-major, length C*nbEBands).
func ProbeCELTFixedPLC ¶
func ProbeCELTFixedPLC(packet []byte, channels, frameSize, start, end, numLost int) ([]int16, error)
ProbeCELTFixedPLC primes a FIXED_POINT libopus CELTDecoder with one prior-good CELT packet (static 48000/960 mode), then runs numLost consecutive lost frames through the celt_decode_with_ec PLC path (data==NULL), returning the concealed int16 PCM frame-major: numLost blocks of channels*frameSize samples.
func ProbeCELTFixedPLCRecovery ¶
func ProbeCELTFixedPLCRecovery(prime, good []byte, channels, frameSize, start, end, numLost int) ([]int16, error)
ProbeCELTFixedPLCRecovery primes a FIXED_POINT libopus CELTDecoder with one prior-good CELT packet (static 48000/960 mode), runs numLost consecutive lost frames through the celt_decode_with_ec PLC path (data==NULL), then decodes the good recovery packet (entered with loss_duration!=0) and returns the recovered good-frame int16 PCM (channels*frameSize samples).
func ProbeCELTMDCT ¶
func ProbeCELTMDCT(mode uint32, p CELTMDCTParams, in []int32) ([]int32, error)
ProbeCELTMDCT drives the real libopus clt_mdct_forward_c (forward) or clt_mdct_backward_c (backward) against a reconstructed FIXED_POINT (non-QEXT) mdct_lookup for the given parameters, returning the int32 output buffer.
For the forward transform in holds N reals and the output is the post-rotated spectrum of stride*(N2-1)+1 reals (N2 = (N>>shift)>>1). For the backward transform in holds stride*(N2-1)+1 frequency reals and the output is the N time-domain reals after windowing/mirroring.
func ProbeCELTMathWords ¶
func ProbeCELTPVQSearch ¶
ProbeCELTPVQSearch runs the FIXED_POINT op_pvq_search_c kernel against the real libopus reference. X is the celt_norm (int32) input vector of length N; the kernel modifies its own copy internally. It returns yy (the squared norm of the codeword, sign-extended from opus_val16) and iy, the per-bin signed pulse counts of length N.
func ProbeCELTPVQSearchFloat ¶
ProbeCELTPVQSearchFloat runs the FLOAT op_pvq_search_c kernel from the default (float) libopus reference. x is the celt_norm (float32) input vector; it returns yy (codeword squared norm, float32) and iy (signed pulse counts). This is the same-arch float oracle for the encoder PVQ search.
func ProbeCELTPatchTransientDecision ¶
ProbeCELTPatchTransientDecision runs the FIXED_POINT patch_transient_decision kernel. newE and oldE hold 2*nbEBands celt_glog (Q24) band energies laid out as E[c*nbEBands+i]; libopus always allocates both channels.
func ProbeCELTRenormaliseVector ¶
ProbeCELTRenormaliseVector runs the FIXED_POINT renormalise_vector kernel against the real libopus reference. x is the celt_norm (int32) input vector; gain is the Q31 gain. It returns the renormalised vector of the same length.
func ProbeCELTStereoIthetaQ30 ¶
func ProbeCELTStereoIthetaQ30(cases []CELTStereoIthetaCase) ([]uint32, error)
func ProbeCELTTFAnalysis ¶
func ProbeCELTTFAnalysis(eBands []int16, length int, isTransient bool, lambda int, x []int32, n0, lm int, tfEstimate int16, tfChan int, importance []int) (tfSelect int, tfRes []int, err error)
ProbeCELTTFAnalysis runs the FIXED_POINT tf_analysis kernel. eBands holds nbEBands+1 band boundaries; X holds the normalised MDCT bins (celt_norm, channel-interleaved at N0). tfEstimate is Q14. It returns tf_select and the per-band tf_res decisions (length len).
func ProbeCELTTFEncode ¶
func ProbeCELTTFEncode(start, end int, isTransient bool, tfRes []int, lm, tfSelect, bufSize, preBits int) (buf []byte, outTFRes []int, err error)
ProbeCELTTFEncode runs the FIXED_POINT tf_encode kernel. It encodes tfRes (and the tf_select bit) into a range coder of bufSize bytes, after consuming preBits of priming bits (each an ec_enc_bit_logp(0,1) call) to set the bit budget. It returns the finished coder buffer and the rewritten tf_res array (length end).
func ProbeDNNKernelCGEMV8x4 ¶
func ProbeDNNKernelSGEMV ¶
func ProbeOpusEncodeFixed ¶
func ProbeOpusEncodeFixed(p OpusEncodeFixedParams) ([][]byte, error)
ProbeOpusEncodeFixed encodes the supplied int16 PCM frames through the FIXED_POINT libopus reference opus_encode() and returns the produced full Opus packets (TOC + payload). This is the top-level reference for the public fixed-point Encoder.
func ProbeSILKShort2Float ¶
func ProbeSoftClip ¶
ProbeSoftClip runs libopus opus_pcm_soft_clip for the provided interleaved PCM.
func QEXTRefPath ¶
QEXTRefPath returns a path under the pinned QEXT-enabled libopus reference tree.
func ReadRefFileOrSkip ¶
ReadRefFileOrSkip reads a pinned libopus reference file. Missing references skip local tests unless GOPUS_STRICT_LIBOPUS_REF asks for hard failures.
func ReadRefPathOrSkip ¶
ReadRefPathOrSkip is the path-based form of ReadRefFileOrSkip.
func RefPath ¶
RefPath returns a path under the pinned libopus reference tree. When GOPUS_LIBOPUS_REF_SCALAR=1 it returns the scalar (generic-C) tree so the pure-Go build and custom parity gate link the bit-reproducible reference.
func RequireOracle ¶
func RunHelperArgs ¶
func RunHelperArgsEnv ¶
func SIMDRefPath ¶
SIMDRefPath returns a path under the SIMD/RTCD-enabled libopus PERFORMANCE reference tree (built by `make ensure-libopus-simd`). Its config.h DEFINES the platform SIMD macros (NEON on arm64, SSE/AVX RTCD on amd64), so it is NOT bit-reproducible and must never be used as a parity oracle — it exists only so the perf scoreboard can compare the gopus asm kernels against a SIMD libopus.
func ScalarRefPath ¶
ScalarRefPath returns a path under the scalar (generic-C, built with --disable-asm --disable-rtcd --disable-intrinsics) libopus reference tree. Its config.h leaves the platform SIMD macros undefined, so C oracle helpers built against it exercise the bit-reproducible scalar kernels that match the pure-Go gopus build.
func ScalarRefRequested ¶
func ScalarRefRequested() bool
ScalarRefRequested reports whether the libopus reference oracles must link the scalar (generic-C, no SIMD/RTCD/intrinsics) libopus build instead of the default tree. The pure-Go (-tags purego) gopus build and the celt/custom parity gate set GOPUS_LIBOPUS_REF_SCALAR=1 so the C oracle compares like-with-like: pure-Go-scalar vs scalar-C. The default tree autotools-enables SIMD on amd64 and Linux arm64, so comparing a SIMD-C oracle against scalar Go is not bit-exact and is the wrong reference for those lanes.
func StrictRefRequired ¶
func StrictRefRequired() bool
Types ¶
type CELTAllocTrimResult ¶
CELTAllocTrimResult mirrors the outputs of alloc_trim_analysis.
func ProbeCELTAllocTrimAnalysis ¶
func ProbeCELTAllocTrimAnalysis(eBands []int16, x []int32, bandLogE []int32, end, lm, c, n0 int, stereoSaving, tfEstimate int16, intensity int, surroundTrim, equivRate int32, analysisValid bool, analysisTonalitySlope float32) (CELTAllocTrimResult, error)
ProbeCELTAllocTrimAnalysis runs the FIXED_POINT alloc_trim_analysis kernel. eBands holds nbEBands+1 boundaries, X holds channel-interleaved celt_norm bins at N0, bandLogE holds 2*nbEBands celt_glog (Q24) energies. stereoSaving is the running Q8 estimate, tfEstimate is Q14, surroundTrim is Q24.
type CELTAntiCollapseInput ¶
type CELTAntiCollapseInput struct {
X []int32
CollapseMasks []byte
LM int
C int
Size int
Start int
End int
LogE []int32
Prev1LogE []int32
Prev2LogE []int32
Pulses []int
EBands []int16
NbEBands int
Seed uint32
Encode bool
}
CELTAntiCollapseInput bundles the anti_collapse kernel arguments. The arrays follow the libopus layout: X is C*Size celt_norm samples, collapseMasks is NbEBands*C bytes, logE/prev1logE/prev2logE are 2*NbEBands celt_glog (Q24) each (libopus always allocates both channels; the !encode && C==1 path reads the 2nd-channel slot), pulses is NbEBands ints, and eBands is NbEBands+1 entries.
type CELTBitexactThetaPair ¶
func ProbeCELTBitexactThetaPairs ¶
func ProbeCELTBitexactThetaPairs(inputs []uint32) ([]CELTBitexactThetaPair, error)
type CELTDeemphasisResult ¶
CELTDeemphasisResult holds the FIXED_POINT deemphasis oracle output: the interleaved opus_res pcm buffer (length Nd*C, stride C) and the updated per-channel filter state mem.
func ProbeCELTFixedDeemphasis ¶
func ProbeCELTFixedDeemphasis(in [][]int32, pcm []int32, coef []int16, mem []int32, N, downsample int, accum bool) (*CELTDeemphasisResult, error)
ProbeCELTFixedDeemphasis runs the FIXED_POINT celt/celt_decoder.c deemphasis kernel against the real libopus reference.
in per-channel celt_sig synthesis input, in[c] has length N
pcm pre-existing interleaved opus_res buffer (length Nd*C); only
read when accum is set, but always provided to seed the buffer
coef mode->preemph coefficients (length 4); only coef[0] is used in
this build config
mem per-channel filter state (length C)
N per-channel sample count
downsample decimation factor (1, 2, ...)
accum whether to accumulate into pcm (ADD_RES) instead of overwriting
type CELTEnergyEncodeParams ¶
type CELTEnergyEncodeParams struct {
NbEBands int
Start int
End int
EffEnd int
C int
LM int
Budget int
NbAvailableBytes int
ForceIntra bool
TwoPass bool
LossRate int
Lfe bool
DelayedIntra int32
BufSize int
FinaliseBits int
// EBands is the channel-major Q24 target log energy (length C*NbEBands).
EBands []int32
// OldEBands is the channel-major Q24 predictor (length C*NbEBands).
OldEBands []int32
// FineQuant, ExtraQuant and FinePriority are per-band (length NbEBands).
FineQuant []int32
ExtraQuant []int32
FinePriority []int32
}
CELTEnergyEncodeParams configures a reference run of the FIXED_POINT CELT energy encoders.
type CELTEnergyEncodeResult ¶
type CELTEnergyEncodeResult struct {
// Bytes is the coded range-coder output.
Bytes []byte
// OldEBands is the reconstructed channel-major Q24 energy (length C*NbEBands).
OldEBands []int32
// Error is the residual channel-major Q24 error (length C*NbEBands).
Error []int32
// DelayedIntra is the updated distortion accumulator.
DelayedIntra int32
}
CELTEnergyEncodeResult holds the reference output.
func ProbeCELTQuantEnergyEncode ¶
func ProbeCELTQuantEnergyEncode(p CELTEnergyEncodeParams) (*CELTEnergyEncodeResult, error)
ProbeCELTQuantEnergyEncode drives the real libopus FIXED_POINT quant_coarse_energy, quant_fine_energy and quant_energy_finalise through a genuine ec_enc and returns the coded bytes plus the resulting state.
type CELTEnergyUnquantParams ¶
type CELTEnergyUnquantParams struct {
NbEBands int
Start int
End int
EffEnd int
Channels int
LM int
Intra bool
Coded []byte
FineQuant []int32
FinePriority []int32
BitsLeft int32
}
CELTEnergyUnquantParams describes a coarse+fine+finalise energy decode pass against the FIXED_POINT libopus quant_bands.c unquantizers.
type CELTFrontendResult ¶
type CELTFrontendResult struct {
// Freq is the interleaved post-MDCT signal (celt_sig), length C*N.
Freq []int32
// BandE is the per-band energy (celt_ener), channel-major, length C*nbEBands.
BandE []int32
// X is the normalised bands (celt_norm), interleaved, length C*N.
X []int32
}
CELTFrontendResult holds the intermediate front-end signals produced by the FIXED_POINT encode front-end just before quant_all_bands.
func ProbeCELTFixedEncodeFrontend ¶
func ProbeCELTFixedEncodeFrontend(pcm []int16, channels, frameSize, start, end int, isTransient bool) (*CELTFrontendResult, error)
ProbeCELTFixedEncodeFrontend runs the inline FIXED_POINT encode front-end on the static 48000/960 mode for the supplied interleaved int16 PCM (channels*frameSize samples). isTransient selects the transient MDCT striping (shortBlocks==M) vs the normal long-block path. It returns the resulting freq, bandE and normalised X exactly as celt_encode_with_ec would compute them on a fresh encoder's first frame.
func ProbeCELTFixedEncodeFrontendRate ¶
func ProbeCELTFixedEncodeFrontendRate(pcm []int16, channels, frameSize, start, end, upsample int, isTransient bool) (*CELTFrontendResult, error)
ProbeCELTFixedEncodeFrontendRate runs the FIXED_POINT encode front-end with an explicit upsample factor (1/2/3/4/6). frameSize is the API-rate per-channel count; the 48 kHz core is frameSize*upsample. The front-end zero-stuffs the input and applies the spectral upsample scaling, matching celt_encode_with_ec.
type CELTMDCTKFFT ¶
type CELTMDCTKFFT struct {
Nfft int
Scale int32
ScaleShift int32
Shift int32
Factors [16]int16
Bitrev []int16
Twiddles [][2]int16
}
CELTMDCTKFFT mirrors one sub-FFT state of the static 48000/960 mode->mdct.
type CELTMDCTParams ¶
CELTMDCTParams describes one MDCT oracle invocation: the full MDCT length n and the lookup's maxshift used to build the kfft/trig tables, plus the per-call shift/overlap/stride and the int16 Q15 window (overlap entries).
type CELTMDCTTables ¶
type CELTMDCTTables struct {
N int
MaxShift int
Trig []int16
Window []int16
EBands []int16
Preemph0 int32
KFFT []CELTMDCTKFFT
}
CELTMDCTTables holds the dumped static 48000/960 mode->mdct tables plus the mode window, band layout and preemphasis coefficient.
func ProbeCELTFixedMDCTTables ¶
func ProbeCELTFixedMDCTTables() (*CELTMDCTTables, error)
ProbeCELTFixedMDCTTables dumps the libopus FIXED_POINT static 48000/960 custom mode's mode->mdct lookup (the exact tables celt_decode_with_ec uses).
type CELTPrefilterParams ¶
type CELTPrefilterParams struct {
CC, N int
Complexity int
LossRate int
NbAvailableBytes int
PrefilterPeriod int
PrefilterTapset int
Enabled bool
Hybrid bool
Tell int
TotalBits int
PrefilterGain int16
TFEstimate int16
ToneFreq int16
Toneishness int32
AnalysisValid bool
MaxPitchRatio float32
}
CELTPrefilterParams mirrors the CELTEncoder state and per-frame inputs that the run_prefilter value-producing block consumes.
type CELTPrefilterResult ¶
type CELTPrefilterResult struct {
PitchIndex int
Gain int16
QG int
PFOn bool
Tapset int
Bytes []byte
}
CELTPrefilterResult holds the FIXED_POINT run_prefilter decision values and the emitted post-filter parameter bytes.
func ProbeCELTPrefilter ¶
func ProbeCELTPrefilter(pre [][]int32, p CELTPrefilterParams) (CELTPrefilterResult, error)
ProbeCELTPrefilter runs the FIXED_POINT run_prefilter value-producing block against the real libopus reference. pre holds the assembled per-channel analysis buffers (each COMBFILTER_MAXPERIOD+N int32 samples); pre[1] is used only when p.CC==2.
type CELTQuantAllBandsEncodeParams ¶
type CELTQuantAllBandsEncodeParams struct {
Channels int
LM int
Start int
End int
ShortBlocks int
Spread int
DualStereo int
Intensity int
TotalBits int32
Balance int32
CodedBands int
Complexity int
DisableInv bool
Seed uint32
NbEBands int
Nbytes int
Pulses []int32
TfRes []int32
BandE []int32 // channels*NbEBands, channel-major (per-band, then +nbEBands)
X []int32 // channels*N, channel-major
}
CELTQuantAllBandsEncodeParams describes a quant_all_bands encode pass against the FIXED_POINT libopus bands.c reference. A fresh range encoder is created over an Nbytes-sized buffer; the normalized X (and stereo Y), band energies, allocation and tf inputs are supplied directly so the comparison is decoupled from the surrounding encoder state. X is channel-major with stride N.
type CELTQuantAllBandsEncodeResult ¶
type CELTQuantAllBandsEncodeResult struct {
N int
Channels int
Seed uint32
BytesUsed int
Coded []byte
X []int32
Collapse []byte
}
CELTQuantAllBandsEncodeResult holds the reference quant_all_bands encode output: the coded byte buffer (full storage, raw bits included), the number of forward range-coder bytes used, the post-encode normalized X buffer (channel-major, stride N), the per-band collapse masks, the channel sample count N and the threaded LCG seed.
func ProbeCELTFixedQuantAllBandsEncode ¶
func ProbeCELTFixedQuantAllBandsEncode(p CELTQuantAllBandsEncodeParams) (*CELTQuantAllBandsEncodeResult, error)
ProbeCELTFixedQuantAllBandsEncode runs the real FIXED_POINT libopus quant_all_bands (encode side, QEXT off) over the supplied inputs and returns the coded bytes, post-encode X[] and collapse masks.
type CELTQuantAllBandsParams ¶
type CELTQuantAllBandsParams struct {
Channels int
LM int
Start int
End int
ShortBlocks int
Spread int
DualStereo int
Intensity int
TotalBits int32
Balance int32
CodedBands int
DisableInv bool
Seed uint32
NbEBands int
Pulses []int32
TfRes []int32
Coded []byte
}
CELTQuantAllBandsParams describes a quant_all_bands decode pass against the FIXED_POINT libopus bands.c reference. The range decoder is initialized fresh over Coded; the energy/allocation/tf inputs are supplied directly so the comparison is decoupled from surrounding decoder state.
type CELTQuantAllBandsResult ¶
CELTQuantAllBandsResult holds the reference quant_all_bands decode output: the normalized celt_norm X buffer (channel-major, channel stride N), the per-band collapse masks (channels*NbEBands), the channel sample count N and the threaded LCG seed.
func ProbeCELTFixedQuantAllBands ¶
func ProbeCELTFixedQuantAllBands(p CELTQuantAllBandsParams) (*CELTQuantAllBandsResult, error)
ProbeCELTFixedQuantAllBands runs the real FIXED_POINT libopus quant_all_bands (decode side, QEXT off) over the supplied inputs and returns the resulting normalized X[] (channels*N) plus collapse masks.
type CELTStereoIthetaCase ¶
type CELTSynthesisParams ¶
type CELTSynthesisParams struct {
FrameSize int // shortMdctSize<<LM (120/240/480/960 for LM 0..3)
C int // coded channels (1 or 2)
CC int // output channels (1 or 2)
LM int
Downsample int
Start int
EffEnd int
IsTransient bool
Silence bool
}
CELTSynthesisParams describes a single celt_synthesis call against the FIXED_POINT reference using the static 48000 mode.
type CELTSynthesisResult ¶
type CELTSynthesisResult struct {
NbEBands int
Overlap int
EBands []int16
Window []int16
ChanLen int
// DecodeMem is the per-channel decode_mem after synthesis, channel-major:
// DecodeMem[c*ChanLen : (c+1)*ChanLen].
DecodeMem []int32
}
CELTSynthesisResult holds the libopus celt_synthesis output: the mode bands and window used (so the Go side can reuse the exact reference values) and the resulting per-channel decode_mem buffers (each ChanLen samples).
func ProbeCELTFixedSynthesis ¶
func ProbeCELTFixedSynthesis(p CELTSynthesisParams, x, oldBandE, decodeMem []int32) (*CELTSynthesisResult, error)
ProbeCELTFixedSynthesis runs the FIXED_POINT celt_synthesis on the supplied coefficients, band energies and per-channel decode_mem state, returning the reference mode bands/window and the resulting decode_mem buffers.
x de-normalised input coefficients (celt_norm), length C*N
oldBandE per-band quantized log energy (celt_glog), length C*nbEBands
decodeMem per-channel input decode_mem (celt_sig), channel-major, length
CC*(CELTSynthesisDecodeBufferSize+overlap)
type CELTTransientResult ¶
CELTTransientResult mirrors the outputs of transient_analysis.
func ProbeCELTTransientAnalysis ¶
func ProbeCELTTransientAnalysis(in []int32, length, c int, allowWeakTransients bool, toneFreq int16, toneishness int32) (CELTTransientResult, error)
ProbeCELTTransientAnalysis runs the FIXED_POINT transient_analysis kernel against the real libopus reference. in holds C*length celt_sig (int32) time-domain samples laid out as in[c*length+i]. toneFreq is Q13 and toneishness is Q29.
type CHelperConfig ¶
type CHelperConfig struct {
Label string
OutputBase string
SourceFile string
ProbeRelPath string
CFlags []string
RefIncludes []string
QEXTRef bool
FixedRef bool
CustomRef bool
// SIMDRef links the SIMD/RTCD-enabled libopus PERFORMANCE reference
// (opus-1.6.1-simd). It is NOT bit-reproducible, so it must only be used for
// performance comparisons, never for parity oracles.
SIMDRef bool
// ForceScalarRef compiles every RefSource (and the helper itself) with the
// libopus x86 SSE/AVX feature macros cleared, so SILK/CELT kernels expand to
// their scalar _c forms instead of the RTCD dispatch tables. Helpers that
// compile a hand-picked subset of libopus .c files (no libopus.a link) and
// reach silk_inner_product_FLP / silk_VQ_WMat_EC (or other x86-dispatched
// kernels) need this: otherwise the default RTCD/intrinsics config routes
// them through SILK_*_IMPL tables defined only in silk/x86/x86_silk_map.c +
// the AVX2/SSE impls, which are not in the subset and fail to link on amd64
// and Windows. The scalar _c path is the bit-reproducible reference.
ForceScalarRef bool
IncludeDirs []string
RefSources []string
Sources []string
Libs []string
LDFlags []string
DeadStrip bool
}
type CTLOp ¶
CTLOp is one step in a CTL behavioral program. Request is the libopus request code (e.g. OPUS_SET_BITRATE_REQUEST); Arg is the SET argument (ignored for GET / PROCESS / RESET).
type CTLResult ¶
CTLResult is the oracle outcome of one CTLOp: the CTL/process return code, the GET value (only meaningful when HaveValue), and whether a value was produced.
func ProbeCTLSequence ¶
func ProbeCTLSequence(p CTLSequenceParams) ([]CTLResult, error)
ProbeCTLSequence drives one libopus encoder or decoder through the program in p.Ops and returns one CTLResult per op. This is the behavioral oracle for the public gopus typed CTL setters/getters.
type CTLSequenceParams ¶
type CTLSequenceParams struct {
IsDecoder bool
SampleRate int
Channels int
Application int // libopus OPUS_APPLICATION_* (encoder only)
FrameSize int // per-channel samples per OP_PROCESS frame (0 => 960)
// FeedPacket is the exact Opus packet the decoder OP_PROCESS decodes. The
// same bytes must be decoded by gopus so decode-derived GETs are comparable.
// Ignored for the encoder.
FeedPacket []byte
Ops []CTLOp
}
CTLSequenceParams configures one oracle run against a single encoder or decoder driven through the supplied program.
type DecodeDiffCase ¶
type DecodeDiffCase struct {
Packet []byte // nil/empty → NULL packet (PLC path)
Format uint32 // DecodeDiffFormat*
FrameSize uint32 // PCM buffer capacity in samples/channel
DecodeFEC bool
}
DecodeDiffCase is one packet to decode through the libopus oracle.
type DecodeDiffResult ¶
type DecodeDiffResult struct {
// Code is the raw opus_decode* return value: negative libopus error, or the
// positive decoded sample count per channel on success.
Code int32
// PCM holds the raw decoded sample bytes on success (Code > 0), little-endian
// in the requested Format. Empty when Code <= 0.
PCM []byte
}
DecodeDiffResult is the libopus oracle output for one DecodeDiffCase.
func ProbeDecodeDiff ¶
func ProbeDecodeDiff(sampleRate, channels int, cases []DecodeDiffCase) ([]DecodeDiffResult, error)
ProbeDecodeDiff decodes every case through a fresh libopus decoder at the given sampleRate/channels and returns the per-case return code and decoded PCM.
All cases share sampleRate/channels (one decoder session). Call separately for different stream configurations.
func (DecodeDiffResult) Float32 ¶
func (r DecodeDiffResult) Float32() []float32
Float32 decodes r.PCM as little-endian float32 samples.
func (DecodeDiffResult) Int16 ¶
func (r DecodeDiffResult) Int16() []int16
Int16 decodes r.PCM as little-endian int16 samples.
func (DecodeDiffResult) Int24 ¶
func (r DecodeDiffResult) Int24() []int32
Int24 decodes r.PCM as little-endian int32 (right-justified 24-bit) samples.
type EncodeDiffParams ¶
type EncodeDiffParams struct {
SampleRate int
Channels int
Application int
ForceMode int
Bandwidth int
MaxBandwidth int
Bitrate int
Complexity int
Signal uint32
VBR bool
VBRConstraint bool
ForceChannels int
InbandFEC int
PacketLoss int
DTX bool
LSBDepth int
PredictionDisabled bool
PhaseInvDisabled bool
FrameSize int // per-channel samples at SampleRate
FrameCount int
// PCM is interleaved float32, length FrameSize*Channels*FrameCount.
PCM []float32
}
EncodeDiffParams configures the comprehensive FLOAT opus_encode_float oracle. One encoder is created and driven statefully across all frames (no reset).
type EncodeDiffRecord ¶
EncodeDiffRecord is one frame's oracle result: opus_encode_float's return code Ret (>0 packet len, 1 = DTX/CELT-silence TOC-only, 0 = DTX no-output, <0 error), the post-encode final range, and the produced packet bytes (nil when Ret<=0).
func ProbeEncodeDiff ¶
func ProbeEncodeDiff(p EncodeDiffParams) ([]EncodeDiffRecord, error)
ProbeEncodeDiff encodes the supplied float PCM frames through the default (float) libopus opus_encode_float() and returns per-frame records. This is the byte-exact oracle for the public float Encoder on the same architecture.
type HelperCache ¶
type HelperCache struct {
// contains filtered or unexported fields
}
HelperCache caches a lazily built helper binary path for oracle tests.
func (*HelperCache) CHelperPath ¶
func (c *HelperCache) CHelperPath(cfg CHelperConfig) (string, error)
CHelperPath returns the cached path for a C oracle helper built from cfg.
type KissFFTComplex ¶
KissFFTComplex is a complex sample with int32 real/imaginary parts matching the FIXED_POINT (non-QEXT) libopus kiss_fft_cpx.
func ProbeKissFFTBfly2 ¶
func ProbeKissFFTBfly2(samples []KissFFTComplex) ([]KissFFTComplex, error)
ProbeKissFFTBfly2 runs the FIXED_POINT kf_bfly2 butterfly over the given samples (which must be a multiple of 8 in length: 8 complex samples per group) and returns the in-place transformed result produced by libopus.
type KissFFTFullResult ¶
type KissFFTFullResult struct {
ScaleShift int
Scale int16
Shift int
Factors [2 * maxFactors]int16
Bitrev []int16
Twiddles []KissFFTTwiddle
Samples []KissFFTComplex
}
KissFFTFullResult holds the libopus full-FFT oracle output: the exact state the library built for nfft (scale_shift/scale/shift, factors, bitrev table, twiddle table) plus the transformed samples, so the Go side can validate both its state constructor and its transform bit-for-bit.
func ProbeKissFFTFull ¶
func ProbeKissFFTFull(mode uint32, samples []KissFFTComplex) (KissFFTFullResult, error)
ProbeKissFFTFull runs the real (non-static) library opus_fft_c (forward) or opus_ifft_c (inverse) over the given nfft samples against a standalone opus_fft_alloc state, returning the state tables and the transformed samples.
type KissFFTRadixResult ¶
type KissFFTRadixResult struct {
Twiddles []KissFFTTwiddle
Samples []KissFFTComplex
}
KissFFTRadixResult holds the libopus radix-3/4/5 butterfly oracle output: the twiddle table it generated for the requested nfft (so the Go side can consume identical Q15 twiddles) and the in-place transformed samples.
func ProbeKissFFTBflyRadix ¶
func ProbeKissFFTBflyRadix(mode, nfft uint32, fstride, m, n, mm int, samples []KissFFTComplex) (KissFFTRadixResult, error)
ProbeKissFFTBflyRadix runs one of the FIXED_POINT radix-3/4/5 butterflies (selected by mode) over the given samples. The oracle rebuilds the twiddle table for nfft exactly as compute_twiddles() does, applies the static kernel body with the supplied fstride/m/N/mm strides, and returns both the twiddle table and the transformed samples.
type KissFFTTwiddle ¶
KissFFTTwiddle is a complex twiddle factor with int16 Q15 real/imaginary parts matching the FIXED_POINT (non-QEXT) libopus kiss_twiddle_cpx.
type OpusEncodeFixedParams ¶
type OpusEncodeFixedParams struct {
SampleRate int
Channels int
ForceMode int
Bandwidth int
Bitrate int
Complexity int
VBR bool
VBRConstraint bool
// ForceChannels pins the coded channel count via OPUS_SET_FORCE_CHANNELS
// (1 or 2). Zero leaves it auto, letting opus_encode pick mono/stereo per
// frame from its own stereo-width analysis.
ForceChannels int
FrameSize int // per-channel samples at SampleRate
FrameCount int
// PCM is the interleaved int16 input for all frames,
// length FrameSize*Channels*FrameCount.
PCM []int16
}
OpusEncodeFixedParams configures a top-level FIXED_POINT opus_encode probe. The reference encoder is created via opus_encoder_create(SampleRate, Channels, OPUS_APPLICATION_AUDIO) and driven through the int16 opus_encode API, so the whole resampler/SILK/CELT integer chain runs exactly as the public fixed-point encoder does. ForceMode (when non-zero) pins SILK/Hybrid/CELT via OPUS_SET_FORCE_MODE; Bandwidth (when non-zero) pins the bandwidth via OPUS_SET_BANDWIDTH + OPUS_SET_MAX_BANDWIDTH.
type OraclePayload ¶
type OraclePayload struct {
// contains filtered or unexported fields
}
func NewOraclePayload ¶
func NewOraclePayload(inputMagic string, header ...uint32) *OraclePayload
func NewOraclePayloadVersion ¶
func NewOraclePayloadVersion(inputMagic string, version uint32, header ...uint32) *OraclePayload
func (*OraclePayload) Bytes ¶
func (p *OraclePayload) Bytes() []byte
func (*OraclePayload) Float32 ¶
func (p *OraclePayload) Float32(v float32)
func (*OraclePayload) Float32s ¶
func (p *OraclePayload) Float32s(values ...float32)
func (*OraclePayload) I16 ¶
func (p *OraclePayload) I16(v int16)
func (*OraclePayload) I32 ¶
func (p *OraclePayload) I32(v int32)
func (*OraclePayload) I32s ¶
func (p *OraclePayload) I32s(values ...int32)
func (*OraclePayload) Magic ¶
func (p *OraclePayload) Magic(magic string)
func (*OraclePayload) Raw ¶
func (p *OraclePayload) Raw(data []byte)
func (*OraclePayload) U16 ¶
func (p *OraclePayload) U16(v uint16)
func (*OraclePayload) U32 ¶
func (p *OraclePayload) U32(v uint32)
func (*OraclePayload) U32s ¶
func (p *OraclePayload) U32s(values ...uint32)
type OracleReader ¶
type OracleReader struct {
// contains filtered or unexported fields
}
func NewOracleReader ¶
func NewOracleReader(label, outputMagic string, data []byte) (*OracleReader, error)
func NewOracleReaderMagicVersion ¶
func NewOracleReaderMagicVersion(label, outputMagic string, data []byte) (*OracleReader, uint32, error)
func NewOracleReaderVersion ¶
func NewOracleReaderVersion(label, outputMagic string, data []byte) (*OracleReader, uint32, error)
func RunOracle ¶
func RunOracle(binPath string, input []byte, label, outputMagic string) (*OracleReader, error)
func RunOracleEnv ¶
func RunOracleVersion ¶
func RunOracleVersionEnv ¶
func (*OracleReader) Bytes ¶
func (r *OracleReader) Bytes(n int) []byte
func (*OracleReader) Count ¶
func (r *OracleReader) Count(want int) int
func (*OracleReader) Err ¶
func (r *OracleReader) Err() error
func (*OracleReader) ExpectConsumed ¶
func (r *OracleReader) ExpectConsumed() error
func (*OracleReader) ExpectRemaining ¶
func (r *OracleReader) ExpectRemaining(n int)
func (*OracleReader) Float32 ¶
func (r *OracleReader) Float32() float32
func (*OracleReader) Float64 ¶
func (r *OracleReader) Float64() float64
func (*OracleReader) I16 ¶
func (r *OracleReader) I16() int16
func (*OracleReader) I32 ¶
func (r *OracleReader) I32() int32
func (*OracleReader) Remaining ¶
func (r *OracleReader) Remaining() int
func (*OracleReader) U16 ¶
func (r *OracleReader) U16() uint16
func (*OracleReader) U32 ¶
func (r *OracleReader) U32() uint32
func (*OracleReader) U64 ¶
func (r *OracleReader) U64() uint64
type QEXTDecode96kParams ¶
type QEXTDecode96kParams struct {
SampleFormat uint32 // QEXTDecode96kFormat* (float32/int16/int24)
Channels int
MaxFrameSize int // per-channel sample capacity passed to opus_decode (96 kHz)
Packets [][]byte // Opus packets to decode in sequence through one decoder
}
QEXTDecode96kParams configures a native 96 kHz QEXT full-packet decode probe. The reference decoder is created with opus_decoder_create(96000, channels), which under ENABLE_QEXT runs the native 96 kHz CELT mode plus the >20 kHz extension-band decode chain.
type QEXTDecode96kResult ¶
QEXTDecode96kResult holds the decoded native 96 kHz PCM and per-packet final range. For float32 output PCM is populated; Int16/Int24 carry the integer formats. Exactly one of the three is non-nil depending on SampleFormat.
func ProbeQEXTDecode96k ¶
func ProbeQEXTDecode96k(p QEXTDecode96kParams) (QEXTDecode96kResult, error)
ProbeQEXTDecode96k decodes the supplied Opus packets through the QEXT-enabled libopus reference at Fs=96000 and returns the native 96 kHz PCM (interleaved) plus the per-packet OPUS_GET_FINAL_RANGE values.
type QEXTEncode96kParams ¶
type QEXTEncode96kParams struct {
Channels int
FrameSize int // per-channel samples at 96 kHz (1920 for 20 ms)
Bitrate int
Complexity int
VBR bool
MaxPacketSize int
// PCM is the interleaved native 96 kHz float input for all frames,
// length FrameSize*Channels*FrameCount.
PCM []float32
FrameCount int
}
QEXTEncode96kParams configures a native 96 kHz QEXT full-packet encode probe. The reference encoder is created with opus_encoder_create(96000, channels, OPUS_APPLICATION_RESTRICTED_LOWDELAY) plus OPUS_SET_QEXT(1) and CELT-only / fullband forcing, so it runs the native 96 kHz CELT mode and the >20 kHz extension-band encode chain.
type QEXTEncode96kResult ¶
QEXTEncode96kResult holds the produced native 96 kHz QEXT Opus packets and the per-frame final range from the reference encoder.
func ProbeQEXTEncode96k ¶
func ProbeQEXTEncode96k(p QEXTEncode96kParams) (QEXTEncode96kResult, error)
ProbeQEXTEncode96k encodes the supplied native 96 kHz float PCM frames through the QEXT-enabled libopus reference at Fs=96000 and returns the produced Opus packets plus the per-frame OPUS_GET_FINAL_RANGE values.
Source Files
¶
- binary.go
- celt_alg_quant_oracle.go
- celt_alloc_analysis_oracle.go
- celt_anticollapse_oracle.go
- celt_decode_oracle.go
- celt_deemphasis_oracle.go
- celt_denormalise_oracle.go
- celt_encode_oracle.go
- celt_energy_encode_oracle.go
- celt_fixed_math_oracle.go
- celt_math_oracle.go
- celt_mdct_oracle.go
- celt_mdct_tables_oracle.go
- celt_plc_oracle.go
- celt_plc_recovery_oracle.go
- celt_prefilter_oracle.go
- celt_pvq_float_oracle.go
- celt_pvq_oracle.go
- celt_quant_all_bands_encode_oracle.go
- celt_quant_all_bands_oracle.go
- celt_quant_energy_oracle.go
- celt_synthesis_oracle.go
- celt_transient_oracle.go
- ctl_sequence_oracle.go
- decode_diff_oracle.go
- dnn_kernel.go
- encode_diff_oracle.go
- helpers.go
- kiss_fft_oracle.go
- opus_encode_fixed_oracle.go
- oracle.go
- oracle_buildtag_default.go
- qext_decode96k_oracle.go
- qext_encode96k_oracle.go
- ref.go
- softclip.go