25 const float4 *src,
float4 *map,
int width,
int height,
float blur,
int quality)
35 const int halfWidth = ((quality + 1) * blur);
45 const float k = -1.0f / (2.0f *
float(
M_PI) * blur * blur);
47 for (
int ix = 0; ix < halfWidth; ix++) {
48 weight =
exp(k * (ix * ix));
49 filter[halfWidth - ix] = weight;
50 filter[halfWidth + ix] = weight;
55 for (
int ix = 0; ix < halfWidth * 2; ix++) {
58 for (
int ix = 0; ix < halfWidth * 2; ix++) {
64 for (
const int y : y_range) {
65 for (
int x = 0;
x < width;
x++) {
69 for (
int nx = xmin, index = (xmin -
x) + halfWidth; nx < xmax; nx++, index++) {
70 curColor += map[nx +
y * width] *
filter[index];
72 temp[
x +
y * width] = curColor;
80 for (
const int x : x_range) {
81 for (
int y = 0;
y < height;
y++) {
85 for (
int ny = ymin, index = (ymin -
y) + halfWidth; ny < ymax; ny++, index++) {
86 curColor += temp[
x + ny * width] *
filter[index];
89 curColor =
math::min(one, src[
x +
y * width] + curColor);
91 map[
x +
y * width] = curColor;
108 for (
const int y : y_range) {
109 int index =
y * width;
110 for (
int x = 0;
x < width;
x++, index++) {
113 float intensity = (
in[index].x +
in[index].y +
in[index].z - threshold);
116 val =
math::min(clampv,
in[index] * (boost * intensity));
183 glow->
dDist * (render_size / 100.0f),
187 size_t offset = y_range.
first() *
x;
189 *(outbuf.
data() + offset),
222 glow->
dDist * (render_size / 100.0f),
236 int render_size = 100 * context->rectx / context->scene->r.xsch;
238 if (
out->float_buffer.data) {
246 out->float_buffer.data);
256 out->byte_buffer.data);
void IMB_colormanagement_transform_byte_to_float(float *float_buffer, unsigned char *byte_buffer, int width, int height, int channels, const char *from_colorspace, const char *to_colorspace)
void IMB_buffer_byte_from_float(unsigned char *rect_to, const float *rect_from, int channels_from, float dither, int profile_to, int profile_from, bool predivide, int width, int height, int stride_to, int stride_from, int start_y=0)
constexpr int64_t first() const
constexpr int64_t size() const
constexpr T clamp(T, U, U) RET
void * MEM_callocN(size_t len, const char *str)
void * MEM_dupallocN(const void *vmemh)
void MEM_freeN(void *vmemh)
T min(const T &a, const T &b)
T max(const T &a, const T &b)
static void init_glow_effect(Strip *strip)
static void copy_glow_effect(Strip *dst, const Strip *src, const int)
ImBuf * prepare_effect_imbufs(const RenderData *context, ImBuf *ibuf1, ImBuf *ibuf2, bool uninitialized_pixels)
static ImBuf * do_glow_effect(const RenderData *context, SeqRenderState *, Strip *strip, float, float fac, ImBuf *ibuf1, ImBuf *ibuf2)
static void glow_blur_bitmap(const float4 *src, float4 *map, int width, int height, float blur, int quality)
static void free_glow_effect(Strip *strip, const bool)
static void do_glow_effect_byte(Strip *strip, int render_size, float fac, int x, int y, uchar *rect1, uchar *, uchar *out)
static void do_glow_effect_float(Strip *strip, int render_size, float fac, int x, int y, float *rect1, float *, float *out)
static void blur_isolate_highlights(const float4 *in, float4 *out, int width, int height, float threshold, float boost, float clamp)
static int num_inputs_glow()
void glow_effect_get_handle(EffectHandle &rval)
void parallel_for(const IndexRange range, const int64_t grain_size, const Function &function, const TaskSizeHints &size_hints=detail::TaskSizeHints_Static(1))
VecBase< float, 4 > float4
ImBufFloatBuffer float_buffer
ImBufByteBuffer byte_buffer
void(* copy)(Strip *dst, const Strip *src, int flag)
ImBuf *(* execute)(const RenderData *context, SeqRenderState *state, Strip *strip, float timeline_frame, float fac, ImBuf *ibuf1, ImBuf *ibuf2)
void(* free)(Strip *strip, bool do_id_user)
void(* init)(Strip *strip)