various changes to rendering flow and structure
This commit is contained in:
@@ -99,7 +99,7 @@ QList<NodeDependency> ClipBlock::RunDependencies(NodeOutput *output, const ratio
|
||||
QList<NodeDependency> deps;
|
||||
|
||||
if (output == texture_output() && texture_input_->IsConnected()) {
|
||||
deps.append(NodeDependency(texture_input_->get_connected_output(), SequenceToMediaTime(time)));
|
||||
deps.append(NodeDependency(texture_input_->get_connected_output(), SequenceToMediaTime(time), SequenceToMediaTime(time)));
|
||||
}
|
||||
|
||||
return deps;
|
||||
|
||||
+20
-4
@@ -25,9 +25,15 @@ NodeDependency::NodeDependency() :
|
||||
{
|
||||
}
|
||||
|
||||
NodeDependency::NodeDependency(NodeOutput *node, const rational &time) :
|
||||
NodeDependency::NodeDependency(NodeOutput *node, const TimeRange &range) :
|
||||
node_(node),
|
||||
time_(time)
|
||||
range_(range)
|
||||
{
|
||||
}
|
||||
|
||||
NodeDependency::NodeDependency(NodeOutput *node, const rational &in, const rational &out) :
|
||||
node_(node),
|
||||
range_(in, out)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -36,7 +42,17 @@ NodeOutput *NodeDependency::node() const
|
||||
return node_;
|
||||
}
|
||||
|
||||
const rational& NodeDependency::time() const
|
||||
const rational& NodeDependency::in() const
|
||||
{
|
||||
return time_;
|
||||
return range_.in();
|
||||
}
|
||||
|
||||
const rational &NodeDependency::out() const
|
||||
{
|
||||
return range_.out();
|
||||
}
|
||||
|
||||
const TimeRange &NodeDependency::range() const
|
||||
{
|
||||
return range_;
|
||||
}
|
||||
|
||||
@@ -23,20 +23,23 @@
|
||||
|
||||
#include <QMetaType>
|
||||
|
||||
#include "common/rational.h"
|
||||
#include "common/timerange.h"
|
||||
#include "node/output.h"
|
||||
|
||||
class NodeDependency {
|
||||
public:
|
||||
NodeDependency();
|
||||
NodeDependency(NodeOutput* node, const rational& time);
|
||||
NodeDependency(NodeOutput* node, const TimeRange& range);
|
||||
NodeDependency(NodeOutput* node, const rational& in, const rational &out);
|
||||
|
||||
NodeOutput* node() const;
|
||||
const rational& time() const;
|
||||
const rational& in() const;
|
||||
const rational& out() const;
|
||||
const TimeRange& range() const;
|
||||
|
||||
private:
|
||||
NodeOutput* node_;
|
||||
rational time_;
|
||||
TimeRange range_;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(NodeDependency)
|
||||
|
||||
@@ -173,7 +173,7 @@ QVariant MediaInput::Value(NodeOutput *output, const rational &in, const rationa
|
||||
// OpenColorIO v1's color transforms can be done on GPU, which improves performance but reduces accuracy. When
|
||||
// online, we prefer accuracy over performance so we use the CPU path instead:
|
||||
// NOTE: OCIO v2 boasts 1:1 results with the CPU and GPU path so this won't be necessary forever
|
||||
if (renderer->mode() == olive::RenderMode::kOnline) {
|
||||
if (renderer->params().mode() == olive::RenderMode::kOnline) {
|
||||
// Convert to 32F, which is required for OpenColorIO's color transformation
|
||||
frame_ = PixelService::ConvertPixelFormat(frame_, olive::PIX_FMT_RGBA32F);
|
||||
|
||||
@@ -220,15 +220,15 @@ QVariant MediaInput::Value(NodeOutput *output, const rational &in, const rationa
|
||||
RenderTexturePtr output_texture = std::make_shared<RenderTexture>();
|
||||
|
||||
output_texture->Create(renderer->context(),
|
||||
renderer->width(),
|
||||
renderer->height(),
|
||||
renderer->format(),
|
||||
RenderTexture::kDoubleBuffer);
|
||||
renderer->params().width(),
|
||||
renderer->params().height(),
|
||||
renderer->params().format(),
|
||||
RenderTexture::kDoubleBuffer);
|
||||
|
||||
// Using the transformation matrix, blit our internal texture (in frame format) to our output texture (in
|
||||
// reference format)
|
||||
|
||||
if (renderer->mode() == olive::RenderMode::kOffline) {
|
||||
if (renderer->params().mode() == olive::RenderMode::kOffline) {
|
||||
// For offline rendering, OCIO's GPU path is acceptable:
|
||||
// NOTE: OCIO v2 boasts 1:1 results with the CPU and GPU path so this won't be necessary forever
|
||||
|
||||
@@ -259,8 +259,8 @@ QVariant MediaInput::Value(NodeOutput *output, const rational &in, const rationa
|
||||
QMatrix4x4 transform;
|
||||
|
||||
// Scale texture to a square for incoming matrix transformation
|
||||
transform.scale(2.0f / static_cast<float>(renderer->width() * renderer->divider()),
|
||||
2.0f / static_cast<float>(renderer->height() * renderer->divider()));
|
||||
transform.scale(2.0f / static_cast<float>(renderer->params().width() * renderer->params().divider()),
|
||||
2.0f / static_cast<float>(renderer->params().height() * renderer->params().divider()));
|
||||
|
||||
// Multiply by input transformation
|
||||
transform *= matrix_input_->get_value(in).value<QMatrix4x4>();
|
||||
@@ -273,7 +273,7 @@ QVariant MediaInput::Value(NodeOutput *output, const rational &in, const rationa
|
||||
//transform.scale(media_size, media_size);
|
||||
|
||||
// Use pipeline to blit using transformation matrix from input
|
||||
if (renderer->mode() == olive::RenderMode::kOffline) {
|
||||
if (renderer->params().mode() == olive::RenderMode::kOffline) {
|
||||
olive::gl::OCIOBlit(pipeline_, ocio_texture_, false, transform);
|
||||
} else {
|
||||
olive::gl::Blit(pipeline_, false, transform);
|
||||
|
||||
+2
-2
@@ -293,7 +293,7 @@ QList<NodeDependency> Node::RunDependencies(NodeOutput *output, const rational &
|
||||
NodeOutput* potential_dep = input->get_connected_output();
|
||||
|
||||
if (potential_dep != nullptr) {
|
||||
run_deps.append(NodeDependency(potential_dep, time));
|
||||
run_deps.append(NodeDependency(potential_dep, time, time));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -367,7 +367,7 @@ void Node::Hash(QCryptographicHash *hash, NodeOutput* from, const rational &time
|
||||
QList<NodeDependency> deps = RunDependencies(from, time);
|
||||
foreach (const NodeDependency& dep, deps) {
|
||||
// Hash the connected node
|
||||
dep.node()->parent()->Hash(hash, dep.node(), dep.time());
|
||||
dep.node()->parent()->Hash(hash, dep.node(), dep.in());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@ QList<NodeDependency> TrackOutput::RunDependencies(NodeOutput* output, const rat
|
||||
ValidateCurrentBlock(time);
|
||||
|
||||
if (current_block_ != this) {
|
||||
deps.append(NodeDependency(current_block_->texture_output(), time));
|
||||
deps.append(NodeDependency(current_block_->texture_output(), time, time));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,9 +20,7 @@
|
||||
|
||||
#include "viewer.h"
|
||||
|
||||
ViewerOutput::ViewerOutput() :
|
||||
viewer_width_(0),
|
||||
viewer_height_(0)
|
||||
ViewerOutput::ViewerOutput()
|
||||
{
|
||||
texture_input_ = new NodeInput("tex_in");
|
||||
texture_input_->add_data_input(NodeInput::kTexture);
|
||||
@@ -57,18 +55,6 @@ QString ViewerOutput::Description()
|
||||
return tr("Interface between a Viewer panel and the node system.");
|
||||
}
|
||||
|
||||
const rational &ViewerOutput::Timebase()
|
||||
{
|
||||
return timebase_;
|
||||
}
|
||||
|
||||
void ViewerOutput::SetTimebase(const rational &timebase)
|
||||
{
|
||||
timebase_ = timebase;
|
||||
|
||||
emit TimebaseChanged(timebase_);
|
||||
}
|
||||
|
||||
NodeInput *ViewerOutput::texture_input()
|
||||
{
|
||||
return texture_input_;
|
||||
@@ -103,22 +89,27 @@ void ViewerOutput::InvalidateCache(const rational &start_range, const rational &
|
||||
SendInvalidateCache(start_range, end_range);
|
||||
}
|
||||
|
||||
void ViewerOutput::SetViewerSize(const int &width, const int &height)
|
||||
const VideoParams &ViewerOutput::video_params()
|
||||
{
|
||||
viewer_width_ = width;
|
||||
viewer_height_ = height;
|
||||
|
||||
emit SizeChanged(viewer_width_, viewer_height_);
|
||||
return video_params_;
|
||||
}
|
||||
|
||||
const int &ViewerOutput::ViewerWidth()
|
||||
const AudioParams &ViewerOutput::audio_params()
|
||||
{
|
||||
return viewer_width_;
|
||||
return audio_params_;
|
||||
}
|
||||
|
||||
const int &ViewerOutput::ViewerHeight()
|
||||
void ViewerOutput::set_video_params(const VideoParams &video)
|
||||
{
|
||||
return viewer_height_;
|
||||
video_params_ = video;
|
||||
|
||||
emit SizeChanged(video_params_.width(), video_params_.height());
|
||||
emit TimebaseChanged(video_params_.time_base());
|
||||
}
|
||||
|
||||
void ViewerOutput::set_audio_params(const AudioParams &audio)
|
||||
{
|
||||
audio_params_ = audio;
|
||||
}
|
||||
|
||||
rational ViewerOutput::Length()
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
#define VIEWER_H
|
||||
|
||||
#include "node/node.h"
|
||||
#include "render/videoparams.h"
|
||||
#include "render/audio/audioparams.h"
|
||||
#include "render/rendertexture.h"
|
||||
|
||||
/**
|
||||
@@ -40,9 +42,6 @@ public:
|
||||
virtual QString Category() override;
|
||||
virtual QString Description() override;
|
||||
|
||||
const rational& Timebase();
|
||||
void SetTimebase(const rational& timebase);
|
||||
|
||||
NodeInput* texture_input();
|
||||
NodeInput* samples_input();
|
||||
NodeInput* length_input();
|
||||
@@ -52,10 +51,11 @@ public:
|
||||
|
||||
virtual void InvalidateCache(const rational &start_range, const rational &end_range, NodeInput *from = nullptr) override;
|
||||
|
||||
void SetViewerSize(const int& width, const int& height);
|
||||
const VideoParams& video_params();
|
||||
const AudioParams& audio_params();
|
||||
|
||||
const int& ViewerWidth();
|
||||
const int& ViewerHeight();
|
||||
void set_video_params(const VideoParams& video);
|
||||
void set_audio_params(const AudioParams& audio);
|
||||
|
||||
rational Length();
|
||||
|
||||
@@ -78,9 +78,9 @@ private:
|
||||
|
||||
rational timebase_;
|
||||
|
||||
int viewer_width_;
|
||||
VideoParams video_params_;
|
||||
|
||||
int viewer_height_;
|
||||
AudioParams audio_params_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user