diff options
author | Manuel Castilla <manzanillawork@gmail.com> | 2021-10-14 00:01:04 +0300 |
---|---|---|
committer | Manuel Castilla <manzanillawork@gmail.com> | 2021-10-14 00:41:14 +0300 |
commit | a2ee3c3a9f01f5cb2f05f1e84a1b6c1931d9d4a4 (patch) | |
tree | d409678b16280311ed228929a45c9470f67a6dcd /source/blender/compositor/operations/COM_BokehBlurOperation.cc | |
parent | ea79efef70da14100b591b50dcada819808f20b6 (diff) |
Cleanup: replace members `m_` prefix by `_` suffix in Compositor
To convert old code to the current convention and
use a single code style.
Diffstat (limited to 'source/blender/compositor/operations/COM_BokehBlurOperation.cc')
-rw-r--r-- | source/blender/compositor/operations/COM_BokehBlurOperation.cc | 100 |
1 files changed, 50 insertions, 50 deletions
diff --git a/source/blender/compositor/operations/COM_BokehBlurOperation.cc b/source/blender/compositor/operations/COM_BokehBlurOperation.cc index a9d1275805a..d00a18baf7b 100644 --- a/source/blender/compositor/operations/COM_BokehBlurOperation.cc +++ b/source/blender/compositor/operations/COM_BokehBlurOperation.cc @@ -39,13 +39,13 @@ BokehBlurOperation::BokehBlurOperation() flags.complex = true; flags.open_cl = true; - m_size = 1.0f; - m_sizeavailable = false; - m_inputProgram = nullptr; - m_inputBokehProgram = nullptr; - m_inputBoundingBoxReader = nullptr; + size_ = 1.0f; + sizeavailable_ = false; + inputProgram_ = nullptr; + inputBokehProgram_ = nullptr; + inputBoundingBoxReader_ = nullptr; - m_extend_bounds = false; + extend_bounds_ = false; } void BokehBlurOperation::init_data() @@ -60,15 +60,15 @@ void BokehBlurOperation::init_data() const float dimension = MIN2(width, height); - m_bokehMidX = width / 2.0f; - m_bokehMidY = height / 2.0f; - m_bokehDimension = dimension / 2.0f; + bokehMidX_ = width / 2.0f; + bokehMidY_ = height / 2.0f; + bokehDimension_ = dimension / 2.0f; } void *BokehBlurOperation::initializeTileData(rcti * /*rect*/) { lockMutex(); - if (!m_sizeavailable) { + if (!sizeavailable_) { updateSize(); } void *buffer = getInputOperation(0)->initializeTileData(nullptr); @@ -80,9 +80,9 @@ void BokehBlurOperation::initExecution() { initMutex(); - m_inputProgram = getInputSocketReader(0); - m_inputBokehProgram = getInputSocketReader(1); - m_inputBoundingBoxReader = getInputSocketReader(2); + inputProgram_ = getInputSocketReader(0); + inputBokehProgram_ = getInputSocketReader(1); + inputBoundingBoxReader_ = getInputSocketReader(2); QualityStepHelper::initExecution(COM_QH_INCREASE); } @@ -93,7 +93,7 @@ void BokehBlurOperation::executePixel(float output[4], int x, int y, void *data) float tempBoundingBox[4]; float bokeh[4]; - m_inputBoundingBoxReader->readSampled(tempBoundingBox, x, y, PixelSampler::Nearest); + inputBoundingBoxReader_->readSampled(tempBoundingBox, x, y, PixelSampler::Nearest); if (tempBoundingBox[0] > 0.0f) { float multiplier_accum[4] = {0.0f, 0.0f, 0.0f, 0.0f}; MemoryBuffer *inputBuffer = (MemoryBuffer *)data; @@ -103,11 +103,11 @@ void BokehBlurOperation::executePixel(float output[4], int x, int y, void *data) int bufferstartx = input_rect.xmin; int bufferstarty = input_rect.ymin; const float max_dim = MAX2(this->getWidth(), this->getHeight()); - int pixelSize = m_size * max_dim / 100.0f; + int pixelSize = size_ * max_dim / 100.0f; zero_v4(color_accum); if (pixelSize < 2) { - m_inputProgram->readSampled(color_accum, x, y, PixelSampler::Nearest); + inputProgram_->readSampled(color_accum, x, y, PixelSampler::Nearest); multiplier_accum[0] = 1.0f; multiplier_accum[1] = 1.0f; multiplier_accum[2] = 1.0f; @@ -125,14 +125,14 @@ void BokehBlurOperation::executePixel(float output[4], int x, int y, void *data) int step = getStep(); int offsetadd = getOffsetAdd() * COM_DATA_TYPE_COLOR_CHANNELS; - float m = m_bokehDimension / pixelSize; + float m = bokehDimension_ / pixelSize; for (int ny = miny; ny < maxy; ny += step) { int bufferindex = ((minx - bufferstartx) * COM_DATA_TYPE_COLOR_CHANNELS) + ((ny - bufferstarty) * COM_DATA_TYPE_COLOR_CHANNELS * bufferwidth); for (int nx = minx; nx < maxx; nx += step) { - float u = m_bokehMidX - (nx - x) * m; - float v = m_bokehMidY - (ny - y) * m; - m_inputBokehProgram->readSampled(bokeh, u, v, PixelSampler::Nearest); + float u = bokehMidX_ - (nx - x) * m; + float v = bokehMidY_ - (ny - y) * m; + inputBokehProgram_->readSampled(bokeh, u, v, PixelSampler::Nearest); madd_v4_v4v4(color_accum, bokeh, &buffer[bufferindex]); add_v4_v4(multiplier_accum, bokeh); bufferindex += offsetadd; @@ -144,16 +144,16 @@ void BokehBlurOperation::executePixel(float output[4], int x, int y, void *data) output[3] = color_accum[3] * (1.0f / multiplier_accum[3]); } else { - m_inputProgram->readSampled(output, x, y, PixelSampler::Nearest); + inputProgram_->readSampled(output, x, y, PixelSampler::Nearest); } } void BokehBlurOperation::deinitExecution() { deinitMutex(); - m_inputProgram = nullptr; - m_inputBokehProgram = nullptr; - m_inputBoundingBoxReader = nullptr; + inputProgram_ = nullptr; + inputBokehProgram_ = nullptr; + inputBoundingBoxReader_ = nullptr; } bool BokehBlurOperation::determineDependingAreaOfInterest(rcti *input, @@ -164,11 +164,11 @@ bool BokehBlurOperation::determineDependingAreaOfInterest(rcti *input, rcti bokehInput; const float max_dim = MAX2(this->getWidth(), this->getHeight()); - if (m_sizeavailable) { - newInput.xmax = input->xmax + (m_size * max_dim / 100.0f); - newInput.xmin = input->xmin - (m_size * max_dim / 100.0f); - newInput.ymax = input->ymax + (m_size * max_dim / 100.0f); - newInput.ymin = input->ymin - (m_size * max_dim / 100.0f); + if (sizeavailable_) { + newInput.xmax = input->xmax + (size_ * max_dim / 100.0f); + newInput.xmin = input->xmin - (size_ * max_dim / 100.0f); + newInput.ymax = input->ymax + (size_ * max_dim / 100.0f); + newInput.ymin = input->ymin - (size_ * max_dim / 100.0f); } else { newInput.xmax = input->xmax + (10.0f * max_dim / 100.0f); @@ -193,7 +193,7 @@ bool BokehBlurOperation::determineDependingAreaOfInterest(rcti *input, if (operation->determineDependingAreaOfInterest(input, readOperation, output)) { return true; } - if (!m_sizeavailable) { + if (!sizeavailable_) { rcti sizeInput; sizeInput.xmin = 0; sizeInput.ymin = 0; @@ -215,19 +215,19 @@ void BokehBlurOperation::executeOpenCL(OpenCLDevice *device, std::list<cl_kernel> * /*clKernelsToCleanUp*/) { cl_kernel kernel = device->COM_clCreateKernel("bokehBlurKernel", nullptr); - if (!m_sizeavailable) { + if (!sizeavailable_) { updateSize(); } const float max_dim = MAX2(this->getWidth(), this->getHeight()); - cl_int radius = m_size * max_dim / 100.0f; + cl_int radius = size_ * max_dim / 100.0f; cl_int step = this->getStep(); device->COM_clAttachMemoryBufferToKernelParameter( - kernel, 0, -1, clMemToCleanUp, inputMemoryBuffers, m_inputBoundingBoxReader); + kernel, 0, -1, clMemToCleanUp, inputMemoryBuffers, inputBoundingBoxReader_); device->COM_clAttachMemoryBufferToKernelParameter( - kernel, 1, 4, clMemToCleanUp, inputMemoryBuffers, m_inputProgram); + kernel, 1, 4, clMemToCleanUp, inputMemoryBuffers, inputProgram_); device->COM_clAttachMemoryBufferToKernelParameter( - kernel, 2, -1, clMemToCleanUp, inputMemoryBuffers, m_inputBokehProgram); + kernel, 2, -1, clMemToCleanUp, inputMemoryBuffers, inputBokehProgram_); device->COM_clAttachOutputMemoryBufferToKernelParameter(kernel, 3, clOutputBuffer); device->COM_clAttachMemoryBufferOffsetToKernelParameter(kernel, 5, outputMemoryBuffer); clSetKernelArg(kernel, 6, sizeof(cl_int), &radius); @@ -239,7 +239,7 @@ void BokehBlurOperation::executeOpenCL(OpenCLDevice *device, void BokehBlurOperation::updateSize() { - if (m_sizeavailable) { + if (sizeavailable_) { return; } @@ -247,25 +247,25 @@ void BokehBlurOperation::updateSize() case eExecutionModel::Tiled: { float result[4]; this->getInputSocketReader(3)->readSampled(result, 0, 0, PixelSampler::Nearest); - m_size = result[0]; - CLAMP(m_size, 0.0f, 10.0f); + size_ = result[0]; + CLAMP(size_, 0.0f, 10.0f); break; } case eExecutionModel::FullFrame: { NodeOperation *size_input = get_input_operation(SIZE_INPUT_INDEX); if (size_input->get_flags().is_constant_operation) { - m_size = *static_cast<ConstantOperation *>(size_input)->get_constant_elem(); - CLAMP(m_size, 0.0f, 10.0f); + size_ = *static_cast<ConstantOperation *>(size_input)->get_constant_elem(); + CLAMP(size_, 0.0f, 10.0f); } /* Else use default. */ break; } } - m_sizeavailable = true; + sizeavailable_ = true; } void BokehBlurOperation::determine_canvas(const rcti &preferred_area, rcti &r_area) { - if (!m_extend_bounds) { + if (!extend_bounds_) { NodeOperation::determine_canvas(preferred_area, r_area); return; } @@ -274,15 +274,15 @@ void BokehBlurOperation::determine_canvas(const rcti &preferred_area, rcti &r_ar case eExecutionModel::Tiled: { NodeOperation::determine_canvas(preferred_area, r_area); const float max_dim = MAX2(BLI_rcti_size_x(&r_area), BLI_rcti_size_y(&r_area)); - r_area.xmax += 2 * m_size * max_dim / 100.0f; - r_area.ymax += 2 * m_size * max_dim / 100.0f; + r_area.xmax += 2 * size_ * max_dim / 100.0f; + r_area.ymax += 2 * size_ * max_dim / 100.0f; break; } case eExecutionModel::FullFrame: { set_determined_canvas_modifier([=](rcti &canvas) { const float max_dim = MAX2(BLI_rcti_size_x(&canvas), BLI_rcti_size_y(&canvas)); /* Rounding to even prevents image jiggling in backdrop while switching size values. */ - float add_size = round_to_even(2 * m_size * max_dim / 100.0f); + float add_size = round_to_even(2 * size_ * max_dim / 100.0f); canvas.xmax += add_size; canvas.ymax += add_size; }); @@ -299,7 +299,7 @@ void BokehBlurOperation::get_area_of_interest(const int input_idx, switch (input_idx) { case IMAGE_INPUT_INDEX: { const float max_dim = MAX2(this->getWidth(), this->getHeight()); - const float add_size = m_size * max_dim / 100.0f; + const float add_size = size_ * max_dim / 100.0f; r_input_area.xmin = output_area.xmin - add_size; r_input_area.xmax = output_area.xmax + add_size; r_input_area.ymin = output_area.ymin - add_size; @@ -326,8 +326,8 @@ void BokehBlurOperation::update_memory_buffer_partial(MemoryBuffer *output, Span<MemoryBuffer *> inputs) { const float max_dim = MAX2(this->getWidth(), this->getHeight()); - const int pixel_size = m_size * max_dim / 100.0f; - const float m = m_bokehDimension / pixel_size; + const int pixel_size = size_ * max_dim / 100.0f; + const float m = bokehDimension_ / pixel_size; const MemoryBuffer *image_input = inputs[IMAGE_INPUT_INDEX]; const MemoryBuffer *bokeh_input = inputs[BOKEH_INPUT_INDEX]; @@ -362,9 +362,9 @@ void BokehBlurOperation::update_memory_buffer_partial(MemoryBuffer *output, const float *row_color = image_input->get_elem(minx, miny); for (int ny = miny; ny < maxy; ny += step, row_color += row_stride) { const float *color = row_color; - const float v = m_bokehMidY - (ny - y) * m; + const float v = bokehMidY_ - (ny - y) * m; for (int nx = minx; nx < maxx; nx += step, color += elem_stride) { - const float u = m_bokehMidX - (nx - x) * m; + const float u = bokehMidX_ - (nx - x) * m; float bokeh[4]; bokeh_input->read_elem_checked(u, v, bokeh); madd_v4_v4v4(color_accum, bokeh, color); |