Re: [dev] [farbfeld] cubic resizing filter

From: Tim Elliott <tle_AT_holymonkey.com>
Date: Sat, 30 Jan 2016 12:17:38 -0800

On Sat, Jan 30, 2016 at 11:12 AM, FRIGN <dev_AT_frign.de> wrote:
> Care to share your experience using farbfeld to implement this? :)

The invert.c example made the implementation very easy. You'll noticed
this is just a modified copy.

The simplicity of the format and the pure use of stdin/stdout means
that there is little boilerplate above writing a regular C function.
This is very nice.

I struggled with endianness at first because I didn't realize that the
format is stored big-endian.

I also made the mistake of using bit-shift to convert between 8-bit &
16-bit colors at first.

> It's hard to say actually. On the one hand, you do want to support 16
> Bit to minimize discretization errors, on the other hand, it would
> not surprise me if it didn't make any difference.
> Maybe you could try it out with a simple white-to-black-gradient and
> running it through your resizer. Posterization should occur in 8-Bit
> mode.
> You might want to start with a 1000x200 gradient and scale it down to
> 900x180.

The interpolator makes other tradeoffs as well:

  * It clamps intermediate values.
  * Resizing images with transparency can result in a halo effect
because the resampler naively treats transparency as any other
channel.
  * Downscaling a huge image to a very small size can run up against a
precision limitat in the interpolator.

However, interpolation is guesswork and matter-of-taste so I like to
ground choices on real-world use cases before adding complexity.

> Thanks for your hard work! :) I'll add your tool to the farbfeld page
> when I find the time.

Sweet. Thanks for the tool!

I'm thinking of using farbfeld to perform integration testing on the
resampling library. I used to have a similar tool[1] in the repository
for this purpose (even with its own image format), but I removed it
because it was too much maintenance.

[1] - https://github.com/ender672/liboil/blob/770926331829838622fb2af4e606386ed5b1cbcd/oil.c
Received on Sat Jan 30 2016 - 21:17:38 CET

This archive was generated by hypermail 2.3.0 : Sat Jan 30 2016 - 21:24:10 CET