diff options
Diffstat (limited to 'source/blender/compositor/operations/COM_GlareFogGlowOperation.cc')
-rw-r--r-- | source/blender/compositor/operations/COM_GlareFogGlowOperation.cc | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/source/blender/compositor/operations/COM_GlareFogGlowOperation.cc b/source/blender/compositor/operations/COM_GlareFogGlowOperation.cc index 23dfc95f9e3..1c1eaebd331 100644 --- a/source/blender/compositor/operations/COM_GlareFogGlowOperation.cc +++ b/source/blender/compositor/operations/COM_GlareFogGlowOperation.cc @@ -19,6 +19,8 @@ #include "COM_GlareFogGlowOperation.h" #include "MEM_guardedalloc.h" +namespace blender::compositor { + /* * 2D Fast Hartley Transform, used for convolution */ @@ -271,7 +273,7 @@ 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_COLOR_CHANNELS * sizeof(float)); // convolution result width & height w2 = 2 * kernelWidth - 1; @@ -287,7 +289,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_COLOR_CHANNELS]; for (x = 0; x < kernelWidth; x++) { add_v3_v3(wt, colp[x]); } @@ -302,7 +304,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_COLOR_CHANNELS]; for (x = 0; x < kernelWidth; x++) { mul_v3_v3(colp[x], wt); } @@ -336,7 +338,7 @@ 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_COLOR_CHANNELS]; for (x = 0; x < kernelWidth; x++) { fp[x] = colp[x][ch]; } @@ -351,7 +353,7 @@ 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_COLOR_CHANNELS]; for (x = 0; x < xbsz; x++) { int xx = xbl * xbsz + x; if (xx >= imageWidth) { @@ -381,7 +383,7 @@ 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_COLOR_CHANNELS]; for (x = 0; x < (int)w2; x++) { const int xx = xbl * xbsz + x - hw; if ((xx < 0) || (xx >= imageWidth)) { @@ -397,8 +399,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_COLOR_CHANNELS); delete (rdst); } @@ -442,3 +445,5 @@ void GlareFogGlowOperation::generateGlare(float *data, convolve(data, inputTile, ckrn); delete ckrn; } + +} // namespace blender::compositor |