diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-05-19 12:06:24 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-06-12 00:29:03 +0300 |
commit | 9c5995c06259ee596dc80b5b5f69690679894357 (patch) | |
tree | faeead0db22eea68d1321aacd1cf39021114cb0e /source/blender/blenkernel/intern/colortools.c | |
parent | b496819fccd2bcf90087d1c6c0c3344e2e379253 (diff) |
Image scopes: Make sample line saving check local
Previously it was using accumulative counter of saved lines and so on in order
to detect cases when new sample is to be saved. This is not quite possible to
do with threaded scopes update.
Change it now with non-accumulative approach which saves a bit different lines
due to slightly different rounding, but this things are not strictly defined
anyway and results are close enough to each other.
Diffstat (limited to 'source/blender/blenkernel/intern/colortools.c')
-rw-r--r-- | source/blender/blenkernel/intern/colortools.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index 5b373e2d6d6..96488d021ce 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -1034,11 +1034,11 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, const ColorManagedViewSettings * double divl, diva, divr, divg, divb; unsigned char *display_buffer; unsigned int *bin_lum, *bin_r, *bin_g, *bin_b, *bin_a; - int savedlines; int ycc_mode = -1; const bool is_float = (ibuf->rect_float != NULL); void *cache_handle = NULL; struct ColormanageProcessor *cm_processor = NULL; + int rows_per_sample_line; if (ibuf->rect == NULL && ibuf->rect_float == NULL) return; @@ -1082,7 +1082,7 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, const ColorManagedViewSettings * scopes->sample_lines = ibuf->y; /* scan the image */ - savedlines = 0; + rows_per_sample_line = ibuf->y / scopes->sample_lines; for (a = 0; a < 3; a++) { scopes->minmax[a][0] = 25500.0f; scopes->minmax[a][1] = -25500.0f; @@ -1117,18 +1117,12 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, const ColorManagedViewSettings * for (y = 0; y < ibuf->y; y++) { const float *rf = NULL; unsigned char *rc = NULL; - int x, c, saveline; + int x, c; if (is_float) rf = ibuf->rect_float + ((size_t)y) * ibuf->x * ibuf->channels; else { rc = display_buffer + ((size_t)y) * ibuf->x * ibuf->channels; } - if (savedlines < scopes->sample_lines && y >= ((savedlines) * ibuf->y) / (scopes->sample_lines + 1)) { - saveline = 1; - } - else { - saveline = 0; - } for (x = 0; x < ibuf->x; x++) { float rgba[4], ycc[3], luma; if (is_float) { @@ -1166,8 +1160,9 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, const ColorManagedViewSettings * bin_a[get_bin_float(rgba[3])] += 1; /* save sample if needed */ - if (saveline) { + if (y % rows_per_sample_line == 0) { const float fx = (float)x / (float)ibuf->x; + const int savedlines = y / rows_per_sample_line; const int idx = 2 * (ibuf->x * savedlines + x); save_sample_line(scopes, idx, fx, rgba, ycc); } @@ -1175,8 +1170,6 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, const ColorManagedViewSettings * rf += ibuf->channels; rc += ibuf->channels; } - if (saveline) - savedlines += 1; } /* test for nicer distribution even - non standard, leave it out for a while */ |