proxy.golang.org : github.com/braheezy/qoa
Package qoa provides functionality for encoding and decoding audio data in the QOA format. The following is from the QOA specification: QOA encodes pulse-code modulated (PCM) audio data with up to 255 channels, sample rates from 1 up to 16777215 hertz and a bit depth of 16 bits. The compression method employed in QOA is lossy; it discards some information from the uncompressed PCM data. For many types of audio signals this compression is "transparent", i.e. the difference from the original file is often not audible. QOA encodes 20 samples of 16 bit PCM data into slices of 64 bits. A single sample therefore requires 3.2 bits of storage space, resulting in a 5x compression (16 / 3.2). A QOA file consists of an 8 byte file header, followed by a number of frames. Each frame contains an 8 byte frame header, the current 16 byte en-/decoder state per channel and 256 slices per channel. Each slice is 8 bytes wide and encodes 20 samples of audio data. All values, including the slices, are big endian. The file layout is as follows: Each qoa_slice_t contains a quantized scalefactor sf_quant and 20 quantized residuals qrNN: Each frame except the last must contain exactly 256 slices per channel. The last frame may contain between 1 .. 256 (inclusive) slices per channel. The last slice (for each channel) in the last frame may contain less than 20 samples; the slice still must be 8 bytes wide, with the unused samples zeroed out. Channels are interleaved per slice. E.g. for 2 channel stereo: slice[0] = L, slice[1] = R, slice[2] = L, slice[3] = R ... A valid QOA file or stream must have at least one frame. Each frame must contain at least one channel and one sample with a samplerate between 1 .. 16777215 (inclusive). If the total number of samples is not known by the encoder, the samples in the file header may be set to 0x00000000 to indicate that the encoder is "streaming". In a streaming context, the samplerate and number of channels may differ from frame to frame. For static files (those with samples set to a non-zero value), each frame must have the same number of channels and same samplerate. Note that this implementation of QOA only handles files with a known total number of samples. A decoder should support at least 8 channels. The channel layout for channel counts 1 .. 8 is: QOA predicts each audio sample based on the previously decoded ones using a "Sign-Sign Least Mean Squares Filter" (LMS). This prediction plus the dequantized residual forms the final output sample.
Registry
-
Source
- Documentation
- JSON
- codemeta.json
purl: pkg:golang/github.com/braheezy/qoa
License: MIT
Latest release: 10 months ago
First release: over 1 year ago
Namespace: github.com/braheezy
Stars: 4 on GitHub
Forks: 0 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: 15 days ago