I changed histogram.c to do the full histogram for higher than 10 bits. Then I decided it wasn't worth it, and took it out. In addition to the extra memory it takes (4 and 16 times the memory for 10-bit), there would need to be changes to get_histo_range(...) which I decided aren't worth the complications, not to mention trying to explain how to use it.
Anyway, I don't think the extra precision is needed. I was trying to figure out what to do with a shot histogram that might be more useful than get_histo_range(..). I read descriptions of how professional photographers use the histogram. What they describe is, they take a shot, look at the shot histogram, and adjust the exposure (or framing) so that the left and right side of the histogram are not clipped off.
So what I propose to do is calculate an exposure change, like I've done for the meters, based on the histogram. It would be easiest to understand by adding a function:
get_histo_meter(options...)
It would return the exposure change needed to move the histogram to the top, bottom, or in between, or whatever options I could figure out. You would use it just like the get_shot_meter(..). For example, option 1 might move the histogram to the right (ETTR):
Tv=Tv+get_histo_meter(1)
The options could specify a target for the end point, and percentage of pixels allowable over or under the target. I suppose the target should be linear, and in percent of full range. It could go like this:
Tv=Tv+get+histo_meter(1,50)
This might mean that you want the brightest pixels to be 50% of the full camera range, i.e. the white level/2. This is 1 f-stop below clipping. You could do a similar thing for the darkest pixels. I.E. change the exposure so the darks are in range, i.e. exposure to the left.
The combination of the right and left exposed images might be all that's needed to produce an HDR image. If the two exposures were too far apart, you might need one in the middle.
Anyway, just updating my thoughts on where I'm going with the shot_histo research.