Repository navigation
v0.0.7: image and audio
odecs now covers the suite's images and audio. stb_image and miniaudio can
go: image and audio decode everything they read, more accurately, and
mostly faster.
Breaking
movieis nowvideo: importdeps:odecs/video. The procedures and
types are unchanged, but threeReaderfields moved, because the reader now
embeds anaudio.Readerthat owns the opened file:r.containeris nowr.audio.container;r.audio_indexis nowr.audio.track;r.audiois anaudio.Reader. Its description isr.audio.info, and
r.audio.present,r.audio.sample_rateand the other fields still work
throughusing.
The demuxers arer.audio.demuxandr.audio.webm.
- Multichannel audio now uses WAVE order for every codec: FL, FR, FC,
LFE, BL, BR, then side and centre pairs. This coversread_audioand
write_audio. AAC, Opus and Vorbis surround were in their codec's own
order before. Mono and stereo are unchanged.
New
image: PNG, JPEG, GIF, BMP, TGA, QOI and WebP to RGBA8, plus PNG
writing.
jpeg: our own baseline and progressive decoder. Its output is
identical to libjpeg-turbo, and it runs as fast with-microarch:native
(about 1.6× faster than stb_image).gif: the first frame as stb_image gives it, or the animation
composited as browsers show it (identical to Chromium). About 1.5× faster
than stb_image.bmp: decoding by stb_image's rules. Unlike core:image's BMP, it keeps
alpha.png/encoder: PNG writing, moved from ovg.
audio: any file's first audio track, in MP4/M4A/MOV, WebM/MKV, WAV,
FLAC, MP3 or Ogg. The codecs are AAC-LC, PCM, FLAC, MP3, Opus, ALAC and
Vorbis.
- Output: interleaved
f32in WAVE order, with seeking (audio.Reader),
or a whole file at once (audio.decode). vorbis: our own Vorbis I decoder, written from the specification. It
is within 135 dB of libvorbis and takes 0.66× libvorbis' time.wav: writing as 16-bit PCM or 32-bit float.
Accuracy against what we replace:
- WAV and FLAC are identical to miniaudio.
- MP3 is within 122 dB of FFmpeg; miniaudio's dr_mp3 is 70 to 89 dB from it.
- miniaudio decodes 5.1 Vorbis wrongly; odecs matches libvorbis and FFmpeg.
Licences and provenance
Everything stays MIT. The JPEG and Vorbis decoders are our own code.
libjpeg-turbo and libvorbis are pinned only as test oracles
(tools/fetch_third_party.sh); none of their code is used.
Known gaps
- JPEG: arithmetic coding, 12-bit and lossless JPEG are not decoded.
- WAV: ADPCM is not decoded. miniaudio decodes it.
- FLAC: decoding takes about 1.5× miniaudio's time.
- Not supported yet: HEIC, AVIF and TIFF.