Twinside/Juicy.Pixels — Issue #5: index bug in inverse discrete cosine transform
Author: dagit
Created: 2012-01-15 22:21:23+00:00
State: open

iclip is declared like this:

iclip :: UArray Int Int16
iclip = listArray (-512, 512) [ val i| i <- [(-512) .. 511]]
where val i | i < (-256) = -256
| i > 255 = 255
| otherwise = i

Two bugs:
* bounds should be `listArray (-512, 511)`
* Specifying the range this way means that you should now be able to index directly into this array instead of adding 512 in the definition of (!!!). I bet this didn't come up in testing due to the use of unsafe index function in the definition of (!!!).

I'm currently doing a refactor to use Data.Vector.Storable instead of Arrays. I've fixed this in my branch, would you like me to submit a patch for this separate from my refactor to use Data.Vector? (I don't know if you are interested in my Data.Vector work).