Compare commits
5 Commits
temp-any-i
...
temp-sprea
Author | SHA1 | Date | |
---|---|---|---|
045bdd5308 | |||
ae51cde3d7 | |||
25f8050830 | |||
ff013946bb | |||
74de45712d |
60
extern/audaspace/plugins/wasapi/WASAPIDevice.cpp
vendored
60
extern/audaspace/plugins/wasapi/WASAPIDevice.cpp
vendored
@@ -35,11 +35,7 @@ void WASAPIDevice::start()
|
||||
{
|
||||
lock();
|
||||
|
||||
// thread is still running, we can abort stopping it
|
||||
if(m_stop)
|
||||
m_stop = false;
|
||||
// thread is not running, let's start it
|
||||
else if(!m_playing)
|
||||
if(!m_playing)
|
||||
{
|
||||
if(m_thread.joinable())
|
||||
m_thread.join();
|
||||
@@ -57,35 +53,20 @@ void WASAPIDevice::updateStream()
|
||||
UINT32 buffer_size;
|
||||
data_t* buffer;
|
||||
|
||||
lock();
|
||||
|
||||
if(FAILED(m_audio_client->GetBufferSize(&buffer_size)))
|
||||
{
|
||||
m_playing = false;
|
||||
m_stop = false;
|
||||
unlock();
|
||||
return;
|
||||
}
|
||||
|
||||
IAudioRenderClient* render_client = nullptr;
|
||||
const IID IID_IAudioRenderClient = __uuidof(IAudioRenderClient);
|
||||
|
||||
if(FAILED(m_audio_client->GetService(IID_IAudioRenderClient, reinterpret_cast<void**>(&render_client))))
|
||||
{
|
||||
m_playing = false;
|
||||
m_stop = false;
|
||||
unlock();
|
||||
return;
|
||||
}
|
||||
|
||||
UINT32 padding;
|
||||
|
||||
if(FAILED(m_audio_client->GetCurrentPadding(&padding)))
|
||||
{
|
||||
SafeRelease(&render_client);
|
||||
m_playing = false;
|
||||
m_stop = false;
|
||||
unlock();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -94,40 +75,31 @@ void WASAPIDevice::updateStream()
|
||||
if(FAILED(render_client->GetBuffer(length, &buffer)))
|
||||
{
|
||||
SafeRelease(&render_client);
|
||||
m_playing = false;
|
||||
m_stop = false;
|
||||
unlock();
|
||||
return;
|
||||
}
|
||||
|
||||
lock();
|
||||
|
||||
mix((data_t*)buffer, length);
|
||||
|
||||
unlock();
|
||||
|
||||
if(FAILED(render_client->ReleaseBuffer(length, 0)))
|
||||
{
|
||||
SafeRelease(&render_client);
|
||||
m_playing = false;
|
||||
m_stop = false;
|
||||
unlock();
|
||||
return;
|
||||
}
|
||||
|
||||
unlock();
|
||||
|
||||
m_audio_client->Start();
|
||||
|
||||
auto sleepDuration = std::chrono::milliseconds(buffer_size * 1000 / int(m_specs.rate) / 2);
|
||||
|
||||
for(;;)
|
||||
{
|
||||
lock();
|
||||
|
||||
if(FAILED(m_audio_client->GetCurrentPadding(&padding)))
|
||||
{
|
||||
m_audio_client->Stop();
|
||||
SafeRelease(&render_client);
|
||||
m_playing = false;
|
||||
m_stop = false;
|
||||
unlock();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -137,52 +109,44 @@ void WASAPIDevice::updateStream()
|
||||
{
|
||||
m_audio_client->Stop();
|
||||
SafeRelease(&render_client);
|
||||
m_playing = false;
|
||||
m_stop = false;
|
||||
unlock();
|
||||
return;
|
||||
}
|
||||
|
||||
lock();
|
||||
|
||||
mix((data_t*)buffer, length);
|
||||
|
||||
unlock();
|
||||
|
||||
if(FAILED(render_client->ReleaseBuffer(length, 0)))
|
||||
{
|
||||
m_audio_client->Stop();
|
||||
SafeRelease(&render_client);
|
||||
m_playing = false;
|
||||
m_stop = false;
|
||||
unlock();
|
||||
return;
|
||||
}
|
||||
|
||||
// stop thread
|
||||
if(m_stop)
|
||||
if(!m_playing)
|
||||
{
|
||||
m_audio_client->Stop();
|
||||
SafeRelease(&render_client);
|
||||
m_playing = false;
|
||||
m_stop = false;
|
||||
unlock();
|
||||
return;
|
||||
}
|
||||
|
||||
unlock();
|
||||
|
||||
std::this_thread::sleep_for(sleepDuration);
|
||||
}
|
||||
}
|
||||
|
||||
void WASAPIDevice::playing(bool playing)
|
||||
{
|
||||
if((!m_playing || m_stop) && playing)
|
||||
if(!m_playing && playing)
|
||||
start();
|
||||
else
|
||||
m_stop = true;
|
||||
m_playing = playing;
|
||||
}
|
||||
|
||||
WASAPIDevice::WASAPIDevice(DeviceSpecs specs, int buffersize) :
|
||||
m_playing(false),
|
||||
m_stop(false),
|
||||
|
||||
m_imm_device_enumerator(nullptr),
|
||||
m_imm_device(nullptr),
|
||||
|
@@ -48,11 +48,6 @@ private:
|
||||
*/
|
||||
bool m_playing;
|
||||
|
||||
/**
|
||||
* Whether the current playback should stop.
|
||||
*/
|
||||
bool m_stop;
|
||||
|
||||
IMMDeviceEnumerator* m_imm_device_enumerator;
|
||||
IMMDevice* m_imm_device;
|
||||
IAudioClient* m_audio_client;
|
||||
|
@@ -825,7 +825,6 @@ const bTheme U_theme_default = {
|
||||
.vertex_size = 3,
|
||||
.outline_width = 1,
|
||||
.facedot_size = 4,
|
||||
.noodle_curving = 4,
|
||||
.grid_levels = 2,
|
||||
.syntaxl = RGBA(0x565656ff),
|
||||
.syntaxs = RGBA(0x975b5bff),
|
||||
|
@@ -953,7 +953,7 @@
|
||||
frame_node="#9b9b9ba0"
|
||||
matte_node="#977474"
|
||||
distor_node="#749797"
|
||||
noodle_curving="4"
|
||||
noodle_curving="0"
|
||||
grid_levels="2"
|
||||
input_node="#cb3d4a"
|
||||
output_node="#cb3d4a"
|
||||
|
@@ -441,7 +441,6 @@ class QuickSmoke(ObjectModeOperator, Operator):
|
||||
|
||||
|
||||
class QuickLiquid(Operator):
|
||||
"""Make selected objects liquid"""
|
||||
bl_idname = "object.quick_liquid"
|
||||
bl_label = "Quick Liquid"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
@@ -97,12 +97,7 @@ class DATA_PT_EEVEE_light(DataButtonsPanel, Panel):
|
||||
col = layout.column()
|
||||
col.prop(light, "color")
|
||||
col.prop(light, "energy")
|
||||
|
||||
col.separator()
|
||||
|
||||
col.prop(light, "diffuse_factor", text="Diffuse")
|
||||
col.prop(light, "specular_factor", text="Specular")
|
||||
col.prop(light, "volume_factor", text="Volume")
|
||||
|
||||
col.separator()
|
||||
|
||||
|
@@ -352,12 +352,8 @@ class SEQUENCER_MT_view(Menu):
|
||||
if is_sequencer_view:
|
||||
layout.prop(st, "show_region_hud")
|
||||
|
||||
layout.separator()
|
||||
|
||||
if st.view_type == 'SEQUENCER':
|
||||
layout.prop(st, "show_backdrop", text="Preview as Backdrop")
|
||||
if is_preview or st.show_backdrop:
|
||||
layout.prop(st, "show_transform_preview", text="Preview During Transform")
|
||||
|
||||
layout.separator()
|
||||
|
||||
@@ -728,7 +724,6 @@ class SEQUENCER_MT_strip_image_transform(Menu):
|
||||
layout.operator("sequencer.strip_transform_clear", text="Clear Rotation").property = 'ROTATION'
|
||||
layout.operator("sequencer.strip_transform_clear", text="Clear All").property = 'ALL'
|
||||
|
||||
|
||||
class SEQUENCER_MT_strip_transform(Menu):
|
||||
bl_label = "Transform"
|
||||
|
||||
@@ -1276,13 +1271,7 @@ class SEQUENCER_PT_effect_text_style(SequencerButtonsPanel, Panel):
|
||||
layout = self.layout
|
||||
layout.use_property_split = True
|
||||
col = layout.column()
|
||||
|
||||
row = col.row(align=True)
|
||||
row.use_property_decorate = False
|
||||
row.template_ID(strip, "font", open="font.open", unlink="font.unlink")
|
||||
row.prop(strip, "use_bold", text="", icon="BOLD")
|
||||
row.prop(strip, "use_italic", text="", icon="ITALIC")
|
||||
|
||||
col.template_ID(strip, "font", open="font.open", unlink="font.unlink")
|
||||
col.prop(strip, "font_size")
|
||||
col.prop(strip, "color")
|
||||
|
||||
@@ -1305,6 +1294,7 @@ class SEQUENCER_PT_effect_text_style(SequencerButtonsPanel, Panel):
|
||||
row.prop_decorator(strip, "box_color")
|
||||
|
||||
row = layout.row(align=True, heading="Box Margin")
|
||||
row.use_property_decorate = False
|
||||
sub = row.row(align=True)
|
||||
sub.prop(strip, "box_margin")
|
||||
sub.active = strip.use_box and (not strip.mute)
|
||||
@@ -1425,36 +1415,36 @@ class SEQUENCER_PT_scene(SequencerButtonsPanel, Panel):
|
||||
return (strip.type == 'SCENE')
|
||||
|
||||
def draw(self, context):
|
||||
strip = act_strip(context)
|
||||
scene = strip.scene
|
||||
|
||||
layout = self.layout
|
||||
layout.use_property_split = True
|
||||
layout.use_property_decorate = False
|
||||
|
||||
strip = act_strip(context)
|
||||
|
||||
layout.active = not strip.mute
|
||||
|
||||
layout.template_ID(strip, "scene", text="Scene")
|
||||
layout.prop(strip, "scene_input", text="Input")
|
||||
layout.template_ID(strip, "scene")
|
||||
|
||||
if strip.scene_input == 'CAMERA':
|
||||
layout.template_ID(strip, "scene_camera", text="Camera")
|
||||
scene = strip.scene
|
||||
layout.prop(strip, "scene_input")
|
||||
|
||||
if scene:
|
||||
# Build a manual split layout as a hack to get proper alignment with the rest of the buttons.
|
||||
sub = layout.row(align=True)
|
||||
sub.use_property_decorate = True
|
||||
split = sub.split(factor=0.4, align=True)
|
||||
split.alignment = 'RIGHT'
|
||||
split.label(text="Volume")
|
||||
split.prop(scene, "audio_volume", text="")
|
||||
sub.use_property_decorate = False
|
||||
layout.prop(scene, "audio_volume", text="Volume")
|
||||
|
||||
if strip.scene_input == 'CAMERA':
|
||||
layout = layout.column(heading="Show")
|
||||
layout.prop(strip, "use_grease_pencil", text="Grease Pencil")
|
||||
layout.alignment = 'RIGHT'
|
||||
sub = layout.column(align=True)
|
||||
split = sub.split(factor=0.5, align=True)
|
||||
split.alignment = 'RIGHT'
|
||||
split.label(text="Camera")
|
||||
split.template_ID(strip, "scene_camera")
|
||||
|
||||
layout.prop(strip, "use_grease_pencil", text="Show Grease Pencil")
|
||||
|
||||
if scene:
|
||||
# Warning, this is not a good convention to follow.
|
||||
# Expose here because setting the alpha from the 'Render' menu is very inconvenient.
|
||||
# layout.label(text="Preview")
|
||||
layout.prop(scene.render, "film_transparent")
|
||||
|
||||
|
||||
|
@@ -42,7 +42,6 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct Collection;
|
||||
struct ID;
|
||||
struct IDOverrideLibrary;
|
||||
struct IDOverrideLibraryProperty;
|
||||
@@ -82,7 +81,6 @@ bool BKE_lib_override_library_resync(struct Main *bmain,
|
||||
struct Scene *scene,
|
||||
struct ViewLayer *view_layer,
|
||||
struct ID *id_root,
|
||||
struct Collection *override_resync_residual_storage,
|
||||
const bool do_hierarchy_enforce);
|
||||
void BKE_lib_override_library_main_resync(struct Main *bmain,
|
||||
struct Scene *scene,
|
||||
|
@@ -663,7 +663,6 @@ static void lib_override_library_create_post_process(Main *bmain,
|
||||
ViewLayer *view_layer,
|
||||
ID *id_root,
|
||||
ID *id_reference,
|
||||
Collection *residual_storage,
|
||||
const bool is_resync)
|
||||
{
|
||||
BKE_main_collection_sync(bmain);
|
||||
@@ -719,13 +718,8 @@ static void lib_override_library_create_post_process(Main *bmain,
|
||||
Object *ob_new = (Object *)id_root->newid;
|
||||
if (!lib_override_library_create_post_process_object_is_instantiated(
|
||||
view_layer, ob_new, is_resync)) {
|
||||
if (is_resync && residual_storage != NULL) {
|
||||
BKE_collection_object_add(bmain, residual_storage, ob_new);
|
||||
}
|
||||
else {
|
||||
BKE_collection_object_add_from(bmain, scene, (Object *)id_root, ob_new);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -740,7 +734,7 @@ static void lib_override_library_create_post_process(Main *bmain,
|
||||
BLI_assert(ob_new->id.override_library != NULL &&
|
||||
ob_new->id.override_library->reference == &ob->id);
|
||||
|
||||
Collection *default_instantiating_collection = residual_storage;
|
||||
Collection *default_instantiating_collection = NULL;
|
||||
if (!lib_override_library_create_post_process_object_is_instantiated(
|
||||
view_layer, ob_new, is_resync)) {
|
||||
if (default_instantiating_collection == NULL) {
|
||||
@@ -805,8 +799,7 @@ bool BKE_lib_override_library_create(
|
||||
return success;
|
||||
}
|
||||
|
||||
lib_override_library_create_post_process(
|
||||
bmain, scene, view_layer, id_root, id_reference, NULL, false);
|
||||
lib_override_library_create_post_process(bmain, scene, view_layer, id_root, id_reference, false);
|
||||
|
||||
/* Cleanup. */
|
||||
BKE_main_id_clear_newpoins(bmain);
|
||||
@@ -865,12 +858,8 @@ bool BKE_lib_override_library_proxy_convert(Main *bmain,
|
||||
* \param id_root: The root liboverride ID to resync from.
|
||||
* \return true if override was successfully resynced.
|
||||
*/
|
||||
bool BKE_lib_override_library_resync(Main *bmain,
|
||||
Scene *scene,
|
||||
ViewLayer *view_layer,
|
||||
ID *id_root,
|
||||
Collection *override_resync_residual_storage,
|
||||
const bool do_hierarchy_enforce)
|
||||
bool BKE_lib_override_library_resync(
|
||||
Main *bmain, Scene *scene, ViewLayer *view_layer, ID *id_root, const bool do_hierarchy_enforce)
|
||||
{
|
||||
BLI_assert(ID_IS_OVERRIDE_LIBRARY_REAL(id_root));
|
||||
BLI_assert(!ID_IS_LINKED(id_root));
|
||||
@@ -1081,13 +1070,8 @@ bool BKE_lib_override_library_resync(Main *bmain,
|
||||
* since we already relinked old root override collection to new resync'ed one above. So this
|
||||
* call is not expected to instantiate this new resync'ed collection anywhere, just to ensure
|
||||
* that we do not have any stray objects. */
|
||||
lib_override_library_create_post_process(bmain,
|
||||
scene,
|
||||
view_layer,
|
||||
id_root_reference,
|
||||
id_root,
|
||||
override_resync_residual_storage,
|
||||
true);
|
||||
lib_override_library_create_post_process(
|
||||
bmain, scene, view_layer, id_root_reference, id_root, true);
|
||||
|
||||
/* Cleanup. */
|
||||
BLI_ghash_free(linkedref_to_old_override, NULL, NULL);
|
||||
@@ -1114,23 +1098,6 @@ bool BKE_lib_override_library_resync(Main *bmain,
|
||||
*/
|
||||
void BKE_lib_override_library_main_resync(Main *bmain, Scene *scene, ViewLayer *view_layer)
|
||||
{
|
||||
/* We use a specific collection to gather/store all 'orphaned' override collections and objects
|
||||
* generated by resyncprocess. This avoids putting them in scene's master collection. */
|
||||
#define OVERRIDE_RESYNC_RESIDUAL_STORAGE_NAME "OVERRIDE_RESYNC_LEFTOVERS"
|
||||
Collection *override_resync_residual_storage = BLI_findstring(
|
||||
&bmain->collections, OVERRIDE_RESYNC_RESIDUAL_STORAGE_NAME, offsetof(ID, name) + 2);
|
||||
if (override_resync_residual_storage != NULL &&
|
||||
override_resync_residual_storage->id.lib != NULL) {
|
||||
override_resync_residual_storage = NULL;
|
||||
}
|
||||
if (override_resync_residual_storage == NULL) {
|
||||
override_resync_residual_storage = BKE_collection_add(
|
||||
bmain, scene->master_collection, OVERRIDE_RESYNC_RESIDUAL_STORAGE_NAME);
|
||||
/* Hide the collection from viewport and render. */
|
||||
override_resync_residual_storage->flag |= COLLECTION_RESTRICT_VIEWPORT |
|
||||
COLLECTION_RESTRICT_RENDER;
|
||||
}
|
||||
|
||||
BKE_main_relations_create(bmain, 0);
|
||||
BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, false);
|
||||
|
||||
@@ -1220,8 +1187,7 @@ void BKE_lib_override_library_main_resync(Main *bmain, Scene *scene, ViewLayer *
|
||||
}
|
||||
do_continue = true;
|
||||
CLOG_INFO(&LOG, 2, "Resyncing %s...", id->name);
|
||||
const bool success = BKE_lib_override_library_resync(
|
||||
bmain, scene, view_layer, id, override_resync_residual_storage, false);
|
||||
const bool success = BKE_lib_override_library_resync(bmain, scene, view_layer, id, false);
|
||||
CLOG_INFO(&LOG, 2, "\tSuccess: %d", success);
|
||||
break;
|
||||
}
|
||||
@@ -1232,10 +1198,6 @@ void BKE_lib_override_library_main_resync(Main *bmain, Scene *scene, ViewLayer *
|
||||
}
|
||||
FOREACH_MAIN_LISTBASE_END;
|
||||
}
|
||||
|
||||
if (BKE_collection_is_empty(override_resync_residual_storage)) {
|
||||
BKE_collection_delete(bmain, override_resync_residual_storage, true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -60,16 +60,6 @@ template<
|
||||
*/
|
||||
typename Allocator = GuardedAllocator>
|
||||
class Array {
|
||||
public:
|
||||
using value_type = T;
|
||||
using pointer = T *;
|
||||
using const_pointer = const T *;
|
||||
using reference = T &;
|
||||
using const_reference = const T &;
|
||||
using iterator = T *;
|
||||
using const_iterator = const T *;
|
||||
using size_type = int64_t;
|
||||
|
||||
private:
|
||||
/** The beginning of the array. It might point into the inline buffer. */
|
||||
T *data_;
|
||||
|
@@ -94,7 +94,6 @@ struct float4x4 {
|
||||
return float3(values[3]);
|
||||
}
|
||||
|
||||
/* Assumes XYZ rotation order. */
|
||||
float3 to_euler() const
|
||||
{
|
||||
float3 euler;
|
||||
|
@@ -82,18 +82,11 @@ class IndexRange {
|
||||
}
|
||||
|
||||
class Iterator {
|
||||
public:
|
||||
using iterator_category = std::forward_iterator_tag;
|
||||
using value_type = int64_t;
|
||||
using pointer = const int64_t *;
|
||||
using reference = const int64_t &;
|
||||
using difference_type = std::ptrdiff_t;
|
||||
|
||||
private:
|
||||
int64_t current_;
|
||||
|
||||
public:
|
||||
constexpr explicit Iterator(int64_t current) : current_(current)
|
||||
constexpr Iterator(int64_t current) : current_(current)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -103,21 +96,9 @@ class IndexRange {
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr Iterator operator++(int) const
|
||||
constexpr bool operator!=(const Iterator &iterator) const
|
||||
{
|
||||
Iterator copied_iterator = *this;
|
||||
++copied_iterator;
|
||||
return copied_iterator;
|
||||
}
|
||||
|
||||
constexpr friend bool operator!=(const Iterator &a, const Iterator &b)
|
||||
{
|
||||
return a.current_ != b.current_;
|
||||
}
|
||||
|
||||
constexpr friend bool operator==(const Iterator &a, const Iterator &b)
|
||||
{
|
||||
return a.current_ == b.current_;
|
||||
return current_ != iterator.current_;
|
||||
}
|
||||
|
||||
constexpr int64_t operator*() const
|
||||
|
@@ -120,9 +120,6 @@ template<
|
||||
*/
|
||||
typename Allocator = GuardedAllocator>
|
||||
class Map {
|
||||
public:
|
||||
using size_type = int64_t;
|
||||
|
||||
private:
|
||||
/**
|
||||
* Slots are either empty, occupied or removed. The number of occupied slots can be computed by
|
||||
@@ -626,9 +623,6 @@ class Map {
|
||||
* This uses the "curiously recurring template pattern" (CRTP).
|
||||
*/
|
||||
template<typename SubIterator> struct BaseIterator {
|
||||
using iterator_category = std::forward_iterator_tag;
|
||||
using difference_type = std::ptrdiff_t;
|
||||
|
||||
Slot *slots_;
|
||||
int64_t total_slots_;
|
||||
int64_t current_slot_;
|
||||
@@ -648,13 +642,6 @@ class Map {
|
||||
return *this;
|
||||
}
|
||||
|
||||
BaseIterator operator++(int) const
|
||||
{
|
||||
BaseIterator copied_iterator = *this;
|
||||
++copied_iterator;
|
||||
return copied_iterator;
|
||||
}
|
||||
|
||||
friend bool operator!=(const BaseIterator &a, const BaseIterator &b)
|
||||
{
|
||||
BLI_assert(a.slots_ == b.slots_);
|
||||
@@ -662,11 +649,6 @@ class Map {
|
||||
return a.current_slot_ != b.current_slot_;
|
||||
}
|
||||
|
||||
friend bool operator==(const BaseIterator &a, const BaseIterator &b)
|
||||
{
|
||||
return !(a != b);
|
||||
}
|
||||
|
||||
SubIterator begin() const
|
||||
{
|
||||
for (int64_t i = 0; i < total_slots_; i++) {
|
||||
@@ -690,10 +672,6 @@ class Map {
|
||||
|
||||
class KeyIterator final : public BaseIterator<KeyIterator> {
|
||||
public:
|
||||
using value_type = Key;
|
||||
using pointer = const Key *;
|
||||
using reference = const Key &;
|
||||
|
||||
KeyIterator(const Slot *slots, int64_t total_slots, int64_t current_slot)
|
||||
: BaseIterator<KeyIterator>(slots, total_slots, current_slot)
|
||||
{
|
||||
@@ -707,10 +685,6 @@ class Map {
|
||||
|
||||
class ValueIterator final : public BaseIterator<ValueIterator> {
|
||||
public:
|
||||
using value_type = Value;
|
||||
using pointer = const Value *;
|
||||
using reference = const Value &;
|
||||
|
||||
ValueIterator(const Slot *slots, int64_t total_slots, int64_t current_slot)
|
||||
: BaseIterator<ValueIterator>(slots, total_slots, current_slot)
|
||||
{
|
||||
@@ -724,10 +698,6 @@ class Map {
|
||||
|
||||
class MutableValueIterator final : public BaseIterator<MutableValueIterator> {
|
||||
public:
|
||||
using value_type = Value;
|
||||
using pointer = Value *;
|
||||
using reference = Value &;
|
||||
|
||||
MutableValueIterator(const Slot *slots, int64_t total_slots, int64_t current_slot)
|
||||
: BaseIterator<MutableValueIterator>(slots, total_slots, current_slot)
|
||||
{
|
||||
@@ -756,10 +726,6 @@ class Map {
|
||||
|
||||
class ItemIterator final : public BaseIterator<ItemIterator> {
|
||||
public:
|
||||
using value_type = Item;
|
||||
using pointer = Item *;
|
||||
using reference = Item &;
|
||||
|
||||
ItemIterator(const Slot *slots, int64_t total_slots, int64_t current_slot)
|
||||
: BaseIterator<ItemIterator>(slots, total_slots, current_slot)
|
||||
{
|
||||
@@ -774,10 +740,6 @@ class Map {
|
||||
|
||||
class MutableItemIterator final : public BaseIterator<MutableItemIterator> {
|
||||
public:
|
||||
using value_type = MutableItem;
|
||||
using pointer = MutableItem *;
|
||||
using reference = MutableItem &;
|
||||
|
||||
MutableItemIterator(const Slot *slots, int64_t total_slots, int64_t current_slot)
|
||||
: BaseIterator<MutableItemIterator>(slots, total_slots, current_slot)
|
||||
{
|
||||
|
@@ -38,9 +38,6 @@
|
||||
namespace blender {
|
||||
|
||||
template<typename Key, typename Value> class MultiValueMap {
|
||||
public:
|
||||
using size_type = int64_t;
|
||||
|
||||
private:
|
||||
using MapType = Map<Key, Vector<Value>>;
|
||||
MapType map_;
|
||||
|
@@ -119,16 +119,6 @@ template<
|
||||
*/
|
||||
typename Allocator = GuardedAllocator>
|
||||
class Set {
|
||||
public:
|
||||
class Iterator;
|
||||
using value_type = Key;
|
||||
using pointer = Key *;
|
||||
using const_pointer = const Key *;
|
||||
using reference = Key &;
|
||||
using const_reference = const Key &;
|
||||
using iterator = Iterator;
|
||||
using size_type = int64_t;
|
||||
|
||||
private:
|
||||
/**
|
||||
* Slots are either empty, occupied or removed. The number of occupied slots can be computed by
|
||||
@@ -411,13 +401,6 @@ class Set {
|
||||
* also change their hash.
|
||||
*/
|
||||
class Iterator {
|
||||
public:
|
||||
using iterator_category = std::forward_iterator_tag;
|
||||
using value_type = Key;
|
||||
using pointer = const Key *;
|
||||
using reference = const Key &;
|
||||
using difference_type = std::ptrdiff_t;
|
||||
|
||||
private:
|
||||
const Slot *slots_;
|
||||
int64_t total_slots_;
|
||||
@@ -439,34 +422,17 @@ class Set {
|
||||
return *this;
|
||||
}
|
||||
|
||||
Iterator operator++(int) const
|
||||
{
|
||||
Iterator copied_iterator = *this;
|
||||
++copied_iterator;
|
||||
return copied_iterator;
|
||||
}
|
||||
|
||||
const Key &operator*() const
|
||||
{
|
||||
return *slots_[current_slot_].key();
|
||||
}
|
||||
|
||||
const Key *operator->() const
|
||||
{
|
||||
return slots_[current_slot_].key();
|
||||
}
|
||||
|
||||
friend bool operator!=(const Iterator &a, const Iterator &b)
|
||||
{
|
||||
BLI_assert(a.slots_ == b.slots_);
|
||||
BLI_assert(a.total_slots_ == b.total_slots_);
|
||||
return a.current_slot_ != b.current_slot_;
|
||||
}
|
||||
|
||||
friend bool operator==(const Iterator &a, const Iterator &b)
|
||||
{
|
||||
return !(a != b);
|
||||
}
|
||||
};
|
||||
|
||||
Iterator begin() const
|
||||
|
@@ -85,15 +85,6 @@ namespace blender {
|
||||
* modified.
|
||||
*/
|
||||
template<typename T> class Span {
|
||||
public:
|
||||
using value_type = T;
|
||||
using pointer = T *;
|
||||
using const_pointer = const T *;
|
||||
using reference = T &;
|
||||
using const_reference = const T &;
|
||||
using iterator = const T *;
|
||||
using size_type = int64_t;
|
||||
|
||||
private:
|
||||
const T *data_ = nullptr;
|
||||
int64_t size_ = 0;
|
||||
@@ -468,15 +459,6 @@ template<typename T> class Span {
|
||||
* MutableSpan.
|
||||
*/
|
||||
template<typename T> class MutableSpan {
|
||||
public:
|
||||
using value_type = T;
|
||||
using pointer = T *;
|
||||
using const_pointer = const T *;
|
||||
using reference = T &;
|
||||
using const_reference = const T &;
|
||||
using iterator = T *;
|
||||
using size_type = int64_t;
|
||||
|
||||
private:
|
||||
T *data_;
|
||||
int64_t size_;
|
||||
|
@@ -80,14 +80,6 @@ template<
|
||||
*/
|
||||
typename Allocator = GuardedAllocator>
|
||||
class Stack {
|
||||
public:
|
||||
using value_type = T;
|
||||
using pointer = T *;
|
||||
using const_pointer = const T *;
|
||||
using reference = T &;
|
||||
using const_reference = const T &;
|
||||
using size_type = int64_t;
|
||||
|
||||
private:
|
||||
using Chunk = StackChunk<T>;
|
||||
|
||||
|
@@ -76,16 +76,6 @@ template<
|
||||
*/
|
||||
typename Allocator = GuardedAllocator>
|
||||
class Vector {
|
||||
public:
|
||||
using value_type = T;
|
||||
using pointer = T *;
|
||||
using const_pointer = const T *;
|
||||
using reference = T &;
|
||||
using const_reference = const T &;
|
||||
using iterator = T *;
|
||||
using const_iterator = const T *;
|
||||
using size_type = int64_t;
|
||||
|
||||
private:
|
||||
/**
|
||||
* Use pointers instead of storing the size explicitly. This reduces the number of instructions
|
||||
|
@@ -100,16 +100,6 @@ template<
|
||||
*/
|
||||
typename Allocator = GuardedAllocator>
|
||||
class VectorSet {
|
||||
public:
|
||||
using value_type = Key;
|
||||
using pointer = Key *;
|
||||
using const_pointer = const Key *;
|
||||
using reference = Key &;
|
||||
using const_reference = const Key &;
|
||||
using iterator = Key *;
|
||||
using const_iterator = const Key *;
|
||||
using size_type = int64_t;
|
||||
|
||||
private:
|
||||
/**
|
||||
* Slots are either empty, occupied or removed. The number of occupied slots can be computed by
|
||||
|
@@ -147,13 +147,4 @@ TEST(index_range, constexpr_)
|
||||
BLI_STATIC_ASSERT(range.size() == 1, "");
|
||||
EXPECT_EQ(compiles[0], 1);
|
||||
}
|
||||
|
||||
TEST(index_range, GenericAlgorithms)
|
||||
{
|
||||
IndexRange range{4, 10};
|
||||
EXPECT_TRUE(std::any_of(range.begin(), range.end(), [](int v) { return v == 6; }));
|
||||
EXPECT_FALSE(std::any_of(range.begin(), range.end(), [](int v) { return v == 20; }));
|
||||
EXPECT_EQ(std::count_if(range.begin(), range.end(), [](int v) { return v < 7; }), 3);
|
||||
}
|
||||
|
||||
} // namespace blender::tests
|
||||
|
@@ -587,23 +587,6 @@ TEST(map, EnumKey)
|
||||
EXPECT_EQ(map.lookup(TestEnum::B), 10);
|
||||
}
|
||||
|
||||
TEST(map, GenericAlgorithms)
|
||||
{
|
||||
Map<int, int> map;
|
||||
map.add(5, 2);
|
||||
map.add(1, 4);
|
||||
map.add(2, 2);
|
||||
map.add(7, 1);
|
||||
map.add(8, 6);
|
||||
EXPECT_TRUE(std::any_of(map.keys().begin(), map.keys().end(), [](int v) { return v == 1; }));
|
||||
EXPECT_TRUE(std::any_of(map.values().begin(), map.values().end(), [](int v) { return v == 1; }));
|
||||
EXPECT_TRUE(std::any_of(
|
||||
map.items().begin(), map.items().end(), [](auto item) { return item.value == 1; }));
|
||||
EXPECT_EQ(std::count(map.values().begin(), map.values().end(), 2), 2);
|
||||
EXPECT_EQ(std::count(map.values().begin(), map.values().end(), 4), 1);
|
||||
EXPECT_EQ(std::count(map.keys().begin(), map.keys().end(), 7), 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set this to 1 to activate the benchmark. It is disabled by default, because it prints a lot.
|
||||
*/
|
||||
|
@@ -526,24 +526,6 @@ TEST(set, AddExceptions)
|
||||
EXPECT_EQ(set.size(), 0);
|
||||
}
|
||||
|
||||
TEST(set, ForwardIterator)
|
||||
{
|
||||
Set<int> set = {5, 2, 6, 4, 1};
|
||||
Set<int>::iterator iter1 = set.begin();
|
||||
int value1 = *iter1;
|
||||
Set<int>::iterator iter2 = iter1++;
|
||||
EXPECT_EQ(*iter1, value1);
|
||||
EXPECT_EQ(*iter2, *(++iter1));
|
||||
}
|
||||
|
||||
TEST(set, GenericAlgorithms)
|
||||
{
|
||||
Set<int> set = {1, 20, 30, 40};
|
||||
EXPECT_FALSE(std::any_of(set.begin(), set.end(), [](int v) { return v == 5; }));
|
||||
EXPECT_TRUE(std::any_of(set.begin(), set.end(), [](int v) { return v == 30; }));
|
||||
EXPECT_EQ(std::count(set.begin(), set.end(), 20), 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set this to 1 to activate the benchmark. It is disabled by default, because it prints a lot.
|
||||
*/
|
||||
|
@@ -36,7 +36,6 @@
|
||||
#include "DNA_gpencil_modifier_types.h"
|
||||
#include "DNA_gpencil_types.h"
|
||||
#include "DNA_hair_types.h"
|
||||
#include "DNA_light_types.h"
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_modifier_types.h"
|
||||
@@ -1916,12 +1915,5 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
||||
*/
|
||||
{
|
||||
/* Keep this block, even when empty. */
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "Light", "float", "diff_fac")) {
|
||||
LISTBASE_FOREACH (Light *, light, &bmain->lights) {
|
||||
light->diff_fac = 1.0f;
|
||||
light->volume_fac = 1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -102,13 +102,13 @@ extern "C" {
|
||||
* ExecutionGroups that have no viewer-node,
|
||||
* will use a default one.
|
||||
* There are several possible chunk orders
|
||||
* - [@ref ChunkOrdering.CenterOut]:
|
||||
* - [@ref OrderOfChunks.COM_TO_CENTER_OUT]:
|
||||
* Start calculating from a configurable point and order by nearest chunk.
|
||||
* - [@ref ChunkOrdering.Random]:
|
||||
* - [@ref OrderOfChunks.COM_TO_RANDOM]:
|
||||
* Randomize all chunks.
|
||||
* - [@ref ChunkOrdering.TopDown]:
|
||||
* - [@ref OrderOfChunks.COM_TO_TOP_DOWN]:
|
||||
* Start calculation from the bottom to the top of the image.
|
||||
* - [@ref ChunkOrdering.RuleOfThirds]:
|
||||
* - [@ref OrderOfChunks.COM_TO_RULE_OF_THIRDS]:
|
||||
* Experimental order based on 9 hot-spots in the image.
|
||||
*
|
||||
* When the chunk-order is determined, the first few chunks will be checked if they can be scheduled.
|
||||
@@ -122,7 +122,7 @@ extern "C" {
|
||||
*
|
||||
* \see ExecutionGroup.execute
|
||||
* \see ViewerOperation.getChunkOrder
|
||||
* \see ChunkOrdering
|
||||
* \see OrderOfChunks
|
||||
*
|
||||
* \section interest Area of interest
|
||||
* An ExecutionGroup can have dependencies to other ExecutionGroup's.
|
||||
|
@@ -22,41 +22,41 @@
|
||||
* \brief possible data types for sockets
|
||||
* \ingroup Model
|
||||
*/
|
||||
enum class DataType {
|
||||
typedef enum DataType {
|
||||
/** \brief Value data type */
|
||||
Value = 0,
|
||||
COM_DT_VALUE = 1,
|
||||
/** \brief Vector data type */
|
||||
Vector = 1,
|
||||
COM_DT_VECTOR = 2,
|
||||
/** \brief Color data type */
|
||||
Color = 2,
|
||||
};
|
||||
COM_DT_COLOR = 4,
|
||||
} DataType;
|
||||
|
||||
/**
|
||||
* \brief Possible quality settings
|
||||
* \see CompositorContext.quality
|
||||
* \ingroup Execution
|
||||
*/
|
||||
enum class CompositorQuality {
|
||||
typedef enum CompositorQuality {
|
||||
/** \brief High quality setting */
|
||||
High = 0,
|
||||
COM_QUALITY_HIGH = 0,
|
||||
/** \brief Medium quality setting */
|
||||
Medium = 1,
|
||||
COM_QUALITY_MEDIUM = 1,
|
||||
/** \brief Low quality setting */
|
||||
Low = 2,
|
||||
};
|
||||
COM_QUALITY_LOW = 2,
|
||||
} CompositorQuality;
|
||||
|
||||
/**
|
||||
* \brief Possible priority settings
|
||||
* \ingroup Execution
|
||||
*/
|
||||
enum class CompositorPriority {
|
||||
typedef enum CompositorPriority {
|
||||
/** \brief High quality setting */
|
||||
High = 2,
|
||||
COM_PRIORITY_HIGH = 2,
|
||||
/** \brief Medium quality setting */
|
||||
Medium = 1,
|
||||
COM_PRIORITY_MEDIUM = 1,
|
||||
/** \brief Low quality setting */
|
||||
Low = 0,
|
||||
};
|
||||
COM_PRIORITY_LOW = 0,
|
||||
} CompositorPriority;
|
||||
|
||||
// configurable items
|
||||
|
||||
@@ -87,18 +87,18 @@ enum class CompositorPriority {
|
||||
* \brief The order of chunks to be scheduled
|
||||
* \ingroup Execution
|
||||
*/
|
||||
enum class ChunkOrdering {
|
||||
typedef enum OrderOfChunks {
|
||||
/** \brief order from a distance to centerX/centerY */
|
||||
CenterOut = 0,
|
||||
COM_TO_CENTER_OUT = 0,
|
||||
/** \brief order randomly */
|
||||
Random = 1,
|
||||
COM_TO_RANDOM = 1,
|
||||
/** \brief no ordering */
|
||||
TopDown = 2,
|
||||
COM_TO_TOP_DOWN = 2,
|
||||
/** \brief experimental ordering with 9 hot-spots. */
|
||||
RuleOfThirds = 3,
|
||||
COM_TO_RULE_OF_THIRDS = 3,
|
||||
} OrderOfChunks;
|
||||
|
||||
Default = ChunkOrdering::CenterOut,
|
||||
};
|
||||
#define COM_ORDER_OF_CHUNKS_DEFAULT COM_TO_CENTER_OUT
|
||||
|
||||
#define COM_RULE_OF_THIRDS_DIVIDER 100.0f
|
||||
|
||||
|
@@ -17,14 +17,22 @@
|
||||
*/
|
||||
|
||||
#include "COM_ChunkOrder.h"
|
||||
|
||||
#include "BLI_math.h"
|
||||
|
||||
void ChunkOrder::update_distance(ChunkOrderHotspot *hotspots, unsigned int len_hotspots)
|
||||
ChunkOrder::ChunkOrder()
|
||||
{
|
||||
double new_distance = DBL_MAX;
|
||||
distance = 0.0;
|
||||
number = 0;
|
||||
x = 0;
|
||||
y = 0;
|
||||
}
|
||||
|
||||
void ChunkOrder::update_distance(ChunkOrderHotspot **hotspots, unsigned int len_hotspots)
|
||||
{
|
||||
double new_distance = FLT_MAX;
|
||||
for (int index = 0; index < len_hotspots; index++) {
|
||||
double distance_to_hotspot = hotspots[index].calc_distance(x, y);
|
||||
ChunkOrderHotspot *hotspot = hotspots[index];
|
||||
double distance_to_hotspot = hotspot->calc_distance(x, y);
|
||||
if (distance_to_hotspot < new_distance) {
|
||||
new_distance = distance_to_hotspot;
|
||||
}
|
||||
|
@@ -23,17 +23,17 @@
|
||||
#endif
|
||||
|
||||
#include "COM_ChunkOrderHotspot.h"
|
||||
|
||||
/** Helper to determine the order how chunks are prioritized during execution. */
|
||||
struct ChunkOrder {
|
||||
unsigned int index = 0;
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
double distance = 0.0;
|
||||
unsigned int number;
|
||||
int x;
|
||||
int y;
|
||||
double distance;
|
||||
|
||||
ChunkOrder();
|
||||
|
||||
friend bool operator<(const ChunkOrder &a, const ChunkOrder &b);
|
||||
|
||||
void update_distance(ChunkOrderHotspot *hotspots, unsigned int len_hotspots);
|
||||
void update_distance(ChunkOrderHotspot **hotspots, unsigned int len_hotspots);
|
||||
|
||||
#ifdef WITH_CXX_GUARDEDALLOC
|
||||
MEM_CXX_CLASS_ALLOC_FUNCS("COM:ChunkOrderHotspot")
|
||||
|
@@ -24,7 +24,7 @@ CompositorContext::CompositorContext()
|
||||
{
|
||||
this->m_scene = nullptr;
|
||||
this->m_rd = nullptr;
|
||||
this->m_quality = CompositorQuality::High;
|
||||
this->m_quality = COM_QUALITY_HIGH;
|
||||
this->m_hasActiveOpenCLDevices = false;
|
||||
this->m_fastCalculation = false;
|
||||
this->m_viewSettings = nullptr;
|
||||
|
@@ -428,22 +428,22 @@ NodeOperation *COM_convert_data_type(const NodeOperationOutput &from, const Node
|
||||
const DataType src_data_type = from.getDataType();
|
||||
const DataType dst_data_type = to.getDataType();
|
||||
|
||||
if (src_data_type == DataType::Value && dst_data_type == DataType::Color) {
|
||||
if (src_data_type == COM_DT_VALUE && dst_data_type == COM_DT_COLOR) {
|
||||
return new ConvertValueToColorOperation();
|
||||
}
|
||||
if (src_data_type == DataType::Value && dst_data_type == DataType::Vector) {
|
||||
if (src_data_type == COM_DT_VALUE && dst_data_type == COM_DT_VECTOR) {
|
||||
return new ConvertValueToVectorOperation();
|
||||
}
|
||||
if (src_data_type == DataType::Color && dst_data_type == DataType::Value) {
|
||||
if (src_data_type == COM_DT_COLOR && dst_data_type == COM_DT_VALUE) {
|
||||
return new ConvertColorToValueOperation();
|
||||
}
|
||||
if (src_data_type == DataType::Color && dst_data_type == DataType::Vector) {
|
||||
if (src_data_type == COM_DT_COLOR && dst_data_type == COM_DT_VECTOR) {
|
||||
return new ConvertColorToVectorOperation();
|
||||
}
|
||||
if (src_data_type == DataType::Vector && dst_data_type == DataType::Value) {
|
||||
if (src_data_type == COM_DT_VECTOR && dst_data_type == COM_DT_VALUE) {
|
||||
return new ConvertVectorToValueOperation();
|
||||
}
|
||||
if (src_data_type == DataType::Vector && dst_data_type == DataType::Color) {
|
||||
if (src_data_type == COM_DT_VECTOR && dst_data_type == COM_DT_COLOR) {
|
||||
return new ConvertVectorToColorOperation();
|
||||
}
|
||||
|
||||
|
@@ -165,13 +165,13 @@ int DebugInfo::graphviz_operation(const ExecutionSystem *system,
|
||||
}
|
||||
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "<IN_%p>", socket);
|
||||
switch (socket->getDataType()) {
|
||||
case DataType::Value:
|
||||
case COM_DT_VALUE:
|
||||
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "Value");
|
||||
break;
|
||||
case DataType::Vector:
|
||||
case COM_DT_VECTOR:
|
||||
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "Vector");
|
||||
break;
|
||||
case DataType::Color:
|
||||
case COM_DT_COLOR:
|
||||
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "Color");
|
||||
break;
|
||||
}
|
||||
@@ -203,13 +203,13 @@ int DebugInfo::graphviz_operation(const ExecutionSystem *system,
|
||||
}
|
||||
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "<OUT_%p>", socket);
|
||||
switch (socket->getDataType()) {
|
||||
case DataType::Value:
|
||||
case COM_DT_VALUE:
|
||||
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "Value");
|
||||
break;
|
||||
case DataType::Vector:
|
||||
case COM_DT_VECTOR:
|
||||
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "Vector");
|
||||
break;
|
||||
case DataType::Color:
|
||||
case COM_DT_COLOR:
|
||||
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "Color");
|
||||
break;
|
||||
}
|
||||
@@ -390,13 +390,13 @@ bool DebugInfo::graphviz_system(const ExecutionSystem *system, char *str, int ma
|
||||
|
||||
std::string color;
|
||||
switch (from->getDataType()) {
|
||||
case DataType::Value:
|
||||
case COM_DT_VALUE:
|
||||
color = "gray";
|
||||
break;
|
||||
case DataType::Vector:
|
||||
case COM_DT_VECTOR:
|
||||
color = "blue";
|
||||
break;
|
||||
case DataType::Color:
|
||||
case COM_DT_COLOR:
|
||||
color = "orange";
|
||||
break;
|
||||
}
|
||||
|
@@ -34,15 +34,10 @@
|
||||
#include "COM_defines.h"
|
||||
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_rand.hh"
|
||||
#include "BLI_string.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "PIL_time.h"
|
||||
|
||||
#include "WM_api.h"
|
||||
#include "WM_types.h"
|
||||
|
||||
@@ -70,19 +65,19 @@ CompositorPriority ExecutionGroup::getRenderPriotrity()
|
||||
return this->getOutputOperation()->getRenderPriority();
|
||||
}
|
||||
|
||||
bool ExecutionGroup::can_contain(NodeOperation &operation)
|
||||
bool ExecutionGroup::canContainOperation(NodeOperation *operation)
|
||||
{
|
||||
if (!this->m_initialized) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (operation.isReadBufferOperation()) {
|
||||
if (operation->isReadBufferOperation()) {
|
||||
return true;
|
||||
}
|
||||
if (operation.isWriteBufferOperation()) {
|
||||
if (operation->isWriteBufferOperation()) {
|
||||
return false;
|
||||
}
|
||||
if (operation.isSetOperation()) {
|
||||
if (operation->isSetOperation()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -92,7 +87,7 @@ bool ExecutionGroup::can_contain(NodeOperation &operation)
|
||||
}
|
||||
/* complex ops can't be added to other groups (except their own, which they initialize, see
|
||||
* above) */
|
||||
if (operation.isComplex()) {
|
||||
if (operation->isComplex()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -101,7 +96,7 @@ bool ExecutionGroup::can_contain(NodeOperation &operation)
|
||||
|
||||
bool ExecutionGroup::addOperation(NodeOperation *operation)
|
||||
{
|
||||
if (!can_contain(*operation)) {
|
||||
if (!canContainOperation(operation)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -183,103 +178,6 @@ void ExecutionGroup::determineNumberOfChunks()
|
||||
}
|
||||
}
|
||||
|
||||
blender::Array<unsigned int> ExecutionGroup::determine_chunk_execution_order() const
|
||||
{
|
||||
int index;
|
||||
blender::Array<unsigned int> chunk_order(m_chunks_len);
|
||||
for (int chunk_index = 0; chunk_index < this->m_chunks_len; chunk_index++) {
|
||||
chunk_order[chunk_index] = chunk_index;
|
||||
}
|
||||
|
||||
NodeOperation *operation = this->getOutputOperation();
|
||||
float centerX = 0.5f;
|
||||
float centerY = 0.5f;
|
||||
ChunkOrdering order_type = ChunkOrdering::Default;
|
||||
|
||||
if (operation->isViewerOperation()) {
|
||||
ViewerOperation *viewer = (ViewerOperation *)operation;
|
||||
centerX = viewer->getCenterX();
|
||||
centerY = viewer->getCenterY();
|
||||
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);
|
||||
|
||||
switch (order_type) {
|
||||
case ChunkOrdering::Random: {
|
||||
static blender::RandomNumberGenerator rng;
|
||||
blender::MutableSpan<unsigned int> span = chunk_order.as_mutable_span();
|
||||
/* Shuffle twice to make it more random. */
|
||||
rng.shuffle(span);
|
||||
rng.shuffle(span);
|
||||
break;
|
||||
}
|
||||
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++) {
|
||||
rcti rect;
|
||||
determineChunkRect(&rect, index);
|
||||
chunk_orders[index].index = index;
|
||||
chunk_orders[index].x = rect.xmin - this->m_viewerBorder.xmin;
|
||||
chunk_orders[index].y = rect.ymin - this->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++) {
|
||||
chunk_order[index] = chunk_orders[index].index;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case ChunkOrdering::RuleOfThirds: {
|
||||
unsigned int tx = border_width / 6;
|
||||
unsigned int ty = border_height / 6;
|
||||
unsigned int mx = border_width / 2;
|
||||
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;
|
||||
|
||||
ChunkOrderHotspot hotspots[9]{
|
||||
ChunkOrderHotspot(mx, my, addition * 0),
|
||||
ChunkOrderHotspot(tx, my, addition * 1),
|
||||
ChunkOrderHotspot(bx, my, addition * 2),
|
||||
ChunkOrderHotspot(bx, by, addition * 3),
|
||||
ChunkOrderHotspot(tx, ty, addition * 4),
|
||||
ChunkOrderHotspot(bx, ty, addition * 5),
|
||||
ChunkOrderHotspot(tx, by, addition * 6),
|
||||
ChunkOrderHotspot(mx, ty, addition * 7),
|
||||
ChunkOrderHotspot(mx, by, addition * 8),
|
||||
};
|
||||
|
||||
blender::Array<ChunkOrder> chunk_orders(m_chunks_len);
|
||||
for (index = 0; index < this->m_chunks_len; index++) {
|
||||
rcti rect;
|
||||
determineChunkRect(&rect, index);
|
||||
chunk_orders[index].index = index;
|
||||
chunk_orders[index].x = rect.xmin - this->m_viewerBorder.xmin;
|
||||
chunk_orders[index].y = rect.ymin - this->m_viewerBorder.ymin;
|
||||
chunk_orders[index].update_distance(hotspots, 9);
|
||||
}
|
||||
|
||||
std::sort(&chunk_orders[0], &chunk_orders[this->m_chunks_len]);
|
||||
|
||||
for (index = 0; index < this->m_chunks_len; index++) {
|
||||
chunk_order[index] = chunk_orders[index].index;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case ChunkOrdering::TopDown:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return chunk_order;
|
||||
}
|
||||
|
||||
/**
|
||||
* this method is called for the top execution groups. containing the compositor node or the
|
||||
* preview node or the viewer node)
|
||||
@@ -297,15 +195,119 @@ void ExecutionGroup::execute(ExecutionSystem *graph)
|
||||
if (this->m_chunks_len == 0) {
|
||||
return;
|
||||
} /** \note Early break out. */
|
||||
unsigned int chunk_index;
|
||||
unsigned int chunkNumber;
|
||||
|
||||
this->m_executionStartTime = PIL_check_seconds_timer();
|
||||
|
||||
this->m_chunks_finished = 0;
|
||||
this->m_bTree = bTree;
|
||||
unsigned int index;
|
||||
unsigned int *chunkOrder = (unsigned int *)MEM_mallocN(sizeof(unsigned int) * this->m_chunks_len,
|
||||
__func__);
|
||||
|
||||
blender::Array<unsigned int> chunk_order = determine_chunk_execution_order();
|
||||
for (chunkNumber = 0; chunkNumber < this->m_chunks_len; chunkNumber++) {
|
||||
chunkOrder[chunkNumber] = chunkNumber;
|
||||
}
|
||||
NodeOperation *operation = this->getOutputOperation();
|
||||
float centerX = 0.5;
|
||||
float centerY = 0.5;
|
||||
OrderOfChunks chunkorder = COM_ORDER_OF_CHUNKS_DEFAULT;
|
||||
|
||||
if (operation->isViewerOperation()) {
|
||||
ViewerOperation *viewer = (ViewerOperation *)operation;
|
||||
centerX = viewer->getCenterX();
|
||||
centerY = viewer->getCenterY();
|
||||
chunkorder = viewer->getChunkOrder();
|
||||
}
|
||||
|
||||
const int border_width = BLI_rcti_size_x(&this->m_viewerBorder);
|
||||
const int border_height = BLI_rcti_size_y(&this->m_viewerBorder);
|
||||
|
||||
switch (chunkorder) {
|
||||
case COM_TO_RANDOM:
|
||||
for (index = 0; index < 2 * this->m_chunks_len; index++) {
|
||||
int index1 = rand() % this->m_chunks_len;
|
||||
int index2 = rand() % this->m_chunks_len;
|
||||
int s = chunkOrder[index1];
|
||||
chunkOrder[index1] = chunkOrder[index2];
|
||||
chunkOrder[index2] = s;
|
||||
}
|
||||
break;
|
||||
case COM_TO_CENTER_OUT: {
|
||||
ChunkOrderHotspot *hotspots[1];
|
||||
hotspots[0] = new ChunkOrderHotspot(border_width * centerX, border_height * centerY, 0.0f);
|
||||
rcti rect;
|
||||
ChunkOrder *chunkOrders = (ChunkOrder *)MEM_mallocN(sizeof(ChunkOrder) * this->m_chunks_len,
|
||||
__func__);
|
||||
for (index = 0; index < this->m_chunks_len; index++) {
|
||||
determineChunkRect(&rect, index);
|
||||
chunkOrders[index].number = index;
|
||||
chunkOrders[index].x = rect.xmin - this->m_viewerBorder.xmin;
|
||||
chunkOrders[index].y = rect.ymin - this->m_viewerBorder.ymin;
|
||||
chunkOrders[index].update_distance(hotspots, 1);
|
||||
}
|
||||
|
||||
std::sort(&chunkOrders[0], &chunkOrders[this->m_chunks_len - 1]);
|
||||
for (index = 0; index < this->m_chunks_len; index++) {
|
||||
chunkOrder[index] = chunkOrders[index].number;
|
||||
}
|
||||
|
||||
delete hotspots[0];
|
||||
MEM_freeN(chunkOrders);
|
||||
break;
|
||||
}
|
||||
case COM_TO_RULE_OF_THIRDS: {
|
||||
ChunkOrderHotspot *hotspots[9];
|
||||
unsigned int tx = border_width / 6;
|
||||
unsigned int ty = border_height / 6;
|
||||
unsigned int mx = border_width / 2;
|
||||
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;
|
||||
hotspots[0] = new ChunkOrderHotspot(mx, my, addition * 0);
|
||||
hotspots[1] = new ChunkOrderHotspot(tx, my, addition * 1);
|
||||
hotspots[2] = new ChunkOrderHotspot(bx, my, addition * 2);
|
||||
hotspots[3] = new ChunkOrderHotspot(bx, by, addition * 3);
|
||||
hotspots[4] = new ChunkOrderHotspot(tx, ty, addition * 4);
|
||||
hotspots[5] = new ChunkOrderHotspot(bx, ty, addition * 5);
|
||||
hotspots[6] = new ChunkOrderHotspot(tx, by, addition * 6);
|
||||
hotspots[7] = new ChunkOrderHotspot(mx, ty, addition * 7);
|
||||
hotspots[8] = new ChunkOrderHotspot(mx, by, addition * 8);
|
||||
rcti rect;
|
||||
ChunkOrder *chunkOrders = (ChunkOrder *)MEM_mallocN(sizeof(ChunkOrder) * this->m_chunks_len,
|
||||
__func__);
|
||||
for (index = 0; index < this->m_chunks_len; index++) {
|
||||
determineChunkRect(&rect, index);
|
||||
chunkOrders[index].number = index;
|
||||
chunkOrders[index].x = rect.xmin - this->m_viewerBorder.xmin;
|
||||
chunkOrders[index].y = rect.ymin - this->m_viewerBorder.ymin;
|
||||
chunkOrders[index].update_distance(hotspots, 9);
|
||||
}
|
||||
|
||||
std::sort(&chunkOrders[0], &chunkOrders[this->m_chunks_len]);
|
||||
|
||||
for (index = 0; index < this->m_chunks_len; index++) {
|
||||
chunkOrder[index] = chunkOrders[index].number;
|
||||
}
|
||||
|
||||
delete hotspots[0];
|
||||
delete hotspots[1];
|
||||
delete hotspots[2];
|
||||
delete hotspots[3];
|
||||
delete hotspots[4];
|
||||
delete hotspots[5];
|
||||
delete hotspots[6];
|
||||
delete hotspots[7];
|
||||
delete hotspots[8];
|
||||
MEM_freeN(chunkOrders);
|
||||
break;
|
||||
}
|
||||
case COM_TO_TOP_DOWN:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
DebugInfo::execution_group_started(this);
|
||||
DebugInfo::graphviz(graph);
|
||||
@@ -322,10 +324,10 @@ void ExecutionGroup::execute(ExecutionSystem *graph)
|
||||
|
||||
for (index = startIndex; index < this->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);
|
||||
switch (m_chunk_execution_states[chunk_index]) {
|
||||
chunkNumber = chunkOrder[index];
|
||||
int yChunk = chunkNumber / this->m_x_chunks_len;
|
||||
int xChunk = chunkNumber - (yChunk * this->m_x_chunks_len);
|
||||
switch (m_chunk_execution_states[chunkNumber]) {
|
||||
case eChunkExecutionState::NOT_SCHEDULED: {
|
||||
scheduleChunkWhenPossible(graph, xChunk, yChunk);
|
||||
finished = false;
|
||||
@@ -359,13 +361,17 @@ void ExecutionGroup::execute(ExecutionSystem *graph)
|
||||
}
|
||||
DebugInfo::execution_group_finished(this);
|
||||
DebugInfo::graphviz(graph);
|
||||
|
||||
MEM_freeN(chunkOrder);
|
||||
}
|
||||
|
||||
MemoryBuffer **ExecutionGroup::getInputBuffersOpenCL(int chunkNumber)
|
||||
{
|
||||
rcti rect;
|
||||
std::vector<MemoryProxy *> memoryproxies;
|
||||
determineChunkRect(&rect, chunkNumber);
|
||||
|
||||
this->determineDependingMemoryProxies(&memoryproxies);
|
||||
MemoryBuffer **memoryBuffers = (MemoryBuffer **)MEM_callocN(
|
||||
sizeof(MemoryBuffer *) * this->m_max_read_buffer_offset, __func__);
|
||||
rcti output;
|
||||
@@ -373,18 +379,18 @@ MemoryBuffer **ExecutionGroup::getInputBuffersOpenCL(int chunkNumber)
|
||||
MemoryProxy *memoryProxy = readOperation->getMemoryProxy();
|
||||
this->determineDependingAreaOfInterest(&rect, readOperation, &output);
|
||||
MemoryBuffer *memoryBuffer = memoryProxy->getExecutor()->constructConsolidatedMemoryBuffer(
|
||||
*memoryProxy, output);
|
||||
memoryProxy, &output);
|
||||
memoryBuffers[readOperation->getOffset()] = memoryBuffer;
|
||||
}
|
||||
return memoryBuffers;
|
||||
}
|
||||
|
||||
MemoryBuffer *ExecutionGroup::constructConsolidatedMemoryBuffer(MemoryProxy &memoryProxy,
|
||||
rcti &rect)
|
||||
MemoryBuffer *ExecutionGroup::constructConsolidatedMemoryBuffer(MemoryProxy *memoryProxy,
|
||||
rcti *rect)
|
||||
{
|
||||
MemoryBuffer *imageBuffer = memoryProxy.getBuffer();
|
||||
MemoryBuffer *result = new MemoryBuffer(&memoryProxy, rect, MemoryBufferState::Temporary);
|
||||
result->fill_from(*imageBuffer);
|
||||
MemoryBuffer *imageBuffer = memoryProxy->getBuffer();
|
||||
MemoryBuffer *result = new MemoryBuffer(memoryProxy, rect);
|
||||
result->copyContentFrom(imageBuffer);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -454,14 +460,13 @@ void ExecutionGroup::determineChunkRect(rcti *rect, const unsigned int chunkNumb
|
||||
determineChunkRect(rect, xChunk, yChunk);
|
||||
}
|
||||
|
||||
MemoryBuffer *ExecutionGroup::allocateOutputBuffer(rcti &rect)
|
||||
MemoryBuffer *ExecutionGroup::allocateOutputBuffer(int /*chunkNumber*/, rcti *rect)
|
||||
{
|
||||
// we assume that this method is only called from complex execution groups.
|
||||
NodeOperation *operation = this->getOutputOperation();
|
||||
if (operation->isWriteBufferOperation()) {
|
||||
WriteBufferOperation *writeOperation = (WriteBufferOperation *)operation;
|
||||
MemoryBuffer *buffer = new MemoryBuffer(
|
||||
writeOperation->getMemoryProxy(), rect, MemoryBufferState::Temporary);
|
||||
MemoryBuffer *buffer = new MemoryBuffer(writeOperation->getMemoryProxy(), rect);
|
||||
return buffer;
|
||||
}
|
||||
return nullptr;
|
||||
@@ -511,44 +516,54 @@ bool ExecutionGroup::scheduleChunk(unsigned int chunkNumber)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ExecutionGroup::scheduleChunkWhenPossible(ExecutionSystem *graph,
|
||||
const int chunk_x,
|
||||
const int chunk_y)
|
||||
bool ExecutionGroup::scheduleChunkWhenPossible(ExecutionSystem *graph, int xChunk, int yChunk)
|
||||
{
|
||||
if (chunk_x < 0 || chunk_x >= (int)this->m_x_chunks_len) {
|
||||
if (xChunk < 0 || xChunk >= (int)this->m_x_chunks_len) {
|
||||
return true;
|
||||
}
|
||||
if (chunk_y < 0 || chunk_y >= (int)this->m_y_chunks_len) {
|
||||
if (yChunk < 0 || yChunk >= (int)this->m_y_chunks_len) {
|
||||
return true;
|
||||
}
|
||||
int chunkNumber = yChunk * this->m_x_chunks_len + xChunk;
|
||||
// chunk is already executed
|
||||
if (this->m_chunk_execution_states[chunkNumber] == eChunkExecutionState::EXECUTED) {
|
||||
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;
|
||||
if (this->m_chunk_execution_states[chunk_index] == eChunkExecutionState::EXECUTED) {
|
||||
return true;
|
||||
}
|
||||
if (this->m_chunk_execution_states[chunk_index] == eChunkExecutionState::SCHEDULED) {
|
||||
// chunk is scheduled, but not executed
|
||||
if (this->m_chunk_execution_states[chunkNumber] == eChunkExecutionState::SCHEDULED) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// chunk is nor executed nor scheduled.
|
||||
std::vector<MemoryProxy *> memoryProxies;
|
||||
this->determineDependingMemoryProxies(&memoryProxies);
|
||||
|
||||
rcti rect;
|
||||
determineChunkRect(&rect, chunk_x, chunk_y);
|
||||
bool can_be_executed = true;
|
||||
determineChunkRect(&rect, xChunk, yChunk);
|
||||
unsigned int index;
|
||||
bool canBeExecuted = true;
|
||||
rcti area;
|
||||
|
||||
for (ReadBufferOperation *read_operation : m_read_operations) {
|
||||
for (index = 0; index < m_read_operations.size(); index++) {
|
||||
ReadBufferOperation *readOperation = m_read_operations[index];
|
||||
BLI_rcti_init(&area, 0, 0, 0, 0);
|
||||
MemoryProxy *memory_proxy = read_operation->getMemoryProxy();
|
||||
determineDependingAreaOfInterest(&rect, read_operation, &area);
|
||||
ExecutionGroup *group = memory_proxy->getExecutor();
|
||||
MemoryProxy *memoryProxy = memoryProxies[index];
|
||||
determineDependingAreaOfInterest(&rect, readOperation, &area);
|
||||
ExecutionGroup *group = memoryProxy->getExecutor();
|
||||
|
||||
if (group != nullptr) {
|
||||
if (!group->scheduleAreaWhenPossible(graph, &area)) {
|
||||
can_be_executed = false;
|
||||
canBeExecuted = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw "ERROR";
|
||||
}
|
||||
}
|
||||
|
||||
if (can_be_executed) {
|
||||
scheduleChunk(chunk_index);
|
||||
if (canBeExecuted) {
|
||||
scheduleChunk(chunkNumber);
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -561,6 +576,13 @@ void ExecutionGroup::determineDependingAreaOfInterest(rcti *input,
|
||||
this->getOutputOperation()->determineDependingAreaOfInterest(input, readOperation, output);
|
||||
}
|
||||
|
||||
void ExecutionGroup::determineDependingMemoryProxies(std::vector<MemoryProxy *> *memoryProxies)
|
||||
{
|
||||
for (ReadBufferOperation *readOperation : m_read_operations) {
|
||||
memoryProxies->push_back(readOperation->getMemoryProxy());
|
||||
}
|
||||
}
|
||||
|
||||
bool ExecutionGroup::isOpenCL()
|
||||
{
|
||||
return this->m_openCL;
|
||||
|
@@ -22,7 +22,6 @@
|
||||
# include "MEM_guardedalloc.h"
|
||||
#endif
|
||||
|
||||
#include "BLI_array.hh"
|
||||
#include "BLI_rect.h"
|
||||
#include "BLI_vector.hh"
|
||||
|
||||
@@ -184,7 +183,7 @@ class ExecutionGroup {
|
||||
* \brief check whether parameter operation can be added to the execution group
|
||||
* \param operation: the operation to be added
|
||||
*/
|
||||
bool can_contain(NodeOperation &operation);
|
||||
bool canContainOperation(NodeOperation *operation);
|
||||
|
||||
/**
|
||||
* \brief calculate the actual chunk size of this execution group.
|
||||
@@ -218,7 +217,7 @@ class ExecutionGroup {
|
||||
* true: package(s) are scheduled
|
||||
* false: scheduling is deferred (depending workpackages are scheduled)
|
||||
*/
|
||||
bool scheduleChunkWhenPossible(ExecutionSystem *graph, const int chunk_x, const int chunk_y);
|
||||
bool scheduleChunkWhenPossible(ExecutionSystem *graph, int xChunk, int yChunk);
|
||||
|
||||
/**
|
||||
* \brief try to schedule a specific area.
|
||||
@@ -249,11 +248,6 @@ class ExecutionGroup {
|
||||
ReadBufferOperation *readOperation,
|
||||
rcti *output);
|
||||
|
||||
/**
|
||||
* Return the execution order of the user visible chunks.
|
||||
*/
|
||||
blender::Array<unsigned int> determine_chunk_execution_order() const;
|
||||
|
||||
public:
|
||||
// constructors
|
||||
ExecutionGroup();
|
||||
@@ -339,7 +333,7 @@ class ExecutionGroup {
|
||||
* \brief compose multiple chunks into a single chunk
|
||||
* \return Memorybuffer *consolidated chunk
|
||||
*/
|
||||
MemoryBuffer *constructConsolidatedMemoryBuffer(MemoryProxy &memoryProxy, rcti &rect);
|
||||
MemoryBuffer *constructConsolidatedMemoryBuffer(MemoryProxy *memoryProxy, rcti *rect);
|
||||
|
||||
/**
|
||||
* \brief initExecution is called just before the execution of the whole graph will be done.
|
||||
@@ -369,7 +363,7 @@ class ExecutionGroup {
|
||||
* \param rect: the rect of that chunk
|
||||
* \see determineChunkRect
|
||||
*/
|
||||
MemoryBuffer *allocateOutputBuffer(rcti &rect);
|
||||
MemoryBuffer *allocateOutputBuffer(int chunkNumber, rcti *rect);
|
||||
|
||||
/**
|
||||
* \brief after a chunk is executed the needed resources can be freed or unlocked.
|
||||
@@ -402,6 +396,14 @@ class ExecutionGroup {
|
||||
*/
|
||||
void execute(ExecutionSystem *graph);
|
||||
|
||||
/**
|
||||
* \brief this method determines the MemoryProxy's where this execution group depends on.
|
||||
* \note After this method determineDependingAreaOfInterest can be called to determine
|
||||
* \note the area of the MemoryProxy.creator that has to be executed.
|
||||
* \param memoryProxies: result
|
||||
*/
|
||||
void determineDependingMemoryProxies(std::vector<MemoryProxy *> *memoryProxies);
|
||||
|
||||
/**
|
||||
* \brief Determine the rect (minx, maxx, miny, maxy) of a chunk.
|
||||
* \note Only gives useful results after the determination of the chunksize
|
||||
|
@@ -177,10 +177,10 @@ void ExecutionSystem::execute()
|
||||
|
||||
WorkScheduler::start(this->m_context);
|
||||
|
||||
execute_groups(CompositorPriority::High);
|
||||
execute_groups(COM_PRIORITY_HIGH);
|
||||
if (!this->getContext().isFastCalculation()) {
|
||||
execute_groups(CompositorPriority::Medium);
|
||||
execute_groups(CompositorPriority::Low);
|
||||
execute_groups(COM_PRIORITY_MEDIUM);
|
||||
execute_groups(COM_PRIORITY_LOW);
|
||||
}
|
||||
|
||||
WorkScheduler::finish();
|
||||
|
@@ -64,8 +64,8 @@ class ExecutionGroup;
|
||||
* \see NodeOperation base class for all operations in the system
|
||||
*
|
||||
* \section EM_Step3 Step3: add additional conversions to the operation system
|
||||
* - Data type conversions: the system has 3 data types DataType::Value, DataType::Vector,
|
||||
* DataType::Color. The user can connect a Value socket to a color socket. As values are ordered
|
||||
* - Data type conversions: the system has 3 data types COM_DT_VALUE, COM_DT_VECTOR,
|
||||
* COM_DT_COLOR. The user can connect a Value socket to a color socket. As values are ordered
|
||||
* differently than colors a conversion happens.
|
||||
*
|
||||
* - Image size conversions: the system can automatically convert when resolutions do not match.
|
||||
|
@@ -23,53 +23,88 @@
|
||||
static unsigned int determine_num_channels(DataType datatype)
|
||||
{
|
||||
switch (datatype) {
|
||||
case DataType::Value:
|
||||
case COM_DT_VALUE:
|
||||
return COM_NUM_CHANNELS_VALUE;
|
||||
case DataType::Vector:
|
||||
case COM_DT_VECTOR:
|
||||
return COM_NUM_CHANNELS_VECTOR;
|
||||
case DataType::Color:
|
||||
case COM_DT_COLOR:
|
||||
default:
|
||||
return COM_NUM_CHANNELS_COLOR;
|
||||
}
|
||||
}
|
||||
|
||||
MemoryBuffer::MemoryBuffer(MemoryProxy *memoryProxy, const rcti &rect, MemoryBufferState state)
|
||||
unsigned int MemoryBuffer::determineBufferSize()
|
||||
{
|
||||
m_rect = rect;
|
||||
return getWidth() * getHeight();
|
||||
}
|
||||
|
||||
int MemoryBuffer::getWidth() const
|
||||
{
|
||||
return this->m_width;
|
||||
}
|
||||
int MemoryBuffer::getHeight() const
|
||||
{
|
||||
return this->m_height;
|
||||
}
|
||||
|
||||
MemoryBuffer::MemoryBuffer(MemoryProxy *memoryProxy, unsigned int chunkNumber, rcti *rect)
|
||||
{
|
||||
BLI_rcti_init(&this->m_rect, rect->xmin, rect->xmax, rect->ymin, rect->ymax);
|
||||
this->m_width = BLI_rcti_size_x(&this->m_rect);
|
||||
this->m_height = BLI_rcti_size_y(&this->m_rect);
|
||||
this->m_memoryProxy = memoryProxy;
|
||||
this->m_chunkNumber = chunkNumber;
|
||||
this->m_num_channels = determine_num_channels(memoryProxy->getDataType());
|
||||
this->m_buffer = (float *)MEM_mallocN_aligned(
|
||||
sizeof(float) * buffer_len() * this->m_num_channels, 16, "COM_MemoryBuffer");
|
||||
this->m_state = state;
|
||||
sizeof(float) * determineBufferSize() * this->m_num_channels, 16, "COM_MemoryBuffer");
|
||||
this->m_state = COM_MB_ALLOCATED;
|
||||
this->m_datatype = memoryProxy->getDataType();
|
||||
}
|
||||
|
||||
MemoryBuffer::MemoryBuffer(DataType dataType, const rcti &rect)
|
||||
MemoryBuffer::MemoryBuffer(MemoryProxy *memoryProxy, rcti *rect)
|
||||
{
|
||||
m_rect = rect;
|
||||
BLI_rcti_init(&this->m_rect, rect->xmin, rect->xmax, rect->ymin, rect->ymax);
|
||||
this->m_width = BLI_rcti_size_x(&this->m_rect);
|
||||
this->m_height = BLI_rcti_size_y(&this->m_rect);
|
||||
this->m_memoryProxy = memoryProxy;
|
||||
this->m_chunkNumber = -1;
|
||||
this->m_num_channels = determine_num_channels(memoryProxy->getDataType());
|
||||
this->m_buffer = (float *)MEM_mallocN_aligned(
|
||||
sizeof(float) * determineBufferSize() * this->m_num_channels, 16, "COM_MemoryBuffer");
|
||||
this->m_state = COM_MB_TEMPORARILY;
|
||||
this->m_datatype = memoryProxy->getDataType();
|
||||
}
|
||||
MemoryBuffer::MemoryBuffer(DataType dataType, rcti *rect)
|
||||
{
|
||||
BLI_rcti_init(&this->m_rect, rect->xmin, rect->xmax, rect->ymin, rect->ymax);
|
||||
this->m_width = BLI_rcti_size_x(&this->m_rect);
|
||||
this->m_height = BLI_rcti_size_y(&this->m_rect);
|
||||
this->m_height = this->m_rect.ymax - this->m_rect.ymin;
|
||||
this->m_memoryProxy = nullptr;
|
||||
this->m_chunkNumber = -1;
|
||||
this->m_num_channels = determine_num_channels(dataType);
|
||||
this->m_buffer = (float *)MEM_mallocN_aligned(
|
||||
sizeof(float) * buffer_len() * this->m_num_channels, 16, "COM_MemoryBuffer");
|
||||
this->m_state = MemoryBufferState::Temporary;
|
||||
sizeof(float) * determineBufferSize() * this->m_num_channels, 16, "COM_MemoryBuffer");
|
||||
this->m_state = COM_MB_TEMPORARILY;
|
||||
this->m_datatype = dataType;
|
||||
}
|
||||
|
||||
MemoryBuffer::MemoryBuffer(const MemoryBuffer &src)
|
||||
: MemoryBuffer(src.m_memoryProxy, src.m_rect, MemoryBufferState::Temporary)
|
||||
MemoryBuffer *MemoryBuffer::duplicate()
|
||||
{
|
||||
memcpy(m_buffer, src.m_buffer, buffer_len() * m_num_channels * sizeof(float));
|
||||
MemoryBuffer *result = new MemoryBuffer(this->m_memoryProxy, &this->m_rect);
|
||||
memcpy(result->m_buffer,
|
||||
this->m_buffer,
|
||||
this->determineBufferSize() * this->m_num_channels * sizeof(float));
|
||||
return result;
|
||||
}
|
||||
|
||||
void MemoryBuffer::clear()
|
||||
{
|
||||
memset(m_buffer, 0, buffer_len() * m_num_channels * sizeof(float));
|
||||
memset(this->m_buffer, 0, this->determineBufferSize() * this->m_num_channels * sizeof(float));
|
||||
}
|
||||
|
||||
float MemoryBuffer::get_max_value() const
|
||||
float MemoryBuffer::getMaximumValue()
|
||||
{
|
||||
float result = this->m_buffer[0];
|
||||
const unsigned int size = this->buffer_len();
|
||||
const unsigned int size = this->determineBufferSize();
|
||||
unsigned int i;
|
||||
|
||||
const float *fp_src = this->m_buffer;
|
||||
@@ -84,17 +119,19 @@ float MemoryBuffer::get_max_value() const
|
||||
return result;
|
||||
}
|
||||
|
||||
float MemoryBuffer::get_max_value(const rcti &rect) const
|
||||
float MemoryBuffer::getMaximumValue(rcti *rect)
|
||||
{
|
||||
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, &this->m_rect, &rect_clamp);
|
||||
|
||||
if (!BLI_rcti_is_empty(&rect_clamp)) {
|
||||
MemoryBuffer temp_buffer(this->m_datatype, rect_clamp);
|
||||
temp_buffer.fill_from(*this);
|
||||
return temp_buffer.get_max_value();
|
||||
MemoryBuffer *temp = new MemoryBuffer(this->m_datatype, &rect_clamp);
|
||||
temp->copyContentFrom(this);
|
||||
float result = temp->getMaximumValue();
|
||||
delete temp;
|
||||
return result;
|
||||
}
|
||||
|
||||
BLI_assert(0);
|
||||
@@ -109,23 +146,28 @@ MemoryBuffer::~MemoryBuffer()
|
||||
}
|
||||
}
|
||||
|
||||
void MemoryBuffer::fill_from(const MemoryBuffer &src)
|
||||
void MemoryBuffer::copyContentFrom(MemoryBuffer *otherBuffer)
|
||||
{
|
||||
if (!otherBuffer) {
|
||||
BLI_assert(0);
|
||||
return;
|
||||
}
|
||||
unsigned int otherY;
|
||||
unsigned int minX = MAX2(this->m_rect.xmin, src.m_rect.xmin);
|
||||
unsigned int maxX = MIN2(this->m_rect.xmax, src.m_rect.xmax);
|
||||
unsigned int minY = MAX2(this->m_rect.ymin, src.m_rect.ymin);
|
||||
unsigned int maxY = MIN2(this->m_rect.ymax, src.m_rect.ymax);
|
||||
unsigned int minX = MAX2(this->m_rect.xmin, otherBuffer->m_rect.xmin);
|
||||
unsigned int maxX = MIN2(this->m_rect.xmax, otherBuffer->m_rect.xmax);
|
||||
unsigned int minY = MAX2(this->m_rect.ymin, otherBuffer->m_rect.ymin);
|
||||
unsigned int maxY = MIN2(this->m_rect.ymax, otherBuffer->m_rect.ymax);
|
||||
int offset;
|
||||
int otherOffset;
|
||||
|
||||
for (otherY = minY; otherY < maxY; otherY++) {
|
||||
otherOffset = ((otherY - src.m_rect.ymin) * src.getWidth() + minX - src.m_rect.xmin) *
|
||||
otherOffset = ((otherY - otherBuffer->m_rect.ymin) * otherBuffer->m_width + minX -
|
||||
otherBuffer->m_rect.xmin) *
|
||||
this->m_num_channels;
|
||||
offset = ((otherY - this->m_rect.ymin) * getWidth() + minX - this->m_rect.xmin) *
|
||||
offset = ((otherY - this->m_rect.ymin) * this->m_width + minX - this->m_rect.xmin) *
|
||||
this->m_num_channels;
|
||||
memcpy(&this->m_buffer[offset],
|
||||
&src.m_buffer[otherOffset],
|
||||
&otherBuffer->m_buffer[otherOffset],
|
||||
(maxX - minX) * this->m_num_channels * sizeof(float));
|
||||
}
|
||||
}
|
||||
@@ -134,7 +176,7 @@ 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) {
|
||||
const int offset = (getWidth() * (y - this->m_rect.ymin) + x - this->m_rect.xmin) *
|
||||
const int offset = (this->m_width * (y - this->m_rect.ymin) + x - this->m_rect.xmin) *
|
||||
this->m_num_channels;
|
||||
memcpy(&this->m_buffer[offset], color, sizeof(float) * this->m_num_channels);
|
||||
}
|
||||
@@ -144,7 +186,7 @@ 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) {
|
||||
const int offset = (getWidth() * (y - this->m_rect.ymin) + x - this->m_rect.xmin) *
|
||||
const int offset = (this->m_width * (y - this->m_rect.ymin) + x - this->m_rect.xmin) *
|
||||
this->m_num_channels;
|
||||
float *dst = &this->m_buffer[offset];
|
||||
const float *src = color;
|
||||
@@ -162,7 +204,7 @@ 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])
|
||||
{
|
||||
BLI_assert(this->m_datatype == DataType::Color);
|
||||
BLI_assert(this->m_datatype == COM_DT_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
|
||||
|
@@ -31,19 +31,21 @@ class MemoryBuffer;
|
||||
* \brief state of a memory buffer
|
||||
* \ingroup Memory
|
||||
*/
|
||||
enum class MemoryBufferState {
|
||||
typedef enum MemoryBufferState {
|
||||
/** \brief memory has been allocated on creator device and CPU machine,
|
||||
* but kernel has not been executed */
|
||||
Default = 0,
|
||||
COM_MB_ALLOCATED = 1,
|
||||
/** \brief memory is available for use, content has been created */
|
||||
COM_MB_AVAILABLE = 2,
|
||||
/** \brief chunk is consolidated from other chunks. special state.*/
|
||||
Temporary = 6,
|
||||
};
|
||||
COM_MB_TEMPORARILY = 6,
|
||||
} MemoryBufferState;
|
||||
|
||||
enum class MemoryBufferExtend {
|
||||
Clip,
|
||||
Extend,
|
||||
Repeat,
|
||||
};
|
||||
typedef enum MemoryBufferExtend {
|
||||
COM_MB_CLIP,
|
||||
COM_MB_EXTEND,
|
||||
COM_MB_REPEAT,
|
||||
} MemoryBufferExtend;
|
||||
|
||||
class MemoryProxy;
|
||||
|
||||
@@ -58,7 +60,7 @@ class MemoryBuffer {
|
||||
MemoryProxy *m_memoryProxy;
|
||||
|
||||
/**
|
||||
* \brief the type of buffer DataType::Value, DataType::Vector, DataType::Color
|
||||
* \brief the type of buffer COM_DT_VALUE, COM_DT_VECTOR, COM_DT_COLOR
|
||||
*/
|
||||
DataType m_datatype;
|
||||
|
||||
@@ -67,6 +69,12 @@ class MemoryBuffer {
|
||||
*/
|
||||
rcti m_rect;
|
||||
|
||||
/**
|
||||
* brief refers to the chunk-number within the execution-group where related to the MemoryProxy
|
||||
* \see memoryProxy
|
||||
*/
|
||||
unsigned int m_chunkNumber;
|
||||
|
||||
/**
|
||||
* \brief state of the buffer
|
||||
*/
|
||||
@@ -81,30 +89,41 @@ class MemoryBuffer {
|
||||
* \brief the number of channels of a single value in the buffer.
|
||||
* For value buffers this is 1, vector 3 and color 4
|
||||
*/
|
||||
uint8_t m_num_channels;
|
||||
unsigned int m_num_channels;
|
||||
|
||||
int m_width;
|
||||
int m_height;
|
||||
|
||||
public:
|
||||
/**
|
||||
* \brief construct new temporarily MemoryBuffer for an area
|
||||
* \brief construct new MemoryBuffer for a chunk
|
||||
*/
|
||||
MemoryBuffer(MemoryProxy *memoryProxy, const rcti &rect, MemoryBufferState state);
|
||||
MemoryBuffer(MemoryProxy *memoryProxy, unsigned int chunkNumber, rcti *rect);
|
||||
|
||||
/**
|
||||
* \brief construct new temporarily MemoryBuffer for an area
|
||||
*/
|
||||
MemoryBuffer(DataType datatype, const rcti &rect);
|
||||
MemoryBuffer(MemoryProxy *memoryProxy, rcti *rect);
|
||||
|
||||
/**
|
||||
* Copy constructor
|
||||
* \brief construct new temporarily MemoryBuffer for an area
|
||||
*/
|
||||
MemoryBuffer(const MemoryBuffer &src);
|
||||
MemoryBuffer(DataType datatype, rcti *rect);
|
||||
|
||||
/**
|
||||
* \brief destructor
|
||||
*/
|
||||
~MemoryBuffer();
|
||||
|
||||
uint8_t get_num_channels()
|
||||
/**
|
||||
* \brief read the ChunkNumber of this MemoryBuffer
|
||||
*/
|
||||
unsigned int getChunkNumber()
|
||||
{
|
||||
return this->m_chunkNumber;
|
||||
}
|
||||
|
||||
unsigned int get_num_channels()
|
||||
{
|
||||
return this->m_num_channels;
|
||||
}
|
||||
@@ -118,17 +137,25 @@ class MemoryBuffer {
|
||||
return this->m_buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief after execution the state will be set to available by calling this method
|
||||
*/
|
||||
void setCreatedState()
|
||||
{
|
||||
this->m_state = COM_MB_AVAILABLE;
|
||||
}
|
||||
|
||||
inline void wrap_pixel(int &x, int &y, MemoryBufferExtend extend_x, MemoryBufferExtend extend_y)
|
||||
{
|
||||
const int w = getWidth();
|
||||
const int h = getHeight();
|
||||
int w = this->m_width;
|
||||
int h = this->m_height;
|
||||
x = x - m_rect.xmin;
|
||||
y = y - m_rect.ymin;
|
||||
|
||||
switch (extend_x) {
|
||||
case MemoryBufferExtend::Clip:
|
||||
case COM_MB_CLIP:
|
||||
break;
|
||||
case MemoryBufferExtend::Extend:
|
||||
case COM_MB_EXTEND:
|
||||
if (x < 0) {
|
||||
x = 0;
|
||||
}
|
||||
@@ -136,15 +163,15 @@ class MemoryBuffer {
|
||||
x = w;
|
||||
}
|
||||
break;
|
||||
case MemoryBufferExtend::Repeat:
|
||||
case COM_MB_REPEAT:
|
||||
x = (x >= 0.0f ? (x % w) : (x % w) + w);
|
||||
break;
|
||||
}
|
||||
|
||||
switch (extend_y) {
|
||||
case MemoryBufferExtend::Clip:
|
||||
case COM_MB_CLIP:
|
||||
break;
|
||||
case MemoryBufferExtend::Extend:
|
||||
case COM_MB_EXTEND:
|
||||
if (y < 0) {
|
||||
y = 0;
|
||||
}
|
||||
@@ -152,7 +179,7 @@ class MemoryBuffer {
|
||||
y = h;
|
||||
}
|
||||
break;
|
||||
case MemoryBufferExtend::Repeat:
|
||||
case COM_MB_REPEAT:
|
||||
y = (y >= 0.0f ? (y % h) : (y % h) + h);
|
||||
break;
|
||||
}
|
||||
@@ -163,15 +190,15 @@ class MemoryBuffer {
|
||||
MemoryBufferExtend extend_x,
|
||||
MemoryBufferExtend extend_y)
|
||||
{
|
||||
const float w = (float)getWidth();
|
||||
const float h = (float)getHeight();
|
||||
float w = (float)this->m_width;
|
||||
float h = (float)this->m_height;
|
||||
x = x - m_rect.xmin;
|
||||
y = y - m_rect.ymin;
|
||||
|
||||
switch (extend_x) {
|
||||
case MemoryBufferExtend::Clip:
|
||||
case COM_MB_CLIP:
|
||||
break;
|
||||
case MemoryBufferExtend::Extend:
|
||||
case COM_MB_EXTEND:
|
||||
if (x < 0) {
|
||||
x = 0.0f;
|
||||
}
|
||||
@@ -179,15 +206,15 @@ class MemoryBuffer {
|
||||
x = w;
|
||||
}
|
||||
break;
|
||||
case MemoryBufferExtend::Repeat:
|
||||
case COM_MB_REPEAT:
|
||||
x = fmodf(x, w);
|
||||
break;
|
||||
}
|
||||
|
||||
switch (extend_y) {
|
||||
case MemoryBufferExtend::Clip:
|
||||
case COM_MB_CLIP:
|
||||
break;
|
||||
case MemoryBufferExtend::Extend:
|
||||
case COM_MB_EXTEND:
|
||||
if (y < 0) {
|
||||
y = 0.0f;
|
||||
}
|
||||
@@ -195,7 +222,7 @@ class MemoryBuffer {
|
||||
y = h;
|
||||
}
|
||||
break;
|
||||
case MemoryBufferExtend::Repeat:
|
||||
case COM_MB_REPEAT:
|
||||
y = fmodf(y, h);
|
||||
break;
|
||||
}
|
||||
@@ -204,11 +231,11 @@ class MemoryBuffer {
|
||||
inline void read(float *result,
|
||||
int x,
|
||||
int y,
|
||||
MemoryBufferExtend extend_x = MemoryBufferExtend::Clip,
|
||||
MemoryBufferExtend extend_y = MemoryBufferExtend::Clip)
|
||||
MemoryBufferExtend extend_x = COM_MB_CLIP,
|
||||
MemoryBufferExtend extend_y = COM_MB_CLIP)
|
||||
{
|
||||
bool clip_x = (extend_x == MemoryBufferExtend::Clip && (x < m_rect.xmin || x >= m_rect.xmax));
|
||||
bool clip_y = (extend_y == MemoryBufferExtend::Clip && (y < m_rect.ymin || y >= m_rect.ymax));
|
||||
bool clip_x = (extend_x == COM_MB_CLIP && (x < m_rect.xmin || x >= m_rect.xmax));
|
||||
bool clip_y = (extend_y == COM_MB_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));
|
||||
@@ -217,7 +244,7 @@ class MemoryBuffer {
|
||||
int u = x;
|
||||
int v = y;
|
||||
this->wrap_pixel(u, v, extend_x, extend_y);
|
||||
const int offset = (getWidth() * y + x) * this->m_num_channels;
|
||||
const int offset = (this->m_width * y + x) * this->m_num_channels;
|
||||
float *buffer = &this->m_buffer[offset];
|
||||
memcpy(result, buffer, sizeof(float) * this->m_num_channels);
|
||||
}
|
||||
@@ -226,19 +253,19 @@ class MemoryBuffer {
|
||||
inline void readNoCheck(float *result,
|
||||
int x,
|
||||
int y,
|
||||
MemoryBufferExtend extend_x = MemoryBufferExtend::Clip,
|
||||
MemoryBufferExtend extend_y = MemoryBufferExtend::Clip)
|
||||
MemoryBufferExtend extend_x = COM_MB_CLIP,
|
||||
MemoryBufferExtend extend_y = COM_MB_CLIP)
|
||||
{
|
||||
int u = x;
|
||||
int v = y;
|
||||
|
||||
this->wrap_pixel(u, v, extend_x, extend_y);
|
||||
const int offset = (getWidth() * v + u) * this->m_num_channels;
|
||||
const int offset = (this->m_width * v + u) * this->m_num_channels;
|
||||
|
||||
BLI_assert(offset >= 0);
|
||||
BLI_assert(offset < this->buffer_len() * this->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)));
|
||||
BLI_assert(offset < this->determineBufferSize() * this->m_num_channels);
|
||||
BLI_assert(!(extend_x == COM_MB_CLIP && (u < m_rect.xmin || u >= m_rect.xmax)) &&
|
||||
!(extend_y == COM_MB_CLIP && (v < m_rect.ymin || v >= m_rect.ymax)));
|
||||
float *buffer = &this->m_buffer[offset];
|
||||
memcpy(result, buffer, sizeof(float) * this->m_num_channels);
|
||||
}
|
||||
@@ -248,26 +275,26 @@ class MemoryBuffer {
|
||||
inline void readBilinear(float *result,
|
||||
float x,
|
||||
float y,
|
||||
MemoryBufferExtend extend_x = MemoryBufferExtend::Clip,
|
||||
MemoryBufferExtend extend_y = MemoryBufferExtend::Clip)
|
||||
MemoryBufferExtend extend_x = COM_MB_CLIP,
|
||||
MemoryBufferExtend extend_y = COM_MB_CLIP)
|
||||
{
|
||||
float u = x;
|
||||
float v = y;
|
||||
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()))) {
|
||||
if ((extend_x != COM_MB_REPEAT && (u < 0.0f || u >= this->m_width)) ||
|
||||
(extend_y != COM_MB_REPEAT && (v < 0.0f || v >= this->m_height))) {
|
||||
copy_vn_fl(result, this->m_num_channels, 0.0f);
|
||||
return;
|
||||
}
|
||||
BLI_bilinear_interpolation_wrap_fl(this->m_buffer,
|
||||
result,
|
||||
getWidth(),
|
||||
getHeight(),
|
||||
this->m_width,
|
||||
this->m_height,
|
||||
this->m_num_channels,
|
||||
u,
|
||||
v,
|
||||
extend_x == MemoryBufferExtend::Repeat,
|
||||
extend_y == MemoryBufferExtend::Repeat);
|
||||
extend_x == COM_MB_REPEAT,
|
||||
extend_y == COM_MB_REPEAT);
|
||||
}
|
||||
|
||||
void readEWA(float *result, const float uv[2], const float derivatives[2][2]);
|
||||
@@ -277,7 +304,7 @@ class MemoryBuffer {
|
||||
*/
|
||||
inline bool isTemporarily() const
|
||||
{
|
||||
return this->m_state == MemoryBufferState::Temporary;
|
||||
return this->m_state == COM_MB_TEMPORARILY;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -287,45 +314,38 @@ class MemoryBuffer {
|
||||
* \note take care when running this on a new buffer since it wont fill in
|
||||
* uninitialized values in areas where the buffers don't overlap.
|
||||
*/
|
||||
void fill_from(const MemoryBuffer &src);
|
||||
void copyContentFrom(MemoryBuffer *otherBuffer);
|
||||
|
||||
/**
|
||||
* \brief get the rect of this MemoryBuffer
|
||||
*/
|
||||
const rcti &get_rect() const
|
||||
rcti *getRect()
|
||||
{
|
||||
return this->m_rect;
|
||||
return &this->m_rect;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief get the width of this MemoryBuffer
|
||||
*/
|
||||
const int getWidth() const
|
||||
{
|
||||
return BLI_rcti_size_x(&m_rect);
|
||||
}
|
||||
int getWidth() const;
|
||||
|
||||
/**
|
||||
* \brief get the height of this MemoryBuffer
|
||||
*/
|
||||
const int getHeight() const
|
||||
{
|
||||
return BLI_rcti_size_y(&m_rect);
|
||||
}
|
||||
int getHeight() const;
|
||||
|
||||
/**
|
||||
* \brief clear the buffer. Make all pixels black transparent.
|
||||
*/
|
||||
void clear();
|
||||
|
||||
float get_max_value() const;
|
||||
float get_max_value(const rcti &rect) const;
|
||||
MemoryBuffer *duplicate();
|
||||
|
||||
float getMaximumValue();
|
||||
float getMaximumValue(rcti *rect);
|
||||
|
||||
private:
|
||||
const int buffer_len() const
|
||||
{
|
||||
return getWidth() * getHeight();
|
||||
}
|
||||
unsigned int determineBufferSize();
|
||||
|
||||
#ifdef WITH_CXX_GUARDEDALLOC
|
||||
MEM_CXX_CLASS_ALLOC_FUNCS("COM:MemoryBuffer")
|
||||
|
@@ -33,7 +33,7 @@ void MemoryProxy::allocate(unsigned int width, unsigned int height)
|
||||
result.ymin = 0;
|
||||
result.ymax = height;
|
||||
|
||||
this->m_buffer = new MemoryBuffer(this, result, MemoryBufferState::Default);
|
||||
this->m_buffer = new MemoryBuffer(this, 1, &result);
|
||||
}
|
||||
|
||||
void MemoryProxy::free()
|
||||
|
@@ -45,12 +45,12 @@ Node::Node(bNode *editorNode, bool create_sockets)
|
||||
if (create_sockets) {
|
||||
bNodeSocket *input = (bNodeSocket *)editorNode->inputs.first;
|
||||
while (input != nullptr) {
|
||||
DataType dt = DataType::Value;
|
||||
DataType dt = COM_DT_VALUE;
|
||||
if (input->type == SOCK_RGBA) {
|
||||
dt = DataType::Color;
|
||||
dt = COM_DT_COLOR;
|
||||
}
|
||||
if (input->type == SOCK_VECTOR) {
|
||||
dt = DataType::Vector;
|
||||
dt = COM_DT_VECTOR;
|
||||
}
|
||||
|
||||
this->addInputSocket(dt, input);
|
||||
@@ -58,12 +58,12 @@ Node::Node(bNode *editorNode, bool create_sockets)
|
||||
}
|
||||
bNodeSocket *output = (bNodeSocket *)editorNode->outputs.first;
|
||||
while (output != nullptr) {
|
||||
DataType dt = DataType::Value;
|
||||
DataType dt = COM_DT_VALUE;
|
||||
if (output->type == SOCK_RGBA) {
|
||||
dt = DataType::Color;
|
||||
dt = COM_DT_COLOR;
|
||||
}
|
||||
if (output->type == SOCK_VECTOR) {
|
||||
dt = DataType::Vector;
|
||||
dt = COM_DT_VECTOR;
|
||||
}
|
||||
|
||||
this->addOutputSocket(dt, output);
|
||||
|
@@ -326,7 +326,7 @@ class NodeOperation : public SocketReader {
|
||||
*/
|
||||
virtual CompositorPriority getRenderPriority() const
|
||||
{
|
||||
return CompositorPriority::Low;
|
||||
return COM_PRIORITY_LOW;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -297,7 +297,7 @@ void NodeOperationBuilder::add_input_constant_value(NodeOperationInput *input,
|
||||
const NodeInput *node_input)
|
||||
{
|
||||
switch (input->getDataType()) {
|
||||
case DataType::Value: {
|
||||
case COM_DT_VALUE: {
|
||||
float value;
|
||||
if (node_input && node_input->getbNodeSocket()) {
|
||||
value = node_input->getEditorValueFloat();
|
||||
@@ -312,7 +312,7 @@ void NodeOperationBuilder::add_input_constant_value(NodeOperationInput *input,
|
||||
addLink(op->getOutputSocket(), input);
|
||||
break;
|
||||
}
|
||||
case DataType::Color: {
|
||||
case COM_DT_COLOR: {
|
||||
float value[4];
|
||||
if (node_input && node_input->getbNodeSocket()) {
|
||||
node_input->getEditorValueColor(value);
|
||||
@@ -327,7 +327,7 @@ void NodeOperationBuilder::add_input_constant_value(NodeOperationInput *input,
|
||||
addLink(op->getOutputSocket(), input);
|
||||
break;
|
||||
}
|
||||
case DataType::Vector: {
|
||||
case COM_DT_VECTOR: {
|
||||
float value[3];
|
||||
if (node_input && node_input->getbNodeSocket()) {
|
||||
node_input->getEditorValueVector(value);
|
||||
|
@@ -67,7 +67,7 @@ void OpenCLDevice::execute(WorkPackage *work)
|
||||
|
||||
executionGroup->determineChunkRect(&rect, chunkNumber);
|
||||
MemoryBuffer **inputBuffers = executionGroup->getInputBuffersOpenCL(chunkNumber);
|
||||
MemoryBuffer *outputBuffer = executionGroup->allocateOutputBuffer(rect);
|
||||
MemoryBuffer *outputBuffer = executionGroup->allocateOutputBuffer(chunkNumber, &rect);
|
||||
|
||||
executionGroup->getOutputOperation()->executeOpenCLRegion(
|
||||
this, &rect, chunkNumber, inputBuffers, outputBuffer);
|
||||
@@ -93,21 +93,19 @@ cl_mem OpenCLDevice::COM_clAttachMemoryBufferToKernelParameter(cl_kernel kernel,
|
||||
|
||||
const cl_image_format *OpenCLDevice::determineImageFormat(MemoryBuffer *memoryBuffer)
|
||||
{
|
||||
switch (memoryBuffer->get_num_channels()) {
|
||||
case 1:
|
||||
return &IMAGE_FORMAT_VALUE;
|
||||
break;
|
||||
case 3:
|
||||
return &IMAGE_FORMAT_VECTOR;
|
||||
break;
|
||||
case 4:
|
||||
return &IMAGE_FORMAT_COLOR;
|
||||
break;
|
||||
default:
|
||||
BLI_assert(!"Unsupported num_channels.");
|
||||
const cl_image_format *imageFormat;
|
||||
int num_channels = memoryBuffer->get_num_channels();
|
||||
if (num_channels == 1) {
|
||||
imageFormat = &IMAGE_FORMAT_VALUE;
|
||||
}
|
||||
else if (num_channels == 3) {
|
||||
imageFormat = &IMAGE_FORMAT_VECTOR;
|
||||
}
|
||||
else {
|
||||
imageFormat = &IMAGE_FORMAT_COLOR;
|
||||
}
|
||||
|
||||
return &IMAGE_FORMAT_COLOR;
|
||||
return imageFormat;
|
||||
}
|
||||
|
||||
cl_mem OpenCLDevice::COM_clAttachMemoryBufferToKernelParameter(cl_kernel kernel,
|
||||
@@ -154,8 +152,8 @@ void OpenCLDevice::COM_clAttachMemoryBufferOffsetToKernelParameter(cl_kernel ker
|
||||
{
|
||||
if (offsetIndex != -1) {
|
||||
cl_int error;
|
||||
const rcti &rect = memoryBuffer->get_rect();
|
||||
cl_int2 offset = {{rect.xmin, rect.ymin}};
|
||||
rcti *rect = memoryBuffer->getRect();
|
||||
cl_int2 offset = {{rect->xmin, rect->ymin}};
|
||||
|
||||
error = clSetKernelArg(kernel, offsetIndex, sizeof(cl_int2), &offset);
|
||||
if (error != CL_SUCCESS) {
|
||||
|
@@ -125,7 +125,7 @@ void CryptomatteNode::input_operations_from_render_source(
|
||||
const std::string combined_name = combined_layer_pass_name(render_layer, render_pass);
|
||||
if (blender::StringRef(combined_name).startswith(prefix)) {
|
||||
RenderLayersProg *op = new RenderLayersProg(
|
||||
render_pass->name, DataType::Color, render_pass->channels);
|
||||
render_pass->name, COM_DT_COLOR, render_pass->channels);
|
||||
op->setScene(scene);
|
||||
op->setLayerId(cryptomatte_layer_id);
|
||||
op->setRenderData(context.getRenderData());
|
||||
|
@@ -110,7 +110,7 @@ void DefocusNode::convertToOperations(NodeConverter &converter,
|
||||
|
||||
VariableSizeBokehBlurOperation *operation = new VariableSizeBokehBlurOperation();
|
||||
if (data->preview) {
|
||||
operation->setQuality(CompositorQuality::Low);
|
||||
operation->setQuality(COM_QUALITY_LOW);
|
||||
}
|
||||
else {
|
||||
operation->setQuality(context.getQuality());
|
||||
|
@@ -30,7 +30,7 @@ void DisplaceNode::convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext &context) const
|
||||
{
|
||||
NodeOperation *operation;
|
||||
if (context.getQuality() == CompositorQuality::Low) {
|
||||
if (context.getQuality() == COM_QUALITY_LOW) {
|
||||
operation = new DisplaceSimpleOperation();
|
||||
}
|
||||
else {
|
||||
|
@@ -46,13 +46,13 @@ NodeOperation *ImageNode::doMultilayerCheck(NodeConverter &converter,
|
||||
NodeOutput *outputSocket = this->getOutputSocket(outputsocketIndex);
|
||||
MultilayerBaseOperation *operation = nullptr;
|
||||
switch (datatype) {
|
||||
case DataType::Value:
|
||||
case COM_DT_VALUE:
|
||||
operation = new MultilayerValueOperation(render_layer, render_pass, view);
|
||||
break;
|
||||
case DataType::Vector:
|
||||
case COM_DT_VECTOR:
|
||||
operation = new MultilayerVectorOperation(render_layer, render_pass, view);
|
||||
break;
|
||||
case DataType::Color:
|
||||
case COM_DT_COLOR:
|
||||
operation = new MultilayerColorOperation(render_layer, render_pass, view);
|
||||
break;
|
||||
default:
|
||||
@@ -137,7 +137,7 @@ void ImageNode::convertToOperations(NodeConverter &converter,
|
||||
framenumber,
|
||||
index,
|
||||
view,
|
||||
DataType::Value);
|
||||
COM_DT_VALUE);
|
||||
break;
|
||||
/* using image operations for both 3 and 4 channels (RGB and RGBA respectively) */
|
||||
/* XXX any way to detect actual vector images? */
|
||||
@@ -150,7 +150,7 @@ void ImageNode::convertToOperations(NodeConverter &converter,
|
||||
framenumber,
|
||||
index,
|
||||
view,
|
||||
DataType::Vector);
|
||||
COM_DT_VECTOR);
|
||||
break;
|
||||
case 4:
|
||||
operation = doMultilayerCheck(converter,
|
||||
@@ -161,7 +161,7 @@ void ImageNode::convertToOperations(NodeConverter &converter,
|
||||
framenumber,
|
||||
index,
|
||||
view,
|
||||
DataType::Color);
|
||||
COM_DT_COLOR);
|
||||
break;
|
||||
default:
|
||||
/* dummy operation is added below */
|
||||
@@ -263,13 +263,13 @@ void ImageNode::convertToOperations(NodeConverter &converter,
|
||||
NodeOutput *output = this->getOutputSocket(i);
|
||||
NodeOperation *operation = nullptr;
|
||||
switch (output->getDataType()) {
|
||||
case DataType::Value: {
|
||||
case COM_DT_VALUE: {
|
||||
SetValueOperation *valueoperation = new SetValueOperation();
|
||||
valueoperation->setValue(0.0f);
|
||||
operation = valueoperation;
|
||||
break;
|
||||
}
|
||||
case DataType::Vector: {
|
||||
case COM_DT_VECTOR: {
|
||||
SetVectorOperation *vectoroperation = new SetVectorOperation();
|
||||
vectoroperation->setX(0.0f);
|
||||
vectoroperation->setY(0.0f);
|
||||
@@ -277,7 +277,7 @@ void ImageNode::convertToOperations(NodeConverter &converter,
|
||||
operation = vectoroperation;
|
||||
break;
|
||||
}
|
||||
case DataType::Color: {
|
||||
case COM_DT_COLOR: {
|
||||
SetColorOperation *coloroperation = new SetColorOperation();
|
||||
coloroperation->setChannel1(0.0f);
|
||||
coloroperation->setChannel2(0.0f);
|
||||
|
@@ -86,28 +86,28 @@ void RenderLayersNode::testRenderLink(NodeConverter &converter,
|
||||
bool is_preview;
|
||||
if (STREQ(rpass->name, RE_PASSNAME_COMBINED) &&
|
||||
STREQ(output->getbNodeSocket()->name, "Alpha")) {
|
||||
operation = new RenderLayersAlphaProg(rpass->name, DataType::Value, rpass->channels);
|
||||
operation = new RenderLayersAlphaProg(rpass->name, COM_DT_VALUE, rpass->channels);
|
||||
is_preview = false;
|
||||
}
|
||||
else if (STREQ(rpass->name, RE_PASSNAME_Z)) {
|
||||
operation = new RenderLayersDepthProg(rpass->name, DataType::Value, rpass->channels);
|
||||
operation = new RenderLayersDepthProg(rpass->name, COM_DT_VALUE, rpass->channels);
|
||||
is_preview = false;
|
||||
}
|
||||
else {
|
||||
DataType type;
|
||||
switch (rpass->channels) {
|
||||
case 4:
|
||||
type = DataType::Color;
|
||||
type = COM_DT_COLOR;
|
||||
break;
|
||||
case 3:
|
||||
type = DataType::Vector;
|
||||
type = COM_DT_VECTOR;
|
||||
break;
|
||||
case 1:
|
||||
type = DataType::Value;
|
||||
type = COM_DT_VALUE;
|
||||
break;
|
||||
default:
|
||||
BLI_assert(!"Unexpected number of channels for pass");
|
||||
type = DataType::Value;
|
||||
type = COM_DT_VALUE;
|
||||
break;
|
||||
}
|
||||
operation = new RenderLayersProg(rpass->name, type, rpass->channels);
|
||||
@@ -121,21 +121,21 @@ void RenderLayersNode::missingSocketLink(NodeConverter &converter, NodeOutput *o
|
||||
{
|
||||
NodeOperation *operation;
|
||||
switch (output->getDataType()) {
|
||||
case DataType::Color: {
|
||||
case COM_DT_COLOR: {
|
||||
const float color[4] = {0.0f, 0.0f, 0.0f, 0.0f};
|
||||
SetColorOperation *color_operation = new SetColorOperation();
|
||||
color_operation->setChannels(color);
|
||||
operation = color_operation;
|
||||
break;
|
||||
}
|
||||
case DataType::Vector: {
|
||||
case COM_DT_VECTOR: {
|
||||
const float vector[3] = {0.0f, 0.0f, 0.0f};
|
||||
SetVectorOperation *vector_operation = new SetVectorOperation();
|
||||
vector_operation->setVector(vector);
|
||||
operation = vector_operation;
|
||||
break;
|
||||
}
|
||||
case DataType::Value: {
|
||||
case COM_DT_VALUE: {
|
||||
SetValueOperation *value_operation = new SetValueOperation();
|
||||
value_operation->setValue(0.0f);
|
||||
operation = value_operation;
|
||||
|
@@ -33,21 +33,21 @@ SocketProxyNode::SocketProxyNode(bNode *editorNode,
|
||||
{
|
||||
DataType dt;
|
||||
|
||||
dt = DataType::Value;
|
||||
dt = COM_DT_VALUE;
|
||||
if (editorInput->type == SOCK_RGBA) {
|
||||
dt = DataType::Color;
|
||||
dt = COM_DT_COLOR;
|
||||
}
|
||||
if (editorInput->type == SOCK_VECTOR) {
|
||||
dt = DataType::Vector;
|
||||
dt = COM_DT_VECTOR;
|
||||
}
|
||||
this->addInputSocket(dt, editorInput);
|
||||
|
||||
dt = DataType::Value;
|
||||
dt = COM_DT_VALUE;
|
||||
if (editorOutput->type == SOCK_RGBA) {
|
||||
dt = DataType::Color;
|
||||
dt = COM_DT_COLOR;
|
||||
}
|
||||
if (editorOutput->type == SOCK_VECTOR) {
|
||||
dt = DataType::Vector;
|
||||
dt = COM_DT_VECTOR;
|
||||
}
|
||||
this->addOutputSocket(dt, editorOutput);
|
||||
}
|
||||
@@ -66,21 +66,21 @@ SocketBufferNode::SocketBufferNode(bNode *editorNode,
|
||||
{
|
||||
DataType dt;
|
||||
|
||||
dt = DataType::Value;
|
||||
dt = COM_DT_VALUE;
|
||||
if (editorInput->type == SOCK_RGBA) {
|
||||
dt = DataType::Color;
|
||||
dt = COM_DT_COLOR;
|
||||
}
|
||||
if (editorInput->type == SOCK_VECTOR) {
|
||||
dt = DataType::Vector;
|
||||
dt = COM_DT_VECTOR;
|
||||
}
|
||||
this->addInputSocket(dt, editorInput);
|
||||
|
||||
dt = DataType::Value;
|
||||
dt = COM_DT_VALUE;
|
||||
if (editorOutput->type == SOCK_RGBA) {
|
||||
dt = DataType::Color;
|
||||
dt = COM_DT_COLOR;
|
||||
}
|
||||
if (editorOutput->type == SOCK_VECTOR) {
|
||||
dt = DataType::Vector;
|
||||
dt = COM_DT_VECTOR;
|
||||
}
|
||||
this->addOutputSocket(dt, editorOutput);
|
||||
}
|
||||
|
@@ -60,7 +60,7 @@ void SplitViewerNode::convertToOperations(NodeConverter &converter,
|
||||
|
||||
/* defaults - the viewer node has these options but not exposed for split view
|
||||
* we could use the split to define an area of interest on one axis at least */
|
||||
viewerOperation->setChunkOrder(ChunkOrdering::Default);
|
||||
viewerOperation->setChunkOrder(COM_ORDER_OF_CHUNKS_DEFAULT);
|
||||
viewerOperation->setCenterX(0.5f);
|
||||
viewerOperation->setCenterY(0.5f);
|
||||
|
||||
|
@@ -55,8 +55,8 @@ void TranslateNode::convertToOperations(NodeConverter &converter,
|
||||
converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0));
|
||||
|
||||
if (data->wrap_axis) {
|
||||
WriteBufferOperation *writeOperation = new WriteBufferOperation(DataType::Color);
|
||||
WrapOperation *wrapOperation = new WrapOperation(DataType::Color);
|
||||
WriteBufferOperation *writeOperation = new WriteBufferOperation(COM_DT_COLOR);
|
||||
WrapOperation *wrapOperation = new WrapOperation(COM_DT_COLOR);
|
||||
wrapOperation->setMemoryProxy(writeOperation->getMemoryProxy());
|
||||
wrapOperation->setWrapping(data->wrap_axis);
|
||||
|
||||
|
@@ -47,7 +47,7 @@ void ViewerNode::convertToOperations(NodeConverter &converter,
|
||||
viewerOperation->setbNodeTree(context.getbNodeTree());
|
||||
viewerOperation->setImage(image);
|
||||
viewerOperation->setImageUser(imageUser);
|
||||
viewerOperation->setChunkOrder((ChunkOrdering)editorNode->custom1);
|
||||
viewerOperation->setChunkOrder((OrderOfChunks)editorNode->custom1);
|
||||
viewerOperation->setCenterX(editorNode->custom3);
|
||||
viewerOperation->setCenterY(editorNode->custom4);
|
||||
/* alpha socket gives either 1 or a custom alpha value if "use alpha" is enabled */
|
||||
|
@@ -114,8 +114,8 @@ static int extrapolate9(float *E0,
|
||||
|
||||
AntiAliasOperation::AntiAliasOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addOutputSocket(DataType::Value);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
this->m_valueReader = nullptr;
|
||||
this->setComplex(true);
|
||||
}
|
||||
|
@@ -23,9 +23,9 @@
|
||||
|
||||
BilateralBlurOperation::BilateralBlurOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Color);
|
||||
this->addInputSocket(DataType::Color);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->setComplex(true);
|
||||
|
||||
this->m_inputColorProgram = nullptr;
|
||||
|
@@ -24,9 +24,9 @@
|
||||
|
||||
BlurBaseOperation::BlurBaseOperation(DataType data_type)
|
||||
{
|
||||
/* data_type is almost always DataType::Color except for alpha-blur */
|
||||
/* data_type is almost always COM_DT_COLOR except for alpha-blur */
|
||||
this->addInputSocket(data_type);
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addOutputSocket(data_type);
|
||||
this->setComplex(true);
|
||||
this->m_inputProgram = nullptr;
|
||||
|
@@ -24,11 +24,11 @@
|
||||
|
||||
BokehBlurOperation::BokehBlurOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Color);
|
||||
this->addInputSocket(DataType::Color, COM_SC_NO_RESIZE);
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addInputSocket(COM_DT_COLOR, COM_SC_NO_RESIZE);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->setComplex(true);
|
||||
this->setOpenCL(true);
|
||||
|
||||
@@ -80,11 +80,10 @@ void BokehBlurOperation::executePixel(float output[4], int x, int y, void *data)
|
||||
if (tempBoundingBox[0] > 0.0f) {
|
||||
float multiplier_accum[4] = {0.0f, 0.0f, 0.0f, 0.0f};
|
||||
MemoryBuffer *inputBuffer = (MemoryBuffer *)data;
|
||||
const rcti &input_rect = inputBuffer->get_rect();
|
||||
float *buffer = inputBuffer->getBuffer();
|
||||
int bufferwidth = inputBuffer->getWidth();
|
||||
int bufferstartx = input_rect.xmin;
|
||||
int bufferstarty = input_rect.ymin;
|
||||
int bufferstartx = inputBuffer->getRect()->xmin;
|
||||
int bufferstarty = inputBuffer->getRect()->ymin;
|
||||
const float max_dim = MAX2(this->getWidth(), this->getHeight());
|
||||
int pixelSize = this->m_size * max_dim / 100.0f;
|
||||
zero_v4(color_accum);
|
||||
@@ -100,10 +99,10 @@ void BokehBlurOperation::executePixel(float output[4], int x, int y, void *data)
|
||||
int maxy = y + pixelSize;
|
||||
int minx = x - pixelSize;
|
||||
int maxx = x + pixelSize;
|
||||
miny = MAX2(miny, input_rect.ymin);
|
||||
minx = MAX2(minx, input_rect.xmin);
|
||||
maxy = MIN2(maxy, input_rect.ymax);
|
||||
maxx = MIN2(maxx, input_rect.xmax);
|
||||
miny = MAX2(miny, inputBuffer->getRect()->ymin);
|
||||
minx = MAX2(minx, inputBuffer->getRect()->xmin);
|
||||
maxy = MIN2(maxy, inputBuffer->getRect()->ymax);
|
||||
maxx = MIN2(maxx, inputBuffer->getRect()->xmax);
|
||||
|
||||
int step = getStep();
|
||||
int offsetadd = getOffsetAdd() * COM_NUM_CHANNELS_COLOR;
|
||||
|
@@ -21,7 +21,7 @@
|
||||
|
||||
BokehImageOperation::BokehImageOperation()
|
||||
{
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->m_deleteData = false;
|
||||
}
|
||||
void BokehImageOperation::initExecution()
|
||||
|
@@ -22,9 +22,9 @@
|
||||
|
||||
BoxMaskOperation::BoxMaskOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addOutputSocket(DataType::Value);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
this->m_inputMask = nullptr;
|
||||
this->m_inputValue = nullptr;
|
||||
this->m_cosine = 0.0f;
|
||||
|
@@ -20,10 +20,10 @@
|
||||
|
||||
BrightnessOperation::BrightnessOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Color);
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->m_inputProgram = nullptr;
|
||||
this->m_use_premultiply = false;
|
||||
}
|
||||
|
@@ -24,8 +24,8 @@
|
||||
|
||||
CalculateMeanOperation::CalculateMeanOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Color, COM_SC_NO_RESIZE);
|
||||
this->addOutputSocket(DataType::Value);
|
||||
this->addInputSocket(COM_DT_COLOR, COM_SC_NO_RESIZE);
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
this->m_imageReader = nullptr;
|
||||
this->m_iscalculated = false;
|
||||
this->m_setting = 1;
|
||||
|
@@ -20,11 +20,11 @@
|
||||
|
||||
ChangeHSVOperation::ChangeHSVOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Color);
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->m_inputOperation = nullptr;
|
||||
}
|
||||
|
||||
|
@@ -21,8 +21,8 @@
|
||||
|
||||
ChannelMatteOperation::ChannelMatteOperation()
|
||||
{
|
||||
addInputSocket(DataType::Color);
|
||||
addOutputSocket(DataType::Value);
|
||||
addInputSocket(COM_DT_COLOR);
|
||||
addOutputSocket(COM_DT_VALUE);
|
||||
|
||||
this->m_inputImageProgram = nullptr;
|
||||
}
|
||||
|
@@ -21,9 +21,9 @@
|
||||
|
||||
ChromaMatteOperation::ChromaMatteOperation()
|
||||
{
|
||||
addInputSocket(DataType::Color);
|
||||
addInputSocket(DataType::Color);
|
||||
addOutputSocket(DataType::Value);
|
||||
addInputSocket(COM_DT_COLOR);
|
||||
addInputSocket(COM_DT_COLOR);
|
||||
addOutputSocket(COM_DT_VALUE);
|
||||
|
||||
this->m_inputImageProgram = nullptr;
|
||||
this->m_inputKeyProgram = nullptr;
|
||||
|
@@ -33,9 +33,9 @@ inline float colorbalance_cdl(float in, float offset, float power, float slope)
|
||||
|
||||
ColorBalanceASCCDLOperation::ColorBalanceASCCDLOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addInputSocket(DataType::Color);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->m_inputValueOperation = nullptr;
|
||||
this->m_inputColorOperation = nullptr;
|
||||
this->setResolutionInputSocketIndex(1);
|
||||
|
@@ -38,9 +38,9 @@ inline float colorbalance_lgg(float in, float lift_lgg, float gamma_inv, float g
|
||||
|
||||
ColorBalanceLGGOperation::ColorBalanceLGGOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addInputSocket(DataType::Color);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->m_inputValueOperation = nullptr;
|
||||
this->m_inputColorOperation = nullptr;
|
||||
this->setResolutionInputSocketIndex(1);
|
||||
|
@@ -23,9 +23,9 @@
|
||||
|
||||
ColorCorrectionOperation::ColorCorrectionOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Color);
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->m_inputImage = nullptr;
|
||||
this->m_inputMask = nullptr;
|
||||
this->m_redChannelEnabled = true;
|
||||
|
@@ -24,11 +24,11 @@
|
||||
|
||||
ColorCurveOperation::ColorCurveOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addInputSocket(DataType::Color);
|
||||
this->addInputSocket(DataType::Color);
|
||||
this->addInputSocket(DataType::Color);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
|
||||
this->m_inputFacProgram = nullptr;
|
||||
this->m_inputImageProgram = nullptr;
|
||||
@@ -100,9 +100,9 @@ void ColorCurveOperation::deinitExecution()
|
||||
|
||||
ConstantLevelColorCurveOperation::ConstantLevelColorCurveOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addInputSocket(DataType::Color);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
|
||||
this->m_inputFacProgram = nullptr;
|
||||
this->m_inputImageProgram = nullptr;
|
||||
|
@@ -20,9 +20,9 @@
|
||||
|
||||
ExposureOperation::ExposureOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Color);
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->m_inputProgram = nullptr;
|
||||
}
|
||||
|
||||
|
@@ -21,9 +21,9 @@
|
||||
|
||||
ColorMatteOperation::ColorMatteOperation()
|
||||
{
|
||||
addInputSocket(DataType::Color);
|
||||
addInputSocket(DataType::Color);
|
||||
addOutputSocket(DataType::Value);
|
||||
addInputSocket(COM_DT_COLOR);
|
||||
addInputSocket(COM_DT_COLOR);
|
||||
addOutputSocket(COM_DT_VALUE);
|
||||
|
||||
this->m_inputImageProgram = nullptr;
|
||||
this->m_inputKeyProgram = nullptr;
|
||||
|
@@ -22,8 +22,8 @@
|
||||
|
||||
ColorRampOperation::ColorRampOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
|
||||
this->m_inputProgram = nullptr;
|
||||
this->m_colorBand = nullptr;
|
||||
|
@@ -22,9 +22,9 @@
|
||||
|
||||
ColorSpillOperation::ColorSpillOperation()
|
||||
{
|
||||
addInputSocket(DataType::Color);
|
||||
addInputSocket(DataType::Value);
|
||||
addOutputSocket(DataType::Color);
|
||||
addInputSocket(COM_DT_COLOR);
|
||||
addInputSocket(COM_DT_VALUE);
|
||||
addOutputSocket(COM_DT_COLOR);
|
||||
|
||||
this->m_inputImageReader = nullptr;
|
||||
this->m_inputFacReader = nullptr;
|
||||
|
@@ -33,9 +33,9 @@
|
||||
|
||||
CompositorOperation::CompositorOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Color);
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
|
||||
this->setRenderData(nullptr);
|
||||
this->m_outputBuffer = nullptr;
|
||||
|
@@ -111,7 +111,7 @@ class CompositorOperation : public NodeOperation {
|
||||
void deinitExecution();
|
||||
CompositorPriority getRenderPriority() const
|
||||
{
|
||||
return CompositorPriority::Medium;
|
||||
return COM_PRIORITY_MEDIUM;
|
||||
}
|
||||
void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
|
||||
void setUseAlphaInput(bool value)
|
||||
|
@@ -22,8 +22,8 @@
|
||||
|
||||
ConvertColorProfileOperation::ConvertColorProfileOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Color);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->m_inputOperation = nullptr;
|
||||
this->m_predivided = false;
|
||||
}
|
||||
|
@@ -23,8 +23,8 @@
|
||||
|
||||
ConvertDepthToRadiusOperation::ConvertDepthToRadiusOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addOutputSocket(DataType::Value);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
this->m_inputOperation = nullptr;
|
||||
this->m_fStop = 128.0f;
|
||||
this->m_cameraObject = nullptr;
|
||||
|
@@ -39,8 +39,8 @@ void ConvertBaseOperation::deinitExecution()
|
||||
|
||||
ConvertValueToColorOperation::ConvertValueToColorOperation() : ConvertBaseOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
||||
|
||||
void ConvertValueToColorOperation::executePixelSampled(float output[4],
|
||||
@@ -58,8 +58,8 @@ void ConvertValueToColorOperation::executePixelSampled(float output[4],
|
||||
|
||||
ConvertColorToValueOperation::ConvertColorToValueOperation() : ConvertBaseOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Color);
|
||||
this->addOutputSocket(DataType::Value);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
}
|
||||
|
||||
void ConvertColorToValueOperation::executePixelSampled(float output[4],
|
||||
@@ -76,8 +76,8 @@ void ConvertColorToValueOperation::executePixelSampled(float output[4],
|
||||
|
||||
ConvertColorToBWOperation::ConvertColorToBWOperation() : ConvertBaseOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Color);
|
||||
this->addOutputSocket(DataType::Value);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
}
|
||||
|
||||
void ConvertColorToBWOperation::executePixelSampled(float output[4],
|
||||
@@ -94,8 +94,8 @@ void ConvertColorToBWOperation::executePixelSampled(float output[4],
|
||||
|
||||
ConvertColorToVectorOperation::ConvertColorToVectorOperation() : ConvertBaseOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Color);
|
||||
this->addOutputSocket(DataType::Vector);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_VECTOR);
|
||||
}
|
||||
|
||||
void ConvertColorToVectorOperation::executePixelSampled(float output[4],
|
||||
@@ -112,8 +112,8 @@ void ConvertColorToVectorOperation::executePixelSampled(float output[4],
|
||||
|
||||
ConvertValueToVectorOperation::ConvertValueToVectorOperation() : ConvertBaseOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addOutputSocket(DataType::Vector);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addOutputSocket(COM_DT_VECTOR);
|
||||
}
|
||||
|
||||
void ConvertValueToVectorOperation::executePixelSampled(float output[4],
|
||||
@@ -130,8 +130,8 @@ void ConvertValueToVectorOperation::executePixelSampled(float output[4],
|
||||
|
||||
ConvertVectorToColorOperation::ConvertVectorToColorOperation() : ConvertBaseOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Vector);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->addInputSocket(COM_DT_VECTOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
||||
|
||||
void ConvertVectorToColorOperation::executePixelSampled(float output[4],
|
||||
@@ -147,8 +147,8 @@ void ConvertVectorToColorOperation::executePixelSampled(float output[4],
|
||||
|
||||
ConvertVectorToValueOperation::ConvertVectorToValueOperation() : ConvertBaseOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Vector);
|
||||
this->addOutputSocket(DataType::Value);
|
||||
this->addInputSocket(COM_DT_VECTOR);
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
}
|
||||
|
||||
void ConvertVectorToValueOperation::executePixelSampled(float output[4],
|
||||
@@ -165,8 +165,8 @@ void ConvertVectorToValueOperation::executePixelSampled(float output[4],
|
||||
|
||||
ConvertRGBToYCCOperation::ConvertRGBToYCCOperation() : ConvertBaseOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Color);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
||||
|
||||
void ConvertRGBToYCCOperation::setMode(int mode)
|
||||
@@ -207,8 +207,8 @@ void ConvertRGBToYCCOperation::executePixelSampled(float output[4],
|
||||
|
||||
ConvertYCCToRGBOperation::ConvertYCCToRGBOperation() : ConvertBaseOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Color);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
||||
|
||||
void ConvertYCCToRGBOperation::setMode(int mode)
|
||||
@@ -253,8 +253,8 @@ void ConvertYCCToRGBOperation::executePixelSampled(float output[4],
|
||||
|
||||
ConvertRGBToYUVOperation::ConvertRGBToYUVOperation() : ConvertBaseOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Color);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
||||
|
||||
void ConvertRGBToYUVOperation::executePixelSampled(float output[4],
|
||||
@@ -278,8 +278,8 @@ void ConvertRGBToYUVOperation::executePixelSampled(float output[4],
|
||||
|
||||
ConvertYUVToRGBOperation::ConvertYUVToRGBOperation() : ConvertBaseOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Color);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
||||
|
||||
void ConvertYUVToRGBOperation::executePixelSampled(float output[4],
|
||||
@@ -303,8 +303,8 @@ void ConvertYUVToRGBOperation::executePixelSampled(float output[4],
|
||||
|
||||
ConvertRGBToHSVOperation::ConvertRGBToHSVOperation() : ConvertBaseOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Color);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
||||
|
||||
void ConvertRGBToHSVOperation::executePixelSampled(float output[4],
|
||||
@@ -322,8 +322,8 @@ void ConvertRGBToHSVOperation::executePixelSampled(float output[4],
|
||||
|
||||
ConvertHSVToRGBOperation::ConvertHSVToRGBOperation() : ConvertBaseOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Color);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
||||
|
||||
void ConvertHSVToRGBOperation::executePixelSampled(float output[4],
|
||||
@@ -344,8 +344,8 @@ void ConvertHSVToRGBOperation::executePixelSampled(float output[4],
|
||||
|
||||
ConvertPremulToStraightOperation::ConvertPremulToStraightOperation() : ConvertBaseOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Color);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
||||
|
||||
void ConvertPremulToStraightOperation::executePixelSampled(float output[4],
|
||||
@@ -374,8 +374,8 @@ void ConvertPremulToStraightOperation::executePixelSampled(float output[4],
|
||||
|
||||
ConvertStraightToPremulOperation::ConvertStraightToPremulOperation() : ConvertBaseOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Color);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
||||
|
||||
void ConvertStraightToPremulOperation::executePixelSampled(float output[4],
|
||||
@@ -399,8 +399,8 @@ void ConvertStraightToPremulOperation::executePixelSampled(float output[4],
|
||||
|
||||
SeparateChannelOperation::SeparateChannelOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Color);
|
||||
this->addOutputSocket(DataType::Value);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
this->m_inputOperation = nullptr;
|
||||
}
|
||||
void SeparateChannelOperation::initExecution()
|
||||
@@ -427,11 +427,11 @@ void SeparateChannelOperation::executePixelSampled(float output[4],
|
||||
|
||||
CombineChannelsOperation::CombineChannelsOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->setResolutionInputSocketIndex(0);
|
||||
this->m_inputChannel1Operation = nullptr;
|
||||
this->m_inputChannel2Operation = nullptr;
|
||||
|
@@ -24,9 +24,9 @@
|
||||
|
||||
ConvolutionFilterOperation::ConvolutionFilterOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Color);
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->setResolutionInputSocketIndex(0);
|
||||
this->m_inputOperation = nullptr;
|
||||
this->setComplex(true);
|
||||
|
@@ -21,8 +21,8 @@
|
||||
|
||||
CropBaseOperation::CropBaseOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Color, COM_SC_NO_RESIZE);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->addInputSocket(COM_DT_COLOR, COM_SC_NO_RESIZE);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->m_inputOperation = nullptr;
|
||||
this->m_settings = nullptr;
|
||||
}
|
||||
|
@@ -21,10 +21,10 @@
|
||||
CryptomatteOperation::CryptomatteOperation(size_t num_inputs)
|
||||
{
|
||||
for (size_t i = 0; i < num_inputs; i++) {
|
||||
this->addInputSocket(DataType::Color);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
}
|
||||
inputs.resize(num_inputs);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->setComplex(true);
|
||||
}
|
||||
|
||||
|
@@ -28,10 +28,10 @@ static pthread_mutex_t oidn_lock = BLI_MUTEX_INITIALIZER;
|
||||
|
||||
DenoiseOperation::DenoiseOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Color);
|
||||
this->addInputSocket(DataType::Vector);
|
||||
this->addInputSocket(DataType::Color);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addInputSocket(COM_DT_VECTOR);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->m_settings = nullptr;
|
||||
}
|
||||
void DenoiseOperation::initExecution()
|
||||
@@ -60,7 +60,7 @@ MemoryBuffer *DenoiseOperation::createMemoryBuffer(rcti *rect2)
|
||||
rect.ymin = 0;
|
||||
rect.xmax = getWidth();
|
||||
rect.ymax = getHeight();
|
||||
MemoryBuffer *result = new MemoryBuffer(DataType::Color, rect);
|
||||
MemoryBuffer *result = new MemoryBuffer(COM_DT_COLOR, &rect);
|
||||
float *data = result->getBuffer();
|
||||
this->generateDenoise(data, tileColor, tileNormal, tileAlbedo, this->m_settings);
|
||||
return result;
|
||||
|
@@ -24,9 +24,9 @@
|
||||
|
||||
DespeckleOperation::DespeckleOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Color);
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->setResolutionInputSocketIndex(0);
|
||||
this->m_inputOperation = nullptr;
|
||||
this->setComplex(true);
|
||||
|
@@ -21,9 +21,9 @@
|
||||
|
||||
DifferenceMatteOperation::DifferenceMatteOperation()
|
||||
{
|
||||
addInputSocket(DataType::Color);
|
||||
addInputSocket(DataType::Color);
|
||||
addOutputSocket(DataType::Value);
|
||||
addInputSocket(COM_DT_COLOR);
|
||||
addInputSocket(COM_DT_COLOR);
|
||||
addOutputSocket(COM_DT_VALUE);
|
||||
|
||||
this->m_inputImage1Program = nullptr;
|
||||
this->m_inputImage2Program = nullptr;
|
||||
|
@@ -25,8 +25,8 @@
|
||||
// DilateErode Distance Threshold
|
||||
DilateErodeThresholdOperation::DilateErodeThresholdOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addOutputSocket(DataType::Value);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
this->setComplex(true);
|
||||
this->m_inputProgram = nullptr;
|
||||
this->m_inset = 0.0f;
|
||||
@@ -70,19 +70,19 @@ void DilateErodeThresholdOperation::executePixel(float output[4], int x, int y,
|
||||
|
||||
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 bufferWidth = inputBuffer->getWidth();
|
||||
rcti *rect = inputBuffer->getRect();
|
||||
const int minx = MAX2(x - this->m_scope, rect->xmin);
|
||||
const int miny = MAX2(y - this->m_scope, rect->ymin);
|
||||
const int maxx = MIN2(x + this->m_scope, rect->xmax);
|
||||
const int maxy = MIN2(y + this->m_scope, rect->ymax);
|
||||
const int bufferWidth = BLI_rcti_size_x(rect);
|
||||
int offset;
|
||||
|
||||
inputBuffer->read(inputValue, x, y);
|
||||
if (inputValue[0] > sw) {
|
||||
for (int yi = miny; yi < maxy; yi++) {
|
||||
const float dy = yi - y;
|
||||
offset = ((yi - input_rect.ymin) * bufferWidth + (minx - input_rect.xmin));
|
||||
offset = ((yi - rect->ymin) * bufferWidth + (minx - rect->xmin));
|
||||
for (int xi = minx; xi < maxx; xi++) {
|
||||
if (buffer[offset] < sw) {
|
||||
const float dx = xi - x;
|
||||
@@ -97,7 +97,7 @@ void DilateErodeThresholdOperation::executePixel(float output[4], int x, int y,
|
||||
else {
|
||||
for (int yi = miny; yi < maxy; yi++) {
|
||||
const float dy = yi - y;
|
||||
offset = ((yi - input_rect.ymin) * bufferWidth + (minx - input_rect.xmin));
|
||||
offset = ((yi - rect->ymin) * bufferWidth + (minx - rect->xmin));
|
||||
for (int xi = minx; xi < maxx; xi++) {
|
||||
if (buffer[offset] > sw) {
|
||||
const float dx = xi - x;
|
||||
@@ -161,8 +161,8 @@ bool DilateErodeThresholdOperation::determineDependingAreaOfInterest(
|
||||
// Dilate Distance
|
||||
DilateDistanceOperation::DilateDistanceOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addOutputSocket(DataType::Value);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
this->setComplex(true);
|
||||
this->m_inputProgram = nullptr;
|
||||
this->m_distance = 0.0f;
|
||||
@@ -190,19 +190,19 @@ void DilateDistanceOperation::executePixel(float output[4], int x, int y, void *
|
||||
|
||||
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 bufferWidth = inputBuffer->getWidth();
|
||||
rcti *rect = inputBuffer->getRect();
|
||||
const int minx = MAX2(x - this->m_scope, rect->xmin);
|
||||
const int miny = MAX2(y - this->m_scope, rect->ymin);
|
||||
const int maxx = MIN2(x + this->m_scope, rect->xmax);
|
||||
const int maxy = MIN2(y + this->m_scope, rect->ymax);
|
||||
const int bufferWidth = BLI_rcti_size_x(rect);
|
||||
int offset;
|
||||
|
||||
float value = 0.0f;
|
||||
|
||||
for (int yi = miny; yi < maxy; yi++) {
|
||||
const float dy = yi - y;
|
||||
offset = ((yi - input_rect.ymin) * bufferWidth + (minx - input_rect.xmin));
|
||||
offset = ((yi - rect->ymin) * bufferWidth + (minx - rect->xmin));
|
||||
for (int xi = minx; xi < maxx; xi++) {
|
||||
const float dx = xi - x;
|
||||
const float dis = dx * dx + dy * dy;
|
||||
@@ -269,19 +269,19 @@ void ErodeDistanceOperation::executePixel(float output[4], int x, int y, void *d
|
||||
|
||||
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 bufferWidth = inputBuffer->getWidth();
|
||||
rcti *rect = inputBuffer->getRect();
|
||||
const int minx = MAX2(x - this->m_scope, rect->xmin);
|
||||
const int miny = MAX2(y - this->m_scope, rect->ymin);
|
||||
const int maxx = MIN2(x + this->m_scope, rect->xmax);
|
||||
const int maxy = MIN2(y + this->m_scope, rect->ymax);
|
||||
const int bufferWidth = BLI_rcti_size_x(rect);
|
||||
int offset;
|
||||
|
||||
float value = 1.0f;
|
||||
|
||||
for (int yi = miny; yi < maxy; yi++) {
|
||||
const float dy = yi - y;
|
||||
offset = ((yi - input_rect.ymin) * bufferWidth + (minx - input_rect.xmin));
|
||||
offset = ((yi - rect->ymin) * bufferWidth + (minx - rect->xmin));
|
||||
for (int xi = minx; xi < maxx; xi++) {
|
||||
const float dx = xi - x;
|
||||
const float dis = dx * dx + dy * dy;
|
||||
@@ -319,8 +319,8 @@ void ErodeDistanceOperation::executeOpenCL(OpenCLDevice *device,
|
||||
// Dilate step
|
||||
DilateStepOperation::DilateStepOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addOutputSocket(DataType::Value);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
this->setComplex(true);
|
||||
this->m_inputProgram = nullptr;
|
||||
}
|
||||
|
@@ -25,8 +25,8 @@
|
||||
|
||||
DirectionalBlurOperation::DirectionalBlurOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Color);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->setComplex(true);
|
||||
|
||||
this->setOpenCL(true);
|
||||
|
@@ -22,11 +22,11 @@
|
||||
|
||||
DisplaceOperation::DisplaceOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Color);
|
||||
this->addInputSocket(DataType::Vector);
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addInputSocket(COM_DT_VECTOR);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->setComplex(true);
|
||||
|
||||
this->m_inputColorProgram = nullptr;
|
||||
|
@@ -22,11 +22,11 @@
|
||||
|
||||
DisplaceSimpleOperation::DisplaceSimpleOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Color);
|
||||
this->addInputSocket(DataType::Vector);
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addInputSocket(COM_DT_VECTOR);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
|
||||
this->m_inputColorProgram = nullptr;
|
||||
this->m_inputVectorProgram = nullptr;
|
||||
|
@@ -21,9 +21,9 @@
|
||||
|
||||
DistanceRGBMatteOperation::DistanceRGBMatteOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Color);
|
||||
this->addInputSocket(DataType::Color);
|
||||
this->addOutputSocket(DataType::Value);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
|
||||
this->m_inputImageProgram = nullptr;
|
||||
this->m_inputKeyProgram = nullptr;
|
||||
|
@@ -20,9 +20,9 @@
|
||||
|
||||
DotproductOperation::DotproductOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Vector);
|
||||
this->addInputSocket(DataType::Vector);
|
||||
this->addOutputSocket(DataType::Value);
|
||||
this->addInputSocket(COM_DT_VECTOR);
|
||||
this->addInputSocket(COM_DT_VECTOR);
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
this->setResolutionInputSocketIndex(0);
|
||||
this->m_input1Operation = nullptr;
|
||||
this->m_input2Operation = nullptr;
|
||||
|
@@ -1308,9 +1308,9 @@ void DoubleEdgeMaskOperation::doDoubleEdgeMask(float *imask, float *omask, float
|
||||
|
||||
DoubleEdgeMaskOperation::DoubleEdgeMaskOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addOutputSocket(DataType::Value);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
this->m_inputInnerMask = nullptr;
|
||||
this->m_inputOuterMask = nullptr;
|
||||
this->m_adjacentOnly = false;
|
||||
|
@@ -22,9 +22,9 @@
|
||||
|
||||
EllipseMaskOperation::EllipseMaskOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addOutputSocket(DataType::Value);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
this->m_inputMask = nullptr;
|
||||
this->m_inputValue = nullptr;
|
||||
this->m_cosine = 0.0f;
|
||||
|
@@ -22,7 +22,7 @@
|
||||
#include "COM_FastGaussianBlurOperation.h"
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
FastGaussianBlurOperation::FastGaussianBlurOperation() : BlurBaseOperation(DataType::Color)
|
||||
FastGaussianBlurOperation::FastGaussianBlurOperation() : BlurBaseOperation(COM_DT_COLOR)
|
||||
{
|
||||
this->m_iirgaus = nullptr;
|
||||
}
|
||||
@@ -80,7 +80,7 @@ void *FastGaussianBlurOperation::initializeTileData(rcti *rect)
|
||||
lockMutex();
|
||||
if (!this->m_iirgaus) {
|
||||
MemoryBuffer *newBuf = (MemoryBuffer *)this->m_inputProgram->initializeTileData(rect);
|
||||
MemoryBuffer *copy = new MemoryBuffer(*newBuf);
|
||||
MemoryBuffer *copy = newBuf->duplicate();
|
||||
updateSize();
|
||||
|
||||
int c;
|
||||
@@ -122,7 +122,7 @@ void FastGaussianBlurOperation::IIR_gauss(MemoryBuffer *src,
|
||||
unsigned int x, y, sz;
|
||||
unsigned int i;
|
||||
float *buffer = src->getBuffer();
|
||||
const uint8_t num_channels = src->get_num_channels();
|
||||
const unsigned int num_channels = src->get_num_channels();
|
||||
|
||||
// <0.5 not valid, though can have a possibly useful sort of sharpening effect
|
||||
if (sigma < 0.5f) {
|
||||
@@ -258,8 +258,8 @@ void FastGaussianBlurOperation::IIR_gauss(MemoryBuffer *src,
|
||||
///
|
||||
FastGaussianBlurValueOperation::FastGaussianBlurValueOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addOutputSocket(DataType::Value);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
this->m_iirgaus = nullptr;
|
||||
this->m_inputprogram = nullptr;
|
||||
this->m_sigma = 1.0f;
|
||||
@@ -310,7 +310,7 @@ void *FastGaussianBlurValueOperation::initializeTileData(rcti *rect)
|
||||
lockMutex();
|
||||
if (!this->m_iirgaus) {
|
||||
MemoryBuffer *newBuf = (MemoryBuffer *)this->m_inputprogram->initializeTileData(rect);
|
||||
MemoryBuffer *copy = new MemoryBuffer(*newBuf);
|
||||
MemoryBuffer *copy = newBuf->duplicate();
|
||||
FastGaussianBlurOperation::IIR_gauss(copy, this->m_sigma, 0, 3);
|
||||
|
||||
if (this->m_overlay == FAST_GAUSS_OVERLAY_MIN) {
|
||||
|
@@ -20,8 +20,8 @@
|
||||
|
||||
FlipOperation::FlipOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Color);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->setResolutionInputSocketIndex(0);
|
||||
this->m_inputOperation = nullptr;
|
||||
this->m_flipX = true;
|
||||
|
@@ -21,8 +21,8 @@
|
||||
|
||||
GammaCorrectOperation::GammaCorrectOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Color);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->m_inputProgram = nullptr;
|
||||
}
|
||||
void GammaCorrectOperation::initExecution()
|
||||
@@ -63,8 +63,8 @@ void GammaCorrectOperation::deinitExecution()
|
||||
|
||||
GammaUncorrectOperation::GammaUncorrectOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Color);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->m_inputProgram = nullptr;
|
||||
}
|
||||
void GammaUncorrectOperation::initExecution()
|
||||
|
@@ -21,9 +21,9 @@
|
||||
|
||||
GammaOperation::GammaOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Color);
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->m_inputProgram = nullptr;
|
||||
this->m_inputGammaProgram = nullptr;
|
||||
}
|
||||
|
@@ -22,7 +22,7 @@
|
||||
|
||||
#include "RE_pipeline.h"
|
||||
|
||||
GaussianAlphaXBlurOperation::GaussianAlphaXBlurOperation() : BlurBaseOperation(DataType::Value)
|
||||
GaussianAlphaXBlurOperation::GaussianAlphaXBlurOperation() : BlurBaseOperation(COM_DT_VALUE)
|
||||
{
|
||||
this->m_gausstab = nullptr;
|
||||
this->m_filtersize = 0;
|
||||
@@ -87,11 +87,10 @@ void GaussianAlphaXBlurOperation::executePixel(float output[4], int x, int y, vo
|
||||
MemoryBuffer *inputBuffer = (MemoryBuffer *)data;
|
||||
float *buffer = inputBuffer->getBuffer();
|
||||
int bufferwidth = inputBuffer->getWidth();
|
||||
const rcti &input_rect = inputBuffer->get_rect();
|
||||
int bufferstartx = input_rect.xmin;
|
||||
int bufferstarty = input_rect.ymin;
|
||||
int bufferstartx = inputBuffer->getRect()->xmin;
|
||||
int bufferstarty = inputBuffer->getRect()->ymin;
|
||||
|
||||
const rcti &rect = inputBuffer->get_rect();
|
||||
rcti &rect = *inputBuffer->getRect();
|
||||
int xmin = max_ii(x - m_filtersize, rect.xmin);
|
||||
int xmax = min_ii(x + m_filtersize + 1, rect.xmax);
|
||||
int ymin = max_ii(y, rect.ymin);
|
||||
|
@@ -22,7 +22,7 @@
|
||||
|
||||
#include "RE_pipeline.h"
|
||||
|
||||
GaussianAlphaYBlurOperation::GaussianAlphaYBlurOperation() : BlurBaseOperation(DataType::Value)
|
||||
GaussianAlphaYBlurOperation::GaussianAlphaYBlurOperation() : BlurBaseOperation(COM_DT_VALUE)
|
||||
{
|
||||
this->m_gausstab = nullptr;
|
||||
this->m_filtersize = 0;
|
||||
@@ -85,15 +85,15 @@ void GaussianAlphaYBlurOperation::executePixel(float output[4], int x, int y, vo
|
||||
{
|
||||
const bool do_invert = this->m_do_subtract;
|
||||
MemoryBuffer *inputBuffer = (MemoryBuffer *)data;
|
||||
const rcti &input_rect = inputBuffer->get_rect();
|
||||
float *buffer = inputBuffer->getBuffer();
|
||||
int bufferwidth = inputBuffer->getWidth();
|
||||
int bufferstartx = input_rect.xmin;
|
||||
int bufferstarty = input_rect.ymin;
|
||||
int bufferstartx = inputBuffer->getRect()->xmin;
|
||||
int bufferstarty = inputBuffer->getRect()->ymin;
|
||||
|
||||
int xmin = max_ii(x, input_rect.xmin);
|
||||
int ymin = max_ii(y - m_filtersize, input_rect.ymin);
|
||||
int ymax = min_ii(y + m_filtersize + 1, input_rect.ymax);
|
||||
rcti &rect = *inputBuffer->getRect();
|
||||
int xmin = max_ii(x, rect.xmin);
|
||||
int ymin = max_ii(y - m_filtersize, rect.ymin);
|
||||
int ymax = min_ii(y + m_filtersize + 1, rect.ymax);
|
||||
|
||||
/* *** this is the main part which is different to 'GaussianYBlurOperation' *** */
|
||||
int step = getStep();
|
||||
|
@@ -22,7 +22,7 @@
|
||||
|
||||
#include "RE_pipeline.h"
|
||||
|
||||
GaussianBokehBlurOperation::GaussianBokehBlurOperation() : BlurBaseOperation(DataType::Color)
|
||||
GaussianBokehBlurOperation::GaussianBokehBlurOperation() : BlurBaseOperation(COM_DT_COLOR)
|
||||
{
|
||||
this->m_gausstab = nullptr;
|
||||
}
|
||||
@@ -121,14 +121,14 @@ void GaussianBokehBlurOperation::executePixel(float output[4], int x, int y, voi
|
||||
MemoryBuffer *inputBuffer = (MemoryBuffer *)data;
|
||||
float *buffer = inputBuffer->getBuffer();
|
||||
int bufferwidth = inputBuffer->getWidth();
|
||||
const rcti &input_rect = inputBuffer->get_rect();
|
||||
int bufferstartx = input_rect.xmin;
|
||||
int bufferstarty = input_rect.ymin;
|
||||
int bufferstartx = inputBuffer->getRect()->xmin;
|
||||
int bufferstarty = inputBuffer->getRect()->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);
|
||||
rcti &rect = *inputBuffer->getRect();
|
||||
int ymin = max_ii(y - this->m_rady, rect.ymin);
|
||||
int ymax = min_ii(y + this->m_rady + 1, rect.ymax);
|
||||
int xmin = max_ii(x - this->m_radx, rect.xmin);
|
||||
int xmax = min_ii(x + this->m_radx + 1, rect.xmax);
|
||||
|
||||
int index;
|
||||
int step = QualityStepHelper::getStep();
|
||||
@@ -195,8 +195,7 @@ bool GaussianBokehBlurOperation::determineDependingAreaOfInterest(
|
||||
}
|
||||
|
||||
// reference image
|
||||
GaussianBlurReferenceOperation::GaussianBlurReferenceOperation()
|
||||
: BlurBaseOperation(DataType::Color)
|
||||
GaussianBlurReferenceOperation::GaussianBlurReferenceOperation() : BlurBaseOperation(COM_DT_COLOR)
|
||||
{
|
||||
this->m_maintabs = nullptr;
|
||||
}
|
||||
|
@@ -23,7 +23,7 @@
|
||||
|
||||
#include "RE_pipeline.h"
|
||||
|
||||
GaussianXBlurOperation::GaussianXBlurOperation() : BlurBaseOperation(DataType::Color)
|
||||
GaussianXBlurOperation::GaussianXBlurOperation() : BlurBaseOperation(COM_DT_COLOR)
|
||||
{
|
||||
this->m_gausstab = nullptr;
|
||||
#ifdef BLI_HAVE_SSE2
|
||||
@@ -81,15 +81,15 @@ void GaussianXBlurOperation::executePixel(float output[4], int x, int y, void *d
|
||||
float ATTR_ALIGN(16) color_accum[4] = {0.0f, 0.0f, 0.0f, 0.0f};
|
||||
float multiplier_accum = 0.0f;
|
||||
MemoryBuffer *inputBuffer = (MemoryBuffer *)data;
|
||||
const rcti &input_rect = inputBuffer->get_rect();
|
||||
float *buffer = inputBuffer->getBuffer();
|
||||
int bufferwidth = inputBuffer->getWidth();
|
||||
int bufferstartx = input_rect.xmin;
|
||||
int bufferstarty = input_rect.ymin;
|
||||
int bufferstartx = inputBuffer->getRect()->xmin;
|
||||
int bufferstarty = inputBuffer->getRect()->ymin;
|
||||
|
||||
int xmin = max_ii(x - m_filtersize, input_rect.xmin);
|
||||
int xmax = min_ii(x + m_filtersize + 1, input_rect.xmax);
|
||||
int ymin = max_ii(y, input_rect.ymin);
|
||||
rcti &rect = *inputBuffer->getRect();
|
||||
int xmin = max_ii(x - m_filtersize, rect.xmin);
|
||||
int xmax = min_ii(x + m_filtersize + 1, rect.xmax);
|
||||
int ymin = max_ii(y, rect.ymin);
|
||||
|
||||
int step = getStep();
|
||||
int offsetadd = getOffsetAdd();
|
||||
|
@@ -23,7 +23,7 @@
|
||||
|
||||
#include "RE_pipeline.h"
|
||||
|
||||
GaussianYBlurOperation::GaussianYBlurOperation() : BlurBaseOperation(DataType::Color)
|
||||
GaussianYBlurOperation::GaussianYBlurOperation() : BlurBaseOperation(COM_DT_COLOR)
|
||||
{
|
||||
this->m_gausstab = nullptr;
|
||||
#ifdef BLI_HAVE_SSE2
|
||||
@@ -80,15 +80,15 @@ void GaussianYBlurOperation::executePixel(float output[4], int x, int y, void *d
|
||||
float ATTR_ALIGN(16) color_accum[4] = {0.0f, 0.0f, 0.0f, 0.0f};
|
||||
float multiplier_accum = 0.0f;
|
||||
MemoryBuffer *inputBuffer = (MemoryBuffer *)data;
|
||||
const rcti &input_rect = inputBuffer->get_rect();
|
||||
float *buffer = inputBuffer->getBuffer();
|
||||
int bufferwidth = inputBuffer->getWidth();
|
||||
int bufferstartx = input_rect.xmin;
|
||||
int bufferstarty = input_rect.ymin;
|
||||
int bufferstartx = inputBuffer->getRect()->xmin;
|
||||
int bufferstarty = inputBuffer->getRect()->ymin;
|
||||
|
||||
int xmin = max_ii(x, input_rect.xmin);
|
||||
int ymin = max_ii(y - m_filtersize, input_rect.ymin);
|
||||
int ymax = min_ii(y + m_filtersize + 1, input_rect.ymax);
|
||||
rcti &rect = *inputBuffer->getRect();
|
||||
int xmin = max_ii(x, rect.xmin);
|
||||
int ymin = max_ii(y - m_filtersize, rect.ymin);
|
||||
int ymax = min_ii(y + m_filtersize + 1, rect.ymax);
|
||||
|
||||
int index;
|
||||
int step = getStep();
|
||||
|
@@ -21,8 +21,8 @@
|
||||
|
||||
GlareBaseOperation::GlareBaseOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Color);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->m_settings = nullptr;
|
||||
}
|
||||
void GlareBaseOperation::initExecution()
|
||||
@@ -45,7 +45,7 @@ MemoryBuffer *GlareBaseOperation::createMemoryBuffer(rcti *rect2)
|
||||
rect.ymin = 0;
|
||||
rect.xmax = getWidth();
|
||||
rect.ymax = getHeight();
|
||||
MemoryBuffer *result = new MemoryBuffer(DataType::Color, rect);
|
||||
MemoryBuffer *result = new MemoryBuffer(COM_DT_COLOR, &rect);
|
||||
float *data = result->getBuffer();
|
||||
this->generateGlare(data, tile, this->m_settings);
|
||||
return result;
|
||||
|
@@ -268,7 +268,7 @@ static void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2)
|
||||
float *kernelBuffer = in2->getBuffer();
|
||||
float *imageBuffer = in1->getBuffer();
|
||||
|
||||
MemoryBuffer *rdst = new MemoryBuffer(DataType::Color, in1->get_rect());
|
||||
MemoryBuffer *rdst = new MemoryBuffer(COM_DT_COLOR, in1->getRect());
|
||||
memset(rdst->getBuffer(),
|
||||
0,
|
||||
rdst->getWidth() * rdst->getHeight() * COM_NUM_CHANNELS_COLOR * sizeof(float));
|
||||
@@ -417,7 +417,7 @@ void GlareFogGlowOperation::generateGlare(float *data,
|
||||
// make the convolution kernel
|
||||
rcti kernelRect;
|
||||
BLI_rcti_init(&kernelRect, 0, sz, 0, sz);
|
||||
ckrn = new MemoryBuffer(DataType::Color, kernelRect);
|
||||
ckrn = new MemoryBuffer(COM_DT_COLOR, &kernelRect);
|
||||
|
||||
scale = 0.25f * sqrtf((float)(sz * sz));
|
||||
|
||||
|
@@ -41,41 +41,41 @@ void GlareGhostOperation::generateGlare(float *data, MemoryBuffer *inputTile, No
|
||||
float sc, isc, u, v, sm, s, t, ofs, scalef[64];
|
||||
const float cmo = 1.0f - settings->colmod;
|
||||
|
||||
MemoryBuffer gbuf(*inputTile);
|
||||
MemoryBuffer tbuf1(*inputTile);
|
||||
MemoryBuffer *gbuf = inputTile->duplicate();
|
||||
MemoryBuffer *tbuf1 = inputTile->duplicate();
|
||||
|
||||
bool breaked = false;
|
||||
|
||||
FastGaussianBlurOperation::IIR_gauss(&tbuf1, s1, 0, 3);
|
||||
FastGaussianBlurOperation::IIR_gauss(tbuf1, s1, 0, 3);
|
||||
if (!breaked) {
|
||||
FastGaussianBlurOperation::IIR_gauss(&tbuf1, s1, 1, 3);
|
||||
FastGaussianBlurOperation::IIR_gauss(tbuf1, s1, 1, 3);
|
||||
}
|
||||
if (isBraked()) {
|
||||
breaked = true;
|
||||
}
|
||||
if (!breaked) {
|
||||
FastGaussianBlurOperation::IIR_gauss(&tbuf1, s1, 2, 3);
|
||||
FastGaussianBlurOperation::IIR_gauss(tbuf1, s1, 2, 3);
|
||||
}
|
||||
|
||||
MemoryBuffer tbuf2(tbuf1);
|
||||
MemoryBuffer *tbuf2 = tbuf1->duplicate();
|
||||
|
||||
if (isBraked()) {
|
||||
breaked = true;
|
||||
}
|
||||
if (!breaked) {
|
||||
FastGaussianBlurOperation::IIR_gauss(&tbuf2, s2, 0, 3);
|
||||
FastGaussianBlurOperation::IIR_gauss(tbuf2, s2, 0, 3);
|
||||
}
|
||||
if (isBraked()) {
|
||||
breaked = true;
|
||||
}
|
||||
if (!breaked) {
|
||||
FastGaussianBlurOperation::IIR_gauss(&tbuf2, s2, 1, 3);
|
||||
FastGaussianBlurOperation::IIR_gauss(tbuf2, s2, 1, 3);
|
||||
}
|
||||
if (isBraked()) {
|
||||
breaked = true;
|
||||
}
|
||||
if (!breaked) {
|
||||
FastGaussianBlurOperation::IIR_gauss(&tbuf2, s2, 2, 3);
|
||||
FastGaussianBlurOperation::IIR_gauss(tbuf2, s2, 2, 3);
|
||||
}
|
||||
|
||||
ofs = (settings->iter & 1) ? 0.5f : 0.0f;
|
||||
@@ -99,57 +99,61 @@ void GlareGhostOperation::generateGlare(float *data, MemoryBuffer *inputTile, No
|
||||
|
||||
sc = 2.13;
|
||||
isc = -0.97;
|
||||
for (y = 0; y < gbuf.getHeight() && (!breaked); y++) {
|
||||
v = ((float)y + 0.5f) / (float)gbuf.getHeight();
|
||||
for (x = 0; x < gbuf.getWidth(); x++) {
|
||||
u = ((float)x + 0.5f) / (float)gbuf.getWidth();
|
||||
for (y = 0; y < gbuf->getHeight() && (!breaked); y++) {
|
||||
v = ((float)y + 0.5f) / (float)gbuf->getHeight();
|
||||
for (x = 0; x < gbuf->getWidth(); x++) {
|
||||
u = ((float)x + 0.5f) / (float)gbuf->getWidth();
|
||||
s = (u - 0.5f) * sc + 0.5f;
|
||||
t = (v - 0.5f) * sc + 0.5f;
|
||||
tbuf1.readBilinear(c, s * gbuf.getWidth(), t * gbuf.getHeight());
|
||||
tbuf1->readBilinear(c, s * gbuf->getWidth(), t * gbuf->getHeight());
|
||||
sm = smoothMask(s, t);
|
||||
mul_v3_fl(c, sm);
|
||||
s = (u - 0.5f) * isc + 0.5f;
|
||||
t = (v - 0.5f) * isc + 0.5f;
|
||||
tbuf2.readBilinear(tc, s * gbuf.getWidth() - 0.5f, t * gbuf.getHeight() - 0.5f);
|
||||
tbuf2->readBilinear(tc, s * gbuf->getWidth() - 0.5f, t * gbuf->getHeight() - 0.5f);
|
||||
sm = smoothMask(s, t);
|
||||
madd_v3_v3fl(c, tc, sm);
|
||||
|
||||
gbuf.writePixel(x, y, c);
|
||||
gbuf->writePixel(x, y, c);
|
||||
}
|
||||
if (isBraked()) {
|
||||
breaked = true;
|
||||
}
|
||||
}
|
||||
|
||||
memset(tbuf1.getBuffer(),
|
||||
memset(tbuf1->getBuffer(),
|
||||
0,
|
||||
tbuf1.getWidth() * tbuf1.getHeight() * COM_NUM_CHANNELS_COLOR * sizeof(float));
|
||||
tbuf1->getWidth() * tbuf1->getHeight() * COM_NUM_CHANNELS_COLOR * sizeof(float));
|
||||
for (n = 1; n < settings->iter && (!breaked); n++) {
|
||||
for (y = 0; y < gbuf.getHeight() && (!breaked); y++) {
|
||||
v = ((float)y + 0.5f) / (float)gbuf.getHeight();
|
||||
for (x = 0; x < gbuf.getWidth(); x++) {
|
||||
u = ((float)x + 0.5f) / (float)gbuf.getWidth();
|
||||
for (y = 0; y < gbuf->getHeight() && (!breaked); y++) {
|
||||
v = ((float)y + 0.5f) / (float)gbuf->getHeight();
|
||||
for (x = 0; x < gbuf->getWidth(); x++) {
|
||||
u = ((float)x + 0.5f) / (float)gbuf->getWidth();
|
||||
tc[0] = tc[1] = tc[2] = 0.0f;
|
||||
for (p = 0; p < 4; p++) {
|
||||
np = (n << 2) + p;
|
||||
s = (u - 0.5f) * scalef[np] + 0.5f;
|
||||
t = (v - 0.5f) * scalef[np] + 0.5f;
|
||||
gbuf.readBilinear(c, s * gbuf.getWidth() - 0.5f, t * gbuf.getHeight() - 0.5f);
|
||||
gbuf->readBilinear(c, s * gbuf->getWidth() - 0.5f, t * gbuf->getHeight() - 0.5f);
|
||||
mul_v3_v3(c, cm[np]);
|
||||
sm = smoothMask(s, t) * 0.25f;
|
||||
madd_v3_v3fl(tc, c, sm);
|
||||
}
|
||||
tbuf1.addPixel(x, y, tc);
|
||||
tbuf1->addPixel(x, y, tc);
|
||||
}
|
||||
if (isBraked()) {
|
||||
breaked = true;
|
||||
}
|
||||
}
|
||||
memcpy(gbuf.getBuffer(),
|
||||
tbuf1.getBuffer(),
|
||||
tbuf1.getWidth() * tbuf1.getHeight() * COM_NUM_CHANNELS_COLOR * sizeof(float));
|
||||
memcpy(gbuf->getBuffer(),
|
||||
tbuf1->getBuffer(),
|
||||
tbuf1->getWidth() * tbuf1->getHeight() * COM_NUM_CHANNELS_COLOR * sizeof(float));
|
||||
}
|
||||
memcpy(data,
|
||||
gbuf.getBuffer(),
|
||||
gbuf.getWidth() * gbuf.getHeight() * COM_NUM_CHANNELS_COLOR * sizeof(float));
|
||||
gbuf->getBuffer(),
|
||||
gbuf->getWidth() * gbuf->getHeight() * COM_NUM_CHANNELS_COLOR * sizeof(float));
|
||||
|
||||
delete gbuf;
|
||||
delete tbuf1;
|
||||
delete tbuf2;
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user