From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c329247dd63d7778 X-Google-Attributes: gid103376,public From: Alan E & Carmel J Brain Subject: Re: 1 and 2d image representations Date: 1997/10/27 Message-ID: <34556F0F.62B5@dynamite.com.au>#1/1 X-Deja-AN: 285256306 References: <344E97A8.688C@eleceng.adelaide.edu.au> Organization: @home Reply-To: aebrain@dynamite.com.au Newsgroups: comp.lang.ada Date: 1997-10-27T00:00:00+00:00 List-Id: 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