diff options
author | Manuel Castilla <manzanillawork@gmail.com> | 2021-06-23 18:44:18 +0300 |
---|---|---|
committer | Manuel Castilla <manzanillawork@gmail.com> | 2021-06-23 18:46:54 +0300 |
commit | c9f12b21e252fee3f102b9e04dfde000016dc099 (patch) | |
tree | 623c9fb9d640ac617bc3d7700a965168c04ec862 /source/blender/compositor/operations/COM_IDMaskOperation.cc | |
parent | 35db01325f41da34e5a71d2b28cc717cddbdb996 (diff) |
Compositor: Full frame ID Mask node
Adds full frame implementation to this node operations.
No functional changes.
1.2x faster than tiled fallback.
Reviewed By: jbakker
Differential Revision: https://developer.blender.org/D11638
Diffstat (limited to 'source/blender/compositor/operations/COM_IDMaskOperation.cc')
-rw-r--r-- | source/blender/compositor/operations/COM_IDMaskOperation.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/source/blender/compositor/operations/COM_IDMaskOperation.cc b/source/blender/compositor/operations/COM_IDMaskOperation.cc index 1bb247e9bc5..38f8b7e075f 100644 --- a/source/blender/compositor/operations/COM_IDMaskOperation.cc +++ b/source/blender/compositor/operations/COM_IDMaskOperation.cc @@ -42,4 +42,22 @@ void IDMaskOperation::executePixel(float output[4], int x, int y, void *data) output[0] = (roundf(buffer[buffer_index]) == this->m_objectIndex) ? 1.0f : 0.0f; } +void IDMaskOperation::update_memory_buffer_partial(MemoryBuffer *output, + const rcti &area, + Span<MemoryBuffer *> inputs) +{ + const MemoryBuffer *input = inputs[0]; + const int width = BLI_rcti_size_x(&area); + for (int y = area.ymin; y < area.ymax; y++) { + float *out = output->get_elem(area.xmin, y); + const float *in = input->get_elem(area.xmin, y); + const float *row_end = out + width * output->elem_stride; + while (out < row_end) { + out[0] = (roundf(in[0]) == m_objectIndex) ? 1.0f : 0.0f; + in += input->elem_stride; + out += output->elem_stride; + } + } +} + } // namespace blender::compositor |