when is cudaReadModeNormalizedFloat != cudaReadModeElementType

I have a 2D grey image (0…255) which I access via a 2D texture. If the texture is
cudaReadModeNormalizedFloat I have to multiply by 255.0f to get back the gray value.
So I thought I would use cudaReadModeElementType instead and access the gray value
as an int directly. Mostly the two yield similar values but there are
slight differences. Larger differences appear to lie where the image intensity changes
rapidly. I have checked all tex2D use integer values for the x and y coordinates,
so I do not think its a question of tex2D interpolating between pixel values.

Any ideas?
What else should I check.
Many thanks
Bill
http://www.cs.ucl.ac.uk/staff/W.Langdon/

Are you adding 0.5 to each dimension of the coordinates to position the sample points in the center of each texel?

Dear njuffa,
(opps seem to have lost my reply)
Thank you very much this feels like the right answer.
The coordinates have values 0.0,0.0 1.0,0.0 2.0,0.0 and so on.

Should I add 0.5f to both texture schemes?

Bill

I always use cudaReadModeElementType and am only aware that one needs to add 0.5 to both the x and y coordinate to actually address the center of each texel.

I have never used cudaReadModeNormalizedFloat, but my guess would be that no adjustments are needed in that mode. Users with more of a graphics background might want to chime in and either confirm or refute this assumption.