openglrenderer: retrieve frame in each worker thread rather than in the proxy thread

Since we now have decoders in each thread, we can parallelize by retrieving
frames in each thread as well.
This commit is contained in:
itsmattkc
2020-04-11 17:37:00 +10:00
parent f08734d18e
commit a8fbe686e2
4 changed files with 8 additions and 11 deletions
+1 -8
View File
@@ -67,7 +67,7 @@ bool OpenGLProxy::Init()
return true;
}
void OpenGLProxy::FrameToValue(DecoderPtr decoder, StreamPtr stream, const TimeRange &range, NodeValueTable* table)
void OpenGLProxy::FrameToValue(FramePtr frame, StreamPtr stream, const TimeRange &range, NodeValueTable* table)
{
// Ensure stream is video or image type
if (stream->type() != Stream::kVideo && stream->type() != Stream::kImage) {
@@ -105,13 +105,6 @@ void OpenGLProxy::FrameToValue(DecoderPtr decoder, StreamPtr stream, const TimeR
ColorManager::OCIOMethod ocio_method = ColorManager::GetOCIOMethodForMode(video_params_.mode());
FramePtr frame = decoder->RetrieveVideo(range.in(), video_params_.divider());
if (!frame) {
// Nothing to be done
return;
}
// OCIO's CPU conversion is more accurate, so for online we render on CPU but offline we render GPU
if (ocio_method == ColorManager::kOCIOAccurate) {
bool has_alpha = PixelFormat::FormatHasAlphaChannel(frame->format());
+1 -1
View File
@@ -63,7 +63,7 @@ public:
void Close();
void FrameToValue(DecoderPtr decoder, StreamPtr stream, const TimeRange &range, NodeValueTable* table);
void FrameToValue(FramePtr frame, StreamPtr stream, const TimeRange &range, NodeValueTable* table);
void RunNodeAccelerated(const Node *node, const TimeRange &range, const NodeValueDatabase &input_params, NodeValueTable* output_params);
+5 -1
View File
@@ -38,7 +38,11 @@ OpenGLWorker::OpenGLWorker(VideoRenderFrameCache *frame_cache, QObject *parent)
void OpenGLWorker::FrameToValue(DecoderPtr decoder, StreamPtr stream, const TimeRange &range, NodeValueTable *table)
{
emit RequestFrameToValue(decoder, stream, range, table);
FramePtr frame = decoder->RetrieveVideo(range.in(), video_params().divider());
if (frame) {
emit RequestFrameToValue(frame, stream, range, table);
}
}
void OpenGLWorker::RunNodeAccelerated(const Node *node, const TimeRange &range, const NodeValueDatabase &input_params, NodeValueTable *output_params)
+1 -1
View File
@@ -38,7 +38,7 @@ public:
QObject* parent = nullptr);
signals:
void RequestFrameToValue(DecoderPtr decoder, StreamPtr stream, const TimeRange &range, NodeValueTable* table);
void RequestFrameToValue(FramePtr frame, StreamPtr stream, const TimeRange &range, NodeValueTable* table);
void RequestRunNodeAccelerated(const Node *node, const TimeRange &range, const NodeValueDatabase &input_params, NodeValueTable* output_params);