HDR bracketing glitch when exposure compensation set at non-whole values

Issue #2119 resolved
Bofei Cao created an issue

When shooting at, for example, +2/3 exposure compensation at 3 shots, 3 stop step, the exposures should be: +2/3, -2 1/3, +3 2/3 But they are: +2/3, 0, +3 2/3

Same goes for any other non-whole exposure compensation.

Problem lies in shoot.c, function expo_value_rounding_ok the line int r = raw % 8; should be int r = (raw % 8 + 8) % 8;

This is because the mod of a negative number is negative! For example, the current code (and mathematicians) expects -5 % 8 to be 3, but it in fact evaluates to -5 in the code.

I'm not experienced with the project so don't want to commit the change myself. Hopefully you can review and evaluate!

Comments (2)

  1. Alex

    Good catch, forgot about this quirk. I mostly use the MOD macro, which works as mathematicians would expect, but this went unnoticed.

    edit: in this case, I think the check should be ABS(raw) % 8. Didn't try it yet, but I expect symmetrical behavior for positive/negative EC.

  2. Log in to comment