@Audionut
THE depth of field is the ML reported ((fd-near) + (far-fd)), where near and far are the ML reported numbers.
In other words ML reports the
absolute (sic), ie relative to the sensor, acceptable focus distances, either side of the focus point.
Once you have gone beyond the diffraction limit, which is when the diffraction blur is the same at the total blur, you have gone beyond the acceptable depth of field, ie the total CoC, in quadrature, of defocus and diffraction blur, you have broken out of your 'solution space'.
It is absolutely correct that the ML reported near and far distance collapse to the focus distance, the relative (to the focus distance) depth of field is zero.
Maybe one way to help your 'fears/worries' is to code in a colour change ie things go red when the near and far collapse to the fd.
But, bluntly, when I see the near and far collapse to the fd I know I am beyond the diffraction limit.
The key point is, depth of field is relative to the criteria you choose, eg total blur or CoC.
Bottom line: I've tried to incorporate the best focus reporting in ML and, bluntly, with access to compile in the cloud, I'm happy to change whatever you and Alex decide to do :-)
Cheers
Garry
PS Play around with this DoF simulator:
http://www.dl-c.com/DoF/