home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / sys / mac / programm / 18368 < prev    next >
Encoding:
Text File  |  1992-11-13  |  2.2 KB  |  55 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!caen!sol.ctr.columbia.edu!sol.ctr.columbia.edu!mhall
  3. From: mhall@mark1.comp.sys.mac.programmer (Matthew Hall)
  4. Subject: FAST fixed point math?
  5. Sender: nobody@ctr.columbia.edu
  6. Organization: Oberlin College Computer Science
  7. Date: Fri, 13 Nov 1992 15:46:42 GMT
  8. Message-ID: <MHALL.92Nov13104642@mark1.comp.sys.mac.programmer>
  9. Distribution: comp.sys.mac.programmer
  10. X-Posted-From: mark1.cs.oberlin.edu
  11. NNTP-Posting-Host: sol.ctr.columbia.edu
  12. Lines: 41
  13.  
  14. Hello-
  15.     Right now, I am working on some sound analysis software.  I
  16. want to seperate a sound into frequency bins, which I can do, however
  17. I do it very slowly.  I have tried using the math coprocessor and
  18. apples built in fixed point math, but either method I choose, the time it takes
  19. to create to compute each frequency bin is at least as long as the
  20. sound (and there are enough freqeuncy bins to make this really slow).
  21.  
  22. The main loop of my procedure is:
  23. for i:=1 to soundlength do
  24. begin
  25.   x:=x+samplenumber[i]; {the sample is converted to -128..127 first}
  26.   xTemp:=r*(a*x-b*y);
  27.   y:= r*(b*x+a*y);
  28.   x:=xtemp;
  29. end;
  30.  
  31. I disassembled this - I don't think it will get much faster with the
  32. FPU if I code it in assembly.  Maybe twice as fast.  However, when I
  33. disassembled the Fixed point version, I saw that for each
  34. multiplication, it took 35 operations.  With 6 multiplications, plus
  35. the extra stuff, it was over 250 operations (oops, I just saw myself
  36. being boneheaded.  I can combine r*a and r*b before the loop) well,
  37. it'll be over 170 operations per sound sample.
  38.     Now, does anyone have any blazingly fast fixed point assembly
  39. code?  I know that fixed point math can be faster than the math
  40. coprocessor (in this case, with the traps, it was much slower, but I
  41. have seen programs where it surpassed the math coprocessor by quite a
  42. margin) It does not need to do any error checking, as my data
  43. shouldn't cause errors.  I would really like to speed this process up.
  44.  
  45. Thank you,
  46. matt hall
  47.  
  48. --
  49. -------------------------------------------------------------------------------
  50. Matt Hall.    mhall@occs.oberlin.edu  OR  SMH9666@OBERLIN.BITNET
  51.               (216)-775-6613 (That's a Cleveland Area code. Lucky Me)
  52.  
  53.                          F(X)=M*X*(1-X)  
  54.  
  55.