Re: Shrinking bitmaps

new topic     » goto parent     » topic index » view thread      » older message » newer message

Graeme,

I do not want to get into another stupid argument across the Tasman, rugby
and cricket fanatics generate enough of them already, but have done any
tests to support your claims?

I just did a quick speed test expanding a 64x64 bitmap to twice its size,
and my *unoptimized* routine seems to be almost 4 times faster than yours. I
could not compare speeds for shrinking, which was the required
functionality, because your routine, as it is, cannot do it.

I have not attempted any measurements regarding memory usage, but casual
inspection reveals that there should be no significant difference between
the two offerings.

jiri

----- Original Message -----
From: "Graeme" <graemeburke at hotmail.com>
To: "EUforum" <EUforum at topica.com>
Sent: Monday, February 04, 2002 1:49 AM
Subject: Re: Shrinking bitmaps


>
> At 07:45 PM 2/3/02 +1300, you wrote:
> >
> >Hi, Jasper,
> >
> >many moons ago, well before this forum became a YAWN (Yet Another Windows
> >Nightmare - jiri' tm), I suggested the following simple-minded approach
to
> >scaling of sequences. For the sake of clarity, some rather obvious
> >optimizations are not implemented (special cases, unrolling of critical
> >routines, etc), but it is still more than 10 times faster than Mr Trick's
> >offering, which otherwise seems to work quite well.
> >
> >jiri
> >
>
> Here's mine. For shrinking bitmaps use jiri's offering, if you want to
make
> them bigger, this routine is considerably faster,and uses a lot less
memory too.
>
> graeme
>
>
> global function resize(sequence bmp,sequence dim)
>     -- HMI Image Re-Size V2
>     sequence tx, -- template for x expansion
>              rx, -- x-expanded bitmap
>              r,  -- return (expanded) bitmap
>              l   -- temp line container
>     atom d
>
>     -- make x template
>     tx=repeat(0,dim[1])
>     d=length(bmp[1])/dim[1]
>     for x=1 to dim[1] do
>         tx[x]=floor(x*d)+1
>     end for
>     tx-=(tx>length(bmp[1]))
>
>     -- expand x
>     l=repeat(0,dim[1])
>     rx=repeat(l,length(bmp)+1)
>     for y=1 to length(bmp) do
>         r=bmp[y]--borrow r as temp ptr
>         for x=1 to dim[1] do
>             l[x]=r[tx[x]]
>         end for
>         rx[y]=l
>     end for
>     rx[length(rx)]=l
>
>     -- expand y
>     r=repeat(rx[1],dim[2])
>     d=length(bmp)/dim[2]
>     for y=2 to dim[2] do
>         r[y]=rx[floor(y*d)+1]
>     end for
>
>     return r
>
> end function
>
>
>
>

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu