completed color management implementation
This commit adds the background functionality of the render cache invalidating whenever a footage's color space is changed. This includes when the project's configuration is changed as well.
This commit is contained in:
@@ -5,6 +5,6 @@
|
||||
#include "render/colorprocessor.h"
|
||||
#include "rendercache.h"
|
||||
|
||||
using ColorProcessorCache = RenderCache<Stream*, ColorProcessorPtr>;
|
||||
using ColorProcessorCache = RenderCache<QString, ColorProcessorPtr>;
|
||||
|
||||
#endif // COLORPROCESSORCACHE_H
|
||||
|
||||
@@ -55,9 +55,6 @@ bool OpenGLWorker::InitInternal()
|
||||
|
||||
void OpenGLWorker::FrameToValue(StreamPtr stream, FramePtr frame, NodeValueTable *table)
|
||||
{
|
||||
// Set up OCIO context
|
||||
OpenGLColorProcessorPtr color_processor = std::static_pointer_cast<OpenGLColorProcessor>(color_cache()->Get(stream.get()));
|
||||
|
||||
// Ensure stream is video or image type
|
||||
if (stream->type() != Stream::kVideo && stream->type() != Stream::kImage) {
|
||||
return;
|
||||
@@ -65,16 +62,13 @@ void OpenGLWorker::FrameToValue(StreamPtr stream, FramePtr frame, NodeValueTable
|
||||
|
||||
ImageStreamPtr video_stream = std::static_pointer_cast<ImageStream>(stream);
|
||||
|
||||
if (!color_processor) {
|
||||
QString input_colorspace = video_stream->colorspace();
|
||||
if (input_colorspace.isEmpty()) {
|
||||
// FIXME: Should use Stream->Footage to find the Project* since that's a direct chain
|
||||
input_colorspace = olive::core.GetActiveProject()->default_input_colorspace();
|
||||
}
|
||||
// Set up OCIO context
|
||||
OpenGLColorProcessorPtr color_processor = std::static_pointer_cast<OpenGLColorProcessor>(color_cache()->Get(video_stream->colorspace()));
|
||||
|
||||
color_processor = OpenGLColorProcessor::CreateOpenGL(input_colorspace,
|
||||
if (!color_processor) {
|
||||
color_processor = OpenGLColorProcessor::CreateOpenGL(video_stream->colorspace(),
|
||||
OCIO::ROLE_SCENE_LINEAR);
|
||||
color_cache()->Add(stream.get(), color_processor);
|
||||
color_cache()->Add(video_stream->colorspace(), color_processor);
|
||||
}
|
||||
|
||||
// OCIO's CPU conversion is more accurate, so for online we render on CPU but offline we render GPU
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "common/define.h"
|
||||
#include "node/node.h"
|
||||
#include "project/project.h"
|
||||
#include "render/pixelservice.h"
|
||||
|
||||
VideoRenderWorker::VideoRenderWorker(VideoRenderFrameCache *frame_cache, QObject *parent) :
|
||||
@@ -102,8 +103,8 @@ void VideoRenderWorker::HashNodeRecursively(QCryptographicHash *hash, const Node
|
||||
// Footage timestamp
|
||||
hash->addData(QString::number(decoder->GetTimestampFromTime(input_time)).toUtf8());
|
||||
|
||||
// Current colorspace
|
||||
// FIXME: Handle empty colorspace...
|
||||
// Current color config and space
|
||||
hash->addData(video_stream->footage()->project()->ocio_config().toUtf8());
|
||||
hash->addData(video_stream->colorspace().toUtf8());
|
||||
|
||||
// Alpha associated setting
|
||||
|
||||
Reference in New Issue
Block a user