🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: sci.image.processing
Article #272

Re: image processing loops: a c programming question

#272
From: Mark D. Shattuck
Date: Fri, 07 Aug 1992 19:40
42 lines
1473 bytes
In article <SLEHAR.92Aug7111245@kendall.bu.edu> slehar@kendall.bu.edu (Steve Lehar) writes:
>
>I    have given much  thought to    an agonizing  trade-off in   image
>processing   loops in   c,  and have   not  come   up with a   totally
>satisfactory solution-   I wonder  whether    anyone  has  any    good
>suggestions.

	How about this:

  /**** in main program ****/
  unsigned char **data;
	.
	.
	.
  data = (unsigned char **)calloc(xsize,sizeof(unsigned char **));
  data[0] = (unsigned char *)calloc(xsize*ysize,sizeof(unsigned char *));
  for (i=1;i<xsize;i++){
     data[i] = data[i-1] + ysize;
  }
	.
	.
	.
  subroutine(data,xsize,ysize)
  int xsize,ysize;
  unsigned char **data;
  {
    int x,y;

    for(y=0;y<ysize;y++){
      for(x=0;x<xsize;x++){
	data[x][y] = ...
      }
    }
  }

	BTW, I just typed this in.  It did not come from working
code.



-- 
	mark shattuck (mds@phy.duke.edu)
Technical Details
Message-ID: <4348@news.duke.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!sun-barr!ames!stanford.edu!rock!concert!duke!news.duke.edu!phy.duke.edu!mds
References: <SLEHAR.92Aug7111245@kendall.bu.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!sun-barr!ames!stanford.edu!rock!concert!duke!news.duke.edu!phy.duke.edu!mds
From: mds@phy.duke.edu (Mark D. Shattuck)
Newsgroups: sci.image.processing
Subject: Re: image processing loops: a c programming question
Message-ID: <4348@news.duke.edu>
Date: 7 Aug 92 19:40:06 GMT
References: <SLEHAR.92Aug7111245@kendall.bu.edu>
Sender: news@news.duke.edu
Distribution: sci.image.processing
Organization: Duke University Physics Dept.; Durham, N.C.
Lines: 42
Nntp-Posting-Host: noise.phy.duke.edu