Skip to content

Commit

Permalink
added settings for bit depth
Browse files Browse the repository at this point in the history
  • Loading branch information
itsmattkc committed Mar 20, 2019
1 parent 9b2b7bc commit 9c920cf
Show file tree
Hide file tree
Showing 5 changed files with 122 additions and 2 deletions.
21 changes: 21 additions & 0 deletions dialogs/preferencesdialog.cpp
Expand Up @@ -48,6 +48,7 @@
#include "global/config.h"
#include "global/path.h"
#include "rendering/audio.h"
#include "rendering/bitdepths.h"
#include "panels/panels.h"
#include "ui/mainwindow.h"

Expand Down Expand Up @@ -942,6 +943,26 @@ void PreferencesDialog::setup_ui() {

row++;

// COLOR MANAGEMENT -> Playback Bit Depth
QComboBox* playback_bit_depth = new QComboBox();
for (int i=0;i<olive::rendering::bit_depths.size();i++) {
playback_bit_depth->addItem(olive::rendering::bit_depths.at(i).name, i);
}
color_management_layout->addWidget(new QLabel("Playback Bit Depth:"), row, 0);
color_management_layout->addWidget(playback_bit_depth, row, 1);

row++;

// COLOR MANAGEMENT -> Rendering Bit Depth
QComboBox* rendering_bit_depth = new QComboBox();
for (int i=0;i<olive::rendering::bit_depths.size();i++) {
rendering_bit_depth->addItem(olive::rendering::bit_depths.at(i).name, i);
}
color_management_layout->addWidget(new QLabel("Rendering Bit Depth:"), row, 0);
color_management_layout->addWidget(rendering_bit_depth, row, 1);

row++;

#ifdef NO_OCIO
enable_color_management->setEnabled(false);
ocio_config_file->setEnabled(false);
Expand Down
4 changes: 4 additions & 0 deletions main.cpp
Expand Up @@ -24,6 +24,7 @@
#include "global/config.h"
#include "global/global.h"
#include "panels/timeline.h"
#include "rendering/bitdepths.h"
#include "ui/mediaiconservice.h"
#include "ui/mainwindow.h"

Expand Down Expand Up @@ -131,6 +132,9 @@ int main(int argc, char *argv[]) {
// multiply track height constants by the current DPI scale
olive::timeline::MultiplyTrackSizesByDPI();

// set up rendering bit depths
olive::rendering::InitializeBitDepths();

// connect main window's first paint to global's init finished function
QObject::connect(&w, SIGNAL(finished_first_paint()), olive::Global.get(), SLOT(finished_initialize()));

Expand Down
6 changes: 4 additions & 2 deletions olive.pro
Expand Up @@ -174,7 +174,8 @@ SOURCES += \
effects/internal/richtexteffect.cpp \
ui/blur.cpp \
ui/menu.cpp \
rendering/qopenglshaderprogramptr.cpp
rendering/qopenglshaderprogramptr.cpp \
rendering/bitdepths.cpp

HEADERS += \
ui/mainwindow.h \
Expand Down Expand Up @@ -302,7 +303,8 @@ HEADERS += \
effects/internal/richtexteffect.h \
ui/blur.h \
ui/menu.h \
rendering/qopenglshaderprogramptr.h
rendering/qopenglshaderprogramptr.h \
rendering/bitdepths.h

FORMS +=

Expand Down
51 changes: 51 additions & 0 deletions rendering/bitdepths.cpp
@@ -0,0 +1,51 @@
/***
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/>.
***/

#include "bitdepths.h"

#include <QCoreApplication>

namespace olive {
namespace rendering {

QVector<BitDepthInfo> bit_depths;

void InitializeBitDepths() {
BitDepthInfo bdi;

bdi.name = QCoreApplication::translate("bitdepths", "8-bit");
bdi.pixel_type = GL_UNSIGNED_BYTE;
bdi.internal_format = GL_RGBA8;
bit_depths.append(bdi);

bdi.name = QCoreApplication::translate("bitdepths", "Half-Float (16-bit)");
bdi.pixel_type = GL_HALF_FLOAT;
bdi.internal_format = GL_RGBA16F;
bit_depths.append(bdi);

bdi.name = QCoreApplication::translate("bitdepths", "Full-Float (32-bit)");
bdi.pixel_type = GL_FLOAT;
bdi.internal_format = GL_RGBA32F;
bit_depths.append(bdi);
}

}
}

42 changes: 42 additions & 0 deletions rendering/bitdepths.h
@@ -0,0 +1,42 @@
/***
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/>.
***/

#ifndef BITDEPTHS_H
#define BITDEPTHS_H

#include <QString>
#include <QVector>
#include <QOpenGLExtraFunctions>

namespace olive {
namespace rendering {
struct BitDepthInfo {
QString name;
GLuint pixel_type;
GLuint internal_format;
};

extern QVector<BitDepthInfo> bit_depths;

void InitializeBitDepths();
}
}

#endif // BITDEPTHS_H

0 comments on commit 9c920cf

Please sign in to comment.