Saving and restoring custom white balance - General Discussion and Assistance - CHDK Forum supplierdeeply

Saving and restoring custom white balance

  • 6 Replies
  • 4477 Views
*

Offline srsa_4c

  • ******
  • 4451
Saving and restoring custom white balance
« on: 24 / January / 2015, 11:18:04 »
Advertisements
Followup of this post: http://chdk.setepontos.com/index.php?topic=10114.10#msg120143

I have finally found the buffer that seems to hold the custom white balance data. Both live view and stills use it. Changes to its content are immediately visible on live view and stills when WB is set to custom on the Canon UI.
The buffer contains all related data, cameras with 2 custom WB settings have a double size buffer.
The very same kind of data is saved in flash ROM when the user takes a WB-shot with the Canon controls.
Changes to the buffer are not saved, so manipulating its content should be relatively safe.

Simple test, camera dependent (I'm using uncached RAM that is shadowed by the instruction TCM and therefore never used).
First execution backs up current WB data, subsequent executions overwrite the WB buffer with the backed up data.

Code: [Select]
-- Camera: a3200 only
uncached=0x40000000 -- CAM_UNCACHED_BIT from stubs_entry.S, also used as location of the persistent flag
backup=uncached+0x10 -- location for WB data backup copy
magic=0x11121314 -- magic value, not likely occuring in uninitialized RAM

buf=0x557b0 -- custom wb runtime buffer
lngth=0x40 -- custom wb data length

what=peek(uncached)
if what ~= magic then
    if call_event_proc("System.Create") == -1 then
        error("System.Create failed")
    end
    call_event_proc("memcpy",backup,buf,lngth) -- back up custom WB prop
    poke(uncached,magic) -- set flag
else
    call_event_proc("memcpy",buf,backup,lngth) -- replace custom wb data with backed-up copy
end
Now, the question is:
How should we use this?
I'm thinking about providing a facility that allows saving and restoring the buffer. The data should be tagged to prevent loading on incompatible cameras.

Suggestions are welcome. It would also be nice to know how it works on other models.

Attachment: an svn diff that contains the buffer address and length for almost all DryOS cameras (exception: S5IS) and most VxWorks cameras (except the earliest few models).
example, a3200:
// WB property, details correct: ID=2, length=64, buffer @ 0x557b0

edit:
updated attachment
« Last Edit: 25 / January / 2015, 18:18:54 by srsa_4c »

*

Offline dvip

  • ****
  • 451
Re: Saving and restoring custom white balance
« Reply #1 on: 24 / January / 2015, 23:22:55 »
Nice! Great job with WB data.

I wonder if there are other buffers that hold the current focal length, shutter speed, aperture, and ISO.
Then from a script we could save/restore settings.

Re: Saving and restoring custom white balance
« Reply #2 on: 24 / January / 2015, 23:49:49 »
I wonder if there are other buffers that hold the current focal length, shutter speed, aperture, and ISO.
Ummm .. I kinda think those are available via know propcases ?
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline dvip

  • ****
  • 451
Re: Saving and restoring custom white balance
« Reply #3 on: 24 / January / 2015, 23:54:09 »
 focal length?
save/restore current settings?


Re: Saving and restoring custom white balance
« Reply #4 on: 25 / January / 2015, 09:23:08 »
focal length?
dof.eff_focal_length from get_dofinfo() in Lua or just get_focal_length in uBASIC ?

Quote
save/restore current settings?
Where this makes sense, there are a lot of scripts that do that using standard Lua file i/o calls.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline dvip

  • ****
  • 451
Re: Saving and restoring custom white balance
« Reply #5 on: 25 / January / 2015, 11:38:50 »
>there are a lot of scripts that do that using standard Lua file i/o calls.

Please show me one that saves/restores current focal length, perhaps I am missing something.

Re: Saving and restoring custom white balance
« Reply #6 on: 25 / January / 2015, 11:57:53 »
Please show me one that saves/restores current focal length, perhaps I am missing something.
AFAIK, you can't set the focal length directly.  But you could write a simple script to adjust the zoom position and read back the focal length until you get as close as the lens mechanism will let you.  Or create a lookup table to do the same thing.
« Last Edit: 25 / January / 2015, 11:59:37 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal