[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [55731] trunk/blender/source/blender: More Histogram fixes:
Ton Roosendaal
ton at blender.org
Tue Apr 2 19:12:21 CEST 2013
Revision: 55731
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=55731
Author: ton
Date: 2013-04-02 17:12:21 +0000 (Tue, 02 Apr 2013)
Log Message:
-----------
More Histogram fixes:
Sequencer histogram was calculating still badly, now it uses a per-color
component counter to calculate the levels (instead of counter for all)
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/intern/colortools.c
trunk/blender/source/blender/editors/space_sequencer/sequencer_draw.c
trunk/blender/source/blender/editors/space_sequencer/sequencer_scopes.c
Modified: trunk/blender/source/blender/blenkernel/intern/colortools.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/colortools.c 2013-04-02 16:51:23 UTC (rev 55730)
+++ trunk/blender/source/blender/blenkernel/intern/colortools.c 2013-04-02 17:12:21 UTC (rev 55731)
@@ -1092,10 +1092,7 @@
if (is_float)
rf = ibuf->rect_float;
else {
- if (view_settings)
- rc = (unsigned char *)IMB_display_buffer_acquire(ibuf, view_settings, display_settings, &cache_handle);
- else
- rc = (unsigned char *)ibuf->rect;
+ rc = (unsigned char *)IMB_display_buffer_acquire(ibuf, view_settings, display_settings, &cache_handle);
}
if (ibuf->rect_float)
@@ -1178,11 +1175,12 @@
if (bin_b[x] > nb) nb = bin_b[x];
if (bin_a[x] > na) na = bin_a[x];
}
- divl = 1.0 / (double)nl;
- diva = 1.0 / (double)na;
- divr = 1.0 / (double)nr;
- divg = 1.0 / (double)ng;
- divb = 1.0 / (double)nb;
+ divl = nl ? 1.0 / (double)nl : 1.0;
+ diva = na ? 1.0 / (double)na : 1.0;
+ divr = nr ? 1.0 / (double)nr : 1.0;
+ divg = ng ? 1.0 / (double)ng : 1.0;
+ divb = nb ? 1.0 / (double)nb : 1.0;
+
for (x = 0; x < 256; x++) {
scopes->hist.data_luma[x] = bin_lum[x] * divl;
scopes->hist.data_r[x] = bin_r[x] * divr;
Modified: trunk/blender/source/blender/editors/space_sequencer/sequencer_draw.c
===================================================================
--- trunk/blender/source/blender/editors/space_sequencer/sequencer_draw.c 2013-04-02 16:51:23 UTC (rev 55730)
+++ trunk/blender/source/blender/editors/space_sequencer/sequencer_draw.c 2013-04-02 17:12:21 UTC (rev 55731)
@@ -896,7 +896,7 @@
{
ImBuf *display_ibuf = IMB_dupImBuf(ibuf);
ImBuf *scope;
-
+
IMB_colormanagement_imbuf_make_display_space(display_ibuf, &scene->view_settings,
&scene->display_settings);
Modified: trunk/blender/source/blender/editors/space_sequencer/sequencer_scopes.c
===================================================================
--- trunk/blender/source/blender/editors/space_sequencer/sequencer_scopes.c 2013-04-02 16:51:23 UTC (rev 55730)
+++ trunk/blender/source/blender/editors/space_sequencer/sequencer_scopes.c 2013-04-02 17:12:21 UTC (rev 55731)
@@ -531,7 +531,7 @@
static ImBuf *make_histogram_view_from_ibuf_float(ImBuf *ibuf)
{
ImBuf *rval = IMB_allocImBuf(515, 128, 32, IB_rect);
- int n, c, x, y;
+ int nr, ng, nb, x, y;
float *src = ibuf->rect_float;
unsigned int bins[3][HIS_STEPS];
@@ -563,23 +563,30 @@
}
}
- draw_histogram_marker(rval, get_bin_float(0.0));
- draw_histogram_marker(rval, get_bin_float(1.0));
-
- n = 0;
- for (c = 0; c < 3; c++) {
- for (x = 0; x < HIS_STEPS; x++) {
- if (bins[c][x] > n) {
- n = bins[c][x];
- }
- }
+ nr = nb = ng = 0;
+ for (x = 0; x < HIS_STEPS; x++) {
+ if (bins[0][x] > nr)
+ nr = bins[0][x];
+ if (bins[1][x] > ng)
+ ng = bins[1][x];
+ if (bins[2][x] > nb)
+ nb = bins[2][x];
}
- for (c = 0; c < 3; c++) {
- for (x = 0; x < HIS_STEPS; x++) {
- draw_histogram_bar(rval, x + 1, (float) bins[c][x] / n, c);
+
+ for (x = 0; x < HIS_STEPS; x++) {
+ if (nr) {
+ draw_histogram_bar(rval, x + 1, ((float) bins[0][x]) / nr, 0);
}
+ if (ng) {
+ draw_histogram_bar(rval, x + 1, ((float) bins[1][x]) / ng, 1);
+ }
+ if (nb) {
+ draw_histogram_bar(rval, x + 1, ((float) bins[2][x]) / nb, 2);
+ }
}
-
+
+ draw_histogram_marker(rval, get_bin_float(0.0));
+ draw_histogram_marker(rval, get_bin_float(1.0));
wform_put_border((unsigned char *) rval->rect, rval->x, rval->y);
return rval;
More information about the Bf-blender-cvs
mailing list