VSE: make Glow effect 6x-10x faster #115818
|
@ -643,8 +643,6 @@ void IMB_buffer_byte_from_byte(unsigned char *rect_to,
|
|||
int height,
|
||||
int stride_to,
|
||||
int stride_from);
|
||||
void IMB_buffer_float_unpremultiply(float *buf, int width, int height);
|
||||
void IMB_buffer_float_premultiply(float *buf, int width, int height);
|
||||
|
||||
/**
|
||||
* Change the ordering of the color bytes pointed to by rect from
|
||||
|
|
|
@ -856,26 +856,6 @@ void IMB_color_to_bw(ImBuf *ibuf)
|
|||
}
|
||||
}
|
||||
|
||||
void IMB_buffer_float_unpremultiply(float *buf, int width, int height)
|
||||
{
|
||||
size_t total = size_t(width) * height;
|
||||
float *fp = buf;
|
||||
while (total--) {
|
||||
premul_to_straight_v4(fp);
|
||||
fp += 4;
|
||||
}
|
||||
}
|
||||
|
||||
void IMB_buffer_float_premultiply(float *buf, int width, int height)
|
||||
{
|
||||
size_t total = size_t(width) * height;
|
||||
float *fp = buf;
|
||||
while (total--) {
|
||||
straight_to_premul_v4(fp);
|
||||
fp += 4;
|
||||
}
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
|
|
@ -2156,19 +2156,7 @@ static void do_glow_effect_byte(Sequence *seq,
|
|||
MEM_mallocN(sizeof(float[4]) * x * y, "glow effect output"));
|
||||
|
||||
using namespace blender;
|
||||
threading::parallel_for(IndexRange(y), 64, [&](const IndexRange y_range) {
|
||||
size_t offset = y_range.first() * x * 4;
|
||||
IMB_buffer_float_from_byte(inbuf + offset,
|
||||
rect1 + offset,
|
||||
IB_PROFILE_SRGB,
|
||||
IB_PROFILE_SRGB,
|
||||
false,
|
||||
x,
|
||||
y_range.size(),
|
||||
x,
|
||||
x);
|
||||
IMB_buffer_float_premultiply(inbuf + offset, x, y_range.size());
|
||||
});
|
||||
IMB_colormanagement_transform_from_byte_threaded(inbuf, rect1, x, y, 4, "sRGB", "sRGB");
|
||||
|
||||
blur_isolate_highlights(
|
||||
inbuf, outbuf, x, y, glow->fMini * 3.0f, glow->fBoost * fac, glow->fClamp);
|
||||
|
@ -2183,14 +2171,13 @@ static void do_glow_effect_byte(Sequence *seq,
|
|||
|
||||
threading::parallel_for(IndexRange(y), 64, [&](const IndexRange y_range) {
|
||||
size_t offset = y_range.first() * x * 4;
|
||||
IMB_buffer_float_unpremultiply(outbuf + offset, x, y_range.size());
|
||||
IMB_buffer_byte_from_float(out + offset,
|
||||
outbuf + offset,
|
||||
4,
|
||||
0.0f,
|
||||
IB_PROFILE_SRGB,
|
||||
IB_PROFILE_SRGB,
|
||||
false,
|
||||
true,
|
||||
x,
|
||||
y_range.size(),
|
||||
x,
|
||||
|
|
Loading…
Reference in New Issue