use correct size with media node

This commit is contained in:
itsmattkc
2019-09-10 12:56:07 +10:00
parent fc4ce3b26e
commit 333d7392d9
10 changed files with 33 additions and 17 deletions
+8 -8
View File
@@ -235,17 +235,17 @@ QVariant MediaInput::Value(NodeOutput *output, const rational &time)
QMatrix4x4 transform;
float sequence_aspect_ratio = static_cast<float>(renderer->width()) / static_cast<float>(renderer->height());
float media_aspect_ratio = static_cast<float>(frame_->width()) / static_cast<float>(frame_->height());
// Scale texture to a square for incoming matrix transformation
transform.scale(static_cast<float>(renderer->height()) / static_cast<float>(renderer->width()), 1.0f);
transform.scale(1.0f / sequence_aspect_ratio, 1.0f);
// Input transform
// Multiply by input transformation
transform *= matrix_input_->get_value(time).value<QMatrix4x4>();
transform.scale(media_aspect_ratio, 1.0f);
/*transform.scale(static_cast<float>(frame_->width()) / static_cast<float>(renderer->width()),
static_cast<float>(frame_->height()) / static_cast<float>(renderer->height()));*/
// Scale texture to the media's aspect ratio
transform.scale(static_cast<float>(frame_->width()) / static_cast<float>(frame_->height()), 1.0f);
float media_size = static_cast<float>(frame_->height()) / static_cast<float>(renderer->height() * renderer->divider());
transform.scale(media_size, media_size);
// Use pipeline to blit using transformation matrix from input
if (renderer->mode() == olive::RenderMode::kOffline) {
+2 -2
View File
@@ -257,7 +257,7 @@ void RendererProcessor::Start()
threads_.resize(background_thread_count);
for (int i=0;i<threads_.size();i++) {
threads_[i] = std::make_shared<RendererProcessThread>(this, ctx, effective_width_, effective_height_, format_, mode_);
threads_[i] = std::make_shared<RendererProcessThread>(this, ctx, effective_width_, effective_height_, divider_, format_, mode_);
threads_[i]->StartThread(QThread::LowPriority);
// Ensure this connection is "Queued" so that it always runs in this object's threaded rather than any of the
@@ -290,7 +290,7 @@ void RendererProcessor::Start()
for (int i=0;i<download_threads_.size();i++) {
// Create download thread
download_threads_[i] = std::make_shared<RendererDownloadThread>(ctx, effective_width_, effective_height_, format_, mode_);
download_threads_[i] = std::make_shared<RendererDownloadThread>(ctx, effective_width_, effective_height_, divider_, format_, mode_);
download_threads_[i]->StartThread(QThread::LowPriority);
connect(download_threads_[i].get(),
@@ -10,9 +10,10 @@
RendererDownloadThread::RendererDownloadThread(QOpenGLContext *share_ctx,
const int &width,
const int &height,
const int &divider,
const olive::PixelFormat &format,
const olive::RenderMode &mode) :
RendererThreadBase(share_ctx, width, height, format, mode),
RendererThreadBase(share_ctx, width, height, divider, format, mode),
cancelled_(false)
{
}
@@ -9,7 +9,7 @@ class RendererDownloadThread : public RendererThreadBase
public:
RendererDownloadThread(QOpenGLContext* share_ctx,
const int& width,
const int& height,
const int& height, const int &divider,
const olive::PixelFormat& format,
const olive::RenderMode& mode);
@@ -26,9 +26,10 @@ RendererProcessThread::RendererProcessThread(RendererProcessor* parent,
QOpenGLContext *share_ctx,
const int &width,
const int &height,
const int &divider,
const olive::PixelFormat &format,
const olive::RenderMode &mode) :
RendererThreadBase(share_ctx, width, height, format, mode),
RendererThreadBase(share_ctx, width, height, divider, format, mode),
parent_(parent),
cancelled_(false)
{
@@ -32,7 +32,7 @@ public:
RendererProcessThread(RendererProcessor* parent,
QOpenGLContext* share_ctx,
const int& width,
const int& height,
const int& height, const int &divider,
const olive::PixelFormat& format,
const olive::RenderMode& mode);
@@ -22,10 +22,11 @@
#include <QDebug>
RendererThreadBase::RendererThreadBase(QOpenGLContext *share_ctx, const int &width, const int &height, const olive::PixelFormat &format, const olive::RenderMode &mode) :
RendererThreadBase::RendererThreadBase(QOpenGLContext *share_ctx, const int &width, const int &height, const int &divider, const olive::PixelFormat &format, const olive::RenderMode &mode) :
share_ctx_(share_ctx),
width_(width),
height_(height),
divider_(divider),
format_(format),
mode_(mode),
render_instance_(nullptr)
@@ -48,7 +49,7 @@ void RendererThreadBase::run()
wait_cond_.wakeAll();
caller_mutex_.unlock();
RenderInstance instance(width_, height_, format_, mode_);
RenderInstance instance(width_, height_, divider_, format_, mode_);
render_instance_ = &instance;
instance.SetShareContext(share_ctx_);
@@ -36,6 +36,7 @@ public:
RendererThreadBase(QOpenGLContext* share_ctx,
const int& width,
const int& height,
const int& divider,
const olive::PixelFormat& format,
const olive::RenderMode& mode);
@@ -64,6 +65,8 @@ private:
const int& height_;
const int& divider_;
const olive::PixelFormat& format_;
const olive::RenderMode& mode_;
+8 -1
View File
@@ -26,13 +26,15 @@
RenderInstance::RenderInstance(const int& width,
const int& height,
const int &divider,
const olive::PixelFormat& format,
const olive::RenderMode& mode) :
share_ctx_(nullptr),
width_(width),
height_(height),
format_(format),
mode_(mode)
mode_(mode),
divider_(divider)
{
}
@@ -130,6 +132,11 @@ const int &RenderInstance::height() const
return height_;
}
const int &RenderInstance::divider() const
{
return divider_;
}
const olive::PixelFormat &RenderInstance::format() const
{
return format_;
+3
View File
@@ -41,6 +41,7 @@ class RenderInstance : public QObject
public:
RenderInstance(const int& width,
const int& height,
const int& divider,
const olive::PixelFormat& format,
const olive::RenderMode& mode);
@@ -60,6 +61,8 @@ public:
const int& height() const;
const int& divider() const;
const olive::PixelFormat& format() const;
const olive::RenderMode& mode() const;