How To Dump Buffer Data Imagery??? - General Discussion and Assistance - CHDK Forum
supplierdeeply

How To Dump Buffer Data Imagery???

  • 3 Replies
  • 1373 Views
How To Dump Buffer Data Imagery???
« on: 01 / June / 2023, 17:57:31 »
Advertisements
I checked this page on Frame Buffers, https://chdk.fandom.com/wiki/Frame_buffers , and I was wondering, is there any way to dump a frame from any of these frame buffers to the SD Card?

I want to see if I can attempt to dump a live view video from the movie buffer, or the viewport buffer. Maybe get a frame from certain buffers.

I've checked everything and haven't found any commands for CHDK on how to dump any Frame Buffer data? Any ideas? Thanks!

*

Offline reyalp

  • ******
  • 14110
Re: How To Dump Buffer Data Imagery???
« Reply #1 on: 02 / June / 2023, 02:18:52 »
I checked this page on Frame Buffers, https://chdk.fandom.com/wiki/Frame_buffers , and I was wondering, is there any way to dump a frame from any of these frame buffers to the SD Card?
It's just a memory address, so you can use any of the normal file functions like write or fwrite from C code. This is how CHDK raw works.

There aren't Lua functions to write directly from memory to a file, but you can use eventprocs with call_event_proc or use call_func_ptr with addresses from stubs to access the same functions used in C.

Quote
I want to see if I can attempt to dump a live view video from the movie buffer, or the viewport buffer. Maybe get a frame from certain buffers.
The screen dump module (see https://chdk.setepontos.com/index.php?topic=14347.msg146339#msg146339 and some related background https://chdk.setepontos.com/index.php?topic=14705.msg149375#msg149375) can be used to record the live view and UI buffers, and of course chdkptp can be used if you have a USB connection.

Note that this will *not* get you faster / higher res / better video than native video recording. Quite the opposite.
Don't forget what the H stands for.

Re: How To Dump Buffer Data Imagery???
« Reply #2 on: 02 / June / 2023, 03:45:07 »
Thanks for the information, but, I'm a bit confused.
Scripts in CHDK are always .LUA or .BAS

You mentioned "C"
What you're saying is for me to make my own CHDK build with extra C code for this.
You're definitely trying to send me to my grave. Joking, but that's a little too advanced for me. :P

Also, regarding the "eventprocs with call_event_proc or call_func_ptr", this does sound like it's much simpler. Could you please maybe give me a little explanation on this. I read through it, and it reminded me when I was debugging in a Commodore64, and I am known for causing CPU Halts, so, haha, I don't want to mess up my camera. I just need something in terms of context. I'm not exactly sure about the syntax, since there isn't a lot of documentation on CHDK, unfortunately, and I have to try guessing what something means. Thanks.

*

Offline reyalp

  • ******
  • 14110
Re: How To Dump Buffer Data Imagery???
« Reply #3 on: 02 / June / 2023, 20:15:20 »
Thanks for the information, but, I'm a bit confused.
Scripts in CHDK are always .LUA or .BAS

You mentioned "C"
What you're saying is for me to make my own CHDK build with extra C code for this.
Yes. To do the same in Lua, you essentially have to understand the C functions, and then translate their usage to Lua. OTOH, if you use Lua you don't have to figure out how to build CHDK, or where to put your changes.

Quote
Also, regarding the "eventprocs with call_event_proc or call_func_ptr", this does sound like it's much simpler. Could you please maybe give me a little explanation on this.
See https://chdk.fandom.com/wiki/Lua/Lua_Reference/Native_Function_Calls
You can find some an example in CHDK/SCRIPTS/TEST/tstcallf.lua

To write memory to a file, you could use the eventprocs Open, Write and Close (registered by SystemEventInit or System.Create, depending ont the camera). These functions generally behave similarly to the C functions described on https://pubs.opengroup.org/onlinepubs/009695399/functions/open.html (use the "See Also" links for write and close)

edit:
Note if you are using chdkptp, you can use the rmem command to dump camera memory directly to a file on your PC with the -f option, and of course, you can use lvdump and lvdumpimg to get the live view or UI buffers.
« Last Edit: 02 / June / 2023, 20:17:30 by reyalp »
Don't forget what the H stands for.


 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal