More strangeness.
Using the same script and your get_histo_range function returns strange things with the G11. On the S95 the function returns what looks the right data, when I check the RAW with Rawdigger.
On the G11 when I check beyond the back point, ie 127 to, say, 130, the function returns data, eg 80. But I no there is no count in this range as in Rawdigger it is clearly 0.
I assume you're using dng RAW files produced by CHDK? I'm computing the histogram from the raw data bytes right from the camera sensor, before any processing. There's some processing involved in computing a DNG file, so maybe the almost black pixels get clipped in the conversion. Maybe reyalp, philmoz, or one of the other RAW/DNG jocks could elaborate.
The black level of 127 is an approximation. The actual level depends on the background noise in the sensor, which gets higher with temperature. The G11 might have a higher noise level, and thus a higher black level.
Incidentally, the new shot histogram goes with the new shot meter functions. The histogram uses meter #1. You can set the area of the histogram with meter #1 as follows:
set_shot_meter(1,x1,y1,x2,y2)
shot_histo_enable(1)
x1,y1,x2,y2 are values from 0 to 100 which are percentages of the total active sensor area. If you omit the first set_shot_meter call, shot_histo_enable(1) calls:
set_shot_meter(1,0,0,100,100)
after taking a shot, you can call:
ev_delta=get_shot_meter(1) -- or just get_shot_meter()
Then you can adjust the exposure with:
set_tv96_direct(ev_delta+get_tv96())
this sets the average pixel value of the next shot at 192 below the 50% linear pixel level (2 f stops)