I want to share my experience and some code changes I did to rawopint.lua in this and the next post.
Thanks for doing this and sharing it.
For a better understanding of the settings/parameters ui_bv_ev_shift_pct, ui_bv_ev_shift_base_e, ui_ev_shift_e I did a bit of reverse engineering by gradually changing one parameter and then recording a sunset and so forth.
As I mentioned earlier
ui_ev_shift_e is
a bit broken. This could be a confounding factor trying to understand the other values.
I attached a pdf with the plots of the ui_bv_ev_shift_pct changes from 2% to 80%, which I think could be also interesting to others for the understanding of this functionality.
For my kind of timelapse a value of about 16-24% is best depending on the ui_bv_ev_shift_base_e and ui_ev_shift_e parameters. At the beginning it was quite strange that high values would overexposed the image in daylight. But in the end it makes sense since it lowers the exposure when it's dark and rises the exposure when it is higher than the "neutral" exposure. The ui_bv_ev_shift_base_e did basically the same as the ui_bv_ev_shift_pct.
bv_ev_shift_base and bv_ev_shift_pct
shouldn't be equivalent in the general case. base should define the Bv value (derived from meter and exposure) where the effect of bv_ev_shift is 0, regardless of the bv_ev_shift_pct value. Bv is an absolute measure of the amount of light, where a scene in full daylight would typically be around 10 APEX.
Looking at your plots, I guess bv_ev_shift_base_bv is APEX 4? I would generally set it around the brightest you expect the scene, since you don't want to overexpose much, but meter and overexposure limits should stop it from going too far.
In your examples, bv_ev_shift crosses the origin right around where bv96 crosses 400. When Bv is higher, it pushes exposure brighter, and when it's lower, it pushes it darker, subject to the meter thresh/limit values (and I think a bit confused by the ui_ev_shift values, but it's hard to say without the actual log).
An other topic was the under_expo_weight, over_exp_weight. As far as I understand for my type of sunset it is best to switch this two parameters off and only relay on the meter exposure, because I think that if a bright cloud comes into the frame the hole frame should not darken.
I would set the "thresh_frac" values to 0 if you want to completely disable under or over protection. This should completely disable all the related calculations.
For sunrise/sunset, I might disable under (or set very large % and low ev limit), but I would probably not disable over. If the scene is half bight sky and half shadowed land, you probably want the sky not to be totally blown out, even when the land is dark.
What does actually mean a rise of the meter weight from 100 to say 200? I attached a plot where exactly that happens but I could not see any changes in the timelapse video itself..
The weights are arbitrary numbers that determine the relative influence of the meter and over / under exposure, subject to various limits. The key line is
ev_change = (ev_change*meter_weight - self.ev_change_max*over_weight + self.ev_change_max*under_weight)/(meter_weight + over_weight + under_weight)
ev_change is the difference between the meter value and the target value, clamped to +/-ev_change_max.
over_weight and under_weight are calculated from the percentage of over and under exposure, such that they reach 100 when "thresh" is reached, and quickly ramp up to 200 after that. You can see if over and under are 0, then ev_change is unaffected. Meter weight starts at 100, and ramps up to 200 between from thresh to limit.
The intent is that the three factors will tend balance in the range defined by the thresh and meter limit values, without any sudden transitions triggered by if/else logic. For example, if overexposure is at the "thresh" value, it will balance with meter the thresh value in the opposite direction, and if that is exceeded, push meter to the limit value without allowing much more overexposure.
The actual change in any given frame is limited to ev_change_max.
I haven't tested much with the weights at non-default values. I'd generally use the thresh / limit and over / under fractions instead.
The last part I'm not sure is, if whether the ui_meter_width_pct and ui_meter_height_pct are dependent on the selected image format. E.g. if I choose 1:1 or 16:9 image format stays the area that rawopint uses to calculate the exposure always the same?
Anything related to size/position in rawopint refers to the full raw buffer. So if you use a different jpeg aspect ratio than the native sensor resolution, you'll have to account for that yourself.