Repository navigation
Releases
v0.0.12
encoders: VP9 forward probability updates and a noise-tolerant split, H.264 motion seeds for fast pans, a faster H.265 encoder with identical output, and an ultrafast speed preset. VP9: the compressed header sends forward updates (coefficients, skip, transform size, inter and intra modes, references, partitions, motion vectors) where a delta pays for its own bits on the frame's counts; tiles stage their symbols and code them in parallel on the pool once the header has settled the probabilities; an inter block splits only past twice the expected quantizer noise. At equal quality (BD-rate over q 60 to 180 on 720p, 1280x544 and 1080p camera clips and a 40 px/frame pan) files are 4.7 to 13.2% smaller than v0.0.11 at 1.00 to 1.06x the time; the 320x180 animation is 1.6 to 1.9x libvpx's size at matched PSNR, from 11x. H.264: the integer search also starts from the previous macroblock's and the previous search's vectors, and a poorly predicted 16x16 also descends from a grid out to three search radii, keeping the cheaper descent; a lone coefficient in an 8x8 is dropped when its bits cost more than the distortion it removes: 0.7 to 3.0% smaller on the camera clips and 77% on the pan (v0.0.11 lost the motion), 1.01 to 1.02x the time. H.265: the bitstream pass skips the prediction and reconstruction the search already did and takes the deblocked picture SAO was decided on, and the mode decision saves a candidate's state only when another follows: output byte-identical to v0.0.11 on every clip and QP, 0.94 to 0.97x the time. ultrafast (media.Config, video.Writer_Config, the H.264 and H.265 encoder configs) prefers encode speed over size: H.264 searches one reference and 16x16 motion and settles on inter sooner (0.55 to 0.58x the time, -1 to +32% BD-rate); H.265 decides the CU tree top-down, tries four intra modes and searches a diamond to half-pel (0.32 to 0.37x, +28 to +66%); VP9 and the hardware encoders do not use it yet. The VP9 encoder README now describes v0.0.11's
backward adaptation, which it still called absent. Gates: ci check --programs and test; vp9_encode_check (reconstruction identical to FFmpeg and libvpx at every size, q and block size, alpha, Chromium transparency); encoder_matrix and 14 more H.264 streams (FFmpeg equals our decoder, regular and ultrafast); chroma_check_h265 (84 cases) and 20 ultrafast cases (reconstruction equals our decoder, FFmpeg and HM, picture hashes checked)
v0.0.11
API unchanged from v0.0.10. No public signature changed; the VP9 encoder's struct gained two internal fields.
VP9 decoder: faster, output unchanged.
- 1080p VP9 decodes take 1728 → 1385 ms and 2586 → 1868 ms (
decode_benchmarkvp9-p0/p2, median of seven). - What changed:
- Intra prediction and reconstruction run in SIMD lanes.
- Blocks with only a DC coefficient take a shortcut through the inverse DCT.
- Coefficients are zeroed after use instead of before every block.
- Unscaled inter prediction has its own path.
- The loop filter is specialised per plane kind and pass.
- Bounds checks are dropped on the hot paths.
- Output is identical to FFmpeg on every alpha-gate VP9 fixture, with 1 and 8 threads: 8/10/12-bit, 4:2:0/4:4:4, alpha, lossless, RGB, segments, tiles, tile rows, error-resilient and two-pass encodes.
VP9 encoder: different, much smaller files.
- Probabilities now adapt backward from each frame's counts, as libvpx does: frames are no longer error-resilient, and
refresh_frame_contextis on. - Transform size is chosen per block (
TX_MODE_SELECT), with split decisions. - The forward transform is vectorised.
- On a synthetic 320×180 animation, files are 3.8–6× smaller at 2–3 dB higher PSNR (q 60, 100, 160).
- Encoded bytes differ from v0.0.10. What a decoder shows is verified: the reconstruction is identical to FFmpeg's and libvpx's decodes at every size, q and block size in the encode check, and Chromium's transparency check passes.
The alpha gate, the VP9 encode check, every package's check under vet, and every package's tests pass.
v0.0.10
Radiance HDR (asked for by o3d, for environment maps that 8-bit images clip). image/hdr decodes .hdr (RGBE) to linear RGBA f32 with alpha 1, rows top-down.
- Facade:
image.inforeportsFormat.HDRwith the width and height.image.decode_float_into(data, pixels: []f32)fillswidth * height * 4floats the caller owns. - The RGBA8
decodeanddecode_intoreturn.Unsupportedfor HDR rather than tone-mapping it. - Reads: the
#?RADIANCEand#?RGBEsignatures,FORMAT=32-bit_rle_rgbe, the standard-Y height +X widthorientation, and RLE or flat scanlines. - Not supported, as in stb: XYZE files and the other orientations return
.Unsupported. Old-style RLE is read as plain pixels. - Exact:
f32holds every RGBE value exactly, and the output is bit-identical to stb_image'sstbi_loadfon ImageMagick and ffmpeg files (RLE, flat, 5 and 32768 pixels wide,#?RGBE) and on two real environment maps. It is 1.5 to 10 times faster. - Memory: the decode allocates nothing beyond the caller's buffer, because RLE scanlines expand inside the caller's own row.
inforefuses a file too short for the size it claims, so a corrupt header can't make a caller allocate gigabytes.
Also removes the empty audio/reader.odin.new that v0.0.9 shipped by mistake (reported by ottis).
Import paths are unchanged from v0.0.9. The image gate (with the new HDR comparison and fuzz), every package's check under vet, and every package's tests pass.
v0.0.9
Breaking: import paths. The codecs and containers now sit under their family, as Odin's core:image/png does. Package names are unchanged, so only the import paths change:
| Before | Now |
|---|---|
odecs/aac, alac, flac, mp3, opus, vorbis, wav |
odecs/audio/aac, audio/alac, audio/flac, audio/mp3, audio/opus, audio/vorbis, audio/wav |
odecs/bmp, gif, jpeg, webp, png/encoder |
odecs/image/bmp, image/gif, image/jpeg, image/webp, image/png/encoder |
odecs/h264, h265, vp9, av1, prores |
odecs/video/h264, video/h265, video/vp9, video/av1, video/prores |
odecs/mp4, webm, ogg |
odecs/container/mp4, container/webm, container/ogg |
Subpackages move with them: for example, odecs/h264/decoder is now odecs/video/h264/decoder and odecs/aac/encoder is now odecs/audio/aac/encoder. These stay where they were: audio, image, video, media (and media/native, media/vulkan, media/videotoolbox), common, shaders, tools, viewer and demo.
Audio no longer links video (reported by ottis). audio decodes through its own audio.Decoder, which is the one implementation of AAC, FLAC, MP3, Opus, ALAC and Vorbis packet decoding. media's native provider delegates to it. An audio-only program decoding Vorbis now has 863 KB of text, down from 3.31 MB on v0.0.8. It contains no video symbols and needs no video codec's licence notice. CI has a new layers gate: audio reaches no media, video or image package, and image reaches no audio, video, media or container package.
Audio additions (asked for by odawg):
i16as well asf32.audio.read(&r, out)takes[]f32or[]i16.audio.decode_into(data, out, channels)fills a caller's buffer of either type, sized frominfo.- WAV and FLAC reads are bit-identical to
wav.readandflac.interleavein both types. - The lossy codecs round their
f32withcommon.to_i16.
- A channel limit.
open,open_stream,decodeanddecode_intotakechannels = N, which keeps the first N channels in WAVE order.Reader.keptgives the count that reads return. Info.loopis aMaybe(audio.Loop).Loopholds{start, end}in frames, withendexclusive. It comes from:- WAV's first
smplloop, which is end-inclusive, soendhere is one past it; - a FLAC file's
APPLICATION "riff"smplchunk; LOOPSTART/LOOPLENGTHVorbis comments, in Ogg Vorbis, Ogg Opus and FLAC.
- WAV's first
- WAV writing:
wav.header_into(dst, frames, rate, channels, format)andwav.HEADER_SIZEgive the 44-byte header alone, for writers that stream their own samples.wav.smpl_loopparses asmplchunk body.
f32 output is unchanged: it is byte-identical on 100 fixture files. The wav, flac, mp3, opus, mkv, alpha, mp4 and vorbis gates pass, and so do the image and WebP gates after the move. Every package checks under vet, and every package's tests pass.
v0.0.8: image.decode_into
Fixes from the consumers' switch to v0.0.7: ovg, o3d, onimite and odawg.
image.decode_into(data, pixels, pool, allocator)writes RGBA8 into
memory the caller owns, sizedwidth * height * 4fromimage.info. It
covers every format;image.decodeis nowinfo, one allocation, then
decode_into.gif,bmpandwebpeach gaindecode_into.- WebP lossless decodes straight into the caller's buffer, with the same
time and memory as before.
- Caller's allocator holds only the result: core:image's buffers for
PNG, TGA and QOI are now heap scratch, freed before returning. A 1080p PNG
takes 8.1 MB of yours, down from 20 MB.
Output is unchanged: the image gate and the WebP gate are all identical.
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.