Cleanup: remove this-> for m_ prefixed members in Compositor

For cleaning old code style as new code usually omit it.
This commit is contained in:
2021-10-13 23:00:50 +02:00
parent ecb8a574c7
commit ea79efef70
198 changed files with 2879 additions and 2961 deletions

View File

@@ -22,14 +22,14 @@ namespace blender::compositor {
CompositorContext::CompositorContext()
{
this->m_scene = nullptr;
this->m_rd = nullptr;
this->m_quality = eCompositorQuality::High;
this->m_hasActiveOpenCLDevices = false;
this->m_fastCalculation = false;
this->m_viewSettings = nullptr;
this->m_displaySettings = nullptr;
this->m_bnodetree = nullptr;
m_scene = nullptr;
m_rd = nullptr;
m_quality = eCompositorQuality::High;
m_hasActiveOpenCLDevices = false;
m_fastCalculation = false;
m_viewSettings = nullptr;
m_displaySettings = nullptr;
m_bnodetree = nullptr;
}
int CompositorContext::getFramenumber() const

View File

@@ -99,7 +99,7 @@ class CompositorContext {
*/
void setRendering(bool rendering)
{
this->m_rendering = rendering;
m_rendering = rendering;
}
/**
@@ -107,7 +107,7 @@ class CompositorContext {
*/
bool isRendering() const
{
return this->m_rendering;
return m_rendering;
}
/**
@@ -115,7 +115,7 @@ class CompositorContext {
*/
void setRenderData(RenderData *rd)
{
this->m_rd = rd;
m_rd = rd;
}
/**
@@ -123,7 +123,7 @@ class CompositorContext {
*/
void setbNodeTree(bNodeTree *bnodetree)
{
this->m_bnodetree = bnodetree;
m_bnodetree = bnodetree;
}
/**
@@ -131,7 +131,7 @@ class CompositorContext {
*/
const bNodeTree *getbNodeTree() const
{
return this->m_bnodetree;
return m_bnodetree;
}
/**
@@ -139,7 +139,7 @@ class CompositorContext {
*/
const RenderData *getRenderData() const
{
return this->m_rd;
return m_rd;
}
void setScene(Scene *scene)
@@ -156,7 +156,7 @@ class CompositorContext {
*/
void setPreviewHash(bNodeInstanceHash *previews)
{
this->m_previews = previews;
m_previews = previews;
}
/**
@@ -164,7 +164,7 @@ class CompositorContext {
*/
bNodeInstanceHash *getPreviewHash() const
{
return this->m_previews;
return m_previews;
}
/**
@@ -172,7 +172,7 @@ class CompositorContext {
*/
void setViewSettings(const ColorManagedViewSettings *viewSettings)
{
this->m_viewSettings = viewSettings;
m_viewSettings = viewSettings;
}
/**
@@ -180,7 +180,7 @@ class CompositorContext {
*/
const ColorManagedViewSettings *getViewSettings() const
{
return this->m_viewSettings;
return m_viewSettings;
}
/**
@@ -188,7 +188,7 @@ class CompositorContext {
*/
void setDisplaySettings(const ColorManagedDisplaySettings *displaySettings)
{
this->m_displaySettings = displaySettings;
m_displaySettings = displaySettings;
}
/**
@@ -196,7 +196,7 @@ class CompositorContext {
*/
const ColorManagedDisplaySettings *getDisplaySettings() const
{
return this->m_displaySettings;
return m_displaySettings;
}
/**
@@ -204,7 +204,7 @@ class CompositorContext {
*/
void setQuality(eCompositorQuality quality)
{
this->m_quality = quality;
m_quality = quality;
}
/**
@@ -212,7 +212,7 @@ class CompositorContext {
*/
eCompositorQuality getQuality() const
{
return this->m_quality;
return m_quality;
}
/**
@@ -225,7 +225,7 @@ class CompositorContext {
*/
bool getHasActiveOpenCLDevices() const
{
return this->m_hasActiveOpenCLDevices;
return m_hasActiveOpenCLDevices;
}
/**
@@ -233,7 +233,7 @@ class CompositorContext {
*/
void setHasActiveOpenCLDevices(bool hasAvtiveOpenCLDevices)
{
this->m_hasActiveOpenCLDevices = hasAvtiveOpenCLDevices;
m_hasActiveOpenCLDevices = hasAvtiveOpenCLDevices;
}
/** Whether it has a view with a specific name and not the default one. */
@@ -247,7 +247,7 @@ class CompositorContext {
*/
const char *getViewName() const
{
return this->m_viewName;
return m_viewName;
}
/**
@@ -255,7 +255,7 @@ class CompositorContext {
*/
void setViewName(const char *viewName)
{
this->m_viewName = viewName;
m_viewName = viewName;
}
int getChunksize() const
@@ -265,11 +265,11 @@ class CompositorContext {
void setFastCalculation(bool fastCalculation)
{
this->m_fastCalculation = fastCalculation;
m_fastCalculation = fastCalculation;
}
bool isFastCalculation() const
{
return this->m_fastCalculation;
return m_fastCalculation;
}
bool isGroupnodeBufferEnabled() const
{

View File

@@ -56,16 +56,16 @@ std::ostream &operator<<(std::ostream &os, const ExecutionGroupFlags &flags)
ExecutionGroup::ExecutionGroup(int id)
{
m_id = id;
this->m_bTree = nullptr;
this->m_height = 0;
this->m_width = 0;
this->m_max_read_buffer_offset = 0;
this->m_x_chunks_len = 0;
this->m_y_chunks_len = 0;
this->m_chunks_len = 0;
this->m_chunks_finished = 0;
BLI_rcti_init(&this->m_viewerBorder, 0, 0, 0, 0);
this->m_executionStartTime = 0;
m_bTree = nullptr;
m_height = 0;
m_width = 0;
m_max_read_buffer_offset = 0;
m_x_chunks_len = 0;
m_y_chunks_len = 0;
m_chunks_len = 0;
m_chunks_finished = 0;
BLI_rcti_init(&m_viewerBorder, 0, 0, 0, 0);
m_executionStartTime = 0;
}
std::ostream &operator<<(std::ostream &os, const ExecutionGroup &execution_group)
@@ -139,8 +139,8 @@ NodeOperation *ExecutionGroup::getOutputOperation() const
void ExecutionGroup::init_work_packages()
{
m_work_packages.clear();
if (this->m_chunks_len != 0) {
m_work_packages.resize(this->m_chunks_len);
if (m_chunks_len != 0) {
m_work_packages.resize(m_chunks_len);
for (unsigned int index = 0; index < m_chunks_len; index++) {
m_work_packages[index].type = eWorkPackageType::Tile;
m_work_packages[index].state = eWorkPackageState::NotScheduled;
@@ -157,12 +157,12 @@ void ExecutionGroup::init_read_buffer_operations()
for (NodeOperation *operation : m_operations) {
if (operation->get_flags().is_read_buffer_operation) {
ReadBufferOperation *readOperation = static_cast<ReadBufferOperation *>(operation);
this->m_read_operations.append(readOperation);
m_read_operations.append(readOperation);
max_offset = MAX2(max_offset, readOperation->getOffset());
}
}
max_offset++;
this->m_max_read_buffer_offset = max_offset;
m_max_read_buffer_offset = max_offset;
}
void ExecutionGroup::initExecution()
@@ -175,11 +175,11 @@ void ExecutionGroup::initExecution()
void ExecutionGroup::deinitExecution()
{
m_work_packages.clear();
this->m_chunks_len = 0;
this->m_x_chunks_len = 0;
this->m_y_chunks_len = 0;
this->m_read_operations.clear();
this->m_bTree = nullptr;
m_chunks_len = 0;
m_x_chunks_len = 0;
m_y_chunks_len = 0;
m_read_operations.clear();
m_bTree = nullptr;
}
void ExecutionGroup::determineResolution(unsigned int resolution[2])
@@ -188,30 +188,30 @@ void ExecutionGroup::determineResolution(unsigned int resolution[2])
resolution[0] = operation->getWidth();
resolution[1] = operation->getHeight();
this->setResolution(resolution);
BLI_rcti_init(&this->m_viewerBorder, 0, this->m_width, 0, this->m_height);
BLI_rcti_init(&m_viewerBorder, 0, m_width, 0, m_height);
}
void ExecutionGroup::init_number_of_chunks()
{
if (this->m_flags.single_threaded) {
this->m_x_chunks_len = 1;
this->m_y_chunks_len = 1;
this->m_chunks_len = 1;
if (m_flags.single_threaded) {
m_x_chunks_len = 1;
m_y_chunks_len = 1;
m_chunks_len = 1;
}
else {
const float chunkSizef = this->m_chunkSize;
const int border_width = BLI_rcti_size_x(&this->m_viewerBorder);
const int border_height = BLI_rcti_size_y(&this->m_viewerBorder);
this->m_x_chunks_len = ceil(border_width / chunkSizef);
this->m_y_chunks_len = ceil(border_height / chunkSizef);
this->m_chunks_len = this->m_x_chunks_len * this->m_y_chunks_len;
const float chunkSizef = m_chunkSize;
const int border_width = BLI_rcti_size_x(&m_viewerBorder);
const int border_height = BLI_rcti_size_y(&m_viewerBorder);
m_x_chunks_len = ceil(border_width / chunkSizef);
m_y_chunks_len = ceil(border_height / chunkSizef);
m_chunks_len = m_x_chunks_len * m_y_chunks_len;
}
}
blender::Array<unsigned int> ExecutionGroup::get_execution_order() const
{
blender::Array<unsigned int> chunk_order(m_chunks_len);
for (int chunk_index = 0; chunk_index < this->m_chunks_len; chunk_index++) {
for (int chunk_index = 0; chunk_index < m_chunks_len; chunk_index++) {
chunk_order[chunk_index] = chunk_index;
}
@@ -227,8 +227,8 @@ blender::Array<unsigned int> ExecutionGroup::get_execution_order() const
order_type = viewer->getChunkOrder();
}
const int border_width = BLI_rcti_size_x(&this->m_viewerBorder);
const int border_height = BLI_rcti_size_y(&this->m_viewerBorder);
const int border_width = BLI_rcti_size_x(&m_viewerBorder);
const int border_height = BLI_rcti_size_y(&m_viewerBorder);
int index;
switch (order_type) {
case ChunkOrdering::Random: {
@@ -242,16 +242,16 @@ blender::Array<unsigned int> ExecutionGroup::get_execution_order() const
case ChunkOrdering::CenterOut: {
ChunkOrderHotspot hotspot(border_width * centerX, border_height * centerY, 0.0f);
blender::Array<ChunkOrder> chunk_orders(m_chunks_len);
for (index = 0; index < this->m_chunks_len; index++) {
for (index = 0; index < m_chunks_len; index++) {
const WorkPackage &work_package = m_work_packages[index];
chunk_orders[index].index = index;
chunk_orders[index].x = work_package.rect.xmin - this->m_viewerBorder.xmin;
chunk_orders[index].y = work_package.rect.ymin - this->m_viewerBorder.ymin;
chunk_orders[index].x = work_package.rect.xmin - m_viewerBorder.xmin;
chunk_orders[index].y = work_package.rect.ymin - m_viewerBorder.ymin;
chunk_orders[index].update_distance(&hotspot, 1);
}
std::sort(&chunk_orders[0], &chunk_orders[this->m_chunks_len - 1]);
for (index = 0; index < this->m_chunks_len; index++) {
std::sort(&chunk_orders[0], &chunk_orders[m_chunks_len - 1]);
for (index = 0; index < m_chunks_len; index++) {
chunk_order[index] = chunk_orders[index].index;
}
@@ -264,7 +264,7 @@ blender::Array<unsigned int> ExecutionGroup::get_execution_order() const
unsigned int my = border_height / 2;
unsigned int bx = mx + 2 * tx;
unsigned int by = my + 2 * ty;
float addition = this->m_chunks_len / COM_RULE_OF_THIRDS_DIVIDER;
float addition = m_chunks_len / COM_RULE_OF_THIRDS_DIVIDER;
ChunkOrderHotspot hotspots[9]{
ChunkOrderHotspot(mx, my, addition * 0),
@@ -279,17 +279,17 @@ blender::Array<unsigned int> ExecutionGroup::get_execution_order() const
};
blender::Array<ChunkOrder> chunk_orders(m_chunks_len);
for (index = 0; index < this->m_chunks_len; index++) {
for (index = 0; index < m_chunks_len; index++) {
const WorkPackage &work_package = m_work_packages[index];
chunk_orders[index].index = index;
chunk_orders[index].x = work_package.rect.xmin - this->m_viewerBorder.xmin;
chunk_orders[index].y = work_package.rect.ymin - this->m_viewerBorder.ymin;
chunk_orders[index].x = work_package.rect.xmin - m_viewerBorder.xmin;
chunk_orders[index].y = work_package.rect.ymin - m_viewerBorder.ymin;
chunk_orders[index].update_distance(hotspots, 9);
}
std::sort(&chunk_orders[0], &chunk_orders[this->m_chunks_len]);
std::sort(&chunk_orders[0], &chunk_orders[m_chunks_len]);
for (index = 0; index < this->m_chunks_len; index++) {
for (index = 0; index < m_chunks_len; index++) {
chunk_order[index] = chunk_orders[index].index;
}
@@ -310,21 +310,21 @@ void ExecutionGroup::execute(ExecutionSystem *graph)
{
const CompositorContext &context = graph->getContext();
const bNodeTree *bTree = context.getbNodeTree();
if (this->m_width == 0 || this->m_height == 0) {
if (m_width == 0 || m_height == 0) {
return;
} /** \note Break out... no pixels to calculate. */
if (bTree->test_break && bTree->test_break(bTree->tbh)) {
return;
} /** \note Early break out for blur and preview nodes. */
if (this->m_chunks_len == 0) {
if (m_chunks_len == 0) {
return;
} /** \note Early break out. */
unsigned int chunk_index;
this->m_executionStartTime = PIL_check_seconds_timer();
m_executionStartTime = PIL_check_seconds_timer();
this->m_chunks_finished = 0;
this->m_bTree = bTree;
m_chunks_finished = 0;
m_bTree = bTree;
blender::Array<unsigned int> chunk_order = get_execution_order();
@@ -341,12 +341,11 @@ void ExecutionGroup::execute(ExecutionSystem *graph)
finished = true;
int numberEvaluated = 0;
for (int index = startIndex;
index < this->m_chunks_len && numberEvaluated < maxNumberEvaluated;
for (int index = startIndex; index < m_chunks_len && numberEvaluated < maxNumberEvaluated;
index++) {
chunk_index = chunk_order[index];
int yChunk = chunk_index / this->m_x_chunks_len;
int xChunk = chunk_index - (yChunk * this->m_x_chunks_len);
int yChunk = chunk_index / m_x_chunks_len;
int xChunk = chunk_index - (yChunk * m_x_chunks_len);
const WorkPackage &work_package = m_work_packages[chunk_index];
switch (work_package.state) {
case eWorkPackageState::NotScheduled: {
@@ -389,7 +388,7 @@ MemoryBuffer **ExecutionGroup::getInputBuffersOpenCL(int chunkNumber)
WorkPackage &work_package = m_work_packages[chunkNumber];
MemoryBuffer **memoryBuffers = (MemoryBuffer **)MEM_callocN(
sizeof(MemoryBuffer *) * this->m_max_read_buffer_offset, __func__);
sizeof(MemoryBuffer *) * m_max_read_buffer_offset, __func__);
rcti output;
for (ReadBufferOperation *readOperation : m_read_operations) {
MemoryProxy *memoryProxy = readOperation->getMemoryProxy();
@@ -417,9 +416,9 @@ void ExecutionGroup::finalizeChunkExecution(int chunkNumber, MemoryBuffer **memo
work_package.state = eWorkPackageState::Executed;
}
atomic_add_and_fetch_u(&this->m_chunks_finished, 1);
atomic_add_and_fetch_u(&m_chunks_finished, 1);
if (memoryBuffers) {
for (unsigned int index = 0; index < this->m_max_read_buffer_offset; index++) {
for (unsigned int index = 0; index < m_max_read_buffer_offset; index++) {
MemoryBuffer *buffer = memoryBuffers[index];
if (buffer) {
if (buffer->isTemporarily()) {
@@ -430,19 +429,16 @@ void ExecutionGroup::finalizeChunkExecution(int chunkNumber, MemoryBuffer **memo
}
MEM_freeN(memoryBuffers);
}
if (this->m_bTree) {
if (m_bTree) {
/* Status report is only performed for top level Execution Groups. */
float progress = this->m_chunks_finished;
progress /= this->m_chunks_len;
this->m_bTree->progress(this->m_bTree->prh, progress);
float progress = m_chunks_finished;
progress /= m_chunks_len;
m_bTree->progress(m_bTree->prh, progress);
char buf[128];
BLI_snprintf(buf,
sizeof(buf),
TIP_("Compositing | Tile %u-%u"),
this->m_chunks_finished,
this->m_chunks_len);
this->m_bTree->stats_draw(this->m_bTree->sdh, buf);
BLI_snprintf(
buf, sizeof(buf), TIP_("Compositing | Tile %u-%u"), m_chunks_finished, m_chunks_len);
m_bTree->stats_draw(m_bTree->sdh, buf);
}
}
@@ -450,30 +446,29 @@ inline void ExecutionGroup::determineChunkRect(rcti *r_rect,
const unsigned int xChunk,
const unsigned int yChunk) const
{
const int border_width = BLI_rcti_size_x(&this->m_viewerBorder);
const int border_height = BLI_rcti_size_y(&this->m_viewerBorder);
const int border_width = BLI_rcti_size_x(&m_viewerBorder);
const int border_height = BLI_rcti_size_y(&m_viewerBorder);
if (this->m_flags.single_threaded) {
BLI_rcti_init(
r_rect, this->m_viewerBorder.xmin, border_width, this->m_viewerBorder.ymin, border_height);
if (m_flags.single_threaded) {
BLI_rcti_init(r_rect, m_viewerBorder.xmin, border_width, m_viewerBorder.ymin, border_height);
}
else {
const unsigned int minx = xChunk * this->m_chunkSize + this->m_viewerBorder.xmin;
const unsigned int miny = yChunk * this->m_chunkSize + this->m_viewerBorder.ymin;
const unsigned int width = MIN2((unsigned int)this->m_viewerBorder.xmax, this->m_width);
const unsigned int height = MIN2((unsigned int)this->m_viewerBorder.ymax, this->m_height);
const unsigned int minx = xChunk * m_chunkSize + m_viewerBorder.xmin;
const unsigned int miny = yChunk * m_chunkSize + m_viewerBorder.ymin;
const unsigned int width = MIN2((unsigned int)m_viewerBorder.xmax, m_width);
const unsigned int height = MIN2((unsigned int)m_viewerBorder.ymax, m_height);
BLI_rcti_init(r_rect,
MIN2(minx, this->m_width),
MIN2(minx + this->m_chunkSize, width),
MIN2(miny, this->m_height),
MIN2(miny + this->m_chunkSize, height));
MIN2(minx, m_width),
MIN2(minx + m_chunkSize, width),
MIN2(miny, m_height),
MIN2(miny + m_chunkSize, height));
}
}
void ExecutionGroup::determineChunkRect(rcti *r_rect, const unsigned int chunkNumber) const
{
const unsigned int yChunk = chunkNumber / this->m_x_chunks_len;
const unsigned int xChunk = chunkNumber - (yChunk * this->m_x_chunks_len);
const unsigned int yChunk = chunkNumber / m_x_chunks_len;
const unsigned int xChunk = chunkNumber - (yChunk * m_x_chunks_len);
determineChunkRect(r_rect, xChunk, yChunk);
}
@@ -492,7 +487,7 @@ MemoryBuffer *ExecutionGroup::allocateOutputBuffer(rcti &rect)
bool ExecutionGroup::scheduleAreaWhenPossible(ExecutionSystem *graph, rcti *area)
{
if (this->m_flags.single_threaded) {
if (m_flags.single_threaded) {
return scheduleChunkWhenPossible(graph, 0, 0);
}
/* Find all chunks inside the rect
@@ -540,15 +535,15 @@ bool ExecutionGroup::scheduleChunkWhenPossible(ExecutionSystem *graph,
const int chunk_x,
const int chunk_y)
{
if (chunk_x < 0 || chunk_x >= (int)this->m_x_chunks_len) {
if (chunk_x < 0 || chunk_x >= (int)m_x_chunks_len) {
return true;
}
if (chunk_y < 0 || chunk_y >= (int)this->m_y_chunks_len) {
if (chunk_y < 0 || chunk_y >= (int)m_y_chunks_len) {
return true;
}
/* Check if chunk is already executed or scheduled and not yet executed. */
const int chunk_index = chunk_y * this->m_x_chunks_len + chunk_x;
const int chunk_index = chunk_y * m_x_chunks_len + chunk_x;
WorkPackage &work_package = m_work_packages[chunk_index];
if (work_package.state == eWorkPackageState::Executed) {
return true;
@@ -589,11 +584,8 @@ void ExecutionGroup::setViewerBorder(float xmin, float xmax, float ymin, float y
{
const NodeOperation &operation = *this->getOutputOperation();
if (operation.get_flags().use_viewer_border) {
BLI_rcti_init(&this->m_viewerBorder,
xmin * this->m_width,
xmax * this->m_width,
ymin * this->m_height,
ymax * this->m_height);
BLI_rcti_init(
&m_viewerBorder, xmin * m_width, xmax * m_width, ymin * m_height, ymax * m_height);
}
}
@@ -601,11 +593,8 @@ void ExecutionGroup::setRenderBorder(float xmin, float xmax, float ymin, float y
{
const NodeOperation &operation = *this->getOutputOperation();
if (operation.isOutputOperation(true) && operation.get_flags().use_render_border) {
BLI_rcti_init(&this->m_viewerBorder,
xmin * this->m_width,
xmax * this->m_width,
ymin * this->m_height,
ymax * this->m_height);
BLI_rcti_init(
&m_viewerBorder, xmin * m_width, xmax * m_width, ymin * m_height, ymax * m_height);
}
}

View File

@@ -266,7 +266,7 @@ class ExecutionGroup {
*/
void setOutputExecutionGroup(bool is_output)
{
this->m_flags.is_output = is_output;
m_flags.is_output = is_output;
}
/**
@@ -281,8 +281,8 @@ class ExecutionGroup {
*/
void setResolution(unsigned int resolution[2])
{
this->m_width = resolution[0];
this->m_height = resolution[1];
m_width = resolution[0];
m_height = resolution[1];
}
/**
@@ -381,7 +381,7 @@ class ExecutionGroup {
void setChunksize(int chunksize)
{
this->m_chunkSize = chunksize;
m_chunkSize = chunksize;
}
/**

View File

@@ -43,25 +43,25 @@ ExecutionSystem::ExecutionSystem(RenderData *rd,
const char *viewName)
{
num_work_threads_ = WorkScheduler::get_num_cpu_threads();
this->m_context.setViewName(viewName);
this->m_context.setScene(scene);
this->m_context.setbNodeTree(editingtree);
this->m_context.setPreviewHash(editingtree->previews);
this->m_context.setFastCalculation(fastcalculation);
m_context.setViewName(viewName);
m_context.setScene(scene);
m_context.setbNodeTree(editingtree);
m_context.setPreviewHash(editingtree->previews);
m_context.setFastCalculation(fastcalculation);
/* initialize the CompositorContext */
if (rendering) {
this->m_context.setQuality((eCompositorQuality)editingtree->render_quality);
m_context.setQuality((eCompositorQuality)editingtree->render_quality);
}
else {
this->m_context.setQuality((eCompositorQuality)editingtree->edit_quality);
m_context.setQuality((eCompositorQuality)editingtree->edit_quality);
}
this->m_context.setRendering(rendering);
this->m_context.setHasActiveOpenCLDevices(WorkScheduler::has_gpu_devices() &&
m_context.setRendering(rendering);
m_context.setHasActiveOpenCLDevices(WorkScheduler::has_gpu_devices() &&
(editingtree->flag & NTREE_COM_OPENCL));
this->m_context.setRenderData(rd);
this->m_context.setViewSettings(viewSettings);
this->m_context.setDisplaySettings(displaySettings);
m_context.setRenderData(rd);
m_context.setViewSettings(viewSettings);
m_context.setDisplaySettings(displaySettings);
BLI_mutex_init(&work_mutex_);
BLI_condition_init(&work_finished_cond_);
@@ -94,12 +94,12 @@ ExecutionSystem::~ExecutionSystem()
for (NodeOperation *operation : m_operations) {
delete operation;
}
this->m_operations.clear();
m_operations.clear();
for (ExecutionGroup *group : m_groups) {
delete group;
}
this->m_groups.clear();
m_groups.clear();
}
void ExecutionSystem::set_operations(const Vector<NodeOperation *> &operations,

View File

@@ -200,7 +200,7 @@ class ExecutionSystem {
*/
const CompositorContext &getContext() const
{
return this->m_context;
return m_context;
}
SharedOperationBuffers &get_active_buffers()

View File

@@ -47,14 +47,14 @@ static rcti create_rect(const int width, const int height)
MemoryBuffer::MemoryBuffer(MemoryProxy *memoryProxy, const rcti &rect, MemoryBufferState state)
{
m_rect = rect;
this->m_is_a_single_elem = false;
this->m_memoryProxy = memoryProxy;
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");
m_is_a_single_elem = false;
m_memoryProxy = memoryProxy;
m_num_channels = COM_data_type_num_channels(memoryProxy->getDataType());
m_buffer = (float *)MEM_mallocN_aligned(
sizeof(float) * buffer_len() * m_num_channels, 16, "COM_MemoryBuffer");
owns_data_ = true;
this->m_state = state;
this->m_datatype = memoryProxy->getDataType();
m_state = state;
m_datatype = memoryProxy->getDataType();
set_strides();
}
@@ -62,14 +62,14 @@ MemoryBuffer::MemoryBuffer(MemoryProxy *memoryProxy, const rcti &rect, MemoryBuf
MemoryBuffer::MemoryBuffer(DataType dataType, const rcti &rect, bool is_a_single_elem)
{
m_rect = rect;
this->m_is_a_single_elem = is_a_single_elem;
this->m_memoryProxy = nullptr;
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");
m_is_a_single_elem = is_a_single_elem;
m_memoryProxy = nullptr;
m_num_channels = COM_data_type_num_channels(dataType);
m_buffer = (float *)MEM_mallocN_aligned(
sizeof(float) * buffer_len() * m_num_channels, 16, "COM_MemoryBuffer");
owns_data_ = true;
this->m_state = MemoryBufferState::Temporary;
this->m_datatype = dataType;
m_state = MemoryBufferState::Temporary;
m_datatype = dataType;
set_strides();
}
@@ -153,20 +153,20 @@ BuffersIterator<float> MemoryBuffer::iterate_with(Span<MemoryBuffer *> inputs, c
MemoryBuffer *MemoryBuffer::inflate() const
{
BLI_assert(is_a_single_elem());
MemoryBuffer *inflated = new MemoryBuffer(this->m_datatype, this->m_rect, false);
inflated->copy_from(this, this->m_rect);
MemoryBuffer *inflated = new MemoryBuffer(m_datatype, m_rect, false);
inflated->copy_from(this, m_rect);
return inflated;
}
float MemoryBuffer::get_max_value() const
{
float result = this->m_buffer[0];
float result = m_buffer[0];
const unsigned int size = this->buffer_len();
unsigned int i;
const float *fp_src = this->m_buffer;
const float *fp_src = m_buffer;
for (i = 0; i < size; i++, fp_src += this->m_num_channels) {
for (i = 0; i < size; i++, fp_src += m_num_channels) {
float value = *fp_src;
if (value > result) {
result = value;
@@ -181,10 +181,10 @@ float MemoryBuffer::get_max_value(const rcti &rect) const
rcti rect_clamp;
/* first clamp the rect by the bounds or we get un-initialized values */
BLI_rcti_isect(&rect, &this->m_rect, &rect_clamp);
BLI_rcti_isect(&rect, &m_rect, &rect_clamp);
if (!BLI_rcti_is_empty(&rect_clamp)) {
MemoryBuffer temp_buffer(this->m_datatype, rect_clamp);
MemoryBuffer temp_buffer(m_datatype, rect_clamp);
temp_buffer.fill_from(*this);
return temp_buffer.get_max_value();
}
@@ -195,9 +195,9 @@ float MemoryBuffer::get_max_value(const rcti &rect) const
MemoryBuffer::~MemoryBuffer()
{
if (this->m_buffer && owns_data_) {
MEM_freeN(this->m_buffer);
this->m_buffer = nullptr;
if (m_buffer && owns_data_) {
MEM_freeN(m_buffer);
m_buffer = nullptr;
}
}
@@ -398,30 +398,28 @@ void MemoryBuffer::fill(const rcti &area,
void MemoryBuffer::fill_from(const MemoryBuffer &src)
{
rcti overlap;
overlap.xmin = MAX2(this->m_rect.xmin, src.m_rect.xmin);
overlap.xmax = MIN2(this->m_rect.xmax, src.m_rect.xmax);
overlap.ymin = MAX2(this->m_rect.ymin, src.m_rect.ymin);
overlap.ymax = MIN2(this->m_rect.ymax, src.m_rect.ymax);
overlap.xmin = MAX2(m_rect.xmin, src.m_rect.xmin);
overlap.xmax = MIN2(m_rect.xmax, src.m_rect.xmax);
overlap.ymin = MAX2(m_rect.ymin, src.m_rect.ymin);
overlap.ymax = MIN2(m_rect.ymax, src.m_rect.ymax);
copy_from(&src, overlap);
}
void MemoryBuffer::writePixel(int x, int y, const float color[4])
{
if (x >= this->m_rect.xmin && x < this->m_rect.xmax && y >= this->m_rect.ymin &&
y < this->m_rect.ymax) {
if (x >= m_rect.xmin && x < m_rect.xmax && y >= m_rect.ymin && y < m_rect.ymax) {
const int offset = get_coords_offset(x, y);
memcpy(&this->m_buffer[offset], color, sizeof(float) * this->m_num_channels);
memcpy(&m_buffer[offset], color, sizeof(float) * m_num_channels);
}
}
void MemoryBuffer::addPixel(int x, int y, const float color[4])
{
if (x >= this->m_rect.xmin && x < this->m_rect.xmax && y >= this->m_rect.ymin &&
y < this->m_rect.ymax) {
if (x >= m_rect.xmin && x < m_rect.xmax && y >= m_rect.ymin && y < m_rect.ymax) {
const int offset = get_coords_offset(x, y);
float *dst = &this->m_buffer[offset];
float *dst = &m_buffer[offset];
const float *src = color;
for (int i = 0; i < this->m_num_channels; i++, dst++, src++) {
for (int i = 0; i < m_num_channels; i++, dst++, src++) {
*dst += *src;
}
}
@@ -436,7 +434,7 @@ static void read_ewa_elem(void *userdata, int x, int y, float result[4])
void MemoryBuffer::read_elem_filtered(
const float x, const float y, float dx[2], float dy[2], float *out) const
{
BLI_assert(this->m_datatype == DataType::Color);
BLI_assert(m_datatype == DataType::Color);
const float deriv[2][2] = {{dx[0], dx[1]}, {dy[0], dy[1]}};
@@ -472,10 +470,10 @@ static void read_ewa_pixel_sampled(void *userdata, int x, int y, float result[4]
void MemoryBuffer::readEWA(float *result, const float uv[2], const float derivatives[2][2])
{
if (m_is_a_single_elem) {
memcpy(result, m_buffer, sizeof(float) * this->m_num_channels);
memcpy(result, m_buffer, sizeof(float) * m_num_channels);
}
else {
BLI_assert(this->m_datatype == DataType::Color);
BLI_assert(m_datatype == DataType::Color);
float inv_width = 1.0f / (float)this->getWidth(), inv_height = 1.0f / (float)this->getHeight();
/* TODO(sergey): Render pipeline uses normalized coordinates and derivatives,
* but compositor uses pixel space. For now let's just divide the values and

View File

@@ -330,12 +330,12 @@ class MemoryBuffer {
uint8_t get_num_channels() const
{
return this->m_num_channels;
return m_num_channels;
}
uint8_t get_elem_bytes_len() const
{
return this->m_num_channels * sizeof(float);
return m_num_channels * sizeof(float);
}
/**
@@ -370,13 +370,13 @@ class MemoryBuffer {
*/
float *getBuffer()
{
return this->m_buffer;
return m_buffer;
}
float *release_ownership_buffer()
{
owns_data_ = false;
return this->m_buffer;
return m_buffer;
}
MemoryBuffer *inflate() const;
@@ -494,15 +494,15 @@ class MemoryBuffer {
bool clip_y = (extend_y == MemoryBufferExtend::Clip && (y < m_rect.ymin || y >= m_rect.ymax));
if (clip_x || clip_y) {
/* clip result outside rect is zero */
memset(result, 0, this->m_num_channels * sizeof(float));
memset(result, 0, m_num_channels * sizeof(float));
}
else {
int u = x;
int v = y;
this->wrap_pixel(u, v, extend_x, extend_y);
const int offset = get_coords_offset(u, v);
float *buffer = &this->m_buffer[offset];
memcpy(result, buffer, sizeof(float) * this->m_num_channels);
float *buffer = &m_buffer[offset];
memcpy(result, buffer, sizeof(float) * m_num_channels);
}
}
@@ -520,11 +520,11 @@ class MemoryBuffer {
const int offset = get_coords_offset(u, v);
BLI_assert(offset >= 0);
BLI_assert(offset < this->buffer_len() * this->m_num_channels);
BLI_assert(offset < this->buffer_len() * m_num_channels);
BLI_assert(!(extend_x == MemoryBufferExtend::Clip && (u < m_rect.xmin || u >= m_rect.xmax)) &&
!(extend_y == MemoryBufferExtend::Clip && (v < m_rect.ymin || v >= m_rect.ymax)));
float *buffer = &this->m_buffer[offset];
memcpy(result, buffer, sizeof(float) * this->m_num_channels);
float *buffer = &m_buffer[offset];
memcpy(result, buffer, sizeof(float) * m_num_channels);
}
void writePixel(int x, int y, const float color[4]);
@@ -540,18 +540,18 @@ class MemoryBuffer {
this->wrap_pixel(u, v, extend_x, extend_y);
if ((extend_x != MemoryBufferExtend::Repeat && (u < 0.0f || u >= getWidth())) ||
(extend_y != MemoryBufferExtend::Repeat && (v < 0.0f || v >= getHeight()))) {
copy_vn_fl(result, this->m_num_channels, 0.0f);
copy_vn_fl(result, m_num_channels, 0.0f);
return;
}
if (m_is_a_single_elem) {
memcpy(result, m_buffer, sizeof(float) * this->m_num_channels);
memcpy(result, m_buffer, sizeof(float) * m_num_channels);
}
else {
BLI_bilinear_interpolation_wrap_fl(this->m_buffer,
BLI_bilinear_interpolation_wrap_fl(m_buffer,
result,
getWidth(),
getHeight(),
this->m_num_channels,
m_num_channels,
u,
v,
extend_x == MemoryBufferExtend::Repeat,
@@ -566,7 +566,7 @@ class MemoryBuffer {
*/
inline bool isTemporarily() const
{
return this->m_state == MemoryBufferState::Temporary;
return m_state == MemoryBufferState::Temporary;
}
void copy_from(const MemoryBuffer *src, const rcti &area);
@@ -632,7 +632,7 @@ class MemoryBuffer {
*/
const rcti &get_rect() const
{
return this->m_rect;
return m_rect;
}
/**
@@ -668,7 +668,7 @@ class MemoryBuffer {
void clear_elem(float *out) const
{
memset(out, 0, this->m_num_channels * sizeof(float));
memset(out, 0, m_num_channels * sizeof(float));
}
template<typename T> T get_relative_x(T x) const

View File

@@ -23,9 +23,9 @@ namespace blender::compositor {
MemoryProxy::MemoryProxy(DataType datatype)
{
this->m_writeBufferOperation = nullptr;
this->m_executor = nullptr;
this->m_datatype = datatype;
m_writeBufferOperation = nullptr;
m_executor = nullptr;
m_datatype = datatype;
}
void MemoryProxy::allocate(unsigned int width, unsigned int height)
@@ -36,14 +36,14 @@ void MemoryProxy::allocate(unsigned int width, unsigned int height)
result.ymin = 0;
result.ymax = height;
this->m_buffer = new MemoryBuffer(this, result, MemoryBufferState::Default);
m_buffer = new MemoryBuffer(this, result, MemoryBufferState::Default);
}
void MemoryProxy::free()
{
if (this->m_buffer) {
delete this->m_buffer;
this->m_buffer = nullptr;
if (m_buffer) {
delete m_buffer;
m_buffer = nullptr;
}
}

View File

@@ -68,7 +68,7 @@ class MemoryProxy {
*/
void setExecutor(ExecutionGroup *executor)
{
this->m_executor = executor;
m_executor = executor;
}
/**
@@ -76,7 +76,7 @@ class MemoryProxy {
*/
ExecutionGroup *getExecutor() const
{
return this->m_executor;
return m_executor;
}
/**
@@ -85,7 +85,7 @@ class MemoryProxy {
*/
void setWriteBufferOperation(WriteBufferOperation *operation)
{
this->m_writeBufferOperation = operation;
m_writeBufferOperation = operation;
}
/**
@@ -94,7 +94,7 @@ class MemoryProxy {
*/
WriteBufferOperation *getWriteBufferOperation() const
{
return this->m_writeBufferOperation;
return m_writeBufferOperation;
}
/**
@@ -112,12 +112,12 @@ class MemoryProxy {
*/
inline MemoryBuffer *getBuffer()
{
return this->m_buffer;
return m_buffer;
}
inline DataType getDataType()
{
return this->m_datatype;
return m_datatype;
}
#ifdef WITH_CXX_GUARDEDALLOC

View File

@@ -97,7 +97,7 @@ class Node {
*/
void setbNode(bNode *node)
{
this->m_editorNode = node;
m_editorNode = node;
}
/**
@@ -106,7 +106,7 @@ class Node {
*/
void setbNodeTree(bNodeTree *nodetree)
{
this->m_editorNodeTree = nodetree;
m_editorNodeTree = nodetree;
}
/**
@@ -145,7 +145,7 @@ class Node {
*/
void setIsInActiveGroup(bool value)
{
this->m_inActiveGroup = value;
m_inActiveGroup = value;
}
/**
@@ -156,7 +156,7 @@ class Node {
*/
inline bool isInActiveGroup() const
{
return this->m_inActiveGroup;
return m_inActiveGroup;
}
/**
@@ -222,7 +222,7 @@ class NodeInput {
Node *getNode() const
{
return this->m_node;
return m_node;
}
DataType getDataType() const
{
@@ -230,7 +230,7 @@ class NodeInput {
}
bNodeSocket *getbNodeSocket() const
{
return this->m_editorSocket;
return m_editorSocket;
}
void setLink(NodeOutput *link);
@@ -264,7 +264,7 @@ class NodeOutput {
Node *getNode() const
{
return this->m_node;
return m_node;
}
DataType getDataType() const
{
@@ -272,7 +272,7 @@ class NodeOutput {
}
bNodeSocket *getbNodeSocket() const
{
return this->m_editorSocket;
return m_editorSocket;
}
float getEditorValueFloat();

View File

@@ -34,7 +34,7 @@ NodeOperation::NodeOperation()
{
canvas_input_index_ = 0;
canvas_ = COM_AREA_NONE;
this->m_btree = nullptr;
m_btree = nullptr;
}
/** Get constant value when operation is constant, otherwise return default_value. */
@@ -179,22 +179,22 @@ void NodeOperation::initExecution()
void NodeOperation::initMutex()
{
BLI_mutex_init(&this->m_mutex);
BLI_mutex_init(&m_mutex);
}
void NodeOperation::lockMutex()
{
BLI_mutex_lock(&this->m_mutex);
BLI_mutex_lock(&m_mutex);
}
void NodeOperation::unlockMutex()
{
BLI_mutex_unlock(&this->m_mutex);
BLI_mutex_unlock(&m_mutex);
}
void NodeOperation::deinitMutex()
{
BLI_mutex_end(&this->m_mutex);
BLI_mutex_end(&m_mutex);
}
void NodeOperation::deinitExecution()

View File

@@ -125,11 +125,11 @@ class NodeOperationInput {
void setResizeMode(ResizeMode resizeMode)
{
this->m_resizeMode = resizeMode;
m_resizeMode = resizeMode;
}
ResizeMode getResizeMode() const
{
return this->m_resizeMode;
return m_resizeMode;
}
SocketReader *getReader();
@@ -442,7 +442,7 @@ class NodeOperation {
void setbNodeTree(const bNodeTree *tree)
{
this->m_btree = tree;
m_btree = tree;
}
void set_execution_system(ExecutionSystem *system)
@@ -561,13 +561,13 @@ class NodeOperation {
inline bool isBraked() const
{
return this->m_btree->test_break(this->m_btree->tbh);
return m_btree->test_break(m_btree->tbh);
}
inline void updateDraw()
{
if (this->m_btree->update_draw) {
this->m_btree->update_draw(this->m_btree->udh);
if (m_btree->update_draw) {
m_btree->update_draw(m_btree->udh);
}
}

View File

@@ -753,7 +753,7 @@ static void add_group_operations_recursive(Tags &visited, NodeOperation *op, Exe
ExecutionGroup *NodeOperationBuilder::make_group(NodeOperation *op)
{
ExecutionGroup *group = new ExecutionGroup(this->m_groups.size());
ExecutionGroup *group = new ExecutionGroup(m_groups.size());
m_groups.append(group);
Tags visited;

View File

@@ -42,14 +42,14 @@ OpenCLDevice::OpenCLDevice(cl_context context,
cl_program program,
cl_int vendorId)
{
this->m_device = device;
this->m_context = context;
this->m_program = program;
this->m_queue = nullptr;
this->m_vendorID = vendorId;
m_device = device;
m_context = context;
m_program = program;
m_queue = nullptr;
m_vendorID = vendorId;
cl_int error;
this->m_queue = clCreateCommandQueue(this->m_context, this->m_device, 0, &error);
m_queue = clCreateCommandQueue(m_context, m_device, 0, &error);
}
OpenCLDevice::OpenCLDevice(OpenCLDevice &&other) noexcept
@@ -64,8 +64,8 @@ OpenCLDevice::OpenCLDevice(OpenCLDevice &&other) noexcept
OpenCLDevice::~OpenCLDevice()
{
if (this->m_queue) {
clReleaseCommandQueue(this->m_queue);
if (m_queue) {
clReleaseCommandQueue(m_queue);
}
}
@@ -131,7 +131,7 @@ cl_mem OpenCLDevice::COM_clAttachMemoryBufferToKernelParameter(cl_kernel kernel,
const cl_image_format *imageFormat = determineImageFormat(result);
cl_mem clBuffer = clCreateImage2D(this->m_context,
cl_mem clBuffer = clCreateImage2D(m_context,
CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR,
imageFormat,
result->getWidth(),
@@ -206,8 +206,7 @@ void OpenCLDevice::COM_clEnqueueRange(cl_kernel kernel, MemoryBuffer *outputMemo
(size_t)outputMemoryBuffer->getHeight(),
};
error = clEnqueueNDRangeKernel(
this->m_queue, kernel, 2, nullptr, size, nullptr, 0, nullptr, nullptr);
error = clEnqueueNDRangeKernel(m_queue, kernel, 2, nullptr, size, nullptr, 0, nullptr, nullptr);
if (error != CL_SUCCESS) {
printf("CLERROR[%d]: %s\n", error, clewErrorString(error));
}
@@ -227,7 +226,7 @@ void OpenCLDevice::COM_clEnqueueRange(cl_kernel kernel,
size_t size[2];
cl_int2 offset;
if (this->m_vendorID == NVIDIA) {
if (m_vendorID == NVIDIA) {
localSize = 32;
}
@@ -255,11 +254,11 @@ void OpenCLDevice::COM_clEnqueueRange(cl_kernel kernel,
printf("CLERROR[%d]: %s\n", error, clewErrorString(error));
}
error = clEnqueueNDRangeKernel(
this->m_queue, kernel, 2, nullptr, size, nullptr, 0, nullptr, nullptr);
m_queue, kernel, 2, nullptr, size, nullptr, 0, nullptr, nullptr);
if (error != CL_SUCCESS) {
printf("CLERROR[%d]: %s\n", error, clewErrorString(error));
}
clFlush(this->m_queue);
clFlush(m_queue);
if (operation->isBraked()) {
breaked = false;
}
@@ -271,7 +270,7 @@ cl_kernel OpenCLDevice::COM_clCreateKernel(const char *kernelname,
std::list<cl_kernel> *clKernelsToCleanUp)
{
cl_int error;
cl_kernel kernel = clCreateKernel(this->m_program, kernelname, &error);
cl_kernel kernel = clCreateKernel(m_program, kernelname, &error);
if (error != CL_SUCCESS) {
printf("CLERROR[%d]: %s\n", error, clewErrorString(error));
}

View File

@@ -93,12 +93,12 @@ class OpenCLDevice : public Device {
cl_context getContext()
{
return this->m_context;
return m_context;
}
cl_command_queue getQueue()
{
return this->m_queue;
return m_queue;
}
cl_mem COM_clAttachMemoryBufferToKernelParameter(cl_kernel kernel,

View File

@@ -22,7 +22,7 @@ namespace blender::compositor {
SingleThreadedOperation::SingleThreadedOperation()
{
this->m_cachedInstance = nullptr;
m_cachedInstance = nullptr;
flags.complex = true;
flags.single_threaded = true;
}
@@ -34,30 +34,30 @@ void SingleThreadedOperation::initExecution()
void SingleThreadedOperation::executePixel(float output[4], int x, int y, void * /*data*/)
{
this->m_cachedInstance->readNoCheck(output, x, y);
m_cachedInstance->readNoCheck(output, x, y);
}
void SingleThreadedOperation::deinitExecution()
{
deinitMutex();
if (this->m_cachedInstance) {
delete this->m_cachedInstance;
this->m_cachedInstance = nullptr;
if (m_cachedInstance) {
delete m_cachedInstance;
m_cachedInstance = nullptr;
}
}
void *SingleThreadedOperation::initializeTileData(rcti *rect)
{
if (this->m_cachedInstance) {
return this->m_cachedInstance;
if (m_cachedInstance) {
return m_cachedInstance;
}
lockMutex();
if (this->m_cachedInstance == nullptr) {
if (m_cachedInstance == nullptr) {
//
this->m_cachedInstance = createMemoryBuffer(rect);
m_cachedInstance = createMemoryBuffer(rect);
}
unlockMutex();
return this->m_cachedInstance;
return m_cachedInstance;
}
} // namespace blender::compositor

View File

@@ -29,7 +29,7 @@ class SingleThreadedOperation : public NodeOperation {
protected:
inline bool isCached()
{
return this->m_cachedInstance != nullptr;
return m_cachedInstance != nullptr;
}
public:

View File

@@ -34,9 +34,9 @@ void AlphaOverKeyOperation::executePixelSampled(float output[4],
float inputOverColor[4];
float value[4];
this->m_inputValueOperation->readSampled(value, x, y, sampler);
this->m_inputColor1Operation->readSampled(inputColor1, x, y, sampler);
this->m_inputColor2Operation->readSampled(inputOverColor, x, y, sampler);
m_inputValueOperation->readSampled(value, x, y, sampler);
m_inputColor1Operation->readSampled(inputColor1, x, y, sampler);
m_inputColor2Operation->readSampled(inputOverColor, x, y, sampler);
if (inputOverColor[3] <= 0.0f) {
copy_v4_v4(output, inputColor1);

View File

@@ -22,7 +22,7 @@ namespace blender::compositor {
AlphaOverMixedOperation::AlphaOverMixedOperation()
{
this->m_x = 0.0f;
m_x = 0.0f;
this->flags.can_be_constant = true;
}
@@ -35,9 +35,9 @@ void AlphaOverMixedOperation::executePixelSampled(float output[4],
float inputOverColor[4];
float value[4];
this->m_inputValueOperation->readSampled(value, x, y, sampler);
this->m_inputColor1Operation->readSampled(inputColor1, x, y, sampler);
this->m_inputColor2Operation->readSampled(inputOverColor, x, y, sampler);
m_inputValueOperation->readSampled(value, x, y, sampler);
m_inputColor1Operation->readSampled(inputColor1, x, y, sampler);
m_inputColor2Operation->readSampled(inputOverColor, x, y, sampler);
if (inputOverColor[3] <= 0.0f) {
copy_v4_v4(output, inputColor1);
@@ -46,7 +46,7 @@ void AlphaOverMixedOperation::executePixelSampled(float output[4],
copy_v4_v4(output, inputOverColor);
}
else {
float addfac = 1.0f - this->m_x + inputOverColor[3] * this->m_x;
float addfac = 1.0f - m_x + inputOverColor[3] * m_x;
float premul = value[0] * addfac;
float mul = 1.0f - value[0] * inputOverColor[3];
@@ -71,7 +71,7 @@ void AlphaOverMixedOperation::update_memory_buffer_row(PixelCursor &p)
copy_v4_v4(p.out, over_color);
}
else {
const float addfac = 1.0f - this->m_x + over_color[3] * this->m_x;
const float addfac = 1.0f - m_x + over_color[3] * m_x;
const float premul = value * addfac;
const float mul = 1.0f - value * over_color[3];

View File

@@ -43,7 +43,7 @@ class AlphaOverMixedOperation : public MixBaseOperation {
void setX(float x)
{
this->m_x = x;
m_x = x;
}
void update_memory_buffer_row(PixelCursor &p) override;

View File

@@ -34,9 +34,9 @@ void AlphaOverPremultiplyOperation::executePixelSampled(float output[4],
float inputOverColor[4];
float value[4];
this->m_inputValueOperation->readSampled(value, x, y, sampler);
this->m_inputColor1Operation->readSampled(inputColor1, x, y, sampler);
this->m_inputColor2Operation->readSampled(inputOverColor, x, y, sampler);
m_inputValueOperation->readSampled(value, x, y, sampler);
m_inputColor1Operation->readSampled(inputColor1, x, y, sampler);
m_inputColor2Operation->readSampled(inputOverColor, x, y, sampler);
/* Zero alpha values should still permit an add of RGB data */
if (inputOverColor[3] < 0.0f) {

View File

@@ -112,13 +112,13 @@ AntiAliasOperation::AntiAliasOperation()
{
this->addInputSocket(DataType::Value);
this->addOutputSocket(DataType::Value);
this->m_valueReader = nullptr;
m_valueReader = nullptr;
this->flags.complex = true;
}
void AntiAliasOperation::initExecution()
{
this->m_valueReader = this->getInputSocketReader(0);
m_valueReader = this->getInputSocketReader(0);
}
void AntiAliasOperation::executePixel(float output[4], int x, int y, void *data)
@@ -175,7 +175,7 @@ void AntiAliasOperation::executePixel(float output[4], int x, int y, void *data)
void AntiAliasOperation::deinitExecution()
{
this->m_valueReader = nullptr;
m_valueReader = nullptr;
}
bool AntiAliasOperation::determineDependingAreaOfInterest(rcti *input,

View File

@@ -27,14 +27,14 @@ BilateralBlurOperation::BilateralBlurOperation()
this->addOutputSocket(DataType::Color);
this->flags.complex = true;
this->m_inputColorProgram = nullptr;
this->m_inputDeterminatorProgram = nullptr;
m_inputColorProgram = nullptr;
m_inputDeterminatorProgram = nullptr;
}
void BilateralBlurOperation::initExecution()
{
this->m_inputColorProgram = getInputSocketReader(0);
this->m_inputDeterminatorProgram = getInputSocketReader(1);
m_inputColorProgram = getInputSocketReader(0);
m_inputDeterminatorProgram = getInputSocketReader(1);
QualityStepHelper::initExecution(COM_QH_INCREASE);
}
@@ -47,14 +47,14 @@ void BilateralBlurOperation::executePixel(float output[4], int x, int y, void *d
float tempColor[4];
float blurColor[4];
float blurDivider;
float space = this->m_space;
float sigmacolor = this->m_data->sigma_color;
float space = m_space;
float sigmacolor = m_data->sigma_color;
int minx = floor(x - space);
int maxx = ceil(x + space);
int miny = floor(y - space);
int maxy = ceil(y + space);
float deltaColor;
this->m_inputDeterminatorProgram->read(determinatorReferenceColor, x, y, data);
m_inputDeterminatorProgram->read(determinatorReferenceColor, x, y, data);
zero_v4(blurColor);
blurDivider = 0.0f;
@@ -65,14 +65,14 @@ void BilateralBlurOperation::executePixel(float output[4], int x, int y, void *d
for (int yi = miny; yi < maxy; yi += QualityStepHelper::getStep()) {
for (int xi = minx; xi < maxx; xi += QualityStepHelper::getStep()) {
/* Read determinator. */
this->m_inputDeterminatorProgram->read(determinator, xi, yi, data);
m_inputDeterminatorProgram->read(determinator, xi, yi, data);
deltaColor = (fabsf(determinatorReferenceColor[0] - determinator[0]) +
fabsf(determinatorReferenceColor[1] - determinator[1]) +
/* Do not take the alpha channel into account. */
fabsf(determinatorReferenceColor[2] - determinator[2]));
if (deltaColor < sigmacolor) {
/* Add this to the blur. */
this->m_inputColorProgram->read(tempColor, xi, yi, data);
m_inputColorProgram->read(tempColor, xi, yi, data);
add_v4_v4(blurColor, tempColor);
blurDivider += 1.0f;
}
@@ -92,8 +92,8 @@ void BilateralBlurOperation::executePixel(float output[4], int x, int y, void *d
void BilateralBlurOperation::deinitExecution()
{
this->m_inputColorProgram = nullptr;
this->m_inputDeterminatorProgram = nullptr;
m_inputColorProgram = nullptr;
m_inputDeterminatorProgram = nullptr;
}
bool BilateralBlurOperation::determineDependingAreaOfInterest(rcti *input,
@@ -101,7 +101,7 @@ bool BilateralBlurOperation::determineDependingAreaOfInterest(rcti *input,
rcti *output)
{
rcti newInput;
int add = ceil(this->m_space) + 1;
int add = ceil(m_space) + 1;
newInput.xmax = input->xmax + (add);
newInput.xmin = input->xmin - (add);
@@ -115,7 +115,7 @@ void BilateralBlurOperation::get_area_of_interest(const int UNUSED(input_idx),
const rcti &output_area,
rcti &r_input_area)
{
const int add = ceil(this->m_space) + 1;
const int add = ceil(m_space) + 1;
r_input_area.xmax = output_area.xmax + (add);
r_input_area.xmin = output_area.xmin - (add);
@@ -174,10 +174,10 @@ void BilateralBlurOperation::update_memory_buffer_partial(MemoryBuffer *output,
{
PixelCursor p = {};
p.step = QualityStepHelper::getStep();
p.sigma_color = this->m_data->sigma_color;
p.sigma_color = m_data->sigma_color;
p.input_color = inputs[0];
p.input_determinator = inputs[1];
const float space = this->m_space;
const float space = m_space;
for (int y = area.ymin; y < area.ymax; y++) {
p.out = output->get_elem(area.xmin, y);
/* This will be used as the reference color for the determinator. */

View File

@@ -54,8 +54,8 @@ class BilateralBlurOperation : public MultiThreadedOperation, public QualityStep
void setData(NodeBilateralBlurData *data)
{
this->m_data = data;
this->m_space = data->sigma_space + data->iter;
m_data = data;
m_space = data->sigma_space + data->iter;
}
void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override;

View File

@@ -30,11 +30,11 @@ BlurBaseOperation::BlurBaseOperation(DataType data_type)
this->addInputSocket(DataType::Value);
this->addOutputSocket(data_type);
this->flags.complex = true;
this->m_inputProgram = nullptr;
m_inputProgram = nullptr;
memset(&m_data, 0, sizeof(NodeBlurData));
this->m_size = 1.0f;
this->m_sizeavailable = false;
this->m_extend_bounds = false;
m_size = 1.0f;
m_sizeavailable = false;
m_extend_bounds = false;
use_variable_size_ = false;
}
@@ -44,32 +44,32 @@ void BlurBaseOperation::init_data()
updateSize();
}
this->m_data.image_in_width = this->getWidth();
this->m_data.image_in_height = this->getHeight();
if (this->m_data.relative) {
m_data.image_in_width = this->getWidth();
m_data.image_in_height = this->getHeight();
if (m_data.relative) {
int sizex, sizey;
switch (this->m_data.aspect) {
switch (m_data.aspect) {
case CMP_NODE_BLUR_ASPECT_Y:
sizex = sizey = this->m_data.image_in_width;
sizex = sizey = m_data.image_in_width;
break;
case CMP_NODE_BLUR_ASPECT_X:
sizex = sizey = this->m_data.image_in_height;
sizex = sizey = m_data.image_in_height;
break;
default:
BLI_assert(this->m_data.aspect == CMP_NODE_BLUR_ASPECT_NONE);
sizex = this->m_data.image_in_width;
sizey = this->m_data.image_in_height;
BLI_assert(m_data.aspect == CMP_NODE_BLUR_ASPECT_NONE);
sizex = m_data.image_in_width;
sizey = m_data.image_in_height;
break;
}
this->m_data.sizex = round_fl_to_int(this->m_data.percentx * 0.01f * sizex);
this->m_data.sizey = round_fl_to_int(this->m_data.percenty * 0.01f * sizey);
m_data.sizex = round_fl_to_int(m_data.percentx * 0.01f * sizex);
m_data.sizey = round_fl_to_int(m_data.percenty * 0.01f * sizey);
}
}
void BlurBaseOperation::initExecution()
{
this->m_inputProgram = this->getInputSocketReader(0);
this->m_inputSize = this->getInputSocketReader(1);
m_inputProgram = this->getInputSocketReader(0);
m_inputSize = this->getInputSocketReader(1);
QualityStepHelper::initExecution(COM_QH_MULTIPLY);
}
@@ -86,7 +86,7 @@ float *BlurBaseOperation::make_gausstab(float rad, int size)
sum = 0.0f;
float fac = (rad > 0.0f ? 1.0f / rad : 0.0f);
for (i = -size; i <= size; i++) {
val = RE_filter_value(this->m_data.filtertype, (float)i * fac);
val = RE_filter_value(m_data.filtertype, (float)i * fac);
sum += val;
gausstab[i + size] = val;
}
@@ -165,8 +165,8 @@ float *BlurBaseOperation::make_dist_fac_inverse(float rad, int size, int falloff
void BlurBaseOperation::deinitExecution()
{
this->m_inputProgram = nullptr;
this->m_inputSize = nullptr;
m_inputProgram = nullptr;
m_inputSize = nullptr;
}
void BlurBaseOperation::setData(const NodeBlurData *data)
@@ -187,7 +187,7 @@ int BlurBaseOperation::get_blur_size(eDimension dim) const
void BlurBaseOperation::updateSize()
{
if (this->m_sizeavailable || use_variable_size_) {
if (m_sizeavailable || use_variable_size_) {
return;
}
@@ -195,7 +195,7 @@ void BlurBaseOperation::updateSize()
case eExecutionModel::Tiled: {
float result[4];
this->getInputSocketReader(1)->readSampled(result, 0, 0, PixelSampler::Nearest);
this->m_size = result[0];
m_size = result[0];
break;
}
case eExecutionModel::FullFrame: {
@@ -206,7 +206,7 @@ void BlurBaseOperation::updateSize()
break;
}
}
this->m_sizeavailable = true;
m_sizeavailable = true;
}
void BlurBaseOperation::determine_canvas(const rcti &preferred_area, rcti &r_area)

View File

@@ -74,13 +74,13 @@ class BlurBaseOperation : public MultiThreadedOperation, public QualityStepHelpe
void setSize(float size)
{
this->m_size = size;
this->m_sizeavailable = true;
m_size = size;
m_sizeavailable = true;
}
void setExtendBounds(bool extend_bounds)
{
this->m_extend_bounds = extend_bounds;
m_extend_bounds = extend_bounds;
}
int get_blur_size(eDimension dim) const;

View File

@@ -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;
});

View File

@@ -64,8 +64,8 @@ class BokehBlurOperation : public MultiThreadedOperation, public QualityStepHelp
void setSize(float size)
{
this->m_size = size;
this->m_sizeavailable = true;
m_size = size;
m_sizeavailable = true;
}
void executeOpenCL(OpenCLDevice *device,
@@ -77,7 +77,7 @@ class BokehBlurOperation : public MultiThreadedOperation, public QualityStepHelp
void setExtendBounds(bool extend_bounds)
{
this->m_extend_bounds = extend_bounds;
m_extend_bounds = extend_bounds;
}
void determine_canvas(const rcti &preferred_area, rcti &r_area) override;

View File

@@ -23,33 +23,33 @@ namespace blender::compositor {
BokehImageOperation::BokehImageOperation()
{
this->addOutputSocket(DataType::Color);
this->m_deleteData = false;
m_deleteData = false;
}
void BokehImageOperation::initExecution()
{
this->m_center[0] = getWidth() / 2;
this->m_center[1] = getHeight() / 2;
this->m_inverseRounding = 1.0f - this->m_data->rounding;
this->m_circularDistance = getWidth() / 2;
this->m_flapRad = (float)(M_PI * 2) / this->m_data->flaps;
this->m_flapRadAdd = this->m_data->angle;
while (this->m_flapRadAdd < 0.0f) {
this->m_flapRadAdd += (float)(M_PI * 2.0);
m_center[0] = getWidth() / 2;
m_center[1] = getHeight() / 2;
m_inverseRounding = 1.0f - m_data->rounding;
m_circularDistance = getWidth() / 2;
m_flapRad = (float)(M_PI * 2) / m_data->flaps;
m_flapRadAdd = m_data->angle;
while (m_flapRadAdd < 0.0f) {
m_flapRadAdd += (float)(M_PI * 2.0);
}
while (this->m_flapRadAdd > (float)M_PI) {
this->m_flapRadAdd -= (float)(M_PI * 2.0);
while (m_flapRadAdd > (float)M_PI) {
m_flapRadAdd -= (float)(M_PI * 2.0);
}
}
void BokehImageOperation::detemineStartPointOfFlap(float r[2], int flapNumber, float distance)
{
r[0] = sinf(this->m_flapRad * flapNumber + this->m_flapRadAdd) * distance + this->m_center[0];
r[1] = cosf(this->m_flapRad * flapNumber + this->m_flapRadAdd) * distance + this->m_center[1];
r[0] = sinf(m_flapRad * flapNumber + m_flapRadAdd) * distance + m_center[0];
r[1] = cosf(m_flapRad * flapNumber + m_flapRadAdd) * distance + m_center[1];
}
float BokehImageOperation::isInsideBokeh(float distance, float x, float y)
{
float insideBokeh = 0.0f;
const float deltaX = x - this->m_center[0];
const float deltaY = y - this->m_center[1];
const float deltaX = x - m_center[0];
const float deltaY = y - m_center[1];
float closestPoint[2];
float lineP1[2];
float lineP2[2];
@@ -57,25 +57,25 @@ float BokehImageOperation::isInsideBokeh(float distance, float x, float y)
point[0] = x;
point[1] = y;
const float distanceToCenter = len_v2v2(point, this->m_center);
const float distanceToCenter = len_v2v2(point, m_center);
const float bearing = (atan2f(deltaX, deltaY) + (float)(M_PI * 2.0));
int flapNumber = (int)((bearing - this->m_flapRadAdd) / this->m_flapRad);
int flapNumber = (int)((bearing - m_flapRadAdd) / m_flapRad);
detemineStartPointOfFlap(lineP1, flapNumber, distance);
detemineStartPointOfFlap(lineP2, flapNumber + 1, distance);
closest_to_line_v2(closestPoint, point, lineP1, lineP2);
const float distanceLineToCenter = len_v2v2(this->m_center, closestPoint);
const float distanceRoundingToCenter = this->m_inverseRounding * distanceLineToCenter +
this->m_data->rounding * distance;
const float distanceLineToCenter = len_v2v2(m_center, closestPoint);
const float distanceRoundingToCenter = m_inverseRounding * distanceLineToCenter +
m_data->rounding * distance;
const float catadioptricDistanceToCenter = distanceRoundingToCenter * this->m_data->catadioptric;
const float catadioptricDistanceToCenter = distanceRoundingToCenter * m_data->catadioptric;
if (distanceRoundingToCenter >= distanceToCenter &&
catadioptricDistanceToCenter <= distanceToCenter) {
if (distanceRoundingToCenter - distanceToCenter < 1.0f) {
insideBokeh = (distanceRoundingToCenter - distanceToCenter);
}
else if (this->m_data->catadioptric != 0.0f &&
else if (m_data->catadioptric != 0.0f &&
distanceToCenter - catadioptricDistanceToCenter < 1.0f) {
insideBokeh = (distanceToCenter - catadioptricDistanceToCenter);
}
@@ -90,9 +90,9 @@ void BokehImageOperation::executePixelSampled(float output[4],
float y,
PixelSampler /*sampler*/)
{
float shift = this->m_data->lensshift;
float shift = m_data->lensshift;
float shift2 = shift / 2.0f;
float distance = this->m_circularDistance;
float distance = m_circularDistance;
float insideBokehMax = isInsideBokeh(distance, x, y);
float insideBokehMed = isInsideBokeh(distance - fabsf(shift2 * distance), x, y);
float insideBokehMin = isInsideBokeh(distance - fabsf(shift * distance), x, y);
@@ -113,9 +113,9 @@ void BokehImageOperation::update_memory_buffer_partial(MemoryBuffer *output,
const rcti &area,
Span<MemoryBuffer *> UNUSED(inputs))
{
const float shift = this->m_data->lensshift;
const float shift = m_data->lensshift;
const float shift2 = shift / 2.0f;
const float distance = this->m_circularDistance;
const float distance = m_circularDistance;
for (BuffersIterator<float> it = output->iterate_with({}, area); !it.is_end(); ++it) {
const float insideBokehMax = isInsideBokeh(distance, it.x, it.y);
const float insideBokehMed = isInsideBokeh(distance - fabsf(shift2 * distance), it.x, it.y);
@@ -136,10 +136,10 @@ void BokehImageOperation::update_memory_buffer_partial(MemoryBuffer *output,
void BokehImageOperation::deinitExecution()
{
if (this->m_deleteData) {
if (this->m_data) {
delete this->m_data;
this->m_data = nullptr;
if (m_deleteData) {
if (m_data) {
delete m_data;
m_data = nullptr;
}
}
}

View File

@@ -136,7 +136,7 @@ class BokehImageOperation : public MultiThreadedOperation {
*/
void setData(NodeBokehImage *data)
{
this->m_data = data;
m_data = data;
}
/**
@@ -148,7 +148,7 @@ class BokehImageOperation : public MultiThreadedOperation {
*/
void deleteDataOnFinish()
{
this->m_deleteData = true;
m_deleteData = true;
}
void update_memory_buffer_partial(MemoryBuffer *output,

View File

@@ -25,19 +25,19 @@ BoxMaskOperation::BoxMaskOperation()
this->addInputSocket(DataType::Value);
this->addInputSocket(DataType::Value);
this->addOutputSocket(DataType::Value);
this->m_inputMask = nullptr;
this->m_inputValue = nullptr;
this->m_cosine = 0.0f;
this->m_sine = 0.0f;
m_inputMask = nullptr;
m_inputValue = nullptr;
m_cosine = 0.0f;
m_sine = 0.0f;
}
void BoxMaskOperation::initExecution()
{
this->m_inputMask = this->getInputSocketReader(0);
this->m_inputValue = this->getInputSocketReader(1);
const double rad = (double)this->m_data->rotation;
this->m_cosine = cos(rad);
this->m_sine = sin(rad);
this->m_aspectRatio = ((float)this->getWidth()) / this->getHeight();
m_inputMask = this->getInputSocketReader(0);
m_inputValue = this->getInputSocketReader(1);
const double rad = (double)m_data->rotation;
m_cosine = cos(rad);
m_sine = sin(rad);
m_aspectRatio = ((float)this->getWidth()) / this->getHeight();
}
void BoxMaskOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler)
@@ -48,20 +48,20 @@ void BoxMaskOperation::executePixelSampled(float output[4], float x, float y, Pi
float rx = x / this->getWidth();
float ry = y / this->getHeight();
const float dy = (ry - this->m_data->y) / this->m_aspectRatio;
const float dx = rx - this->m_data->x;
rx = this->m_data->x + (this->m_cosine * dx + this->m_sine * dy);
ry = this->m_data->y + (-this->m_sine * dx + this->m_cosine * dy);
const float dy = (ry - m_data->y) / m_aspectRatio;
const float dx = rx - m_data->x;
rx = m_data->x + (m_cosine * dx + m_sine * dy);
ry = m_data->y + (-m_sine * dx + m_cosine * dy);
this->m_inputMask->readSampled(inputMask, x, y, sampler);
this->m_inputValue->readSampled(inputValue, x, y, sampler);
m_inputMask->readSampled(inputMask, x, y, sampler);
m_inputValue->readSampled(inputValue, x, y, sampler);
float halfHeight = this->m_data->height / 2.0f;
float halfWidth = this->m_data->width / 2.0f;
bool inside = (rx > this->m_data->x - halfWidth && rx < this->m_data->x + halfWidth &&
ry > this->m_data->y - halfHeight && ry < this->m_data->y + halfHeight);
float halfHeight = m_data->height / 2.0f;
float halfWidth = m_data->width / 2.0f;
bool inside = (rx > m_data->x - halfWidth && rx < m_data->x + halfWidth &&
ry > m_data->y - halfHeight && ry < m_data->y + halfHeight);
switch (this->m_maskType) {
switch (m_maskType) {
case CMP_NODE_MASKTYPE_ADD:
if (inside) {
output[0] = MAX2(inputMask[0], inputValue[0]);
@@ -143,18 +143,18 @@ void BoxMaskOperation::apply_mask(MemoryBuffer *output,
{
const float op_w = this->getWidth();
const float op_h = this->getHeight();
const float half_w = this->m_data->width / 2.0f;
const float half_h = this->m_data->height / 2.0f;
const float half_w = m_data->width / 2.0f;
const float half_h = m_data->height / 2.0f;
for (BuffersIterator<float> it = output->iterate_with(inputs, area); !it.is_end(); ++it) {
const float op_ry = it.y / op_h;
const float dy = (op_ry - this->m_data->y) / m_aspectRatio;
const float dy = (op_ry - m_data->y) / m_aspectRatio;
const float op_rx = it.x / op_w;
const float dx = op_rx - this->m_data->x;
const float rx = this->m_data->x + (m_cosine * dx + m_sine * dy);
const float ry = this->m_data->y + (-m_sine * dx + m_cosine * dy);
const float dx = op_rx - m_data->x;
const float rx = m_data->x + (m_cosine * dx + m_sine * dy);
const float ry = m_data->y + (-m_sine * dx + m_cosine * dy);
const bool inside = (rx > this->m_data->x - half_w && rx < this->m_data->x + half_w &&
ry > this->m_data->y - half_h && ry < this->m_data->y + half_h);
const bool inside = (rx > m_data->x - half_w && rx < m_data->x + half_w &&
ry > m_data->y - half_h && ry < m_data->y + half_h);
const float *mask = it.in(0);
const float *value = it.in(1);
*it.out = mask_func(inside, mask, value);
@@ -163,8 +163,8 @@ void BoxMaskOperation::apply_mask(MemoryBuffer *output,
void BoxMaskOperation::deinitExecution()
{
this->m_inputMask = nullptr;
this->m_inputValue = nullptr;
m_inputMask = nullptr;
m_inputValue = nullptr;
}
} // namespace blender::compositor

View File

@@ -59,12 +59,12 @@ class BoxMaskOperation : public MultiThreadedOperation {
void setData(NodeBoxMask *data)
{
this->m_data = data;
m_data = data;
}
void setMaskType(int maskType)
{
this->m_maskType = maskType;
m_maskType = maskType;
}
void update_memory_buffer_partial(MemoryBuffer *output,

View File

@@ -26,21 +26,21 @@ BrightnessOperation::BrightnessOperation()
this->addInputSocket(DataType::Value);
this->addInputSocket(DataType::Value);
this->addOutputSocket(DataType::Color);
this->m_inputProgram = nullptr;
this->m_use_premultiply = false;
m_inputProgram = nullptr;
m_use_premultiply = false;
flags.can_be_constant = true;
}
void BrightnessOperation::setUsePremultiply(bool use_premultiply)
{
this->m_use_premultiply = use_premultiply;
m_use_premultiply = use_premultiply;
}
void BrightnessOperation::initExecution()
{
this->m_inputProgram = this->getInputSocketReader(0);
this->m_inputBrightnessProgram = this->getInputSocketReader(1);
this->m_inputContrastProgram = this->getInputSocketReader(2);
m_inputProgram = this->getInputSocketReader(0);
m_inputBrightnessProgram = this->getInputSocketReader(1);
m_inputContrastProgram = this->getInputSocketReader(2);
}
void BrightnessOperation::executePixelSampled(float output[4],
@@ -52,9 +52,9 @@ void BrightnessOperation::executePixelSampled(float output[4],
float a, b;
float inputBrightness[4];
float inputContrast[4];
this->m_inputProgram->readSampled(inputValue, x, y, sampler);
this->m_inputBrightnessProgram->readSampled(inputBrightness, x, y, sampler);
this->m_inputContrastProgram->readSampled(inputContrast, x, y, sampler);
m_inputProgram->readSampled(inputValue, x, y, sampler);
m_inputBrightnessProgram->readSampled(inputBrightness, x, y, sampler);
m_inputContrastProgram->readSampled(inputContrast, x, y, sampler);
float brightness = inputBrightness[0];
float contrast = inputContrast[0];
brightness /= 100.0f;
@@ -74,14 +74,14 @@ void BrightnessOperation::executePixelSampled(float output[4],
a = max_ff(1.0f - delta * 2.0f, 0.0f);
b = a * brightness + delta;
}
if (this->m_use_premultiply) {
if (m_use_premultiply) {
premul_to_straight_v4(inputValue);
}
output[0] = a * inputValue[0] + b;
output[1] = a * inputValue[1] + b;
output[2] = a * inputValue[2] + b;
output[3] = inputValue[3];
if (this->m_use_premultiply) {
if (m_use_premultiply) {
straight_to_premul_v4(output);
}
}
@@ -113,7 +113,7 @@ void BrightnessOperation::update_memory_buffer_partial(MemoryBuffer *output,
b = a * brightness + delta;
}
const float *color;
if (this->m_use_premultiply) {
if (m_use_premultiply) {
premul_to_straight_v4_v4(tmp_color, in_color);
color = tmp_color;
}
@@ -124,7 +124,7 @@ void BrightnessOperation::update_memory_buffer_partial(MemoryBuffer *output,
it.out[1] = a * color[1] + b;
it.out[2] = a * color[2] + b;
it.out[3] = color[3];
if (this->m_use_premultiply) {
if (m_use_premultiply) {
straight_to_premul_v4(it.out);
}
}
@@ -132,9 +132,9 @@ void BrightnessOperation::update_memory_buffer_partial(MemoryBuffer *output,
void BrightnessOperation::deinitExecution()
{
this->m_inputProgram = nullptr;
this->m_inputBrightnessProgram = nullptr;
this->m_inputContrastProgram = nullptr;
m_inputProgram = nullptr;
m_inputBrightnessProgram = nullptr;
m_inputContrastProgram = nullptr;
}
} // namespace blender::compositor

View File

@@ -28,26 +28,26 @@ CalculateMeanOperation::CalculateMeanOperation()
{
this->addInputSocket(DataType::Color, ResizeMode::Align);
this->addOutputSocket(DataType::Value);
this->m_imageReader = nullptr;
this->m_iscalculated = false;
this->m_setting = 1;
m_imageReader = nullptr;
m_iscalculated = false;
m_setting = 1;
this->flags.complex = true;
}
void CalculateMeanOperation::initExecution()
{
this->m_imageReader = this->getInputSocketReader(0);
this->m_iscalculated = false;
m_imageReader = this->getInputSocketReader(0);
m_iscalculated = false;
NodeOperation::initMutex();
}
void CalculateMeanOperation::executePixel(float output[4], int /*x*/, int /*y*/, void * /*data*/)
{
output[0] = this->m_result;
output[0] = m_result;
}
void CalculateMeanOperation::deinitExecution()
{
this->m_imageReader = nullptr;
m_imageReader = nullptr;
NodeOperation::deinitMutex();
}
@@ -56,7 +56,7 @@ bool CalculateMeanOperation::determineDependingAreaOfInterest(rcti * /*input*/,
rcti *output)
{
rcti imageInput;
if (this->m_iscalculated) {
if (m_iscalculated) {
return false;
}
NodeOperation *operation = getInputOperation(0);
@@ -73,10 +73,10 @@ bool CalculateMeanOperation::determineDependingAreaOfInterest(rcti * /*input*/,
void *CalculateMeanOperation::initializeTileData(rcti *rect)
{
lockMutex();
if (!this->m_iscalculated) {
MemoryBuffer *tile = (MemoryBuffer *)this->m_imageReader->initializeTileData(rect);
if (!m_iscalculated) {
MemoryBuffer *tile = (MemoryBuffer *)m_imageReader->initializeTileData(rect);
calculateMean(tile);
this->m_iscalculated = true;
m_iscalculated = true;
}
unlockMutex();
return nullptr;
@@ -84,7 +84,7 @@ void *CalculateMeanOperation::initializeTileData(rcti *rect)
void CalculateMeanOperation::calculateMean(MemoryBuffer *tile)
{
this->m_result = 0.0f;
m_result = 0.0f;
float *buffer = tile->getBuffer();
int size = tile->getWidth() * tile->getHeight();
int pixels = 0;
@@ -93,7 +93,7 @@ void CalculateMeanOperation::calculateMean(MemoryBuffer *tile)
if (buffer[offset + 3] > 0) {
pixels++;
switch (this->m_setting) {
switch (m_setting) {
case 1: {
sum += IMB_colormanagement_get_luminance(&buffer[offset]);
break;
@@ -125,12 +125,12 @@ void CalculateMeanOperation::calculateMean(MemoryBuffer *tile)
}
}
}
this->m_result = sum / pixels;
m_result = sum / pixels;
}
void CalculateMeanOperation::setSetting(int setting)
{
this->m_setting = setting;
m_setting = setting;
switch (setting) {
case 1: {
setting_func_ = IMB_colormanagement_get_luminance;
@@ -171,10 +171,10 @@ void CalculateMeanOperation::update_memory_buffer_started(MemoryBuffer *UNUSED(o
const rcti &UNUSED(area),
Span<MemoryBuffer *> inputs)
{
if (!this->m_iscalculated) {
if (!m_iscalculated) {
MemoryBuffer *input = inputs[0];
m_result = calc_mean(input);
this->m_iscalculated = true;
m_iscalculated = true;
}
}

View File

@@ -29,26 +29,26 @@ void CalculateStandardDeviationOperation::executePixel(float output[4],
int /*y*/,
void * /*data*/)
{
output[0] = this->m_standardDeviation;
output[0] = m_standardDeviation;
}
void *CalculateStandardDeviationOperation::initializeTileData(rcti *rect)
{
lockMutex();
if (!this->m_iscalculated) {
MemoryBuffer *tile = (MemoryBuffer *)this->m_imageReader->initializeTileData(rect);
if (!m_iscalculated) {
MemoryBuffer *tile = (MemoryBuffer *)m_imageReader->initializeTileData(rect);
CalculateMeanOperation::calculateMean(tile);
this->m_standardDeviation = 0.0f;
m_standardDeviation = 0.0f;
float *buffer = tile->getBuffer();
int size = tile->getWidth() * tile->getHeight();
int pixels = 0;
float sum = 0.0f;
float mean = this->m_result;
float mean = m_result;
for (int i = 0, offset = 0; i < size; i++, offset += 4) {
if (buffer[offset + 3] > 0) {
pixels++;
switch (this->m_setting) {
switch (m_setting) {
case 1: /* rgb combined */
{
float value = IMB_colormanagement_get_luminance(&buffer[offset]);
@@ -89,8 +89,8 @@ void *CalculateStandardDeviationOperation::initializeTileData(rcti *rect)
}
}
}
this->m_standardDeviation = sqrt(sum / (float)(pixels - 1));
this->m_iscalculated = true;
m_standardDeviation = sqrt(sum / (float)(pixels - 1));
m_iscalculated = true;
}
unlockMutex();
return nullptr;
@@ -99,7 +99,7 @@ void *CalculateStandardDeviationOperation::initializeTileData(rcti *rect)
void CalculateStandardDeviationOperation::update_memory_buffer_started(
MemoryBuffer *UNUSED(output), const rcti &UNUSED(area), Span<MemoryBuffer *> inputs)
{
if (!this->m_iscalculated) {
if (!m_iscalculated) {
const MemoryBuffer *input = inputs[0];
const float mean = CalculateMeanOperation::calc_mean(input);
@@ -112,10 +112,9 @@ void CalculateStandardDeviationOperation::update_memory_buffer_started(
join.sum += chunk.sum;
join.num_pixels += chunk.num_pixels;
});
this->m_standardDeviation = total.num_pixels <= 1 ?
0.0f :
m_standardDeviation = total.num_pixels <= 1 ? 0.0f :
sqrt(total.sum / (float)(total.num_pixels - 1));
this->m_iscalculated = true;
m_iscalculated = true;
}
}

View File

@@ -27,24 +27,24 @@ ChangeHSVOperation::ChangeHSVOperation()
this->addInputSocket(DataType::Value);
this->addInputSocket(DataType::Value);
this->addOutputSocket(DataType::Color);
this->m_inputOperation = nullptr;
m_inputOperation = nullptr;
this->flags.can_be_constant = true;
}
void ChangeHSVOperation::initExecution()
{
this->m_inputOperation = getInputSocketReader(0);
this->m_hueOperation = getInputSocketReader(1);
this->m_saturationOperation = getInputSocketReader(2);
this->m_valueOperation = getInputSocketReader(3);
m_inputOperation = getInputSocketReader(0);
m_hueOperation = getInputSocketReader(1);
m_saturationOperation = getInputSocketReader(2);
m_valueOperation = getInputSocketReader(3);
}
void ChangeHSVOperation::deinitExecution()
{
this->m_inputOperation = nullptr;
this->m_hueOperation = nullptr;
this->m_saturationOperation = nullptr;
this->m_valueOperation = nullptr;
m_inputOperation = nullptr;
m_hueOperation = nullptr;
m_saturationOperation = nullptr;
m_valueOperation = nullptr;
}
void ChangeHSVOperation::executePixelSampled(float output[4],
@@ -55,10 +55,10 @@ void ChangeHSVOperation::executePixelSampled(float output[4],
float inputColor1[4];
float hue[4], saturation[4], value[4];
this->m_inputOperation->readSampled(inputColor1, x, y, sampler);
this->m_hueOperation->readSampled(hue, x, y, sampler);
this->m_saturationOperation->readSampled(saturation, x, y, sampler);
this->m_valueOperation->readSampled(value, x, y, sampler);
m_inputOperation->readSampled(inputColor1, x, y, sampler);
m_hueOperation->readSampled(hue, x, y, sampler);
m_saturationOperation->readSampled(saturation, x, y, sampler);
m_valueOperation->readSampled(value, x, y, sampler);
output[0] = inputColor1[0] + (hue[0] - 0.5f);
if (output[0] > 1.0f) {

View File

@@ -25,46 +25,46 @@ ChannelMatteOperation::ChannelMatteOperation()
addInputSocket(DataType::Color);
addOutputSocket(DataType::Value);
this->m_inputImageProgram = nullptr;
m_inputImageProgram = nullptr;
flags.can_be_constant = true;
}
void ChannelMatteOperation::initExecution()
{
this->m_inputImageProgram = this->getInputSocketReader(0);
m_inputImageProgram = this->getInputSocketReader(0);
this->m_limit_range = this->m_limit_max - this->m_limit_min;
m_limit_range = m_limit_max - m_limit_min;
switch (this->m_limit_method) {
switch (m_limit_method) {
/* SINGLE */
case 0: {
/* 123 / RGB / HSV / YUV / YCC */
const int matte_channel = this->m_matte_channel - 1;
const int limit_channel = this->m_limit_channel - 1;
this->m_ids[0] = matte_channel;
this->m_ids[1] = limit_channel;
this->m_ids[2] = limit_channel;
const int matte_channel = m_matte_channel - 1;
const int limit_channel = m_limit_channel - 1;
m_ids[0] = matte_channel;
m_ids[1] = limit_channel;
m_ids[2] = limit_channel;
break;
}
/* MAX */
case 1: {
switch (this->m_matte_channel) {
switch (m_matte_channel) {
case 1: {
this->m_ids[0] = 0;
this->m_ids[1] = 1;
this->m_ids[2] = 2;
m_ids[0] = 0;
m_ids[1] = 1;
m_ids[2] = 2;
break;
}
case 2: {
this->m_ids[0] = 1;
this->m_ids[1] = 0;
this->m_ids[2] = 2;
m_ids[0] = 1;
m_ids[1] = 0;
m_ids[2] = 2;
break;
}
case 3: {
this->m_ids[0] = 2;
this->m_ids[1] = 0;
this->m_ids[2] = 1;
m_ids[0] = 2;
m_ids[1] = 0;
m_ids[2] = 1;
break;
}
default:
@@ -79,7 +79,7 @@ void ChannelMatteOperation::initExecution()
void ChannelMatteOperation::deinitExecution()
{
this->m_inputImageProgram = nullptr;
m_inputImageProgram = nullptr;
}
void ChannelMatteOperation::executePixelSampled(float output[4],
@@ -90,14 +90,14 @@ void ChannelMatteOperation::executePixelSampled(float output[4],
float inColor[4];
float alpha;
const float limit_max = this->m_limit_max;
const float limit_min = this->m_limit_min;
const float limit_range = this->m_limit_range;
const float limit_max = m_limit_max;
const float limit_min = m_limit_min;
const float limit_range = m_limit_range;
this->m_inputImageProgram->readSampled(inColor, x, y, sampler);
m_inputImageProgram->readSampled(inColor, x, y, sampler);
/* matte operation */
alpha = inColor[this->m_ids[0]] - MAX2(inColor[this->m_ids[1]], inColor[this->m_ids[2]]);
alpha = inColor[m_ids[0]] - MAX2(inColor[m_ids[1]], inColor[m_ids[2]]);
/* flip because 0.0 is transparent, not 1.0 */
alpha = 1.0f - alpha;
@@ -129,7 +129,7 @@ void ChannelMatteOperation::update_memory_buffer_partial(MemoryBuffer *output,
const float *color = it.in(0);
/* Matte operation. */
float alpha = color[this->m_ids[0]] - MAX2(color[this->m_ids[1]], color[this->m_ids[2]]);
float alpha = color[m_ids[0]] - MAX2(color[m_ids[1]], color[m_ids[2]]);
/* Flip because 0.0 is transparent, not 1.0. */
alpha = 1.0f - alpha;

View File

@@ -65,11 +65,11 @@ class ChannelMatteOperation : public MultiThreadedOperation {
void setSettings(NodeChroma *nodeChroma, const int custom2)
{
this->m_limit_max = nodeChroma->t1;
this->m_limit_min = nodeChroma->t2;
this->m_limit_method = nodeChroma->algorithm;
this->m_limit_channel = nodeChroma->channel;
this->m_matte_channel = custom2;
m_limit_max = nodeChroma->t1;
m_limit_min = nodeChroma->t2;
m_limit_method = nodeChroma->algorithm;
m_limit_channel = nodeChroma->channel;
m_matte_channel = custom2;
}
void update_memory_buffer_partial(MemoryBuffer *output,

View File

@@ -26,21 +26,21 @@ ChromaMatteOperation::ChromaMatteOperation()
addInputSocket(DataType::Color);
addOutputSocket(DataType::Value);
this->m_inputImageProgram = nullptr;
this->m_inputKeyProgram = nullptr;
m_inputImageProgram = nullptr;
m_inputKeyProgram = nullptr;
flags.can_be_constant = true;
}
void ChromaMatteOperation::initExecution()
{
this->m_inputImageProgram = this->getInputSocketReader(0);
this->m_inputKeyProgram = this->getInputSocketReader(1);
m_inputImageProgram = this->getInputSocketReader(0);
m_inputKeyProgram = this->getInputSocketReader(1);
}
void ChromaMatteOperation::deinitExecution()
{
this->m_inputImageProgram = nullptr;
this->m_inputKeyProgram = nullptr;
m_inputImageProgram = nullptr;
m_inputKeyProgram = nullptr;
}
void ChromaMatteOperation::executePixelSampled(float output[4],
@@ -51,16 +51,16 @@ void ChromaMatteOperation::executePixelSampled(float output[4],
float inKey[4];
float inImage[4];
const float acceptance = this->m_settings->t1; /* in radians */
const float cutoff = this->m_settings->t2; /* in radians */
const float gain = this->m_settings->fstrength;
const float acceptance = m_settings->t1; /* in radians */
const float cutoff = m_settings->t2; /* in radians */
const float gain = m_settings->fstrength;
float x_angle, z_angle, alpha;
float theta, beta;
float kfg;
this->m_inputKeyProgram->readSampled(inKey, x, y, sampler);
this->m_inputImageProgram->readSampled(inImage, x, y, sampler);
m_inputKeyProgram->readSampled(inKey, x, y, sampler);
m_inputImageProgram->readSampled(inImage, x, y, sampler);
/* Store matte(alpha) value in [0] to go with
* #COM_SetAlphaMultiplyOperation and the Value output. */
@@ -114,9 +114,9 @@ void ChromaMatteOperation::update_memory_buffer_partial(MemoryBuffer *output,
const rcti &area,
Span<MemoryBuffer *> inputs)
{
const float acceptance = this->m_settings->t1; /* In radians. */
const float cutoff = this->m_settings->t2; /* In radians. */
const float gain = this->m_settings->fstrength;
const float acceptance = m_settings->t1; /* In radians. */
const float cutoff = m_settings->t2; /* In radians. */
const float gain = m_settings->fstrength;
for (BuffersIterator<float> it = output->iterate_with(inputs, area); !it.is_end(); ++it) {
const float *in_image = it.in(0);
const float *in_key = it.in(1);

View File

@@ -48,7 +48,7 @@ class ChromaMatteOperation : public MultiThreadedOperation {
void setSettings(NodeChroma *nodeChroma)
{
this->m_settings = nodeChroma;
m_settings = nodeChroma;
}
void update_memory_buffer_partial(MemoryBuffer *output,

View File

@@ -37,16 +37,16 @@ ColorBalanceASCCDLOperation::ColorBalanceASCCDLOperation()
this->addInputSocket(DataType::Value);
this->addInputSocket(DataType::Color);
this->addOutputSocket(DataType::Color);
this->m_inputValueOperation = nullptr;
this->m_inputColorOperation = nullptr;
m_inputValueOperation = nullptr;
m_inputColorOperation = nullptr;
this->set_canvas_input_index(1);
flags.can_be_constant = true;
}
void ColorBalanceASCCDLOperation::initExecution()
{
this->m_inputValueOperation = this->getInputSocketReader(0);
this->m_inputColorOperation = this->getInputSocketReader(1);
m_inputValueOperation = this->getInputSocketReader(0);
m_inputColorOperation = this->getInputSocketReader(1);
}
void ColorBalanceASCCDLOperation::executePixelSampled(float output[4],
@@ -57,22 +57,19 @@ void ColorBalanceASCCDLOperation::executePixelSampled(float output[4],
float inputColor[4];
float value[4];
this->m_inputValueOperation->readSampled(value, x, y, sampler);
this->m_inputColorOperation->readSampled(inputColor, x, y, sampler);
m_inputValueOperation->readSampled(value, x, y, sampler);
m_inputColorOperation->readSampled(inputColor, x, y, sampler);
float fac = value[0];
fac = MIN2(1.0f, fac);
const float mfac = 1.0f - fac;
output[0] = mfac * inputColor[0] +
fac * colorbalance_cdl(
inputColor[0], this->m_offset[0], this->m_power[0], this->m_slope[0]);
fac * colorbalance_cdl(inputColor[0], m_offset[0], m_power[0], m_slope[0]);
output[1] = mfac * inputColor[1] +
fac * colorbalance_cdl(
inputColor[1], this->m_offset[1], this->m_power[1], this->m_slope[1]);
fac * colorbalance_cdl(inputColor[1], m_offset[1], m_power[1], m_slope[1]);
output[2] = mfac * inputColor[2] +
fac * colorbalance_cdl(
inputColor[2], this->m_offset[2], this->m_power[2], this->m_slope[2]);
fac * colorbalance_cdl(inputColor[2], m_offset[2], m_power[2], m_slope[2]);
output[3] = inputColor[3];
}
@@ -95,8 +92,8 @@ void ColorBalanceASCCDLOperation::update_memory_buffer_row(PixelCursor &p)
void ColorBalanceASCCDLOperation::deinitExecution()
{
this->m_inputValueOperation = nullptr;
this->m_inputColorOperation = nullptr;
m_inputValueOperation = nullptr;
m_inputColorOperation = nullptr;
}
} // namespace blender::compositor

View File

@@ -61,15 +61,15 @@ class ColorBalanceASCCDLOperation : public MultiThreadedRowOperation {
void setOffset(float offset[3])
{
copy_v3_v3(this->m_offset, offset);
copy_v3_v3(m_offset, offset);
}
void setPower(float power[3])
{
copy_v3_v3(this->m_power, power);
copy_v3_v3(m_power, power);
}
void setSlope(float slope[3])
{
copy_v3_v3(this->m_slope, slope);
copy_v3_v3(m_slope, slope);
}
void update_memory_buffer_row(PixelCursor &p) override;

View File

@@ -42,16 +42,16 @@ ColorBalanceLGGOperation::ColorBalanceLGGOperation()
this->addInputSocket(DataType::Value);
this->addInputSocket(DataType::Color);
this->addOutputSocket(DataType::Color);
this->m_inputValueOperation = nullptr;
this->m_inputColorOperation = nullptr;
m_inputValueOperation = nullptr;
m_inputColorOperation = nullptr;
this->set_canvas_input_index(1);
flags.can_be_constant = true;
}
void ColorBalanceLGGOperation::initExecution()
{
this->m_inputValueOperation = this->getInputSocketReader(0);
this->m_inputColorOperation = this->getInputSocketReader(1);
m_inputValueOperation = this->getInputSocketReader(0);
m_inputColorOperation = this->getInputSocketReader(1);
}
void ColorBalanceLGGOperation::executePixelSampled(float output[4],
@@ -62,22 +62,19 @@ void ColorBalanceLGGOperation::executePixelSampled(float output[4],
float inputColor[4];
float value[4];
this->m_inputValueOperation->readSampled(value, x, y, sampler);
this->m_inputColorOperation->readSampled(inputColor, x, y, sampler);
m_inputValueOperation->readSampled(value, x, y, sampler);
m_inputColorOperation->readSampled(inputColor, x, y, sampler);
float fac = value[0];
fac = MIN2(1.0f, fac);
const float mfac = 1.0f - fac;
output[0] = mfac * inputColor[0] +
fac * colorbalance_lgg(
inputColor[0], this->m_lift[0], this->m_gamma_inv[0], this->m_gain[0]);
fac * colorbalance_lgg(inputColor[0], m_lift[0], m_gamma_inv[0], m_gain[0]);
output[1] = mfac * inputColor[1] +
fac * colorbalance_lgg(
inputColor[1], this->m_lift[1], this->m_gamma_inv[1], this->m_gain[1]);
fac * colorbalance_lgg(inputColor[1], m_lift[1], m_gamma_inv[1], m_gain[1]);
output[2] = mfac * inputColor[2] +
fac * colorbalance_lgg(
inputColor[2], this->m_lift[2], this->m_gamma_inv[2], this->m_gain[2]);
fac * colorbalance_lgg(inputColor[2], m_lift[2], m_gamma_inv[2], m_gain[2]);
output[3] = inputColor[3];
}
@@ -100,8 +97,8 @@ void ColorBalanceLGGOperation::update_memory_buffer_row(PixelCursor &p)
void ColorBalanceLGGOperation::deinitExecution()
{
this->m_inputValueOperation = nullptr;
this->m_inputColorOperation = nullptr;
m_inputValueOperation = nullptr;
m_inputColorOperation = nullptr;
}
} // namespace blender::compositor

View File

@@ -61,15 +61,15 @@ class ColorBalanceLGGOperation : public MultiThreadedRowOperation {
void setGain(const float gain[3])
{
copy_v3_v3(this->m_gain, gain);
copy_v3_v3(m_gain, gain);
}
void setLift(const float lift[3])
{
copy_v3_v3(this->m_lift, lift);
copy_v3_v3(m_lift, lift);
}
void setGammaInv(const float gamma_inv[3])
{
copy_v3_v3(this->m_gamma_inv, gamma_inv);
copy_v3_v3(m_gamma_inv, gamma_inv);
}
void update_memory_buffer_row(PixelCursor &p) override;

View File

@@ -27,17 +27,17 @@ ColorCorrectionOperation::ColorCorrectionOperation()
this->addInputSocket(DataType::Color);
this->addInputSocket(DataType::Value);
this->addOutputSocket(DataType::Color);
this->m_inputImage = nullptr;
this->m_inputMask = nullptr;
this->m_redChannelEnabled = true;
this->m_greenChannelEnabled = true;
this->m_blueChannelEnabled = true;
m_inputImage = nullptr;
m_inputMask = nullptr;
m_redChannelEnabled = true;
m_greenChannelEnabled = true;
m_blueChannelEnabled = true;
flags.can_be_constant = true;
}
void ColorCorrectionOperation::initExecution()
{
this->m_inputImage = this->getInputSocketReader(0);
this->m_inputMask = this->getInputSocketReader(1);
m_inputImage = this->getInputSocketReader(0);
m_inputMask = this->getInputSocketReader(1);
}
/* Calculate x^y if the function is defined. Otherwise return the given fallback value. */
@@ -56,15 +56,15 @@ void ColorCorrectionOperation::executePixelSampled(float output[4],
{
float inputImageColor[4];
float inputMask[4];
this->m_inputImage->readSampled(inputImageColor, x, y, sampler);
this->m_inputMask->readSampled(inputMask, x, y, sampler);
m_inputImage->readSampled(inputImageColor, x, y, sampler);
m_inputMask->readSampled(inputMask, x, y, sampler);
float level = (inputImageColor[0] + inputImageColor[1] + inputImageColor[2]) / 3.0f;
float contrast = this->m_data->master.contrast;
float saturation = this->m_data->master.saturation;
float gamma = this->m_data->master.gamma;
float gain = this->m_data->master.gain;
float lift = this->m_data->master.lift;
float contrast = m_data->master.contrast;
float saturation = m_data->master.saturation;
float gamma = m_data->master.gamma;
float gain = m_data->master.gain;
float lift = m_data->master.lift;
float r, g, b;
float value = inputMask[0];
@@ -76,18 +76,18 @@ void ColorCorrectionOperation::executePixelSampled(float output[4],
float levelHighlights = 0.0;
#define MARGIN 0.10f
#define MARGIN_DIV (0.5f / MARGIN)
if (level < this->m_data->startmidtones - MARGIN) {
if (level < m_data->startmidtones - MARGIN) {
levelShadows = 1.0f;
}
else if (level < this->m_data->startmidtones + MARGIN) {
levelMidtones = ((level - this->m_data->startmidtones) * MARGIN_DIV) + 0.5f;
else if (level < m_data->startmidtones + MARGIN) {
levelMidtones = ((level - m_data->startmidtones) * MARGIN_DIV) + 0.5f;
levelShadows = 1.0f - levelMidtones;
}
else if (level < this->m_data->endmidtones - MARGIN) {
else if (level < m_data->endmidtones - MARGIN) {
levelMidtones = 1.0f;
}
else if (level < this->m_data->endmidtones + MARGIN) {
levelHighlights = ((level - this->m_data->endmidtones) * MARGIN_DIV) + 0.5f;
else if (level < m_data->endmidtones + MARGIN) {
levelHighlights = ((level - m_data->endmidtones) * MARGIN_DIV) + 0.5f;
levelMidtones = 1.0f - levelHighlights;
}
else {
@@ -95,21 +95,18 @@ void ColorCorrectionOperation::executePixelSampled(float output[4],
}
#undef MARGIN
#undef MARGIN_DIV
contrast *= (levelShadows * this->m_data->shadows.contrast) +
(levelMidtones * this->m_data->midtones.contrast) +
(levelHighlights * this->m_data->highlights.contrast);
saturation *= (levelShadows * this->m_data->shadows.saturation) +
(levelMidtones * this->m_data->midtones.saturation) +
(levelHighlights * this->m_data->highlights.saturation);
gamma *= (levelShadows * this->m_data->shadows.gamma) +
(levelMidtones * this->m_data->midtones.gamma) +
(levelHighlights * this->m_data->highlights.gamma);
gain *= (levelShadows * this->m_data->shadows.gain) +
(levelMidtones * this->m_data->midtones.gain) +
(levelHighlights * this->m_data->highlights.gain);
lift += (levelShadows * this->m_data->shadows.lift) +
(levelMidtones * this->m_data->midtones.lift) +
(levelHighlights * this->m_data->highlights.lift);
contrast *= (levelShadows * m_data->shadows.contrast) +
(levelMidtones * m_data->midtones.contrast) +
(levelHighlights * m_data->highlights.contrast);
saturation *= (levelShadows * m_data->shadows.saturation) +
(levelMidtones * m_data->midtones.saturation) +
(levelHighlights * m_data->highlights.saturation);
gamma *= (levelShadows * m_data->shadows.gamma) + (levelMidtones * m_data->midtones.gamma) +
(levelHighlights * m_data->highlights.gamma);
gain *= (levelShadows * m_data->shadows.gain) + (levelMidtones * m_data->midtones.gain) +
(levelHighlights * m_data->highlights.gain);
lift += (levelShadows * m_data->shadows.lift) + (levelMidtones * m_data->midtones.lift) +
(levelHighlights * m_data->highlights.lift);
float invgamma = 1.0f / gamma;
float luma = IMB_colormanagement_get_luminance(inputImageColor);
@@ -136,19 +133,19 @@ void ColorCorrectionOperation::executePixelSampled(float output[4],
g = mvalue * inputImageColor[1] + value * g;
b = mvalue * inputImageColor[2] + value * b;
if (this->m_redChannelEnabled) {
if (m_redChannelEnabled) {
output[0] = r;
}
else {
output[0] = inputImageColor[0];
}
if (this->m_greenChannelEnabled) {
if (m_greenChannelEnabled) {
output[1] = g;
}
else {
output[1] = inputImageColor[1];
}
if (this->m_blueChannelEnabled) {
if (m_blueChannelEnabled) {
output[2] = b;
}
else {
@@ -169,43 +166,40 @@ void ColorCorrectionOperation::update_memory_buffer_row(PixelCursor &p)
float level_highlights = 0.0f;
constexpr float MARGIN = 0.10f;
constexpr float MARGIN_DIV = 0.5f / MARGIN;
if (level < this->m_data->startmidtones - MARGIN) {
if (level < m_data->startmidtones - MARGIN) {
level_shadows = 1.0f;
}
else if (level < this->m_data->startmidtones + MARGIN) {
level_midtones = ((level - this->m_data->startmidtones) * MARGIN_DIV) + 0.5f;
else if (level < m_data->startmidtones + MARGIN) {
level_midtones = ((level - m_data->startmidtones) * MARGIN_DIV) + 0.5f;
level_shadows = 1.0f - level_midtones;
}
else if (level < this->m_data->endmidtones - MARGIN) {
else if (level < m_data->endmidtones - MARGIN) {
level_midtones = 1.0f;
}
else if (level < this->m_data->endmidtones + MARGIN) {
level_highlights = ((level - this->m_data->endmidtones) * MARGIN_DIV) + 0.5f;
else if (level < m_data->endmidtones + MARGIN) {
level_highlights = ((level - m_data->endmidtones) * MARGIN_DIV) + 0.5f;
level_midtones = 1.0f - level_highlights;
}
else {
level_highlights = 1.0f;
}
float contrast = this->m_data->master.contrast;
float saturation = this->m_data->master.saturation;
float gamma = this->m_data->master.gamma;
float gain = this->m_data->master.gain;
float lift = this->m_data->master.lift;
contrast *= level_shadows * this->m_data->shadows.contrast +
level_midtones * this->m_data->midtones.contrast +
level_highlights * this->m_data->highlights.contrast;
saturation *= level_shadows * this->m_data->shadows.saturation +
level_midtones * this->m_data->midtones.saturation +
level_highlights * this->m_data->highlights.saturation;
gamma *= level_shadows * this->m_data->shadows.gamma +
level_midtones * this->m_data->midtones.gamma +
level_highlights * this->m_data->highlights.gamma;
gain *= level_shadows * this->m_data->shadows.gain +
level_midtones * this->m_data->midtones.gain +
level_highlights * this->m_data->highlights.gain;
lift += level_shadows * this->m_data->shadows.lift +
level_midtones * this->m_data->midtones.lift +
level_highlights * this->m_data->highlights.lift;
float contrast = m_data->master.contrast;
float saturation = m_data->master.saturation;
float gamma = m_data->master.gamma;
float gain = m_data->master.gain;
float lift = m_data->master.lift;
contrast *= level_shadows * m_data->shadows.contrast +
level_midtones * m_data->midtones.contrast +
level_highlights * m_data->highlights.contrast;
saturation *= level_shadows * m_data->shadows.saturation +
level_midtones * m_data->midtones.saturation +
level_highlights * m_data->highlights.saturation;
gamma *= level_shadows * m_data->shadows.gamma + level_midtones * m_data->midtones.gamma +
level_highlights * m_data->highlights.gamma;
gain *= level_shadows * m_data->shadows.gain + level_midtones * m_data->midtones.gain +
level_highlights * m_data->highlights.gain;
lift += level_shadows * m_data->shadows.lift + level_midtones * m_data->midtones.lift +
level_highlights * m_data->highlights.lift;
const float inv_gamma = 1.0f / gamma;
const float luma = IMB_colormanagement_get_luminance(in_color);
@@ -239,8 +233,8 @@ void ColorCorrectionOperation::update_memory_buffer_row(PixelCursor &p)
void ColorCorrectionOperation::deinitExecution()
{
this->m_inputImage = nullptr;
this->m_inputMask = nullptr;
m_inputImage = nullptr;
m_inputMask = nullptr;
}
} // namespace blender::compositor

View File

@@ -55,19 +55,19 @@ class ColorCorrectionOperation : public MultiThreadedRowOperation {
void setData(NodeColorCorrection *data)
{
this->m_data = data;
m_data = data;
}
void setRedChannelEnabled(bool enabled)
{
this->m_redChannelEnabled = enabled;
m_redChannelEnabled = enabled;
}
void setGreenChannelEnabled(bool enabled)
{
this->m_greenChannelEnabled = enabled;
m_greenChannelEnabled = enabled;
}
void setBlueChannelEnabled(bool enabled)
{
this->m_blueChannelEnabled = enabled;
m_blueChannelEnabled = enabled;
}
void update_memory_buffer_row(PixelCursor &p) override;

View File

@@ -30,22 +30,22 @@ ColorCurveOperation::ColorCurveOperation()
this->addInputSocket(DataType::Color);
this->addOutputSocket(DataType::Color);
this->m_inputFacProgram = nullptr;
this->m_inputImageProgram = nullptr;
this->m_inputBlackProgram = nullptr;
this->m_inputWhiteProgram = nullptr;
m_inputFacProgram = nullptr;
m_inputImageProgram = nullptr;
m_inputBlackProgram = nullptr;
m_inputWhiteProgram = nullptr;
this->set_canvas_input_index(1);
}
void ColorCurveOperation::initExecution()
{
CurveBaseOperation::initExecution();
this->m_inputFacProgram = this->getInputSocketReader(0);
this->m_inputImageProgram = this->getInputSocketReader(1);
this->m_inputBlackProgram = this->getInputSocketReader(2);
this->m_inputWhiteProgram = this->getInputSocketReader(3);
m_inputFacProgram = this->getInputSocketReader(0);
m_inputImageProgram = this->getInputSocketReader(1);
m_inputBlackProgram = this->getInputSocketReader(2);
m_inputWhiteProgram = this->getInputSocketReader(3);
BKE_curvemapping_premultiply(this->m_curveMapping, 0);
BKE_curvemapping_premultiply(m_curveMapping, 0);
}
void ColorCurveOperation::executePixelSampled(float output[4],
@@ -53,7 +53,7 @@ void ColorCurveOperation::executePixelSampled(float output[4],
float y,
PixelSampler sampler)
{
CurveMapping *cumap = this->m_curveMapping;
CurveMapping *cumap = m_curveMapping;
float fac[4];
float image[4];
@@ -63,15 +63,15 @@ void ColorCurveOperation::executePixelSampled(float output[4],
float white[4];
float bwmul[3];
this->m_inputBlackProgram->readSampled(black, x, y, sampler);
this->m_inputWhiteProgram->readSampled(white, x, y, sampler);
m_inputBlackProgram->readSampled(black, x, y, sampler);
m_inputWhiteProgram->readSampled(white, x, y, sampler);
/* get our own local bwmul value,
* since we can't be threadsafe and use cumap->bwmul & friends */
BKE_curvemapping_set_black_white_ex(black, white, bwmul);
this->m_inputFacProgram->readSampled(fac, x, y, sampler);
this->m_inputImageProgram->readSampled(image, x, y, sampler);
m_inputFacProgram->readSampled(fac, x, y, sampler);
m_inputImageProgram->readSampled(image, x, y, sampler);
if (*fac >= 1.0f) {
BKE_curvemapping_evaluate_premulRGBF_ex(cumap, output, image, black, bwmul);
@@ -90,17 +90,17 @@ void ColorCurveOperation::executePixelSampled(float output[4],
void ColorCurveOperation::deinitExecution()
{
CurveBaseOperation::deinitExecution();
this->m_inputFacProgram = nullptr;
this->m_inputImageProgram = nullptr;
this->m_inputBlackProgram = nullptr;
this->m_inputWhiteProgram = nullptr;
m_inputFacProgram = nullptr;
m_inputImageProgram = nullptr;
m_inputBlackProgram = nullptr;
m_inputWhiteProgram = nullptr;
}
void ColorCurveOperation::update_memory_buffer_partial(MemoryBuffer *output,
const rcti &area,
Span<MemoryBuffer *> inputs)
{
CurveMapping *cumap = this->m_curveMapping;
CurveMapping *cumap = m_curveMapping;
float bwmul[3];
for (BuffersIterator<float> it = output->iterate_with(inputs, area); !it.is_end(); ++it) {
/* Local versions of `cumap->black` and `cumap->white`. */
@@ -134,20 +134,20 @@ ConstantLevelColorCurveOperation::ConstantLevelColorCurveOperation()
this->addInputSocket(DataType::Color);
this->addOutputSocket(DataType::Color);
this->m_inputFacProgram = nullptr;
this->m_inputImageProgram = nullptr;
m_inputFacProgram = nullptr;
m_inputImageProgram = nullptr;
this->set_canvas_input_index(1);
}
void ConstantLevelColorCurveOperation::initExecution()
{
CurveBaseOperation::initExecution();
this->m_inputFacProgram = this->getInputSocketReader(0);
this->m_inputImageProgram = this->getInputSocketReader(1);
m_inputFacProgram = this->getInputSocketReader(0);
m_inputImageProgram = this->getInputSocketReader(1);
BKE_curvemapping_premultiply(this->m_curveMapping, 0);
BKE_curvemapping_premultiply(m_curveMapping, 0);
BKE_curvemapping_set_black_white(this->m_curveMapping, this->m_black, this->m_white);
BKE_curvemapping_set_black_white(m_curveMapping, m_black, m_white);
}
void ConstantLevelColorCurveOperation::executePixelSampled(float output[4],
@@ -158,18 +158,18 @@ void ConstantLevelColorCurveOperation::executePixelSampled(float output[4],
float fac[4];
float image[4];
this->m_inputFacProgram->readSampled(fac, x, y, sampler);
this->m_inputImageProgram->readSampled(image, x, y, sampler);
m_inputFacProgram->readSampled(fac, x, y, sampler);
m_inputImageProgram->readSampled(image, x, y, sampler);
if (*fac >= 1.0f) {
BKE_curvemapping_evaluate_premulRGBF(this->m_curveMapping, output, image);
BKE_curvemapping_evaluate_premulRGBF(m_curveMapping, output, image);
}
else if (*fac <= 0.0f) {
copy_v3_v3(output, image);
}
else {
float col[4];
BKE_curvemapping_evaluate_premulRGBF(this->m_curveMapping, col, image);
BKE_curvemapping_evaluate_premulRGBF(m_curveMapping, col, image);
interp_v3_v3v3(output, image, col, *fac);
}
output[3] = image[3];
@@ -178,15 +178,15 @@ void ConstantLevelColorCurveOperation::executePixelSampled(float output[4],
void ConstantLevelColorCurveOperation::deinitExecution()
{
CurveBaseOperation::deinitExecution();
this->m_inputFacProgram = nullptr;
this->m_inputImageProgram = nullptr;
m_inputFacProgram = nullptr;
m_inputImageProgram = nullptr;
}
void ConstantLevelColorCurveOperation::update_memory_buffer_partial(MemoryBuffer *output,
const rcti &area,
Span<MemoryBuffer *> inputs)
{
CurveMapping *cumap = this->m_curveMapping;
CurveMapping *cumap = m_curveMapping;
for (BuffersIterator<float> it = output->iterate_with(inputs, area); !it.is_end(); ++it) {
const float fac = *it.in(0);
const float *image = it.in(1);

View File

@@ -85,11 +85,11 @@ class ConstantLevelColorCurveOperation : public CurveBaseOperation {
void setBlackLevel(float black[3])
{
copy_v3_v3(this->m_black, black);
copy_v3_v3(m_black, black);
}
void setWhiteLevel(float white[3])
{
copy_v3_v3(this->m_white, white);
copy_v3_v3(m_white, white);
}
void update_memory_buffer_partial(MemoryBuffer *output,

View File

@@ -25,14 +25,14 @@ ExposureOperation::ExposureOperation()
this->addInputSocket(DataType::Color);
this->addInputSocket(DataType::Value);
this->addOutputSocket(DataType::Color);
this->m_inputProgram = nullptr;
m_inputProgram = nullptr;
flags.can_be_constant = true;
}
void ExposureOperation::initExecution()
{
this->m_inputProgram = this->getInputSocketReader(0);
this->m_inputExposureProgram = this->getInputSocketReader(1);
m_inputProgram = this->getInputSocketReader(0);
m_inputExposureProgram = this->getInputSocketReader(1);
}
void ExposureOperation::executePixelSampled(float output[4],
@@ -42,8 +42,8 @@ void ExposureOperation::executePixelSampled(float output[4],
{
float inputValue[4];
float inputExposure[4];
this->m_inputProgram->readSampled(inputValue, x, y, sampler);
this->m_inputExposureProgram->readSampled(inputExposure, x, y, sampler);
m_inputProgram->readSampled(inputValue, x, y, sampler);
m_inputExposureProgram->readSampled(inputExposure, x, y, sampler);
const float exposure = pow(2, inputExposure[0]);
output[0] = inputValue[0] * exposure;
@@ -68,8 +68,8 @@ void ExposureOperation::update_memory_buffer_row(PixelCursor &p)
void ExposureOperation::deinitExecution()
{
this->m_inputProgram = nullptr;
this->m_inputExposureProgram = nullptr;
m_inputProgram = nullptr;
m_inputExposureProgram = nullptr;
}
} // namespace blender::compositor

View File

@@ -26,21 +26,21 @@ ColorMatteOperation::ColorMatteOperation()
addInputSocket(DataType::Color);
addOutputSocket(DataType::Value);
this->m_inputImageProgram = nullptr;
this->m_inputKeyProgram = nullptr;
m_inputImageProgram = nullptr;
m_inputKeyProgram = nullptr;
flags.can_be_constant = true;
}
void ColorMatteOperation::initExecution()
{
this->m_inputImageProgram = this->getInputSocketReader(0);
this->m_inputKeyProgram = this->getInputSocketReader(1);
m_inputImageProgram = this->getInputSocketReader(0);
m_inputKeyProgram = this->getInputSocketReader(1);
}
void ColorMatteOperation::deinitExecution()
{
this->m_inputImageProgram = nullptr;
this->m_inputKeyProgram = nullptr;
m_inputImageProgram = nullptr;
m_inputKeyProgram = nullptr;
}
void ColorMatteOperation::executePixelSampled(float output[4],
@@ -51,14 +51,14 @@ void ColorMatteOperation::executePixelSampled(float output[4],
float inColor[4];
float inKey[4];
const float hue = this->m_settings->t1;
const float sat = this->m_settings->t2;
const float val = this->m_settings->t3;
const float hue = m_settings->t1;
const float sat = m_settings->t2;
const float val = m_settings->t3;
float h_wrap;
this->m_inputImageProgram->readSampled(inColor, x, y, sampler);
this->m_inputKeyProgram->readSampled(inKey, x, y, sampler);
m_inputImageProgram->readSampled(inColor, x, y, sampler);
m_inputKeyProgram->readSampled(inKey, x, y, sampler);
/* Store matte(alpha) value in [0] to go with
* COM_SetAlphaMultiplyOperation and the Value output.

View File

@@ -48,7 +48,7 @@ class ColorMatteOperation : public MultiThreadedOperation {
void setSettings(NodeChroma *nodeChroma)
{
this->m_settings = nodeChroma;
m_settings = nodeChroma;
}
void update_memory_buffer_partial(MemoryBuffer *output,

View File

@@ -27,13 +27,13 @@ ColorRampOperation::ColorRampOperation()
this->addInputSocket(DataType::Value);
this->addOutputSocket(DataType::Color);
this->m_inputProgram = nullptr;
this->m_colorBand = nullptr;
m_inputProgram = nullptr;
m_colorBand = nullptr;
this->flags.can_be_constant = true;
}
void ColorRampOperation::initExecution()
{
this->m_inputProgram = this->getInputSocketReader(0);
m_inputProgram = this->getInputSocketReader(0);
}
void ColorRampOperation::executePixelSampled(float output[4],
@@ -43,13 +43,13 @@ void ColorRampOperation::executePixelSampled(float output[4],
{
float values[4];
this->m_inputProgram->readSampled(values, x, y, sampler);
BKE_colorband_evaluate(this->m_colorBand, values[0], output);
m_inputProgram->readSampled(values, x, y, sampler);
BKE_colorband_evaluate(m_colorBand, values[0], output);
}
void ColorRampOperation::deinitExecution()
{
this->m_inputProgram = nullptr;
m_inputProgram = nullptr;
}
void ColorRampOperation::update_memory_buffer_partial(MemoryBuffer *output,

View File

@@ -51,7 +51,7 @@ class ColorRampOperation : public MultiThreadedOperation {
void setColorBand(ColorBand *colorBand)
{
this->m_colorBand = colorBand;
m_colorBand = colorBand;
}
void update_memory_buffer_partial(MemoryBuffer *output,

View File

@@ -27,60 +27,60 @@ ColorSpillOperation::ColorSpillOperation()
addInputSocket(DataType::Value);
addOutputSocket(DataType::Color);
this->m_inputImageReader = nullptr;
this->m_inputFacReader = nullptr;
this->m_spillChannel = 1; /* GREEN */
this->m_spillMethod = 0;
m_inputImageReader = nullptr;
m_inputFacReader = nullptr;
m_spillChannel = 1; /* GREEN */
m_spillMethod = 0;
flags.can_be_constant = true;
}
void ColorSpillOperation::initExecution()
{
this->m_inputImageReader = this->getInputSocketReader(0);
this->m_inputFacReader = this->getInputSocketReader(1);
if (this->m_spillChannel == 0) {
this->m_rmut = -1.0f;
this->m_gmut = 1.0f;
this->m_bmut = 1.0f;
this->m_channel2 = 1;
this->m_channel3 = 2;
if (this->m_settings->unspill == 0) {
this->m_settings->uspillr = 1.0f;
this->m_settings->uspillg = 0.0f;
this->m_settings->uspillb = 0.0f;
m_inputImageReader = this->getInputSocketReader(0);
m_inputFacReader = this->getInputSocketReader(1);
if (m_spillChannel == 0) {
m_rmut = -1.0f;
m_gmut = 1.0f;
m_bmut = 1.0f;
m_channel2 = 1;
m_channel3 = 2;
if (m_settings->unspill == 0) {
m_settings->uspillr = 1.0f;
m_settings->uspillg = 0.0f;
m_settings->uspillb = 0.0f;
}
}
else if (this->m_spillChannel == 1) {
this->m_rmut = 1.0f;
this->m_gmut = -1.0f;
this->m_bmut = 1.0f;
this->m_channel2 = 0;
this->m_channel3 = 2;
if (this->m_settings->unspill == 0) {
this->m_settings->uspillr = 0.0f;
this->m_settings->uspillg = 1.0f;
this->m_settings->uspillb = 0.0f;
else if (m_spillChannel == 1) {
m_rmut = 1.0f;
m_gmut = -1.0f;
m_bmut = 1.0f;
m_channel2 = 0;
m_channel3 = 2;
if (m_settings->unspill == 0) {
m_settings->uspillr = 0.0f;
m_settings->uspillg = 1.0f;
m_settings->uspillb = 0.0f;
}
}
else {
this->m_rmut = 1.0f;
this->m_gmut = 1.0f;
this->m_bmut = -1.0f;
m_rmut = 1.0f;
m_gmut = 1.0f;
m_bmut = -1.0f;
this->m_channel2 = 0;
this->m_channel3 = 1;
if (this->m_settings->unspill == 0) {
this->m_settings->uspillr = 0.0f;
this->m_settings->uspillg = 0.0f;
this->m_settings->uspillb = 1.0f;
m_channel2 = 0;
m_channel3 = 1;
if (m_settings->unspill == 0) {
m_settings->uspillr = 0.0f;
m_settings->uspillg = 0.0f;
m_settings->uspillb = 1.0f;
}
}
}
void ColorSpillOperation::deinitExecution()
{
this->m_inputImageReader = nullptr;
this->m_inputFacReader = nullptr;
m_inputImageReader = nullptr;
m_inputFacReader = nullptr;
}
void ColorSpillOperation::executePixelSampled(float output[4],
@@ -90,27 +90,25 @@ void ColorSpillOperation::executePixelSampled(float output[4],
{
float fac[4];
float input[4];
this->m_inputFacReader->readSampled(fac, x, y, sampler);
this->m_inputImageReader->readSampled(input, x, y, sampler);
m_inputFacReader->readSampled(fac, x, y, sampler);
m_inputImageReader->readSampled(input, x, y, sampler);
float rfac = MIN2(1.0f, fac[0]);
float map;
switch (this->m_spillMethod) {
switch (m_spillMethod) {
case 0: /* simple */
map = rfac * (input[this->m_spillChannel] -
(this->m_settings->limscale * input[this->m_settings->limchan]));
map = rfac * (input[m_spillChannel] - (m_settings->limscale * input[m_settings->limchan]));
break;
default: /* average */
map = rfac *
(input[this->m_spillChannel] -
(this->m_settings->limscale * AVG(input[this->m_channel2], input[this->m_channel3])));
map = rfac * (input[m_spillChannel] -
(m_settings->limscale * AVG(input[m_channel2], input[m_channel3])));
break;
}
if (map > 0.0f) {
output[0] = input[0] + this->m_rmut * (this->m_settings->uspillr * map);
output[1] = input[1] + this->m_gmut * (this->m_settings->uspillg * map);
output[2] = input[2] + this->m_bmut * (this->m_settings->uspillb * map);
output[0] = input[0] + m_rmut * (m_settings->uspillr * map);
output[1] = input[1] + m_gmut * (m_settings->uspillg * map);
output[2] = input[2] + m_bmut * (m_settings->uspillb * map);
output[3] = input[3];
}
else {

View File

@@ -53,15 +53,15 @@ class ColorSpillOperation : public MultiThreadedOperation {
void setSettings(NodeColorspill *nodeColorSpill)
{
this->m_settings = nodeColorSpill;
m_settings = nodeColorSpill;
}
void setSpillChannel(int channel)
{
this->m_spillChannel = channel;
m_spillChannel = channel;
}
void setSpillMethod(int method)
{
this->m_spillMethod = method;
m_spillMethod = method;
}
float calculateMapValue(float fac, float *input);

View File

@@ -32,71 +32,71 @@ CompositorOperation::CompositorOperation()
this->addInputSocket(DataType::Value);
this->setRenderData(nullptr);
this->m_outputBuffer = nullptr;
this->m_depthBuffer = nullptr;
this->m_imageInput = nullptr;
this->m_alphaInput = nullptr;
this->m_depthInput = nullptr;
m_outputBuffer = nullptr;
m_depthBuffer = nullptr;
m_imageInput = nullptr;
m_alphaInput = nullptr;
m_depthInput = nullptr;
this->m_useAlphaInput = false;
this->m_active = false;
m_useAlphaInput = false;
m_active = false;
this->m_scene = nullptr;
this->m_sceneName[0] = '\0';
this->m_viewName = nullptr;
m_scene = nullptr;
m_sceneName[0] = '\0';
m_viewName = nullptr;
flags.use_render_border = true;
}
void CompositorOperation::initExecution()
{
if (!this->m_active) {
if (!m_active) {
return;
}
/* When initializing the tree during initial load the width and height can be zero. */
this->m_imageInput = getInputSocketReader(0);
this->m_alphaInput = getInputSocketReader(1);
this->m_depthInput = getInputSocketReader(2);
m_imageInput = getInputSocketReader(0);
m_alphaInput = getInputSocketReader(1);
m_depthInput = getInputSocketReader(2);
if (this->getWidth() * this->getHeight() != 0) {
this->m_outputBuffer = (float *)MEM_callocN(
sizeof(float[4]) * this->getWidth() * this->getHeight(), "CompositorOperation");
m_outputBuffer = (float *)MEM_callocN(sizeof(float[4]) * this->getWidth() * this->getHeight(),
"CompositorOperation");
}
if (this->m_depthInput != nullptr) {
this->m_depthBuffer = (float *)MEM_callocN(
sizeof(float) * this->getWidth() * this->getHeight(), "CompositorOperation");
if (m_depthInput != nullptr) {
m_depthBuffer = (float *)MEM_callocN(sizeof(float) * this->getWidth() * this->getHeight(),
"CompositorOperation");
}
}
void CompositorOperation::deinitExecution()
{
if (!this->m_active) {
if (!m_active) {
return;
}
if (!isBraked()) {
Render *re = RE_GetSceneRender(this->m_scene);
Render *re = RE_GetSceneRender(m_scene);
RenderResult *rr = RE_AcquireResultWrite(re);
if (rr) {
RenderView *rv = RE_RenderViewGetByName(rr, this->m_viewName);
RenderView *rv = RE_RenderViewGetByName(rr, m_viewName);
if (rv->rectf != nullptr) {
MEM_freeN(rv->rectf);
}
rv->rectf = this->m_outputBuffer;
rv->rectf = m_outputBuffer;
if (rv->rectz != nullptr) {
MEM_freeN(rv->rectz);
}
rv->rectz = this->m_depthBuffer;
rv->rectz = m_depthBuffer;
rr->have_combined = true;
}
else {
if (this->m_outputBuffer) {
MEM_freeN(this->m_outputBuffer);
if (m_outputBuffer) {
MEM_freeN(m_outputBuffer);
}
if (this->m_depthBuffer) {
MEM_freeN(this->m_depthBuffer);
if (m_depthBuffer) {
MEM_freeN(m_depthBuffer);
}
}
@@ -113,26 +113,26 @@ void CompositorOperation::deinitExecution()
BLI_thread_unlock(LOCK_DRAW_IMAGE);
}
else {
if (this->m_outputBuffer) {
MEM_freeN(this->m_outputBuffer);
if (m_outputBuffer) {
MEM_freeN(m_outputBuffer);
}
if (this->m_depthBuffer) {
MEM_freeN(this->m_depthBuffer);
if (m_depthBuffer) {
MEM_freeN(m_depthBuffer);
}
}
this->m_outputBuffer = nullptr;
this->m_depthBuffer = nullptr;
this->m_imageInput = nullptr;
this->m_alphaInput = nullptr;
this->m_depthInput = nullptr;
m_outputBuffer = nullptr;
m_depthBuffer = nullptr;
m_imageInput = nullptr;
m_alphaInput = nullptr;
m_depthInput = nullptr;
}
void CompositorOperation::executeRegion(rcti *rect, unsigned int /*tileNumber*/)
{
float color[8]; // 7 is enough
float *buffer = this->m_outputBuffer;
float *zbuffer = this->m_depthBuffer;
float *buffer = m_outputBuffer;
float *zbuffer = m_depthBuffer;
if (!buffer) {
return;
@@ -150,7 +150,7 @@ void CompositorOperation::executeRegion(rcti *rect, unsigned int /*tileNumber*/)
int dx = 0, dy = 0;
#if 0
const RenderData *rd = this->m_rd;
const RenderData *rd = m_rd;
if (rd->mode & R_BORDER && rd->mode & R_CROP) {
/**
@@ -192,14 +192,14 @@ void CompositorOperation::executeRegion(rcti *rect, unsigned int /*tileNumber*/)
for (x = x1; x < x2 && (!breaked); x++) {
int input_x = x + dx, input_y = y + dy;
this->m_imageInput->readSampled(color, input_x, input_y, PixelSampler::Nearest);
if (this->m_useAlphaInput) {
this->m_alphaInput->readSampled(&(color[3]), input_x, input_y, PixelSampler::Nearest);
m_imageInput->readSampled(color, input_x, input_y, PixelSampler::Nearest);
if (m_useAlphaInput) {
m_alphaInput->readSampled(&(color[3]), input_x, input_y, PixelSampler::Nearest);
}
copy_v4_v4(buffer + offset4, color);
this->m_depthInput->readSampled(color, input_x, input_y, PixelSampler::Nearest);
m_depthInput->readSampled(color, input_x, input_y, PixelSampler::Nearest);
zbuffer[offset] = color[0];
offset4 += COM_DATA_TYPE_COLOR_CHANNELS;
offset++;
@@ -221,7 +221,7 @@ void CompositorOperation::update_memory_buffer_partial(MemoryBuffer *UNUSED(outp
}
MemoryBuffer output_buf(m_outputBuffer, COM_DATA_TYPE_COLOR_CHANNELS, getWidth(), getHeight());
output_buf.copy_from(inputs[0], area);
if (this->m_useAlphaInput) {
if (m_useAlphaInput) {
output_buf.copy_from(inputs[1], area, 0, COM_DATA_TYPE_VALUE_CHANNELS, 3);
}
MemoryBuffer depth_buf(m_depthBuffer, COM_DATA_TYPE_VALUE_CHANNELS, getWidth(), getHeight());
@@ -230,12 +230,12 @@ void CompositorOperation::update_memory_buffer_partial(MemoryBuffer *UNUSED(outp
void CompositorOperation::determine_canvas(const rcti &UNUSED(preferred_area), rcti &r_area)
{
int width = this->m_rd->xsch * this->m_rd->size / 100;
int height = this->m_rd->ysch * this->m_rd->size / 100;
int width = m_rd->xsch * m_rd->size / 100;
int height = m_rd->ysch * m_rd->size / 100;
/* Check actual render resolution with cropping it may differ with cropped border.rendering
* Fix for T31777 Border Crop gives black (easy). */
Render *re = RE_GetSceneRender(this->m_scene);
Render *re = RE_GetSceneRender(m_scene);
if (re) {
RenderResult *rr = RE_AcquireResultRead(re);
if (rr) {

View File

@@ -84,7 +84,7 @@ class CompositorOperation : public MultiThreadedOperation {
CompositorOperation();
bool isActiveCompositorOutput() const
{
return this->m_active;
return m_active;
}
void executeRegion(rcti *rect, unsigned int tileNumber) override;
void setScene(const struct Scene *scene)
@@ -93,15 +93,15 @@ class CompositorOperation : public MultiThreadedOperation {
}
void setSceneName(const char *sceneName)
{
BLI_strncpy(this->m_sceneName, sceneName, sizeof(this->m_sceneName));
BLI_strncpy(m_sceneName, sceneName, sizeof(m_sceneName));
}
void setViewName(const char *viewName)
{
this->m_viewName = viewName;
m_viewName = viewName;
}
void setRenderData(const RenderData *rd)
{
this->m_rd = rd;
m_rd = rd;
}
bool isOutputOperation(bool /*rendering*/) const override
{
@@ -116,11 +116,11 @@ class CompositorOperation : public MultiThreadedOperation {
void determine_canvas(const rcti &preferred_area, rcti &r_area) override;
void setUseAlphaInput(bool value)
{
this->m_useAlphaInput = value;
m_useAlphaInput = value;
}
void setActive(bool active)
{
this->m_active = active;
m_active = active;
}
void update_memory_buffer_partial(MemoryBuffer *output,

View File

@@ -26,13 +26,13 @@ ConvertColorProfileOperation::ConvertColorProfileOperation()
{
this->addInputSocket(DataType::Color);
this->addOutputSocket(DataType::Color);
this->m_inputOperation = nullptr;
this->m_predivided = false;
m_inputOperation = nullptr;
m_predivided = false;
}
void ConvertColorProfileOperation::initExecution()
{
this->m_inputOperation = this->getInputSocketReader(0);
m_inputOperation = this->getInputSocketReader(0);
}
void ConvertColorProfileOperation::executePixelSampled(float output[4],
@@ -41,14 +41,14 @@ void ConvertColorProfileOperation::executePixelSampled(float output[4],
PixelSampler sampler)
{
float color[4];
this->m_inputOperation->readSampled(color, x, y, sampler);
m_inputOperation->readSampled(color, x, y, sampler);
IMB_buffer_float_from_float(
output, color, 4, this->m_toProfile, this->m_fromProfile, this->m_predivided, 1, 1, 0, 0);
output, color, 4, m_toProfile, m_fromProfile, m_predivided, 1, 1, 0, 0);
}
void ConvertColorProfileOperation::deinitExecution()
{
this->m_inputOperation = nullptr;
m_inputOperation = nullptr;
}
} // namespace blender::compositor

View File

@@ -71,15 +71,15 @@ class ConvertColorProfileOperation : public NodeOperation {
void setFromColorProfile(int colorProfile)
{
this->m_fromProfile = colorProfile;
m_fromProfile = colorProfile;
}
void setToColorProfile(int colorProfile)
{
this->m_toProfile = colorProfile;
m_toProfile = colorProfile;
}
void setPredivided(bool predivided)
{
this->m_predivided = predivided;
m_predivided = predivided;
}
};

View File

@@ -26,19 +26,19 @@ ConvertDepthToRadiusOperation::ConvertDepthToRadiusOperation()
{
this->addInputSocket(DataType::Value);
this->addOutputSocket(DataType::Value);
this->m_inputOperation = nullptr;
this->m_fStop = 128.0f;
this->m_cameraObject = nullptr;
this->m_maxRadius = 32.0f;
this->m_blurPostOperation = nullptr;
m_inputOperation = nullptr;
m_fStop = 128.0f;
m_cameraObject = nullptr;
m_maxRadius = 32.0f;
m_blurPostOperation = nullptr;
}
float ConvertDepthToRadiusOperation::determineFocalDistance()
{
if (this->m_cameraObject && this->m_cameraObject->type == OB_CAMERA) {
Camera *camera = (Camera *)this->m_cameraObject->data;
this->m_cam_lens = camera->lens;
return BKE_camera_object_dof_distance(this->m_cameraObject);
if (m_cameraObject && m_cameraObject->type == OB_CAMERA) {
Camera *camera = (Camera *)m_cameraObject->data;
m_cam_lens = camera->lens;
return BKE_camera_object_dof_distance(m_cameraObject);
}
return 10.0f;
@@ -49,28 +49,27 @@ void ConvertDepthToRadiusOperation::initExecution()
float cam_sensor = DEFAULT_SENSOR_WIDTH;
Camera *camera = nullptr;
if (this->m_cameraObject && this->m_cameraObject->type == OB_CAMERA) {
camera = (Camera *)this->m_cameraObject->data;
if (m_cameraObject && m_cameraObject->type == OB_CAMERA) {
camera = (Camera *)m_cameraObject->data;
cam_sensor = BKE_camera_sensor_size(camera->sensor_fit, camera->sensor_x, camera->sensor_y);
}
this->m_inputOperation = this->getInputSocketReader(0);
m_inputOperation = this->getInputSocketReader(0);
float focalDistance = determineFocalDistance();
if (focalDistance == 0.0f) {
focalDistance = 1e10f; /* If the DOF is 0.0 then set it to be far away. */
}
this->m_inverseFocalDistance = 1.0f / focalDistance;
this->m_aspect = (this->getWidth() > this->getHeight()) ?
m_inverseFocalDistance = 1.0f / focalDistance;
m_aspect = (this->getWidth() > this->getHeight()) ?
(this->getHeight() / (float)this->getWidth()) :
(this->getWidth() / (float)this->getHeight());
this->m_aperture = 0.5f * (this->m_cam_lens / (this->m_aspect * cam_sensor)) / this->m_fStop;
m_aperture = 0.5f * (m_cam_lens / (m_aspect * cam_sensor)) / m_fStop;
const float minsz = MIN2(getWidth(), getHeight());
this->m_dof_sp =
minsz / ((cam_sensor / 2.0f) /
this->m_cam_lens); /* <- == `aspect * MIN2(img->x, img->y) / tan(0.5f * fov)` */
m_dof_sp = minsz / ((cam_sensor / 2.0f) /
m_cam_lens); /* <- == `aspect * MIN2(img->x, img->y) / tan(0.5f * fov)` */
if (this->m_blurPostOperation) {
m_blurPostOperation->setSigma(MIN2(m_aperture * 128.0f, this->m_maxRadius));
if (m_blurPostOperation) {
m_blurPostOperation->setSigma(MIN2(m_aperture * 128.0f, m_maxRadius));
}
}
@@ -82,7 +81,7 @@ void ConvertDepthToRadiusOperation::executePixelSampled(float output[4],
float inputValue[4];
float z;
float radius;
this->m_inputOperation->readSampled(inputValue, x, y, sampler);
m_inputOperation->readSampled(inputValue, x, y, sampler);
z = inputValue[0];
if (z != 0.0f) {
float iZ = (1.0f / z);
@@ -93,15 +92,14 @@ void ConvertDepthToRadiusOperation::executePixelSampled(float output[4],
/* Scale crad back to original maximum and blend. */
crad->rect[px] = bcrad + wts->rect[px] * (scf * crad->rect[px] - bcrad);
#endif
radius = 0.5f * fabsf(this->m_aperture *
(this->m_dof_sp * (this->m_inverseFocalDistance - iZ) - 1.0f));
radius = 0.5f * fabsf(m_aperture * (m_dof_sp * (m_inverseFocalDistance - iZ) - 1.0f));
/* 'bug' T6615, limit minimum radius to 1 pixel,
* not really a solution, but somewhat mitigates the problem. */
if (radius < 0.0f) {
radius = 0.0f;
}
if (radius > this->m_maxRadius) {
radius = this->m_maxRadius;
if (radius > m_maxRadius) {
radius = m_maxRadius;
}
output[0] = radius;
}
@@ -112,7 +110,7 @@ void ConvertDepthToRadiusOperation::executePixelSampled(float output[4],
void ConvertDepthToRadiusOperation::deinitExecution()
{
this->m_inputOperation = nullptr;
m_inputOperation = nullptr;
}
void ConvertDepthToRadiusOperation::update_memory_buffer_partial(MemoryBuffer *output,

View File

@@ -68,20 +68,20 @@ class ConvertDepthToRadiusOperation : public MultiThreadedOperation {
void setfStop(float fStop)
{
this->m_fStop = fStop;
m_fStop = fStop;
}
void setMaxRadius(float maxRadius)
{
this->m_maxRadius = maxRadius;
m_maxRadius = maxRadius;
}
void setCameraObject(Object *camera)
{
this->m_cameraObject = camera;
m_cameraObject = camera;
}
float determineFocalDistance();
void setPostBlur(FastGaussianBlurValueOperation *operation)
{
this->m_blurPostOperation = operation;
m_blurPostOperation = operation;
}
void update_memory_buffer_partial(MemoryBuffer *output,

View File

@@ -26,18 +26,18 @@ namespace blender::compositor {
ConvertBaseOperation::ConvertBaseOperation()
{
this->m_inputOperation = nullptr;
m_inputOperation = nullptr;
this->flags.can_be_constant = true;
}
void ConvertBaseOperation::initExecution()
{
this->m_inputOperation = this->getInputSocketReader(0);
m_inputOperation = this->getInputSocketReader(0);
}
void ConvertBaseOperation::deinitExecution()
{
this->m_inputOperation = nullptr;
m_inputOperation = nullptr;
}
void ConvertBaseOperation::hash_output_params()
@@ -66,7 +66,7 @@ void ConvertValueToColorOperation::executePixelSampled(float output[4],
PixelSampler sampler)
{
float value;
this->m_inputOperation->readSampled(&value, x, y, sampler);
m_inputOperation->readSampled(&value, x, y, sampler);
output[0] = output[1] = output[2] = value;
output[3] = 1.0f;
}
@@ -93,7 +93,7 @@ void ConvertColorToValueOperation::executePixelSampled(float output[4],
PixelSampler sampler)
{
float inputColor[4];
this->m_inputOperation->readSampled(inputColor, x, y, sampler);
m_inputOperation->readSampled(inputColor, x, y, sampler);
output[0] = (inputColor[0] + inputColor[1] + inputColor[2]) / 3.0f;
}
@@ -119,7 +119,7 @@ void ConvertColorToBWOperation::executePixelSampled(float output[4],
PixelSampler sampler)
{
float inputColor[4];
this->m_inputOperation->readSampled(inputColor, x, y, sampler);
m_inputOperation->readSampled(inputColor, x, y, sampler);
output[0] = IMB_colormanagement_get_luminance(inputColor);
}
@@ -144,7 +144,7 @@ void ConvertColorToVectorOperation::executePixelSampled(float output[4],
PixelSampler sampler)
{
float color[4];
this->m_inputOperation->readSampled(color, x, y, sampler);
m_inputOperation->readSampled(color, x, y, sampler);
copy_v3_v3(output, color);
}
@@ -169,7 +169,7 @@ void ConvertValueToVectorOperation::executePixelSampled(float output[4],
PixelSampler sampler)
{
float value;
this->m_inputOperation->readSampled(&value, x, y, sampler);
m_inputOperation->readSampled(&value, x, y, sampler);
output[0] = output[1] = output[2] = value;
}
@@ -193,7 +193,7 @@ void ConvertVectorToColorOperation::executePixelSampled(float output[4],
float y,
PixelSampler sampler)
{
this->m_inputOperation->readSampled(output, x, y, sampler);
m_inputOperation->readSampled(output, x, y, sampler);
output[3] = 1.0f;
}
@@ -219,7 +219,7 @@ void ConvertVectorToValueOperation::executePixelSampled(float output[4],
PixelSampler sampler)
{
float input[4];
this->m_inputOperation->readSampled(input, x, y, sampler);
m_inputOperation->readSampled(input, x, y, sampler);
output[0] = (input[0] + input[1] + input[2]) / 3.0f;
}
@@ -243,14 +243,14 @@ void ConvertRGBToYCCOperation::setMode(int mode)
{
switch (mode) {
case 0:
this->m_mode = BLI_YCC_ITU_BT601;
m_mode = BLI_YCC_ITU_BT601;
break;
case 2:
this->m_mode = BLI_YCC_JFIF_0_255;
m_mode = BLI_YCC_JFIF_0_255;
break;
case 1:
default:
this->m_mode = BLI_YCC_ITU_BT709;
m_mode = BLI_YCC_ITU_BT709;
break;
}
}
@@ -263,9 +263,9 @@ void ConvertRGBToYCCOperation::executePixelSampled(float output[4],
float inputColor[4];
float color[3];
this->m_inputOperation->readSampled(inputColor, x, y, sampler);
m_inputOperation->readSampled(inputColor, x, y, sampler);
rgb_to_ycc(
inputColor[0], inputColor[1], inputColor[2], &color[0], &color[1], &color[2], this->m_mode);
inputColor[0], inputColor[1], inputColor[2], &color[0], &color[1], &color[2], m_mode);
/* divided by 255 to normalize for viewing in */
/* R,G,B --> Y,Cb,Cr */
@@ -283,7 +283,7 @@ void ConvertRGBToYCCOperation::update_memory_buffer_partial(BuffersIterator<floa
{
for (; !it.is_end(); ++it) {
const float *in = it.in(0);
rgb_to_ycc(in[0], in[1], in[2], &it.out[0], &it.out[1], &it.out[2], this->m_mode);
rgb_to_ycc(in[0], in[1], in[2], &it.out[0], &it.out[1], &it.out[2], m_mode);
/* Normalize for viewing (#rgb_to_ycc returns 0-255 values). */
mul_v3_fl(it.out, 1.0f / 255.0f);
@@ -303,14 +303,14 @@ void ConvertYCCToRGBOperation::setMode(int mode)
{
switch (mode) {
case 0:
this->m_mode = BLI_YCC_ITU_BT601;
m_mode = BLI_YCC_ITU_BT601;
break;
case 2:
this->m_mode = BLI_YCC_JFIF_0_255;
m_mode = BLI_YCC_JFIF_0_255;
break;
case 1:
default:
this->m_mode = BLI_YCC_ITU_BT709;
m_mode = BLI_YCC_ITU_BT709;
break;
}
}
@@ -321,7 +321,7 @@ void ConvertYCCToRGBOperation::executePixelSampled(float output[4],
PixelSampler sampler)
{
float inputColor[4];
this->m_inputOperation->readSampled(inputColor, x, y, sampler);
m_inputOperation->readSampled(inputColor, x, y, sampler);
/* need to un-normalize the data */
/* R,G,B --> Y,Cb,Cr */
@@ -333,7 +333,7 @@ void ConvertYCCToRGBOperation::executePixelSampled(float output[4],
&output[0],
&output[1],
&output[2],
this->m_mode);
m_mode);
output[3] = inputColor[3];
}
@@ -354,7 +354,7 @@ void ConvertYCCToRGBOperation::update_memory_buffer_partial(BuffersIterator<floa
&it.out[0],
&it.out[1],
&it.out[2],
this->m_mode);
m_mode);
it.out[3] = in[3];
}
}
@@ -373,7 +373,7 @@ void ConvertRGBToYUVOperation::executePixelSampled(float output[4],
PixelSampler sampler)
{
float inputColor[4];
this->m_inputOperation->readSampled(inputColor, x, y, sampler);
m_inputOperation->readSampled(inputColor, x, y, sampler);
rgb_to_yuv(inputColor[0],
inputColor[1],
inputColor[2],
@@ -407,7 +407,7 @@ void ConvertYUVToRGBOperation::executePixelSampled(float output[4],
PixelSampler sampler)
{
float inputColor[4];
this->m_inputOperation->readSampled(inputColor, x, y, sampler);
m_inputOperation->readSampled(inputColor, x, y, sampler);
yuv_to_rgb(inputColor[0],
inputColor[1],
inputColor[2],
@@ -441,7 +441,7 @@ void ConvertRGBToHSVOperation::executePixelSampled(float output[4],
PixelSampler sampler)
{
float inputColor[4];
this->m_inputOperation->readSampled(inputColor, x, y, sampler);
m_inputOperation->readSampled(inputColor, x, y, sampler);
rgb_to_hsv_v(inputColor, output);
output[3] = inputColor[3];
}
@@ -469,7 +469,7 @@ void ConvertHSVToRGBOperation::executePixelSampled(float output[4],
PixelSampler sampler)
{
float inputColor[4];
this->m_inputOperation->readSampled(inputColor, x, y, sampler);
m_inputOperation->readSampled(inputColor, x, y, sampler);
hsv_to_rgb_v(inputColor, output);
output[0] = max_ff(output[0], 0.0f);
output[1] = max_ff(output[1], 0.0f);
@@ -503,7 +503,7 @@ void ConvertPremulToStraightOperation::executePixelSampled(float output[4],
PixelSampler sampler)
{
ColorSceneLinear4f<eAlpha::Premultiplied> input;
this->m_inputOperation->readSampled(input, x, y, sampler);
m_inputOperation->readSampled(input, x, y, sampler);
ColorSceneLinear4f<eAlpha::Straight> converted = input.unpremultiply_alpha();
copy_v4_v4(output, converted);
}
@@ -529,7 +529,7 @@ void ConvertStraightToPremulOperation::executePixelSampled(float output[4],
PixelSampler sampler)
{
ColorSceneLinear4f<eAlpha::Straight> input;
this->m_inputOperation->readSampled(input, x, y, sampler);
m_inputOperation->readSampled(input, x, y, sampler);
ColorSceneLinear4f<eAlpha::Premultiplied> converted = input.premultiply_alpha();
copy_v4_v4(output, converted);
}
@@ -547,16 +547,16 @@ SeparateChannelOperation::SeparateChannelOperation()
{
this->addInputSocket(DataType::Color);
this->addOutputSocket(DataType::Value);
this->m_inputOperation = nullptr;
m_inputOperation = nullptr;
}
void SeparateChannelOperation::initExecution()
{
this->m_inputOperation = this->getInputSocketReader(0);
m_inputOperation = this->getInputSocketReader(0);
}
void SeparateChannelOperation::deinitExecution()
{
this->m_inputOperation = nullptr;
m_inputOperation = nullptr;
}
void SeparateChannelOperation::executePixelSampled(float output[4],
@@ -565,8 +565,8 @@ void SeparateChannelOperation::executePixelSampled(float output[4],
PixelSampler sampler)
{
float input[4];
this->m_inputOperation->readSampled(input, x, y, sampler);
output[0] = input[this->m_channel];
m_inputOperation->readSampled(input, x, y, sampler);
output[0] = input[m_channel];
}
void SeparateChannelOperation::update_memory_buffer_partial(MemoryBuffer *output,
@@ -574,7 +574,7 @@ void SeparateChannelOperation::update_memory_buffer_partial(MemoryBuffer *output
Span<MemoryBuffer *> inputs)
{
for (BuffersIterator<float> it = output->iterate_with(inputs, area); !it.is_end(); ++it) {
it.out[0] = it.in(0)[this->m_channel];
it.out[0] = it.in(0)[m_channel];
}
}
@@ -588,26 +588,26 @@ CombineChannelsOperation::CombineChannelsOperation()
this->addInputSocket(DataType::Value);
this->addOutputSocket(DataType::Color);
this->set_canvas_input_index(0);
this->m_inputChannel1Operation = nullptr;
this->m_inputChannel2Operation = nullptr;
this->m_inputChannel3Operation = nullptr;
this->m_inputChannel4Operation = nullptr;
m_inputChannel1Operation = nullptr;
m_inputChannel2Operation = nullptr;
m_inputChannel3Operation = nullptr;
m_inputChannel4Operation = nullptr;
}
void CombineChannelsOperation::initExecution()
{
this->m_inputChannel1Operation = this->getInputSocketReader(0);
this->m_inputChannel2Operation = this->getInputSocketReader(1);
this->m_inputChannel3Operation = this->getInputSocketReader(2);
this->m_inputChannel4Operation = this->getInputSocketReader(3);
m_inputChannel1Operation = this->getInputSocketReader(0);
m_inputChannel2Operation = this->getInputSocketReader(1);
m_inputChannel3Operation = this->getInputSocketReader(2);
m_inputChannel4Operation = this->getInputSocketReader(3);
}
void CombineChannelsOperation::deinitExecution()
{
this->m_inputChannel1Operation = nullptr;
this->m_inputChannel2Operation = nullptr;
this->m_inputChannel3Operation = nullptr;
this->m_inputChannel4Operation = nullptr;
m_inputChannel1Operation = nullptr;
m_inputChannel2Operation = nullptr;
m_inputChannel3Operation = nullptr;
m_inputChannel4Operation = nullptr;
}
void CombineChannelsOperation::executePixelSampled(float output[4],
@@ -616,20 +616,20 @@ void CombineChannelsOperation::executePixelSampled(float output[4],
PixelSampler sampler)
{
float input[4];
if (this->m_inputChannel1Operation) {
this->m_inputChannel1Operation->readSampled(input, x, y, sampler);
if (m_inputChannel1Operation) {
m_inputChannel1Operation->readSampled(input, x, y, sampler);
output[0] = input[0];
}
if (this->m_inputChannel2Operation) {
this->m_inputChannel2Operation->readSampled(input, x, y, sampler);
if (m_inputChannel2Operation) {
m_inputChannel2Operation->readSampled(input, x, y, sampler);
output[1] = input[0];
}
if (this->m_inputChannel3Operation) {
this->m_inputChannel3Operation->readSampled(input, x, y, sampler);
if (m_inputChannel3Operation) {
m_inputChannel3Operation->readSampled(input, x, y, sampler);
output[2] = input[0];
}
if (this->m_inputChannel4Operation) {
this->m_inputChannel4Operation->readSampled(input, x, y, sampler);
if (m_inputChannel4Operation) {
m_inputChannel4Operation->readSampled(input, x, y, sampler);
output[3] = input[0];
}
}

View File

@@ -221,7 +221,7 @@ class SeparateChannelOperation : public MultiThreadedOperation {
void setChannel(int channel)
{
this->m_channel = channel;
m_channel = channel;
}
void update_memory_buffer_partial(MemoryBuffer *output,

View File

@@ -38,44 +38,44 @@ void ConvolutionEdgeFilterOperation::executePixel(float output[4], int x, int y,
CLAMP(y3, 0, getHeight() - 1);
float value[4];
this->m_inputValueOperation->read(value, x2, y2, nullptr);
m_inputValueOperation->read(value, x2, y2, nullptr);
float mval = 1.0f - value[0];
this->m_inputOperation->read(in1, x1, y1, nullptr);
madd_v3_v3fl(res1, in1, this->m_filter[0]);
madd_v3_v3fl(res2, in1, this->m_filter[0]);
m_inputOperation->read(in1, x1, y1, nullptr);
madd_v3_v3fl(res1, in1, m_filter[0]);
madd_v3_v3fl(res2, in1, m_filter[0]);
this->m_inputOperation->read(in1, x2, y1, nullptr);
madd_v3_v3fl(res1, in1, this->m_filter[1]);
madd_v3_v3fl(res2, in1, this->m_filter[3]);
m_inputOperation->read(in1, x2, y1, nullptr);
madd_v3_v3fl(res1, in1, m_filter[1]);
madd_v3_v3fl(res2, in1, m_filter[3]);
this->m_inputOperation->read(in1, x3, y1, nullptr);
madd_v3_v3fl(res1, in1, this->m_filter[2]);
madd_v3_v3fl(res2, in1, this->m_filter[6]);
m_inputOperation->read(in1, x3, y1, nullptr);
madd_v3_v3fl(res1, in1, m_filter[2]);
madd_v3_v3fl(res2, in1, m_filter[6]);
this->m_inputOperation->read(in1, x1, y2, nullptr);
madd_v3_v3fl(res1, in1, this->m_filter[3]);
madd_v3_v3fl(res2, in1, this->m_filter[1]);
m_inputOperation->read(in1, x1, y2, nullptr);
madd_v3_v3fl(res1, in1, m_filter[3]);
madd_v3_v3fl(res2, in1, m_filter[1]);
this->m_inputOperation->read(in2, x2, y2, nullptr);
madd_v3_v3fl(res1, in2, this->m_filter[4]);
madd_v3_v3fl(res2, in2, this->m_filter[4]);
m_inputOperation->read(in2, x2, y2, nullptr);
madd_v3_v3fl(res1, in2, m_filter[4]);
madd_v3_v3fl(res2, in2, m_filter[4]);
this->m_inputOperation->read(in1, x3, y2, nullptr);
madd_v3_v3fl(res1, in1, this->m_filter[5]);
madd_v3_v3fl(res2, in1, this->m_filter[7]);
m_inputOperation->read(in1, x3, y2, nullptr);
madd_v3_v3fl(res1, in1, m_filter[5]);
madd_v3_v3fl(res2, in1, m_filter[7]);
this->m_inputOperation->read(in1, x1, y3, nullptr);
madd_v3_v3fl(res1, in1, this->m_filter[6]);
madd_v3_v3fl(res2, in1, this->m_filter[2]);
m_inputOperation->read(in1, x1, y3, nullptr);
madd_v3_v3fl(res1, in1, m_filter[6]);
madd_v3_v3fl(res2, in1, m_filter[2]);
this->m_inputOperation->read(in1, x2, y3, nullptr);
madd_v3_v3fl(res1, in1, this->m_filter[7]);
madd_v3_v3fl(res2, in1, this->m_filter[5]);
m_inputOperation->read(in1, x2, y3, nullptr);
madd_v3_v3fl(res1, in1, m_filter[7]);
madd_v3_v3fl(res2, in1, m_filter[5]);
this->m_inputOperation->read(in1, x3, y3, nullptr);
madd_v3_v3fl(res1, in1, this->m_filter[8]);
madd_v3_v3fl(res2, in1, this->m_filter[8]);
m_inputOperation->read(in1, x3, y3, nullptr);
madd_v3_v3fl(res1, in1, m_filter[8]);
madd_v3_v3fl(res2, in1, m_filter[8]);
output[0] = sqrt(res1[0] * res1[0] + res2[0] * res2[0]);
output[1] = sqrt(res1[1] * res1[1] + res2[1] * res2[1]);

View File

@@ -26,35 +26,35 @@ ConvolutionFilterOperation::ConvolutionFilterOperation()
this->addInputSocket(DataType::Value);
this->addOutputSocket(DataType::Color);
this->set_canvas_input_index(0);
this->m_inputOperation = nullptr;
m_inputOperation = nullptr;
this->flags.complex = true;
}
void ConvolutionFilterOperation::initExecution()
{
this->m_inputOperation = this->getInputSocketReader(0);
this->m_inputValueOperation = this->getInputSocketReader(1);
m_inputOperation = this->getInputSocketReader(0);
m_inputValueOperation = this->getInputSocketReader(1);
}
void ConvolutionFilterOperation::set3x3Filter(
float f1, float f2, float f3, float f4, float f5, float f6, float f7, float f8, float f9)
{
this->m_filter[0] = f1;
this->m_filter[1] = f2;
this->m_filter[2] = f3;
this->m_filter[3] = f4;
this->m_filter[4] = f5;
this->m_filter[5] = f6;
this->m_filter[6] = f7;
this->m_filter[7] = f8;
this->m_filter[8] = f9;
this->m_filterHeight = 3;
this->m_filterWidth = 3;
m_filter[0] = f1;
m_filter[1] = f2;
m_filter[2] = f3;
m_filter[3] = f4;
m_filter[4] = f5;
m_filter[5] = f6;
m_filter[6] = f7;
m_filter[7] = f8;
m_filter[8] = f9;
m_filterHeight = 3;
m_filterWidth = 3;
}
void ConvolutionFilterOperation::deinitExecution()
{
this->m_inputOperation = nullptr;
this->m_inputValueOperation = nullptr;
m_inputOperation = nullptr;
m_inputValueOperation = nullptr;
}
void ConvolutionFilterOperation::executePixel(float output[4], int x, int y, void * /*data*/)
@@ -74,28 +74,28 @@ void ConvolutionFilterOperation::executePixel(float output[4], int x, int y, voi
CLAMP(y2, 0, getHeight() - 1);
CLAMP(y3, 0, getHeight() - 1);
float value[4];
this->m_inputValueOperation->read(value, x2, y2, nullptr);
m_inputValueOperation->read(value, x2, y2, nullptr);
const float mval = 1.0f - value[0];
zero_v4(output);
this->m_inputOperation->read(in1, x1, y1, nullptr);
madd_v4_v4fl(output, in1, this->m_filter[0]);
this->m_inputOperation->read(in1, x2, y1, nullptr);
madd_v4_v4fl(output, in1, this->m_filter[1]);
this->m_inputOperation->read(in1, x3, y1, nullptr);
madd_v4_v4fl(output, in1, this->m_filter[2]);
this->m_inputOperation->read(in1, x1, y2, nullptr);
madd_v4_v4fl(output, in1, this->m_filter[3]);
this->m_inputOperation->read(in2, x2, y2, nullptr);
madd_v4_v4fl(output, in2, this->m_filter[4]);
this->m_inputOperation->read(in1, x3, y2, nullptr);
madd_v4_v4fl(output, in1, this->m_filter[5]);
this->m_inputOperation->read(in1, x1, y3, nullptr);
madd_v4_v4fl(output, in1, this->m_filter[6]);
this->m_inputOperation->read(in1, x2, y3, nullptr);
madd_v4_v4fl(output, in1, this->m_filter[7]);
this->m_inputOperation->read(in1, x3, y3, nullptr);
madd_v4_v4fl(output, in1, this->m_filter[8]);
m_inputOperation->read(in1, x1, y1, nullptr);
madd_v4_v4fl(output, in1, m_filter[0]);
m_inputOperation->read(in1, x2, y1, nullptr);
madd_v4_v4fl(output, in1, m_filter[1]);
m_inputOperation->read(in1, x3, y1, nullptr);
madd_v4_v4fl(output, in1, m_filter[2]);
m_inputOperation->read(in1, x1, y2, nullptr);
madd_v4_v4fl(output, in1, m_filter[3]);
m_inputOperation->read(in2, x2, y2, nullptr);
madd_v4_v4fl(output, in2, m_filter[4]);
m_inputOperation->read(in1, x3, y2, nullptr);
madd_v4_v4fl(output, in1, m_filter[5]);
m_inputOperation->read(in1, x1, y3, nullptr);
madd_v4_v4fl(output, in1, m_filter[6]);
m_inputOperation->read(in1, x2, y3, nullptr);
madd_v4_v4fl(output, in1, m_filter[7]);
m_inputOperation->read(in1, x3, y3, nullptr);
madd_v4_v4fl(output, in1, m_filter[8]);
output[0] = output[0] * value[0] + in2[0] * mval;
output[1] = output[1] * value[0] + in2[1] * mval;
@@ -113,8 +113,8 @@ bool ConvolutionFilterOperation::determineDependingAreaOfInterest(
rcti *input, ReadBufferOperation *readOperation, rcti *output)
{
rcti newInput;
int addx = (this->m_filterWidth - 1) / 2 + 1;
int addy = (this->m_filterHeight - 1) / 2 + 1;
int addx = (m_filterWidth - 1) / 2 + 1;
int addy = (m_filterHeight - 1) / 2 + 1;
newInput.xmax = input->xmax + addx;
newInput.xmin = input->xmin - addx;
newInput.ymax = input->ymax + addy;

View File

@@ -24,8 +24,8 @@ CropBaseOperation::CropBaseOperation()
{
this->addInputSocket(DataType::Color, ResizeMode::Align);
this->addOutputSocket(DataType::Color);
this->m_inputOperation = nullptr;
this->m_settings = nullptr;
m_inputOperation = nullptr;
m_settings = nullptr;
}
void CropBaseOperation::updateArea()
@@ -33,10 +33,10 @@ void CropBaseOperation::updateArea()
SocketReader *inputReference = this->getInputSocketReader(0);
float width = inputReference->getWidth();
float height = inputReference->getHeight();
NodeTwoXYs local_settings = *this->m_settings;
NodeTwoXYs local_settings = *m_settings;
if (width > 0.0f && height > 0.0f) {
if (this->m_relative) {
if (m_relative) {
local_settings.x1 = width * local_settings.fac_x1;
local_settings.x2 = width * local_settings.fac_x2;
local_settings.y1 = height * local_settings.fac_y1;
@@ -55,28 +55,28 @@ void CropBaseOperation::updateArea()
local_settings.y2 = height - 1;
}
this->m_xmax = MAX2(local_settings.x1, local_settings.x2) + 1;
this->m_xmin = MIN2(local_settings.x1, local_settings.x2);
this->m_ymax = MAX2(local_settings.y1, local_settings.y2) + 1;
this->m_ymin = MIN2(local_settings.y1, local_settings.y2);
m_xmax = MAX2(local_settings.x1, local_settings.x2) + 1;
m_xmin = MIN2(local_settings.x1, local_settings.x2);
m_ymax = MAX2(local_settings.y1, local_settings.y2) + 1;
m_ymin = MIN2(local_settings.y1, local_settings.y2);
}
else {
this->m_xmax = 0;
this->m_xmin = 0;
this->m_ymax = 0;
this->m_ymin = 0;
m_xmax = 0;
m_xmin = 0;
m_ymax = 0;
m_ymin = 0;
}
}
void CropBaseOperation::initExecution()
{
this->m_inputOperation = this->getInputSocketReader(0);
m_inputOperation = this->getInputSocketReader(0);
updateArea();
}
void CropBaseOperation::deinitExecution()
{
this->m_inputOperation = nullptr;
m_inputOperation = nullptr;
}
CropOperation::CropOperation() : CropBaseOperation()
@@ -86,8 +86,8 @@ CropOperation::CropOperation() : CropBaseOperation()
void CropOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler)
{
if ((x < this->m_xmax && x >= this->m_xmin) && (y < this->m_ymax && y >= this->m_ymin)) {
this->m_inputOperation->readSampled(output, x, y, sampler);
if ((x < m_xmax && x >= m_xmin) && (y < m_ymax && y >= m_ymin)) {
m_inputOperation->readSampled(output, x, y, sampler);
}
else {
zero_v4(output);
@@ -121,10 +121,10 @@ bool CropImageOperation::determineDependingAreaOfInterest(rcti *input,
{
rcti newInput;
newInput.xmax = input->xmax + this->m_xmin;
newInput.xmin = input->xmin + this->m_xmin;
newInput.ymax = input->ymax + this->m_ymin;
newInput.ymin = input->ymin + this->m_ymin;
newInput.xmax = input->xmax + m_xmin;
newInput.xmin = input->xmin + m_xmin;
newInput.ymax = input->ymax + m_ymin;
newInput.ymin = input->ymin + m_ymin;
return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
}
@@ -135,10 +135,10 @@ void CropImageOperation::get_area_of_interest(const int input_idx,
{
BLI_assert(input_idx == 0);
UNUSED_VARS_NDEBUG(input_idx);
r_input_area.xmax = output_area.xmax + this->m_xmin;
r_input_area.xmin = output_area.xmin + this->m_xmin;
r_input_area.ymax = output_area.ymax + this->m_ymin;
r_input_area.ymin = output_area.ymin + this->m_ymin;
r_input_area.xmax = output_area.xmax + m_xmin;
r_input_area.xmin = output_area.xmin + m_xmin;
r_input_area.ymax = output_area.ymax + m_ymin;
r_input_area.ymin = output_area.ymin + m_ymin;
}
void CropImageOperation::determine_canvas(const rcti &preferred_area, rcti &r_area)
@@ -155,7 +155,7 @@ void CropImageOperation::executePixelSampled(float output[4],
PixelSampler sampler)
{
if (x >= 0 && x < getWidth() && y >= 0 && y < getHeight()) {
this->m_inputOperation->readSampled(output, (x + this->m_xmin), (y + this->m_ymin), sampler);
m_inputOperation->readSampled(output, (x + m_xmin), (y + m_ymin), sampler);
}
else {
zero_v4(output);
@@ -171,7 +171,7 @@ void CropImageOperation::update_memory_buffer_partial(MemoryBuffer *output,
const MemoryBuffer *input = inputs[0];
for (BuffersIterator<float> it = output->iterate_with({}, area); !it.is_end(); ++it) {
if (BLI_rcti_isect_pt(&op_area, it.x, it.y)) {
input->read_elem_checked(it.x + this->m_xmin, it.y + this->m_ymin, it.out);
input->read_elem_checked(it.x + m_xmin, it.y + m_ymin, it.out);
}
else {
zero_v4(it.out);

View File

@@ -40,11 +40,11 @@ class CropBaseOperation : public MultiThreadedOperation {
void deinitExecution() override;
void setCropSettings(NodeTwoXYs *settings)
{
this->m_settings = settings;
m_settings = settings;
}
void setRelative(bool rel)
{
this->m_relative = rel;
m_relative = rel;
}
};

View File

@@ -24,37 +24,37 @@ namespace blender::compositor {
CurveBaseOperation::CurveBaseOperation()
{
this->m_curveMapping = nullptr;
m_curveMapping = nullptr;
this->flags.can_be_constant = true;
}
CurveBaseOperation::~CurveBaseOperation()
{
if (this->m_curveMapping) {
BKE_curvemapping_free(this->m_curveMapping);
this->m_curveMapping = nullptr;
if (m_curveMapping) {
BKE_curvemapping_free(m_curveMapping);
m_curveMapping = nullptr;
}
}
void CurveBaseOperation::initExecution()
{
BKE_curvemapping_init(this->m_curveMapping);
BKE_curvemapping_init(m_curveMapping);
}
void CurveBaseOperation::deinitExecution()
{
if (this->m_curveMapping) {
BKE_curvemapping_free(this->m_curveMapping);
this->m_curveMapping = nullptr;
if (m_curveMapping) {
BKE_curvemapping_free(m_curveMapping);
m_curveMapping = nullptr;
}
}
void CurveBaseOperation::setCurveMapping(CurveMapping *mapping)
{
/* duplicate the curve to avoid glitches while drawing, see bug T32374. */
if (this->m_curveMapping) {
BKE_curvemapping_free(this->m_curveMapping);
if (m_curveMapping) {
BKE_curvemapping_free(m_curveMapping);
}
this->m_curveMapping = BKE_curvemapping_copy(mapping);
m_curveMapping = BKE_curvemapping_copy(mapping);
}
} // namespace blender::compositor

View File

@@ -160,21 +160,21 @@ DenoiseOperation::DenoiseOperation()
this->addInputSocket(DataType::Vector);
this->addInputSocket(DataType::Color);
this->addOutputSocket(DataType::Color);
this->m_settings = nullptr;
m_settings = nullptr;
}
void DenoiseOperation::initExecution()
{
SingleThreadedOperation::initExecution();
this->m_inputProgramColor = getInputSocketReader(0);
this->m_inputProgramNormal = getInputSocketReader(1);
this->m_inputProgramAlbedo = getInputSocketReader(2);
m_inputProgramColor = getInputSocketReader(0);
m_inputProgramNormal = getInputSocketReader(1);
m_inputProgramAlbedo = getInputSocketReader(2);
}
void DenoiseOperation::deinitExecution()
{
this->m_inputProgramColor = nullptr;
this->m_inputProgramNormal = nullptr;
this->m_inputProgramAlbedo = nullptr;
m_inputProgramColor = nullptr;
m_inputProgramNormal = nullptr;
m_inputProgramAlbedo = nullptr;
SingleThreadedOperation::deinitExecution();
}
@@ -199,16 +199,16 @@ void DenoiseOperation::hash_output_params()
MemoryBuffer *DenoiseOperation::createMemoryBuffer(rcti *rect2)
{
MemoryBuffer *tileColor = (MemoryBuffer *)this->m_inputProgramColor->initializeTileData(rect2);
MemoryBuffer *tileNormal = (MemoryBuffer *)this->m_inputProgramNormal->initializeTileData(rect2);
MemoryBuffer *tileAlbedo = (MemoryBuffer *)this->m_inputProgramAlbedo->initializeTileData(rect2);
MemoryBuffer *tileColor = (MemoryBuffer *)m_inputProgramColor->initializeTileData(rect2);
MemoryBuffer *tileNormal = (MemoryBuffer *)m_inputProgramNormal->initializeTileData(rect2);
MemoryBuffer *tileAlbedo = (MemoryBuffer *)m_inputProgramAlbedo->initializeTileData(rect2);
rcti rect;
rect.xmin = 0;
rect.ymin = 0;
rect.xmax = getWidth();
rect.ymax = getHeight();
MemoryBuffer *result = new MemoryBuffer(DataType::Color, rect);
this->generateDenoise(result, tileColor, tileNormal, tileAlbedo, this->m_settings);
this->generateDenoise(result, tileColor, tileNormal, tileAlbedo, m_settings);
return result;
}

View File

@@ -68,7 +68,7 @@ class DenoiseOperation : public DenoiseBaseOperation {
void setDenoiseSettings(NodeDenoise *settings)
{
this->m_settings = settings;
m_settings = settings;
}
void update_memory_buffer(MemoryBuffer *output,

View File

@@ -28,19 +28,19 @@ DespeckleOperation::DespeckleOperation()
this->addInputSocket(DataType::Value);
this->addOutputSocket(DataType::Color);
this->set_canvas_input_index(0);
this->m_inputOperation = nullptr;
m_inputOperation = nullptr;
this->flags.complex = true;
}
void DespeckleOperation::initExecution()
{
this->m_inputOperation = this->getInputSocketReader(0);
this->m_inputValueOperation = this->getInputSocketReader(1);
m_inputOperation = this->getInputSocketReader(0);
m_inputValueOperation = this->getInputSocketReader(1);
}
void DespeckleOperation::deinitExecution()
{
this->m_inputOperation = nullptr;
this->m_inputValueOperation = nullptr;
m_inputOperation = nullptr;
m_inputValueOperation = nullptr;
}
BLI_INLINE int color_diff(const float a[3], const float b[3], const float threshold)
@@ -69,10 +69,10 @@ void DespeckleOperation::executePixel(float output[4], int x, int y, void * /*da
CLAMP(y2, 0, getHeight() - 1);
CLAMP(y3, 0, getHeight() - 1);
float value[4];
this->m_inputValueOperation->read(value, x2, y2, nullptr);
m_inputValueOperation->read(value, x2, y2, nullptr);
// const float mval = 1.0f - value[0];
this->m_inputOperation->read(color_org, x2, y2, nullptr);
m_inputOperation->read(color_org, x2, y2, nullptr);
#define TOT_DIV_ONE 1.0f
#define TOT_DIV_CNR (float)M_SQRT1_2
@@ -82,7 +82,7 @@ void DespeckleOperation::executePixel(float output[4], int x, int y, void * /*da
#define COLOR_ADD(fac) \
{ \
madd_v4_v4fl(color_mid, in1, fac); \
if (color_diff(in1, color_org, this->m_threshold)) { \
if (color_diff(in1, color_org, m_threshold)) { \
w += fac; \
madd_v4_v4fl(color_mid_ok, in1, fac); \
} \
@@ -91,34 +91,34 @@ void DespeckleOperation::executePixel(float output[4], int x, int y, void * /*da
zero_v4(color_mid);
zero_v4(color_mid_ok);
this->m_inputOperation->read(in1, x1, y1, nullptr);
m_inputOperation->read(in1, x1, y1, nullptr);
COLOR_ADD(TOT_DIV_CNR)
this->m_inputOperation->read(in1, x2, y1, nullptr);
m_inputOperation->read(in1, x2, y1, nullptr);
COLOR_ADD(TOT_DIV_ONE)
this->m_inputOperation->read(in1, x3, y1, nullptr);
m_inputOperation->read(in1, x3, y1, nullptr);
COLOR_ADD(TOT_DIV_CNR)
this->m_inputOperation->read(in1, x1, y2, nullptr);
m_inputOperation->read(in1, x1, y2, nullptr);
COLOR_ADD(TOT_DIV_ONE)
#if 0
this->m_inputOperation->read(in2, x2, y2, nullptr);
madd_v4_v4fl(color_mid, in2, this->m_filter[4]);
m_inputOperation->read(in2, x2, y2, nullptr);
madd_v4_v4fl(color_mid, in2, m_filter[4]);
#endif
this->m_inputOperation->read(in1, x3, y2, nullptr);
m_inputOperation->read(in1, x3, y2, nullptr);
COLOR_ADD(TOT_DIV_ONE)
this->m_inputOperation->read(in1, x1, y3, nullptr);
m_inputOperation->read(in1, x1, y3, nullptr);
COLOR_ADD(TOT_DIV_CNR)
this->m_inputOperation->read(in1, x2, y3, nullptr);
m_inputOperation->read(in1, x2, y3, nullptr);
COLOR_ADD(TOT_DIV_ONE)
this->m_inputOperation->read(in1, x3, y3, nullptr);
m_inputOperation->read(in1, x3, y3, nullptr);
COLOR_ADD(TOT_DIV_CNR)
mul_v4_fl(color_mid, 1.0f / (4.0f + (4.0f * (float)M_SQRT1_2)));
// mul_v4_fl(color_mid, 1.0f / w);
if ((w != 0.0f) && ((w / WTOT) > (this->m_threshold_neighbor)) &&
color_diff(color_mid, color_org, this->m_threshold)) {
if ((w != 0.0f) && ((w / WTOT) > (m_threshold_neighbor)) &&
color_diff(color_mid, color_org, m_threshold)) {
mul_v4_fl(color_mid_ok, 1.0f / w);
interp_v4_v4v4(output, color_org, color_mid_ok, value[0]);
}
@@ -137,8 +137,8 @@ bool DespeckleOperation::determineDependingAreaOfInterest(rcti *input,
rcti *output)
{
rcti newInput;
int addx = 2; //(this->m_filterWidth - 1) / 2 + 1;
int addy = 2; //(this->m_filterHeight - 1) / 2 + 1;
int addx = 2; //(m_filterWidth - 1) / 2 + 1;
int addy = 2; //(m_filterHeight - 1) / 2 + 1;
newInput.xmax = input->xmax + addx;
newInput.xmin = input->xmin - addx;
newInput.ymax = input->ymax + addy;
@@ -153,8 +153,8 @@ void DespeckleOperation::get_area_of_interest(const int input_idx,
{
switch (input_idx) {
case IMAGE_INPUT_INDEX: {
const int add_x = 2; //(this->m_filterWidth - 1) / 2 + 1;
const int add_y = 2; //(this->m_filterHeight - 1) / 2 + 1;
const int add_x = 2; //(m_filterWidth - 1) / 2 + 1;
const int add_y = 2; //(m_filterHeight - 1) / 2 + 1;
r_input_area.xmin = output_area.xmin - add_x;
r_input_area.xmax = output_area.xmax + add_x;
r_input_area.ymin = output_area.ymin - add_y;
@@ -217,7 +217,7 @@ void DespeckleOperation::update_memory_buffer_partial(MemoryBuffer *output,
#if 0
const float* in2 = image->get_elem(x2, y2);
madd_v4_v4fl(color_mid, in2, this->m_filter[4]);
madd_v4_v4fl(color_mid, in2, m_filter[4]);
#endif
in1 = image->get_elem(x3, y2);

View File

@@ -46,11 +46,11 @@ class DespeckleOperation : public MultiThreadedOperation {
void setThreshold(float threshold)
{
this->m_threshold = threshold;
m_threshold = threshold;
}
void setThresholdNeighbor(float threshold)
{
this->m_threshold_neighbor = threshold;
m_threshold_neighbor = threshold;
}
void initExecution() override;

View File

@@ -26,20 +26,20 @@ DifferenceMatteOperation::DifferenceMatteOperation()
addInputSocket(DataType::Color);
addOutputSocket(DataType::Value);
this->m_inputImage1Program = nullptr;
this->m_inputImage2Program = nullptr;
m_inputImage1Program = nullptr;
m_inputImage2Program = nullptr;
flags.can_be_constant = true;
}
void DifferenceMatteOperation::initExecution()
{
this->m_inputImage1Program = this->getInputSocketReader(0);
this->m_inputImage2Program = this->getInputSocketReader(1);
m_inputImage1Program = this->getInputSocketReader(0);
m_inputImage2Program = this->getInputSocketReader(1);
}
void DifferenceMatteOperation::deinitExecution()
{
this->m_inputImage1Program = nullptr;
this->m_inputImage2Program = nullptr;
m_inputImage1Program = nullptr;
m_inputImage2Program = nullptr;
}
void DifferenceMatteOperation::executePixelSampled(float output[4],
@@ -50,13 +50,13 @@ void DifferenceMatteOperation::executePixelSampled(float output[4],
float inColor1[4];
float inColor2[4];
const float tolerance = this->m_settings->t1;
const float falloff = this->m_settings->t2;
const float tolerance = m_settings->t1;
const float falloff = m_settings->t2;
float difference;
float alpha;
this->m_inputImage1Program->readSampled(inColor1, x, y, sampler);
this->m_inputImage2Program->readSampled(inColor2, x, y, sampler);
m_inputImage1Program->readSampled(inColor1, x, y, sampler);
m_inputImage2Program->readSampled(inColor2, x, y, sampler);
difference = (fabsf(inColor2[0] - inColor1[0]) + fabsf(inColor2[1] - inColor1[1]) +
fabsf(inColor2[2] - inColor1[2]));

View File

@@ -48,7 +48,7 @@ class DifferenceMatteOperation : public MultiThreadedOperation {
void setSettings(NodeChroma *nodeChroma)
{
this->m_settings = nodeChroma;
m_settings = nodeChroma;
}
void update_memory_buffer_partial(MemoryBuffer *output,

View File

@@ -27,58 +27,58 @@ DilateErodeThresholdOperation::DilateErodeThresholdOperation()
this->addInputSocket(DataType::Value);
this->addOutputSocket(DataType::Value);
this->flags.complex = true;
this->m_inputProgram = nullptr;
this->m_inset = 0.0f;
this->m__switch = 0.5f;
this->m_distance = 0.0f;
m_inputProgram = nullptr;
m_inset = 0.0f;
m__switch = 0.5f;
m_distance = 0.0f;
}
void DilateErodeThresholdOperation::init_data()
{
if (this->m_distance < 0.0f) {
this->m_scope = -this->m_distance + this->m_inset;
if (m_distance < 0.0f) {
m_scope = -m_distance + m_inset;
}
else {
if (this->m_inset * 2 > this->m_distance) {
this->m_scope = MAX2(this->m_inset * 2 - this->m_distance, this->m_distance);
if (m_inset * 2 > m_distance) {
m_scope = MAX2(m_inset * 2 - m_distance, m_distance);
}
else {
this->m_scope = this->m_distance;
m_scope = m_distance;
}
}
if (this->m_scope < 3) {
this->m_scope = 3;
if (m_scope < 3) {
m_scope = 3;
}
}
void DilateErodeThresholdOperation::initExecution()
{
this->m_inputProgram = this->getInputSocketReader(0);
m_inputProgram = this->getInputSocketReader(0);
}
void *DilateErodeThresholdOperation::initializeTileData(rcti * /*rect*/)
{
void *buffer = this->m_inputProgram->initializeTileData(nullptr);
void *buffer = m_inputProgram->initializeTileData(nullptr);
return buffer;
}
void DilateErodeThresholdOperation::executePixel(float output[4], int x, int y, void *data)
{
float inputValue[4];
const float sw = this->m__switch;
const float distance = this->m_distance;
const float sw = m__switch;
const float distance = m_distance;
float pixelvalue;
const float rd = this->m_scope * this->m_scope;
const float inset = this->m_inset;
const float rd = m_scope * m_scope;
const float inset = m_inset;
float mindist = rd * 2;
MemoryBuffer *inputBuffer = (MemoryBuffer *)data;
float *buffer = inputBuffer->getBuffer();
const rcti &input_rect = inputBuffer->get_rect();
const int minx = MAX2(x - this->m_scope, input_rect.xmin);
const int miny = MAX2(y - this->m_scope, input_rect.ymin);
const int maxx = MIN2(x + this->m_scope, input_rect.xmax);
const int maxy = MIN2(y + this->m_scope, input_rect.ymax);
const int minx = MAX2(x - m_scope, input_rect.xmin);
const int miny = MAX2(y - m_scope, input_rect.ymin);
const int maxx = MIN2(x + m_scope, input_rect.xmax);
const int maxy = MIN2(y + m_scope, input_rect.ymax);
const int bufferWidth = inputBuffer->getWidth();
int offset;
@@ -146,7 +146,7 @@ void DilateErodeThresholdOperation::executePixel(float output[4], int x, int y,
void DilateErodeThresholdOperation::deinitExecution()
{
this->m_inputProgram = nullptr;
m_inputProgram = nullptr;
}
bool DilateErodeThresholdOperation::determineDependingAreaOfInterest(
@@ -154,10 +154,10 @@ bool DilateErodeThresholdOperation::determineDependingAreaOfInterest(
{
rcti newInput;
newInput.xmax = input->xmax + this->m_scope;
newInput.xmin = input->xmin - this->m_scope;
newInput.ymax = input->ymax + this->m_scope;
newInput.ymin = input->ymin - this->m_scope;
newInput.xmax = input->xmax + m_scope;
newInput.xmin = input->xmin - m_scope;
newInput.ymax = input->ymax + m_scope;
newInput.ymin = input->ymin - m_scope;
return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
}
@@ -273,43 +273,43 @@ DilateDistanceOperation::DilateDistanceOperation()
{
this->addInputSocket(DataType::Value);
this->addOutputSocket(DataType::Value);
this->m_inputProgram = nullptr;
this->m_distance = 0.0f;
m_inputProgram = nullptr;
m_distance = 0.0f;
flags.complex = true;
flags.open_cl = true;
}
void DilateDistanceOperation::init_data()
{
this->m_scope = this->m_distance;
if (this->m_scope < 3) {
this->m_scope = 3;
m_scope = m_distance;
if (m_scope < 3) {
m_scope = 3;
}
}
void DilateDistanceOperation::initExecution()
{
this->m_inputProgram = this->getInputSocketReader(0);
m_inputProgram = this->getInputSocketReader(0);
}
void *DilateDistanceOperation::initializeTileData(rcti * /*rect*/)
{
void *buffer = this->m_inputProgram->initializeTileData(nullptr);
void *buffer = m_inputProgram->initializeTileData(nullptr);
return buffer;
}
void DilateDistanceOperation::executePixel(float output[4], int x, int y, void *data)
{
const float distance = this->m_distance;
const float distance = m_distance;
const float mindist = distance * distance;
MemoryBuffer *inputBuffer = (MemoryBuffer *)data;
float *buffer = inputBuffer->getBuffer();
const rcti &input_rect = inputBuffer->get_rect();
const int minx = MAX2(x - this->m_scope, input_rect.xmin);
const int miny = MAX2(y - this->m_scope, input_rect.ymin);
const int maxx = MIN2(x + this->m_scope, input_rect.xmax);
const int maxy = MIN2(y + this->m_scope, input_rect.ymax);
const int minx = MAX2(x - m_scope, input_rect.xmin);
const int miny = MAX2(y - m_scope, input_rect.ymin);
const int maxx = MIN2(x + m_scope, input_rect.xmax);
const int maxy = MIN2(y + m_scope, input_rect.ymax);
const int bufferWidth = inputBuffer->getWidth();
int offset;
@@ -332,7 +332,7 @@ void DilateDistanceOperation::executePixel(float output[4], int x, int y, void *
void DilateDistanceOperation::deinitExecution()
{
this->m_inputProgram = nullptr;
m_inputProgram = nullptr;
}
bool DilateDistanceOperation::determineDependingAreaOfInterest(rcti *input,
@@ -341,10 +341,10 @@ bool DilateDistanceOperation::determineDependingAreaOfInterest(rcti *input,
{
rcti newInput;
newInput.xmax = input->xmax + this->m_scope;
newInput.xmin = input->xmin - this->m_scope;
newInput.ymax = input->ymax + this->m_scope;
newInput.ymin = input->ymin - this->m_scope;
newInput.xmax = input->xmax + m_scope;
newInput.xmin = input->xmin - m_scope;
newInput.ymax = input->ymax + m_scope;
newInput.ymin = input->ymin - m_scope;
return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
}
@@ -358,11 +358,11 @@ void DilateDistanceOperation::executeOpenCL(OpenCLDevice *device,
{
cl_kernel dilateKernel = device->COM_clCreateKernel("dilateKernel", nullptr);
cl_int distanceSquared = this->m_distance * this->m_distance;
cl_int scope = this->m_scope;
cl_int distanceSquared = m_distance * m_distance;
cl_int scope = m_scope;
device->COM_clAttachMemoryBufferToKernelParameter(
dilateKernel, 0, 2, clMemToCleanUp, inputMemoryBuffers, this->m_inputProgram);
dilateKernel, 0, 2, clMemToCleanUp, inputMemoryBuffers, m_inputProgram);
device->COM_clAttachOutputMemoryBufferToKernelParameter(dilateKernel, 1, clOutputBuffer);
device->COM_clAttachMemoryBufferOffsetToKernelParameter(dilateKernel, 3, outputMemoryBuffer);
clSetKernelArg(dilateKernel, 4, sizeof(cl_int), &scope);
@@ -465,16 +465,16 @@ ErodeDistanceOperation::ErodeDistanceOperation() : DilateDistanceOperation()
void ErodeDistanceOperation::executePixel(float output[4], int x, int y, void *data)
{
const float distance = this->m_distance;
const float distance = m_distance;
const float mindist = distance * distance;
MemoryBuffer *inputBuffer = (MemoryBuffer *)data;
float *buffer = inputBuffer->getBuffer();
const rcti &input_rect = inputBuffer->get_rect();
const int minx = MAX2(x - this->m_scope, input_rect.xmin);
const int miny = MAX2(y - this->m_scope, input_rect.ymin);
const int maxx = MIN2(x + this->m_scope, input_rect.xmax);
const int maxy = MIN2(y + this->m_scope, input_rect.ymax);
const int minx = MAX2(x - m_scope, input_rect.xmin);
const int miny = MAX2(y - m_scope, input_rect.ymin);
const int maxx = MIN2(x + m_scope, input_rect.xmax);
const int maxy = MIN2(y + m_scope, input_rect.ymax);
const int bufferWidth = inputBuffer->getWidth();
int offset;
@@ -504,11 +504,11 @@ void ErodeDistanceOperation::executeOpenCL(OpenCLDevice *device,
{
cl_kernel erodeKernel = device->COM_clCreateKernel("erodeKernel", nullptr);
cl_int distanceSquared = this->m_distance * this->m_distance;
cl_int scope = this->m_scope;
cl_int distanceSquared = m_distance * m_distance;
cl_int scope = m_scope;
device->COM_clAttachMemoryBufferToKernelParameter(
erodeKernel, 0, 2, clMemToCleanUp, inputMemoryBuffers, this->m_inputProgram);
erodeKernel, 0, 2, clMemToCleanUp, inputMemoryBuffers, m_inputProgram);
device->COM_clAttachOutputMemoryBufferToKernelParameter(erodeKernel, 1, clOutputBuffer);
device->COM_clAttachMemoryBufferOffsetToKernelParameter(erodeKernel, 3, outputMemoryBuffer);
clSetKernelArg(erodeKernel, 4, sizeof(cl_int), &scope);
@@ -534,11 +534,11 @@ DilateStepOperation::DilateStepOperation()
this->addInputSocket(DataType::Value);
this->addOutputSocket(DataType::Value);
this->flags.complex = true;
this->m_inputProgram = nullptr;
m_inputProgram = nullptr;
}
void DilateStepOperation::initExecution()
{
this->m_inputProgram = this->getInputSocketReader(0);
m_inputProgram = this->getInputSocketReader(0);
}
/* Small helper to pass data from initializeTileData to executePixel. */
@@ -563,13 +563,13 @@ static tile_info *create_cache(int xmin, int xmax, int ymin, int ymax)
void *DilateStepOperation::initializeTileData(rcti *rect)
{
MemoryBuffer *tile = (MemoryBuffer *)this->m_inputProgram->initializeTileData(nullptr);
MemoryBuffer *tile = (MemoryBuffer *)m_inputProgram->initializeTileData(nullptr);
int x, y, i;
int width = tile->getWidth();
int height = tile->getHeight();
float *buffer = tile->getBuffer();
int half_window = this->m_iterations;
int half_window = m_iterations;
int window = half_window * 2 + 1;
int xmin = MAX2(0, rect->xmin - half_window);
@@ -661,7 +661,7 @@ void DilateStepOperation::executePixel(float output[4], int x, int y, void *data
void DilateStepOperation::deinitExecution()
{
this->m_inputProgram = nullptr;
m_inputProgram = nullptr;
}
void DilateStepOperation::deinitializeTileData(rcti * /*rect*/, void *data)
@@ -676,7 +676,7 @@ bool DilateStepOperation::determineDependingAreaOfInterest(rcti *input,
rcti *output)
{
rcti newInput;
int it = this->m_iterations;
int it = m_iterations;
newInput.xmax = input->xmax + it;
newInput.xmin = input->xmin - it;
newInput.ymax = input->ymax + it;
@@ -814,13 +814,13 @@ ErodeStepOperation::ErodeStepOperation() : DilateStepOperation()
void *ErodeStepOperation::initializeTileData(rcti *rect)
{
MemoryBuffer *tile = (MemoryBuffer *)this->m_inputProgram->initializeTileData(nullptr);
MemoryBuffer *tile = (MemoryBuffer *)m_inputProgram->initializeTileData(nullptr);
int x, y, i;
int width = tile->getWidth();
int height = tile->getHeight();
float *buffer = tile->getBuffer();
int half_window = this->m_iterations;
int half_window = m_iterations;
int window = half_window * 2 + 1;
int xmin = MAX2(0, rect->xmin - half_window);

View File

@@ -64,15 +64,15 @@ class DilateErodeThresholdOperation : public MultiThreadedOperation {
void setDistance(float distance)
{
this->m_distance = distance;
m_distance = distance;
}
void setSwitch(float sw)
{
this->m__switch = sw;
m__switch = sw;
}
void setInset(float inset)
{
this->m_inset = inset;
m_inset = inset;
}
bool determineDependingAreaOfInterest(rcti *input,
@@ -119,7 +119,7 @@ class DilateDistanceOperation : public MultiThreadedOperation {
void setDistance(float distance)
{
this->m_distance = distance;
m_distance = distance;
}
bool determineDependingAreaOfInterest(rcti *input,
ReadBufferOperation *readOperation,
@@ -190,7 +190,7 @@ class DilateStepOperation : public MultiThreadedOperation {
void setIterations(int iterations)
{
this->m_iterations = iterations;
m_iterations = iterations;
}
bool determineDependingAreaOfInterest(rcti *input,

View File

@@ -27,20 +27,20 @@ DirectionalBlurOperation::DirectionalBlurOperation()
this->addOutputSocket(DataType::Color);
flags.complex = true;
flags.open_cl = true;
this->m_inputProgram = nullptr;
m_inputProgram = nullptr;
}
void DirectionalBlurOperation::initExecution()
{
this->m_inputProgram = getInputSocketReader(0);
m_inputProgram = getInputSocketReader(0);
QualityStepHelper::initExecution(COM_QH_INCREASE);
const float angle = this->m_data->angle;
const float zoom = this->m_data->zoom;
const float spin = this->m_data->spin;
const float iterations = this->m_data->iter;
const float distance = this->m_data->distance;
const float center_x = this->m_data->center_x;
const float center_y = this->m_data->center_y;
const float angle = m_data->angle;
const float zoom = m_data->zoom;
const float spin = m_data->spin;
const float iterations = m_data->iter;
const float distance = m_data->distance;
const float center_x = m_data->center_x;
const float center_y = m_data->center_y;
const float width = getWidth();
const float height = getHeight();
@@ -49,45 +49,45 @@ void DirectionalBlurOperation::initExecution()
float D;
D = distance * sqrtf(width * width + height * height);
this->m_center_x_pix = center_x * width;
this->m_center_y_pix = center_y * height;
m_center_x_pix = center_x * width;
m_center_y_pix = center_y * height;
this->m_tx = itsc * D * cosf(a);
this->m_ty = -itsc * D * sinf(a);
this->m_sc = itsc * zoom;
this->m_rot = itsc * spin;
m_tx = itsc * D * cosf(a);
m_ty = -itsc * D * sinf(a);
m_sc = itsc * zoom;
m_rot = itsc * spin;
}
void DirectionalBlurOperation::executePixel(float output[4], int x, int y, void * /*data*/)
{
const int iterations = pow(2.0f, this->m_data->iter);
const int iterations = pow(2.0f, m_data->iter);
float col[4] = {0.0f, 0.0f, 0.0f, 0.0f};
float col2[4] = {0.0f, 0.0f, 0.0f, 0.0f};
this->m_inputProgram->readSampled(col2, x, y, PixelSampler::Bilinear);
float ltx = this->m_tx;
float lty = this->m_ty;
float lsc = this->m_sc;
float lrot = this->m_rot;
m_inputProgram->readSampled(col2, x, y, PixelSampler::Bilinear);
float ltx = m_tx;
float lty = m_ty;
float lsc = m_sc;
float lrot = m_rot;
/* blur the image */
for (int i = 0; i < iterations; i++) {
const float cs = cosf(lrot), ss = sinf(lrot);
const float isc = 1.0f / (1.0f + lsc);
const float v = isc * (y - this->m_center_y_pix) + lty;
const float u = isc * (x - this->m_center_x_pix) + ltx;
const float v = isc * (y - m_center_y_pix) + lty;
const float u = isc * (x - m_center_x_pix) + ltx;
this->m_inputProgram->readSampled(col,
cs * u + ss * v + this->m_center_x_pix,
cs * v - ss * u + this->m_center_y_pix,
m_inputProgram->readSampled(col,
cs * u + ss * v + m_center_x_pix,
cs * v - ss * u + m_center_y_pix,
PixelSampler::Bilinear);
add_v4_v4(col2, col);
/* double transformations */
ltx += this->m_tx;
lty += this->m_ty;
lrot += this->m_rot;
lsc += this->m_sc;
ltx += m_tx;
lty += m_ty;
lrot += m_rot;
lsc += m_sc;
}
mul_v4_v4fl(output, col2, 1.0f / (iterations + 1));
@@ -102,14 +102,14 @@ void DirectionalBlurOperation::executeOpenCL(OpenCLDevice *device,
{
cl_kernel directionalBlurKernel = device->COM_clCreateKernel("directionalBlurKernel", nullptr);
cl_int iterations = pow(2.0f, this->m_data->iter);
cl_float2 ltxy = {{this->m_tx, this->m_ty}};
cl_float2 centerpix = {{this->m_center_x_pix, this->m_center_y_pix}};
cl_float lsc = this->m_sc;
cl_float lrot = this->m_rot;
cl_int iterations = pow(2.0f, m_data->iter);
cl_float2 ltxy = {{m_tx, m_ty}};
cl_float2 centerpix = {{m_center_x_pix, m_center_y_pix}};
cl_float lsc = m_sc;
cl_float lrot = m_rot;
device->COM_clAttachMemoryBufferToKernelParameter(
directionalBlurKernel, 0, -1, clMemToCleanUp, inputMemoryBuffers, this->m_inputProgram);
directionalBlurKernel, 0, -1, clMemToCleanUp, inputMemoryBuffers, m_inputProgram);
device->COM_clAttachOutputMemoryBufferToKernelParameter(
directionalBlurKernel, 1, clOutputBuffer);
device->COM_clAttachMemoryBufferOffsetToKernelParameter(
@@ -125,7 +125,7 @@ void DirectionalBlurOperation::executeOpenCL(OpenCLDevice *device,
void DirectionalBlurOperation::deinitExecution()
{
this->m_inputProgram = nullptr;
m_inputProgram = nullptr;
}
bool DirectionalBlurOperation::determineDependingAreaOfInterest(rcti * /*input*/,
@@ -156,7 +156,7 @@ void DirectionalBlurOperation::update_memory_buffer_partial(MemoryBuffer *output
Span<MemoryBuffer *> inputs)
{
const MemoryBuffer *input = inputs[0];
const int iterations = pow(2.0f, this->m_data->iter);
const int iterations = pow(2.0f, m_data->iter);
for (BuffersIterator<float> it = output->iterate_with({}, area); !it.is_end(); ++it) {
const int x = it.x;
const int y = it.y;
@@ -166,27 +166,27 @@ void DirectionalBlurOperation::update_memory_buffer_partial(MemoryBuffer *output
/* Blur pixel. */
/* TODO(manzanilla): Many values used on iterations can be calculated beforehand. Create a
* table on operation initialization. */
float ltx = this->m_tx;
float lty = this->m_ty;
float lsc = this->m_sc;
float lrot = this->m_rot;
float ltx = m_tx;
float lty = m_ty;
float lsc = m_sc;
float lrot = m_rot;
for (int i = 0; i < iterations; i++) {
const float cs = cosf(lrot), ss = sinf(lrot);
const float isc = 1.0f / (1.0f + lsc);
const float v = isc * (y - this->m_center_y_pix) + lty;
const float u = isc * (x - this->m_center_x_pix) + ltx;
const float v = isc * (y - m_center_y_pix) + lty;
const float u = isc * (x - m_center_x_pix) + ltx;
float color[4];
input->read_elem_bilinear(
cs * u + ss * v + this->m_center_x_pix, cs * v - ss * u + this->m_center_y_pix, color);
cs * u + ss * v + m_center_x_pix, cs * v - ss * u + m_center_y_pix, color);
add_v4_v4(color_accum, color);
/* Double transformations. */
ltx += this->m_tx;
lty += this->m_ty;
lrot += this->m_rot;
lsc += this->m_sc;
ltx += m_tx;
lty += m_ty;
lrot += m_rot;
lsc += m_sc;
}
mul_v4_v4fl(it.out, color_accum, 1.0f / (iterations + 1));

View File

@@ -56,7 +56,7 @@ class DirectionalBlurOperation : public MultiThreadedOperation, public QualitySt
void setData(NodeDBlurData *data)
{
this->m_data = data;
m_data = data;
}
void executeOpenCL(OpenCLDevice *device,

View File

@@ -29,12 +29,12 @@ DisplaceOperation::DisplaceOperation()
this->addOutputSocket(DataType::Color);
this->flags.complex = true;
this->m_inputColorProgram = nullptr;
m_inputColorProgram = nullptr;
}
void DisplaceOperation::initExecution()
{
this->m_inputColorProgram = this->getInputSocketReader(0);
m_inputColorProgram = this->getInputSocketReader(0);
NodeOperation *vector = this->getInputSocketReader(1);
NodeOperation *scale_x = this->getInputSocketReader(2);
NodeOperation *scale_y = this->getInputSocketReader(3);
@@ -50,8 +50,8 @@ void DisplaceOperation::initExecution()
};
}
this->m_width_x4 = this->getWidth() * 4;
this->m_height_x4 = this->getHeight() * 4;
m_width_x4 = this->getWidth() * 4;
m_height_x4 = this->getHeight() * 4;
input_vector_width_ = vector->getWidth();
input_vector_height_ = vector->getHeight();
}
@@ -66,11 +66,11 @@ void DisplaceOperation::executePixelSampled(float output[4],
pixelTransform(xy, uv, deriv);
if (is_zero_v2(deriv[0]) && is_zero_v2(deriv[1])) {
this->m_inputColorProgram->readSampled(output, uv[0], uv[1], PixelSampler::Bilinear);
m_inputColorProgram->readSampled(output, uv[0], uv[1], PixelSampler::Bilinear);
}
else {
/* EWA filtering (without nearest it gets blurry with NO distortion) */
this->m_inputColorProgram->readFiltered(output, uv[0], uv[1], deriv[0], deriv[1]);
m_inputColorProgram->readFiltered(output, uv[0], uv[1], deriv[0], deriv[1]);
}
}
@@ -153,7 +153,7 @@ void DisplaceOperation::pixelTransform(const float xy[2], float r_uv[2], float r
void DisplaceOperation::deinitExecution()
{
this->m_inputColorProgram = nullptr;
m_inputColorProgram = nullptr;
vector_read_fn_ = nullptr;
scale_x_read_fn_ = nullptr;
scale_y_read_fn_ = nullptr;

View File

@@ -28,21 +28,21 @@ DisplaceSimpleOperation::DisplaceSimpleOperation()
this->addInputSocket(DataType::Value);
this->addOutputSocket(DataType::Color);
this->m_inputColorProgram = nullptr;
this->m_inputVectorProgram = nullptr;
this->m_inputScaleXProgram = nullptr;
this->m_inputScaleYProgram = nullptr;
m_inputColorProgram = nullptr;
m_inputVectorProgram = nullptr;
m_inputScaleXProgram = nullptr;
m_inputScaleYProgram = nullptr;
}
void DisplaceSimpleOperation::initExecution()
{
this->m_inputColorProgram = this->getInputSocketReader(0);
this->m_inputVectorProgram = this->getInputSocketReader(1);
this->m_inputScaleXProgram = this->getInputSocketReader(2);
this->m_inputScaleYProgram = this->getInputSocketReader(3);
m_inputColorProgram = this->getInputSocketReader(0);
m_inputVectorProgram = this->getInputSocketReader(1);
m_inputScaleXProgram = this->getInputSocketReader(2);
m_inputScaleYProgram = this->getInputSocketReader(3);
this->m_width_x4 = this->getWidth() * 4;
this->m_height_x4 = this->getHeight() * 4;
m_width_x4 = this->getWidth() * 4;
m_height_x4 = this->getHeight() * 4;
}
/* minimum distance (in pixels) a pixel has to be displaced
@@ -60,17 +60,17 @@ void DisplaceSimpleOperation::executePixelSampled(float output[4],
float p_dx, p_dy; /* main displacement in pixel space */
float u, v;
this->m_inputScaleXProgram->readSampled(inScale, x, y, sampler);
m_inputScaleXProgram->readSampled(inScale, x, y, sampler);
float xs = inScale[0];
this->m_inputScaleYProgram->readSampled(inScale, x, y, sampler);
m_inputScaleYProgram->readSampled(inScale, x, y, sampler);
float ys = inScale[0];
/* clamp x and y displacement to triple image resolution -
* to prevent hangs from huge values mistakenly plugged in eg. z buffers */
CLAMP(xs, -this->m_width_x4, this->m_width_x4);
CLAMP(ys, -this->m_height_x4, this->m_height_x4);
CLAMP(xs, -m_width_x4, m_width_x4);
CLAMP(ys, -m_height_x4, m_height_x4);
this->m_inputVectorProgram->readSampled(inVector, x, y, sampler);
m_inputVectorProgram->readSampled(inVector, x, y, sampler);
p_dx = inVector[0] * xs;
p_dy = inVector[1] * ys;
@@ -81,15 +81,15 @@ void DisplaceSimpleOperation::executePixelSampled(float output[4],
CLAMP(u, 0.0f, this->getWidth() - 1.0f);
CLAMP(v, 0.0f, this->getHeight() - 1.0f);
this->m_inputColorProgram->readSampled(output, u, v, sampler);
m_inputColorProgram->readSampled(output, u, v, sampler);
}
void DisplaceSimpleOperation::deinitExecution()
{
this->m_inputColorProgram = nullptr;
this->m_inputVectorProgram = nullptr;
this->m_inputScaleXProgram = nullptr;
this->m_inputScaleYProgram = nullptr;
m_inputColorProgram = nullptr;
m_inputVectorProgram = nullptr;
m_inputScaleXProgram = nullptr;
m_inputScaleYProgram = nullptr;
}
bool DisplaceSimpleOperation::determineDependingAreaOfInterest(rcti *input,

View File

@@ -26,21 +26,21 @@ DistanceRGBMatteOperation::DistanceRGBMatteOperation()
this->addInputSocket(DataType::Color);
this->addOutputSocket(DataType::Value);
this->m_inputImageProgram = nullptr;
this->m_inputKeyProgram = nullptr;
m_inputImageProgram = nullptr;
m_inputKeyProgram = nullptr;
flags.can_be_constant = true;
}
void DistanceRGBMatteOperation::initExecution()
{
this->m_inputImageProgram = this->getInputSocketReader(0);
this->m_inputKeyProgram = this->getInputSocketReader(1);
m_inputImageProgram = this->getInputSocketReader(0);
m_inputKeyProgram = this->getInputSocketReader(1);
}
void DistanceRGBMatteOperation::deinitExecution()
{
this->m_inputImageProgram = nullptr;
this->m_inputKeyProgram = nullptr;
m_inputImageProgram = nullptr;
m_inputKeyProgram = nullptr;
}
float DistanceRGBMatteOperation::calculateDistance(const float key[4], const float image[4])
@@ -56,14 +56,14 @@ void DistanceRGBMatteOperation::executePixelSampled(float output[4],
float inKey[4];
float inImage[4];
const float tolerance = this->m_settings->t1;
const float falloff = this->m_settings->t2;
const float tolerance = m_settings->t1;
const float falloff = m_settings->t2;
float distance;
float alpha;
this->m_inputKeyProgram->readSampled(inKey, x, y, sampler);
this->m_inputImageProgram->readSampled(inImage, x, y, sampler);
m_inputKeyProgram->readSampled(inKey, x, y, sampler);
m_inputImageProgram->readSampled(inImage, x, y, sampler);
distance = this->calculateDistance(inKey, inImage);
@@ -102,8 +102,8 @@ void DistanceRGBMatteOperation::update_memory_buffer_partial(MemoryBuffer *outpu
const float *in_key = it.in(1);
float distance = this->calculateDistance(in_key, in_image);
const float tolerance = this->m_settings->t1;
const float falloff = this->m_settings->t2;
const float tolerance = m_settings->t1;
const float falloff = m_settings->t2;
/* Store matte(alpha) value in [0] to go with
* COM_SetAlphaMultiplyOperation and the Value output.

View File

@@ -50,7 +50,7 @@ class DistanceRGBMatteOperation : public MultiThreadedOperation {
void setSettings(NodeChroma *nodeChroma)
{
this->m_settings = nodeChroma;
m_settings = nodeChroma;
}
void update_memory_buffer_partial(MemoryBuffer *output,

View File

@@ -26,20 +26,20 @@ DotproductOperation::DotproductOperation()
this->addInputSocket(DataType::Vector);
this->addOutputSocket(DataType::Value);
this->set_canvas_input_index(0);
this->m_input1Operation = nullptr;
this->m_input2Operation = nullptr;
m_input1Operation = nullptr;
m_input2Operation = nullptr;
flags.can_be_constant = true;
}
void DotproductOperation::initExecution()
{
this->m_input1Operation = this->getInputSocketReader(0);
this->m_input2Operation = this->getInputSocketReader(1);
m_input1Operation = this->getInputSocketReader(0);
m_input2Operation = this->getInputSocketReader(1);
}
void DotproductOperation::deinitExecution()
{
this->m_input1Operation = nullptr;
this->m_input2Operation = nullptr;
m_input1Operation = nullptr;
m_input2Operation = nullptr;
}
/** \todo current implementation is the inverse of a dot-product. not 'logically' correct
@@ -51,8 +51,8 @@ void DotproductOperation::executePixelSampled(float output[4],
{
float input1[4];
float input2[4];
this->m_input1Operation->readSampled(input1, x, y, sampler);
this->m_input2Operation->readSampled(input2, x, y, sampler);
m_input1Operation->readSampled(input1, x, y, sampler);
m_input2Operation->readSampled(input2, x, y, sampler);
output[0] = -(input1[0] * input2[0] + input1[1] * input2[1] + input1[2] * input2[2]);
}

View File

@@ -1267,8 +1267,8 @@ void DoubleEdgeMaskOperation::doDoubleEdgeMask(float *imask, float *omask, float
*
* Each version has slightly different criteria for detecting an edge pixel.
*/
if (this->m_adjacentOnly) { /* If "adjacent only" inner edge mode is turned on. */
if (this->m_keepInside) { /* If "keep inside" buffer edge mode is turned on. */
if (m_adjacentOnly) { /* If "adjacent only" inner edge mode is turned on. */
if (m_keepInside) { /* If "keep inside" buffer edge mode is turned on. */
do_adjacentKeepBorders(t, rw, limask, lomask, lres, res, rsize);
}
else { /* "bleed out" buffer edge mode is turned on. */
@@ -1282,7 +1282,7 @@ void DoubleEdgeMaskOperation::doDoubleEdgeMask(float *imask, float *omask, float
do_adjacentEdgeDetection(t, rw, limask, lomask, lres, res, rsize, isz, osz, gsz);
}
else { /* "all" inner edge mode is turned on. */
if (this->m_keepInside) { /* If "keep inside" buffer edge mode is turned on. */
if (m_keepInside) { /* If "keep inside" buffer edge mode is turned on. */
do_allKeepBorders(t, rw, limask, lomask, lres, res, rsize);
}
else { /* "bleed out" buffer edge mode is turned on. */
@@ -1322,10 +1322,10 @@ DoubleEdgeMaskOperation::DoubleEdgeMaskOperation()
this->addInputSocket(DataType::Value);
this->addInputSocket(DataType::Value);
this->addOutputSocket(DataType::Value);
this->m_inputInnerMask = nullptr;
this->m_inputOuterMask = nullptr;
this->m_adjacentOnly = false;
this->m_keepInside = false;
m_inputInnerMask = nullptr;
m_inputOuterMask = nullptr;
m_adjacentOnly = false;
m_keepInside = false;
this->flags.complex = true;
is_output_rendered_ = false;
}
@@ -1334,7 +1334,7 @@ bool DoubleEdgeMaskOperation::determineDependingAreaOfInterest(rcti * /*input*/,
ReadBufferOperation *readOperation,
rcti *output)
{
if (this->m_cachedInstance == nullptr) {
if (m_cachedInstance == nullptr) {
rcti newInput;
newInput.xmax = this->getWidth();
newInput.xmin = 0;
@@ -1348,31 +1348,31 @@ bool DoubleEdgeMaskOperation::determineDependingAreaOfInterest(rcti * /*input*/,
void DoubleEdgeMaskOperation::initExecution()
{
this->m_inputInnerMask = this->getInputSocketReader(0);
this->m_inputOuterMask = this->getInputSocketReader(1);
m_inputInnerMask = this->getInputSocketReader(0);
m_inputOuterMask = this->getInputSocketReader(1);
initMutex();
this->m_cachedInstance = nullptr;
m_cachedInstance = nullptr;
}
void *DoubleEdgeMaskOperation::initializeTileData(rcti *rect)
{
if (this->m_cachedInstance) {
return this->m_cachedInstance;
if (m_cachedInstance) {
return m_cachedInstance;
}
lockMutex();
if (this->m_cachedInstance == nullptr) {
MemoryBuffer *innerMask = (MemoryBuffer *)this->m_inputInnerMask->initializeTileData(rect);
MemoryBuffer *outerMask = (MemoryBuffer *)this->m_inputOuterMask->initializeTileData(rect);
if (m_cachedInstance == nullptr) {
MemoryBuffer *innerMask = (MemoryBuffer *)m_inputInnerMask->initializeTileData(rect);
MemoryBuffer *outerMask = (MemoryBuffer *)m_inputOuterMask->initializeTileData(rect);
float *data = (float *)MEM_mallocN(sizeof(float) * this->getWidth() * this->getHeight(),
__func__);
float *imask = innerMask->getBuffer();
float *omask = outerMask->getBuffer();
doDoubleEdgeMask(imask, omask, data);
this->m_cachedInstance = data;
m_cachedInstance = data;
}
unlockMutex();
return this->m_cachedInstance;
return m_cachedInstance;
}
void DoubleEdgeMaskOperation::executePixel(float output[4], int x, int y, void *data)
{
@@ -1383,12 +1383,12 @@ void DoubleEdgeMaskOperation::executePixel(float output[4], int x, int y, void *
void DoubleEdgeMaskOperation::deinitExecution()
{
this->m_inputInnerMask = nullptr;
this->m_inputOuterMask = nullptr;
m_inputInnerMask = nullptr;
m_inputOuterMask = nullptr;
deinitMutex();
if (this->m_cachedInstance) {
MEM_freeN(this->m_cachedInstance);
this->m_cachedInstance = nullptr;
if (m_cachedInstance) {
MEM_freeN(m_cachedInstance);
m_cachedInstance = nullptr;
}
}

View File

@@ -64,11 +64,11 @@ class DoubleEdgeMaskOperation : public NodeOperation {
void setAdjecentOnly(bool adjacentOnly)
{
this->m_adjacentOnly = adjacentOnly;
m_adjacentOnly = adjacentOnly;
}
void setKeepInside(bool keepInside)
{
this->m_keepInside = keepInside;
m_keepInside = keepInside;
}
void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override;

View File

@@ -25,19 +25,19 @@ EllipseMaskOperation::EllipseMaskOperation()
this->addInputSocket(DataType::Value);
this->addInputSocket(DataType::Value);
this->addOutputSocket(DataType::Value);
this->m_inputMask = nullptr;
this->m_inputValue = nullptr;
this->m_cosine = 0.0f;
this->m_sine = 0.0f;
m_inputMask = nullptr;
m_inputValue = nullptr;
m_cosine = 0.0f;
m_sine = 0.0f;
}
void EllipseMaskOperation::initExecution()
{
this->m_inputMask = this->getInputSocketReader(0);
this->m_inputValue = this->getInputSocketReader(1);
const double rad = (double)this->m_data->rotation;
this->m_cosine = cos(rad);
this->m_sine = sin(rad);
this->m_aspectRatio = ((float)this->getWidth()) / this->getHeight();
m_inputMask = this->getInputSocketReader(0);
m_inputValue = this->getInputSocketReader(1);
const double rad = (double)m_data->rotation;
m_cosine = cos(rad);
m_sine = sin(rad);
m_aspectRatio = ((float)this->getWidth()) / this->getHeight();
}
void EllipseMaskOperation::executePixelSampled(float output[4],
@@ -51,26 +51,26 @@ void EllipseMaskOperation::executePixelSampled(float output[4],
float rx = x / this->getWidth();
float ry = y / this->getHeight();
const float dy = (ry - this->m_data->y) / this->m_aspectRatio;
const float dx = rx - this->m_data->x;
rx = this->m_data->x + (this->m_cosine * dx + this->m_sine * dy);
ry = this->m_data->y + (-this->m_sine * dx + this->m_cosine * dy);
const float dy = (ry - m_data->y) / m_aspectRatio;
const float dx = rx - m_data->x;
rx = m_data->x + (m_cosine * dx + m_sine * dy);
ry = m_data->y + (-m_sine * dx + m_cosine * dy);
this->m_inputMask->readSampled(inputMask, x, y, sampler);
this->m_inputValue->readSampled(inputValue, x, y, sampler);
m_inputMask->readSampled(inputMask, x, y, sampler);
m_inputValue->readSampled(inputValue, x, y, sampler);
const float halfHeight = (this->m_data->height) / 2.0f;
const float halfWidth = this->m_data->width / 2.0f;
float sx = rx - this->m_data->x;
const float halfHeight = (m_data->height) / 2.0f;
const float halfWidth = m_data->width / 2.0f;
float sx = rx - m_data->x;
sx *= sx;
const float tx = halfWidth * halfWidth;
float sy = ry - this->m_data->y;
float sy = ry - m_data->y;
sy *= sy;
const float ty = halfHeight * halfHeight;
bool inside = ((sx / tx) + (sy / ty)) < 1.0f;
switch (this->m_maskType) {
switch (m_maskType) {
case CMP_NODE_MASKTYPE_ADD:
if (inside) {
output[0] = MAX2(inputMask[0], inputValue[0]);
@@ -154,24 +154,24 @@ void EllipseMaskOperation::apply_mask(MemoryBuffer *output,
const MemoryBuffer *input_value = inputs[1];
const float op_w = this->getWidth();
const float op_h = this->getHeight();
const float half_w = this->m_data->width / 2.0f;
const float half_h = this->m_data->height / 2.0f;
const float half_w = m_data->width / 2.0f;
const float half_h = m_data->height / 2.0f;
const float tx = half_w * half_w;
const float ty = half_h * half_h;
for (int y = area.ymin; y < area.ymax; y++) {
const float op_ry = y / op_h;
const float dy = (op_ry - this->m_data->y) / m_aspectRatio;
const float dy = (op_ry - m_data->y) / m_aspectRatio;
float *out = output->get_elem(area.xmin, y);
const float *mask = input_mask->get_elem(area.xmin, y);
const float *value = input_value->get_elem(area.xmin, y);
for (int x = area.xmin; x < area.xmax; x++) {
const float op_rx = x / op_w;
const float dx = op_rx - this->m_data->x;
const float rx = this->m_data->x + (m_cosine * dx + m_sine * dy);
const float ry = this->m_data->y + (-m_sine * dx + m_cosine * dy);
float sx = rx - this->m_data->x;
const float dx = op_rx - m_data->x;
const float rx = m_data->x + (m_cosine * dx + m_sine * dy);
const float ry = m_data->y + (-m_sine * dx + m_cosine * dy);
float sx = rx - m_data->x;
sx *= sx;
float sy = ry - this->m_data->y;
float sy = ry - m_data->y;
sy *= sy;
const bool inside = ((sx / tx) + (sy / ty)) < 1.0f;
out[0] = mask_func(inside, mask, value);
@@ -185,8 +185,8 @@ void EllipseMaskOperation::apply_mask(MemoryBuffer *output,
void EllipseMaskOperation::deinitExecution()
{
this->m_inputMask = nullptr;
this->m_inputValue = nullptr;
m_inputMask = nullptr;
m_inputValue = nullptr;
}
} // namespace blender::compositor

View File

@@ -59,12 +59,12 @@ class EllipseMaskOperation : public MultiThreadedOperation {
void setData(NodeEllipseMask *data)
{
this->m_data = data;
m_data = data;
}
void setMaskType(int maskType)
{
this->m_maskType = maskType;
m_maskType = maskType;
}
void update_memory_buffer_partial(MemoryBuffer *output,

View File

@@ -24,7 +24,7 @@ namespace blender::compositor {
FastGaussianBlurOperation::FastGaussianBlurOperation() : BlurBaseOperation(DataType::Color)
{
this->m_iirgaus = nullptr;
m_iirgaus = nullptr;
}
void FastGaussianBlurOperation::executePixel(float output[4], int x, int y, void *data)
@@ -48,7 +48,7 @@ bool FastGaussianBlurOperation::determineDependingAreaOfInterest(
return true;
}
if (this->m_iirgaus) {
if (m_iirgaus) {
return false;
}
@@ -63,8 +63,8 @@ bool FastGaussianBlurOperation::determineDependingAreaOfInterest(
void FastGaussianBlurOperation::init_data()
{
BlurBaseOperation::init_data();
this->m_sx = this->m_data.sizex * this->m_size / 2.0f;
this->m_sy = this->m_data.sizey * this->m_size / 2.0f;
m_sx = m_data.sizex * m_size / 2.0f;
m_sy = m_data.sizey * m_size / 2.0f;
}
void FastGaussianBlurOperation::initExecution()
@@ -75,9 +75,9 @@ void FastGaussianBlurOperation::initExecution()
void FastGaussianBlurOperation::deinitExecution()
{
if (this->m_iirgaus) {
delete this->m_iirgaus;
this->m_iirgaus = nullptr;
if (m_iirgaus) {
delete m_iirgaus;
m_iirgaus = nullptr;
}
BlurBaseOperation::deinitMutex();
}
@@ -85,36 +85,36 @@ void FastGaussianBlurOperation::deinitExecution()
void *FastGaussianBlurOperation::initializeTileData(rcti *rect)
{
lockMutex();
if (!this->m_iirgaus) {
MemoryBuffer *newBuf = (MemoryBuffer *)this->m_inputProgram->initializeTileData(rect);
if (!m_iirgaus) {
MemoryBuffer *newBuf = (MemoryBuffer *)m_inputProgram->initializeTileData(rect);
MemoryBuffer *copy = new MemoryBuffer(*newBuf);
updateSize();
int c;
this->m_sx = this->m_data.sizex * this->m_size / 2.0f;
this->m_sy = this->m_data.sizey * this->m_size / 2.0f;
m_sx = m_data.sizex * m_size / 2.0f;
m_sy = m_data.sizey * m_size / 2.0f;
if ((this->m_sx == this->m_sy) && (this->m_sx > 0.0f)) {
if ((m_sx == m_sy) && (m_sx > 0.0f)) {
for (c = 0; c < COM_DATA_TYPE_COLOR_CHANNELS; c++) {
IIR_gauss(copy, this->m_sx, c, 3);
IIR_gauss(copy, m_sx, c, 3);
}
}
else {
if (this->m_sx > 0.0f) {
if (m_sx > 0.0f) {
for (c = 0; c < COM_DATA_TYPE_COLOR_CHANNELS; c++) {
IIR_gauss(copy, this->m_sx, c, 1);
IIR_gauss(copy, m_sx, c, 1);
}
}
if (this->m_sy > 0.0f) {
if (m_sy > 0.0f) {
for (c = 0; c < COM_DATA_TYPE_COLOR_CHANNELS; c++) {
IIR_gauss(copy, this->m_sy, c, 2);
IIR_gauss(copy, m_sy, c, 2);
}
}
}
this->m_iirgaus = copy;
m_iirgaus = copy;
}
unlockMutex();
return this->m_iirgaus;
return m_iirgaus;
}
void FastGaussianBlurOperation::IIR_gauss(MemoryBuffer *src,
@@ -294,20 +294,20 @@ void FastGaussianBlurOperation::update_memory_buffer_started(MemoryBuffer *outpu
}
image->copy_from(input, area);
if ((this->m_sx == this->m_sy) && (this->m_sx > 0.0f)) {
if ((m_sx == m_sy) && (m_sx > 0.0f)) {
for (const int c : IndexRange(COM_DATA_TYPE_COLOR_CHANNELS)) {
IIR_gauss(image, this->m_sx, c, 3);
IIR_gauss(image, m_sx, c, 3);
}
}
else {
if (this->m_sx > 0.0f) {
if (m_sx > 0.0f) {
for (const int c : IndexRange(COM_DATA_TYPE_COLOR_CHANNELS)) {
IIR_gauss(image, this->m_sx, c, 1);
IIR_gauss(image, m_sx, c, 1);
}
}
if (this->m_sy > 0.0f) {
if (m_sy > 0.0f) {
for (const int c : IndexRange(COM_DATA_TYPE_COLOR_CHANNELS)) {
IIR_gauss(image, this->m_sy, c, 2);
IIR_gauss(image, m_sy, c, 2);
}
}
}
@@ -322,10 +322,10 @@ FastGaussianBlurValueOperation::FastGaussianBlurValueOperation()
{
this->addInputSocket(DataType::Value);
this->addOutputSocket(DataType::Value);
this->m_iirgaus = nullptr;
this->m_inputprogram = nullptr;
this->m_sigma = 1.0f;
this->m_overlay = 0;
m_iirgaus = nullptr;
m_inputprogram = nullptr;
m_sigma = 1.0f;
m_overlay = 0;
flags.complex = true;
}
@@ -340,7 +340,7 @@ bool FastGaussianBlurValueOperation::determineDependingAreaOfInterest(
{
rcti newInput;
if (this->m_iirgaus) {
if (m_iirgaus) {
return false;
}
@@ -354,15 +354,15 @@ bool FastGaussianBlurValueOperation::determineDependingAreaOfInterest(
void FastGaussianBlurValueOperation::initExecution()
{
this->m_inputprogram = getInputSocketReader(0);
m_inputprogram = getInputSocketReader(0);
initMutex();
}
void FastGaussianBlurValueOperation::deinitExecution()
{
if (this->m_iirgaus) {
delete this->m_iirgaus;
this->m_iirgaus = nullptr;
if (m_iirgaus) {
delete m_iirgaus;
m_iirgaus = nullptr;
}
deinitMutex();
}
@@ -370,12 +370,12 @@ void FastGaussianBlurValueOperation::deinitExecution()
void *FastGaussianBlurValueOperation::initializeTileData(rcti *rect)
{
lockMutex();
if (!this->m_iirgaus) {
MemoryBuffer *newBuf = (MemoryBuffer *)this->m_inputprogram->initializeTileData(rect);
if (!m_iirgaus) {
MemoryBuffer *newBuf = (MemoryBuffer *)m_inputprogram->initializeTileData(rect);
MemoryBuffer *copy = new MemoryBuffer(*newBuf);
FastGaussianBlurOperation::IIR_gauss(copy, this->m_sigma, 0, 3);
FastGaussianBlurOperation::IIR_gauss(copy, m_sigma, 0, 3);
if (this->m_overlay == FAST_GAUSS_OVERLAY_MIN) {
if (m_overlay == FAST_GAUSS_OVERLAY_MIN) {
float *src = newBuf->getBuffer();
float *dst = copy->getBuffer();
for (int i = copy->getWidth() * copy->getHeight(); i != 0;
@@ -385,7 +385,7 @@ void *FastGaussianBlurValueOperation::initializeTileData(rcti *rect)
}
}
}
else if (this->m_overlay == FAST_GAUSS_OVERLAY_MAX) {
else if (m_overlay == FAST_GAUSS_OVERLAY_MAX) {
float *src = newBuf->getBuffer();
float *dst = copy->getBuffer();
for (int i = copy->getWidth() * copy->getHeight(); i != 0;
@@ -396,10 +396,10 @@ void *FastGaussianBlurValueOperation::initializeTileData(rcti *rect)
}
}
this->m_iirgaus = copy;
m_iirgaus = copy;
}
unlockMutex();
return this->m_iirgaus;
return m_iirgaus;
}
void FastGaussianBlurValueOperation::get_area_of_interest(const int UNUSED(input_idx),
@@ -427,12 +427,12 @@ void FastGaussianBlurValueOperation::update_memory_buffer_partial(MemoryBuffer *
{
MemoryBuffer *image = inputs[0];
BuffersIterator<float> it = output->iterate_with({image, m_iirgaus}, area);
if (this->m_overlay == FAST_GAUSS_OVERLAY_MIN) {
if (m_overlay == FAST_GAUSS_OVERLAY_MIN) {
for (; !it.is_end(); ++it) {
*it.out = MIN2(*it.in(0), *it.in(1));
}
}
else if (this->m_overlay == FAST_GAUSS_OVERLAY_MAX) {
else if (m_overlay == FAST_GAUSS_OVERLAY_MAX) {
for (; !it.is_end(); ++it) {
*it.out = MAX2(*it.in(0), *it.in(1));
}

View File

@@ -83,13 +83,13 @@ class FastGaussianBlurValueOperation : public MultiThreadedOperation {
void initExecution() override;
void setSigma(float sigma)
{
this->m_sigma = sigma;
m_sigma = sigma;
}
/* used for DOF blurring ZBuffer */
void setOverlay(int overlay)
{
this->m_overlay = overlay;
m_overlay = overlay;
}
void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override;

View File

@@ -25,26 +25,26 @@ FlipOperation::FlipOperation()
this->addInputSocket(DataType::Color, ResizeMode::None);
this->addOutputSocket(DataType::Color);
this->set_canvas_input_index(0);
this->m_inputOperation = nullptr;
this->m_flipX = true;
this->m_flipY = false;
m_inputOperation = nullptr;
m_flipX = true;
m_flipY = false;
}
void FlipOperation::initExecution()
{
this->m_inputOperation = this->getInputSocketReader(0);
m_inputOperation = this->getInputSocketReader(0);
}
void FlipOperation::deinitExecution()
{
this->m_inputOperation = nullptr;
m_inputOperation = nullptr;
}
void FlipOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler)
{
float nx = this->m_flipX ? ((int)this->getWidth() - 1) - x : x;
float ny = this->m_flipY ? ((int)this->getHeight() - 1) - y : y;
float nx = m_flipX ? ((int)this->getWidth() - 1) - x : x;
float ny = m_flipY ? ((int)this->getHeight() - 1) - y : y;
this->m_inputOperation->readSampled(output, nx, ny, sampler);
m_inputOperation->readSampled(output, nx, ny, sampler);
}
bool FlipOperation::determineDependingAreaOfInterest(rcti *input,
@@ -53,7 +53,7 @@ bool FlipOperation::determineDependingAreaOfInterest(rcti *input,
{
rcti newInput;
if (this->m_flipX) {
if (m_flipX) {
const int w = (int)this->getWidth() - 1;
newInput.xmax = (w - input->xmin) + 1;
newInput.xmin = (w - input->xmax) - 1;
@@ -62,7 +62,7 @@ bool FlipOperation::determineDependingAreaOfInterest(rcti *input,
newInput.xmin = input->xmin;
newInput.xmax = input->xmax;
}
if (this->m_flipY) {
if (m_flipY) {
const int h = (int)this->getHeight() - 1;
newInput.ymax = (h - input->ymin) + 1;
newInput.ymin = (h - input->ymax) - 1;
@@ -99,7 +99,7 @@ void FlipOperation::get_area_of_interest(const int input_idx,
{
BLI_assert(input_idx == 0);
UNUSED_VARS_NDEBUG(input_idx);
if (this->m_flipX) {
if (m_flipX) {
const int w = (int)this->getWidth() - 1;
r_input_area.xmax = (w - output_area.xmin) + 1;
r_input_area.xmin = (w - output_area.xmax) + 1;
@@ -108,7 +108,7 @@ void FlipOperation::get_area_of_interest(const int input_idx,
r_input_area.xmin = output_area.xmin;
r_input_area.xmax = output_area.xmax;
}
if (this->m_flipY) {
if (m_flipY) {
const int h = (int)this->getHeight() - 1;
r_input_area.ymax = (h - output_area.ymin) + 1;
r_input_area.ymin = (h - output_area.ymax) + 1;
@@ -127,8 +127,8 @@ void FlipOperation::update_memory_buffer_partial(MemoryBuffer *output,
const int input_offset_x = input_img->get_rect().xmin;
const int input_offset_y = input_img->get_rect().ymin;
for (BuffersIterator<float> it = output->iterate_with({}, area); !it.is_end(); ++it) {
const int nx = this->m_flipX ? ((int)this->getWidth() - 1) - it.x : it.x;
const int ny = this->m_flipY ? ((int)this->getHeight() - 1) - it.y : it.y;
const int nx = m_flipX ? ((int)this->getWidth() - 1) - it.x : it.x;
const int ny = m_flipY ? ((int)this->getHeight() - 1) - it.y : it.y;
input_img->read_elem(input_offset_x + nx, input_offset_y + ny, it.out);
}
}

View File

@@ -39,11 +39,11 @@ class FlipOperation : public MultiThreadedOperation {
void deinitExecution() override;
void setFlipX(bool flipX)
{
this->m_flipX = flipX;
m_flipX = flipX;
}
void setFlipY(bool flipY)
{
this->m_flipY = flipY;
m_flipY = flipY;
}
void determine_canvas(const rcti &preferred_area, rcti &r_area) override;

View File

@@ -24,12 +24,12 @@ GammaCorrectOperation::GammaCorrectOperation()
{
this->addInputSocket(DataType::Color);
this->addOutputSocket(DataType::Color);
this->m_inputProgram = nullptr;
m_inputProgram = nullptr;
flags.can_be_constant = true;
}
void GammaCorrectOperation::initExecution()
{
this->m_inputProgram = this->getInputSocketReader(0);
m_inputProgram = this->getInputSocketReader(0);
}
void GammaCorrectOperation::executePixelSampled(float output[4],
@@ -38,7 +38,7 @@ void GammaCorrectOperation::executePixelSampled(float output[4],
PixelSampler sampler)
{
float inputColor[4];
this->m_inputProgram->readSampled(inputColor, x, y, sampler);
m_inputProgram->readSampled(inputColor, x, y, sampler);
if (inputColor[3] > 0.0f) {
inputColor[0] /= inputColor[3];
inputColor[1] /= inputColor[3];
@@ -88,19 +88,19 @@ void GammaCorrectOperation::update_memory_buffer_partial(MemoryBuffer *output,
void GammaCorrectOperation::deinitExecution()
{
this->m_inputProgram = nullptr;
m_inputProgram = nullptr;
}
GammaUncorrectOperation::GammaUncorrectOperation()
{
this->addInputSocket(DataType::Color);
this->addOutputSocket(DataType::Color);
this->m_inputProgram = nullptr;
m_inputProgram = nullptr;
flags.can_be_constant = true;
}
void GammaUncorrectOperation::initExecution()
{
this->m_inputProgram = this->getInputSocketReader(0);
m_inputProgram = this->getInputSocketReader(0);
}
void GammaUncorrectOperation::executePixelSampled(float output[4],
@@ -109,7 +109,7 @@ void GammaUncorrectOperation::executePixelSampled(float output[4],
PixelSampler sampler)
{
float inputColor[4];
this->m_inputProgram->readSampled(inputColor, x, y, sampler);
m_inputProgram->readSampled(inputColor, x, y, sampler);
if (inputColor[3] > 0.0f) {
inputColor[0] /= inputColor[3];
@@ -158,7 +158,7 @@ void GammaUncorrectOperation::update_memory_buffer_partial(MemoryBuffer *output,
void GammaUncorrectOperation::deinitExecution()
{
this->m_inputProgram = nullptr;
m_inputProgram = nullptr;
}
} // namespace blender::compositor

View File

@@ -25,14 +25,14 @@ GammaOperation::GammaOperation()
this->addInputSocket(DataType::Color);
this->addInputSocket(DataType::Value);
this->addOutputSocket(DataType::Color);
this->m_inputProgram = nullptr;
this->m_inputGammaProgram = nullptr;
m_inputProgram = nullptr;
m_inputGammaProgram = nullptr;
flags.can_be_constant = true;
}
void GammaOperation::initExecution()
{
this->m_inputProgram = this->getInputSocketReader(0);
this->m_inputGammaProgram = this->getInputSocketReader(1);
m_inputProgram = this->getInputSocketReader(0);
m_inputGammaProgram = this->getInputSocketReader(1);
}
void GammaOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler)
@@ -40,8 +40,8 @@ void GammaOperation::executePixelSampled(float output[4], float x, float y, Pixe
float inputValue[4];
float inputGamma[4];
this->m_inputProgram->readSampled(inputValue, x, y, sampler);
this->m_inputGammaProgram->readSampled(inputGamma, x, y, sampler);
m_inputProgram->readSampled(inputValue, x, y, sampler);
m_inputGammaProgram->readSampled(inputGamma, x, y, sampler);
const float gamma = inputGamma[0];
/* check for negative to avoid nan's */
output[0] = inputValue[0] > 0.0f ? powf(inputValue[0], gamma) : inputValue[0];
@@ -67,8 +67,8 @@ void GammaOperation::update_memory_buffer_row(PixelCursor &p)
void GammaOperation::deinitExecution()
{
this->m_inputProgram = nullptr;
this->m_inputGammaProgram = nullptr;
m_inputProgram = nullptr;
m_inputGammaProgram = nullptr;
}
} // namespace blender::compositor

View File

@@ -23,9 +23,9 @@ namespace blender::compositor {
GaussianAlphaBlurBaseOperation::GaussianAlphaBlurBaseOperation(eDimension dim)
: BlurBaseOperation(DataType::Value)
{
this->m_gausstab = nullptr;
this->m_filtersize = 0;
this->m_falloff = -1; /* Intentionally invalid, so we can detect uninitialized values. */
m_gausstab = nullptr;
m_filtersize = 0;
m_falloff = -1; /* Intentionally invalid, so we can detect uninitialized values. */
dimension_ = dim;
}
@@ -52,14 +52,14 @@ void GaussianAlphaBlurBaseOperation::deinitExecution()
{
BlurBaseOperation::deinitExecution();
if (this->m_gausstab) {
MEM_freeN(this->m_gausstab);
this->m_gausstab = nullptr;
if (m_gausstab) {
MEM_freeN(m_gausstab);
m_gausstab = nullptr;
}
if (this->m_distbuf_inv) {
MEM_freeN(this->m_distbuf_inv);
this->m_distbuf_inv = nullptr;
if (m_distbuf_inv) {
MEM_freeN(m_distbuf_inv);
m_distbuf_inv = nullptr;
}
}

View File

@@ -51,11 +51,11 @@ class GaussianAlphaBlurBaseOperation : public BlurBaseOperation {
*/
void setSubtract(bool subtract)
{
this->m_do_subtract = subtract;
m_do_subtract = subtract;
}
void setFalloff(int falloff)
{
this->m_falloff = falloff;
m_falloff = falloff;
}
};

View File

@@ -28,7 +28,7 @@ GaussianAlphaXBlurOperation::GaussianAlphaXBlurOperation()
void *GaussianAlphaXBlurOperation::initializeTileData(rcti * /*rect*/)
{
lockMutex();
if (!this->m_sizeavailable) {
if (!m_sizeavailable) {
updateGauss();
}
void *buffer = getInputOperation(0)->initializeTileData(nullptr);
@@ -42,7 +42,7 @@ void GaussianAlphaXBlurOperation::initExecution()
initMutex();
if (this->m_sizeavailable && execution_model_ == eExecutionModel::Tiled) {
if (m_sizeavailable && execution_model_ == eExecutionModel::Tiled) {
float rad = max_ff(m_size * m_data.sizex, 0.0f);
m_filtersize = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS);
@@ -53,7 +53,7 @@ void GaussianAlphaXBlurOperation::initExecution()
void GaussianAlphaXBlurOperation::updateGauss()
{
if (this->m_gausstab == nullptr) {
if (m_gausstab == nullptr) {
updateSize();
float rad = max_ff(m_size * m_data.sizex, 0.0f);
m_filtersize = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS);
@@ -61,7 +61,7 @@ void GaussianAlphaXBlurOperation::updateGauss()
m_gausstab = BlurBaseOperation::make_gausstab(rad, m_filtersize);
}
if (this->m_distbuf_inv == nullptr) {
if (m_distbuf_inv == nullptr) {
updateSize();
float rad = max_ff(m_size * m_data.sizex, 0.0f);
rad = min_ff(rad, MAX_GAUSSTAB_RADIUS);
@@ -78,7 +78,7 @@ BLI_INLINE float finv_test(const float f, const bool test)
void GaussianAlphaXBlurOperation::executePixel(float output[4], int x, int y, void *data)
{
const bool do_invert = this->m_do_subtract;
const bool do_invert = m_do_subtract;
MemoryBuffer *inputBuffer = (MemoryBuffer *)data;
float *buffer = inputBuffer->getBuffer();
int bufferwidth = inputBuffer->getWidth();
@@ -106,20 +106,20 @@ void GaussianAlphaXBlurOperation::executePixel(float output[4], int x, int y, vo
float distfacinv_max = 1.0f; /* 0 to 1 */
for (int nx = xmin; nx < xmax; nx += step) {
const int index = (nx - x) + this->m_filtersize;
const int index = (nx - x) + m_filtersize;
float value = finv_test(buffer[bufferindex], do_invert);
float multiplier;
/* gauss */
{
multiplier = this->m_gausstab[index];
multiplier = m_gausstab[index];
alpha_accum += value * multiplier;
multiplier_accum += multiplier;
}
/* dilate - find most extreme color */
if (value > value_max) {
multiplier = this->m_distbuf_inv[index];
multiplier = m_distbuf_inv[index];
value *= multiplier;
if (value > value_max) {
value_max = value;
@@ -139,14 +139,14 @@ void GaussianAlphaXBlurOperation::deinitExecution()
{
GaussianAlphaBlurBaseOperation::deinitExecution();
if (this->m_gausstab) {
MEM_freeN(this->m_gausstab);
this->m_gausstab = nullptr;
if (m_gausstab) {
MEM_freeN(m_gausstab);
m_gausstab = nullptr;
}
if (this->m_distbuf_inv) {
MEM_freeN(this->m_distbuf_inv);
this->m_distbuf_inv = nullptr;
if (m_distbuf_inv) {
MEM_freeN(m_distbuf_inv);
m_distbuf_inv = nullptr;
}
deinitMutex();
@@ -170,9 +170,9 @@ bool GaussianAlphaXBlurOperation::determineDependingAreaOfInterest(
else
#endif
{
if (this->m_sizeavailable && this->m_gausstab != nullptr) {
newInput.xmax = input->xmax + this->m_filtersize + 1;
newInput.xmin = input->xmin - this->m_filtersize - 1;
if (m_sizeavailable && m_gausstab != nullptr) {
newInput.xmax = input->xmax + m_filtersize + 1;
newInput.xmin = input->xmin - m_filtersize - 1;
newInput.ymax = input->ymax;
newInput.ymin = input->ymin;
}

View File

@@ -28,7 +28,7 @@ GaussianAlphaYBlurOperation::GaussianAlphaYBlurOperation()
void *GaussianAlphaYBlurOperation::initializeTileData(rcti * /*rect*/)
{
lockMutex();
if (!this->m_sizeavailable) {
if (!m_sizeavailable) {
updateGauss();
}
void *buffer = getInputOperation(0)->initializeTileData(nullptr);
@@ -43,7 +43,7 @@ void GaussianAlphaYBlurOperation::initExecution()
initMutex();
if (this->m_sizeavailable && execution_model_ == eExecutionModel::Tiled) {
if (m_sizeavailable && execution_model_ == eExecutionModel::Tiled) {
float rad = max_ff(m_size * m_data.sizey, 0.0f);
m_filtersize = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS);
@@ -55,7 +55,7 @@ void GaussianAlphaYBlurOperation::initExecution()
/* TODO(manzanilla): to be removed with tiled implementation. */
void GaussianAlphaYBlurOperation::updateGauss()
{
if (this->m_gausstab == nullptr) {
if (m_gausstab == nullptr) {
updateSize();
float rad = max_ff(m_size * m_data.sizey, 0.0f);
rad = min_ff(rad, MAX_GAUSSTAB_RADIUS);
@@ -64,7 +64,7 @@ void GaussianAlphaYBlurOperation::updateGauss()
m_gausstab = BlurBaseOperation::make_gausstab(rad, m_filtersize);
}
if (this->m_distbuf_inv == nullptr) {
if (m_distbuf_inv == nullptr) {
updateSize();
float rad = max_ff(m_size * m_data.sizey, 0.0f);
m_filtersize = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS);
@@ -80,7 +80,7 @@ BLI_INLINE float finv_test(const float f, const bool test)
void GaussianAlphaYBlurOperation::executePixel(float output[4], int x, int y, void *data)
{
const bool do_invert = this->m_do_subtract;
const bool do_invert = m_do_subtract;
MemoryBuffer *inputBuffer = (MemoryBuffer *)data;
const rcti &input_rect = inputBuffer->get_rect();
float *buffer = inputBuffer->getBuffer();
@@ -108,20 +108,20 @@ void GaussianAlphaYBlurOperation::executePixel(float output[4], int x, int y, vo
for (int ny = ymin; ny < ymax; ny += step) {
int bufferindex = ((xmin - bufferstartx)) + ((ny - bufferstarty) * bufferwidth);
const int index = (ny - y) + this->m_filtersize;
const int index = (ny - y) + m_filtersize;
float value = finv_test(buffer[bufferindex], do_invert);
float multiplier;
/* gauss */
{
multiplier = this->m_gausstab[index];
multiplier = m_gausstab[index];
alpha_accum += value * multiplier;
multiplier_accum += multiplier;
}
/* dilate - find most extreme color */
if (value > value_max) {
multiplier = this->m_distbuf_inv[index];
multiplier = m_distbuf_inv[index];
value *= multiplier;
if (value > value_max) {
value_max = value;
@@ -140,14 +140,14 @@ void GaussianAlphaYBlurOperation::deinitExecution()
{
GaussianAlphaBlurBaseOperation::deinitExecution();
if (this->m_gausstab) {
MEM_freeN(this->m_gausstab);
this->m_gausstab = nullptr;
if (m_gausstab) {
MEM_freeN(m_gausstab);
m_gausstab = nullptr;
}
if (this->m_distbuf_inv) {
MEM_freeN(this->m_distbuf_inv);
this->m_distbuf_inv = nullptr;
if (m_distbuf_inv) {
MEM_freeN(m_distbuf_inv);
m_distbuf_inv = nullptr;
}
deinitMutex();
@@ -171,11 +171,11 @@ bool GaussianAlphaYBlurOperation::determineDependingAreaOfInterest(
else
#endif
{
if (this->m_sizeavailable && this->m_gausstab != nullptr) {
if (m_sizeavailable && m_gausstab != nullptr) {
newInput.xmax = input->xmax;
newInput.xmin = input->xmin;
newInput.ymax = input->ymax + this->m_filtersize + 1;
newInput.ymin = input->ymin - this->m_filtersize - 1;
newInput.ymax = input->ymax + m_filtersize + 1;
newInput.ymin = input->ymin - m_filtersize - 1;
}
else {
newInput.xmax = this->getWidth();

View File

@@ -24,13 +24,13 @@ namespace blender::compositor {
GaussianBokehBlurOperation::GaussianBokehBlurOperation() : BlurBaseOperation(DataType::Color)
{
this->m_gausstab = nullptr;
m_gausstab = nullptr;
}
void *GaussianBokehBlurOperation::initializeTileData(rcti * /*rect*/)
{
lockMutex();
if (!this->m_sizeavailable) {
if (!m_sizeavailable) {
updateGauss();
}
void *buffer = getInputOperation(0)->initializeTileData(nullptr);
@@ -44,19 +44,19 @@ void GaussianBokehBlurOperation::init_data()
const float width = this->getWidth();
const float height = this->getHeight();
if (!this->m_sizeavailable) {
if (!m_sizeavailable) {
updateSize();
}
radxf_ = this->m_size * (float)this->m_data.sizex;
radxf_ = m_size * (float)m_data.sizex;
CLAMP(radxf_, 0.0f, width / 2.0f);
/* Vertical. */
radyf_ = this->m_size * (float)this->m_data.sizey;
radyf_ = m_size * (float)m_data.sizey;
CLAMP(radyf_, 0.0f, height / 2.0f);
this->m_radx = ceil(radxf_);
this->m_rady = ceil(radyf_);
m_radx = ceil(radxf_);
m_rady = ceil(radyf_);
}
void GaussianBokehBlurOperation::initExecution()
@@ -65,16 +65,16 @@ void GaussianBokehBlurOperation::initExecution()
initMutex();
if (this->m_sizeavailable) {
if (m_sizeavailable) {
updateGauss();
}
}
void GaussianBokehBlurOperation::updateGauss()
{
if (this->m_gausstab == nullptr) {
int ddwidth = 2 * this->m_radx + 1;
int ddheight = 2 * this->m_rady + 1;
if (m_gausstab == nullptr) {
int ddwidth = 2 * m_radx + 1;
int ddheight = 2 * m_rady + 1;
int n = ddwidth * ddheight;
/* create a full filter image */
float *ddgauss = (float *)MEM_mallocN(sizeof(float) * n, __func__);
@@ -82,12 +82,12 @@ void GaussianBokehBlurOperation::updateGauss()
float sum = 0.0f;
float facx = (radxf_ > 0.0f ? 1.0f / radxf_ : 0.0f);
float facy = (radyf_ > 0.0f ? 1.0f / radyf_ : 0.0f);
for (int j = -this->m_rady; j <= this->m_rady; j++) {
for (int i = -this->m_radx; i <= this->m_radx; i++, dgauss++) {
for (int j = -m_rady; j <= m_rady; j++) {
for (int i = -m_radx; i <= m_radx; i++, dgauss++) {
float fj = (float)j * facy;
float fi = (float)i * facx;
float dist = sqrt(fj * fj + fi * fi);
*dgauss = RE_filter_value(this->m_data.filtertype, dist);
*dgauss = RE_filter_value(m_data.filtertype, dist);
sum += *dgauss;
}
@@ -105,7 +105,7 @@ void GaussianBokehBlurOperation::updateGauss()
ddgauss[center] = 1.0f;
}
this->m_gausstab = ddgauss;
m_gausstab = ddgauss;
}
}
@@ -124,21 +124,21 @@ void GaussianBokehBlurOperation::executePixel(float output[4], int x, int y, voi
int bufferstartx = input_rect.xmin;
int bufferstarty = input_rect.ymin;
int ymin = max_ii(y - this->m_rady, input_rect.ymin);
int ymax = min_ii(y + this->m_rady + 1, input_rect.ymax);
int xmin = max_ii(x - this->m_radx, input_rect.xmin);
int xmax = min_ii(x + this->m_radx + 1, input_rect.xmax);
int ymin = max_ii(y - m_rady, input_rect.ymin);
int ymax = min_ii(y + m_rady + 1, input_rect.ymax);
int xmin = max_ii(x - m_radx, input_rect.xmin);
int xmax = min_ii(x + m_radx + 1, input_rect.xmax);
int index;
int step = QualityStepHelper::getStep();
int offsetadd = QualityStepHelper::getOffsetAdd();
const int addConst = (xmin - x + this->m_radx);
const int mulConst = (this->m_radx * 2 + 1);
const int addConst = (xmin - x + m_radx);
const int mulConst = (m_radx * 2 + 1);
for (int ny = ymin; ny < ymax; ny += step) {
index = ((ny - y) + this->m_rady) * mulConst + addConst;
index = ((ny - y) + m_rady) * mulConst + addConst;
int bufferindex = ((xmin - bufferstartx) * 4) + ((ny - bufferstarty) * 4 * bufferwidth);
for (int nx = xmin; nx < xmax; nx += step) {
const float multiplier = this->m_gausstab[index];
const float multiplier = m_gausstab[index];
madd_v4_v4fl(tempColor, &buffer[bufferindex], multiplier);
multiplier_accum += multiplier;
index += step;
@@ -153,9 +153,9 @@ void GaussianBokehBlurOperation::deinitExecution()
{
BlurBaseOperation::deinitExecution();
if (this->m_gausstab) {
MEM_freeN(this->m_gausstab);
this->m_gausstab = nullptr;
if (m_gausstab) {
MEM_freeN(m_gausstab);
m_gausstab = nullptr;
}
deinitMutex();
@@ -176,15 +176,15 @@ bool GaussianBokehBlurOperation::determineDependingAreaOfInterest(
return true;
}
if (this->m_sizeavailable && this->m_gausstab != nullptr) {
if (m_sizeavailable && m_gausstab != nullptr) {
newInput.xmin = 0;
newInput.ymin = 0;
newInput.xmax = this->getWidth();
newInput.ymax = this->getHeight();
}
else {
int addx = this->m_radx;
int addy = this->m_rady;
int addx = m_radx;
int addy = m_rady;
newInput.xmax = input->xmax + addx;
newInput.xmin = input->xmin - addx;
newInput.ymax = input->ymax + addy;
@@ -219,23 +219,23 @@ void GaussianBokehBlurOperation::update_memory_buffer_partial(MemoryBuffer *outp
const int x = it.x;
const int y = it.y;
const int ymin = max_ii(y - this->m_rady, input_rect.ymin);
const int ymax = min_ii(y + this->m_rady + 1, input_rect.ymax);
const int xmin = max_ii(x - this->m_radx, input_rect.xmin);
const int xmax = min_ii(x + this->m_radx + 1, input_rect.xmax);
const int ymin = max_ii(y - m_rady, input_rect.ymin);
const int ymax = min_ii(y + m_rady + 1, input_rect.ymax);
const int xmin = max_ii(x - m_radx, input_rect.xmin);
const int xmax = min_ii(x + m_radx + 1, input_rect.xmax);
float tempColor[4] = {0};
float multiplier_accum = 0;
const int step = QualityStepHelper::getStep();
const int elem_step = step * input->elem_stride;
const int add_const = (xmin - x + this->m_radx);
const int mul_const = (this->m_radx * 2 + 1);
const int add_const = (xmin - x + m_radx);
const int mul_const = (m_radx * 2 + 1);
for (int ny = ymin; ny < ymax; ny += step) {
const float *color = input->get_elem(xmin, ny);
int gauss_index = ((ny - y) + this->m_rady) * mul_const + add_const;
int gauss_index = ((ny - y) + m_rady) * mul_const + add_const;
const int gauss_end = gauss_index + (xmax - xmin);
for (; gauss_index < gauss_end; gauss_index += step, color += elem_step) {
const float multiplier = this->m_gausstab[gauss_index];
const float multiplier = m_gausstab[gauss_index];
madd_v4_v4fl(tempColor, color, multiplier);
multiplier_accum += multiplier;
}
@@ -249,34 +249,34 @@ void GaussianBokehBlurOperation::update_memory_buffer_partial(MemoryBuffer *outp
GaussianBlurReferenceOperation::GaussianBlurReferenceOperation()
: BlurBaseOperation(DataType::Color)
{
this->m_maintabs = nullptr;
m_maintabs = nullptr;
use_variable_size_ = true;
}
void GaussianBlurReferenceOperation::init_data()
{
/* Setup variables for gausstab and area of interest. */
this->m_data.image_in_width = this->getWidth();
this->m_data.image_in_height = this->getHeight();
if (this->m_data.relative) {
switch (this->m_data.aspect) {
m_data.image_in_width = this->getWidth();
m_data.image_in_height = this->getHeight();
if (m_data.relative) {
switch (m_data.aspect) {
case CMP_NODE_BLUR_ASPECT_NONE:
this->m_data.sizex = (int)(this->m_data.percentx * 0.01f * this->m_data.image_in_width);
this->m_data.sizey = (int)(this->m_data.percenty * 0.01f * this->m_data.image_in_height);
m_data.sizex = (int)(m_data.percentx * 0.01f * m_data.image_in_width);
m_data.sizey = (int)(m_data.percenty * 0.01f * m_data.image_in_height);
break;
case CMP_NODE_BLUR_ASPECT_Y:
this->m_data.sizex = (int)(this->m_data.percentx * 0.01f * this->m_data.image_in_width);
this->m_data.sizey = (int)(this->m_data.percenty * 0.01f * this->m_data.image_in_width);
m_data.sizex = (int)(m_data.percentx * 0.01f * m_data.image_in_width);
m_data.sizey = (int)(m_data.percenty * 0.01f * m_data.image_in_width);
break;
case CMP_NODE_BLUR_ASPECT_X:
this->m_data.sizex = (int)(this->m_data.percentx * 0.01f * this->m_data.image_in_height);
this->m_data.sizey = (int)(this->m_data.percenty * 0.01f * this->m_data.image_in_height);
m_data.sizex = (int)(m_data.percentx * 0.01f * m_data.image_in_height);
m_data.sizey = (int)(m_data.percenty * 0.01f * m_data.image_in_height);
break;
}
}
/* Horizontal. */
m_filtersizex = (float)this->m_data.sizex;
m_filtersizex = (float)m_data.sizex;
int imgx = getWidth() / 2;
if (m_filtersizex > imgx) {
m_filtersizex = imgx;
@@ -287,7 +287,7 @@ void GaussianBlurReferenceOperation::init_data()
m_radx = (float)m_filtersizex;
/* Vertical. */
m_filtersizey = (float)this->m_data.sizey;
m_filtersizey = (float)m_data.sizey;
int imgy = getHeight() / 2;
if (m_filtersizey > imgy) {
m_filtersizey = imgy;
@@ -334,7 +334,7 @@ void GaussianBlurReferenceOperation::executePixel(float output[4], int x, int y,
int imgx = getWidth();
int imgy = getHeight();
float tempSize[4];
this->m_inputSize->read(tempSize, x, y, data);
m_inputSize->read(tempSize, x, y, data);
float refSize = tempSize[0];
int refradx = (int)(refSize * m_radx);
int refrady = (int)(refSize * m_rady);
@@ -391,11 +391,11 @@ void GaussianBlurReferenceOperation::executePixel(float output[4], int x, int y,
void GaussianBlurReferenceOperation::deinitExecution()
{
int x, i;
x = MAX2(this->m_filtersizex, this->m_filtersizey);
x = MAX2(m_filtersizex, m_filtersizey);
for (i = 0; i < x; i++) {
MEM_freeN(this->m_maintabs[i]);
MEM_freeN(m_maintabs[i]);
}
MEM_freeN(this->m_maintabs);
MEM_freeN(m_maintabs);
BlurBaseOperation::deinitExecution();
}
@@ -409,8 +409,8 @@ bool GaussianBlurReferenceOperation::determineDependingAreaOfInterest(
return true;
}
int addx = this->m_data.sizex + 2;
int addy = this->m_data.sizey + 2;
int addx = m_data.sizex + 2;
int addy = m_data.sizey + 2;
newInput.xmax = input->xmax + addx;
newInput.xmin = input->xmin - addx;
newInput.ymax = input->ymax + addy;
@@ -427,8 +427,8 @@ void GaussianBlurReferenceOperation::get_area_of_interest(const int input_idx,
return;
}
const int add_x = this->m_data.sizex + 2;
const int add_y = this->m_data.sizey + 2;
const int add_x = m_data.sizex + 2;
const int add_y = m_data.sizey + 2;
r_input_area.xmax = output_area.xmax + add_x;
r_input_area.xmin = output_area.xmin - add_x;
r_input_area.ymax = output_area.ymax + add_y;

View File

@@ -28,7 +28,7 @@ GaussianXBlurOperation::GaussianXBlurOperation() : GaussianBlurBaseOperation(eDi
void *GaussianXBlurOperation::initializeTileData(rcti * /*rect*/)
{
lockMutex();
if (!this->m_sizeavailable) {
if (!m_sizeavailable) {
updateGauss();
}
void *buffer = getInputOperation(0)->initializeTileData(nullptr);
@@ -43,14 +43,14 @@ void GaussianXBlurOperation::initExecution()
initMutex();
if (this->m_sizeavailable && execution_model_ == eExecutionModel::Tiled) {
if (m_sizeavailable && execution_model_ == eExecutionModel::Tiled) {
float rad = max_ff(m_size * m_data.sizex, 0.0f);
m_filtersize = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS);
/* TODO(sergey): De-duplicate with the case below and Y blur. */
this->m_gausstab = BlurBaseOperation::make_gausstab(rad, m_filtersize);
m_gausstab = BlurBaseOperation::make_gausstab(rad, m_filtersize);
#ifdef BLI_HAVE_SSE2
this->m_gausstab_sse = BlurBaseOperation::convert_gausstab_sse(this->m_gausstab, m_filtersize);
m_gausstab_sse = BlurBaseOperation::convert_gausstab_sse(m_gausstab, m_filtersize);
#endif
}
}
@@ -58,15 +58,15 @@ void GaussianXBlurOperation::initExecution()
/* TODO(manzanilla): to be removed with tiled implementation. */
void GaussianXBlurOperation::updateGauss()
{
if (this->m_gausstab == nullptr) {
if (m_gausstab == nullptr) {
updateSize();
float rad = max_ff(m_size * m_data.sizex, 0.0f);
rad = min_ff(rad, MAX_GAUSSTAB_RADIUS);
m_filtersize = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS);
this->m_gausstab = BlurBaseOperation::make_gausstab(rad, m_filtersize);
m_gausstab = BlurBaseOperation::make_gausstab(rad, m_filtersize);
#ifdef BLI_HAVE_SSE2
this->m_gausstab_sse = BlurBaseOperation::convert_gausstab_sse(this->m_gausstab, m_filtersize);
m_gausstab_sse = BlurBaseOperation::convert_gausstab_sse(m_gausstab, m_filtersize);
#endif
}
}
@@ -92,19 +92,17 @@ void GaussianXBlurOperation::executePixel(float output[4], int x, int y, void *d
#ifdef BLI_HAVE_SSE2
__m128 accum_r = _mm_load_ps(color_accum);
for (int nx = xmin, index = (xmin - x) + this->m_filtersize; nx < xmax;
nx += step, index += step) {
for (int nx = xmin, index = (xmin - x) + m_filtersize; nx < xmax; nx += step, index += step) {
__m128 reg_a = _mm_load_ps(&buffer[bufferindex]);
reg_a = _mm_mul_ps(reg_a, this->m_gausstab_sse[index]);
reg_a = _mm_mul_ps(reg_a, m_gausstab_sse[index]);
accum_r = _mm_add_ps(accum_r, reg_a);
multiplier_accum += this->m_gausstab[index];
multiplier_accum += m_gausstab[index];
bufferindex += offsetadd;
}
_mm_store_ps(color_accum, accum_r);
#else
for (int nx = xmin, index = (xmin - x) + this->m_filtersize; nx < xmax;
nx += step, index += step) {
const float multiplier = this->m_gausstab[index];
for (int nx = xmin, index = (xmin - x) + m_filtersize; nx < xmax; nx += step, index += step) {
const float multiplier = m_gausstab[index];
madd_v4_v4fl(color_accum, &buffer[bufferindex], multiplier);
multiplier_accum += multiplier;
bufferindex += offsetadd;
@@ -122,20 +120,16 @@ void GaussianXBlurOperation::executeOpenCL(OpenCLDevice *device,
{
cl_kernel gaussianXBlurOperationKernel = device->COM_clCreateKernel(
"gaussianXBlurOperationKernel", nullptr);
cl_int filter_size = this->m_filtersize;
cl_int filter_size = m_filtersize;
cl_mem gausstab = clCreateBuffer(device->getContext(),
CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR,
sizeof(float) * (this->m_filtersize * 2 + 1),
this->m_gausstab,
sizeof(float) * (m_filtersize * 2 + 1),
m_gausstab,
nullptr);
device->COM_clAttachMemoryBufferToKernelParameter(gaussianXBlurOperationKernel,
0,
1,
clMemToCleanUp,
inputMemoryBuffers,
this->m_inputProgram);
device->COM_clAttachMemoryBufferToKernelParameter(
gaussianXBlurOperationKernel, 0, 1, clMemToCleanUp, inputMemoryBuffers, m_inputProgram);
device->COM_clAttachOutputMemoryBufferToKernelParameter(
gaussianXBlurOperationKernel, 2, clOutputBuffer);
device->COM_clAttachMemoryBufferOffsetToKernelParameter(
@@ -153,14 +147,14 @@ void GaussianXBlurOperation::deinitExecution()
{
GaussianBlurBaseOperation::deinitExecution();
if (this->m_gausstab) {
MEM_freeN(this->m_gausstab);
this->m_gausstab = nullptr;
if (m_gausstab) {
MEM_freeN(m_gausstab);
m_gausstab = nullptr;
}
#ifdef BLI_HAVE_SSE2
if (this->m_gausstab_sse) {
MEM_freeN(this->m_gausstab_sse);
this->m_gausstab_sse = nullptr;
if (m_gausstab_sse) {
MEM_freeN(m_gausstab_sse);
m_gausstab_sse = nullptr;
}
#endif
@@ -173,7 +167,7 @@ bool GaussianXBlurOperation::determineDependingAreaOfInterest(rcti *input,
{
rcti newInput;
if (!this->m_sizeavailable) {
if (!m_sizeavailable) {
rcti sizeInput;
sizeInput.xmin = 0;
sizeInput.ymin = 0;
@@ -185,9 +179,9 @@ bool GaussianXBlurOperation::determineDependingAreaOfInterest(rcti *input,
}
}
{
if (this->m_sizeavailable && this->m_gausstab != nullptr) {
newInput.xmax = input->xmax + this->m_filtersize + 1;
newInput.xmin = input->xmin - this->m_filtersize - 1;
if (m_sizeavailable && m_gausstab != nullptr) {
newInput.xmax = input->xmax + m_filtersize + 1;
newInput.xmin = input->xmin - m_filtersize - 1;
newInput.ymax = input->ymax;
newInput.ymin = input->ymin;
}

Some files were not shown because too many files have changed in this diff Show More