comp.lang.ada
 help / color / mirror / Atom feed
From: Alan E & Carmel J Brain <aebrain@dynamite.com.au>
Subject: Re: 1 and 2d image representations
Date: 1997/10/27
Date: 1997-10-27T00:00:00+00:00	[thread overview]
Message-ID: <34556F0F.62B5@dynamite.com.au> (raw)
In-Reply-To: 344E97A8.688C@eleceng.adelaide.edu.au


Richard Beare wrote:

> I'm writing some image processing software and I'm concerned about my
> use of arrays. 

> Alternatively it is possible to represent an image as a linear array
> and provide functions to perform the mapping between 1 and 2
> dimensions.
> 
> Is there a sensible way to provide both the 1 and 2 dimensional
> views of the image.

Sounds like a job for Representation clauses and Unchecked Conversion,
at first sight.

> Can anyone comment on the overhead of using a linear array and
> functions to map from two dimensions to one (and vice versa).

If performance is a big issue, then Unchecked Conversion really could be
the way to go. On many systems, the overhead is negligible. Trouble is,
of course, you can, depending on the compiler, optimise away all the
good things regarding boundary checking that Ada provides. It still
won't let you go outside the maximum size of the array, but internally,
it could.

-- 
aebrain@dynamite.com.au     <> <>    How doth the little Crocodile
| Alan & Carmel Brain|      xxxxx       Improve his shining tail?
| Canberra Australia |  xxxxxHxHxxxxxx _MMMMMMMMM_MMMMMMMMM
 abrain@cs.adfa.oz.au  o OO*O^^^^O*OO o oo     oo oo     oo  
                    By pulling MAERKLIN Wagons, in 1/220 Scale






  reply	other threads:[~1997-10-27  0:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-10-23  0:00 1 and 2d image representations Richard Beare
1997-10-27  0:00 ` Alan E & Carmel J Brain [this message]
1997-10-28  0:00   ` Samuel T. Harris
1997-11-01  0:00   ` Matthew Heaney
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox