improved render channel count system

This commit is contained in:
itsmattkc
2020-11-15 22:16:40 +11:00
parent ee5307336e
commit 0d0766e4fb
83 changed files with 1017 additions and 1132 deletions
@@ -21,6 +21,7 @@
#ifndef MANAGEDDISPLAYOBJECT_H
#define MANAGEDDISPLAYOBJECT_H
#include <QOpenGLContext>
#include <QOpenGLWidget>
#include "render/colormanager.h"
@@ -30,6 +30,7 @@ QVariant NodeTableTraverser::ProcessVideoFootage(StreamPtr stream, const rationa
video_stream->height(),
video_stream->timebase(),
video_stream->format(),
video_stream->channel_count(),
video_stream->pixel_aspect_ratio()));
}
@@ -39,7 +40,7 @@ QVariant NodeTableTraverser::ProcessAudioFootage(StreamPtr stream, const TimeRan
return QVariant::fromValue(AudioParams(audio_stream->sample_rate(),
audio_stream->channel_layout(),
SampleFormat::kInternalFormat));
AudioParams::kInternalFormat));
}
OLIVE_NAMESPACE_EXIT
+1 -1
View File
@@ -145,7 +145,7 @@ void NodeTableView::SetTime(const rational &time)
case NodeParam::kTexture:
{
// NodeTableTraverser puts video params in here
for (int k=0;k<kRGBAChannels;k++) {
for (int k=0;k<VideoParams::kRGBAChannelCount;k++) {
this->setItemWidget(sub_item, 2 + k, new QCheckBox());
}
break;
+3 -1
View File
@@ -80,7 +80,9 @@ void HistogramScope::DrawScope(TexturePtr managed_tex, QVariant pipeline)
if (!texture_row_sums_
|| texture_row_sums_->width() != this->width()
|| texture_row_sums_->height() != this->height()) {
texture_row_sums_ = renderer()->CreateTexture(VideoParams(width(), height(), managed_tex->format()));
texture_row_sums_ = renderer()->CreateTexture(VideoParams(width(), height(),
managed_tex->format(),
managed_tex->channel_count()));
}
// Draw managed texture to a sums texture
+5 -1
View File
@@ -20,6 +20,8 @@
#include "scopebase.h"
#include "config/config.h"
OLIVE_NAMESPACE_ENTER
ScopeBase::ScopeBase(QWidget* parent) :
@@ -54,7 +56,9 @@ void ScopeBase::DrawScope(TexturePtr managed_tex, QVariant pipeline)
job.InsertValue(QStringLiteral("ove_maintex"), ShaderValue(QVariant::fromValue(managed_tex), NodeParam::kTexture));
renderer()->Blit(pipeline, job, VideoParams(width(), height(), PixelFormat::PIX_FMT_RGBA16F));
renderer()->Blit(pipeline, job, VideoParams(width(), height(),
static_cast<VideoParams::Format>(Config::Current()["OfflinePixelFormat"].toInt()),
VideoParams::kInternalChannelCount));
}
void ScopeBase::UploadTextureFromBuffer()
+4 -1
View File
@@ -28,6 +28,7 @@
#include <QVector3D>
#include "common/qtutils.h"
#include "config/config.h"
#include "node/node.h"
OLIVE_NAMESPACE_ENTER
@@ -74,7 +75,9 @@ void WaveformScope::DrawScope(TexturePtr managed_tex, QVariant pipeline)
job.InsertValue(QStringLiteral("ove_maintex"),
ShaderValue(QVariant::fromValue(managed_tex), NodeParam::kTexture));
renderer()->Blit(pipeline, job, VideoParams(width(), height(), PixelFormat::PIX_FMT_RGBA16F));
renderer()->Blit(pipeline, job, VideoParams(width(), height(),
static_cast<VideoParams::Format>(Config::Current()["OfflinePixelFormat"].toInt()),
VideoParams::kInternalChannelCount));
float waveform_dim_x = ceil((width() - 1.0) * waveform_scale);
float waveform_dim_y = ceil((height() - 1.0) * waveform_scale);
@@ -23,7 +23,7 @@
#include <QComboBox>
#include "render/pixelformat.h"
#include "render/videoparams.h"
OLIVE_NAMESPACE_ENTER
@@ -35,21 +35,21 @@ public:
QComboBox(parent)
{
// Set up preview formats
for (int i=0;i<PixelFormat::PIX_FMT_COUNT;i++) {
PixelFormat::Format pix_fmt = static_cast<PixelFormat::Format>(i);
for (int i=0;i<VideoParams::kFormatCount;i++) {
VideoParams::Format pix_fmt = static_cast<VideoParams::Format>(i);
if (!float_only || PixelFormat::FormatIsFloat(pix_fmt)) {
this->addItem(PixelFormat::GetName(pix_fmt), pix_fmt);
if (!float_only || VideoParams::FormatIsFloat(pix_fmt)) {
this->addItem(VideoParams::GetFormatName(pix_fmt), pix_fmt);
}
}
}
PixelFormat::Format GetPixelFormat() const
VideoParams::Format GetPixelFormat() const
{
return static_cast<PixelFormat::Format>(this->currentData().toInt());
return static_cast<VideoParams::Format>(this->currentData().toInt());
}
void SetPixelFormat(PixelFormat::Format fmt)
void SetPixelFormat(VideoParams::Format fmt)
{
for (int i=0; i<this->count(); i++) {
if (this->itemData(i).toInt() == fmt) {
+2 -2
View File
@@ -397,8 +397,8 @@ void ImportTool::DropGhosts(bool insert)
QVector<Block*> block_items(parent()->GetGhostItems().size());
// Check if we're inserting
if (insert) {
// Check if we're inserting (only valid if we're not creating this sequence ourselves)
if (insert && !open_sequence) {
InsertGapsAtGhostDestination(command);
}
-9
View File
@@ -37,7 +37,6 @@
#include "config/config.h"
#include "project/item/sequence/sequence.h"
#include "project/project.h"
#include "render/pixelformat.h"
#include "render/rendermanager.h"
#include "task/taskmanager.h"
#include "widget/menu/menu.h"
@@ -113,9 +112,6 @@ ViewerWidget::ViewerWidget(QWidget *parent) :
connect(waveform_view_, &AudioWaveformView::TimeChanged, this, &ViewerWidget::TimeChangedFromWaveform);
connect(waveform_view_, &AudioWaveformView::customContextMenuRequested, this, &ViewerWidget::ShowContextMenu);
// Ensures renderer is updated if the global pixel format is changed
connect(PixelFormat::instance(), &PixelFormat::FormatChanged, this, &ViewerWidget::UpdateRendererVideoParameters);
connect(&playback_backup_timer_, &QTimer::timeout, this, &ViewerWidget::PlaybackTimerUpdate);
SetAutoMaxScrollBar(true);
@@ -616,11 +612,6 @@ void ViewerWidget::RequestNextFrameForQueue()
watcher->SetTicket(GetFrame(next_time, false));
}
PixelFormat::Format ViewerWidget::GetCurrentPixelFormat() const
{
return PixelFormat::instance()->GetConfiguredFormatForMode(RenderMode::kOffline);
}
RenderTicketPtr ViewerWidget::GetFrame(const rational &t, bool clear_render_queue)
{
QByteArray cached_hash = GetConnectedNode()->video_frame_cache()->GetHash(t);
-2
View File
@@ -191,8 +191,6 @@ private:
void RequestNextFrameForQueue();
PixelFormat::Format GetCurrentPixelFormat() const;
RenderTicketPtr GetFrame(const rational& t, bool clear_render_queue);
void FinishPlayPreprocess();
+5 -4
View File
@@ -31,9 +31,9 @@
#include "common/define.h"
#include "common/functiontimer.h"
#include "gizmotraverser.h"
#include "render/pixelformat.h"
#include "config/config.h"
#include "core.h"
#include "gizmotraverser.h"
OLIVE_NAMESPACE_ENTER
@@ -105,7 +105,8 @@ void ViewerDisplayWidget::SetImage(FramePtr in_buffer)
if (!texture_
|| texture_->width() != in_buffer->width()
|| texture_->height() != in_buffer->height()
|| texture_->format() != in_buffer->format()) {
|| texture_->format() != in_buffer->format()
|| texture_->channel_count() != in_buffer->channel_count()) {
texture_ = renderer()->CreateTexture(in_buffer->video_params(), in_buffer->data(), in_buffer->linesize_pixels());
} else {
texture_->Upload(in_buffer->data(), in_buffer->linesize_pixels());
@@ -299,7 +300,7 @@ void ViewerDisplayWidget::OnPaint()
// Draw texture through color transform
renderer()->BlitColorManaged(color_service(), texture_, true,
VideoParams(width(), height(), PixelFormat::PIX_FMT_RGBA16F),
VideoParams(width(), height(), static_cast<VideoParams::Format>(Config::Current()["OfflinePixelFormat"].toInt()), VideoParams::kInternalChannelCount),
GetCompleteMatrixFlippedYTranslation());
}