/* Compute minimum BSDF from histogram and clear it */ static void comp_bsdf_min() { int cnt; int i, target; cnt = 0; for (i = HISTLEN; i--; ) cnt += bsdf_hist[i]; target = cnt/100; /* ignore bottom 1% */ cnt = 0; for (i = 0; cnt <= target; i++) cnt += bsdf_hist[i]; bsdf_min = histval(i-1); memset(bsdf_hist, 0, sizeof(bsdf_hist)); }
/* Compute minimum BSDF from histogram and clear it */ static void comp_bsdf_min() { int cnt; int i, target; cnt = 0; for (i = HISTLEN; i--; ) cnt += bsdf_hist[i]; if (!cnt) { /* shouldn't happen */ bsdf_min = 0; return; } target = cnt/100; /* ignore bottom 1% */ cnt = 0; for (i = 0; cnt <= target; i++) cnt += bsdf_hist[i]; bsdf_min = histval(i-1); memset(bsdf_hist, 0, sizeof(bsdf_hist)); }