I'm trying to solve the following problem. I got a "low frequency" input 2D signal over a square region. I'll collect a few samples, somewhere around 10-30 maybe, the exact sample count will be dynamic. Then I want to compress this to much less data and later reconstruct the square representation. The compression will only occur once but the decompression multiple times. Performance is essential. So I need a method that compress fast, but decompress faster and to a compact format so the data transfer won't become the bottleneck.

The actual application: It's for real-time computer graphics processed on a GPU. I compute samples of lighting in a vertex shader. Then the data transfers to a pixel shader where it gets reconstructed. I will accept a certain amount of error as long as the result is "blurry", i.e. no sharp artifacts. Also transcendental functions are somewhat slow on a GPU (even though a slim transcendental representation will beat any verbose solution ofc)

I've been thinking about several methods. Maybe something fourier based. I could use a standard fourier series in its power series form, e^i(mx+ny) but that would require n^2-1 params to be handled right? Does it exist some basis function that's less verbose in 2D? Or in general more suited for this kind of thing?

Maybe I could do something related to curve fitting (plane fitting). Or maybe something completely different altogether. Anyone with a suggestion?


  • $\begingroup$ If I understand you correctly, 10-30 samples is already incredibly compressed for an image. How are you talking these samples? $\endgroup$ – Rodney Price Sep 18 '17 at 20:14
  • $\begingroup$ I meant "taking these samples." Autocorrect strikes again. $\endgroup$ – Rodney Price Sep 18 '17 at 20:16
  • $\begingroup$ It's a lighting equation that I'll compute at points distributed across the surface of the quad. The variation is usually quite low frequency so I think it might be ok, but possibly I can go a little higher than 30. $\endgroup$ – user3619622 Sep 18 '17 at 20:32
  • $\begingroup$ I might have to bow out then, because I know very little about computer graphics. I would suggest, however, that you sample your image much more densely than you think you need, then do the 2D FFT, and look at the frequency response. If it's all concentrated in only a few coefficients, them that's how you compress it. Sample just enough to get those few coefficients in your code. It's difficult to imagine that you will get fewer coefficients than 10-30, however, especially since the FFT coefficients are complex. You might also try a 2D wavelet transform, sampled densely again. $\endgroup$ – Rodney Price Sep 18 '17 at 20:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.