From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: Date: Sun, 30 Nov 2008 21:54:56 -0200 From: "Iruata Souza" To: "Fans of the OS Plan 9 from Bell Labs" <9fans@9fans.net> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: Subject: Re: [9fans] image/memimage speed Topicbox-Message-UUID: 5402d3da-ead4-11e9-9d60-3106f5b1d025 On Sun, Nov 30, 2008 at 8:00 PM, Iruata Souza wrote: > 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. > mostly everything here is now understood by me. sorry for the noise. iru