if (histo_max[HISTO_RGB] > 0) { // over- / under- expos
under_exposed = (histogram_proc[HISTO_RGB][0]*8
+histogram_proc[HISTO_RGB][1]*4
+histogram_proc[HISTO_RGB][2]) > exposition_thresh;
over_exposed = (histogram_proc[HISTO_RGB][HISTO_WIDTH-3]
+histogram_proc[HISTO_RGB][HISTO_WIDTH-2]*4
+histogram_proc[HISTO_RGB][HISTO_WIDTH-1]*8) > exposition_thresh;
} else {
over_exposed = 0;
under_exposed = 1;
}
I don’t get the *4 and *8 bit in the code, ie looking at the top or bottom three bins
of the histogram.
... I would say, outer left and right 3 columns of the histogram, but maybe we mean the same...
Edit: this little tweak could save some CPU-cycles, but it´s called quite often.
int clip(int v);
inline int clip(int v)
{
if (v<1) return 0;
return v<255 ? v:255;
}