supplierdeeply

New Mandelbrot generator released

  • 6 Replies
  • 1145 Views
New Mandelbrot generator released
« on: 28 / September / 2014, 07:41:34 »
Advertisements
So, to get me introduced to developing with CHDk I wrote the titular code.

https://github.com/MarquisdeGeek/chdk-mandlebrot

It's an obvious hack from the mandelbrots I've written over the years, but it works. But by way of a question, if there's any more idiomatic methods of writing the same code, I'm happy to hear them!

Steev

Re: New Mandelbrot generator released
« Reply #1 on: 28 / September / 2014, 09:41:50 »
From the link :
Quote
What I did was add the files into the games directly directory, and amend the Makefile by replace all instances of the word 'snake' with 'mandelbrot'. There's probably a simpler command line incanation though...
I guess it goes without saying, but if you added the word  'mandelbrot' everywhere you found the word 'snake' (rather than replace it),  then all you would need to do is create a patch file and submit this for consideration for inclusion in the svn/autobuild.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline srsa_4c

  • ******
  • 3538
Re: New Mandelbrot generator released
« Reply #2 on: 28 / September / 2014, 17:47:31 »
The pre-built .flt is not working on current CHDK 1.3 trunk.
The following changes are needed to make it work:
- copy mandelbrot.c to modules/games
- 3 floating point related library functions need to be added to the export list (OR one could reverse some of the r3241 changes to modules/Makefile to include library functions in the module)
Code: [Select]
Index: modules/module_exportlist.c
===================================================================
--- modules/module_exportlist.c (revision 3629)
+++ modules/module_exportlist.c (working copy)
@@ -48,6 +48,9 @@
             __ltdf2,
             __gtdf2,
             __bswapsi2,
+            __addsf3,
+            __subsf3,
+            __gtsf2,
 
             module_get_adr,
             module_exit_alt,
Index: modules/module_load.c
===================================================================
--- modules/module_load.c (revision 3629)
+++ modules/module_load.c (working copy)
@@ -85,7 +85,11 @@
 extern void __ltdf2(void);
 extern void __gtdf2(void);
 extern void __bswapsi2(void);
+extern void __addsf3(void);
+extern void __subsf3(void);
+extern void __gtsf2(void);
 
+
 //********************************************************/
 
 // Struct for symbol hash table entries
- modules/Makefile needs these changes (note that modules should have 8.3 names for DryOS compatibility):
Code: [Select]
Index: modules/Makefile
===================================================================
--- modules/Makefile (revision 3629)
+++ modules/Makefile (working copy)
@@ -23,7 +23,7 @@
 # to avoid 'long_call' overhead
 FLTS=fselect.flt edgeovr.flt curves.flt mpopup.flt palette.flt grids.flt mdetect.flt zebra.flt \
      _dng.flt benchm.flt calend.flt 4wins.flt mastmind.flt reversi.flt sokoban.flt _rawop.flt \
-     txtread.flt memview.flt modinsp.flt tetris.flt snake.flt sudoku.flt _tbox.flt _osd_le.flt \
+     txtread.flt memview.flt modinsp.flt tetris.flt snake.flt mandelbr.flt sudoku.flt _tbox.flt _osd_le.flt \
      _hexbox.flt ubasic.flt lua.flt cpuinfo.flt useredit.flt eyefi.flt histo.flt
 
 all: $(FLTS)
@@ -78,6 +78,7 @@
 reversi.flt: gui_reversi.o
 tetris.flt: gui_tetris.o
 snake.flt: gui_snake.o
+mandelbr.flt: mandelbrot.o
 sokoban.flt: gui_sokoban.o
 sudoku.flt: gui_sudoku.o
 
@@ -90,6 +91,7 @@
 gui_reversi.o: games/gui_reversi.c games/simple_game.c
 gui_tetris.o: games/gui_tetris.c games/simple_game.c
 gui_snake.o: games/gui_snake.c games/simple_game.c
+mandelbrot.o: games/mandelbrot.c games/simple_game.c
 
 cpuinfo.o: simple_module.c
 

Re: New Mandelbrot generator released
« Reply #3 on: 29 / September / 2014, 15:55:50 »
I shall look at submitting a patch later. I've made a few other changes, in addition to the 8.3 suggestion (from srsa_4c). I'm not sure which version I took, ATM, as __gtdf2 doesn't appear in my modules_exportlist.c file. (I hope I'm not too far behind on my versions!)

S.


*

Offline srsa_4c

  • ******
  • 3538
Re: New Mandelbrot generator released
« Reply #4 on: 29 / September / 2014, 17:45:56 »
I'm not sure which version I took, ATM, as __gtdf2 doesn't appear in my modules_exportlist.c file. (I hope I'm not too far behind on my versions!)
The official CHDK project page is here, the svn repo is here.

Re: New Mandelbrot generator released
« Reply #5 on: 15 / October / 2014, 17:05:06 »
svn checkout done. Patch made. Code tested. It's almost ready, although I can't create a ticket in assembla to add my attachment to. (And, naturally, I've no commit rights.)

So I've added here for safe keeping, until I've found the right piece of documentation to get me moving again!


*

Offline srsa_4c

  • ******
  • 3538
Re: New Mandelbrot generator released
« Reply #6 on: 18 / October / 2014, 10:57:57 »
It works well*, looks much better with the aspect ratio fix.
Since you've switched to doubles, the 3 extra (single precision related) exported functions are not needed. I have also removed noise caused by an extra space from the Makefile diff.
I was thinking about making this a CPU benchmark, but ...
- measuring the computation time would only make sense on the default view
- the differing bitmap overlay resolution of various cameras would make direct comparison useless

* there is one small issue: the white color doesn't get inverted, the cursor disappears in large white areas

Since the impact on CHDK core is minimal (one menu item), I see no reason why this shouldn't be added.

 

Related Topics