Skip to content
Fast C code for smooth image scaling
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
gnuplot
COPYING
COPYING.BSD-4
COPYING.LGPLv3
Makefile
README
bench.sh
plot.sh bench: Add benchmarking and plotting scripts Jul 2, 2019
png.c
skia.cpp test: Add missing copyright note Jul 4, 2019
smolscale-avx2.c
smolscale-private.h
smolscale.c
smolscale.h smolscale: Add support for RGB8 and BGR8 pixels Jul 21, 2019
test.c

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. It supports
both premultiplied and unassociated alpha and can convert between the two. It
is host byte ordering agnostic.

The design goals are:

* High throughput: Optimized code, within reason. Easily parallelizable.

* Decent quality: No "jaggies" as produced by nearest-neighbor scaling.

* Low memory overhead: Mostly on the stack.

* 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.h

If 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 '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

* 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).
You can’t perform that action at this time.