Author Topic: [Prizm C] Mandelbrot Set  (Read 10065 times)

0 Members and 1 Guest are viewing this topic.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: [Prizm C] Mandelbrot Set
« Reply #15 on: September 24, 2013, 12:53:31 am »
Darn that renders quite fast too!

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: [Prizm C] Mandelbrot Set
« Reply #16 on: September 24, 2013, 09:37:37 am »
I haven't gotten to look at the code much, but I imagine that it is the difference between using integer or fixed point math and floating point.

Offline ProgrammerNerd

  • LV3 Member (Next: 100)
  • ***
  • Posts: 50
  • Rating: +9/-2
    • View Profile
Re: [Prizm C] Mandelbrot Set
« Reply #17 on: September 25, 2013, 02:13:31 pm »
Yes fixed point math is part of the speedup however I would like you to take note of the comments in the function called ManIt() as you can see I credited the websites http://locklessinc.com/articles/mandelbrot/ and https://randomascii.wordpress.com/2011/08/13/faster-fractals-through-algebra/
The first website contains some nice "early exit" code which speeds things up a lot.
The second website contains some code to reduce the amount of multiplications needed. There are still some optimizations that I don't take advantage of such as the fact that 1/4 of the pixels are already calculated and don't need to be redrawn again. I already fixed that but there is still lots more work to be done before the next release.
Also Xeda112358 what is up with your plot function?
Code: [Select]
void plot(int x0, int y0, int color) {
   char* VRAM = (char*)0xA8000000;
   VRAM += 2*(y0*LCD_WIDTH_PX + x0);
   *(VRAM++) = (color&0x0000FF00)>>8;
   *(VRAM++) = (color&0x000000FF);
   return;
}
Should be
Code: [Select]
inline void plot(unsigned short x0, unsigned short y0, unsigned short color) {
   unsigned short* VRAM = (unsigned short*)0xA8000000;
   VRAM += (y0*LCD_WIDTH_PX) + x0;
   *VRAM = color;
}
Not tested but should work. I access VRAM as unsigned short in my program and it draws just fine. The reason for the change is because your function seems kind of inefficient not to cause offense but just giving optimization tips.
« Last Edit: September 25, 2013, 02:20:02 pm by ProgrammerNerd »

Offline flyingfisch

  • I'm 1337 now!
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1620
  • Rating: +94/-17
  • Testing, testing, 1...2...3...4...5...6...7...8..9
    • View Profile
    • Top Page Website Design
Re: [Prizm C] Mandelbrot Set
« Reply #18 on: September 25, 2013, 11:18:31 pm »
wow, programmernerd, i love that fractal generator. If you could package it up with a menu, and maybe put a help file in with it, that would be great! ;)



Quote from: my dad
"welcome to the world of computers, where everything seems to be based on random number generators"



The Game V. 2.0

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: [Prizm C] Mandelbrot Set
« Reply #19 on: September 26, 2013, 07:55:34 am »
And thanks for the tips, links, and optimisation! Optimisation is one of my favorite things to do for the Z80 calcs (I am primarily a Z80 assembly programmer). I think I found the routine on the Prizm Wiki, though I may have modified it more (I cannot remember). I also never tried testing for periodicity, though I am quite familiar with it (I even took a semester course in fractals and chaotic systems). I planned to write a program for the platform I am more familiar with and then port it to the Prizm to try out the optimisations.

Offline Vijfhoek

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 120
  • Rating: +13/-1
    • View Profile
Re: [Prizm C] Mandelbrot Set
« Reply #20 on: September 26, 2013, 10:35:14 am »
I am curious about how fast this would be in computer Lua on a 150 MHz computer with 64 MB of RAM compared to the Lua TI gave us.

Won't be a fair comparison since x86 has a better IPS, it'd be better if someone ported "computer Lua" to the Nspire.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: [Prizm C] Mandelbrot Set
« Reply #21 on: October 09, 2013, 12:29:24 am »
Yeah that's what I thought too. This also reminds me, a few years ago BrandonW wanted to rewrite the entire TI-83 Plus BASIC parser from scratch so it runs at reasonable speeds per 6 MHz standards, but sadly I don't know how far that went. It was before Axe programmers started to outnumber BASIC coders, IIRC.
« Last Edit: October 09, 2013, 12:29:53 am by DJ Omnimaga »