9fans,

I'm playing with nearest-neighbor image resampling and wrote two
simple implementations - http://tmp.oitobits.net/iru/nn.c,
http://tmp.oitobits.net/iru/nnmem.c - one using draw(2) and the other
using memdraw(2).

running them on the same image on disk shows that nnmem is way faster:

cpu% nnmem acme.wd
spent 0.127344 seconds on resampling
cpu% nn acme.wd
spent 6.111893 seconds on resampling

looking at the code you see nn.c calls unloadimage() to fill oscan
with the data from m; oscan is then used for the interpolation. that
pass is not needed in nnmem.c because of byteaddr() gives us the
address of the first byte of data in m, the memimage in question.

what I'm seeking is a way to avoid the unloadimage() call in nn.c, if
that's possible - which, by my understanding of the manual and code,
is not.
alternatively I could try drawing the memimage to the screen, which I
did not find possible directly, only by converting it to an image.
any ideas?

sorry if I'm missing the obvious.

iru

Reply via email to