reimplemented color management and alpha association in new renderer system

Color management is now as functional as it was before.
This commit is contained in:
itsmattkc
2019-12-06 13:33:53 +11:00
parent 927e2252f3
commit 33f73e0e90
14 changed files with 261 additions and 35 deletions
+22 -7
View File
@@ -4,9 +4,10 @@
#include "node/node.h"
#include "render/pixelservice.h"
VideoRenderWorker::VideoRenderWorker(DecoderCache *decoder_cache, VideoRenderFrameCache *frame_cache, QObject *parent) :
VideoRenderWorker::VideoRenderWorker(DecoderCache *decoder_cache, ColorProcessorCache *color_cache, VideoRenderFrameCache *frame_cache, QObject *parent) :
RenderWorker(decoder_cache, parent),
frame_cache_(frame_cache)
frame_cache_(frame_cache),
color_cache_(color_cache)
{
}
@@ -36,7 +37,7 @@ NodeValueTable VideoRenderWorker::RenderInternal(const NodeDependency& path)
emit CompletedFrame(path, hash, value);
} else {
// Another thread must be caching this already, nothing to be done
emit HashAlreadyBeingCached();
emit HashAlreadyBeingCached(path, hash);
}
return value;
@@ -85,7 +86,7 @@ void VideoRenderWorker::HashNodeRecursively(QCryptographicHash *hash, Node* n, c
// We have one exception for FOOTAGE types, since we resolve the footage into a frame in the renderer
if (input->data_type() == NodeParam::kFootage) {
StreamPtr stream = ResolveStreamFromInput(input);
DecoderPtr decoder = ResolveDecoderFromInput(input);
DecoderPtr decoder = ResolveDecoderFromInput(stream);
if (decoder != nullptr) {
// Add footage details to hash
@@ -99,10 +100,19 @@ void VideoRenderWorker::HashNodeRecursively(QCryptographicHash *hash, Node* n, c
// Footage stream
hash->addData(QString::number(stream->index()).toUtf8());
// Footage timestamp
hash->addData(QString::number(decoder->GetTimestampFromTime(time)).toUtf8());
if (stream->type() == Stream::kImage || stream->type() == Stream::kVideo) {
ImageStreamPtr video_stream = std::static_pointer_cast<ImageStream>(stream);
// FIXME: Add colorspace and alpha assoc
// Footage timestamp
hash->addData(QString::number(decoder->GetTimestampFromTime(time)).toUtf8());
// Current colorspace
// FIXME: Handle empty colorspace...
hash->addData(video_stream->colorspace().toUtf8());
// Alpha associated setting
hash->addData(QString::number(video_stream->premultiplied_alpha()).toUtf8());
}
}
}
}
@@ -171,3 +181,8 @@ NodeValueTable VideoRenderWorker::RenderBlock(TrackOutput *track, const TimeRang
return table;
}
ColorProcessorCache *VideoRenderWorker::color_cache() const
{
return color_cache_;
}