Proposed correction to shooting.c - General Discussion and Assistance - CHDK Forum supplierdeeply

Proposed correction to shooting.c

  • 9 Replies
  • 312 Views
Proposed correction to shooting.c
« on: 27 / January / 2020, 01:40:09 »
Advertisements
Not really a feature request, but a correction.

As some will have noted, the DoF info that CHDK displays, when focused at infinity, shows the near DoF as, infinity.

The near DoF when focused at infinity is, of course, the hyperfocal.

I believe the base code change to fix this is simple, ie I don't know how simple it is to then propagate this out to all the CHDK cameras  ;)

I have flagged the changes here: https://gist.github.com/pigeonhill/006836c925bd0559783b102688b9eb11/revisions



I'm 'only' a scripter, don't compile, so I haven't checked the proposed change.

Also, I've looked through shooting.c to see if this 'error' is repeated elsewhere, and believe it isn't. So the minor change above should fix the issue.

Cheers

Garry

*

Offline reyalp

  • ******
  • 12435
Re: Proposed correction to shooting.c
« Reply #1 on: 28 / January / 2020, 23:02:47 »
Not really a feature request, but a correction.

As some will have noted, the DoF info that CHDK displays, when focused at infinity, shows the near DoF as, infinity.

The near DoF when focused at infinity is, of course, the hyperfocal.
Thanks for looking into this. I'm not against the change, but I suspect it doesn't fix the thing you want.

Your change is in shooting_get_near_limit_f around line 1007. Unless I've missed something, this function is called from exactly one place: shooting_set_focus in the conf.dof_subj_dist_as_near_limit case. The intent behind that option is not clear to me, and the manual doesn't help (https://chdk.fandom.com/wiki/CHDK_1.4.0_User_Manual#DOF_Calculator), but the value from shooting_get_near_limit_f will only impact setting subject distance.

If -1 appears in the dofinfo or the dof OSD, that comes from a different part of the code, likely starting around line 1110 in shooting_update_dof_values

One final note:
It's not really safe to assume SD == -1 is infinity focus. The camera returns -1 at some point, but there are often many steps beyond that point, and actual infinity focus may be before or after SD starts being -1.
Don't forget what the H stands for.

Re: Proposed correction to shooting.c
« Reply #2 on: 29 / January / 2020, 02:07:27 »
@reyalp

You are, of course correct, and I've updated the proposed changes on my github gist.

The update DoF part of the code starts by setting near, far and total DoFs to -1 and only updates these if you are not at infinity.

If you are at infinity, the above don't get updated and hence we have the presentational error.

Here are the changes that should fix it  ;)



Note I'm carrying on with the convention that infinity is presented as -1 in the CHDK DoF display.

*

Offline reyalp

  • ******
  • 12435
Re: Proposed correction to shooting.c
« Reply #3 on: 04 / February / 2020, 01:22:06 »
Here's a test build for G7X 100d, plus source diff.

It turns out that the DOF display had an additional check for shooting_is_infinity_distance and if it was true, displayed "inf" for distance values regardless of what the specific value was. I commented it out. I think the values all get set to -1 for inf (except for the near limit) but I'm not 100% certain.
Don't forget what the H stands for.


Re: Proposed correction to shooting.c
« Reply #4 on: 04 / February / 2020, 01:42:35 »
@reyalp

 :D

Just tested and it looks good, ie it's right now  ;)

BTW earlier you pointed out

Code: [Select]
It's not really safe to assume SD == -1 is infinity focus
Based on this, would it too much effort to differentiate the two conditions, ie -1 == infinity, but 0 == some other non defined state.

Doing this means scripts can be more refined in their tests of SD.

My guess is that this may be too difficult?

Just a thought, and once again thanks for the above.

Cheers

Garry

*

Offline reyalp

  • ******
  • 12435
Re: Proposed correction to shooting.c
« Reply #5 on: 04 / February / 2020, 02:01:07 »
Code: [Select]
It's not really safe to assume SD == -1 is infinity focus
Based on this, would it too much effort to differentiate the two conditions, ie -1 == infinity, but 0 == some other non defined state.
CHDK doesn't currently have a way to distinguish between infinity and beyond. The information must exist somewhere, but as I mentioned before the "infinity" point is not particularly well calibrated, so I'm not sure how much value it would have in practice.
Don't forget what the H stands for.

Re: Proposed correction to shooting.c
« Reply #6 on: 04 / February / 2020, 02:58:36 »
Agree :)

Re: Proposed correction to shooting.c
« Reply #7 on: 04 / February / 2020, 03:03:41 »
@reyalp

Quote
but as I mentioned before the "infinity" point is not particularly well calibrated, so I'm not sure how much value it would have in practice.

BTW this is why I use blur-based infinity focusing and why I wrote the original Magic Lantern DOFI script.

Blurs beyond 2 sensor pixels are not going to gain you much/anything, which is why DOFIZ gives you this info, thanks to CHDK, which I can't get out of ML, ie I would need to explicitly map it in for every cam.

For me, infinity is when my defocus blur is similar to the 2 sensor pixel value: all rounded of course, as we need pragmatism in our photography - although the maths and 'science' is fun  :) ;)
« Last Edit: 04 / February / 2020, 03:23:25 by pigeonhill »


*

Offline reyalp

  • ******
  • 12435
Re: Proposed correction to shooting.c
« Reply #8 on: 06 / February / 2020, 01:06:17 »
I checked this in, trunk autobuild 5417.
Don't forget what the H stands for.

Re: Proposed correction to shooting.c
« Reply #9 on: 06 / February / 2020, 01:36:07 »
@reyalp

Great. Many thanks for your efforts in continuously refining CHDK, despite, as you said to me before, the user base may be a little smaller these days than it was.

Having said that I still think CDHK on, say, the G5X makes this cameras an amazing little beast. Maybe one of the best travel cams when you factor in all the scripts that are available for, say, timelapse and, I humbly say, DOFIZ  :D

 

Related Topics