Mattias Gustavsson
banner
mattiasg.bsky.social
Mattias Gustavsson
@mattiasg.bsky.social
Hobby game dev, making retro style games: mattiasgustavsson.itch.io and public domain C libs: github.com/mattiasgustavsson
I write about things at mattiasgustavsson.com
Feel free to DM me about anything
Reposted by Mattias Gustavsson
The single header lib also includes source code for an encoder utility and a playback app (both which makes use of other single header libs), behind conditional compile switches (ifdefs). Instructions for how to build them can be found at the top of the file.
August 31, 2025 at 6:48 PM
Reposted by Mattias Gustavsson
The code is public domain, and available here github.com/mattiasgusta...
For most uses, you are probably better off using a real codec. But for something small, simple, self-contained with no dependencies, this might fit the bill.
github.com
August 31, 2025 at 6:48 PM
Reposted by Mattias Gustavsson
The videos in the examples are compressed with my "default" setting, which makes them quite small, with ok-ish quality. On "max" they are more like dvd in size/quality. I focused on avoiding temporal aliasing, and I think i pulled that off quite well.
August 31, 2025 at 6:48 PM
Reposted by Mattias Gustavsson
All in all, it seems like my quality/compression is maybe around dvd quality (?), so not in the same league as modern codecs (but attempting that would start to infringe on patents, so I don't particularly want to go down that route).
August 31, 2025 at 6:48 PM
Reposted by Mattias Gustavsson
Here are two sample video snippets:
mattiasgustavsson.com/wasm/fmv.html
mattiasgustavsson.com/wasm/fmvdl.h...
(both are displayed with my CRT filter, because that's how I am most likely to be using this myself, but it can be toggled with F9).
August 31, 2025 at 6:48 PM
QOI, and, by the looks of it, QOV (cool, I didn't know about that one) are both lossless, which is super cool, and such wonderfully simple formats too. Mine is a very lossy mpeg-like encoding, doing DCT compression and motion vectors and such things, so quite different, but still video compression 🙂
August 31, 2025 at 11:46 PM
The single header lib also includes source code for an encoder utility and a playback app (both which makes use of other single header libs), behind conditional compile switches (ifdefs). Instructions for how to build them can be found at the top of the file.
August 31, 2025 at 6:48 PM
The code is public domain, and available here github.com/mattiasgusta...
For most uses, you are probably better off using a real codec. But for something small, simple, self-contained with no dependencies, this might fit the bill.
github.com
August 31, 2025 at 6:48 PM
The videos in the examples are compressed with my "default" setting, which makes them quite small, with ok-ish quality. On "max" they are more like dvd in size/quality. I focused on avoiding temporal aliasing, and I think i pulled that off quite well.
August 31, 2025 at 6:48 PM
All in all, it seems like my quality/compression is maybe around dvd quality (?), so not in the same league as modern codecs (but attempting that would start to infringe on patents, so I don't particularly want to go down that route).
August 31, 2025 at 6:48 PM
Here are two sample video snippets:
mattiasgustavsson.com/wasm/fmv.html
mattiasgustavsson.com/wasm/fmvdl.h...
(both are displayed with my CRT filter, because that's how I am most likely to be using this myself, but it can be toggled with F9).
August 31, 2025 at 6:48 PM
I found that on the latest compiler versions, my previous intrinsics-based implementations tripped some undefined behavior optimizations. fixed it now
August 3, 2025 at 12:57 AM
that'd be cool :) the current vecmath.h is already very large, but I tried to limit its features to those found in HLSL and D3DX, to have as a baseline. There's many convenience functions and higher level functionality that could be added, so I'm considering a "vecmath_util.h" for all of those
July 25, 2025 at 7:36 AM
Reposted by Mattias Gustavsson
If you're looking for a vector math lib for C (or C++) check it out

github.com/mattiasgusta...

If you do take a look, please let me know what you think about it - getting feedback is a big part of the reward releasing libraries like this, and I spent a lot of time and effort on it
github.com
July 21, 2025 at 3:09 PM
Reposted by Mattias Gustavsson
It's been tested on windows, mac, linux and web-assembly, using msvc, clang, gcc and tcc (tiny c compiler).
July 21, 2025 at 3:09 PM
Reposted by Mattias Gustavsson
It is not trying to be the most optimized library, not using any SIMD intrinsics or assembly code, just straightforward, fully portable, simple implementations of a large number of math functions.
July 21, 2025 at 3:09 PM
Reposted by Mattias Gustavsson
It has a large set of functions, as it attempts to implement most of what you get in shader languages like HLSL and GLSL, and also most of the utility functions from libraries like D3DX in DirectX.
July 21, 2025 at 3:09 PM