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:
Diffstat (limited to 'source/blender/compositor/operations/COM_BokehBlurOperation.cc')
-rw-r--r--source/blender/compositor/operations/COM_BokehBlurOperation.cc78
1 files changed, 39 insertions, 39 deletions
diff --git a/source/blender/compositor/operations/COM_BokehBlurOperation.cc b/source/blender/compositor/operations/COM_BokehBlurOperation.cc
index c175eff093b..a9d1275805a 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;
- this->m_size = 1.0f;
- this->m_sizeavailable = false;
- this->m_inputProgram = nullptr;
- this->m_inputBokehProgram = nullptr;
- this->m_inputBoundingBoxReader = nullptr;
+ m_size = 1.0f;
+ m_sizeavailable = false;
+ m_inputProgram = nullptr;
+ m_inputBokehProgram = nullptr;
+ m_inputBoundingBoxReader = nullptr;
- this->m_extend_bounds = false;
+ m_extend_bounds = false;
}
void BokehBlurOperation::init_data()
@@ -68,7 +68,7 @@ void BokehBlurOperation::init_data()
void *BokehBlurOperation::initializeTileData(rcti * /*rect*/)
{
lockMutex();
- if (!this->m_sizeavailable) {
+ if (!m_sizeavailable) {
updateSize();
}
void *buffer = getInputOperation(0)->initializeTileData(nullptr);
@@ -80,9 +80,9 @@ void BokehBlurOperation::initExecution()
{
initMutex();
- this->m_inputProgram = getInputSocketReader(0);
- this->m_inputBokehProgram = getInputSocketReader(1);
- this->m_inputBoundingBoxReader = getInputSocketReader(2);
+ m_inputProgram = getInputSocketReader(0);
+ m_inputBokehProgram = getInputSocketReader(1);
+ m_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];
- this->m_inputBoundingBoxReader->readSampled(tempBoundingBox, x, y, PixelSampler::Nearest);
+ m_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 = this->m_size * max_dim / 100.0f;
+ int pixelSize = m_size * max_dim / 100.0f;
zero_v4(color_accum);
if (pixelSize < 2) {
- this->m_inputProgram->readSampled(color_accum, x, y, PixelSampler::Nearest);
+ m_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 = this->m_bokehDimension / pixelSize;
+ float m = 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 = this->m_bokehMidX - (nx - x) * m;
- float v = this->m_bokehMidY - (ny - y) * m;
- this->m_inputBokehProgram->readSampled(bokeh, u, v, PixelSampler::Nearest);
+ float u = m_bokehMidX - (nx - x) * m;
+ float v = m_bokehMidY - (ny - y) * m;
+ 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 {
- this->m_inputProgram->readSampled(output, x, y, PixelSampler::Nearest);
+ m_inputProgram->readSampled(output, x, y, PixelSampler::Nearest);
}
}
void BokehBlurOperation::deinitExecution()
{
deinitMutex();
- this->m_inputProgram = nullptr;
- this->m_inputBokehProgram = nullptr;
- this->m_inputBoundingBoxReader = nullptr;
+ m_inputProgram = nullptr;
+ m_inputBokehProgram = nullptr;
+ m_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 (this->m_sizeavailable) {
- newInput.xmax = input->xmax + (this->m_size * max_dim / 100.0f);
- newInput.xmin = input->xmin - (this->m_size * max_dim / 100.0f);
- newInput.ymax = input->ymax + (this->m_size * max_dim / 100.0f);
- newInput.ymin = input->ymin - (this->m_size * max_dim / 100.0f);
+ 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);
}
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 (!this->m_sizeavailable) {
+ if (!m_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 (!this->m_sizeavailable) {
+ if (!m_sizeavailable) {
updateSize();
}
const float max_dim = MAX2(this->getWidth(), this->getHeight());
- cl_int radius = this->m_size * max_dim / 100.0f;
+ cl_int radius = m_size * max_dim / 100.0f;
cl_int step = this->getStep();
device->COM_clAttachMemoryBufferToKernelParameter(
- kernel, 0, -1, clMemToCleanUp, inputMemoryBuffers, this->m_inputBoundingBoxReader);
+ kernel, 0, -1, clMemToCleanUp, inputMemoryBuffers, m_inputBoundingBoxReader);
device->COM_clAttachMemoryBufferToKernelParameter(
- kernel, 1, 4, clMemToCleanUp, inputMemoryBuffers, this->m_inputProgram);
+ kernel, 1, 4, clMemToCleanUp, inputMemoryBuffers, m_inputProgram);
device->COM_clAttachMemoryBufferToKernelParameter(
- kernel, 2, -1, clMemToCleanUp, inputMemoryBuffers, this->m_inputBokehProgram);
+ kernel, 2, -1, clMemToCleanUp, inputMemoryBuffers, m_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 (this->m_sizeavailable) {
+ if (m_sizeavailable) {
return;
}
@@ -247,8 +247,8 @@ void BokehBlurOperation::updateSize()
case eExecutionModel::Tiled: {
float result[4];
this->getInputSocketReader(3)->readSampled(result, 0, 0, PixelSampler::Nearest);
- this->m_size = result[0];
- CLAMP(this->m_size, 0.0f, 10.0f);
+ m_size = result[0];
+ CLAMP(m_size, 0.0f, 10.0f);
break;
}
case eExecutionModel::FullFrame: {
@@ -260,7 +260,7 @@ void BokehBlurOperation::updateSize()
break;
}
}
- this->m_sizeavailable = true;
+ m_sizeavailable = true;
}
void BokehBlurOperation::determine_canvas(const rcti &preferred_area, rcti &r_area)
@@ -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 * this->m_size * max_dim / 100.0f;
- r_area.ymax += 2 * this->m_size * max_dim / 100.0f;
+ r_area.xmax += 2 * m_size * max_dim / 100.0f;
+ r_area.ymax += 2 * m_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 * this->m_size * max_dim / 100.0f);
+ float add_size = round_to_even(2 * m_size * max_dim / 100.0f);
canvas.xmax += add_size;
canvas.ymax += add_size;
});