Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hpjansson/smolscale
Fast, embeddable C code for smooth image scaling and pixel format conversion
https://github.com/hpjansson/smolscale
avx2 c embeddable fast graphics image-processing images pixels
Last synced: 11 days ago
JSON representation
Fast, embeddable C code for smooth image scaling and pixel format conversion
- Host: GitHub
- URL: https://github.com/hpjansson/smolscale
- Owner: hpjansson
- License: other
- Created: 2019-07-08T01:45:22.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-01-04T22:36:25.000Z (10 months ago)
- Last Synced: 2024-10-18T15:58:56.436Z (21 days ago)
- Topics: avx2, c, embeddable, fast, graphics, image-processing, images, pixels
- Language: C
- Homepage:
- Size: 1.35 MB
- Stars: 32
- Watchers: 2
- Forks: 4
- Open Issues: 19
-
Metadata Files:
- Readme: README
- License: COPYING
Awesome Lists containing this project
README
Smolscale
=========Smolscale is a smol piece of C code for quickly scaling images to a reasonable
level of quality using CPU resources only (no GPU). It operates on 4-channel
data with 32 bits per pixel, i.e. packed RGBA, ARGB, BGRA etc, as well as
3-channel data without an alpha channel. It supports both premultiplied and
unassociated alpha and can convert between the two. It is host byte ordering
agnostic. The maximum image dimensions are 65535x65535 pixels.The design goals are:
* High throughput: Optimized code, within reason. Easily parallelizable.
* Decent quality: No aliasing as produced by nearest-neighbor scaling.
* Low memory overhead.
* Simplicity: A modern C toolchain as the only dependency.
* Ease of use: One-shot and row-batch APIs.
Usage
-----First, read COPYING. If your project meets the requirements, you should be
able to copy the following files into it and add it to your build with
minimal fuss:smolscale.c
smolscale.h
smolscale-private.hIf you want AVX2 SIMD support, optionally copy this additional file and
compile everything with -DSMOL_WITH_AVX2:smolscale-avx2.c
Keep in mind that this file is mostly just a straight copy of the generic
code for the time being. Still, you will get a performance boost by building
it with -mavx2 and letting Smolscale pick the implementation at runtime.The API documentation lives in smolscale.h along with the public declarations.
Tests
-----There is a testing and benchmarking program included. It lives in test.c.
You should be able to build it by simply issuing 'gmake' or 'make'. It also
allows you to test a few non-smol image scaling implementations.You need the development files for the following dependencies installed first
(these are for test.c only and are not needed for Smolscale proper):* gdx-pixbuf
* libpng
* libswscale
* pixman
* SDL_gfx
You can also optionally build in Skia support, but then you have to build
Skia in the skia/ subdir and edit the Makefile (WITH_SKIA=yes).