Bilinear resampling #5

Merged
merged 4 commits into from Feb 15, 2013

Projects

None yet

2 participants

@natemueller
Collaborator

No description provided.

@wvanbergen
Owner

Thanks for contributing. The build seems to be failing because of long overflows: https://travis-ci.org/wvanbergen/oily_png/builds/4809541

@natemueller
Collaborator

Hmm. Passes on my test machines but they're all 64-bit. I'll check it out.

@wvanbergen
Owner

One tidbit that may have caused this:

ChunkyPNG/OilyPNG use 32bit integers to store pixels. This would normally work fine on 32-bit machines, but a ruby Fixnum uses the first two bits for type information, so in practice a FIxnum only has 30 bits before it overflows to a Bignum.

So when you convert a long back into a Ruby type, it could be both a Fixnum or a Bignum. You may want to play around with ruby.h'sFIX2INT,NUM2INT,FIX2LONG, andNUM2LONG` macros to make it work.

(I didn't actually look at your code to see if this is the problem for you ;)

@natemueller natemueller Store pixels in uint32_t instead of long
Saves space and works on 32-bit systems
1c21a9a
@natemueller
Collaborator

Yea, that was it. Thanks for pointing me in the right direction.

@wvanbergen wvanbergen merged commit 4495023 into wvanbergen:master Feb 15, 2013

1 check passed

default The Travis build passed
Details
@wvanbergen
Owner

Released as version 1.1.0. Thanks for contributing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment