sequence: made divider a sequence parameter rather than a viewer parameter
Doing this makes the preview resolution an explicit project setting rather than a temporary UI setting. This will allow more consistency when caching.
This commit is contained in:
@@ -67,7 +67,7 @@ bool OpenGLProxy::Init()
|
||||
return true;
|
||||
}
|
||||
|
||||
NodeValue OpenGLProxy::FrameToValue(FramePtr frame, StreamPtr stream, const VideoRenderingParams& params)
|
||||
NodeValue OpenGLProxy::FrameToValue(FramePtr frame, StreamPtr stream, const VideoParams& params, const RenderMode::Mode& mode)
|
||||
{
|
||||
ImageStreamPtr video_stream = std::static_pointer_cast<ImageStream>(stream);
|
||||
|
||||
@@ -83,7 +83,7 @@ NodeValue OpenGLProxy::FrameToValue(FramePtr frame, StreamPtr stream, const Vide
|
||||
color_cache_.insert(colorspace_match, color_processor);
|
||||
}
|
||||
|
||||
ColorManager::OCIOMethod ocio_method = ColorManager::GetOCIOMethodForMode(params.mode());
|
||||
ColorManager::OCIOMethod ocio_method = ColorManager::GetOCIOMethodForMode(mode);
|
||||
|
||||
// OCIO's CPU conversion is more accurate, so for online we render on CPU but offline we render GPU
|
||||
if (ocio_method == ColorManager::kOCIOAccurate) {
|
||||
@@ -120,7 +120,7 @@ NodeValue OpenGLProxy::FrameToValue(FramePtr frame, StreamPtr stream, const Vide
|
||||
color_processor->Enable(ctx_, video_stream->premultiplied_alpha());
|
||||
}
|
||||
|
||||
VideoRenderingParams frame_params = frame->video_params();
|
||||
VideoParams frame_params = frame->video_params();
|
||||
|
||||
// Check frame aspect ratio
|
||||
if (frame->sample_aspect_ratio() != 1 && frame->sample_aspect_ratio() != 0) {
|
||||
@@ -136,16 +136,16 @@ NodeValue OpenGLProxy::FrameToValue(FramePtr frame, StreamPtr stream, const Vide
|
||||
new_height = qRound(static_cast<double>(new_height) / frame->sample_aspect_ratio().toDouble());
|
||||
}
|
||||
|
||||
frame_params = VideoRenderingParams(new_width,
|
||||
new_height,
|
||||
frame_params.format(),
|
||||
frame_params.divider());
|
||||
frame_params = VideoParams(new_width,
|
||||
new_height,
|
||||
frame_params.format(),
|
||||
frame_params.divider());
|
||||
}
|
||||
|
||||
VideoRenderingParams dest_params(frame_params.width(),
|
||||
frame_params.height(),
|
||||
params.format(),
|
||||
frame_params.divider());
|
||||
VideoParams dest_params(frame_params.width(),
|
||||
frame_params.height(),
|
||||
params.format(),
|
||||
frame_params.divider());
|
||||
|
||||
// Create destination texture
|
||||
OpenGLTextureCache::ReferencePtr associated_tex_ref = texture_cache_.Get(ctx_, dest_params);
|
||||
@@ -184,7 +184,7 @@ void OpenGLProxy::RunNodeAccelerated(const Node *node,
|
||||
const TimeRange &range,
|
||||
NodeValueDatabase &input_params,
|
||||
NodeValueTable &output_params,
|
||||
const VideoRenderingParams& params)
|
||||
const VideoParams& params)
|
||||
{
|
||||
OpenGLShaderPtr shader = shader_cache_.value(node->ShaderID(input_params));
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ public slots:
|
||||
const OLIVE_NAMESPACE::TimeRange &range,
|
||||
OLIVE_NAMESPACE::NodeValueDatabase &input_params,
|
||||
OLIVE_NAMESPACE::NodeValueTable& output_params,
|
||||
const OLIVE_NAMESPACE::VideoRenderingParams ¶ms);
|
||||
const OLIVE_NAMESPACE::VideoParams ¶ms);
|
||||
|
||||
void TextureToBuffer(const QVariant& texture,
|
||||
OLIVE_NAMESPACE::FramePtr frame,
|
||||
@@ -79,7 +79,8 @@ public slots:
|
||||
|
||||
OLIVE_NAMESPACE::NodeValue FrameToValue(OLIVE_NAMESPACE::FramePtr frame,
|
||||
OLIVE_NAMESPACE::StreamPtr stream,
|
||||
const OLIVE_NAMESPACE::VideoRenderingParams ¶ms);
|
||||
const OLIVE_NAMESPACE::VideoParams ¶ms,
|
||||
const OLIVE_NAMESPACE::RenderMode::Mode &mode);
|
||||
|
||||
private:
|
||||
QOpenGLContext* ctx_;
|
||||
|
||||
@@ -45,7 +45,7 @@ bool OpenGLTexture::IsCreated() const
|
||||
return (texture_);
|
||||
}
|
||||
|
||||
void OpenGLTexture::Create(QOpenGLContext *ctx, const VideoRenderingParams ¶ms, const void* data, int linesize)
|
||||
void OpenGLTexture::Create(QOpenGLContext *ctx, const VideoParams ¶ms, const void* data, int linesize)
|
||||
{
|
||||
if (!ctx) {
|
||||
qWarning() << "OpenGLTexture::Create was passed an invalid context";
|
||||
@@ -63,7 +63,7 @@ void OpenGLTexture::Create(QOpenGLContext *ctx, const VideoRenderingParams ¶
|
||||
CreateInternal(created_ctx_, &texture_, data, linesize);
|
||||
}
|
||||
|
||||
void OpenGLTexture::Create(QOpenGLContext *ctx, const VideoRenderingParams ¶ms)
|
||||
void OpenGLTexture::Create(QOpenGLContext *ctx, const VideoParams ¶ms)
|
||||
{
|
||||
Create(ctx, params, nullptr, 0);
|
||||
}
|
||||
|
||||
@@ -41,8 +41,8 @@ public:
|
||||
|
||||
DISABLE_COPY_MOVE(OpenGLTexture)
|
||||
|
||||
void Create(QOpenGLContext* ctx, const VideoRenderingParams& params, const void *data, int linesize);
|
||||
void Create(QOpenGLContext* ctx, const VideoRenderingParams& params);
|
||||
void Create(QOpenGLContext* ctx, const VideoParams& params, const void *data, int linesize);
|
||||
void Create(QOpenGLContext* ctx, const VideoParams& params);
|
||||
void Create(QOpenGLContext* ctx, FramePtr frame);
|
||||
void Create(QOpenGLContext* ctx, Frame* frame);
|
||||
|
||||
@@ -76,7 +76,7 @@ private:
|
||||
|
||||
GLuint texture_;
|
||||
|
||||
VideoRenderingParams params_;
|
||||
VideoParams params_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ OpenGLTextureCache::ReferencePtr OpenGLTextureCache::Get(QOpenGLContext *ctx, Fr
|
||||
return Get(ctx, frame->video_params(), frame->data(), frame->linesize_pixels());
|
||||
}
|
||||
|
||||
OpenGLTextureCache::ReferencePtr OpenGLTextureCache::Get(QOpenGLContext* ctx, const VideoRenderingParams ¶ms, const void *data, int linesize)
|
||||
OpenGLTextureCache::ReferencePtr OpenGLTextureCache::Get(QOpenGLContext* ctx, const VideoParams ¶ms, const void *data, int linesize)
|
||||
{
|
||||
OpenGLTexturePtr texture = nullptr;
|
||||
|
||||
@@ -76,7 +76,7 @@ OpenGLTextureCache::ReferencePtr OpenGLTextureCache::Get(QOpenGLContext* ctx, co
|
||||
return ref;
|
||||
}
|
||||
|
||||
OpenGLTextureCache::ReferencePtr OpenGLTextureCache::Get(QOpenGLContext *ctx, const VideoRenderingParams ¶ms)
|
||||
OpenGLTextureCache::ReferencePtr OpenGLTextureCache::Get(QOpenGLContext *ctx, const VideoParams ¶ms)
|
||||
{
|
||||
return Get(ctx, params, nullptr, 0);
|
||||
}
|
||||
|
||||
@@ -59,8 +59,8 @@ public:
|
||||
|
||||
ReferencePtr Get(QOpenGLContext *ctx, FramePtr frame);
|
||||
ReferencePtr Get(QOpenGLContext *ctx, Frame* frame);
|
||||
ReferencePtr Get(QOpenGLContext *ctx, const VideoRenderingParams& params, const void *data, int linesize);
|
||||
ReferencePtr Get(QOpenGLContext *ctx, const VideoRenderingParams& params);
|
||||
ReferencePtr Get(QOpenGLContext *ctx, const VideoParams& params, const void *data, int linesize);
|
||||
ReferencePtr Get(QOpenGLContext *ctx, const VideoParams& params);
|
||||
|
||||
private:
|
||||
void Relinquish(Reference* ref);
|
||||
|
||||
@@ -42,7 +42,7 @@ NodeValue OpenGLWorker::FrameToTexture(DecoderPtr decoder, StreamPtr stream, con
|
||||
{
|
||||
FramePtr frame = decoder->RetrieveVideo(range.in(),
|
||||
video_params().divider(),
|
||||
video_params().mode() == RenderMode::kOffline);
|
||||
render_mode() == RenderMode::kOffline);
|
||||
|
||||
NodeValue value;
|
||||
|
||||
@@ -53,7 +53,8 @@ NodeValue OpenGLWorker::FrameToTexture(DecoderPtr decoder, StreamPtr stream, con
|
||||
OLIVE_NS_RETURN_ARG(NodeValue, value),
|
||||
OLIVE_NS_ARG(FramePtr, frame),
|
||||
OLIVE_NS_ARG(StreamPtr, stream),
|
||||
OLIVE_NS_CONST_ARG(VideoRenderingParams&, video_params()));
|
||||
OLIVE_NS_CONST_ARG(VideoParams&, video_params()),
|
||||
OLIVE_NS_CONST_ARG(RenderMode::Mode&, render_mode()));
|
||||
}
|
||||
|
||||
return value;
|
||||
@@ -71,7 +72,7 @@ void OpenGLWorker::ProcessNodeEvent(const Node *node, const TimeRange &range, No
|
||||
OLIVE_NS_CONST_ARG(TimeRange&, range),
|
||||
OLIVE_NS_ARG(NodeValueDatabase&, input_params),
|
||||
OLIVE_NS_ARG(NodeValueTable&, output_params),
|
||||
OLIVE_NS_CONST_ARG(VideoRenderingParams&, video_params()));
|
||||
OLIVE_NS_CONST_ARG(VideoParams&, video_params()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,8 @@ RenderBackend::RenderBackend(QObject *parent) :
|
||||
QObject(parent),
|
||||
viewer_node_(nullptr),
|
||||
update_with_graph_(false),
|
||||
preview_job_time_(0)
|
||||
preview_job_time_(0),
|
||||
render_mode_(RenderMode::kOnline)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -124,7 +125,7 @@ QFuture<QList<QByteArray> > RenderBackend::Hash(const QList<rational> ×)
|
||||
hasher.addData(reinterpret_cast<const char*>(&video_params_.effective_width()), sizeof(int));
|
||||
hasher.addData(reinterpret_cast<const char*>(&video_params_.effective_height()), sizeof(int));
|
||||
hasher.addData(reinterpret_cast<const char*>(&video_params_.format()), sizeof(PixelFormat::Format));
|
||||
hasher.addData(reinterpret_cast<const char*>(&video_params_.mode()), sizeof(RenderMode::Mode));
|
||||
hasher.addData(reinterpret_cast<const char*>(&render_mode_), sizeof(RenderMode::Mode));
|
||||
|
||||
copied_viewer_node_->Hash(hasher, t);
|
||||
|
||||
@@ -167,12 +168,12 @@ RenderTicketPtr RenderBackend::RenderAudio(const TimeRange &r)
|
||||
return ticket;
|
||||
}
|
||||
|
||||
void RenderBackend::SetVideoParams(const VideoRenderingParams ¶ms)
|
||||
void RenderBackend::SetVideoParams(const VideoParams ¶ms)
|
||||
{
|
||||
video_params_ = params;
|
||||
}
|
||||
|
||||
void RenderBackend::SetAudioParams(const AudioRenderingParams ¶ms)
|
||||
void RenderBackend::SetAudioParams(const AudioParams ¶ms)
|
||||
{
|
||||
audio_params_ = params;
|
||||
}
|
||||
@@ -297,6 +298,7 @@ void RenderBackend::RunNextJob()
|
||||
worker->SetVideoParams(video_params_);
|
||||
worker->SetAudioParams(audio_params_);
|
||||
worker->SetVideoDownloadMatrix(video_download_matrix_);
|
||||
worker->SetRenderMode(render_mode_);
|
||||
if (preview_job_time_) {
|
||||
worker->EnablePreviewGeneration(viewer_node_->audio_playback_cache(), preview_job_time_);
|
||||
}
|
||||
|
||||
@@ -50,6 +50,11 @@ public:
|
||||
update_with_graph_ = e;
|
||||
}
|
||||
|
||||
void SetRenderMode(RenderMode::Mode e)
|
||||
{
|
||||
render_mode_ = e;
|
||||
}
|
||||
|
||||
void EnablePreviewGeneration(qint64 job_time)
|
||||
{
|
||||
preview_job_time_ = job_time;
|
||||
@@ -72,9 +77,9 @@ public:
|
||||
*/
|
||||
RenderTicketPtr RenderAudio(const TimeRange& r);
|
||||
|
||||
void SetVideoParams(const VideoRenderingParams& params);
|
||||
void SetVideoParams(const VideoParams& params);
|
||||
|
||||
void SetAudioParams(const AudioRenderingParams& params);
|
||||
void SetAudioParams(const AudioParams& params);
|
||||
|
||||
void SetVideoDownloadMatrix(const QMatrix4x4& mat);
|
||||
|
||||
@@ -98,11 +103,11 @@ private:
|
||||
ViewerOutput* viewer_node_;
|
||||
|
||||
// VIDEO MEMBERS
|
||||
VideoRenderingParams video_params_;
|
||||
VideoParams video_params_;
|
||||
QMatrix4x4 video_download_matrix_;
|
||||
|
||||
// AUDIO MEMBERS
|
||||
AudioRenderingParams audio_params_;
|
||||
AudioParams audio_params_;
|
||||
|
||||
QList<NodeInput*> graph_update_queue_;
|
||||
QHash<Node*, Node*> copy_map_;
|
||||
@@ -123,6 +128,8 @@ private:
|
||||
|
||||
qint64 preview_job_time_;
|
||||
|
||||
RenderMode::Mode render_mode_;
|
||||
|
||||
private slots:
|
||||
void WorkerFinished();
|
||||
|
||||
|
||||
@@ -35,7 +35,8 @@ RenderWorker::RenderWorker(RenderBackend* parent) :
|
||||
parent_(parent),
|
||||
available_(true),
|
||||
audio_mode_is_preview_(false),
|
||||
preview_cache_(nullptr)
|
||||
preview_cache_(nullptr),
|
||||
render_mode_(RenderMode::kOnline)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -48,12 +48,12 @@ public:
|
||||
available_ = a;
|
||||
}
|
||||
|
||||
void SetVideoParams(const VideoRenderingParams& params)
|
||||
void SetVideoParams(const VideoParams& params)
|
||||
{
|
||||
video_params_ = params;
|
||||
}
|
||||
|
||||
void SetAudioParams(const AudioRenderingParams& params)
|
||||
void SetAudioParams(const AudioParams& params)
|
||||
{
|
||||
audio_params_ = params;
|
||||
}
|
||||
@@ -73,6 +73,11 @@ public:
|
||||
copy_map_ = copy_map;
|
||||
}
|
||||
|
||||
void SetRenderMode(const RenderMode::Mode& mode)
|
||||
{
|
||||
render_mode_ = mode;
|
||||
}
|
||||
|
||||
void EnablePreviewGeneration(AudioPlaybackCache* cache, qint64 job_time)
|
||||
{
|
||||
preview_cache_ = cache;
|
||||
@@ -117,19 +122,24 @@ protected:
|
||||
|
||||
virtual void ProcessNodeEvent(const Node *node, const TimeRange &range, NodeValueDatabase &input_params_in, NodeValueTable &output_params) override;
|
||||
|
||||
const VideoRenderingParams& video_params() const
|
||||
const VideoParams& video_params() const
|
||||
{
|
||||
return video_params_;
|
||||
}
|
||||
|
||||
const AudioRenderingParams& audio_params() const
|
||||
const AudioParams& audio_params() const
|
||||
{
|
||||
return audio_params_;
|
||||
}
|
||||
|
||||
const RenderMode::Mode& render_mode() const
|
||||
{
|
||||
return render_mode_;
|
||||
}
|
||||
|
||||
signals:
|
||||
void AudioConformUnavailable(StreamPtr stream, TimeRange range,
|
||||
rational stream_time, AudioRenderingParams params);
|
||||
rational stream_time, AudioParams params);
|
||||
|
||||
void FinishedJob();
|
||||
|
||||
@@ -142,9 +152,9 @@ private:
|
||||
|
||||
RenderBackend* parent_;
|
||||
|
||||
VideoRenderingParams video_params_;
|
||||
VideoParams video_params_;
|
||||
|
||||
AudioRenderingParams audio_params_;
|
||||
AudioParams audio_params_;
|
||||
|
||||
struct CachedStill {
|
||||
NodeValue texture;
|
||||
@@ -170,6 +180,8 @@ private:
|
||||
|
||||
QHash<Node*, Node*>* copy_map_;
|
||||
|
||||
RenderMode::Mode render_mode_;
|
||||
|
||||
};
|
||||
|
||||
OLIVE_NAMESPACE_EXIT
|
||||
|
||||
Reference in New Issue
Block a user