nodes: further optimized merge node to passthrough RGB blend textures
This commit is contained in:
@@ -44,6 +44,7 @@ function(olive_add_test GROUP NAME SOURCE)
|
||||
${NAME}
|
||||
PRIVATE
|
||||
${CMAKE_SOURCE_DIR}/app
|
||||
${CMAKE_SOURCE_DIR}/tests
|
||||
${OLIVE_INCLUDE_DIRS}
|
||||
)
|
||||
target_link_libraries(
|
||||
@@ -64,4 +65,5 @@ function(olive_add_test GROUP NAME SOURCE)
|
||||
add_test(${NAME} ${NAME})
|
||||
endfunction()
|
||||
|
||||
add_subdirectory(compositing)
|
||||
add_subdirectory(timeline)
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
# Olive - Non-Linear Video Editor
|
||||
# Copyright (C) 2021 Olive Team
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
olive_add_test(Node compositing-tests compositing-tests.cpp)
|
||||
@@ -0,0 +1,71 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2021 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#include "testutil.h"
|
||||
|
||||
#include "node/distort/transform/transformdistortnode.h"
|
||||
#include "node/generator/solid/solid.h"
|
||||
#include "node/math/merge/merge.h"
|
||||
#include "node/project/project.h"
|
||||
#include "render/rendermanager.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
OLIVE_ADD_TEST(MergeRGBOptimization)
|
||||
{
|
||||
Project project;
|
||||
|
||||
// Solids generate RGB buffers, which the merge node should optimize by passing through the blend
|
||||
SolidGenerator* source_1 = new SolidGenerator();
|
||||
source_1->setParent(&project);
|
||||
source_1->SetStandardValue(SolidGenerator::kColorInput, QVariant::fromValue(Color(1.0, 0.0, 0.0)));
|
||||
|
||||
SolidGenerator* source_2 = new SolidGenerator();
|
||||
source_2->setParent(&project);
|
||||
source_2->SetStandardValue(SolidGenerator::kColorInput, QVariant::fromValue(Color(0.0, 1.0, 0.0)));
|
||||
|
||||
MergeNode* merge_1 = new MergeNode();
|
||||
merge_1->setParent(&project);
|
||||
|
||||
MergeNode* merge_2 = new MergeNode();
|
||||
merge_2->setParent(&project);
|
||||
|
||||
Node::ConnectEdge(source_2, NodeInput(merge_1, MergeNode::kBaseIn));
|
||||
Node::ConnectEdge(source_1, NodeInput(merge_1, MergeNode::kBlendIn));
|
||||
Node::ConnectEdge(source_1, NodeInput(merge_2, MergeNode::kBaseIn));
|
||||
Node::ConnectEdge(source_2, NodeInput(merge_2, MergeNode::kBlendIn));
|
||||
|
||||
VideoParams params(1920, 1080, rational(1, 30), VideoParams::kFormatFloat16, VideoParams::kRGBAChannelCount);
|
||||
|
||||
QByteArray source_1_hash = RenderManager::Hash(source_1, SolidGenerator::kDefaultOutput, params, 0);
|
||||
QByteArray source_2_hash = RenderManager::Hash(source_2, SolidGenerator::kDefaultOutput, params, 0);
|
||||
QByteArray merge_1_hash = RenderManager::Hash(merge_1, MergeNode::kDefaultOutput, params, 0);
|
||||
QByteArray merge_2_hash = RenderManager::Hash(merge_2, MergeNode::kDefaultOutput, params, 0);
|
||||
|
||||
// Merge 1 should pass through to source 1 since source 1 is RGB and its blend
|
||||
OLIVE_ASSERT(source_1_hash == merge_1_hash);
|
||||
|
||||
// Merge 2 should pass through to source 2 since source 2 is RGB and its blend
|
||||
OLIVE_ASSERT(source_2_hash == merge_2_hash);
|
||||
|
||||
OLIVE_TEST_END;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -26,7 +26,7 @@
|
||||
#include "node/project/sequence/sequence.h"
|
||||
#include "undo/undocommand.h"
|
||||
#include "widget/timelinewidget/timelineundo.h"
|
||||
#include "../testutil.h"
|
||||
#include "testutil.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user