Documentation
¶
Overview ¶
Package testvectors provides utilities for parsing and validating against official RFC 8251 Opus test vectors.
The package implements: - opus_demo .bit file parser (proprietary framing format) - Quality metric computation for decoder compliance - Test infrastructure for RFC 8251 validation
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrTruncatedHeader indicates insufficient data for packet header. ErrTruncatedHeader = errors.New("testvectors: truncated packet header (need 8 bytes)") // ErrTruncatedPacket indicates packet data shorter than header specified. ErrTruncatedPacket = errors.New("testvectors: truncated packet data") // ErrEmptyFile indicates the file contains no packets. ErrEmptyFile = errors.New("testvectors: empty file (no packets)") )
Errors returned by the parser.
var ( QualityBarNearExact = qualitycompare.QualityBarNearExact QualityBarRFC = qualitycompare.QualityBarRFC )
Trusted quality bars.
var ( CompareDecodedFloat32 = qualitycompare.CompareDecodedFloat32 ComputeOpusCompareQuality = qualitycompare.ComputeOpusCompareQuality ComputeOpusCompareQualityFloat32 = qualitycompare.ComputeOpusCompareQualityFloat32 ComputeOpusCompareQualityFloat32WithDelay = qualitycompare.ComputeOpusCompareQualityFloat32WithDelay QualityBarForMode = qualitycompare.QualityBarForMode AssertQuality = qualitycompare.AssertQuality )
Comparator and opus_compare entry points.
Functions ¶
This section is empty.
Types ¶
type BitstreamInfo ¶
type BitstreamInfo struct {
PacketCount int // Number of packets in the bitstream
TotalBytes int // Total bytes of packet data (excluding headers)
FirstTOC byte // TOC byte of first packet (for mode detection)
Duration int // Estimated duration in samples at 48kHz
}
BitstreamInfo contains summary information about a parsed bitstream.
func GetBitstreamInfo ¶
func GetBitstreamInfo(packets []Packet) BitstreamInfo
GetBitstreamInfo returns summary information about a parsed bitstream. This is useful for test vector processing reports.
type Packet ¶
type Packet struct {
// Data is the raw Opus packet data (including TOC byte).
Data []byte
// FinalRange is the range coder final state from encoding.
// This can be used to verify range decoder state matches after decoding.
FinalRange uint32
}
Packet represents a decoded opus_demo packet with metadata. The opus_demo format stores packets with their range coder final state for verification purposes.
func ParseOpusDemoBitstream ¶
ParseOpusDemoBitstream reads opus_demo .bit file format from a byte slice.
The format per packet is (big-endian, network byte order):
- uint32_be: packet_length (4 bytes)
- uint32_be: enc_final_range (4 bytes, range coder verification)
- byte[packet_length]: opus_packet_data
Returns all packets in the bitstream, or an error if the format is invalid.
func ReadBitstreamFile ¶
ReadBitstreamFile reads and parses an opus_demo .bit file from disk. This is a convenience function that combines os.ReadFile with ParseOpusDemoBitstream.
type QualityBar ¶
type QualityBar = qualitycompare.QualityBar
QualityBar is a trusted parity threshold.
type QualityComparison ¶
type QualityComparison = qualitycompare.QualityComparison
QualityComparison is the result of a trusted opus_compare-based comparison.