Skip to content

Fast, embeddable C code for smooth image scaling and pixel format conversion

License

Unknown and 2 other licenses found

Licenses found

Unknown
COPYING
Unknown
COPYING.BSD-4
LGPL-3.0
COPYING.LGPLv3
Notifications You must be signed in to change notification settings

hpjansson/smolscale

Repository files navigation

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.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 '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).

About

Fast, embeddable C code for smooth image scaling and pixel format conversion

Topics

Resources

License

Unknown and 2 other licenses found

Licenses found

Unknown
COPYING
Unknown
COPYING.BSD-4
LGPL-3.0
COPYING.LGPLv3

Stars

Watchers

Forks

Packages

No packages published

Languages