VSE: speedup "show overexposed" option #115622
|
@ -569,14 +569,17 @@ static ImBuf *sequencer_get_scope(Scene *scene, SpaceSeq *sseq, ImBuf *ibuf, boo
|
||||||
switch (sseq->mainb) {
|
switch (sseq->mainb) {
|
||||||
case SEQ_DRAW_IMG_IMBUF:
|
case SEQ_DRAW_IMG_IMBUF:
|
||||||
if (!scopes->zebra_ibuf) {
|
if (!scopes->zebra_ibuf) {
|
||||||
ImBuf *display_ibuf = IMB_dupImBuf(ibuf);
|
|
||||||
|
|
||||||
if (display_ibuf->float_buffer.data) {
|
if (ibuf->float_buffer.data) {
|
||||||
|
ImBuf *display_ibuf = IMB_dupImBuf(ibuf);
|
||||||
IMB_colormanagement_imbuf_make_display_space(
|
IMB_colormanagement_imbuf_make_display_space(
|
||||||
display_ibuf, &scene->view_settings, &scene->display_settings);
|
display_ibuf, &scene->view_settings, &scene->display_settings);
|
||||||
|
scopes->zebra_ibuf = make_zebra_view_from_ibuf(display_ibuf, sseq->zebra);
|
||||||
|
IMB_freeImBuf(display_ibuf);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
scopes->zebra_ibuf = make_zebra_view_from_ibuf(ibuf, sseq->zebra);
|
||||||
}
|
}
|
||||||
scopes->zebra_ibuf = make_zebra_view_from_ibuf(display_ibuf, sseq->zebra);
|
|
||||||
IMB_freeImBuf(display_ibuf);
|
|
||||||
}
|
}
|
||||||
scope = scopes->zebra_ibuf;
|
scope = scopes->zebra_ibuf;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -362,63 +362,69 @@ ImBuf *make_sep_waveform_view_from_ibuf(ImBuf *ibuf)
|
||||||
|
|
||||||
static void draw_zebra_byte(const ImBuf *src, ImBuf *ibuf, float perc)
|
static void draw_zebra_byte(const ImBuf *src, ImBuf *ibuf, float perc)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_TIME
|
||||||
|
SCOPED_TIMER_AVERAGED(__func__);
|
||||||
|
#endif
|
||||||
|
using namespace blender;
|
||||||
uint limit = 255.0f * perc / 100.0f;
|
uint limit = 255.0f * perc / 100.0f;
|
||||||
const uchar *p = src->byte_buffer.data;
|
|
||||||
uchar *o = ibuf->byte_buffer.data;
|
|
||||||
int x;
|
|
||||||
int y;
|
|
||||||
|
|
||||||
for (y = 0; y < ibuf->y; y++) {
|
threading::parallel_for(IndexRange(ibuf->y), 16, [&](IndexRange y_range) {
|
||||||
for (x = 0; x < ibuf->x; x++) {
|
const uchar *p = src->byte_buffer.data + y_range.first() * ibuf->x * 4;
|
||||||
uchar r = *p++;
|
uchar *o = ibuf->byte_buffer.data + y_range.first() * ibuf->x * 4;
|
||||||
uchar g = *p++;
|
for (const int y : y_range) {
|
||||||
uchar b = *p++;
|
for (int x = 0; x < ibuf->x; x++) {
|
||||||
uchar a = *p++;
|
uchar r = *p++;
|
||||||
|
uchar g = *p++;
|
||||||
|
uchar b = *p++;
|
||||||
|
uchar a = *p++;
|
||||||
|
|
||||||
if (r >= limit || g >= limit || b >= limit) {
|
if (r >= limit || g >= limit || b >= limit) {
|
||||||
if (((x + y) & 0x08) != 0) {
|
if (((x + y) & 0x08) != 0) {
|
||||||
r = 255 - r;
|
r = 255 - r;
|
||||||
g = 255 - g;
|
g = 255 - g;
|
||||||
b = 255 - b;
|
b = 255 - b;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
*o++ = r;
|
||||||
|
*o++ = g;
|
||||||
|
*o++ = b;
|
||||||
|
*o++ = a;
|
||||||
}
|
}
|
||||||
*o++ = r;
|
|
||||||
*o++ = g;
|
|
||||||
*o++ = b;
|
|
||||||
*o++ = a;
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static void draw_zebra_float(ImBuf *src, ImBuf *ibuf, float perc)
|
static void draw_zebra_float(ImBuf *src, ImBuf *ibuf, float perc)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_TIME
|
||||||
|
SCOPED_TIMER_AVERAGED(__func__);
|
||||||
|
#endif
|
||||||
|
using namespace blender;
|
||||||
|
|
||||||
float limit = perc / 100.0f;
|
float limit = perc / 100.0f;
|
||||||
const float *p = src->float_buffer.data;
|
|
||||||
uchar *o = ibuf->byte_buffer.data;
|
|
||||||
int x;
|
|
||||||
int y;
|
|
||||||
|
|
||||||
for (y = 0; y < ibuf->y; y++) {
|
threading::parallel_for(IndexRange(ibuf->y), 16, [&](IndexRange y_range) {
|
||||||
for (x = 0; x < ibuf->x; x++) {
|
const float *p = src->float_buffer.data + y_range.first() * ibuf->x * 4;
|
||||||
float r = *p++;
|
uchar *o = ibuf->byte_buffer.data + y_range.first() * ibuf->x * 4;
|
||||||
float g = *p++;
|
for (const int y : y_range) {
|
||||||
float b = *p++;
|
for (int x = 0; x < ibuf->x; x++) {
|
||||||
float a = *p++;
|
float pix[4];
|
||||||
|
pix[0] = *p++;
|
||||||
if (r >= limit || g >= limit || b >= limit) {
|
pix[1] = *p++;
|
||||||
if (((x + y) & 0x08) != 0) {
|
pix[2] = *p++;
|
||||||
r = -r;
|
pix[3] = *p++;
|
||||||
g = -g;
|
if (pix[0] >= limit || pix[1] >= limit || pix[2] >= limit) {
|
||||||
b = -b;
|
if (((x + y) & 0x08) != 0) {
|
||||||
|
pix[0] = -pix[0];
|
||||||
|
pix[1] = -pix[1];
|
||||||
|
pix[2] = -pix[2];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
rgba_float_to_uchar(o, pix);
|
||||||
|
o += 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
*o++ = unit_float_to_uchar_clamp(r);
|
|
||||||
*o++ = unit_float_to_uchar_clamp(g);
|
|
||||||
*o++ = unit_float_to_uchar_clamp(b);
|
|
||||||
*o++ = unit_float_to_uchar_clamp(a);
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ImBuf *make_zebra_view_from_ibuf(ImBuf *ibuf, float perc)
|
ImBuf *make_zebra_view_from_ibuf(ImBuf *ibuf, float perc)
|
||||||
|
|
Loading…
Reference in New Issue