traverser: fixed regression regarding converting generated frames

This commit is contained in:
itsmattkc
2022-05-03 20:49:44 -07:00
parent d8a944c8c4
commit a3c52cafaa
4 changed files with 25 additions and 16 deletions
+13 -2
View File
@@ -317,15 +317,26 @@ void NodeTraverser::ResolveJobs(NodeValue &val, const TimeRange &range)
VideoParams tex_params = GetCacheVideoParams();
tex_params.set_channel_count(GetChannelCountFromJob(job));
VideoParams upload_params = tex_params;
if (job.GetRequestedFormat() != VideoParams::kFormatInvalid) {
tex_params.set_format(job.GetRequestedFormat());
upload_params.set_format(job.GetRequestedFormat());
}
TexturePtr tex = CreateTexture(tex_params);
TexturePtr tex = CreateTexture(upload_params);
PreProcessRow(range, job.GetValues());
ProcessFrameGeneration(tex, val.source(), job);
if (!job.GetColorspace().isEmpty()) {
// Convert to reference space
TexturePtr dest = CreateTexture(tex_params);
ConvertToReferenceSpace(dest, tex, job.GetColorspace());
tex = dest;
}
val.set_data(QVariant::fromValue(tex));
} else if (v.canConvert<FootageJob>()) {
+2
View File
@@ -92,6 +92,8 @@ protected:
virtual void ProcessFrameGeneration(TexturePtr destination, const Node *node, const GenerateJob& job){}
virtual void ConvertToReferenceSpace(TexturePtr destination, TexturePtr source, const QString &input_cs){}
virtual TexturePtr CreateTexture(const VideoParams &p)
{
return CreateDummyTexture(p);
+8 -14
View File
@@ -554,20 +554,7 @@ void RenderProcessor::ProcessFrameGeneration(TexturePtr destination, const Node
node->GenerateFrame(frame, job);
if (job.GetColorspace().isEmpty()) {
// Just upload frame data straight to frame
destination->Upload(frame->data(), frame->linesize_pixels());
} else {
// Convert to reference space
// Upload to middle texture
TexturePtr mid = render_ctx_->CreateTexture(GetCacheVideoParams());
mid->Upload(frame->data(), frame->linesize_pixels());
ColorManager* color_manager = Node::ValueToPtr<ColorManager>(ticket_->property("colormanager"));
ColorProcessorPtr cp = ColorProcessor::Create(color_manager, job.GetColorspace(), color_manager->GetReferenceColorSpace());
render_ctx_->BlitColorManaged(cp, mid, Renderer::kAlphaAssociated, destination.get());
}
destination->Upload(frame->data(), frame->linesize_pixels());
}
bool RenderProcessor::CanCacheFrames()
@@ -575,4 +562,11 @@ bool RenderProcessor::CanCacheFrames()
return ticket_->property("type").value<RenderManager::TicketType>() == RenderManager::kTypeVideo;
}
void RenderProcessor::ConvertToReferenceSpace(TexturePtr destination, TexturePtr source, const QString &input_cs)
{
ColorManager* color_manager = Node::ValueToPtr<ColorManager>(ticket_->property("colormanager"));
ColorProcessorPtr cp = ColorProcessor::Create(color_manager, input_cs, color_manager->GetReferenceColorSpace());
render_ctx_->BlitColorManaged(cp, source, Renderer::kAlphaAssociated, destination.get());
}
}
+2
View File
@@ -66,6 +66,8 @@ protected:
return SampleBuffer::CreateAllocated(params, sample_count);
}
virtual void ConvertToReferenceSpace(TexturePtr destination, TexturePtr source, const QString &input_cs) override;
private:
RenderProcessor(RenderTicketPtr ticket, Renderer* render_ctx, DecoderCache* decoder_cache, ShaderCache* shader_cache, QVariant default_shader);