[Bf-blender-cvs] [aed85ac4b66] compositor-full-frame: Cleanup: fix compiler warnings
Manuel Castilla
noreply at git.blender.org
Thu Aug 12 22:35:58 CEST 2021
Commit: aed85ac4b66d27edff6a650bda9cbed1603a5910
Author: Manuel Castilla
Date: Thu Aug 12 22:28:30 2021 +0200
Branches: compositor-full-frame
https://developer.blender.org/rBaed85ac4b66d27edff6a650bda9cbed1603a5910
Cleanup: fix compiler warnings
===================================================================
M source/blender/compositor/operations/COM_DilateErodeOperation.cc
M source/blender/compositor/operations/COM_DilateErodeOperation.h
===================================================================
diff --git a/source/blender/compositor/operations/COM_DilateErodeOperation.cc b/source/blender/compositor/operations/COM_DilateErodeOperation.cc
index c894a5f43ef..1a413257f00 100644
--- a/source/blender/compositor/operations/COM_DilateErodeOperation.cc
+++ b/source/blender/compositor/operations/COM_DilateErodeOperation.cc
@@ -177,6 +177,21 @@ void DilateErodeThresholdOperation::get_area_of_interest(const int input_idx,
r_input_area.ymax = output_area.ymax + m_scope;
}
+struct DilateErodeThresholdOperation::PixelData {
+ int x;
+ int y;
+ int xmin;
+ int xmax;
+ int ymin;
+ int ymax;
+ const float *elem;
+ float distance;
+ int elem_stride;
+ int row_stride;
+ /** Switch. */
+ float sw;
+};
+
template<template<typename> typename TCompare>
static float get_min_distance(DilateErodeThresholdOperation::PixelData &p)
{
@@ -267,17 +282,6 @@ DilateDistanceOperation::DilateDistanceOperation()
flags.open_cl = true;
}
-DilateDistanceOperation::PixelData::PixelData(MemoryBuffer *input,
- const int distance,
- const int scope)
- : min_distance(distance * distance),
- scope(scope),
- elem_stride(input->elem_stride),
- row_stride(input->row_stride),
- input_rect(input->get_rect())
-{
-}
-
void DilateDistanceOperation::init_data()
{
this->m_scope = this->m_distance;
@@ -382,6 +386,41 @@ void DilateDistanceOperation::get_area_of_interest(const int input_idx,
r_input_area.ymax = output_area.ymax + m_scope;
}
+struct DilateDistanceOperation::PixelData {
+ int x;
+ int y;
+ int xmin;
+ int xmax;
+ int ymin;
+ int ymax;
+ const float *elem;
+ float min_distance;
+ int scope;
+ int elem_stride;
+ int row_stride;
+ const rcti &input_rect;
+
+ PixelData(MemoryBuffer *input, const int distance, const int scope)
+ : min_distance(distance * distance),
+ scope(scope),
+ elem_stride(input->elem_stride),
+ row_stride(input->row_stride),
+ input_rect(input->get_rect())
+ {
+ }
+
+ void update(BuffersIterator<float> &it)
+ {
+ x = it.x;
+ y = it.y;
+ xmin = MAX2(x - scope, input_rect.xmin);
+ ymin = MAX2(y - scope, input_rect.ymin);
+ xmax = MIN2(x + scope, input_rect.xmax);
+ ymax = MIN2(y + scope, input_rect.ymax);
+ elem = it.in(0);
+ }
+};
+
template<template<typename> typename TCompare>
static float get_distance_value(DilateDistanceOperation::PixelData &p, const float start_value)
{
@@ -398,7 +437,7 @@ static float get_distance_value(DilateDistanceOperation::PixelData &p, const flo
const float *elem = row;
for (int xi = p.xmin; xi < p.xmax; xi++) {
const float dx = xi - p.x;
- const float dist = dx * dx + dy * dy;
+ const float dist = dx * dx + dist_y;
if (dist <= min_dist) {
value = compare(*elem, value) ? *elem : value;
}
@@ -761,6 +800,7 @@ struct Max2Selector {
return MAX2(f1, f2);
}
};
+
void DilateStepOperation::update_memory_buffer_partial(MemoryBuffer *output,
const rcti &area,
Span<MemoryBuffer *> inputs)
@@ -870,6 +910,7 @@ struct Min2Selector {
return MIN2(f1, f2);
}
};
+
void ErodeStepOperation::update_memory_buffer_partial(MemoryBuffer *output,
const rcti &area,
Span<MemoryBuffer *> inputs)
diff --git a/source/blender/compositor/operations/COM_DilateErodeOperation.h b/source/blender/compositor/operations/COM_DilateErodeOperation.h
index db6cbad48a1..9c32a5ac1fd 100644
--- a/source/blender/compositor/operations/COM_DilateErodeOperation.h
+++ b/source/blender/compositor/operations/COM_DilateErodeOperation.h
@@ -23,22 +23,10 @@
namespace blender::compositor {
class DilateErodeThresholdOperation : public MultiThreadedOperation {
- private:
- struct PixelData {
- int x;
- int y;
- int xmin;
- int xmax;
- int ymin;
- int ymax;
- const float *elem;
- float distance;
- int elem_stride;
- int row_stride;
- /** Switch. */
- float sw;
- };
+ public:
+ struct PixelData;
+ private:
/**
* Cached reference to the inputProgram
*/
@@ -98,35 +86,10 @@ class DilateErodeThresholdOperation : public MultiThreadedOperation {
};
class DilateDistanceOperation : public MultiThreadedOperation {
- protected:
- struct PixelData {
- int x;
- int y;
- int xmin;
- int xmax;
- int ymin;
- int ymax;
- const float *elem;
- float min_distance;
- int scope;
- int elem_stride;
- int row_stride;
- const rcti &input_rect;
-
- PixelData(MemoryBuffer *input, int distance, int scope);
-
- void update(BuffersIterator<float> &it)
- {
- x = it.x;
- y = it.y;
- xmin = MAX2(x - scope, input_rect.xmin);
- ymin = MAX2(y - scope, input_rect.ymin);
- xmax = MIN2(x + scope, input_rect.xmax);
- ymax = MIN2(y + scope, input_rect.ymax);
- elem = it.in(0);
- }
- };
+ public:
+ struct PixelData;
+ protected:
/**
* Cached reference to the inputProgram
*/
More information about the Bf-blender-cvs
mailing list