Re: [Audacity-nyquist] read-int issue
A free multi-track audio editor and recorder
Brought to you by:
aosiniao
From: Dominic M. <do...@au...> - 2005-07-01 18:12:12
|
Evan, Nyquist's version of xlisp always reads big-endian numbers, which is the opposite of what you'd normally want on an Intel (i.e. Windows or typical Linux) machine. Pass a negative number to read a little- endian integer: > (setq tempWidth (read-int filePointer -2)) > (setq tempHeight (read-int filePointer -2)) - Dominic On Jul 1, 2005, at 2:05 AM, Evan Merz wrote: > Thanks for all the suggestions, they were all good > ideas, but perhaps I'm not getting the issue right > after all.... as none of your suggestions seemed to > produce the intended results. > > I'm reading tga images, a format that is ridiculously > simple, and for which I have working C code. When I > read the height/width of certain images, however, I > get bizarre results from nyquist, that I don't get in > C. > > here's my C code: > fread(&header->width, 2, 1, inputFile); > fread(&header->height, 2, 1, inputFile); > > here's my nyquist code: > (setq tempWidth (read-int filePointer 2)) > (setq tempHeight (read-int filePointer 2)) > > In C everything works great, but in nyquist, I get > crazy numbers. > > for a while I was just dividing by 256 ( I don't > remember why) and that seemed to work on small images > - 50x1 for instance. > > But from images of diverse sizes, I get strange > numbers. Since some were large and negative, I was > assuming it was a sign thing, but after playing with > your suggestions, I can see that that doesn't appear > to be the case. > > I imagine that there's something that I'm missing in > the nyquist specification which points out a subtle > difference in how it stores numbers versus the way gnu > c does it... anyone have any ideas? > > Oh, I also read something about turning off boundary > alignment in a C compiler, because that might cause a > misinterpretation of the bytes... might something like > that be occurring here? > > thanks again, for any ideas, > > Evan Merz > > > > ____________________________________________________ > Yahoo! Sports > Rekindle the Rivalries. Sign up for Fantasy Football > http://football.fantasysports.yahoo.com > > > ------------------------------------------------------- > SF.Net email is sponsored by: Discover Easy Linux Migration Strategies > from IBM. Find simple to follow Roadmaps, straightforward articles, > informative Webcasts and more! Get everything you need to get up to > speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click > _______________________________________________ > Audacity-nyquist mailing list > Aud...@li... > https://lists.sourceforge.net/lists/listinfo/audacity-nyquist > |