Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen Bakker <jeroen@blender.org>2021-03-30 15:12:41 +0300
committerJeroen Bakker <jeroen@blender.org>2021-03-30 17:03:43 +0300
commit88e0ed32888f4a87ec1192e3b54aebe8686e029c (patch)
tree2659678f6a9adfd6605c7fb17b219b9166364ade /source/blender/compositor
parentb48a573adb1e8ba254c5b3ea58bf1bb2a013ce89 (diff)
Cleanup: Use constexpr.
Diffstat (limited to 'source/blender/compositor')
-rw-r--r--source/blender/compositor/COM_defines.h27
-rw-r--r--source/blender/compositor/intern/COM_MemoryBuffer.cc16
-rw-r--r--source/blender/compositor/intern/COM_compositor.cc8
-rw-r--r--source/blender/compositor/operations/COM_BokehBlurOperation.cc7
-rw-r--r--source/blender/compositor/operations/COM_CompositorOperation.cc6
-rw-r--r--source/blender/compositor/operations/COM_FastGaussianBlurOperation.cc16
-rw-r--r--source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cc7
-rw-r--r--source/blender/compositor/operations/COM_GlareFogGlowOperation.cc21
-rw-r--r--source/blender/compositor/operations/COM_GlareGhostOperation.cc9
-rw-r--r--source/blender/compositor/operations/COM_InpaintOperation.cc3
-rw-r--r--source/blender/compositor/operations/COM_SunBeamsOperation.cc9
-rw-r--r--source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cc4
-rw-r--r--source/blender/compositor/operations/COM_VectorBlurOperation.cc2
13 files changed, 74 insertions, 61 deletions
diff --git a/source/blender/compositor/COM_defines.h b/source/blender/compositor/COM_defines.h
index 66da43eda89..7e580f40d97 100644
--- a/source/blender/compositor/COM_defines.h
+++ b/source/blender/compositor/COM_defines.h
@@ -34,6 +34,22 @@ enum class DataType {
};
/**
+ * Utility to get the number of channels of the given data type.
+ */
+constexpr int COM_data_type_num_channels(const DataType datatype)
+{
+ switch (datatype) {
+ case DataType::Value:
+ return 1;
+ case DataType::Vector:
+ return 3;
+ case DataType::Color:
+ default:
+ return 4;
+ }
+}
+
+/**
* \brief Possible quality settings
* \see CompositorContext.quality
* \ingroup Execution
@@ -63,7 +79,6 @@ enum class CompositorPriority {
// configurable items
// chunk size determination
-#define COM_PREVIEW_SIZE 140.0f
// #define COM_DEBUG
// chunk order
@@ -84,12 +99,8 @@ enum class ChunkOrdering {
Default = ChunkOrdering::CenterOut,
};
-#define COM_RULE_OF_THIRDS_DIVIDER 100.0f
-
-#define COM_NUM_CHANNELS_VALUE 1
-#define COM_NUM_CHANNELS_VECTOR 3
-#define COM_NUM_CHANNELS_COLOR 4
-
-#define COM_BLUR_BOKEH_PIXELS 512
+constexpr float COM_PREVIEW_SIZE = 140.f;
+constexpr float COM_RULE_OF_THIRDS_DIVIDER = 100.0f;
+constexpr float COM_BLUR_BOKEH_PIXELS = 512;
} // namespace blender::compositor
diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.cc b/source/blender/compositor/intern/COM_MemoryBuffer.cc
index 241e0c66aeb..d9694169ab8 100644
--- a/source/blender/compositor/intern/COM_MemoryBuffer.cc
+++ b/source/blender/compositor/intern/COM_MemoryBuffer.cc
@@ -22,24 +22,12 @@
namespace blender::compositor {
-static unsigned int determine_num_channels(DataType datatype)
-{
- switch (datatype) {
- case DataType::Value:
- return COM_NUM_CHANNELS_VALUE;
- case DataType::Vector:
- return COM_NUM_CHANNELS_VECTOR;
- case DataType::Color:
- default:
- return COM_NUM_CHANNELS_COLOR;
- }
-}
MemoryBuffer::MemoryBuffer(MemoryProxy *memoryProxy, const rcti &rect, MemoryBufferState state)
{
m_rect = rect;
this->m_memoryProxy = memoryProxy;
- this->m_num_channels = determine_num_channels(memoryProxy->getDataType());
+ this->m_num_channels = COM_data_type_num_channels(memoryProxy->getDataType());
this->m_buffer = (float *)MEM_mallocN_aligned(
sizeof(float) * buffer_len() * this->m_num_channels, 16, "COM_MemoryBuffer");
this->m_state = state;
@@ -50,7 +38,7 @@ MemoryBuffer::MemoryBuffer(DataType dataType, const rcti &rect)
{
m_rect = rect;
this->m_memoryProxy = nullptr;
- this->m_num_channels = determine_num_channels(dataType);
+ this->m_num_channels = COM_data_type_num_channels(dataType);
this->m_buffer = (float *)MEM_mallocN_aligned(
sizeof(float) * buffer_len() * this->m_num_channels, 16, "COM_MemoryBuffer");
this->m_state = MemoryBufferState::Temporary;
diff --git a/source/blender/compositor/intern/COM_compositor.cc b/source/blender/compositor/intern/COM_compositor.cc
index 3aa711c6594..5839f53976b 100644
--- a/source/blender/compositor/intern/COM_compositor.cc
+++ b/source/blender/compositor/intern/COM_compositor.cc
@@ -46,12 +46,12 @@ static void compositor_init_node_previews(const RenderData *render_data, bNodeTr
1.0f;
int preview_width, preview_height;
if (aspect < 1.0f) {
- preview_width = COM_PREVIEW_SIZE;
- preview_height = (int)(COM_PREVIEW_SIZE * aspect);
+ preview_width = blender::compositor::COM_PREVIEW_SIZE;
+ preview_height = (int)(blender::compositor::COM_PREVIEW_SIZE * aspect);
}
else {
- preview_width = (int)(COM_PREVIEW_SIZE / aspect);
- preview_height = COM_PREVIEW_SIZE;
+ preview_width = (int)(blender::compositor::COM_PREVIEW_SIZE / aspect);
+ preview_height = blender::compositor::COM_PREVIEW_SIZE;
}
BKE_node_preview_init_tree(node_tree, preview_width, preview_height, false);
}
diff --git a/source/blender/compositor/operations/COM_BokehBlurOperation.cc b/source/blender/compositor/operations/COM_BokehBlurOperation.cc
index 8d331758377..46f3de820ef 100644
--- a/source/blender/compositor/operations/COM_BokehBlurOperation.cc
+++ b/source/blender/compositor/operations/COM_BokehBlurOperation.cc
@@ -109,12 +109,13 @@ void BokehBlurOperation::executePixel(float output[4], int x, int y, void *data)
maxx = MIN2(maxx, input_rect.xmax);
int step = getStep();
- int offsetadd = getOffsetAdd() * COM_NUM_CHANNELS_COLOR;
+ int offsetadd = getOffsetAdd() * COM_data_type_num_channels(DataType::Color);
float m = this->m_bokehDimension / pixelSize;
for (int ny = miny; ny < maxy; ny += step) {
- int bufferindex = ((minx - bufferstartx) * COM_NUM_CHANNELS_COLOR) +
- ((ny - bufferstarty) * COM_NUM_CHANNELS_COLOR * bufferwidth);
+ int bufferindex = ((minx - bufferstartx) * COM_data_type_num_channels(DataType::Color)) +
+ ((ny - bufferstarty) * COM_data_type_num_channels(DataType::Color) *
+ bufferwidth);
for (int nx = minx; nx < maxx; nx += step) {
float u = this->m_bokehMidX - (nx - x) * m;
float v = this->m_bokehMidY - (ny - y) * m;
diff --git a/source/blender/compositor/operations/COM_CompositorOperation.cc b/source/blender/compositor/operations/COM_CompositorOperation.cc
index f70b5cc9dad..f35a63ac9a1 100644
--- a/source/blender/compositor/operations/COM_CompositorOperation.cc
+++ b/source/blender/compositor/operations/COM_CompositorOperation.cc
@@ -151,7 +151,7 @@ void CompositorOperation::executeRegion(rcti *rect, unsigned int /*tileNumber*/)
int y2 = rect->ymax;
int offset = (y1 * this->getWidth() + x1);
int add = (this->getWidth() - (x2 - x1));
- int offset4 = offset * COM_NUM_CHANNELS_COLOR;
+ int offset4 = offset * COM_data_type_num_channels(DataType::Color);
int x;
int y;
bool breaked = false;
@@ -209,14 +209,14 @@ void CompositorOperation::executeRegion(rcti *rect, unsigned int /*tileNumber*/)
this->m_depthInput->readSampled(color, input_x, input_y, PixelSampler::Nearest);
zbuffer[offset] = color[0];
- offset4 += COM_NUM_CHANNELS_COLOR;
+ offset4 += COM_data_type_num_channels(DataType::Color);
offset++;
if (isBraked()) {
breaked = true;
}
}
offset += add;
- offset4 += add * COM_NUM_CHANNELS_COLOR;
+ offset4 += add * COM_data_type_num_channels(DataType::Color);
}
}
diff --git a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cc b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cc
index 6f2ac73d251..cd6bb3952bf 100644
--- a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cc
+++ b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cc
@@ -90,18 +90,18 @@ void *FastGaussianBlurOperation::initializeTileData(rcti *rect)
this->m_sy = this->m_data.sizey * this->m_size / 2.0f;
if ((this->m_sx == this->m_sy) && (this->m_sx > 0.0f)) {
- for (c = 0; c < COM_NUM_CHANNELS_COLOR; c++) {
+ for (c = 0; c < COM_data_type_num_channels(DataType::Color); c++) {
IIR_gauss(copy, this->m_sx, c, 3);
}
}
else {
if (this->m_sx > 0.0f) {
- for (c = 0; c < COM_NUM_CHANNELS_COLOR; c++) {
+ for (c = 0; c < COM_data_type_num_channels(DataType::Color); c++) {
IIR_gauss(copy, this->m_sx, c, 1);
}
}
if (this->m_sy > 0.0f) {
- for (c = 0; c < COM_NUM_CHANNELS_COLOR; c++) {
+ for (c = 0; c < COM_data_type_num_channels(DataType::Color); c++) {
IIR_gauss(copy, this->m_sy, c, 2);
}
}
@@ -318,8 +318,9 @@ void *FastGaussianBlurValueOperation::initializeTileData(rcti *rect)
if (this->m_overlay == FAST_GAUSS_OVERLAY_MIN) {
float *src = newBuf->getBuffer();
float *dst = copy->getBuffer();
- for (int i = copy->getWidth() * copy->getHeight(); i != 0;
- i--, src += COM_NUM_CHANNELS_VALUE, dst += COM_NUM_CHANNELS_VALUE) {
+ for (int i = copy->getWidth() * copy->getHeight(); i != 0; i--,
+ src += COM_data_type_num_channels(DataType::Value),
+ dst += COM_data_type_num_channels(DataType::Value)) {
if (*src < *dst) {
*dst = *src;
}
@@ -328,8 +329,9 @@ void *FastGaussianBlurValueOperation::initializeTileData(rcti *rect)
else if (this->m_overlay == FAST_GAUSS_OVERLAY_MAX) {
float *src = newBuf->getBuffer();
float *dst = copy->getBuffer();
- for (int i = copy->getWidth() * copy->getHeight(); i != 0;
- i--, src += COM_NUM_CHANNELS_VALUE, dst += COM_NUM_CHANNELS_VALUE) {
+ for (int i = copy->getWidth() * copy->getHeight(); i != 0; i--,
+ src += COM_data_type_num_channels(DataType::Value),
+ dst += COM_data_type_num_channels(DataType::Value)) {
if (*src > *dst) {
*dst = *src;
}
diff --git a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cc b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cc
index 7e86b26bfd9..ac88ce0f894 100644
--- a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cc
+++ b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cc
@@ -305,7 +305,8 @@ void GaussianBlurReferenceOperation::executePixel(float output[4], int x, int y,
int minyr = y - refrady < 0 ? -y : -refrady;
int maxyr = y + refrady > imgy ? imgy - y : refrady;
- float *srcd = buffer + COM_NUM_CHANNELS_COLOR * ((y + minyr) * imgx + x + minxr);
+ float *srcd = buffer +
+ COM_data_type_num_channels(DataType::Color) * ((y + minyr) * imgx + x + minxr);
gausstabx = m_maintabs[refradx - 1];
gausstabcentx = gausstabx + refradx;
@@ -313,9 +314,9 @@ void GaussianBlurReferenceOperation::executePixel(float output[4], int x, int y,
gausstabcenty = gausstaby + refrady;
sum = gval = rval = bval = aval = 0.0f;
- for (i = minyr; i < maxyr; i++, srcd += COM_NUM_CHANNELS_COLOR * imgx) {
+ for (i = minyr; i < maxyr; i++, srcd += COM_data_type_num_channels(DataType::Color) * imgx) {
src = srcd;
- for (j = minxr; j < maxxr; j++, src += COM_NUM_CHANNELS_COLOR) {
+ for (j = minxr; j < maxxr; j++, src += COM_data_type_num_channels(DataType::Color)) {
val = gausstabcenty[i] * gausstabcentx[j];
sum += val;
diff --git a/source/blender/compositor/operations/COM_GlareFogGlowOperation.cc b/source/blender/compositor/operations/COM_GlareFogGlowOperation.cc
index 6b3d08a9315..1e121c246f4 100644
--- a/source/blender/compositor/operations/COM_GlareFogGlowOperation.cc
+++ b/source/blender/compositor/operations/COM_GlareFogGlowOperation.cc
@@ -273,7 +273,8 @@ static void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2)
MemoryBuffer *rdst = new MemoryBuffer(DataType::Color, in1->get_rect());
memset(rdst->getBuffer(),
0,
- rdst->getWidth() * rdst->getHeight() * COM_NUM_CHANNELS_COLOR * sizeof(float));
+ rdst->getWidth() * rdst->getHeight() * COM_data_type_num_channels(DataType::Color) *
+ sizeof(float));
// convolution result width & height
w2 = 2 * kernelWidth - 1;
@@ -289,7 +290,7 @@ static void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2)
// normalize convolutor
wt[0] = wt[1] = wt[2] = 0.0f;
for (y = 0; y < kernelHeight; y++) {
- colp = (fRGB *)&kernelBuffer[y * kernelWidth * COM_NUM_CHANNELS_COLOR];
+ colp = (fRGB *)&kernelBuffer[y * kernelWidth * COM_data_type_num_channels(DataType::Color)];
for (x = 0; x < kernelWidth; x++) {
add_v3_v3(wt, colp[x]);
}
@@ -304,7 +305,7 @@ static void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2)
wt[2] = 1.0f / wt[2];
}
for (y = 0; y < kernelHeight; y++) {
- colp = (fRGB *)&kernelBuffer[y * kernelWidth * COM_NUM_CHANNELS_COLOR];
+ colp = (fRGB *)&kernelBuffer[y * kernelWidth * COM_data_type_num_channels(DataType::Color)];
for (x = 0; x < kernelWidth; x++) {
mul_v3_v3(colp[x], wt);
}
@@ -338,7 +339,8 @@ static void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2)
// in2, channel ch -> data1
for (y = 0; y < kernelHeight; y++) {
fp = &data1ch[y * w2];
- colp = (fRGB *)&kernelBuffer[y * kernelWidth * COM_NUM_CHANNELS_COLOR];
+ colp = (fRGB *)&kernelBuffer[y * kernelWidth *
+ COM_data_type_num_channels(DataType::Color)];
for (x = 0; x < kernelWidth; x++) {
fp[x] = colp[x][ch];
}
@@ -353,7 +355,8 @@ static void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2)
continue;
}
fp = &data2[y * w2];
- colp = (fRGB *)&imageBuffer[yy * imageWidth * COM_NUM_CHANNELS_COLOR];
+ colp =
+ (fRGB *)&imageBuffer[yy * imageWidth * COM_data_type_num_channels(DataType::Color)];
for (x = 0; x < xbsz; x++) {
int xx = xbl * xbsz + x;
if (xx >= imageWidth) {
@@ -383,7 +386,8 @@ static void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2)
continue;
}
fp = &data2[y * w2];
- colp = (fRGB *)&rdst->getBuffer()[yy * imageWidth * COM_NUM_CHANNELS_COLOR];
+ colp = (fRGB *)&rdst
+ ->getBuffer()[yy * imageWidth * COM_data_type_num_channels(DataType::Color)];
for (x = 0; x < (int)w2; x++) {
const int xx = xbl * xbsz + x - hw;
if ((xx < 0) || (xx >= imageWidth)) {
@@ -399,8 +403,9 @@ static void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2)
MEM_freeN(data2);
MEM_freeN(data1);
- memcpy(
- dst, rdst->getBuffer(), sizeof(float) * imageWidth * imageHeight * COM_NUM_CHANNELS_COLOR);
+ memcpy(dst,
+ rdst->getBuffer(),
+ sizeof(float) * imageWidth * imageHeight * COM_data_type_num_channels(DataType::Color));
delete (rdst);
}
diff --git a/source/blender/compositor/operations/COM_GlareGhostOperation.cc b/source/blender/compositor/operations/COM_GlareGhostOperation.cc
index c843a673ec0..7ba49c97244 100644
--- a/source/blender/compositor/operations/COM_GlareGhostOperation.cc
+++ b/source/blender/compositor/operations/COM_GlareGhostOperation.cc
@@ -125,7 +125,8 @@ void GlareGhostOperation::generateGlare(float *data, MemoryBuffer *inputTile, No
memset(tbuf1.getBuffer(),
0,
- tbuf1.getWidth() * tbuf1.getHeight() * COM_NUM_CHANNELS_COLOR * sizeof(float));
+ tbuf1.getWidth() * tbuf1.getHeight() * COM_data_type_num_channels(DataType::Color) *
+ sizeof(float));
for (n = 1; n < settings->iter && (!breaked); n++) {
for (y = 0; y < gbuf.getHeight() && (!breaked); y++) {
v = ((float)y + 0.5f) / (float)gbuf.getHeight();
@@ -149,11 +150,13 @@ void GlareGhostOperation::generateGlare(float *data, MemoryBuffer *inputTile, No
}
memcpy(gbuf.getBuffer(),
tbuf1.getBuffer(),
- tbuf1.getWidth() * tbuf1.getHeight() * COM_NUM_CHANNELS_COLOR * sizeof(float));
+ tbuf1.getWidth() * tbuf1.getHeight() * COM_data_type_num_channels(DataType::Color) *
+ sizeof(float));
}
memcpy(data,
gbuf.getBuffer(),
- gbuf.getWidth() * gbuf.getHeight() * COM_NUM_CHANNELS_COLOR * sizeof(float));
+ gbuf.getWidth() * gbuf.getHeight() * COM_data_type_num_channels(DataType::Color) *
+ sizeof(float));
}
} // namespace blender::compositor
diff --git a/source/blender/compositor/operations/COM_InpaintOperation.cc b/source/blender/compositor/operations/COM_InpaintOperation.cc
index ad257611522..6b71d80b963 100644
--- a/source/blender/compositor/operations/COM_InpaintOperation.cc
+++ b/source/blender/compositor/operations/COM_InpaintOperation.cc
@@ -78,7 +78,8 @@ float *InpaintSimpleOperation::get_pixel(int x, int y)
ASSERT_XY_RANGE(x, y);
- return &this->m_cached_buffer[y * width * COM_NUM_CHANNELS_COLOR + x * COM_NUM_CHANNELS_COLOR];
+ return &this->m_cached_buffer[y * width * COM_data_type_num_channels(DataType::Color) +
+ x * COM_data_type_num_channels(DataType::Color)];
}
int InpaintSimpleOperation::mdist(int x, int y)
diff --git a/source/blender/compositor/operations/COM_SunBeamsOperation.cc b/source/blender/compositor/operations/COM_SunBeamsOperation.cc
index 085a0bb571c..46fc716b2d7 100644
--- a/source/blender/compositor/operations/COM_SunBeamsOperation.cc
+++ b/source/blender/compositor/operations/COM_SunBeamsOperation.cc
@@ -140,7 +140,8 @@ template<int fxu, int fxv, int fyu, int fyv> struct BufferLineAccumulator {
falloff_factor = dist_max > dist_min ? dr / (float)(dist_max - dist_min) : 0.0f;
- float *iter = input->getBuffer() + COM_NUM_CHANNELS_COLOR * (x + input->getWidth() * y);
+ float *iter = input->getBuffer() +
+ COM_data_type_num_channels(DataType::Color) * (x + input->getWidth() * y);
return iter;
}
@@ -169,7 +170,7 @@ template<int fxu, int fxv, int fyu, int fyv> struct BufferLineAccumulator {
if ((int)(co[0] - source[0]) == 0 && (int)(co[1] - source[1]) == 0) {
copy_v4_v4(output,
- input->getBuffer() + COM_NUM_CHANNELS_COLOR *
+ input->getBuffer() + COM_data_type_num_channels(DataType::Color) *
((int)source[0] + input->getWidth() * (int)source[1]));
return;
}
@@ -210,7 +211,7 @@ template<int fxu, int fxv, int fyu, int fyv> struct BufferLineAccumulator {
/* decrement u */
x -= fxu;
y -= fyu;
- buffer -= (fxu + fyu * buffer_width) * COM_NUM_CHANNELS_COLOR;
+ buffer -= (fxu + fyu * buffer_width) * COM_data_type_num_channels(DataType::Color);
/* decrement v (in steps of dv < 1) */
v_local -= dv;
@@ -219,7 +220,7 @@ template<int fxu, int fxv, int fyu, int fyv> struct BufferLineAccumulator {
x -= fxv;
y -= fyv;
- buffer -= (fxv + fyv * buffer_width) * COM_NUM_CHANNELS_COLOR;
+ buffer -= (fxv + fyv * buffer_width) * COM_data_type_num_channels(DataType::Color);
}
}
diff --git a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cc b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cc
index 6f4ba2d5af1..f61074a44d9 100644
--- a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cc
+++ b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cc
@@ -137,14 +137,14 @@ void VariableSizeBokehBlurOperation::executePixel(float output[4], int x, int y,
const int addXStepValue = QualityStepHelper::getStep();
const int addYStepValue = addXStepValue;
- const int addXStepColor = addXStepValue * COM_NUM_CHANNELS_COLOR;
+ const int addXStepColor = addXStepValue * COM_data_type_num_channels(DataType::Color);
if (size_center > this->m_threshold) {
for (int ny = miny; ny < maxy; ny += addYStepValue) {
float dy = ny - y;
int offsetValueNy = ny * inputSizeBuffer->getWidth();
int offsetValueNxNy = offsetValueNy + (minx);
- int offsetColorNxNy = offsetValueNxNy * COM_NUM_CHANNELS_COLOR;
+ int offsetColorNxNy = offsetValueNxNy * COM_data_type_num_channels(DataType::Color);
for (int nx = minx; nx < maxx; nx += addXStepValue) {
if (nx != x || ny != y) {
float size = MIN2(inputSizeFloatBuffer[offsetValueNxNy] * scalar, size_center);
diff --git a/source/blender/compositor/operations/COM_VectorBlurOperation.cc b/source/blender/compositor/operations/COM_VectorBlurOperation.cc
index c32075a5fd4..fb810dd4673 100644
--- a/source/blender/compositor/operations/COM_VectorBlurOperation.cc
+++ b/source/blender/compositor/operations/COM_VectorBlurOperation.cc
@@ -71,7 +71,7 @@ void VectorBlurOperation::initExecution()
void VectorBlurOperation::executePixel(float output[4], int x, int y, void *data)
{
float *buffer = (float *)data;
- int index = (y * this->getWidth() + x) * COM_NUM_CHANNELS_COLOR;
+ int index = (y * this->getWidth() + x) * COM_data_type_num_channels(DataType::Color);
copy_v4_v4(output, &buffer[index]);
}