oslbackend: began new backend classes

This commit is contained in:
itsmattkc
2020-02-05 14:49:55 +11:00
parent 91f1be90a9
commit 1e71c0e7f5
10 changed files with 125 additions and 29 deletions
+24
View File
@@ -0,0 +1,24 @@
# Olive - Non-Linear Video Editor
# Copyright (C) 2019 Olive Team
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
set(OLIVE_SOURCES
${OLIVE_SOURCES}
render/backend/osl/oslbackend.h
render/backend/osl/oslbackend.cpp
render/backend/osl/oslworker.h
render/backend/osl/oslworker.cpp
PARENT_SCOPE
)
+42
View File
@@ -0,0 +1,42 @@
#include "oslbackend.h"
#include <QEventLoop>
#include <QThread>
#include "oslworker.h"
OSLBackend::OSLBackend(QObject *parent) :
VideoRenderBackend(parent)
{
}
OSLBackend::~OSLBackend()
{
Close();
}
bool OSLBackend::InitInternal()
{
if (!VideoRenderBackend::InitInternal()) {
return false;
}
// Initiate one thread per CPU core
for (int i=0;i<threads().size();i++) {
// Create one processor object for each thread
OSLWorker* processor = new OSLWorker(frame_cache());
processor->SetParameters(params());
processors_.append(processor);
}
return true;
}
bool OSLBackend::CompileInternal()
{
return true;
}
void OSLBackend::DecompileInternal()
{
}
+25
View File
@@ -0,0 +1,25 @@
#ifndef OSLBACKEND_H
#define OSLBACKEND_H
#include "../videorenderbackend.h"
class OSLBackend : public VideoRenderBackend
{
Q_OBJECT
public:
OSLBackend(QObject* parent = nullptr);
virtual ~OSLBackend() override;
protected:
virtual bool InitInternal() override;
virtual bool CompileInternal() override;
virtual void DecompileInternal() override;
virtual void ParamsChangedEvent() override;
};
#endif // OSLBACKEND_H
+25
View File
@@ -0,0 +1,25 @@
#include "oslworker.h"
#include "common/clamp.h"
#include "core.h"
#include "node/block/transition/transition.h"
#include "node/node.h"
#include "render/colormanager.h"
#include "render/pixelservice.h"
OSLWorker::OSLWorker(VideoRenderFrameCache *frame_cache, QObject *parent) :
VideoRenderWorker(frame_cache, parent)
{
}
void OSLWorker::FrameToValue(StreamPtr stream, FramePtr frame, NodeValueTable *table)
{
}
void OSLWorker::RunNodeAccelerated(const Node *node, const TimeRange &range, const NodeValueDatabase &input_params, NodeValueTable *output_params)
{
}
void OSLWorker::TextureToBuffer(const QVariant &tex_in, QByteArray &buffer)
{
}
+22
View File
@@ -0,0 +1,22 @@
#ifndef OSLWORKER_H
#define OSLWORKER_H
#include "../videorenderworker.h"
class OSLWorker : public VideoRenderWorker
{
Q_OBJECT
public:
OSLWorker(VideoRenderFrameCache* frame_cache,
QObject* parent = nullptr);
protected:
virtual void FrameToValue(StreamPtr stream, FramePtr frame, NodeValueTable* table) override;
virtual void RunNodeAccelerated(const Node *node, const TimeRange &range, const NodeValueDatabase &input_params, NodeValueTable* output_params) override;
virtual void TextureToBuffer(const QVariant& texture, QByteArray& buffer) override;
};
#endif // OSLWORKER_H