any meaning to sv, tv, bv, or av values?

  • 4 Replies
  • 2887 Views
any meaning to sv, tv, bv, or av values?
« on: 09 / April / 2009, 17:12:12 »
Advertisements
i'm working on a script which relates sv, tv, bv, and av values through functions such as get_bv96(), etc. unfortunately these values seem a bit arbitrary to me. i can find some documentation regarding set_av and set_tv which shows a small range of integers but others, particularly tv ranges quite a bit. perhaps because the script uses set_prop(propcase.TV,tv) ?

*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: any meaning to sv, tv, bv, or av values?
« Reply #1 on: 10 / April / 2009, 06:14:44 »
Well this is not complete, but a start... I didn't have the time to go to ISO yet or to check that Av commands behave identically to Tv or to check all get_* commands, or to document how propcases behave on a570 (I can't speak for others) in each shooting mode...

All ?v96 values are ?v values from the APEX system multiplied by 96 for finer precision using integer math. Link to APEX system description can be found here, I guess you already have seem it: http://chdk.setepontos.com/index.php/topic,3208.msg29878.html#msg29878.

There's a long standing bug in setting a ?v96 zero using some of the set_?v* scripting commands, but it is only a problem with Tv (tv96=0 equals to 1 second exposure, for Av and Sv 0 is out of our camera's ranges, ISO 3.125 and f/1.0).

All possible aperture, shutter speed and ISO settings that are available without CHDK are listed in tables in CHDK source code platform/*/shooting.c, with three values each:
  "id", small integer for enumeration in CHDK (not related to APEX),
  "prop_id", value matching each of these settings in Canon's propcases, which happen to be 96 * APEX ?v values,
  "name", the usual user representation for use in a string, for ISO this includes "HI" and "Auto".
 
Table for Tv also has shutter speed in microseconds listed as a fourth field (from the name, found in include/platform.h one can see that it supposedly has something to do with dark frame duration, but I didn't dig deeper and it's not used by script commands).


From lib/ubasic/ubasic.c one can quickly find which CHDK C function each ubasic command calls. I didn't check Lua, but for now let's assume they are all implemented and call the same functions:

Tv and Av have similar function sets, I'm only listing tv and I'm assuming the functions work similarly:

set_tv96_direct -> shooting_set_tv96_direct((short int)to, SET_LATER);
set_tv96 -> shooting_set_tv96((short int)to, SET_LATER);
set_user_tv96 -> shooting_set_user_tv96((short int)to);
set_user_tv_by_id -> shooting_set_user_tv_by_id(to)
set_user_tv_by_id_rel -> shooting_set_user_tv_by_id_rel(to)

ISO/Sv is a bit different:

set_sv96 -> shooting_set_sv96((short int)to, SET_LATER);
set_iso_market -> shooting_set_iso_market(to);
set_iso_real_delta_from_base -> shooting_set_iso_real_delta_from_base(to);
set_iso_real -> shooting_set_iso_real(to, SET_LATER);
set_iso_mode -> shooting_set_iso_mode(to);


Now, what do these C functions do? They can be found in platform/generic/shooting.c and they manipulate propcases found in Canon firmware.

Canon firmware uses them in many ways, depending on operating mode. The most usual way is that they are set by autoexposure during half press. Thus to override autoexposure these propcases typically must be set after autoexposure is finished. That's why many of those calls above have a "SET_LATER" tag: it makes CHDK wait until we're just about to open the shutter and only then it overrides the propcase. Otherwise Canon firmware would just overwrite it and the command wouldn't have any effect.


set_tv96_direct -> shooting_set_tv96_direct((short int)to, SET_LATER);

Makes CHDK set PROPCASE_TV (apex Tv * 96) to the input value, but since it's SET_LATER, its not usually equivalent to set_prop(PROPCASE_TV, tv96).

NOTE: If input is 0, I think this fails due to a bug (in platform/generic/shootin.c function shooting_expo_param_override(), a non-zero value of photoparam_put_off.tv96 is required for it to call shooting_set_tv96 with SET_NOW in a script). For Av, set_av96_direct shouldn't have this problem because av96=0 is larger than our camera's capabilities, unless someone attempts to set maximum aperture by calling with zero.


set_tv96 -> shooting_set_tv96((short int)to, SET_LATER);

Scans thru the "prop_id" list of tv96 values from platform/*/shooting.c and if input matches one of those, shooting_set_tv96_direct() is called with SET_LATER. If no match is found in that list, this function does nothing.

I find this command useless and confusing because it's name implies it might do something with an arbitrary integer input. Only use it in with values you get from get_tv96 by the same script.
get_tv96 is equivalent to get_prop(PROPCASE_TV).


set_user_tv96 -> shooting_set_user_tv96((short int)to);

For cameras without a Tv mode / manual mode in which Tv can be set this does not do anything.

For cameras that have Tv modes, this command scans the "prop_id" list of tv96 values and immediately sets PROPCASE_USER_TV. This propcase holds the setting from Canon user interface when the camera is in Tv mode or M mode (the kind of M mode that is actually manual and allows setting Tv, not the kind of automatic mode that's found on tx1, misleadingly called M). When in one of these modes, Canon firmware copies the value of PROPCASE_USER_TV to PROPCASE_TV during half shoot, and it is then used.

I'm not sure if that prop_id list scanning and matching is necessary. Maybe it is, maybe it varies with camera models, maybe it isn't.

This command is not very useful (especially since it doesn't do anything with the most easy to use camera models), but it may be useful for interactive scripts, because I think setting it immediately causes the live view image to adapt. Still, since it scans the "prop_id" list and ignores any tv96 value that's not one of Canon's presets, I wouldn't recommend using this command much, but set_user_tv_by_id and *_rel instead (basically you should only feed this command values you have acquired using the matching get_* command earlier by the same script).

Similarly, get_user_tv96 is equal to get_prop(PROPCASE_USER_TV), but for cameras without Tv modes it returns 0.


set_user_tv_by_id -> shooting_set_user_tv_by_id(to)

Is very similar to set_user_tv96, but instead of scanning the "prop_id" list, it scans the "id" list. Since id's are incremented and decremented without gaps, incrementing and decrementing a current value acquired using the matching get* command will always make the photo darker or lighter. However, if you exceed Canon's user interface limits with your integer, nothing happens i.e. you can't use this command to exceed Canon's limitations for Tv.


set_user_tv_by_id_rel(increment) -> shooting_set_user_tv_by_id_rel(to)

Is pretty much equivalent to set_user_tv_by_id (increment + get_user_tv_id() ) and again, only works in Tv/M modes for cameras that have those.


Re: any meaning to sv, tv, bv, or av values?
« Reply #2 on: 10 / April / 2009, 18:27:45 »
i guess what i find most interesting about the v96 values is how they simplify math. i've been taking a close look at this equation from fbonomi sunset script -

tv=bv-av+sv

is it really as simple as it looks? does that equation work as is?

still need to give your response a closer read. this is fascinating stuff.

*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: any meaning to sv, tv, bv, or av values?
« Reply #3 on: 10 / April / 2009, 18:45:49 »
tv=bv-av+sv

is it really as simple as it looks? does that equation work as is?

I believe it is, that's the beauty of the APEX system... you can find that equation (among other things) from APEX.pdf from that link in the previous post.


*

Offline fbonomi

  • ****
  • 469
  • A570IS SD1100/Ixus80
    • Francesco Bonomi
Re: any meaning to sv, tv, bv, or av values?
« Reply #4 on: 11 / April / 2009, 04:45:39 »
The apex.pdf file is here:
http://doug.kerr.home.att.net/pumpkin/APEX.pdf

Excel files to convert from Sv to ISO and from TV to seconds:
http://www.francescobonomi.it/?q=ballon-photography-CHDK-scripts
        the direct link to files:
        http://www.francescobonomi.it/sites/francescobonomi.it/files/Tv-Sec.xls
        http://www.francescobonomi.it/sites/francescobonomi.it/files/Sv-ISO.xls

Quote
is it really as simple as it looks? does that equation work as is?

Well, the idea behind the APEX systemo is to use unusual units of measure in order to make the calculations simple :-)


 

Related Topics