nodes: store time with accelerated jobs

Fixes #2031
This commit is contained in:
itsmattkc
2022-09-23 02:55:18 -07:00
parent b553d5afb7
commit b19730b1f5
10 changed files with 37 additions and 29 deletions
+1 -3
View File
@@ -64,8 +64,6 @@ QString PanNode::Description() const
void PanNode::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const
{
Q_UNUSED(globals)
// Create a sample job
SampleBuffer samples = value[kSamplesInput].toSamples();
if (samples.is_allocated()) {
@@ -85,7 +83,7 @@ void PanNode::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeV
table->Push(NodeValue(NodeValue::kSamples, samples, this));
} else {
// Requires job
table->Push(NodeValue::kSamples, SampleJob(kSamplesInput, value), this);
table->Push(NodeValue::kSamples, SampleJob(globals.time(), kSamplesInput, value), this);
}
} else {
// Pass right through
+1 -3
View File
@@ -63,8 +63,6 @@ QString VolumeNode::Description() const
void VolumeNode::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const
{
Q_UNUSED(globals)
// Create a sample job
SampleBuffer buffer = value[kSamplesInput].toSamples();
@@ -80,7 +78,7 @@ void VolumeNode::Value(const NodeValueRow &value, const NodeGlobals &globals, No
table->Push(NodeValue::kSamples, QVariant::fromValue(buffer), this);
} else {
// Requires job
SampleJob job(kSamplesInput, value);
SampleJob job(globals.time(), kSamplesInput, value);
job.Insert(kVolumeInput, value);
table->Push(NodeValue::kSamples, QVariant::fromValue(job), this);
}
+1 -1
View File
@@ -410,7 +410,7 @@ void MathNodeBase::ValueInternal(Operation operation, Pairing pairing, const QSt
output->Push(NodeValue::kSamples, QVariant::fromValue(buffer), this);
} else {
SampleJob job(val_a.type() == NodeValue::kSamples ? val_a : val_b);
SampleJob job(globals.time(), val_a.type() == NodeValue::kSamples ? val_a : val_b);
job.Insert(number_param, NodeValue(NodeValue::kFloat, number, this));
output->Push(NodeValue::kSamples, QVariant::fromValue(job), this);
}
+1 -1
View File
@@ -265,7 +265,7 @@ void Footage::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeV
// Push each stream as a footage job
for (int i=0; i<GetTotalStreamCount(); i++) {
Track::Reference ref = GetReferenceFromRealIndex(i);
FootageJob job(decoder_, filename(), ref.type(), GetLength());
FootageJob job(globals.time(), decoder_, filename(), ref.type(), GetLength());
NodeValue::Type type;
+11 -11
View File
@@ -61,7 +61,7 @@ NodeValueRow NodeTraverser::GenerateRow(NodeValueDatabase *database, const Node
row.insert(it.key(), value);
}
PreProcessRow(range, row);
PreProcessRow(row);
return row;
}
@@ -357,7 +357,7 @@ QVector2D NodeTraverser::GenerateResolution() const
return QVector2D(video_params_.square_pixel_width(), video_params_.height());
}
void NodeTraverser::ResolveJobs(NodeValue &val, const TimeRange &range)
void NodeTraverser::ResolveJobs(NodeValue &val)
{
if (val.type() == NodeValue::kTexture || val.type() == NodeValue::kSamples) {
if (val.canConvert<CacheJob>()) {
@@ -374,7 +374,7 @@ void NodeTraverser::ResolveJobs(NodeValue &val, const TimeRange &range)
ShaderJob job = val.value<ShaderJob>();
PreProcessRow(range, job.GetValues());
PreProcessRow(job.GetValues());
VideoParams tex_params = GetCacheVideoParams();
tex_params.set_channel_count(GetChannelCountFromJob(job));
@@ -389,7 +389,7 @@ void NodeTraverser::ResolveJobs(NodeValue &val, const TimeRange &range)
TexturePtr tex = CreateTexture(tex_params);
ProcessShader(tex, val.source(), range, job);
ProcessShader(tex, val.source(), job);
val.set_value(tex);
@@ -407,7 +407,7 @@ void NodeTraverser::ResolveJobs(NodeValue &val, const TimeRange &range)
TexturePtr tex = CreateTexture(upload_params);
PreProcessRow(range, job.GetValues());
PreProcessRow(job.GetValues());
ProcessFrameGeneration(tex, val.source(), job);
if (!job.GetColorspace().isEmpty()) {
@@ -440,7 +440,7 @@ void NodeTraverser::ResolveJobs(NodeValue &val, const TimeRange &range)
if (job.type() == Track::kVideo) {
rational footage_time = Footage::AdjustTimeByLoopMode(range.in(), loop_mode_, job.length(), job.video_params().video_type(), job.video_params().frame_rate_as_time_base());
rational footage_time = Footage::AdjustTimeByLoopMode(job.time().in(), loop_mode_, job.length(), job.video_params().video_type(), job.video_params().frame_rate_as_time_base());
TexturePtr tex;
@@ -473,8 +473,8 @@ void NodeTraverser::ResolveJobs(NodeValue &val, const TimeRange &range)
} else if (job.type() == Track::kAudio) {
SampleBuffer buffer = CreateSampleBuffer(GetCacheAudioParams(), range.length());
ProcessAudioFootage(buffer, job, range);
SampleBuffer buffer = CreateSampleBuffer(GetCacheAudioParams(), job.time().length());
ProcessAudioFootage(buffer, job, job.time());
val.set_value(buffer);
}
@@ -483,7 +483,7 @@ void NodeTraverser::ResolveJobs(NodeValue &val, const TimeRange &range)
SampleJob job = val.value<SampleJob>();
SampleBuffer output_buffer = CreateSampleBuffer(job.samples().audio_params(), job.samples().sample_count());
ProcessSamples(output_buffer, val.source(), range, job);
ProcessSamples(output_buffer, val.source(), job.time(), job);
val.set_value(QVariant::fromValue(output_buffer));
}
@@ -491,7 +491,7 @@ void NodeTraverser::ResolveJobs(NodeValue &val, const TimeRange &range)
}
}
void NodeTraverser::PreProcessRow(const TimeRange &range, NodeValueRow &row)
void NodeTraverser::PreProcessRow(NodeValueRow &row)
{
QByteArray cached_node_hash;
@@ -500,7 +500,7 @@ void NodeTraverser::PreProcessRow(const TimeRange &range, NodeValueRow &row)
// Jobs will almost always be submitted with one of these types
NodeValue &val = it.value();
ResolveJobs(val, range);
ResolveJobs(val);
}
}
+3 -3
View File
@@ -93,7 +93,7 @@ protected:
virtual void ProcessAudioFootage(SampleBuffer &destination, const FootageJob &stream, const TimeRange &input_time){}
virtual void ProcessShader(TexturePtr destination, const Node *node, const TimeRange &range, const ShaderJob& job){}
virtual void ProcessShader(TexturePtr destination, const Node *node, const ShaderJob& job){}
virtual void ProcessColorTransform(TexturePtr destination, const Node *node, const ColorTransformJob& job){}
@@ -140,7 +140,7 @@ protected:
CancelAtom *GetCancelPointer() const { return cancel_; }
void SetCancelPointer(CancelAtom *cancel) { cancel_ = cancel; }
void ResolveJobs(NodeValue &value, const TimeRange &range);
void ResolveJobs(NodeValue &value);
Block *GetCurrentBlock() const
{
@@ -150,7 +150,7 @@ protected:
Decoder::LoopMode loop_mode() const { return loop_mode_; }
private:
void PreProcessRow(const TimeRange &range, NodeValueRow &row);
void PreProcessRow(NodeValueRow &row);
TexturePtr CreateDummyTexture(const VideoParams &p);