5 ms·
Show HN: PlutoFilter- A single-header, zero-allocation image filter library in C
- rossant 1y agoAny SIMD/multicore capabilities?
- ephou7 1y agoI'm not sure why single-header is an advantage over powerful libraries such as GEGL.
- malkia 1y agoor ImageMagick, or plenty of others, with SIMD, GPU, etc. support.
- Calavar 1y agoIt fills the lightweight niche. You can build it on Windows without needing to drag in all of msys. I can see this as really useful for toy projects and demos.
- majorchord 1y agoI'm not sure why walking is an advantage over a hot air balloon. /s Try to understand that "advantage" can mean different things to different people. Your perspective and usecases might be totally opposite from someone else, and that doesn't mean either of you are wrong.
- im_down_w_otp 1y agoBoth the single header and the zero-allocation callouts can be desirable qualities for something used in an embedded (as in classical MCU-shaped) context. edit: Seeing that it's also C99 makes me think that embedded applications might be what this was geared toward.
- gregschlom 1y agoThe benefit of single-header, specifically, is that it's super easy to integrate with any project. You don't need to mess with your build system, or the library's build system, just include the file and you're good to go. No allocation is useful for embedded / resource constrained targets.
- mrheosuper 1y agoeasy to test and integrate to your project.
- vouaobrasil 1y agoIt's sort of like how a clean organized desk is an advantage to some but a hindrance to others....
- anitil 1y agoI was wondering how it would do arbitrary-sized kernels without dynamic allocation (my guess was that it would use the input/output buffer as a temporary storage). The answer is that there's a _slight_ asterix to the 'zero-allocation' - the allocation is on the stack [0], but it's small-ish (2kb) and fixed size. So in an embedded context you'd just want to make sure you have headroom for this. [0] https://github.com/sammycage/plutofilter/blob/main/plutofilter.h#L912 https://github.com/sammycage/plutofilter/blob/main/plutofilt...
- deleted 1y ago[deleted]
- Neywiny 1y agoIt's interesting. On embedded, heap allocation is usually not done. If it is, it's permanent- free does nothing. Not always the case, you can enable a real alloc/free algorithm, but usually you don't need to free so it doesn't matter. The stack, though... If you take 2KB of stack and you haven't linked that much in, good luck trying to find that "bug" for why everything gets corrupted/crashes. My point here isn't that 2KB is big for embedded, it's actually that I'd prefer it just either statically allocates the memory or uses the heap so I can at least get an "out of memory" error
- kookamamie 1y agoQuite nice. Although, it seems to be making some pretty interesting assumptions. For example, most operations seem to assume ARGB inputs are premultiplied-alpha and will call PLUTOFILTER_UNPREMULTIPLY_PIXEL.
- mnaimd 1y agoWow Really easy to add it into an existing project, Written in C99... Great job!
- dxroshan 1y agoCongratulation! Great work! I really like his PlutoVG, LunaSVG and PlutoSVG.
- countfeng 1y agonice, like Blend model
- jlundberg 1y agoWell done and great with all the examples. Kind of wish I had a use case for this already, but I probably have :)