- for(int i = 0; i < HISTOGRAM_SLOTS; i++)
- {
- if(accum && accum[i] > normalize) normalize = accum[i];
- }
-
-
- if(normalize)
- {
- for(int i = 0; i < canvas_w; i++)
- {
- int accum_start = (int)(accum_per_canvas_f * i);
- int accum_end = accum_start + accum_per_canvas_i;
- max = 0;
- for(int j = accum_start; j < accum_end; j++)
- {
- max = MAX(accum[j], max);
+ int64_t max = 0;
+ int64_t *accum = plugin->accum[mode];
+ for( int k0=0,x=0; x<canvas_w; ++x ) {
+ int k1 = (HISTOGRAM_SLOTS * (x+1)) / canvas_w;
+ if( k0 == k1 ) continue;
+ int64_t m = accum[k0];
+ for( int k=k0; ++k<k1; ) {
+ if( m < accum[k] ) m = accum[k];
+ }
+ if( max < m ) max = m;
+ k0 = k1;
+ }
+ if( max > 0 ) {
+ double log_slider = plugin->config.log_slider;
+ double lin_slider = 1. - log_slider;
+ double lin_max = (lin_slider * h) / max;
+ double log_max = (log_slider * h) / log(max);
+ for( int k0=0,x=0; x<canvas_w; ++x ) {
+ int k1 = (HISTOGRAM_SLOTS * (x+1)) / canvas_w;
+ if( k0 == k1 ) continue;
+ int64_t m = accum[k0];
+ for( int k=k0; ++k<k1; ) {
+ if( m < accum[k] ) m = accum[k];