From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: Date: Sun, 30 Nov 2008 20:00:33 -0200 From: "Iruata Souza" To: "Fans of the OS Plan 9 from Bell Labs" <9fans@9fans.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline Subject: [9fans] image/memimage speed Topicbox-Message-UUID: 53f6be4c-ead4-11e9-9d60-3106f5b1d025 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