Compositor: Full frame Movie Clip node
Adds full frame implementation to this node operation. No functional changes. 2x faster than tiled fallback.
This commit is contained in:
parent
91e2b1dcaf
commit
48e27ad122
Notes:
blender-bot
2023-02-14 10:35:28 +01:00
Referenced by issue #88150, Full Frame Compositor
|
@ -66,6 +66,7 @@ constexpr int COM_DATA_TYPE_VALUE_CHANNELS = COM_data_type_num_channels(DataType
|
|||
constexpr int COM_DATA_TYPE_VECTOR_CHANNELS = COM_data_type_num_channels(DataType::Vector);
|
||||
constexpr int COM_DATA_TYPE_COLOR_CHANNELS = COM_data_type_num_channels(DataType::Color);
|
||||
|
||||
constexpr float COM_COLOR_TRANSPARENT[4] = {0.0f, 0.0f, 0.0f, 0.0f};
|
||||
constexpr float COM_VECTOR_ZERO[3] = {0.0f, 0.0f, 0.0f};
|
||||
constexpr float COM_VALUE_ZERO[1] = {0.0f};
|
||||
constexpr float COM_VALUE_ONE[1] = {1.0f};
|
||||
|
|
|
@ -116,6 +116,18 @@ void MovieClipBaseOperation::executePixelSampled(float output[4],
|
|||
}
|
||||
}
|
||||
|
||||
void MovieClipBaseOperation::update_memory_buffer_partial(MemoryBuffer *output,
|
||||
const rcti &area,
|
||||
Span<MemoryBuffer *> UNUSED(inputs))
|
||||
{
|
||||
if (m_movieClipBuffer) {
|
||||
output->copy_from(m_movieClipBuffer, area);
|
||||
}
|
||||
else {
|
||||
output->fill(area, COM_COLOR_TRANSPARENT);
|
||||
}
|
||||
}
|
||||
|
||||
MovieClipOperation::MovieClipOperation() : MovieClipBaseOperation()
|
||||
{
|
||||
this->addOutputSocket(DataType::Color);
|
||||
|
@ -136,4 +148,16 @@ void MovieClipAlphaOperation::executePixelSampled(float output[4],
|
|||
output[0] = result[3];
|
||||
}
|
||||
|
||||
void MovieClipAlphaOperation::update_memory_buffer_partial(MemoryBuffer *output,
|
||||
const rcti &area,
|
||||
Span<MemoryBuffer *> UNUSED(inputs))
|
||||
{
|
||||
if (m_movieClipBuffer) {
|
||||
output->copy_from(m_movieClipBuffer, area, 3, COM_DATA_TYPE_VALUE_CHANNELS, 0);
|
||||
}
|
||||
else {
|
||||
output->fill(area, COM_VALUE_ZERO);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "BLI_listbase.h"
|
||||
#include "COM_NodeOperation.h"
|
||||
#include "COM_MultiThreadedOperation.h"
|
||||
#include "DNA_movieclip_types.h"
|
||||
#include "IMB_imbuf_types.h"
|
||||
|
||||
|
@ -28,7 +28,7 @@ namespace blender::compositor {
|
|||
/**
|
||||
* Base class for movie clip
|
||||
*/
|
||||
class MovieClipBaseOperation : public NodeOperation {
|
||||
class MovieClipBaseOperation : public MultiThreadedOperation {
|
||||
protected:
|
||||
MovieClip *m_movieClip;
|
||||
MovieClipUser *m_movieClipUser;
|
||||
|
@ -67,6 +67,10 @@ class MovieClipBaseOperation : public NodeOperation {
|
|||
this->m_framenumber = framenumber;
|
||||
}
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
|
||||
void update_memory_buffer_partial(MemoryBuffer *output,
|
||||
const rcti &area,
|
||||
Span<MemoryBuffer *> inputs) override;
|
||||
};
|
||||
|
||||
class MovieClipOperation : public MovieClipBaseOperation {
|
||||
|
@ -78,6 +82,10 @@ class MovieClipAlphaOperation : public MovieClipBaseOperation {
|
|||
public:
|
||||
MovieClipAlphaOperation();
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
|
||||
void update_memory_buffer_partial(MemoryBuffer *output,
|
||||
const rcti &area,
|
||||
Span<MemoryBuffer *> inputs) override;
|
||||
};
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
|
Loading…
Reference in New Issue