reylap
Thanks for the code pointer, I haven't looked at the trunk data before in CHDK. I did add in, with the help of a1ex, the DoF code into ML, including diffraction, but I'm not a C programmer ;-)
On my blog I have tried to discuss the value of understanding blurs as a way of controlling/setting DoF.
As you are aware, on the Powershot cameras, the useful blur zone in microns is from about 30xcrop to 2xsensor pitch. Also, apertures are limited compared to a full frame DSLR: so it's most probably not worth trying to enhanced the CHDK code with diffraction sensitive DoF math. Better to make users aware of the two main blur components, ie defocus blur, as built into CHDK, and diffraction blur.
As diffraction blur is 'flat' through the scene, some say that this can be accounted for in Photoshop etc. To some extent this is true. The defocus blur, however, is another story, as it varies through the scene. The chart I created here (
http://photography.grayheron.net/2018/11/focus-tutorial-part-1.html) tells the story.
Although I think it would be useful to have an user input feature for the defocus blur, ie CoC; you don't really need it if you use the hyperfocal distance to control blur, as shown in the chart. That is, knowing that the g7X CoC is set at 11 microns, I can set it to half that by focusing at 2*H. In other words I can fully control the blur at infinity: assuming the Canon-CHDK distance reporting is 'accurate' and we know that Canon lens reporting is far from 'smooth' in the 'far field'.
Finally, I think the 4 bracket approach will give you a reasonable approach for landscapes. In fact, you could most probably just use three brackets, ie start at H/3 and use a distance offset of about H.
Bottom line: I think what we have is OK, recognizing we are playing around with a P&S camera ;-)