Hi Ton, I coded the scopes for the image window (waveform, vectorscope and sample line, Matt Ebb coded the histogram). They are actually quite faster than the sequencer ones. The sequencer scopes are extra slow because it "draws" the scopes in a byte buffer and then uses openGL to display this byte buffer. The images window scopes draw directly the scopes using vertex arrays and this makes them faster.
The code is easily "parellelisationable" and there was also a patch to make the updates in a background job but redraw notifications was making it flicker. Also the scopes for the sequencer are quite "dumb" and do not update all at the same time: If you have 3 scopes visible at the same time in the sequencer, the image data will be read 3 times -> no so cache optimised in my opinion ;-/ Xavier 2013/3/26 Ton Roosendaal <t...@blender.org> > Revision: 55603 > > http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=55603 > Author: ton > Date: 2013-03-26 17:49:57 +0000 (Tue, 26 Mar 2013) > Log Message: > ----------- > Bug fix - own collection. > > - Scopes in Sequencer were not drawing OK (drawing code assumed alpha) > - Histogram in Sequencer now uses same formula to quantify R G B as the > other histogram in Blender (per channel). > > I seriously thought of dropping this, and add the same sidebar here as we > have for Image window. However, what stops me is that current code is > very optimized, and has OMP hints. > > Will check instead on cleaner drawing here now. > > Modified Paths: > -------------- > 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/editors/space_sequencer/sequencer_draw.c > =================================================================== > --- trunk/blender/source/blender/editors/space_sequencer/sequencer_draw.c > 2013-03-26 15:52:43 UTC (rev 55602) > +++ trunk/blender/source/blender/editors/space_sequencer/sequencer_draw.c > 2013-03-26 17:49:57 UTC (rev 55603) > @@ -1061,9 +1061,12 @@ > > glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, ibuf->x, ibuf->y, 0, > GL_RGBA, GL_UNSIGNED_BYTE, display_buffer); > > - if (sseq->flag & SEQ_USE_ALPHA) { > - glEnable(GL_BLEND); > - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); > + /* only draw alpha for main buffer */ > + if (sseq->mainb == SEQ_DRAW_IMG_IMBUF) { > + if (sseq->flag & SEQ_USE_ALPHA) { > + glEnable(GL_BLEND); > + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); > + } > } > > glBegin(GL_QUADS); > > Modified: > trunk/blender/source/blender/editors/space_sequencer/sequencer_scopes.c > =================================================================== > --- > trunk/blender/source/blender/editors/space_sequencer/sequencer_scopes.c > 2013-03-26 15:52:43 UTC (rev 55602) > +++ > trunk/blender/source/blender/editors/space_sequencer/sequencer_scopes.c > 2013-03-26 17:49:57 UTC (rev 55603) > @@ -107,20 +107,20 @@ > > for (x = 0; x < w; x++) { > unsigned char *p = tgt + 4 * x; > - p[1] = p[3] = 255.0; > - p[4 * w + 1] = p[4 * w + 3] = 255.0; > + p[1] = p[3] = 155; > + p[4 * w + 1] = p[4 * w + 3] = 155; > p = tgt + 4 * (w * (h - 1) + x); > - p[1] = p[3] = 255.0; > - p[-4 * w + 1] = p[-4 * w + 3] = 255.0; > + p[1] = p[3] = 155; > + p[-4 * w + 1] = p[-4 * w + 3] = 155; > } > > for (y = 0; y < h; y++) { > unsigned char *p = tgt + 4 * w * y; > - p[1] = p[3] = 255.0; > - p[4 + 1] = p[4 + 3] = 255.0; > + p[1] = p[3] = 155; > + p[4 + 1] = p[4 + 3] = 155; > p = tgt + 4 * (w * y + w - 1); > - p[1] = p[3] = 255.0; > - p[-4 + 1] = p[-4 + 3] = 255.0; > + p[1] = p[3] = 155; > + p[-4 + 1] = p[-4 + 3] = 155; > } > } > > @@ -156,7 +156,8 @@ > unsigned char wtable[256]; > > wform_put_grid(tgt, w, h); > - > + wform_put_border(tgt, w, h); > + > for (x = 0; x < 256; x++) { > wtable[x] = (unsigned char) (pow(((float) x + 1) / 256, > waveform_gamma) * 255); > } > @@ -181,8 +182,6 @@ > } > } > > - wform_put_border(tgt, w, h); > - > return rval; > } > > @@ -454,8 +453,8 @@ > static ImBuf *make_histogram_view_from_ibuf_byte(ImBuf *ibuf) > { > ImBuf *rval = IMB_allocImBuf(515, 128, 32, IB_rect); > - int c, x, y; > - unsigned int n; > + int x, y; > + unsigned int nr, ng, nb; > unsigned char *src = (unsigned char *) ibuf->rect; > > unsigned int bins[3][HIS_STEPS]; > @@ -487,20 +486,29 @@ > } > } > > - 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 * 2 + 1, ((float) > bins[c][x]) / n, c); > - draw_histogram_bar(rval, x * 2 + 2, ((float) > bins[c][x]) / n, c); > + for (x = 0; x < HIS_STEPS; x++) { > + if (nr) { > + draw_histogram_bar(rval, x * 2 + 1, ((float) > bins[0][x]) / nr, 0); > + draw_histogram_bar(rval, x * 2 + 2, ((float) > bins[0][x]) / nr, 0); > } > + if (ng) { > + draw_histogram_bar(rval, x * 2 + 1, ((float) > bins[1][x]) / ng, 1); > + draw_histogram_bar(rval, x * 2 + 2, ((float) > bins[1][x]) / ng, 1); > + } > + if (nb) { > + draw_histogram_bar(rval, x * 2 + 1, ((float) > bins[2][x]) / nb, 2); > + draw_histogram_bar(rval, x * 2 + 2, ((float) > bins[2][x]) / nb, 2); > + } > } > > wform_put_border((unsigned char *) rval->rect, rval->x, rval->y); > > _______________________________________________ > Bf-blender-cvs mailing list > bf-blender-...@blender.org > http://lists.blender.org/mailman/listinfo/bf-blender-cvs > _______________________________________________ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers