first commit

This commit is contained in:
itsmattkc
2019-02-20 19:13:10 -08:00
parent f4668e317a
commit 110b75a04d
5 changed files with 473 additions and 365 deletions
+36 -10
View File
@@ -20,11 +20,20 @@
#include "renderfunctions.h"
extern "C" {
#include <libavformat/avformat.h>
}
#include <QOpenGLFramebufferObject>
#include <QApplication>
#include <QDesktopWidget>
#include <QDebug>
#ifdef OLIVE_OCIO
#include <OpenColorIO/OpenColorIO.h>
namespace OCIO = OCIO_NAMESPACE;
#endif
#include "project/clip.h"
#include "project/sequence.h"
#include "project/media.h"
@@ -43,10 +52,6 @@
#include "panels/timeline.h"
#include "panels/viewer.h"
extern "C" {
#include <libavformat/avformat.h>
}
void full_blit() {
glPushMatrix();
glLoadIdentity();
@@ -358,15 +363,36 @@ GLuint compose_sequence(ComposeSequenceParams &params) {
// compose_sequence() would have written to this clip's fbo[0], so we switch to fbo[1]
fbo_switcher = true;
} else if (c->media->get_type() == MEDIA_TYPE_FOOTAGE && !c->media->to_footage()->alpha_is_premultiplied) {
// alpha is not premultiplied, we'll need to premultiply it for the rest of the pipeline
params.premultiply_program->bind();
} else if (c->media->get_type() == MEDIA_TYPE_FOOTAGE) {
textureID = draw_clip(c->fbo[0], textureID, true);
if (!c->media->to_footage()->alpha_is_premultiplied) {
// alpha is not premultiplied, we'll need to multiply it for the rest of the pipeline
params.premultiply_program->bind();
params.premultiply_program->release();
textureID = draw_clip(c->fbo[0], textureID, true);
params.premultiply_program->release();
fbo_switcher = true;
}
// convert to linear colorspace
#ifdef OLIVE_OCIO
bool linear_convert = true;
if (linear_convert)
{
OCIO::ConstConfigRcPtr config = OCIO::GetCurrentConfig();
const char* g_display = config->getDefaultDisplay();
const char* g_transformName = config->getDefaultView(g_display);
const char* g_inputColorSpace = OCIO::ROLE_SCENE_LINEAR;
std::string cs = config->parseColorSpaceFromString("srgb");
if (!cs.empty()) {
g_inputColorSpace = cs.c_str();
}
}
#endif
fbo_switcher = true;
}
}
+40 -40
View File
@@ -39,55 +39,55 @@ const int LUT3D_EDGE_SIZE = 32;
const int NUM_3D_ENTRIES = 98304;
class RenderThread : public QThread {
Q_OBJECT
Q_OBJECT
public:
RenderThread();
~RenderThread();
void run();
QMutex mutex;
GLuint front_buffer;
GLuint front_texture;
EffectPtr gizmos;
void paint();
void start_render(QOpenGLContext* share, SequencePtr s, const QString &save = nullptr, GLvoid *pixels = nullptr, int pixel_linesize = 0, int idivider = 0);
bool did_texture_fail();
void cancel();
RenderThread();
~RenderThread();
void run();
QMutex mutex;
GLuint front_buffer;
GLuint front_texture;
EffectPtr gizmos;
void paint();
void start_render(QOpenGLContext* share, SequencePtr s, const QString &save = nullptr, GLvoid *pixels = nullptr, int pixel_linesize = 0, int idivider = 0);
bool did_texture_fail();
void cancel();
public slots:
// cleanup functions
void delete_ctx();
// cleanup functions
void delete_ctx();
signals:
void ready();
void ready();
private:
// cleanup functions
void delete_texture();
void delete_fbo();
void delete_shader_program();
// cleanup functions
void delete_texture();
void delete_fbo();
void delete_shader_program();
QWaitCondition waitCond;
QOffscreenSurface surface;
QOpenGLContext* share_ctx;
QOpenGLContext* ctx;
QOpenGLShaderProgram* blend_mode_program;
QOpenGLShaderProgram* premultiply_program;
QWaitCondition waitCond;
QOffscreenSurface surface;
QOpenGLContext* share_ctx;
QOpenGLContext* ctx;
QOpenGLShaderProgram* blend_mode_program;
QOpenGLShaderProgram* premultiply_program;
GLuint back_buffer_1;
GLuint back_buffer_2;
GLuint back_texture_1;
GLuint back_texture_2;
GLuint back_buffer_1;
GLuint back_buffer_2;
GLuint back_texture_1;
GLuint back_texture_2;
float ocio_lut_data[NUM_3D_ENTRIES];
float ocio_lut_data[NUM_3D_ENTRIES];
SequencePtr seq;
int divider;
int tex_width;
int tex_height;
bool queued;
bool texture_failed;
bool running;
QString save_fn;
GLvoid *pixel_buffer;
int pixel_buffer_linesize;
SequencePtr seq;
int divider;
int tex_width;
int tex_height;
bool queued;
bool texture_failed;
bool running;
QString save_fn;
GLvoid *pixel_buffer;
int pixel_buffer_linesize;
};
#endif // RENDERTHREAD_H