Github: https://github.com/Ferki-git-creator/TurboStitchGIF-HeaderOn...
Don't you get linker errors when a project includes this header twice in different translation units? If not, please explain how.
I've included many single .h/.c pair libraries before in my projects and given the of simplicity that was never a pain point.
edit: Yeah, defining *_IMPLEMENTATION appropriately would address these issues.
But the core logic, turbo decoding modes, and embedded optimization — that’s all written, tested, and understood by me.
I see AI as a tool, not an author — it helps speed things up, but I still do the thinking.
I quite like the flexibility it provides in terms of making “unity builds” very easy, and scaling down quite well to small, single-TU projects with minimal build set ups.
I checked the code, it gives me "LLM vibes", too. FWIW, I am not against it. Perhaps the developer was using it here and there. Personally I do not care.
LLM is also similar in that sense, so it produces the same writing. It resists personal touch without being explicitly asked.
The trickiest part wasn’t the encoder; it’s computing the palette from RGB images. To minimize the output file size, I wanted a single palette shared by all frames.
The key piece of research was in that sample code from early 90-s https://www.ece.mcmaster.ca/~xwu/cq.c However, I had to rework it heavily because global variables and C language are too old school, also because FP32 precision is insufficient for the count of input pixels in my use case. 200 FullHD frames contain approximately 400M pixels, FP32 numbers don’t have the precision to accumulate that many of them. And the number is dangerously close to int32 limit, I have also upgraded the integer counters to int64.
Ignoring the compatibility, modern video codecs like h264 or h265 are substantially better than animated GIFs, in terms of both size and quality.
BTW I supported them as well. The only target platform of that software is modern versions of Windows. It only took couple pages of straightforward C++ because the OS includes a functional equivalent of libavcodec and libavformat libraries. Moreover, GPU drivers install and register the components to leverage the codecs implemented by hardware of these GPUs. The high-level API to encode compressed video files from a sequence of frames is MFCreateSinkWriterFromURL function.
ppl who ask qustions like this must have not worked much on codebases w/ nightmarish build setups, libraries like this are so refreshing/easier to work w/