@philmoz The ETTR hint is only calculated for under exposed images. I have tried a few ways of calculating for an over exposed image; but I can't find anything that I think is usable.
Like you, and others I'm sure, I've thought about this and concluded there is no general and robust way of calculating the number of stops one is overexposed.
The histogram is scene dependent and once you over expose the scene-specific information is lost, ie it gets added to the 100% saturated bin. The information is non recoverable, other than saying there are x% of the sampled points in the fully saturated bin. But I see no way of converting this stops/Ev.
Likewise, if the exposure is underexposed, a similar thing can be said, ie the scene specific information is lost.
The only two scenarios, where you can obtain an over or under exposure Ev value is when the histogram clearly has 0% in the highlight or shadow extreme bins.
IMHO and obviously ;-)
Cheers
Garry