diff options
Diffstat (limited to 'source/blender/compositor/operations')
10 files changed, 49 insertions, 35 deletions
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]); } |