I use the GPU mainly to do image filtering and signal processing (GPGPU programming). Because I’m only intrested in images in grayscale, I store 4 grayscale pixels in one 4-component pixel (R, G, B and A). That works perfect for most of the time, some filters even get a 4 times speedup compered to the naïve approach, and some filters need some swizzling to get working. I use Cg for the shaders.
But now I’ve come to a point where i need to warp the image using linear interpolation. Haven’t I used the packed format, it would’ve been trivial, just enable GL_LINEAR and change some coordinates, but if I do that with the packed format, the result is horrific.
I could solve it by interpolating manually by writing a fairly complex pixel shader, but that whould involve som heavy swizzling and lots of branching.
Another solution would be to “unpack” the image, transform it with GL_LINEAR, and then pack it again.
I’m not really happy with any of these solutions, none of them would be very efficent. Is there any other way of doing it? Is there some expansion to OpenGL that lets me use GL_LINEAR on my kind of “packed” image format?