I’m trying to understand the code in asinh.c which I am attempting to port into another environment. I’m pretty certain that there is an assumption baked into asinhlut_float() that the values in the fits buffers are in the range [0.0, 1.0]. Is that correct?
If I want to handle values that have a range of [0., 255.996], can you suggest how I might change the code (I think it is the code that sets the values of sf and tf that needs to change, but there could be more that I have missed).
Instead of changing the asinh code, simply normalise the input values to the range [0, 1] for processing. You can always rescale the output to [0, 255], or any other range, as required.
By the way, the range of your input [0, 255.996] seems odd. If the data is from 8-bit integers, one would expect a range of [0, 255].